/* ========================================
   SAT Vocabulary - Complete Redesign
   Inspired by Anthropic's warm, restrained design
   and L2 Lab's mobile-first elegance
   ======================================== */

/* === RESET === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box
}

/* === DESIGN TOKENS === */
:root {
  /* Fonts - Clean, readable like Anthropic */
  --font-display: 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  /* Colors - Warm palette like Anthropic */
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --ink: #1a1a1a;
  --ink2: #3d3d3d;
  --muted: #666666;
  /* Readable, not too grey */
  --line: rgba(0, 0, 0, 0.08);

  /* Warm accent - burnt orange/terracotta like Anthropic */
  --accent: #c9693c;
  --accent-hover: #b55a30;
  --accent-light: rgba(201, 105, 60, 0.08);

  /* Tier colors - ALL warm tones */
  --t1: #e8f5e9;
  --t1-ink: #2e7d32;
  --t2: #fff3e0;
  --t2-ink: #e65100;
  --t3: #fce4ec;
  --t3-ink: #ad1457;
  --t4: #f3e5f5;
  --t4-ink: #7b1fa2;
  --t5: #ffebee;
  --t5-ink: #c62828;

  /* Feedback */
  --success: #2e7d32;
  --success-bg: #e8f5e9;
  --error: #c62828;
  --error-bg: #ffebee;
  --warm-bg: #fef7ed;

  /* Spacing - fluid with clamp */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: clamp(12px, 3vw, 16px);
  --space-lg: clamp(16px, 4vw, 24px);
  --space-xl: clamp(24px, 5vw, 32px);

  /* Container - mobile-first, no overflow */
  --container: min(480px, calc(100vw - 32px));
  --container-wide: min(720px, calc(100vw - 32px));

  /* Radius - subtle, not bubbly */
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows - soft, warm */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.05), 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.08);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* === TYPOGRAPHY === */
h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h1 {
  font-size: clamp(22px, 5vw, 28px)
}

h2 {
  font-size: clamp(18px, 4vw, 22px)
}

h3 {
  font-size: 16px
}

p {
  color: var(--ink2);
  line-height: 1.6
}

.text-muted {
  color: var(--muted)
}

.text-sm {
  font-size: 13px
}

.text-xs {
  font-size: 12px
}

/* === TOPBAR === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 248, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-nav {
  margin-left: auto;
  display: flex;
  gap: 4px;
}

.topbar-link {
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all 0.15s;
}

.topbar-link:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--ink);
}

/* About link always visible on mobile */

/* === BOTTOMBAR (Mobile only) === */
.bottombar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(250, 250, 248, 0.95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}

.bottombar-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.btn-scroll-hint {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  animation: bounce-hint 2s ease-in-out infinite;
}

.btn-scroll-hint:hover {
  background: var(--accent);
  color: white;
  animation: none;
}

@keyframes bounce-hint {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

@media(min-width:768px) {
  .bottombar {
    display: none
  }
}

/* === MAIN CONTAINER === */
.wrap {
  width: var(--container);
  margin: 0 auto;
  padding: var(--space-md) 0;
  padding-bottom: calc(72px + var(--space-lg));
  /* Space for bottombar */
}

@media(min-width:768px) {
  .wrap {
    padding-bottom: var(--space-xl)
  }
}

/* === SCREENS === */
.screen {
  display: none
}

.screen.active {
  display: block
}

/* === BUTTONS - Compact like Anthropic === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98)
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover)
}

.btn-primary:disabled,
.btn-primary[disabled],
.btn-primary.btn-disabled {
  background: hsl(0 0% 75%);
  color: hsl(0 0% 95%);
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary:disabled:hover,
.btn-primary[disabled]:hover,
.btn-primary.btn-disabled:hover {
  background: hsl(0 0% 75%);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink2);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--ink2);
  padding: 8px 12px;
}

.btn-ghost:hover {
  background: rgba(0, 0, 0, 0.04)
}

.btn-block {
  width: 100%
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px
}

.btn-flash {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: #92400e;
}

.btn-flash:hover {
  background: linear-gradient(135deg, #fde68a, #fcd34d);
}

/* Navigation buttons - compact, minimal */
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.12s;
}

.nav-btn:hover {
  background: var(--surface);
  border-color: rgba(0, 0, 0, 0.15);
}

.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* === BADGE === */
.badge {
  display: inline-block;
  padding: 4px 10px;
  background: var(--accent-light);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--space-sm);
}

/* === CARDS - Border + Shadow === */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
}

/* === SCREEN 1: HERO === */
.hero-section {
  margin-bottom: var(--space-lg);
}

.hero-section h1 {
  margin-bottom: var(--space-xs);
}

.hero-section h1 span {
  color: var(--accent);
}

.subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: var(--space-md);
}

/* Preview Card */
.preview-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-md);
}

.preview-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.preview-emoji {
  font-size: 28px;
  line-height: 1
}

.preview-word {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.preview-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.preview-tier {
  margin-left: auto
}

/* Tier badges */
.tier {
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.t1 {
  background: var(--t1);
  color: var(--t1-ink)
}

.t2 {
  background: var(--t2);
  color: var(--t2-ink)
}

.t3 {
  background: var(--t3);
  color: var(--t3-ink)
}

.t4 {
  background: var(--t4);
  color: var(--t4-ink)
}

.t5 {
  background: var(--t5);
  color: var(--t5-ink)
}

.preview-def {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink2);
  margin-bottom: 10px;
}

.preview-sentence {
  font-size: 13px;
  color: var(--ink2);
  font-style: italic;
  padding: 10px 12px;
  background: var(--warm-bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.preview-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.preview-counter {
  font-size: 12px;
  color: var(--muted);
}

/* Hero CTA Row - Sober, Anthropic-style */
.hero-cta-row {
  display: flex;
  gap: 8px;
  margin: var(--space-md) 0;
}

.cta-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--surface);
  min-width: 0;
}

.cta-btn:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: var(--shadow-sm);
}

.cta-btn:active {
  transform: scale(0.98)
}

.cta-icon {
  font-size: 16px;
  line-height: 1;
  opacity: 0.7
}

.cta-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%
}

/* Primary CTA - solid accent */
.cta-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
}

.cta-btn.primary .cta-icon {
  opacity: 1
}

.cta-btn.primary .cta-label {
  color: #fff
}

.cta-btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* All other CTAs - uniform subtle style */
.cta-btn.secondary,
.cta-btn.flash,
.cta-btn.rtc {
  background: var(--surface);
  border-color: var(--line);
}

.cta-btn.secondary:hover,
.cta-btn.flash:hover,
.cta-btn.rtc:hover {
  background: var(--bg);
  border-color: rgba(0, 0, 0, 0.12);
}

/* Desktop: slightly larger */
@media(min-width:768px) {
  .hero-cta-row {
    gap: 10px;
    margin: var(--space-lg) 0;
  }

  .cta-btn {
    padding: 14px 10px;
    gap: 6px;
  }

  .cta-icon {
    font-size: 18px
  }

  .cta-label {
    font-size: 13px
  }
}

/* Stats */
.stats {
  display: flex;
  justify-content: center;
  gap: clamp(16px, 5vw, 32px);
  margin: var(--space-lg) 0;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stat {
  text-align: center
}

.stat-val {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Poll Section */
.poll {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

.poll-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.poll-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.poll-badge {
  padding: 3px 8px;
  background: var(--accent-light);
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}

.poll-word-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.poll-emoji {
  font-size: 24px
}

.poll-word {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.poll-pos {
  font-size: 12px;
  color: var(--muted)
}

.poll-q {
  font-size: 14px;
  color: var(--ink2);
  margin-bottom: 12px;
}

.poll-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.poll-opt {
  position: relative;
  padding: 11px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: all 0.15s;
}

.poll-opt:hover {
  border-color: var(--accent)
}

.poll-opt.selected {
  border-color: var(--accent);
  background: var(--accent-light)
}

.poll-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--accent);
  opacity: 0.12;
  width: 0;
  transition: width 0.4s ease;
}

.poll-opt-text {
  position: relative;
  font-size: 13px;
  color: var(--ink2);
}

.poll-opt-pct {
  position: relative;
  float: right;
  font-weight: 600;
  font-size: 13px;
  color: var(--accent);
  opacity: 0;
}

.poll-opt.revealed .poll-opt-pct {
  opacity: 1
}

.poll-result {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

/* Footer */
.footer {
  margin-top: var(--space-xl);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 10px;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}

.footer-links a:hover {
  color: var(--ink)
}

.footer-copy {
  font-size: 11px;
  color: var(--muted);
}

/* === SCREEN 2: SELECTION === */
.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-md);
}

.screen-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

/* Tier Box */
.tier-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.tier-box-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tier-grid {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.tier-btn {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.12s;
}

.tier-btn:hover {
  transform: scale(1.02)
}

.tier-btn:active {
  transform: scale(0.98)
}

.tier-btn.active {
  border-color: var(--ink)
}

.tier-btn.t1 {
  background: var(--t1)
}

.tier-btn.t2 {
  background: var(--t2)
}

.tier-btn.t3 {
  background: var(--t3)
}

.tier-btn.t4 {
  background: var(--t4)
}

.tier-btn.t5 {
  background: var(--t5)
}

.tier-emoji {
  font-size: 16px;
  margin-bottom: 2px
}

.tier-num {
  font-weight: 700;
  font-size: 15px;
  line-height: 1
}

.tier-name {
  font-size: 9px;
  text-transform: uppercase;
  margin-top: 2px;
  color: var(--ink2);
  letter-spacing: 0.3px
}

.tier-desc {
  font-size: 13px;
  color: var(--ink2);
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.tier-count {
  margin-top: 6px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

/* Section Label */
.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-count-label {
  font-weight: 500;
  color: var(--accent);
  font-size: 12px;
  text-transform: none;
}

/* Theme Grid - Responsive columns */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media(min-width:400px) {
  .theme-grid {
    grid-template-columns: repeat(2, 1fr)
  }
}

@media(min-width:768px) {
  .theme-grid {
    grid-template-columns: repeat(3, 1fr)
  }
}

@media(min-width:1024px) {
  .theme-grid {
    grid-template-columns: repeat(4, 1fr)
  }
}

.theme-grid.collapsed .theme-card:nth-child(n+17) {
  display: none
}

.view-all-btn {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  margin-top: 8px;
  transition: all 0.12s;
}

.view-all-btn:hover {
  background: var(--surface);
  color: var(--ink2);
}

.view-all-btn.hidden {
  display: none
}

/* Theme Card */
.theme-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.12s;
}

.theme-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.theme-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.theme-card:active {
  transform: scale(0.98)
}

.theme-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.theme-emoji {
  font-size: 18px
}

.theme-name {
  font-weight: 600;
  font-size: 13px
}

.theme-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 4px;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.theme-count {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

/* Main CTA for Screen 2 - now visible on all devices */
.start-cta-main {
  display: block;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xl);
}

/* === SCREEN 3: WORD CARD === */
.words-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-md);
}

/* Compact Back button in words header */
.words-header .nav-btn {
  padding: 4px 8px;
  font-size: 11px;
  flex-shrink: 0;
}

.words-info {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.words-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.words-count {
  font-size: 11px;
  color: var(--muted);
}

/* Tier Quick Nav */
.tier-quick-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.tier-quick-btn {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  transition: all 0.12s;
  opacity: 0.5;
}

.tier-quick-btn:hover {
  opacity: 0.7;
  transform: scale(1.05)
}

.tier-quick-btn:active {
  transform: scale(0.95)
}

.tier-quick-btn.active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--ink)
}

.tier-quick-btn.t1 {
  background: var(--t1);
  color: var(--t1-ink)
}

.tier-quick-btn.t2 {
  background: var(--t2);
  color: var(--t2-ink)
}

.tier-quick-btn.t3 {
  background: var(--t3);
  color: var(--t3-ink)
}

.tier-quick-btn.t4 {
  background: var(--t4);
  color: var(--t4-ink)
}

.tier-quick-btn.t5 {
  background: var(--t5);
  color: var(--t5-ink)
}

/* Flash Button in header nav */
.tier-quick-nav .flash-btn {
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
  flex-shrink: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: inherit;
}

.flash-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-sm)
}

.flash-btn:active {
  transform: scale(0.95)
}

/* Word Card Wrap */
.word-card-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 400px;
  margin: 0 auto;
}

/* Word Card - Compact, tall orientation, stable height */
.word-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-md);
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.word-card-content {
  flex: 1;
}

.word-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.word-card-emoji {
  font-size: 26px;
  line-height: 1
}

.word-card-main {
  flex: 1;
  min-width: 0
}

.word-card-word {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.word-card-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

.word-card-tier {
  margin-left: auto
}

.word-card-def {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink2);
  margin-bottom: 6px;
}

.word-card-sentence {
  font-size: 13px;
  color: var(--ink2);
  font-style: italic;
  padding: 8px 10px;
  background: var(--warm-bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
  margin-bottom: 6px;
}

.word-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 6px;
}

.tag {
  padding: 4px 8px;
  border-radius: var(--radius);
  font-size: 11px;
  font-weight: 500;
}

.tag.syn {
  background: var(--success-bg);
  color: var(--success)
}

.tag.ant {
  background: var(--error-bg);
  color: var(--error)
}

/* Word Card Actions - 3 Equal Toggle Buttons */
.word-card-actions {
  display: flex;
  gap: 6px;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line);
}

.card-action {
  flex: 1;
  padding: 8px 6px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.12s;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink2);
  white-space: nowrap;
}

.card-action:hover {
  background: var(--bg);
  border-color: rgba(0, 0, 0, 0.12);
}

.card-action:active {
  transform: scale(0.98)
}

/* Unified active state for all buttons */
.card-action.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Disabled state for Poll when no poll available */
.card-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card-action:disabled:hover {
  background: var(--surface);
  border-color: var(--line);
}

/* Related Words Section */
.word-card-related {
  margin-top: var(--space-sm);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line);
}

.related-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.related-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.related-chip {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s ease;
  border: 1px solid transparent;
}

.related-chip:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
}

.related-chip:active {
  transform: scale(0.96);
}

/* Hidden utility class */
.hidden {
  display: none !important
}

/* === SCREEN 6: POLL === */
.poll-screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-md);
}

.poll-screen-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
}

.poll-screen-body {
  max-width: 440px;
  margin: 0 auto;
}

.poll-screen-word {
  text-align: center;
  margin-bottom: var(--space-sm);
}

.poll-word-emoji {
  font-size: 32px;
  display: block;
  margin-bottom: 4px;
}

.poll-word-text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
}

.poll-screen-question {
  font-size: 15px;
  color: var(--ink2);
  text-align: center;
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.poll-screen-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.poll-screen-opt {
  position: relative;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.poll-screen-opt:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.poll-screen-opt:active {
  transform: scale(0.99)
}

.poll-screen-opt .poll-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--accent);
  opacity: 0.12;
  transition: width 0.4s ease;
  z-index: 0;
}

.poll-screen-opt .poll-opt-text {
  position: relative;
  z-index: 1;
}

.poll-screen-opt .poll-opt-pct {
  position: relative;
  z-index: 1;
  float: right;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s;
}

.poll-screen-opt.revealed {
  pointer-events: none;
  cursor: default;
}

.poll-screen-opt.revealed .poll-opt-pct {
  opacity: 1;
}

.poll-screen-opt.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.poll-screen-opt.selected .poll-bar {
  background: var(--accent);
  opacity: 0.18;
}

.poll-screen-footer {
  margin-top: var(--space-md);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

/* Card Nav Row */
.card-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
}

.card-counter {
  font-size: 11px;
  color: var(--muted);
}

/* === SCREEN 4: QUIZ === */
.quiz-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: var(--space-md);
}

.quiz-progress {
  display: flex;
  gap: 6px;
  margin-left: auto;
  align-items: center;
}

.quiz-emoji {
  font-size: 20px
}

.quiz-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
  transition: all 0.2s;
}

.quiz-dot.active {
  background: var(--accent)
}

.quiz-dot.correct {
  background: var(--success)
}

.quiz-dot.wrong {
  background: var(--error)
}

.quiz-body {
  max-width: 440px;
  margin: 0 auto;
}

.quiz-word-row {
  text-align: center;
  margin-bottom: var(--space-sm);
}

.quiz-word {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 2px;
}

.quiz-type,
.quiz-pos {
  font-size: 12px;
  color: var(--muted);
}

.quiz-question {
  font-size: 14px;
  color: var(--ink2);
  text-align: center;
  margin-bottom: var(--space-md);
}

.quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quiz-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s;
  font-size: 14px;
  line-height: 1.45;
}

.quiz-opt:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.quiz-opt:active {
  transform: scale(0.99)
}

.quiz-opt.correct {
  border-color: var(--success);
  background: var(--success-bg);
}

.quiz-opt.wrong {
  border-color: var(--error);
  background: var(--error-bg);
}

.quiz-opt.disabled {
  pointer-events: none;
}

.quiz-opt-letter {
  width: 26px;
  height: 26px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.quiz-opt.correct .quiz-opt-letter {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.quiz-opt.wrong .quiz-opt-letter {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.quiz-feedback {
  margin-top: var(--space-md);
  padding: 12px;
  background: var(--warm-bg);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
}

.quiz-next {
  margin-top: var(--space-sm);
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.quiz-next:hover {
  background: var(--accent-hover)
}

.quiz-next:active {
  transform: scale(0.98)
}

/* === SCREEN 5: FLASH MODE (Dark Glassmorphism) === */
.flash-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  overflow: hidden;
  background: radial-gradient(1200px 800px at 20% 10%, hsl(280 60% 18% / .65), transparent 55%),
    radial-gradient(1000px 700px at 90% 80%, hsl(210 70% 22% / .55), transparent 55%),
    linear-gradient(180deg, hsl(220 30% 8%), hsl(260 45% 10%));
}

.flash-screen.active {
  display: block
}

/* Animated gradient drift */
.flash-drift {
  position: fixed;
  inset: -30%;
  background: conic-gradient(from 180deg at 50% 50%, hsl(280 60% 22% / .40), hsl(210 70% 24% / .35), hsl(330 60% 18% / .32), hsl(280 60% 22% / .40));
  filter: blur(80px);
  animation: flashDrift 18s ease-in-out infinite;
  opacity: .55;
  pointer-events: none;
  transform: translate3d(0, 0, 0);
}

@keyframes flashDrift {
  0% {
    transform: translate3d(-3%, -2%, 0) rotate(0deg) scale(1.02);
  }

  50% {
    transform: translate3d(3%, 2%, 0) rotate(18deg) scale(1.05);
  }

  100% {
    transform: translate3d(-3%, -2%, 0) rotate(0deg) scale(1.02);
  }
}

/* Grain texture */
.flash-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  mix-blend-mode: overlay;
  opacity: .08;
}

/* Stage container */
.flash-stage {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow: hidden;
}

.flash-content {
  width: min(440px, 90vw);
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Title */
.flash-title {
  text-align: center;
  line-height: 1.2;
  margin-bottom: 4px;
}

.flash-title h2 {
  font-size: clamp(16px, 2.4vw, 20px);
  font-weight: 650;
  letter-spacing: .2px;
  margin: 0;
  color: hsl(0 0% 100% / .72);
}

.flash-title p {
  margin: 6px 0 0;
  font-size: clamp(11px, 2vw, 13px);
  color: hsl(0 0% 100% / .55);
}

/* Book frame */
.flash-book {
  width: min(360px, 85vw);
  height: min(220px, 35vh);
  position: relative;
  perspective: 1000px;
  perspective-origin: 50% 40%;
  border-radius: 18px;
}

/* Glow ring */
.flash-halo {
  position: absolute;
  inset: -16px;
  border-radius: 30px;
  background: radial-gradient(closest-side, hsl(0 0% 100% / .10), transparent 70%);
  filter: blur(10px);
  opacity: .55;
  pointer-events: none;
}

/* Page */
.flash-page {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: linear-gradient(135deg, hsl(0 0% 100% / .10), hsl(0 0% 100% / .06));
  border: 1px solid hsl(0 0% 100% / .14);
  box-shadow: 0 24px 70px hsl(0 0% 0% / .35);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform-style: preserve-3d;
  overflow: hidden;
}

/* Internal reflection */
.flash-page::before {
  content: "";
  position: absolute;
  inset: -40% -30%;
  background: radial-gradient(circle at 30% 20%, hsl(0 0% 100% / .18), transparent 40%),
    radial-gradient(circle at 70% 80%, hsl(0 0% 100% / .10), transparent 45%);
  transform: rotate(8deg);
  opacity: .65;
  pointer-events: none;
}

/* Flip animation */
.flash-page.flip {
  animation: flashFlip 140ms cubic-bezier(.2, .7, .2, 1);
}

@keyframes flashFlip {
  0% {
    transform: rotateY(0deg) translateZ(0);
  }

  45% {
    transform: rotateY(-62deg) translateX(-3px) translateZ(0);
  }

  100% {
    transform: rotateY(0deg) translateZ(0);
  }
}

/* Micro highlight pulse */
.flash-pulse {
  position: absolute;
  inset: -20%;
  border-radius: 40px;
  background: radial-gradient(circle at 50% 40%, hsl(0 0% 100% / .18), transparent 55%);
  opacity: 0;
  pointer-events: none;
  transform: translateZ(2px);
  mix-blend-mode: screen;
}

.flash-pulse.active {
  animation: flashPulseAnim 120ms ease-out;
}

@keyframes flashPulseAnim {
  0% {
    opacity: 0;
    transform: scale(.98);
  }

  35% {
    opacity: .72;
    transform: scale(1.0);
  }

  100% {
    opacity: 0;
    transform: scale(1.02);
  }
}

/* Word container */
.flash-word-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  transform: translateZ(1px);
}

.flash-word {
  font-family: var(--font-display);
  font-size: clamp(34px, 7.2vw, 58px);
  font-weight: 780;
  letter-spacing: 0.8px;
  line-height: 1;
  color: hsl(0 0% 100%);
  text-shadow: 0 10px 35px hsl(0 0% 0% / .30);
  filter: drop-shadow(0 12px 24px hsl(0 0% 0% / .22));
  opacity: 0;
  transform: scale(.98);
  will-change: transform, opacity, filter;
}

/* Focus snap animation */
.flash-word.show {
  animation: focusSnap 170ms ease-out forwards;
}

@keyframes focusSnap {
  0% {
    opacity: .16;
    transform: scale(.97);
    filter: blur(4px);
  }

  55% {
    opacity: 1;
    transform: scale(1.03);
    filter: blur(.6px);
  }

  100% {
    opacity: 1;
    transform: scale(1.0);
    filter: blur(0px);
  }
}

/* Countdown style */
.flash-word.countdown {
  font-size: clamp(56px, 14vw, 80px);
  color: hsl(0 0% 100%);
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
  animation: countdownPop 200ms ease-out forwards;
}

@keyframes countdownPop {
  0% {
    transform: scale(0.8);
    opacity: 0.5;
  }

  60% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Tier Pills - Mobile First */
.flash-tiers {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 4px;
  width: 100%;
  max-width: 280px;
}

.flash-tier-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  color: hsl(0 0% 100% / .6);
  background: linear-gradient(135deg, hsl(0 0% 100% / .08), hsl(0 0% 100% / .04));
  border: 1px solid hsl(0 0% 100% / .12);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all .15s ease;
}

.flash-tier-btn:active {
  transform: scale(.92);
}

.flash-tier-btn.active {
  color: hsl(0 0% 100%);
  background: linear-gradient(135deg, hsl(0 0% 100% / .24), hsl(0 0% 100% / .16));
  border-color: hsl(0 0% 100% / .35);
  box-shadow: 0 0 12px hsl(0 0% 100% / .15);
}

/* Tier color accents when active */
.flash-tier-btn[data-tier="1"].active {
  border-color: hsl(142 70% 45%);
  box-shadow: 0 0 12px hsl(142 70% 45% / .3);
}

.flash-tier-btn[data-tier="2"].active {
  border-color: hsl(217 91% 60%);
  box-shadow: 0 0 12px hsl(217 91% 60% / .3);
}

.flash-tier-btn[data-tier="3"].active {
  border-color: hsl(262 83% 58%);
  box-shadow: 0 0 12px hsl(262 83% 58% / .3);
}

.flash-tier-btn[data-tier="4"].active {
  border-color: hsl(25 95% 53%);
  box-shadow: 0 0 12px hsl(25 95% 53% / .3);
}

.flash-tier-btn[data-tier="5"].active {
  border-color: hsl(0 84% 60%);
  box-shadow: 0 0 12px hsl(0 84% 60% / .3);
}

/* "All" button slightly wider */
.flash-tier-btn[data-tier="0"] {
  width: 36px;
  font-size: 10px;
  letter-spacing: .2px;
}

/* HUD controls */
.flash-hud {
  width: 100%;
  max-width: 300px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  color: hsl(0 0% 100% / .72);
  font-size: 11px;
  -webkit-user-select: none;
  user-select: none;
}

.flash-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, hsl(0 0% 100% / .10), hsl(0 0% 100% / .06));
  border: 1px solid hsl(0 0% 100% / .14);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px hsl(0 0% 0% / .15);
}

/* Speed Controls Row: ◀ ▮▮ ▶ */
.flash-speed-row {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.flash-speed-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  color: hsl(0 0% 100% / .7);
  background: linear-gradient(135deg, hsl(0 0% 100% / .10), hsl(0 0% 100% / .05));
  border: 1px solid hsl(0 0% 100% / .15);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: all .12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.flash-speed-btn:hover {
  background: linear-gradient(135deg, hsl(0 0% 100% / .18), hsl(0 0% 100% / .10));
  color: hsl(0 0% 100%);
}

.flash-speed-btn:active {
  transform: scale(.92);
}

/* Pause/Play button - slightly larger */
.flash-speed-btn.pause-play {
  width: 42px;
  height: 42px;
  font-size: 12px;
  letter-spacing: 2px;
  background: linear-gradient(135deg, hsl(0 0% 100% / .14), hsl(0 0% 100% / .08));
}

/* Playing state - show play icon */
.flash-speed-btn.pause-play.playing {
  color: hsl(142 70% 50%);
  border-color: hsl(142 70% 45% / .4);
}

/* Action Row: Quiz | Define | Poll */
.flash-action-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  margin-top: 4px;
}

.flash-action-btn {
  flex: 1;
  appearance: none;
  border: none;
  cursor: pointer;
  color: hsl(0 0% 100% / .85);
  font-weight: 500;
  letter-spacing: .2px;
  padding: 8px 6px;
  border-radius: 6px;
  background: hsl(0 0% 100% / .08);
  border: 1px solid hsl(0 0% 100% / .10);
  transition: transform .12s ease, background .12s ease;
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.flash-action-btn:active {
  transform: translateY(1px) scale(.97);
}

.flash-action-btn:hover {
  background: hsl(0 0% 100% / .12);
  border-color: hsl(0 0% 100% / .15);
}

.flash-action-btn.active {
  background: linear-gradient(135deg, hsl(142 70% 45% / .3), hsl(142 70% 40% / .2));
  border-color: hsl(142 70% 50% / .4);
  color: hsl(142 80% 85%);
}

/* Button row (legacy, kept for overlays) */
.flash-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 340px;
}

.flash-row+.flash-row {
  margin-top: 14px;
}

.flash-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  color: hsl(0 0% 100%);
  font-weight: 600;
  letter-spacing: .3px;
  padding: 14px 24px;
  border-radius: 12px;
  background: linear-gradient(135deg, hsl(0 0% 100% / .16), hsl(0 0% 100% / .10));
  border: 1px solid hsl(0 0% 100% / .18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px hsl(0 0% 0% / .20);
  transition: transform .12s ease, background .12s ease;
  font-size: 14px;
  min-width: 80px;
  text-align: center;
  white-space: nowrap;
}

.flash-btn:active {
  transform: translateY(1px) scale(.98);
}

.flash-btn:hover {
  background: linear-gradient(135deg, hsl(0 0% 100% / .22), hsl(0 0% 100% / .14));
}

.flash-btn.secondary {
  font-weight: 500;
  color: hsl(0 0% 100% / .72);
  background: linear-gradient(135deg, hsl(0 0% 100% / .10), hsl(0 0% 100% / .06));
}

.flash-btn.active {
  background: linear-gradient(135deg, hsl(0 0% 100% / .26), hsl(0 0% 100% / .18));
  border-color: hsl(0 0% 100% / .30);
}

/* Back button */
.flash-back {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid hsl(0 0% 100% / .18);
  background: linear-gradient(135deg, hsl(0 0% 100% / .12), hsl(0 0% 100% / .06));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: hsl(0 0% 100% / .8);
  transition: all .12s ease;
}

.flash-back:hover {
  background: linear-gradient(135deg, hsl(0 0% 100% / .20), hsl(0 0% 100% / .12));
  border-color: hsl(0 0% 100% / .28);
}

/* Start/End overlay panels */
.flash-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  z-index: 10;
  background: hsl(220 30% 8% / .95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.flash-panel {
  width: min(420px, 90vw);
  border-radius: 24px;
  padding: 32px 28px;
  background: linear-gradient(135deg, hsl(0 0% 100% / .14), hsl(0 0% 100% / .07));
  border: 1px solid hsl(0 0% 100% / .18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 90px hsl(0 0% 0% / .35);
  text-align: center;
}

.flash-panel h3 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: .2px;
  color: hsl(0 0% 100%);
}

.flash-panel p {
  margin: 0 0 20px;
  color: hsl(0 0% 100% / .72);
  font-size: 14px;
  line-height: 1.6;
}

.flash-panel .flash-row {
  margin-top: 0;
}

/* Word echo chips */
.flash-echo {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 20px;
  max-height: 140px;
  overflow-y: auto;
}

.flash-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, hsl(0 0% 100% / .10), hsl(0 0% 100% / .06));
  border: 1px solid hsl(0 0% 100% / .14);
  color: hsl(0 0% 100% / .72);
  font-size: 13px;
}

/* Quiz overlay - flat, no nested cards */
.flash-quiz-overlay {
  position: absolute;
  inset: 0;
  background: hsl(220 20% 10% / .98);
  display: flex;
  flex-direction: column;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  z-index: 20;
}

/* Close button top-right */
.flash-quiz-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  color: hsl(0 0% 100% / .5);
  font-size: 20px;
  cursor: pointer;
  z-index: 5;
}

.flash-quiz-close:hover {
  color: hsl(0 0% 100% / .8)
}

/* Word - compact header */
.flash-quiz-word {
  text-align: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: hsl(0 0% 100%);
  margin: 24px 0 6px;
}

.flash-quiz-q {
  text-align: center;
  font-size: 13px;
  color: hsl(0 0% 100% / .6);
  margin-bottom: 16px;
}

/* Options - tight list, no card feel */
.flash-quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  max-width: 400px;
  margin: 0 auto;
  width: 100%;
}

.flash-quiz-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: hsl(0 0% 100% / .06);
  border: 1px solid hsl(0 0% 100% / .1);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.4;
  color: hsl(0 0% 100% / .85);
  transition: all 0.1s;
  text-align: left;
}

.flash-quiz-opt:active {
  transform: scale(0.98);
}

.flash-quiz-opt.correct {
  border-color: hsl(142 70% 40%);
  background: hsl(142 70% 40% / .2);
}

.flash-quiz-opt.wrong {
  border-color: hsl(0 65% 50%);
  background: hsl(0 65% 50% / .2);
}

.flash-quiz-opt.disabled {
  pointer-events: none
}

/* Letter badge - smaller */
.flash-quiz-letter {
  width: 22px;
  height: 22px;
  background: hsl(0 0% 100% / .1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  color: hsl(0 0% 100% / .6);
}

/* Continue button - bottom */
.flash-quiz-continue {
  margin-top: auto;
  padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  text-align: center;
}

.flash-quiz-continue .flash-btn {
  padding: 12px 24px;
  font-size: 14px;
}

/* Definition Peek Overlay - centered in viewport */
.flash-define-peek {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 25;
  opacity: 0;
  transition: transform .2s ease-out, opacity .2s ease-out;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  width: 320px;
}

.flash-define-peek[style*="display: flex"],
.flash-define-peek[style*="display:flex"] {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.define-peek-content {
  text-align: center;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, hsl(220 30% 15% / .98), hsl(220 30% 12% / .98));
  border: 1px solid hsl(0 0% 100% / .18);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 16px 48px hsl(0 0% 0% / .5), 0 0 0 1px hsl(0 0% 0% / .2);
}

.define-peek-word {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: hsl(0 0% 100%);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.define-peek-def {
  font-size: 14px;
  line-height: 1.45;
  color: hsl(0 0% 100% / .85);
}

.define-peek-save {
  margin-top: 12px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  border-radius: 20px;
  background: hsl(0 0% 100% / .15);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.define-peek-save:hover {
  background: hsl(0 0% 100% / .25);
}

.define-peek-save.saved {
  background: hsl(140 60% 40% / .8);
  color: #fff;
}

/* Accessibility for flash mode */
@media(prefers-reduced-motion:reduce) {
  .flash-page.flip {
    animation: none
  }

  .flash-drift {
    animation: none
  }

  .flash-word.show {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none
  }

  .flash-pulse.active {
    animation: none
  }

  .flash-define-peek {
    transition: none
  }
}

/* === RTC (Reading Comprehension) - COMPACT === */

/* Compact wrapper */
.wrap-compact {
  padding: 8px 12px
}

/* Compact Header - single tight row */
.rtc-header-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.rtc-back-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.rtc-back-btn:hover {
  background: var(--surface)
}

.rtc-header-title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rtc-header-progress {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.rtc-header-tier {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  flex-shrink: 0;
}

/* Compact Passage */
.rtc-passage-compact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
  position: relative;
}

.rtc-passage-compact .rtc-passage {
  font-size: 13px;
  line-height: 1.6;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
}

.rtc-passage-compact .rtc-word-count {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 9px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 999px;
}

.rtc-passage strong,
.rtc-passage b {
  color: var(--accent);
  font-weight: 600;
}

/* Compact Question */
.rtc-question-compact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 8px;
}

.rtc-q-header-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.rtc-q-header-compact .rtc-q-num {
  font-size: 11px;
  font-weight: 600;
}

.rtc-q-header-compact .rtc-q-type {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--muted);
  background: hsl(0 0% 100% / .06);
  padding: 2px 6px;
  border-radius: 999px;
}

.rtc-question-compact .rtc-question {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 10px;
}

/* Compact Options */
.rtc-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rtc-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: hsl(0 0% 100% / .04);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all .12s ease;
}

.rtc-opt:hover {
  background: hsl(0 0% 100% / .08);
  border-color: var(--accent);
}

.rtc-opt.selected {
  background: hsl(217 91% 60% / .15);
  border-color: var(--accent);
}

.rtc-opt.correct {
  background: hsl(142 70% 45% / .15);
  border-color: hsl(142 70% 45%);
}

.rtc-opt.wrong {
  background: hsl(0 65% 50% / .15);
  border-color: hsl(0 65% 50%);
}

.rtc-opt.disabled {
  pointer-events: none;
  opacity: .7;
}

.rtc-opt-letter {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: hsl(0 0% 100% / .1);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.rtc-opt-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.3;
}

/* Attempt info */
.rtc-attempt-info {
  margin-top: 8px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.rtc-attempt-info.warning {
  color: hsl(45 90% 50%)
}

/* Compact Explanation */
.rtc-explanation {
  margin-top: 10px;
  padding: 8px;
  background: hsl(217 91% 60% / .1);
  border: 1px solid hsl(217 91% 60% / .3);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.rtc-explanation.hidden {
  display: none
}

/* Compact Navigation */
.rtc-nav-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}

.rtc-nav-btn {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.rtc-nav-btn:hover {
  background: var(--surface)
}

.rtc-nav-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.rtc-nav-btn.primary:hover {
  filter: brightness(1.1)
}

.rtc-nav-btn:disabled {
  opacity: .5;
  cursor: not-allowed
}

/* Legacy support */
.rtc-header,
.rtc-passage-wrap,
.rtc-question-wrap,
.rtc-nav-row {
  display: none
}

/* RTC Selection Screen (Screen 8) */
.rtc-intro {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
}

.rtc-intro-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.rtc-intro-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

/* RTC Mode Selection */
.rtc-mode-box {
  margin: 20px 0;
}

.rtc-mode-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 10px;
}

.rtc-mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rtc-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .12s ease;
}

.rtc-mode-btn:hover {
  border-color: var(--accent);
}

.rtc-mode-btn.active {
  background: hsl(217 91% 60% / .12);
  border-color: var(--accent);
}

.rtc-mode-icon {
  font-size: 24px;
}

.rtc-mode-label {
  font-size: 13px;
  font-weight: 500;
}

/* RTC Results Screen (Screen 9) - COMPACT */
.rtc-results-compact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.rtc-results-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.rtc-score-ring {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(142 70% 45% / .2), hsl(142 70% 45% / .1));
  border: 2px solid hsl(142 70% 45%);
  flex-shrink: 0;
}

.rtc-score-ring .rtc-score-num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: hsl(142 70% 45%);
}

.rtc-score-ring .rtc-score-of {
  font-size: 12px;
  color: var(--muted);
}

.rtc-score-ring .rtc-score-total {
  font-size: 14px;
  color: var(--muted);
}

.rtc-results-info {
  flex: 1
}

.rtc-results-compact .rtc-results-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}

.rtc-results-compact .rtc-score-pct {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

/* Compact Skills */
.rtc-skills-compact {
  margin-bottom: 10px;
}

.rtc-skills-compact .rtc-skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
}

.rtc-skills-compact .rtc-skill-name {
  font-size: 12px
}

.rtc-skills-compact .rtc-skill-score {
  font-size: 12px;
  font-weight: 600
}

.rtc-skill-score.pass {
  color: hsl(142 70% 45%)
}

.rtc-skill-score.fail {
  color: hsl(0 65% 50%)
}

/* Compact Words */
.rtc-words-compact {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.rtc-words-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 4px;
  flex-shrink: 0;
}

.rtc-words-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.rtc-word-chip {
  padding: 3px 8px;
  background: hsl(217 91% 60% / .15);
  border: 1px solid hsl(217 91% 60% / .3);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
}

/* Compact Results Buttons - single row */
.rtc-results-btns {
  display: flex;
  gap: 8px;
}

.rtc-action-btn {
  flex: 1;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.rtc-action-btn:hover {
  background: var(--surface)
}

.rtc-action-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  flex: 1.5;
}

.rtc-action-btn.primary:hover {
  filter: brightness(1.1)
}

/* Legacy Results Actions - hide */
.rtc-results-actions {
  display: none
}

.rtc-results-header,
.rtc-results-score,
.rtc-words-learned {
  display: none
}

/* Keep old classes for JS compat */
.rtc-results-actions-old {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 10px;
}

.rtc-results-actions .btn {
  width: 100%;
}

.rtc-results-actions .nav-btn {
  text-align: center;
  padding: 12px;
}

/* === ABOUT CAROUSEL - Premium App Style === */
.about-modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  background: var(--bg);
}

.about-modal.active {
  display: flex;
  flex-direction: column
}

.about-container {
  position: relative;
  flex: 1;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Header - clean top bar */
.about-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  padding-top: max(16px, env(safe-area-inset-top));
  flex-shrink: 0;
}

.about-audio-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.15s;
}

.about-audio-btn:hover {
  background: var(--bg)
}

.about-audio-btn.active {
  background: var(--accent-light);
  border-color: var(--accent);
}

.about-audio-btn.active .about-audio-icon::after {
  content: '🔊'
}

.about-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-size: 20px;
  color: var(--muted);
  transition: all 0.15s;
}

.about-close-btn:hover {
  background: var(--bg);
  color: var(--ink);
}

/* Carousel Track */
.about-track {
  flex: 1;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.about-track::-webkit-scrollbar {
  display: none
}

/* Slides */
.about-slide {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.about-slide-content {
  max-width: 360px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

/* Featured Card - Apple Store style */
.about-feature-card {
  width: 100%;
  background: var(--surface);
  border-radius: 16px;
  padding: 24px 20px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.about-feature-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  background: var(--accent-light);
}

.about-feature-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin: 0;
}

.about-feature-subtitle {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  margin: 0;
}

/* Stats row inside card */
.about-feature-stats {
  display: flex;
  gap: 24px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  width: 100%;
  justify-content: center;
}

.about-feature-stat {
  text-align: center
}

.about-feature-stat-val {
  display: block;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
}

.about-feature-stat-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Tier pills - horizontal layout */
.about-tier-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.about-tier-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.about-tier-pill.t1 {
  background: var(--t1);
  color: var(--t1-ink)
}

.about-tier-pill.t2 {
  background: var(--t2);
  color: var(--t2-ink)
}

.about-tier-pill.t3 {
  background: var(--t3);
  color: var(--t3-ink)
}

.about-tier-pill.t4 {
  background: var(--t4);
  color: var(--t4-ink)
}

.about-tier-pill.t5 {
  background: var(--t5);
  color: var(--t5-ink)
}

.about-tier-pill span {
  font-size: 16px
}

/* Theme chips */
.about-theme-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.about-theme-chip {
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  color: var(--ink2);
}

/* Mini word card preview */
.about-mini-card {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
}

.about-mini-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.about-mini-card-emoji {
  font-size: 24px
}

.about-mini-card-word {
  font-weight: 700;
  font-size: 16px;
  flex: 1;
}

.about-mini-card-tier {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--t2);
  color: var(--t2-ink);
}

.about-mini-card-def {
  font-size: 13px;
  color: var(--ink2);
  line-height: 1.4;
  margin-bottom: 8px;
}

.about-mini-card-sentence {
  font-size: 12px;
  font-style: italic;
  color: var(--muted);
  padding: 8px;
  background: var(--warm-bg);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}

/* Action buttons row */
.about-action-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.about-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-width: 70px;
}

.about-action-btn-icon {
  font-size: 20px
}

.about-action-btn-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500
}

/* Quiz preview */
.about-quiz-preview {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.about-quiz-word {
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  margin-bottom: 8px;
}

.about-quiz-q {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
}

.about-quiz-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.about-quiz-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
}

.about-quiz-opt-letter {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}

.about-quiz-opt.correct {
  background: var(--success-bg);
  border-color: var(--success);
}

.about-quiz-opt.correct .about-quiz-opt-letter {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.about-quiz-opt.wrong {
  background: var(--error-bg);
  border-color: var(--error);
}

.about-quiz-opt.wrong .about-quiz-opt-letter {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

/* Flash mode preview */
.about-flash-preview {
  width: 100%;
  background: linear-gradient(135deg, hsl(240 20% 12%), hsl(220 20% 8%));
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
}

.about-flash-word {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.about-flash-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.about-flash-ctrl {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
}

.about-flash-ctrl.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* RTC passage preview */
.about-rtc-preview {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
}

.about-rtc-passage {
  font-size: 12px;
  color: var(--ink2);
  line-height: 1.6;
  margin-bottom: 10px;
}

.about-rtc-passage strong {
  color: var(--accent)
}

.about-rtc-question {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.about-rtc-opts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.about-rtc-opt {
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
}

/* Poll preview */
.about-poll-preview {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.about-poll-q {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
}

.about-poll-opts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.about-poll-opt {
  position: relative;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  overflow: hidden;
}

.about-poll-bar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--accent-light);
  border-radius: 8px 0 0 8px;
}

.about-poll-opt-text {
  position: relative;
  z-index: 1;
}

.about-poll-opt-pct {
  position: relative;
  z-index: 1;
  float: right;
  font-weight: 600;
  color: var(--accent);
}

/* CTA slide */
.about-cta-content {
  text-align: center;
}

.about-cta-icon {
  font-size: 48px;
  margin-bottom: 8px;
}

.about-cta-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 8px;
}

.about-cta-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 20px;
}

.about-cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 260px;
  margin: 0 auto;
}

.about-cta-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--surface);
  color: var(--ink);
}

.about-cta-btn:active {
  transform: scale(0.98)
}

.about-cta-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.about-cta-btn.primary:hover {
  background: var(--accent-hover)
}

.about-cta-btn:not(.primary):hover {
  background: var(--bg);
  border-color: var(--accent);
}

/* Bottom Navigation Bar - horizontal layout */
.about-nav {
  flex-shrink: 0;
  padding: 12px 20px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

/* Skip link - left */
.about-skip {
  padding: 8px 0;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  background: none;
  border: none;
  min-width: 60px;
  text-align: left;
}

.about-skip:hover {
  color: var(--ink)
}

/* Progress Dots - center */
.about-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.about-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  background: var(--line);
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.about-dot:hover {
  background: var(--muted)
}

.about-dot.active {
  background: var(--accent);
  width: 18px;
  border-radius: 3px;
}

/* Navigation Buttons - right */
.about-btn-row {
  display: flex;
  gap: 8px;
  min-width: 60px;
  justify-content: flex-end;
}

.about-nav-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.about-nav-btn.secondary {
  background: transparent;
  color: var(--muted);
}

.about-nav-btn.secondary:hover {
  color: var(--ink)
}

.about-nav-btn.primary {
  background: var(--accent);
  color: #fff;
}

.about-nav-btn.primary:hover {
  background: var(--accent-hover)
}

/* Hide old arrows */
.about-arrow {
  display: none
}

/* Reduced motion */
@media(prefers-reduced-motion:reduce) {
  .about-track {
    scroll-behavior: auto
  }
}

/* === FILE PICKER === */
.file-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.file-modal.active {
  display: flex
}

.file-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  max-width: 300px;
  text-align: center;
}

.file-emoji {
  font-size: 40px;
  margin-bottom: 10px
}

.file-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.file-text {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: var(--space-md);
}

.file-input {
  display: none
}

.file-btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.file-btn:hover {
  background: var(--accent-hover)
}

/* === CHIP (for flash echo) === */
.chip {
  display: inline-block;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
}

/* === ACCESSIBILITY === */
@media(prefers-reduced-motion:reduce) {
  .flash-page.flip {
    animation: none
  }

  .flash-drift {
    animation: none
  }

  .flash-word.show {
    animation: none;
    opacity: 1;
    filter: none;
    transform: none
  }

  * {
    transition-duration: 0.01ms !important
  }
}

/* Focus states */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* === RESPONSIVE CONTAINER === */
@media(min-width:768px) {
  :root {
    --container: min(520px, 100% - 40px);
  }
}

@media(min-width:1024px) {
  :root {
    --container: min(560px, 100% - 48px);
  }
}

/* === FAQ SCREEN === */
.faq-container {
  padding-bottom: var(--space-xl);
}

.faq-bucket {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.faq-bucket-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.faq-item {
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.faq-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.faq-q {
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  /* Hide default triangle */
  position: relative;
  padding-right: 20px;
}

.faq-q::-webkit-details-marker {
  display: none;
}

.faq-q::after {
  content: '▼';
  position: absolute;
  right: 0;
  top: 2px;
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s;
}

details[open] .faq-q::after {
  transform: rotate(180deg);
}

.faq-a {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink2);
  padding-right: 12px;
}

/* === BOOKMARKS FEATURE === */

/* Saved button style in hero - matches secondary buttons */
.cta-btn.saved {
  background: var(--surface);
  border-color: var(--line);
}

.cta-btn.saved:hover {
  border-color: var(--accent);
}

/* Bookmark button state in word card */
.card-action.bookmarked {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* Bookmarks Screen (11) Header */
.bookmarks-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.bookmarks-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bookmarks-count {
  font-size: 16px;
  font-weight: 600;
}

.bookmarks-min {
  font-size: 11px;
  color: var(--muted);
}

/* Bookmarks List */
.bookmarks-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - 280px);
  overflow-y: auto;
  padding-bottom: 12px;
}

.bookmark-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.12s;
}

.bookmark-item:hover {
  border-color: var(--accent);
}

.bookmark-item-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.bookmark-emoji {
  font-size: 20px;
  flex-shrink: 0;
}

.bookmark-info {
  flex: 1;
  min-width: 0;
}

.bookmark-word {
  display: block;
  font-weight: 600;
  font-size: 14px;
}

.bookmark-def {
  display: block;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-tier {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}

.bookmark-remove {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.12s;
  flex-shrink: 0;
}

.bookmark-remove:hover {
  background: hsl(0 65% 50% / .1);
  color: hsl(0 65% 50%);
}

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

.bookmarks-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.bookmarks-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 16px;
}

.bookmarks-empty-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  text-align: left;
  max-width: 240px;
  margin-left: auto;
  margin-right: auto;
}

.bookmarks-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink2);
}

.step-num {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.bookmarks-empty-hint {
  font-size: 12px;
  margin-top: 6px;
}

/* Progress message when less than minimum */
.bookmarks-progress-msg {
  text-align: center;
  padding: 10px 16px;
  margin-bottom: 12px;
  background: hsl(45 90% 50% / .1);
  border: 1px solid hsl(45 90% 50% / .3);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: hsl(35 80% 35%);
}

/* CTA */
.bookmarks-cta {
  padding: 16px 0;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

/* === BOOKMARK TEST CONFIG MODAL === */
.bm-test-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.bm-test-modal.active {
  display: flex;
}

.bm-test-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: min(360px, 100%);
  box-shadow: var(--shadow-lg);
}

.bm-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.bm-config-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.bm-config-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  border-radius: 50%;
}

.bm-config-close:hover {
  background: var(--bg);
}

.bm-config-section {
  margin-bottom: 20px;
}

.bm-config-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

.bm-config-btns {
  display: flex;
  gap: 8px;
}

.test-count-btn,
.test-time-btn {
  flex: 1;
  padding: 10px 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.12s;
}

.test-count-btn:hover,
.test-time-btn:hover {
  border-color: var(--accent);
}

.test-count-btn.active,
.test-time-btn.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.test-count-btn:disabled,
.test-time-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === BOOKMARK TEST SCREEN (12) === */
.bm-test-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  margin-bottom: 12px;
}

.bm-test-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
}

.bm-test-progress {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.bm-test-timer {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding: 2px 8px;
  background: var(--accent-light);
  border-radius: 999px;
}

.bm-test-timer:empty {
  display: none;
}

.bm-test-timer.warning {
  color: hsl(0 65% 50%);
  background: hsl(0 65% 50% / .1);
}

.bm-test-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 10px;
}

.bm-test-word-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.bm-test-emoji {
  font-size: 28px;
}

.bm-test-word {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
}

.bm-test-question {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 12px;
}

.bm-test-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bm-test-opt {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.12s;
}

.bm-test-opt:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.bm-test-opt.correct {
  background: hsl(142 70% 45% / .1);
  border-color: hsl(142 70% 45%);
}

.bm-test-opt.wrong {
  background: hsl(0 65% 50% / .1);
  border-color: hsl(0 65% 50%);
}

.bm-test-opt.disabled {
  pointer-events: none;
  opacity: 0.8;
}

.bm-test-opt-letter {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.bm-test-opt.correct .bm-test-opt-letter {
  background: hsl(142 70% 45%);
  border-color: hsl(142 70% 45%);
  color: #fff;
}

.bm-test-opt.wrong .bm-test-opt-letter {
  background: hsl(0 65% 50%);
  border-color: hsl(0 65% 50%);
  color: #fff;
}

.bm-test-opt-text {
  flex: 1;
  font-size: 13px;
  line-height: 1.4;
}

.bm-test-nav {
  display: none;
}

/* === BOOKMARK RESULTS SCREEN (13) === */
.bm-results-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}

.bm-results-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.bm-result-ring {
  width: 72px;
  height: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(142 70% 45% / .12), hsl(142 70% 45% / .04));
  border: 3px solid hsl(142 70% 45%);
  flex-shrink: 0;
}

.bm-result-score {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: hsl(142 70% 45%);
}

.bm-result-of {
  display: none;
}

.bm-result-total {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.bm-result-total::before {
  content: "of ";
}

.bm-results-info {
  flex: 1;
}

.bm-results-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 2px;
}

.bm-result-pct {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}

.bm-results-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
}

.bm-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bm-stat-label {
  font-size: 12px;
  color: var(--muted);
}

.bm-stat-value {
  font-size: 14px;
  font-weight: 600;
}

.bm-timed-out {
  background: hsl(45 90% 50% / .1);
  border: 1px solid hsl(45 90% 50% / .3);
  border-radius: var(--radius);
  padding: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: hsl(35 80% 35%);
  margin-bottom: 12px;
}

.bm-missed-section {
  margin-top: 12px;
}

.bm-missed-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.bm-missed-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bm-missed-chip {
  padding: 4px 10px;
  background: hsl(0 65% 50% / .1);
  border: 1px solid hsl(0 65% 50% / .2);
  border-radius: 999px;
  font-size: 12px;
  color: hsl(0 65% 50%);
  cursor: pointer;
  transition: all 0.12s;
}

.bm-missed-chip:hover {
  background: hsl(0 65% 50% / .2);
  border-color: hsl(0 65% 50% / .4);
}

/* Word preview popup */
.word-preview-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.word-preview-popup.active {
  display: flex;
}

.word-preview-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: min(340px, 100%);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.word-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 16px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.word-preview-close:hover {
  background: var(--line);
}

.word-preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.word-preview-emoji {
  font-size: 32px;
}

.word-preview-main {
  flex: 1;
}

.word-preview-word {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.word-preview-meta {
  font-size: 12px;
  color: var(--muted);
}

.word-preview-tier {
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}

.word-preview-def {
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.word-preview-sentence {
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  padding: 10px;
  background: var(--bg);
  border-radius: var(--radius);
}

.bm-perfect {
  text-align: center;
  font-size: 18px;
  padding: 12px;
  color: hsl(142 70% 40%);
}

.bm-results-btns {
  display: flex;
  gap: 10px;
}

.bm-results-btns .btn {
  flex: 1;
}

/* ========================================
   EXTENDED TRAINING SECTION (Home Page)
   ======================================== */

.extended-training {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-top: var(--space-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}

.extended-training-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.extended-training-header h2 {
  font-size: clamp(18px, 4vw, 22px);
  color: var(--ink);
  margin-bottom: 4px;
}

.extended-training-subtitle {
  font-size: 14px;
  color: var(--muted);
}

.extended-training-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}

.extended-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--space-md);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.extended-card:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.extended-card-icon {
  font-size: 24px;
}

.extended-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.extended-card-desc {
  font-size: 12px;
  color: var(--muted);
}

/* ========================================
   WORD EXPLORER SCREEN (Screen 14)
   ======================================== */

/* ===== COMPACT MOBILE FILTER BAR ===== */
.explorer-compact-bar {
  background: var(--surface);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Row 1: Search + Source dropdown */
.explorer-row-1 {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.explorer-row-1 .explorer-search-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  min-width: 0;
  outline: none;
  transition: border-color 0.15s;
}

.explorer-row-1 .explorer-search-input:focus {
  border-color: var(--accent);
}

.explorer-source-select {
  padding: 10px 12px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  min-width: 100px;
  outline: none;
}

/* Row 2: Letters + POS in 2 columns */
.explorer-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}

.explorer-filter-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.explorer-filter-label-sm {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.explorer-range-compact {
  display: flex;
  align-items: center;
  gap: 6px;
}

.explorer-range-compact span {
  color: var(--muted);
  font-size: 12px;
}

.explorer-range-sm {
  width: 50px;
  padding: 8px 4px;
  text-align: center;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  outline: none;
}

.explorer-range-sm:focus {
  border-color: var(--accent);
}

.explorer-pos-select {
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  width: 100%;
  outline: none;
}

/* Row 3: Collapsible Pattern Search */
.explorer-pattern-details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 4px;
}

.explorer-pattern-summary {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 4px;
}

.explorer-pattern-summary::before {
  content: '▶';
  font-size: 8px;
  transition: transform 0.2s;
}

.explorer-pattern-details[open] .explorer-pattern-summary::before {
  transform: rotate(90deg);
}

.explorer-pattern-compact {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.explorer-pattern-mode-sm {
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  min-width: 80px;
}

.explorer-pattern-input-sm {
  flex: 1;
  padding: 6px 10px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  min-width: 60px;
}

.explorer-pattern-btn-sm {
  padding: 6px 12px;
  font-size: 13px;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

/* Hide desktop version on mobile */
.explorer-desktop-only {
  display: none;
}

/* Desktop: show full version, hide compact */
@media (min-width: 600px) {
  .explorer-compact-bar {
    display: none;
  }

  .explorer-desktop-only {
    display: block;
  }

  /* Move results header after desktop box */
  .explorer-results-header {
    margin-top: 0;
  }
}

/* Search Box - Desktop */
.explorer-search-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  margin-bottom: var(--space-md);
}

.explorer-search-row {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.explorer-search-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.explorer-search-input:focus {
  border-color: var(--accent);
}

.explorer-search-btn {
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s;
}

.explorer-search-btn:hover {
  background: var(--accent-hover);
}

/* Filters */
.explorer-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.explorer-filter-group {
  flex: 1;
  min-width: 140px;
}

.explorer-filter-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.explorer-range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.explorer-range-input {
  width: 60px;
  padding: 8px;
  text-align: center;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.explorer-range-sep {
  color: var(--muted);
  font-size: 13px;
}

.explorer-pos-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.explorer-pos-btn {
  padding: 6px 12px;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
}

.explorer-pos-btn:hover {
  border-color: var(--accent);
}

.explorer-pos-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Pattern Search */
.explorer-pattern-box {
  padding-top: var(--space-md);
  border-top: 1px solid var(--line);
}

.explorer-pattern-row {
  display: flex;
  gap: var(--space-sm);
}

.explorer-pattern-mode {
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
}

.explorer-pattern-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  min-width: 80px;
}

.explorer-pattern-btn {
  padding: 8px 16px;
  font-size: 14px;
  background: var(--ink);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity 0.2s;
}

.explorer-pattern-btn:hover {
  opacity: 0.85;
}

/* Data Source Toggle */
.explorer-source-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.explorer-source-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.explorer-source-btns {
  display: flex;
  gap: 8px;
  flex: 1;
}

.explorer-source-btn {
  flex: 1;
  padding: 10px 14px;
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.explorer-source-btn:hover {
  border-color: var(--accent);
}

.explorer-source-btn.active {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

/* Results Header */
.explorer-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-sm);
  padding: 8px 4px;
}

.explorer-results-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.explorer-sort {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  background: var(--surface);
  cursor: pointer;
}

/* Results List */
.explorer-results {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-height: 60vh;
  overflow-y: auto;
}

.explorer-empty,
.explorer-loading {
  text-align: center;
  padding: var(--space-xl);
  color: var(--muted);
  font-size: 14px;
}

.explorer-loading {
  color: var(--accent);
}

/* Word Card */
.explorer-word-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all 0.2s;
}

.explorer-word-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.explorer-word-main {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.explorer-word-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.explorer-word-pos {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 10px;
}

.explorer-word-len {
  font-size: 11px;
  color: var(--muted);
}

.explorer-word-sat {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  padding: 2px 6px;
  border-radius: 4px;
}

.explorer-word-actions {
  display: flex;
  gap: 6px;
}

.explorer-action-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.2s;
}

.explorer-action-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: scale(1.05);
}

/* Load More */
.explorer-load-more {
  text-align: center;
  padding: var(--space-md);
}

/* ========================================
   EXPLORER WORD MODAL
   ======================================== */

.explorer-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: var(--space-md);
}

.explorer-modal.active {
  opacity: 1;
  visibility: visible;
}

.explorer-modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.explorer-modal.active .explorer-modal-content {
  transform: translateY(0);
}

.explorer-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  background: var(--bg);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 1;
}

.explorer-modal-close:hover {
  background: var(--error-bg);
  color: var(--error);
}

.explorer-modal-header {
  padding: var(--space-lg);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
}

.explorer-modal-word {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
}

.explorer-modal-pos {
  font-size: 14px;
  color: var(--muted);
}

/* Tabs */
.explorer-modal-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 var(--space-md);
}

.explorer-tab {
  flex: 1;
  padding: var(--space-md);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  position: relative;
  transition: color 0.2s;
}

.explorer-tab:hover {
  color: var(--ink);
}

.explorer-tab.active {
  color: var(--accent);
}

.explorer-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

/* Tab Content */
.explorer-tab-content {
  display: none;
  padding: var(--space-lg);
}

.explorer-tab-content.active {
  display: block;
}

/* Hooks Tab */
.explorer-hook-section {
  text-align: center;
}

.explorer-hook-letters {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.explorer-letter {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: white;
  font-size: 18px;
  font-weight: 700;
  border-radius: var(--radius);
}

.explorer-hook-phrase {
  font-size: 16px;
  line-height: 1.8;
  color: var(--ink);
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius);
  margin-bottom: var(--space-md);
}

.explorer-hook-regenerate {
  padding: 10px 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  color: var(--ink);
  transition: all 0.2s;
}

.explorer-hook-regenerate:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Links Tab */
.explorer-links-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.explorer-links-group {
  /* Each group */
}

.explorer-links-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--space-sm);
}

.explorer-links-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.explorer-chip {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s;
}

.explorer-chip:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.explorer-no-results {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* Roots Tab */
.explorer-roots-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.explorer-root-item {
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.explorer-root-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: 8px;
}

.explorer-root-type {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  color: white;
}

.explorer-root-type.prefix {
  background: #4a90a4;
}

.explorer-root-type.suffix {
  background: #a4724a;
}

.explorer-root-type.root {
  background: #4aa470;
}

.explorer-root-affix {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.explorer-root-origin {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

.explorer-root-meaning {
  font-size: 14px;
  color: var(--ink2);
  margin-bottom: 8px;
}

.explorer-root-pos {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.explorer-root-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.explorer-chip-sm {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12px;
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.2s;
}

.explorer-chip-sm:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.explorer-root-count {
  font-size: 11px;
  color: var(--accent);
  margin-left: auto;
  font-weight: 600;
}

.explorer-roots-stats {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
}

.explorer-roots-stats p {
  margin-bottom: 4px;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 480px) {
  .extended-training-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .explorer-filters {
    flex-direction: column;
  }

  .explorer-filter-group {
    width: 100%;
  }

  .explorer-source-btns {
    flex-direction: column;
  }

  .explorer-source-btn {
    text-align: center;
  }

  .explorer-hook-letters {
    gap: 4px;
  }

  .explorer-letter {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
}

/* ========================================
   COMPACT MOBILE WORD CARDS
   ======================================== */

/* Mobile-first: Single row compact layout */
.explorer-word-card {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
  background: var(--surface);
  border: none;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  margin-bottom: 8px;
  transition: all 0.15s ease;
}

.explorer-word-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.explorer-word-main {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.explorer-word-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.explorer-word-pos {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--bg);
  color: var(--muted);
  border-radius: 4px;
  flex-shrink: 0;
}

.explorer-word-len {
  display: none;
}

.explorer-word-sat {
  display: none;
}

.explorer-word-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.explorer-action-btn {
  width: 32px;
  height: 32px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.explorer-action-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  transform: scale(1.08);
}

/* Results container spacing */
.explorer-results {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 8px 0;
}

/* Desktop: show length, larger buttons */
@media (min-width: 600px) {
  .explorer-word-card {
    padding: 16px 20px;
    gap: 16px;
    margin-bottom: 10px;
  }

  .explorer-word-text {
    font-size: 17px;
  }

  .explorer-word-pos {
    font-size: 12px;
    padding: 3px 10px;
  }

  .explorer-word-len {
    display: inline;
  }

  .explorer-word-sat {
    display: inline;
    font-size: 10px;
    padding: 2px 6px;
  }

  .explorer-action-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* ========================================
   ABOUT CAROUSEL - WORD EXPLORER SLIDE
   ======================================== */

.about-explorer-preview {
  margin-top: var(--space-md);
}

.about-explorer-tools {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.about-explorer-tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-width: 80px;
}

.about-explorer-tool-icon {
  font-size: 24px;
}

.about-explorer-tool-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.about-explorer-tool-desc {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}

/* About Slide: Writer's Toolkit */
.about-toolkit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: var(--space-md);
}

.about-toolkit-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 6px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.about-toolkit-icon {
  font-size: 20px;
}

.about-toolkit-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
}

.about-toolkit-tagline {
  margin-top: var(--space-sm);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* ========================================
   WRITER'S TOOLKIT SECTION
   ======================================== */

.writers-toolkit {
  margin: var(--space-lg) 0;
  padding: var(--space-md);
  background: linear-gradient(135deg, #fef7ed 0%, #fdf2e4 100%);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201, 105, 60, 0.15);
}

.writers-toolkit-header {
  text-align: center;
  margin-bottom: var(--space-md);
}

.writers-toolkit-header h2 {
  font-size: clamp(18px, 4vw, 22px);
  color: var(--ink);
  margin-bottom: 4px;
}

.writers-toolkit-subtitle {
  font-size: 13px;
  color: var(--muted);
}

.writers-toolkit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.toolkit-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.toolkit-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.toolkit-card:active {
  transform: scale(0.98);
}

.toolkit-card-icon {
  font-size: 20px;
  line-height: 1;
}

.toolkit-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.toolkit-card-desc {
  font-size: 9px;
  color: var(--muted);
  line-height: 1.2;
}

/* Mobile: 4 columns but smaller */
@media (max-width: 400px) {
  .writers-toolkit-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ========================================
   WRITER TOOL MODAL
   ======================================== */

.writer-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  padding: var(--space-md);
}

.writer-modal.active {
  opacity: 1;
  visibility: visible;
}

.writer-modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.writer-modal.active .writer-modal-content {
  transform: translateY(0);
}

.writer-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
}

.writer-modal-close:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.writer-modal-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-bottom: 1px solid var(--line);
  background: var(--warm-bg);
}

.writer-modal-icon {
  font-size: 32px;
  line-height: 1;
}

.writer-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

.writer-modal-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.writer-modal-input {
  padding: var(--space-md);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

/* Input variations for different tools */
.writer-input-row {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  flex-wrap: wrap;
}

.writer-input-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 60px;
}

.writer-input-field {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  min-width: 100px;
}

.writer-input-field:focus {
  outline: none;
  border-color: var(--accent);
}

.writer-input-select {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  cursor: pointer;
}

.writer-input-btn {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.writer-input-btn:hover {
  background: var(--accent-hover);
}

/* Syllable/number buttons */
.writer-num-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.writer-num-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.writer-num-btn:hover {
  border-color: var(--accent);
}

.writer-num-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Letter buttons for alliteration */
.writer-letter-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.writer-letter-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-transform: uppercase;
}

.writer-letter-btn:hover {
  border-color: var(--accent);
}

.writer-letter-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Results header */
.writer-modal-results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.writer-modal-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.writer-modal-copy {
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.writer-modal-copy:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* Results list */
.writer-modal-results {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm);
  max-height: 300px;
}

.writer-modal-empty {
  text-align: center;
  padding: var(--space-xl);
  color: var(--muted);
  font-size: 14px;
}

.writer-results-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.writer-results-grouped {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.writer-results-header {
  width: 100%;
  padding: 8px 0 4px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
}

.writer-results-header:first-child {
  margin-top: 0;
}

.writer-result-word {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}

.writer-result-word:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.writer-result-word.sat {
  border-left: 3px solid var(--accent);
}

/* Hint text */
.writer-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: var(--space-xs);
  font-style: italic;
}

/* Quick filter chips */
.writer-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.writer-chip {
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12px;
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.15s;
}

.writer-chip:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.writer-chip.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ========================================
   WRITER MODAL - TAB INTERFACE
   ======================================== */

/* Tab Container */
.writer-modal-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.writer-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.writer-tab:hover {
  background: var(--surface);
  color: var(--ink2);
}

.writer-tab.active {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.writer-tab-icon {
  font-size: 14px;
}

/* Tab Panels */
.writer-tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.writer-tab-panel.active {
  display: flex;
}

/* ========================================
   WRITER MODAL - FAQ PANEL
   ======================================== */

.writer-faq-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  max-height: 400px;
}

.writer-faq-section {
  margin-bottom: 16px;
}

.writer-faq-section:last-child {
  margin-bottom: 0;
}

.writer-faq-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.writer-faq-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* FAQ Item - Using <details> for expand/collapse */
.writer-faq-item {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.writer-faq-item[open] {
  background: var(--surface);
  border-color: var(--accent);
}

.writer-faq-q {
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.writer-faq-q::-webkit-details-marker {
  display: none;
}

.writer-faq-q::before {
  content: '+';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--accent-light);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  transition: all 0.2s;
}

.writer-faq-item[open] .writer-faq-q::before {
  content: '−';
  background: var(--accent);
  color: white;
}

.writer-faq-a {
  padding: 0 12px 12px 38px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink2);
}

/* ========================================
   WRITER MODAL - COMING SOON INDICATORS
   ======================================== */

.writer-coming-soon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: linear-gradient(135deg, var(--warm-bg) 0%, #fff3e0 100%);
  border: 1px dashed var(--accent);
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.coming-soon-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  background: var(--warm-bg);
  border: 1px dashed var(--accent);
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  margin-left: 6px;
  vertical-align: middle;
}

/* ========================================
   WRITER MODAL - SMARTNESS ENHANCEMENTS
   ======================================== */

/* Syllable break display */
.word-syllables {
  font-size: 12px;
  color: var(--muted);
  margin-left: 4px;
}

/* Scrabble score breakdown */
.word-score {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.word-score-main {
  font-weight: 600;
  color: var(--ink);
}

.word-score-breakdown {
  font-size: 11px;
  color: var(--muted);
  font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

/* Pattern preview for crossword */
.pattern-box {
  display: flex;
  gap: 4px;
  margin: 8px 0;
  flex-wrap: wrap;
}

.pattern-letter {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--line);
  border-radius: 4px;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--surface);
}

.pattern-letter.known {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.pattern-letter.unknown {
  color: var(--muted);
  background: var(--bg);
}

/* Length group headers in results */
.writer-group-header {
  width: 100%;
  padding: 6px 10px;
  margin-top: 10px;
  background: var(--accent-light);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.writer-group-header:first-child {
  margin-top: 0;
}

/* Rhyme quality indicators */
.rhyme-perfect {
  border-left: 3px solid var(--success);
}

.rhyme-near {
  border-left: 3px solid var(--muted);
}

/* ========================================
   WRITER MODAL - REDUCED PADDING MODE
   Less left/right margins for more content
   ======================================== */

.writer-modal {
  padding: 8px;
}

.writer-modal-content {
  max-width: 520px;
}

.writer-modal-header {
  padding: 10px 12px;
}

.writer-modal-input {
  padding: 10px 12px;
}

.writer-modal-results-header {
  padding: var(--space-xs) 12px;
}

.writer-modal-results {
  padding: 8px;
}

/* ========================================
   WRITER MODAL - RESULT FILTER BAR
   ======================================== */

.writer-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.writer-filter-input {
  flex: 1;
  min-width: 100px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  background: var(--surface);
}

.writer-filter-input:focus {
  outline: none;
  border-color: var(--accent);
}

.writer-filter-input::placeholder {
  color: var(--muted);
  font-style: italic;
}

.writer-filter-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.writer-filter-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

.writer-filter-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.writer-filter-toggle:hover .writer-filter-label {
  color: var(--accent);
}

/* Adjust results header for filter bar */
.writer-modal-results-header {
  flex-wrap: wrap;
}

/* ========================================
   WRITER MODAL - PAGINATION
   ======================================== */

.writer-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.writer-page-btn {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.writer-page-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.writer-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.writer-page-info {
  font-size: 12px;
  color: var(--muted);
}

/* ========================================
   WRITER MODAL - TOOL LINKS IN FAQ
   ======================================== */

.writer-tool-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px dashed var(--accent);
  transition: all 0.15s;
}

.writer-tool-link:hover {
  color: var(--accent-hover);
  border-bottom-style: solid;
  background: var(--accent-light);
  padding: 0 2px;
  margin: 0 -2px;
  border-radius: 2px;
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */

.toast-notification {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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