/* ==========================================================================
   OPIc AI — Fresh & Dynamic Theme (bright, airy, playful)
   Loads AFTER styles.css → overrides tokens + key components.
   Palette: sky-indigo → violet gradient, mint/amber accents, white glassy chrome.
   ========================================================================== */

/* ==========================================================================
   OPIc AI — Fresh & Dynamic Theme theo UI_DESIGN_STANDARD.md
   (Claymorphism + learning indigo; tokens: purple #6c5ce7, Nunito, 44px, 12-14px)
   Loads AFTER styles.css → overrides tokens + key components.
   ========================================================================== */

:root {
  color-scheme: light;

  /* UI_DESIGN_STANDARD — màu sắc chính */
  --purple-primary: #6c5ce7;
  --purple-hover: #5b4cc4;
  --purple-light: #f0eeff;
  --purple-border: #e6e1fc;
  --app-bg: #f6f5fd;

  /* Aliases giữ tương thích token cũ */
  --surface: #ffffff;
  --surface-subtle: #f6f5fd;
  --border: #e6e1fc;
  --border-light: #efeaf8;
  --primary: #6c5ce7;
  --primary-hover: #5b4cc4;
  --primary-light: #f0eeff;
  --primary-text: #5b4cc4;
  --text-main: #2d2942;
  --text-body: #2d2942;
  --text-muted: #6b6781;
  --text-subtle: #6b6781;

  /* UI_DESIGN_STANDARD — cỡ chữ chuẩn */
  --fs-2xs: 12px;
  --fs-xs: 13px;
  --fs-sm: 14px;
  --fs-base: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 28px;
  --fs-3xl: 32px;

  /* Accents — fresh (CTA green chuẩn skill) */
  --accent-cyan: #0EA5E9;
  --accent-cyan-light: #E0F2FE;
  --accent-cyan-border: #BAE6FD;
  --accent-green: #22C55E;
  --accent-green-hover: #16A34A;
  --accent-green-light: #DCFCE7;
  --accent-green-text: #15803D;
  --accent-purple: #818CF8;
  --accent-purple-light: #f0eeff;
  --accent-purple-text: #6c5ce7;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #6c5ce7 0%, #818CF8 100%);
  --grad-primary-soft: linear-gradient(135deg, #f0eeff 0%, #e9e4ff 55%, #fff6ec 100%);
  --grad-cyan: linear-gradient(135deg, #0EA5E9 0%, #22C55E 100%);
  --grad-bar: linear-gradient(90deg, #6c5ce7 0%, #818CF8 100%);

  /* Claymorphism shadows — double: inner white + outer purple tint */
  --shadow-sm: 0 1px 2px rgba(108, 92, 231, 0.05), 0 10px 24px -10px rgba(108, 92, 231, 0.10);
  --shadow-md: 0 2px 4px rgba(108, 92, 231, 0.05), 0 14px 36px -12px rgba(108, 92, 231, 0.14);
  --shadow-lg: 0 10px 44px -8px rgba(108, 92, 231, 0.22);
  --shadow-clay: 8px 8px 20px rgba(108, 92, 231, 0.08), -6px -6px 16px rgba(255, 255, 255, 0.9);
  --shadow-clay-press: inset 4px 4px 10px rgba(108, 92, 231, 0.10), inset -4px -4px 10px rgba(255, 255, 255, 0.8);

  /* Fonts — heading Baloo 2, body Nunito (UI_DESIGN_STANDARD) */
  --font-heading: 'Baloo 2', 'Nunito', 'Segoe UI', sans-serif;
  --font-sans: 'Nunito', 'Segoe UI', system-ui, sans-serif;

  /* Layout — sidebar 260px, header 72-80px (UI_DESIGN_STANDARD) */
  --sidebar-width: 260px;
  --header-height: 76px;

  /* Control sizing — 44px chuẩn */
  --control-h: 44px;
  --control-radius: 12px;
}

/* Bright airy canvas theo chuẩn */
html, body, #app-container {
  background: linear-gradient(160deg, #f6f5fd 0%, #FDFEFF 48%, #fff8f2 100%) fixed;
}
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
}

/* Headings — Baloo 2, hierarchy theo UI_DESIGN_STANDARD (H1 28/H2 22/H3 18) */
h1, h2, h3,
.page-title, .card-title, .brand-title, .section-title {
  font-family: var(--font-heading);
  color: var(--text-main);
  letter-spacing: -0.01em;
}
h1, .page-title { font-size: var(--fs-2xl); font-weight: 800; line-height: 1.25; }
h2 { font-size: var(--fs-xl); font-weight: 700; line-height: 1.25; }
h3 { font-size: var(--fs-lg); font-weight: 700; line-height: 1.25; }
.topbar-title { font-family: var(--font-heading); }

/* Focus — vòng outline rõ tối thiểu 2px (UI_DESIGN_STANDARD 7.3) */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Sidebar — light glassy, dynamic gradient active pill
   ========================================================================== */
.sidebar {
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-light);
}

.brand-title { color: var(--text-main); }
.brand-subtitle {
  color: var(--primary, #4F46E5);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.brand-badge-ai { background: var(--grad-cyan); color: #FFFFFF; }
.brand-icon {
  background: var(--grad-primary);
  box-shadow: 0 4px 14px rgba(79, 140, 255, 0.38);
}

.nav-item {
  color: var(--text-muted);
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.nav-item:hover {
  background-color: var(--primary-light);
  color: var(--primary-text);
}
.exam-locked #sidebar .nav-item {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.55;
}

.nav-item.active {
  background: var(--grad-primary);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(79, 140, 255, 0.38);
}

.lang-selector-label { color: var(--text-subtle); }
.lang-pills {
  background-color: var(--surface-subtle);
  border: 1px solid var(--border-light);
}
.lang-pill {
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.lang-pill:hover { color: var(--primary-text); }
.lang-pill.active {
  background: var(--grad-primary);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(79, 140, 255, 0.4);
}

.sidebar-footer {
  background: transparent;
  border-top: 1px solid var(--border-light);
}

/* ==========================================================================
   Topbar — glassy white
   ========================================================================== */
.topbar {
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-light);
}

.exam-time-chip {
  background: var(--grad-primary);
}

/* ==========================================================================
   Cards — panel chuẩn UI_DESIGN_STANDARD: trắng, radius 16px, border 1px
   + clay double shadow nhẹ
   ========================================================================== */
.card {
  border-radius: 16px;
  border: 1px solid var(--border-light);
  box-shadow: 0 4px 20px rgba(108, 92, 231, 0.05);
}
.card:hover { box-shadow: var(--shadow-md); }

.card.accent,
.q-bubble.accent {
  border-color: var(--purple-border);
  background: var(--grad-primary-soft);
}

/* ==========================================================================
   Buttons — chuẩn UI_DESIGN_STANDARD: primary 44px/radius 12px/fs 14/w700
   + clay soft press (200ms ease-out)
   ========================================================================== */
.btn {
  min-height: 44px;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: var(--fs-sm);
  font-weight: 700;
  transition: background-color 0.2s ease-out, color 0.2s ease-out, box-shadow 0.2s ease-out,
    transform 0.2s ease-out, border-color 0.2s ease-out, filter 0.2s ease-out;
}

.btn-primary {
  background: var(--grad-primary);
  box-shadow: 0 4px 12px rgba(108, 92, 231, 0.3);
}
.btn-primary:hover {
  background: var(--grad-primary);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(108, 92, 231, 0.4);
}
.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(108, 92, 231, 0.28);
}

.btn-green {
  background: linear-gradient(135deg, #22C55E 0%, #0EA5E9 100%);
}
.btn-green:hover { background: linear-gradient(135deg, #16A34A 0%, #0284C7 100%); }
.btn-green:active { transform: translateY(1px); }

.btn-outline {
  border: 1px solid var(--purple-border);
}
.btn-outline:hover {
  background-color: var(--purple-light);
  border-color: #c9bcf5;
  color: var(--primary-text);
}

.btn.sm, .btn-tts-speaker {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 10px;
}

/* ==========================================================================
   Progress bars & gauge — gradient fill
   ========================================================================== */
.progress-bar-fill { background: var(--grad-bar); }
.progress-mini i { background: var(--grad-bar); }
.gauge-bg-circle { stroke: #EAF2FF; }

/* ==========================================================================
   Chips, pills, tiles — fresh accents
   ========================================================================== */
.topic-chip {
  background-color: var(--primary-light);
  border-color: #C7DBFF;
}
.diff-pill.active { background: var(--grad-primary); }
.speed-pill.active { background: var(--grad-primary); }

/* Collocation popover — replaced by the .dict-popover selection tooltip in
   styles.css, so the gradient card rule is no longer needed. */

/* Level circle badge */
.level-circle-badge {
  background: linear-gradient(135deg, #EAF2FF 0%, #F1EBFF 100%);
  border-color: #C7DBFF;
  color: var(--primary);
}

/* ==========================================================================
   Toast — fresh white with colored edge
   ========================================================================== */
.toast {
  background-color: #FFFFFF;
  color: var(--text-main);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-green);
  box-shadow: var(--shadow-lg);
}
.toast.err { border-left-color: var(--accent-red); }

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

/* ==========================================================================
   UI_DESIGN_STANDARD — sidebar nav item 44-48px, radius 12px, gap 8px
   ========================================================================== */
.sidebar-nav .nav-item {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 8px;
}
.sidebar-nav .nav-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ==========================================================================
   UI_DESIGN_STANDARD — form controls 44px, radius 12px, fs 14
   ========================================================================== */
.form-input, .form-select {
  min-height: 44px;
  border-radius: 12px;
  font-size: var(--fs-sm);
  border-color: var(--purple-border);
}
textarea.form-input { min-height: 0; }
.form-input:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}
.form-label { font-size: var(--fs-2xs); font-weight: 700; color: var(--text-muted); }

/* Main content padding 18-24px theo chuẩn */
.screen-content { padding: 20px 24px; }

/* Modal chuẩn UI_DESIGN_STANDARD 9.5: width 360-640, radius 16-20 */
.modal {
  min-width: 360px;
  max-width: 640px;
  border-radius: 18px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { font-size: var(--fs-lg); font-weight: 800; margin-bottom: 14px; }
.modal-overlay { background: rgba(45, 41, 66, 0.4); }

/* Nunito body line-height 1.5-1.65 */
p, li, .form-field, .hint { line-height: 1.55; }

/* UI_DESIGN_STANDARD — spacing: panels không sát nhau (section gap 16-20px) */
.settings-view { gap: 14px; }
.settings-group { gap: 14px; }
.settings-view .card { padding: 18px 20px; }
.form-field { gap: 6px; }
.settings-view .form-field { margin-bottom: 0; }

/* Topic list — gap rõ ràng + cursor pointer (hình bàn tay khi hover) */
.card.clickable, .topic-card, .feature, .test-tile, .dash-cta-card { cursor: pointer; }
.topics-list { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.topics-list .card:hover { transform: translateY(-2px); }

/* Mock test — tiles bắt mắt hơn (clay, gradient hover) */

.listen-question-card {
  background: var(--grad-primary-soft);
  border-color: var(--purple-border);
}

/* Section gaps đồng nhất 14-20px */
.exam-view { display: flex; flex-direction: column; gap: 14px; }
.dashboard-view { display: flex; flex-direction: column; gap: 20px; }
.results-view { display: flex; flex-direction: column; gap: 18px; }

/* ==========================================================================
   Practice layout — DevTools analysis: single column, gap 24, max 900px
   ========================================================================== */
.practice-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.practice-layout > .q-bubble.accent,
.practice-layout > .answer-editor-card,
.practice-layout > .controls-bar,
.practice-layout > .practice-controls-wrap {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
}

/* ===== Final visual overrides: dashboard OPIc info + official mock cards ===== */
.dash-opic-about { padding: 0; overflow: hidden; border: 1px solid #DDD6FE; background: linear-gradient(135deg, #FFFFFF 0%, #FAF8FF 100%); box-shadow: 0 10px 28px rgba(79,70,229,.08); }
.opic-about-summary { padding: 18px 20px; background: linear-gradient(100deg, #F5F3FF, #FFFFFF); border-bottom: 1px solid #EDE9FE; }
.opic-about-summary:hover { background: linear-gradient(100deg, #EDE9FE, #FFFFFF); }
.opic-about-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, #6366F1, #8B5CF6); color: #fff; font-size: 1.15rem; box-shadow: 0 5px 12px rgba(99,102,241,.25); }
.opic-about-title { font-size: 1.05rem; letter-spacing: -.01em; }
.opic-about-title::after { content: "  ·  ACTFL speaking test"; color: var(--text-muted); font-size: .72rem; font-weight: 700; }
.opic-about-arrow { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #EDE9FE; color: #6366F1; font-weight: 900; }
.opic-about-body { margin: 0; padding: 20px; border-top: 0; }
.opic-about-desc { max-width: 920px; font-size: .88rem; line-height: 1.7; }
.opic-level-ladder { gap: 10px; margin: 16px 0 18px; }
.opic-level-step { position: relative; min-width: 110px; padding: 13px 10px; background: #fff; border: 1px solid #E9D5FF; box-shadow: 0 4px 12px rgba(79,70,229,.06); transition: transform .18s ease, box-shadow .18s ease; }
.opic-level-step:hover { transform: translateY(-3px); box-shadow: 0 8px 18px rgba(79,70,229,.14); }
.opic-level-code { font-size: 1.2rem; }
.opic-level-name { font-size: .7rem; font-weight: 700; }

.mock-select-page { max-width: 1120px; }

/* Topbar exam-flow strip (only on the mock-test route) */
.topbar-flow { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: .78rem; font-weight: 800; letter-spacing: .01em; color: var(--primary); }

/* Official test cards */
.official-tests-section { padding: 6px 0; }
.official-tests-heading { padding: 0 2px 10px; border-bottom: 1px solid var(--border); }
/* Official test list: one compact row per set — name, facts, result, action.
   Test and topic cards use auto-fill with a readable min card width, so
   narrow screens wrap to fewer columns instead of crushing the text.
   Dashboard shortcut cards keep their fixed 3/2/1 column rhythm. */
.topics-cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.test-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 14px; }
.topics-list.topics-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
@media (max-width: 900px) {
  .topics-cards-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .topics-cards-grid { grid-template-columns: 1fr; }
}
.test-tile.test-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; width: 100%; min-width: 0; box-sizing: border-box; padding: 12px 14px; text-align: left; color: var(--text-main); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease; }
.test-tile.test-row:hover { border-color: var(--purple-border); background: var(--purple-light); }
.test-tile.test-row.is-done { border-color: #C7D2FE; }
.test-row-main { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.test-row-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.test-name { font-size: .95rem; font-weight: 800; color: var(--text-main); white-space: nowrap; }
.test-score { padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.test-score.score-good { background: #DCFCE7; color: #15803D; }
.test-score.score-mid { background: #FEF3C7; color: #B45309; }
.test-score.score-low { background: #FEE2E2; color: #B91C1C; }
.test-score.is-new { background: var(--surface-subtle); color: var(--text-muted); font-weight: 700; }
/* Facts line: question count, total time, question types. */
.test-facts { display: flex; flex-wrap: wrap; gap: 10px; font-size: .76rem; color: var(--text-muted); }
/* Per-level pass/fail tally from the last graded run. */
.test-results { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; font-size: .74rem; }
.test-results-label { font-weight: 700; color: var(--text-muted); }
.test-line { display: inline-flex; align-items: baseline; gap: 4px; }
.test-line b { font-weight: 800; color: var(--text-main); }
.test-line .ok { color: #15803D; font-weight: 700; }
.test-line .no { color: #B91C1C; font-weight: 700; }
.test-start-btn { flex-shrink: 0; min-width: 104px; min-height: 34px; padding: 7px 14px; border: 1px solid var(--purple-border); border-radius: 9px; color: var(--primary-text); background: var(--purple-light); font-size: .78rem; font-weight: 800; cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease; }
.test-start-btn:hover, .test-start-btn:focus-visible { background: var(--primary); border-color: var(--primary); color: #fff; }
.test-start-btn:active { transform: translateY(1px); }
/* Narrow cards: text stacks above the action. flex-wrap drops the start
   button below the content when the card is too tight; on small screens the
   row becomes a column with a full-width button. */
@media (max-width: 600px) {
  .test-tile.test-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .test-tile.test-row .test-start-btn { width: 100%; }
}
@media (max-width: 600px) { .test-grid { grid-template-columns: 1fr; } .official-tests-heading { align-items: flex-start; flex-direction: column; gap: 8px; } .opic-level-step { min-width: 72px; } .opic-about-title::after { display: none; } }
.practice-layout { align-items: stretch; }
.practice-layout > .answer-editor-card, .practice-layout > .controls-bar, .practice-layout > .practice-controls-wrap { width: min(100%, 760px); margin-left: auto; }
.practice-controls-wrap .controls-bar { justify-content: flex-end !important; }
.answer-editor-card { width: min(100%, 760px); margin-left: auto; }
.answer-editor-card .ai-tools-group { justify-content: flex-end; margin-top: 0; }
.answer-editor-card .controls-bar { justify-content: flex-end !important; }
.circular-timer-wrap > div { width: 78px !important; height: 78px !important; }
.circular-timer-wrap > div svg { width: 72px !important; height: 72px !important; }
.circular-timer-wrap > div > span { font-size: 16px !important; }
.exam-time-chip { min-width: 132px; padding: 8px 14px; font-size: .95rem; text-align: center; font-variant-numeric: tabular-nums; }
.answer-editor-card .custom-prompt-wrap { text-align: left; margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-subtle); }
.answer-editor-card .custom-prompt-wrap input, .answer-editor-card .custom-prompt-wrap textarea { text-align: left; }
.custom-prompt-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.custom-prompt-icon { font-size: .95rem; }
.custom-prompt-label { font-size: .8rem; font-weight: 800; color: var(--text-main); }
.custom-prompt-input { width: 100%; min-height: 62px; resize: vertical; }
.custom-prompt-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.custom-prompt-hint { font-size: .74rem; color: var(--text-muted); flex: 1 1 180px; }
.custom-prompt-run { flex-shrink: 0; }

/* Saved-prompt chips: one tap fills the prompt field. */
.prompt-preset-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.prompt-preset-label { font-size: .74rem; font-weight: 800; color: var(--text-muted); }
.prompt-chip { display: inline-flex; align-items: stretch; border: 1px solid var(--purple-border); border-radius: 999px; overflow: hidden; background: var(--purple-light); max-width: 100%; }
.prompt-chip-text { border: 0; background: transparent; color: var(--primary-text); font-size: .74rem; font-weight: 600; padding: 4px 10px; cursor: pointer; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prompt-chip-text:hover { background: var(--purple-border); }
.prompt-chip-del { border: 0; border-left: 1px solid var(--purple-border); background: transparent; color: #DC2626; font-size: .7rem; cursor: pointer; padding: 0 7px; }
.prompt-chip-del:hover { background: rgba(239,68,68,.12); }
.prompt-chip-add { border: 1px dashed var(--primary); background: transparent; color: var(--primary); font-size: .74rem; font-weight: 700; border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.prompt-chip-add:hover { background: var(--purple-light); }
.reading-ai-topic-btn { white-space: nowrap; }
.topic-card { min-height: 0; }
.topic-card .topic-thumbnail { height: 108px; }
.topic-card-body { padding: 12px 14px; gap: 5px; }
.topic-card-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: .78rem; line-height: 1.35; }
.topic-card-name { font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topics-list.topics-grid .card { min-height: 0; }
.user-avatar-wrap { width: 44px; height: 44px; padding: 2px; background: linear-gradient(135deg,#6366F1,#A855F7); box-shadow: 0 3px 10px rgba(99,102,241,.25); }
.user-avatar { border-radius: 50%; background: #fff; }
/* Avatar Picker styles */
.avatar-picker-section { width: 100%; margin-top: 4px; }
.avatar-picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 12px; }
.avatar-picker-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 8px; border: 2px solid var(--border); border-radius: 16px;
  background: var(--surface); cursor: pointer; transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
  user-select: none;
}
.avatar-picker-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(108,92,231,.12); }
.avatar-picker-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.avatar-picker-card.active { border-color: var(--primary); background: var(--purple-light); box-shadow: 0 4px 14px rgba(108,92,231,.18); }
.avatar-picker-img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.avatar-upload-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.4rem; background: var(--surface-subtle); border: 2px dashed var(--border); }
.avatar-picker-label { font-size: 0.76rem; font-weight: 800; color: var(--text-main); text-align: center; }
.avatar-check-badge { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 11px; font-weight: 900; display: grid; place-items: center; }
.avatar-upload-btn { margin-top: 2px; font-size: 0.68rem; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--primary); color: var(--primary); background: transparent; cursor: pointer; }

/* Settings: use full workspace width and balanced configuration columns. */
.settings-view { width: min(100%, var(--page-max)); max-width: none; margin: 0 auto; gap: 14px; align-content: start; }
.settings-group { min-width: 0; gap: 14px; }
.settings-view .form-field { min-width: 0; }
.settings-view .form-input, .settings-view .form-select { width: 100%; box-sizing: border-box; }
@media (max-width: 900px) { .settings-fields { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .test-grid { grid-template-columns: 1fr; } .practice-layout > .answer-editor-card, .practice-layout > .controls-bar { width: 100%; } .settings-view .card { padding: 18px; } }

/* P1 shared page frame: every workspace page uses one readable content width.
   Practice stays narrower because answer editing benefits from shorter line length. */
:root {
  --page-max: 1120px;
  --topic-max: 920px;
  --practice-max: 820px;
  --page-gap: 18px;
}
.screen-content > .dashboard-view,
.screen-content > .topics-view,
.screen-content > .results-view,
.screen-content > .reading-arena-view,
.screen-content > .settings-view,
.screen-content > .mock-select-page,
.screen-content > .topic-practice-page,
.screen-content > .exam-view {
  width: min(100%, var(--page-max));
  margin-inline: auto;
}
.screen-content > .practice-layout,
.screen-content > .mocktest-view {
  width: min(100%, var(--page-max));
  max-width: none;
  margin-inline: auto;
}
.mock-select-page,
.reading-arena-view,
.settings-view,
.topic-practice-page {
  width: min(100%, var(--page-max));
  max-width: var(--page-max);
  margin-inline: auto;
}

/* Reduced-motion fallback for route transitions, hover lifts, timers and badges. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Small screens: preserve title and primary action, remove only secondary chrome. */
@media (max-width: 520px) {
  .topbar { padding-inline: 12px; gap: 8px; }
  .topbar-left { min-width: 0; gap: 8px; }
  .topbar-headings { min-width: 0; }
  #topbar-title { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #topbar-subtitle, .exam-counter-chip { display: none; }
  .topbar-right { gap: 8px; min-width: 0; }
  .exam-timer-bar { gap: 6px; }
  .exam-time-chip { min-width: 0; padding-inline: 9px; font-size: .82rem; }
  .screen-content { padding-inline: 16px; }
}

/* Decorative menu SVG should not be announced twice beside its labelled button. */
#mobile-menu-btn svg { pointer-events: none; }

/* Distributed controls bar — record group trái, Score primary phải */
.controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background-color: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: 16px;
}

/* Primary action — Score nổi bật (pill, bold, shadow) — defined below */

/* ===== Topic practice page redesign ===== */
.topic-practice-page {
  width: min(100%, var(--topic-max));
  max-width: var(--topic-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.topic-practice-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(120deg, #312E81, #4F46E5 58%, #7C3AED);
  box-shadow: 0 14px 30px rgba(49,46,129,.2);
}
.topic-practice-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  border-radius: 20px;
  background: rgba(255,255,255,.16);
  font-size: 2rem;
}
.topic-practice-toolbar .btn { min-height: 42px; }
.topic-practice-toolbar { width: 100%; }
.topic-practice-toolbar > .topic-question-filters { flex: 1; min-width: 0; }
.topic-practice-toolbar > .btn { min-width: 170px; }
.topic-practice-heading { min-width: 0; flex: 1; }
.topic-practice-kicker { margin-bottom: 4px; color: #C4B5FD; font-size: .68rem; font-weight: 900; letter-spacing: .13em; }
.topic-practice-heading h1 { margin: 0; color: #fff; font-size: 1.55rem; text-wrap: balance; }
.topic-practice-heading p { margin: 5px 0 0; color: rgba(255,255,255,.78); font-size: .84rem; }
.topic-practice-progress { width: 122px; flex: 0 0 122px; text-align: right; }
.topic-practice-progress strong { display: block; font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.topic-practice-progress span { display: block; margin: 5px 0 8px; color: rgba(255,255,255,.72); font-size: .72rem; }
.topic-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.2); }
.topic-progress-track i { display: block; height: 100%; border-radius: inherit; background: #A7F3D0; }
.topic-practice-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.topic-question-filters {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-subtle);
}
.topic-filter-btn {
  min-height: 34px;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.topic-filter-btn:hover, .topic-filter-btn:focus-visible { color: var(--primary); background: #fff; }
.topic-filter-btn.active { color: #fff; background: var(--primary); box-shadow: 0 4px 10px rgba(79,70,229,.2); }
.topic-question-grid {
  width: 100%;
  display: grid;
  gap: 12px;
}
.topic-question-card {
  display: grid;
  grid-template-columns: 52px minmax(0,1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  box-sizing: border-box;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.topic-question-card:hover {
  transform: translateY(-2px);
  border-color: #A5B4FC;
  box-shadow: 0 12px 26px rgba(79,70,229,.12);
}
.topic-question-card:focus-visible {
  outline: 3px solid rgba(99,102,241,.3);
  outline-offset: 2px;
}
.topic-question-index {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: var(--primary);
  background: #EEF2FF;
  font-size: .82rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.topic-question-main { min-width: 0; }
.topic-question-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 5px;
}
.topic-question-type { color: var(--primary); font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.topic-question-status { color: var(--text-muted); font-size: .7rem; font-weight: 700; }
.topic-question-status.is-done { color: #059669; }
.topic-question-text { color: var(--text-main); font-size: .94rem; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere; }
.topic-question-card .q-orig-text { margin-top: 4px; color: var(--text-muted); font-size: .75rem; line-height: 1.35; overflow-wrap: anywhere; }
.topic-question-actions { display: flex; align-items: center; gap: 4px; }
.topic-icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 9px; background: transparent; cursor: pointer; }
.topic-icon-btn:hover, .topic-icon-btn:focus-visible { background: #EEF2FF; }
.topic-icon-btn.danger:hover, .topic-icon-btn.danger:focus-visible { background: #FEF2F2; }
.topic-question-open { margin-left: 8px; color: var(--primary); font-size: .76rem; font-weight: 900; white-space: nowrap; }
.topic-empty-state { display: grid; justify-items: center; gap: 8px; padding: 40px 20px; border: 1px dashed #A5B4FC; border-radius: 16px; color: var(--text-muted); text-align: center; }
@media (max-width: 640px) { .topic-practice-hero { align-items: flex-start; padding: 20px; flex-wrap: wrap; } .topic-practice-icon { width: 52px; height: 52px; flex-basis: 52px; font-size: 1.5rem; } .topic-practice-heading h1 { font-size: 1.25rem; } .topic-practice-progress { width: 100%; flex-basis: 100%; text-align: left; } .topic-practice-progress strong { display: inline; margin-right: 5px; font-size: 1.3rem; } .topic-practice-progress span { display: inline; } .topic-question-card { grid-template-columns: 38px minmax(0,1fr); gap: 10px; padding: 12px; } .topic-question-index { width: 36px; height: 36px; border-radius: 10px; } .topic-question-actions { grid-column: 2; justify-content: flex-end; } .topic-question-open { margin-left: auto; } .topic-filter-btn { padding-inline: 8px; font-size: .7rem; } }

.btn-score-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 24px;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 800;
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-md);
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease-out, box-shadow 0.2s ease-out, transform 0.2s ease-out;
}
.btn-score-main:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.btn-score-main:active { transform: translateY(1px); }
.btn-score-main:disabled { opacity: 0.55; cursor: not-allowed; }

/* AI tools — primary-light phân biệt với action chính; một hàng, cuộn ngang nếu màn quá nhỏ */
.ai-tools-group { display: flex; gap: 12px; flex-wrap: nowrap; overflow-x: auto; min-width: 0; }
.ai-tools-group .btn {
  flex-shrink: 0;
  white-space: nowrap;
  background-color: var(--purple-light);
  color: var(--primary-text);
  border: 1px solid var(--purple-border);
}
.ai-tools-group .btn:hover {
  background-color: var(--purple-border);
  color: var(--text-main);
}

/* ===== Login Gate ===== */
@keyframes loginFloatSlow {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(-16px) scale(1.05); }
}
@keyframes loginFloatReverse {
  0%, 100% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(16px) scale(0.95); }
}
.login-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background-color: #f8fafc;
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}
.login-bg-blob-1 {
  position: absolute;
  top: -12%;
  left: -10%;
  width: 55vw;
  height: 55vw;
  max-width: 650px;
  max-height: 650px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(196, 181, 253, 0.45) 0%, rgba(224, 231, 255, 0.35) 60%, transparent 80%);
  filter: blur(55px);
  animation: loginFloatSlow 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.login-bg-blob-2 {
  position: absolute;
  bottom: -15%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  max-width: 700px;
  max-height: 700px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233, 213, 255, 0.45) 0%, rgba(252, 231, 243, 0.3) 60%, transparent 80%);
  filter: blur(55px);
  animation: loginFloatReverse 10s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.login-card {
  width: 100%;
  max-width: 460px;
  padding: 34px 36px 28px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 20px 50px -12px rgba(109, 40, 217, 0.12), 0 4px 16px -2px rgba(0, 0, 0, 0.04);
  position: relative;
  z-index: 1;
  text-align: center;
  box-sizing: border-box;
  animation: loginFadeIn 0.3s ease-out;
  transition: box-shadow 0.3s ease;
}
.login-card:hover {
  box-shadow: 0 25px 60px -12px rgba(109, 40, 217, 0.18), 0 6px 20px -2px rgba(0, 0, 0, 0.06);
}
@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header & Brand */
.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
}
.login-brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.login-mic-box {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 50%, #6366f1 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.28);
  flex-shrink: 0;
}
.login-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.login-title-brand {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.login-badge-ai {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 6px;
  background: #ede9fe;
  color: #7c3aed;
  letter-spacing: 0.04em;
}
.login-lang-control {
  background: rgba(241, 245, 249, 0.85);
  padding: 4px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.login-lang-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}
.login-lang-btn:hover {
  color: #0f172a;
}
.login-lang-btn.active {
  background: #ffffff;
  color: #7c3aed;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* Headings */
.login-headings {
  text-align: center;
  margin: 24px 0 22px;
}
.login-highlight-title {
  font-size: 1.55rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.025em;
  line-height: 1.32;
  margin: 0 0 8px;
}
.login-highlight-name {
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin: 0;
  font-weight: 400;
  line-height: 1.45;
}

/* Modern form fields with input icons */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}
.login-form .form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-form .form-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.login-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-input-wrap .form-input {
  width: 100%;
  height: 48px;
  padding: 0 42px 0 40px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  color: #0f172a;
  font-size: 0.92rem;
  font-family: inherit;
  transition: all 0.2s ease;
  box-sizing: border-box;
}
.login-input-wrap .form-input:focus {
  outline: none;
  background: #ffffff;
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
}
.login-input-wrap .form-input::placeholder {
  color: #94a3b8;
}
.login-eye-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s ease;
}
.login-eye-toggle-btn:hover {
  color: #475569;
}

/* Options row under password: remember me on left, create account link on right */
.login-options-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0 4px;
}
.login-remember-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  transition: color 0.15s ease;
}
.login-remember-wrap:hover {
  color: #0f172a;
}
.login-remember-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #7c3aed;
  border-radius: 4px;
  margin: 0;
}
.login-switch-link {
  background: transparent;
  border: none;
  color: #7c3aed;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: all 0.15s ease;
  font-family: inherit;
}
.login-switch-link:hover {
  color: #5b21b6;
  text-decoration: underline;
}

/* Submit button */
.login-submit {
  width: 100%;
  height: 48px;
  margin-top: 6px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #ffffff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: none;
  box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.4), 0 4px 10px -2px rgba(124, 58, 237, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}
.login-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #6d28d9 0%, #4f46e5 100%);
  box-shadow: 0 12px 28px -4px rgba(124, 58, 237, 0.48);
  transform: translateY(-1px);
}
.login-submit:active:not(:disabled) {
  transform: translateY(0);
}
.login-submit:disabled {
  opacity: 0.8;
  cursor: wait;
}

/* Spinner */
.login-spinner {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.login-switch-footer {
  text-align: center;
  margin: 6px 0 0;
  font-size: 12.5px;
  color: #64748b;
}

/* Trust Badge / Sub-footer */
.login-footer-trust {
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}
.login-trust-icon-box {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ecfdf5;
  color: #059669;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-pending-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 16px;
  padding: 24px 20px;
  text-align: center;
  margin: 12px 0;
}
.login-pending-icon { font-size: 36px; margin-bottom: 8px; }
.login-pending-title { font-size: 1.15rem; font-weight: 800; color: #92400e; margin: 0 0 6px; }
.login-pending-msg { font-size: 0.88rem; color: #b45309; margin: 0 0 16px; line-height: 1.5; }

/* ===== Role badges ===== */
.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.role-admin { background: #FEF3C7; color: #B45309; }
.role-user { background: #E0E7FF; color: #3730A3; }

/* ===== User list (admin) ===== */
.user-list { display: flex; flex-direction: column; gap: 8px; }
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  flex-wrap: wrap;
}
.user-name { font-weight: 700; font-size: 0.9rem; color: var(--text-main); }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Accounts window — per-user role selector stays compact inside the row */
.user-row .role-select { width: auto; min-width: 118px; flex: 0 1 auto; }

/* ===== Recordings list ===== */
.recordings-list-view { width: min(100%, var(--page-max)); margin: 0 auto; }
.recordings-list { display: flex; flex-direction: column; gap: 10px; }
.recording-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  transition: box-shadow 0.15s ease;
}
.recording-row:hover { box-shadow: var(--shadow-sm); }
.rec-main { min-width: 0; }
.rec-question { font-weight: 700; color: var(--text-main); font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-meta { display: flex; gap: 16px; margin-top: 4px; font-size: 0.78rem; color: var(--text-muted); }
.rec-actions { display: flex; align-items: center; gap: 10px; }
.play-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-light);
  color: var(--primary);
  border: none;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.play-btn:hover { background: var(--primary); color: #fff; transform: scale(1.06); }
.play-btn.playing { background: var(--accent-green); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.clip-score {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
}
.clip-score.score-good { background: var(--accent-green-light); color: var(--accent-green-text); }
.clip-score.score-mid { background: #FEF3C7; color: #B45309; }
.clip-score.score-low { background: #FEE2E2; color: #B91C1C; }
.clip-score.score-none { background: var(--surface-subtle); color: var(--text-muted); }

/* ===== Pending approval (login + admin) ===== */
.login-pending-box {
  display: none;
  text-align: center;
  padding: 8px 0 4px;
}
.login-pending-icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.login-pending-title { font-weight: 800; font-size: 1rem; margin: 0 0 6px; color: var(--text-main); }
.login-pending-msg { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 14px; }
.login-role-hint { color: var(--text-muted); font-size: 0.78rem; margin: 0; text-align: center; }
.pending-approvals {
  margin-bottom: 14px;
  padding: 12px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 12px;
}
.pending-approvals-title { font-weight: 800; font-size: 0.88rem; margin-bottom: 4px; color: #B45309; }
.pending-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: #FEF3C7;
  color: #B45309;
}

/* ===== Key input wrapper (settings) ===== */
.key-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.key-input-box {
  position: relative;
  width: 100%;
  max-width: 280px;
  display: flex;
  align-items: center;
}
.key-input-box .form-input {
  width: 100%;
  padding-right: 36px;
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
}
.key-eye-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  line-height: 1;
  opacity: 0.7;
}
.key-eye-btn:hover {
  opacity: 1;
}
.key-status-badge {
  position: static !important;
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #16A34A;
  background-color: #DCFCE7;
  padding: 3px 8px;
  border-radius: var(--radius-sm, 6px);
  white-space: nowrap;
}
.key-input-wrapper .btn { flex-shrink: 0; white-space: nowrap; }

/* ===== Danger button ===== */
.btn-danger { border-color: #FCA5A5; color: #DC2626; background: #FEF2F2; }
.btn-danger:hover { background: #FEE2E2; border-color: #F87171; }

/* ===== Admin default keys card ===== */
.default-keys-card .key-input-wrapper .key-status-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-green-light);
  color: var(--accent-green-text);
}

/* ===== One-row controls + playback lock ===== */
/* Tool row next to Save also stays on one row; narrow screens scroll it. */
.answer-head-actions { flex-wrap: nowrap; overflow-x: auto; }
.answer-head-actions .btn { flex-shrink: 0; white-space: nowrap; }

/* Locked while TTS or a recording plays: dimmed, click-blocked, announced. */
button[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.spk-icon-btn[aria-busy="true"] { pointer-events: none; }
.q-bubble[aria-busy="true"] { cursor: progress; }

@media (max-width: 600px) {
  .ai-tools-group, .answer-head-actions { gap: 8px; }
  .ai-tools-group .btn, .answer-head-actions .btn { padding: 6px 9px; font-size: 0.72rem; }
  .controls-bar { gap: 8px; padding: 12px 14px; }
}

