/* =========================================================
   Рассказчик Брендон — Design System
   ========================================================= */

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);
  --bg-glass-active: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(232, 30, 140, 0.12);
  --border-glass-hover: rgba(232, 30, 140, 0.25);
  --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(232, 30, 140, 0.06);
  --shadow-glass-hover: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(232, 30, 140, 0.12);

  --pink: #e91e8c;
  --pink-light: #ff6b9d;
  --pink-gradient: linear-gradient(135deg, #e91e8c, #ff6b9d);
  --pink-gradient-subtle: linear-gradient(135deg, rgba(232, 30, 140, 0.15), rgba(255, 107, 157, 0.08));
  --pink-glow: 0 0 24px rgba(232, 30, 140, 0.3), 0 0 48px rgba(232, 30, 140, 0.1);

  --text-primary: #efeff5;
  --text-secondary: #8888a0;
  --text-muted: #555570;
  --text-on-pink: #ffffff;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --z-base: 1;
  --z-glass: 10;
  --z-modal: 100;
  --z-toast: 1000;

  --tg-safe-area-top: env(safe-area-inset-top, 0px);
  --tg-safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* ---- Reset ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  padding-top: var(--tg-safe-area-top);
  padding-bottom: var(--tg-safe-area-bottom);
  line-height: 1.6;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-glass);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--pink);
}

/* ---- Selection ---- */
::selection {
  background: rgba(232, 30, 140, 0.3);
  color: var(--text-primary);
}

/* ---- Glass Card ---- */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-glass);
  transition: all var(--transition-normal);
}

.glass:hover {
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-glass-hover);
}

.glass-sm {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glass);
}

/* ---- Glass panel variant for full sections ---- */
.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-glass);
  transition: all var(--transition-normal);
}

.glass-panel:hover {
  border-color: var(--border-glass-hover);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--pink-gradient);
  color: var(--text-on-pink);
  box-shadow: 0 4px 16px rgba(232, 30, 140, 0.2);
}
.btn-primary:hover {
  box-shadow: var(--pink-glow);
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(232, 30, 140, 0.2);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.btn-icon {
  padding: 10px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---- Inputs ---- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-field {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: all var(--transition-normal);
  width: 100%;
}

.input-field:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(232, 30, 140, 0.1);
  background: var(--bg-glass-hover);
}

.input-field::placeholder {
  color: var(--text-muted);
}

textarea.input-field {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%238888a0'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

select.input-field option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ---- Radio / Chip Selectors ---- */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.chip:hover {
  border-color: var(--border-glass-hover);
  color: var(--text-primary);
}

.chip.selected {
  background: var(--pink-gradient);
  border-color: transparent;
  color: var(--text-on-pink);
  box-shadow: 0 4px 12px rgba(232, 30, 140, 0.2);
}

/* ---- Character card ---- */
.character-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all var(--transition-normal);
}

.character-card:hover {
  border-color: var(--border-glass-hover);
  background: var(--bg-glass-hover);
}

.character-card .char-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.character-card .char-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--pink-light);
}

.character-card .char-fields {
  display: grid;
  gap: 10px;
}

/* ---- Page transitions ---- */
.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 8px rgba(232, 30, 140, 0.2); }
  50% { box-shadow: 0 0 20px rgba(232, 30, 140, 0.4); }
}

@keyframes typing {
  0% { transform: translateY(0); }
  25% { transform: translateY(-6px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-3px); }
  100% { transform: translateY(0); }
}

@keyframes glassShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ---- Shimmer loading effect ---- */
.loading-shimmer {
  background: linear-gradient(
    90deg,
    var(--bg-glass) 25%,
    var(--bg-glass-hover) 50%,
    var(--bg-glass) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ---- App Shell ---- */
.app-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---- Header ---- */
.app-header {
  text-align: center;
  padding: 40px 0 32px;
  animation: slideUp 0.5s ease;
}

.app-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.app-logo svg {
  width: 64px;
  height: 64px;
}

.app-title {
  font-size: 1.6rem;
  font-weight: 200;
  letter-spacing: 0.02em;
  background: var(--pink-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.app-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---- Mode Selector ---- */
.mode-selector {
  display: grid;
  gap: 16px;
  padding: 16px 0;
}

.mode-card {
  padding: 28px 24px;
  cursor: pointer;
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--pink-gradient-subtle);
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.mode-card:hover::before {
  opacity: 0.6;
}

.mode-card:hover {
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
}

.mode-card .mode-icon {
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
  color: var(--pink-light);
}

.mode-card .mode-icon svg {
  width: 40px;
  height: 40px;
}

.mode-card h3 {
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.mode-card p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  font-weight: 300;
}

/* ---- Step indicators ---- */
.steps {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 28px;
  padding: 8px 0;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: all var(--transition-normal);
}

.step-dot.active {
  background: var(--pink);
  box-shadow: 0 0 8px rgba(232, 30, 140, 0.5);
  width: 24px;
  border-radius: 4px;
}

.step-dot.completed {
  background: var(--pink-light);
  opacity: 0.6;
}

/* ---- Forms layout ---- */
.form-section {
  animation: slideUp 0.4s ease;
}

.form-section h2 {
  font-size: 1.3rem;
  font-weight: 400;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.form-section .section-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-weight: 300;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border-glass);
}

/* ---- Add character card ---- */
.add-character-area {
  border: 2px dashed var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.add-character-area:hover {
  border-color: var(--pink);
  background: rgba(232, 30, 140, 0.04);
}

.add-character-area svg {
  width: 28px;
  height: 28px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.add-character-area span {
  display: block;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ---- Generation progress ---- */
.generation-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 0;
}

.generation-animation {
  width: 80px;
  height: 80px;
  margin-bottom: 24px;
  position: relative;
}

.generation-animation svg {
  width: 80px;
  height: 80px;
  animation: glow 2s ease-in-out infinite;
}

.generation-status {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 300;
  margin-bottom: 8px;
}

.generation-progress {
  width: 200px;
  height: 2px;
  background: var(--border-glass);
  border-radius: 2px;
  overflow: hidden;
}

.generation-progress .bar {
  height: 100%;
  width: 0%;
  background: var(--pink-gradient);
  transition: width 0.5s ease;
  border-radius: 2px;
}

/* ---- Story result ---- */
.story-result {
  padding: 24px;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.8;
  color: var(--text-primary);
  max-height: 60vh;
  overflow-y: auto;
}

/* ---- Chat interface ---- */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  height: calc(100dvh - 200px);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-message {
  display: flex;
  gap: 12px;
  animation: slideUp 0.3s ease;
}

.chat-message.user {
  justify-content: flex-end;
}

.chat-message .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--pink-gradient);
  color: var(--text-on-pink);
  font-size: 0.75rem;
  font-weight: 600;
}

.chat-message.user .avatar {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.chat-message .bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  /* Shrink-to-fit: запасной вариант если WebView не поддерживает width:fit-content */
  display: table;
  width: auto;
}

.chat-message.assistant .bubble {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.chat-message.user .bubble {
  background: var(--pink-gradient);
  color: var(--text-on-pink);
  border-bottom-right-radius: 4px;
  /* User баблы более компактные */
  padding: 6px 12px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.chat-message.assistant .bubble {
  border-bottom-left-radius: 4px;
}

.chat-message .bubble .char-name-label {
  font-size: 0.75rem;
  color: var(--pink-light);
  font-weight: 600;
  margin-bottom: 4px;
  display: block;
}

/* ---- Typing indicator ---- */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-items: center;
}

.typing-indicator .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pink-light);
  animation: typing 1s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-indicator .dot:nth-child(3) {
  animation-delay: 0.3s;
}

/* ---- Chat input ---- */
.chat-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-glass);
}

.chat-input-area .input-field {
  flex: 1;
  border-radius: var(--radius-md);
}

.chat-input-area .btn {
  border-radius: var(--radius-md);
  aspect-ratio: 1;
}

/* Expandable textarea in chat */
.chat-input-field {
  flex: 1;
  border-radius: var(--radius-md) !important;
  resize: none !important;
  overflow-y: auto;
  max-height: 120px;
  min-height: 44px;
  padding: 12px 16px !important;
  line-height: 1.4 !important;
  min-width: 0;
}

.chat-input-field::-webkit-scrollbar {
  width: 3px;
}

/* ---- Commands help ---- */
.commands-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 8px 4px;
  cursor: pointer;
}

.commands-hint:hover {
  color: var(--text-secondary);
}

.commands-dropdown {
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 8px;
  font-size: 0.8rem;
}

.commands-dropdown .cmd {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-glass);
}

.commands-dropdown .cmd:last-child {
  border-bottom: none;
}

.commands-dropdown .cmd code {
  color: var(--pink-light);
  font-family: var(--font-sans);
  font-weight: 500;
}

.commands-dropdown .cmd span {
  color: var(--text-muted);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  z-index: var(--z-toast);
  opacity: 0;
  transition: all var(--transition-slow);
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.success {
  border-color: var(--pink);
  color: var(--pink-light);
}

/* ---- Prompt editor ---- */
.prompt-editor {
  width: 100%;
  min-height: 200px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  padding: 16px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.6;
  resize: vertical;
}

.prompt-editor:focus {
  outline: none;
  border-color: var(--pink);
}

/* ---- Settings link ---- */
.settings-link {
  position: fixed;
  top: calc(12px + var(--tg-safe-area-top));
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-normal);
  z-index: var(--z-glass);
}

.settings-link:hover {
  border-color: var(--pink);
  background: var(--bg-glass-hover);
}

.settings-link svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

/* ---- Back button ---- */
.back-btn {
  position: fixed;
  top: calc(12px + var(--tg-safe-area-top));
  left: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-normal);
  z-index: var(--z-glass);
}

.back-btn:hover {
  border-color: var(--pink);
  background: var(--bg-glass-hover);
}

.back-btn svg {
  width: 18px;
  height: 18px;
  color: var(--text-secondary);
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 0.9rem;
  font-weight: 300;
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .app-container {
    padding: 12px 12px 32px;
  }

  .app-header {
    padding: 24px 0 20px;
  }

  .app-title {
    font-size: 1.3rem;
  }

  .glass-panel {
    padding: 20px;
  }

  .mode-card {
    padding: 20px;
  }

  .chat-container {
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px);
  }

  .chat-message .bubble {
    max-width: 90%;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }

  .back-btn, .settings-link {
    top: calc(8px + var(--tg-safe-area-top));
  }
}

/* ---- Personality grid (for xxx mode) ---- */
.personality-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 16px;
}

@media (max-width: 400px) {
  .personality-grid {
    grid-template-columns: 1fr;
  }
}

.personality-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.personality-card:hover {
  border-color: var(--border-glass-hover);
  background: var(--bg-glass-hover);
}

.personality-card.selected {
  border-color: var(--pink);
  background: var(--pink-gradient-subtle);
  box-shadow: 0 0 12px rgba(232, 30, 140, 0.15);
}

.personality-card .personality-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.personality-card .personality-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ---- Chat header (for xxx mode) ---- */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-glass);
  margin-bottom: 8px;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-header-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--pink-light);
}

.chat-header-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 300;
}

.chat-header-actions {
  display: flex;
  gap: 8px;
}

/* ---- Xxx session list overlay ---- */
.session-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  animation: slideUp 0.25s ease;
}

.session-overlay-content {
  width: 100%;
  max-height: 60vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 20px;
  overflow-y: auto;
  border-top: 1px solid var(--border-glass);
}

.session-overlay-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 16px;
  text-align: center;
}

/* ---- Saved session cards ---- */
.saved-session-card {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  border-color: var(--border-glass);
}

.saved-session-card:hover {
  transform: translateY(-1px);
  border-color: rgba(232, 30, 140, 0.25);
}

.saved-session-card .session-card-main {
  transition: color 0.2s ease;
}

.saved-session-card:hover .session-card-main > div:first-child {
  color: var(--pink-light);
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .page.active {
    animation: none;
  }
}

/* ---- Home footer links ---- */
.home-footer {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-normal);
}

.footer-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.footer-link svg {
  width: 16px;
  height: 16px;
}

/* ---- Role badge ---- */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.role-default {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
}

.role-premium {
  background: linear-gradient(135deg, rgba(232,30,140,0.2), rgba(255,107,157,0.1));
  border: 1px solid var(--pink);
  color: var(--pink-light);
}

.role-legend {
  background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,165,0,0.1));
  border: 1px solid #ffd700;
  color: #ffd700;
}

.role-admin {
  background: linear-gradient(135deg, rgba(0,200,255,0.2), rgba(0,150,255,0.1));
  border: 1px solid #00c8ff;
  color: #00c8ff;
}

/* ---- Limit bar ---- */
.limit-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-glass);
  border-radius: 3px;
  overflow: hidden;
}

.limit-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ---- Admin user list ---- */
.admin-user-list {
  display: grid;
  gap: 12px;
}

.admin-user-card {
  padding: 20px;
}

.admin-user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--transition-normal);
}

.btn-sm:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
  color: var(--text-primary);
}

/* ---- Additional utility states ---- */
.hidden {
  display: none !important;
}
