/* ==========================================================================
   SNBT Master & Speaking Studio - Design System & Styles
   Aesthetic: Modern Sleek Dark Mode with Glassmorphism & Vibrant Gradients
   ========================================================================== */

:root {
  /* Color Palette Tokens */
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-surface: rgba(17, 24, 39, 0.75);
  --bg-card: rgba(30, 41, 59, 0.65);
  --bg-card-hover: rgba(51, 65, 85, 0.7);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.35);
  --border-active: #6366f1;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Accent Gradients & Vibrancy */
  --accent-indigo: #4f46e5;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;

  --grad-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
  --grad-card-glow: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(168, 85, 247, 0.05));
  --grad-record: linear-gradient(135deg, #ef4444 0%, #f43f5e 100%);

  /* Spacing & Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --shadow-glow: 0 8px 32px 0 rgba(79, 70, 229, 0.25);
  --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

/* Reset & Box Sizing */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(79, 70, 229, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(6, 182, 212, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ==========================================================================
   Header & Tabs Navigation
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--grad-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #ffffff, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--accent-cyan);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-install {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid var(--border-glow);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-install:hover {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
  transform: translateY(-1px);
}

/* Tab Bar */
.app-tabs {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.app-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn svg {
  width: 17px;
  height: 17px;
  stroke-width: 2.2;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: #818cf8;
  border-bottom-color: #818cf8;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.app-main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Banners */
.hero-banner {
  text-align: center;
  margin-bottom: 24px;
}

.hero-badge {
  display: inline-block;
  padding: 5px 14px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid var(--border-glow);
  color: #a5b4fc;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.hero-title {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto;
}

/* ==========================================================================
   Quiz Configuration View
   ========================================================================== */
.config-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.config-step {
  margin-bottom: 24px;
}

.step-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 14px;
  color: #f1f5f9;
}

.step-num {
  width: 24px;
  height: 24px;
  background: var(--accent-indigo);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
}

/* Subtest Grid */
.subtest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.subtest-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.subtest-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.subtest-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-indigo);
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.3);
}

.subtest-btn-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 3px;
}

.subtest-btn-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* Topic Chips */
.topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topic-chip {
  padding: 7px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topic-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.topic-chip.active {
  background: #4f46e5;
  color: #fff;
  border-color: #6366f1;
  box-shadow: 0 2px 10px rgba(79, 70, 229, 0.4);
}

/* Difficulty Grid */
.diff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.diff-btn {
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}

.diff-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.diff-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-indigo);
  color: #fff;
}

/* Count Selector */
.count-selector {
  display: flex;
  gap: 12px;
}

.count-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.count-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-indigo);
}

.count-val {
  font-size: 1.05rem;
  font-weight: 800;
}

.count-tag {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

/* Action Buttons */
.btn-primary-large {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 800;
  font-family: var(--font-sans);
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary-large:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(79, 70, 229, 0.45);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   Loading Pulse Box
   ========================================================================== */
.loading-box {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
}

.pulse-loader {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.pulse-loader div {
  width: 14px;
  height: 14px;
  background: var(--accent-indigo);
  border-radius: 50%;
  animation: pulseLoader 0.9s infinite alternate;
}
.pulse-loader div:nth-child(2) { animation-delay: 0.3s; background: var(--accent-purple); }
.pulse-loader div:nth-child(3) { animation-delay: 0.6s; background: var(--accent-cyan); }

@keyframes pulseLoader {
  from { transform: scale(0.6); opacity: 0.4; }
  to { transform: scale(1.3); opacity: 1; }
}

.loading-title {
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.loading-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Interactive Quiz Player View
   ========================================================================== */
.player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.player-info {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-subtest, .badge-topic, .badge-diff {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-subtest { background: rgba(99, 102, 241, 0.2); color: #c7d2fe; }
.badge-topic { background: rgba(6, 182, 212, 0.2); color: #a5f3fc; }
.badge-diff { background: rgba(245, 158, 11, 0.2); color: #fde68a; }

.player-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 700;
  color: #38bdf8;
}

.progress-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 20px;
}

.progress-fill {
  height: 100%;
  background: var(--grad-primary);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.question-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-card);
}

.question-meta {
  margin-bottom: 12px;
}

.q-number {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.question-text {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.6;
  margin-bottom: 24px;
  color: #ffffff;
}

/* Options */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(4px);
}

.option-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.option-text {
  flex: 1;
}

/* Option States */
.option-btn.correct {
  background: rgba(16, 185, 129, 0.18) !important;
  border-color: #10b981 !important;
  color: #a7f3d0 !important;
}
.option-btn.correct .option-badge {
  background: #10b981;
  color: #fff;
}

.option-btn.wrong {
  background: rgba(244, 63, 94, 0.18) !important;
  border-color: #f43f5e !important;
  color: #fecdd3 !important;
}
.option-btn.wrong .option-badge {
  background: #f43f5e;
  color: #fff;
}

/* Explanation Box */
.explanation-box {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 18px;
  animation: fadeIn 0.3s ease;
}

.exp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.exp-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
}
.exp-badge.correct { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.exp-badge.wrong { background: rgba(244, 63, 94, 0.2); color: #fb7185; }

.exp-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.exp-content {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #e2e8f0;
}

.player-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Result Card */
.result-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
}

.result-celebration {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fcd34d;
  margin-bottom: 6px;
}

.result-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 24px;
}

.score-circle-wrapper {
  margin-bottom: 24px;
}

.score-circle {
  width: 140px;
  height: 140px;
  margin: 0 auto;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, rgba(15, 23, 42, 0.8) 70%);
  border: 4px solid var(--accent-indigo);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.35);
}

.score-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}

.score-label {
  font-size: 0.8rem;
  color: var(--accent-cyan);
  font-weight: 700;
  margin-top: 4px;
}

.result-stats-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-mini-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  min-width: 90px;
}

.stat-mini-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  display: block;
}

.stat-mini-lbl {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.ai-eval-box {
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: left;
  margin-bottom: 28px;
}

.ai-eval-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #c7d2fe;
  margin-bottom: 8px;
}

.ai-eval-content {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #cbd5e1;
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}

/* ==========================================================================
   Speaking Voice Studio View
   ========================================================================== */
.speaking-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.speaking-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}

.badge-cat {
  padding: 4px 12px;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-block;
  margin-bottom: 8px;
}

.speaking-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.speaking-prompt-box {
  background: rgba(255, 255, 255, 0.03);
  border-left: 4px solid var(--accent-indigo);
  padding: 16px 20px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: 20px;
}

.speaking-main-q {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.55;
  font-style: italic;
}

.guiding-section, .vocab-section {
  margin-bottom: 18px;
}

.guiding-title, .vocab-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: block;
}

.guiding-list {
  padding-left: 20px;
  font-size: 0.88rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vocab-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vocab-chip {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: #e2e8f0;
}

.vocab-chip strong {
  color: var(--accent-cyan);
}

/* Recording Deck */
.recording-deck {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.audio-visualizer {
  width: 100%;
  max-width: 420px;
  height: 60px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.3);
  margin-bottom: 14px;
}

.recording-timer {
  font-size: 1.3rem;
  font-weight: 800;
  color: #f43f5e;
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}

.recording-controls {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
}

.btn-record {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: var(--grad-record);
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(244, 63, 94, 0.4);
  transition: all 0.25s ease;
}

.btn-record:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(244, 63, 94, 0.6);
}

.btn-record.recording {
  animation: pulseRecording 1.5s infinite;
}

@keyframes pulseRecording {
  0% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  70% { box-shadow: 0 0 0 16px rgba(244, 63, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0); }
}

.btn-stop-record {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-full);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-stop-record:hover {
  background: #334155;
}

.record-icon-wrapper svg {
  width: 20px;
  height: 20px;
}

.record-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Speaking Evaluation Result Card */
.speaking-result-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-card);
  animation: fadeIn 0.3s ease;
}

.result-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.cefr-badge-box {
  display: flex;
  flex-direction: column;
}

.cefr-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.cefr-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #38bdf8;
}

.coach-tag {
  padding: 6px 14px;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 700;
}

.eval-block {
  margin-bottom: 20px;
}

.eval-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 8px;
}

.transcript-box {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.9rem;
  color: #e2e8f0;
  font-style: italic;
  line-height: 1.6;
}

.eval-text {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.6;
}

.corrections-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.correction-item {
  background: rgba(244, 63, 94, 0.08);
  border-left: 3px solid #f43f5e;
  padding: 10px 14px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.88rem;
}

.correction-diff {
  margin-bottom: 4px;
}

.mistake-badge {
  color: #fb7185;
  text-decoration: line-through;
  margin-right: 6px;
}

.fix-badge {
  color: #34d399;
  font-weight: 700;
}

.correction-rule {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.vocab-upgrade-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.vocab-upgrade-pill {
  padding: 6px 14px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.vocab-orig {
  color: var(--text-muted);
  text-decoration: line-through;
}

.vocab-new {
  color: #38bdf8;
  font-weight: 700;
  margin-left: 6px;
}

/* Native Demo Card */
.native-demo-card {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-top: 24px;
  margin-bottom: 18px;
}

.native-demo-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.native-badge {
  font-size: 0.95rem;
  font-weight: 800;
  color: #34d399;
}

.native-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.native-text {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #f8fafc;
  margin-bottom: 16px;
  font-style: italic;
}

.btn-play-audio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #10b981;
  color: #fff;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
}

.btn-play-audio:hover {
  transform: translateY(-1px);
  background: #059669;
}

.coach-quote-box {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 0.85rem;
  color: #94a3b8;
  text-align: center;
}

/* ==========================================================================
   Stats & Rankings Table Views
   ========================================================================== */
.stats-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.stat-icon.bg-indigo { background: rgba(79, 70, 229, 0.2); }
.stat-icon.bg-cyan { background: rgba(6, 182, 212, 0.2); }
.stat-icon.bg-emerald { background: rgba(16, 185, 129, 0.2); }
.stat-icon.bg-purple { background: rgba(139, 92, 246, 0.2); }

.stat-number {
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  display: block;
  line-height: 1.1;
}

.stat-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.history-card, .rankings-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.card-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 16px;
}

.speaking-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.history-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-item-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
}

.history-item-meta {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.history-item-band {
  padding: 4px 10px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 800;
}

.empty-state {
  text-align: center;
  padding: 28px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Rankings Table */
.rankings-table-wrapper {
  overflow-x: auto;
}

.rankings-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.rankings-table th {
  padding: 12px 14px;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.rankings-table td {
  padding: 14px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.rank-badge {
  font-weight: 800;
  font-size: 1rem;
}

.toast-popup {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-glow);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

}

/* ==========================================================================
   User Profile Pill & Dropdown Menu
   ========================================================================== */
.user-pill-wrapper {
  position: relative;
}

.user-pill {
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-pill:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--border-glow);
}

.pill-chevron {
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.user-pill.open .pill-chevron {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  background: rgba(17, 24, 39, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  padding: 8px;
  z-index: 500;
  animation: fadeIn 0.15s ease-out;
}

.user-dropdown-info {
  padding: 10px 12px;
}

.dropdown-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

#dropdownUserId {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-family: monospace;
}

.dropdown-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.25);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.35);
  text-transform: capitalize;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.dropdown-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ==========================================================================
   Unified Login Modal Styling
   ========================================================================== */
.auth-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
  animation: fadeIn 0.25s ease-out;
}

.auth-modal-card {
  width: 100%;
  max-width: 440px;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(99, 102, 241, 0.2);
  padding: 28px 24px;
  position: relative;
  overflow: hidden;
}

.auth-modal-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--grad-primary);
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 22px;
  position: relative;
}

.auth-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  margin-bottom: 8px;
}

.auth-modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.auth-modal-subtitle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.auth-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s ease;
}

.auth-close-btn:hover {
  color: var(--text-primary);
}

/* Auth Tabs */
.auth-tabs {
  display: flex;
  background: rgba(30, 41, 59, 0.5);
  padding: 4px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  border: 1px solid var(--border-subtle);
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn:hover {
  color: var(--text-primary);
}

.auth-tab-btn.active {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
  border: 1px solid rgba(99, 102, 241, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Auth Tab Content Panes */
.auth-tab-pane {
  display: none;
  animation: fadeIn 0.2s ease;
}

.auth-tab-pane.active {
  display: block;
}

.auth-tab-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Google Sign In Elements */
.google-auth-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.google-btn-slot {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

.google-demo-slot {
  display: flex;
  justify-content: center;
}

.btn-google-standard {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  background: #ffffff;
  color: #1f2937;
  font-size: 0.9rem;
  font-weight: 700;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-google-standard:hover {
  background: #f8fafc;
  box-shadow: 0 4px 14px rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.auth-link-box {
  background: rgba(30, 41, 59, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-top: 6px;
}

.auth-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
}

.auth-toggle-label input[type="checkbox"] {
  accent-color: var(--accent-indigo);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.link-field-wrapper {
  margin-top: 10px;
  animation: fadeIn 0.2s ease;
}

/* Form Styles */
.auth-form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.auth-input-group label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.auth-input-field {
  width: 100%;
  padding: 11px 14px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.92rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.auth-input-field:focus {
  outline: none;
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  background: rgba(15, 23, 42, 0.95);
}

.auth-field-tip {
  display: block;
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.auth-tip-card {
  display: flex;
  gap: 10px;
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.tip-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.tip-text code {
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

.btn-auth-submit {
  width: 100%;
  padding: 12px;
  background: var(--grad-primary);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-glow);
  margin-top: 4px;
}

.btn-auth-submit:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.auth-status-alert {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.4;
  animation: fadeIn 0.2s ease;
}

.auth-status-alert.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.auth-status-alert.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
}

.auth-status-alert.warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fde047;
}

/* Auth Warning Card in Guest Tab */
.auth-warning-card {
  display: flex;
  gap: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-size: 0.78rem;
  color: #fef08a;
  line-height: 1.5;
  margin-bottom: 6px;
}

.auth-badge-disabled {
  display: inline-block;
  font-size: 0.62rem;
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 5px;
  font-weight: 700;
  vertical-align: middle;
}

/* Guest Online Test Warning Banner in Quiz Tab */
.guest-quiz-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.45);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  animation: fadeIn 0.3s ease;
}

.guest-quiz-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.guest-quiz-text {
  flex: 1;
  text-align: left;
}

.guest-quiz-text strong {
  display: block;
  font-size: 0.92rem;
  color: #fef08a;
  margin-bottom: 3px;
}

.guest-quiz-text p {
  margin: 0;
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.btn-banner-login {
  flex-shrink: 0;
  padding: 9px 16px;
  background: var(--grad-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-banner-login:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}
