/* ==========================================================================
   EnglishPhonics - Core Design System & Styles
   ========================================================================== */

:root {
  color-scheme: light dark;
  --primary-coral: #eb5757;
  --primary-coral-hover: #d94343;
  --primary-coral-light: #fff5f5;
  --primary-coral-border: #fca5a5;
  --accent-orange: #f97316;

  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-pill-inactive: #f1f5f9;

  --text-dark: #1e293b;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --text-hint: #0284c7;

  --border-light: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-active: #eb5757;

  --scrollbar-track: #f1f5f9;
  --scrollbar-thumb: #64748b;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-card: 0 10px 30px -5px rgba(15, 23, 42, 0.06);
  --shadow-card-hover: 0 16px 32px -4px rgba(235, 87, 87, 0.12), 0 6px 12px -2px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-sans: 'Plus Jakarta Sans', 'Inter', 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-reading: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);

  accent-color: var(--primary-coral);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Reflect active theme in :root color-scheme so native UI (scrollbars, inputs, canvas) always matches */
:root:has(> head > meta[name="color-scheme"][content="light"]),
:root:has(> body:not(.dark-mode)) {
  color-scheme: light;
}

:root:has(> head > meta[name="color-scheme"][content="dark"]),
:root.dark-mode,
:root:has(> body.dark-mode) {
  color-scheme: dark;
}

/* Dark mode support — 3-tier surface hierarchy + WCAG 2.1 AA contrast */
html.dark-mode,
body.dark-mode {
  --primary-coral: #f26868;
  --primary-coral-hover: #f87171;
  --primary-coral-light: rgba(242, 104, 104, 0.16);
  --primary-coral-border: rgba(248, 113, 113, 0.42);
  --accent-orange: #fb923c;

  --bg-main: #090d16;
  --bg-card: #111827;
  --bg-card-hover: #182235;
  --bg-pill-inactive: #1a2436;

  --text-dark: #f8fafc;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-hint: #60a5fa;

  --border-light: rgba(148, 163, 184, 0.14);
  --border-subtle: rgba(148, 163, 184, 0.24);
  --border-active: #f26868;

  --scrollbar-track: #0f172a;
  --scrollbar-thumb: #64748b;

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.35);
  --shadow-card: 0 18px 40px -12px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(148, 163, 184, 0.08);
  --shadow-card-hover: 0 20px 38px -8px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(242, 104, 104, 0.32);
  --shadow-modal: 0 28px 60px -12px rgba(0, 0, 0, 0.78);
}

/* Text selection theming (Light & Dark) */
::selection {
  background-color: rgba(235, 87, 87, 0.22);
  color: var(--text-primary);
}

body.dark-mode ::selection {
  background-color: rgba(242, 104, 104, 0.34);
  color: #ffffff;
}

/* Legacy WebKit scrollbar fallback only where standard scrollbar-color is unsupported */
@supports not (scrollbar-color: auto) {
  html::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }

  html::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }

  html::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 9999px;
    border: 3px solid var(--scrollbar-track);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
}

/* Accessibility Focus Ring (WCAG 2.1 AA) */
*:focus-visible {
  outline: 3px solid var(--primary-coral);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip to main content link for keyboard & screen reader accessibility */
.skip-to-content {
  position: absolute;
  top: -120px;
  left: 20px;
  background: var(--primary-coral);
  color: #ffffff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 0.95rem;
  text-decoration: none;
  z-index: 9999;
  transition: top 0.25s ease-in-out;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.skip-to-content:focus {
  top: 20px;
  outline: 3px solid #ffffff;
  outline-offset: 2px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-dark);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Bloqueo de zoom táctil: sin doble toque ni pellizco, solo desplazamiento */
html {
  touch-action: pan-x pan-y;
  -ms-touch-action: pan-x pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  background-color: var(--bg-main);
}

body,
button,
a,
[role="button"],
[role="tab"],
.letter-card,
.ipa-card {
  touch-action: manipulation;
}

img,
svg,
video {
  max-width: 100%;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.app-header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-top {
  max-width: 1380px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand-wrapper {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 2px 6px;
  transition: opacity 0.18s ease;
}

.brand-wrapper:hover {
  opacity: 0.9;
}

.brand-wrapper:focus-visible {
  outline: 2px solid var(--coral-primary);
  outline-offset: 4px;
}

.brand-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 2px;
}

.brand-title .accent {
  color: var(--primary-coral);
  font-weight: 900;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-pill {
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  letter-spacing: 0.02em;
}

.header-pill:hover {
  border-color: var(--primary-coral-border);
  color: var(--primary-coral);
}

.header-pill.active {
  background-color: var(--primary-coral);
  border-color: var(--primary-coral);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(235, 87, 87, 0.35);
}

.header-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.header-icon-btn:hover {
  border-color: var(--primary-coral-border);
  color: var(--primary-coral);
  transform: scale(1.05);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--primary-coral);
  background: var(--primary-coral-light);
  color: var(--primary-coral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(235, 87, 87, 0.25);
}

/* ==========================================================================
   Category Tabs Bar
   ========================================================================== */

.category-nav {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-start;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  transition: background-color var(--transition-normal);
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-nav-list {
  display: flex;
  list-style: none;
  gap: 28px;
  padding: 0 24px;
  margin: 0 auto;
}

.nav-tab-item {
  position: relative;
}

.nav-tab-btn {
  padding: 12px 4px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.nav-tab-btn:hover {
  color: var(--text-dark);
}

.nav-tab-item.active .nav-tab-btn {
  color: var(--text-dark);
}

.nav-tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  background-color: var(--primary-coral);
  border-radius: 2px 2px 0 0;
}

/* ==========================================================================
   Listening Controls Subheader
   ========================================================================== */

.controls-section {
  max-width: 1280px;
  margin: 32px auto 24px;
  padding: 0 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.listening-bar {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-card);
  padding: 4px 6px 4px 16px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.listening-label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.audio-mode-selector {
  display: flex;
  background: var(--bg-pill-inactive);
  padding: 3px;
  border-radius: var(--radius-full);
  gap: 2px;
}

.audio-mode-btn {
  padding: 6px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.audio-mode-btn:hover:not(.active) {
  color: var(--text-dark);
}

.audio-mode-btn.active {
  background-color: var(--primary-coral);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(235, 87, 87, 0.3);
}

.hint-instruction {
  margin-top: 14px;
  font-size: 0.82rem;
  color: var(--text-hint);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: opacity var(--transition-fast);
}

/* ==========================================================================
   Vowel Filter Bar (ABC & VOWEL section)
   ========================================================================== */

.vowel-filter-section {
  max-width: 1280px;
  margin: 0 auto 24px;
  padding: 0 24px;
  display: flex;
  justify-content: center;
}

.vowel-filter-bar {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  padding: 5px 6px 5px 18px;
  box-shadow: var(--shadow-sm);
}

.vowel-filter-label {
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: var(--text-secondary);
  text-transform: uppercase;
  flex-shrink: 0;
}

.vowel-filter-pills {
  display: flex;
  background: var(--bg-pill-inactive);
  padding: 3px;
  border-radius: var(--radius-full);
  gap: 2px;
}

.vowel-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.vowel-filter-pill:hover:not(.active) {
  color: var(--text-dark);
}

.vowel-filter-pill.active {
  background: var(--primary-coral);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(235, 87, 87, 0.32);
}

.vowel-filter-pill.pill-long.active {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.38);
}

.vowel-filter-pill.pill-short.active {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 2px 8px rgba(14, 165, 233, 0.38);
}

.vf-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.vf-dot.long {
  background: #f59e0b;
}

.vf-dot.short {
  background: #0ea5e9;
}

.vowel-filter-pill.active .vf-dot {
  background: rgba(255, 255, 255, 0.85);
}

.vf-icon {
  font-size: 0.9em;
}

.vf-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  background: rgba(0, 0, 0, 0.09);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.vowel-filter-pill.active .vf-count {
  background: rgba(255, 255, 255, 0.25);
}

/* ==========================================================================
   Letters Grid Section (Matching Image Layout)
   ========================================================================== */

.main-content {
  flex: 1;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  padding: 8px 24px 60px;
}

.alphabet-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 16px;
  justify-content: center;
}

/* Vowel-only grid: fewer columns for bigger cards */
.alphabet-grid.vowel-only-grid {
  grid-template-columns: repeat(5, 1fr);
  max-width: 740px;
  margin-left: auto;
  margin-right: auto;
}

/* Specific styling for the 4th row with 2 letters */
.alphabet-grid>.letter-card:nth-child(25) {
  grid-column-start: 1;
}

/* Vowel card accent borders */
.letter-card.card-vowel-long {
  border-top: 3px solid #f59e0b;
}

.letter-card.card-vowel-short {
  border-top: 3px solid #0ea5e9;
}

/* Vowel type tag badge inside card */
.vowel-type-tag {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.vowel-type-tag.tag-long {
  background: rgba(245, 158, 11, 0.13);
  color: #b45309;
}

.vowel-type-tag.tag-short {
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
}

body.dark-mode .vowel-type-tag.tag-long {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}

body.dark-mode .vowel-type-tag.tag-short {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
}

/* Letter Card */
.letter-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-card);
  padding: 24px 12px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  cursor: pointer;
  user-select: none;
  transition: transform var(--transition-bounce), box-shadow var(--transition-normal), border-color var(--transition-normal);
  outline: none;
}

.letter-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: rgba(235, 87, 87, 0.3);
}

.letter-card:active {
  transform: translateY(-1px) scale(0.98);
}

/* Sound wave playing animation */
.letter-card.is-playing {
  border-color: var(--primary-coral);
  box-shadow: 0 0 0 3px rgba(235, 87, 87, 0.25), var(--shadow-card-hover);
  animation: pulseCard 0.8s ease-in-out infinite alternate;
}

@keyframes pulseCard {
  0% {
    transform: translateY(-4px) scale(1);
  }

  100% {
    transform: translateY(-5px) scale(1.02);
  }
}

.card-glyph {
  font-size: 2.85rem;
  font-weight: 800;
  line-height: 1;
  color: var(--text-dark);
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  transition: color var(--transition-fast);
}

.letter-card:hover .card-glyph {
  color: var(--primary-coral);
}

/* Rules and Variants Badge Button */
.rules-variant-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 10px;
  background-color: #ffffff;
  border: 1px solid var(--primary-coral-border);
  border-radius: var(--radius-full);
  color: var(--primary-coral);
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: 12px;
  white-space: nowrap;
}

body.dark-mode .rules-variant-btn {
  background-color: rgba(235, 87, 87, 0.1);
  border-color: rgba(235, 87, 87, 0.4);
}

.rules-variant-btn:hover {
  background-color: var(--primary-coral);
  border-color: var(--primary-coral);
  color: #ffffff;
  transform: scale(1.04);
}

.rules-variant-btn .btn-icon {
  font-size: 0.72rem;
}

/* IPA / Phonetic Symbols */
.card-ipa-symbols {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 22px;
}

.ipa-badge {
  font-size: 0.76rem;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.ipa-badge.ipa-clickable {
  cursor: pointer;
  background-color: transparent;
  user-select: none;
}

.ipa-badge.ipa-clickable:hover {
  background-color: var(--primary-coral-light);
  color: var(--primary-coral);
  transform: translateY(-1px);
}

.ipa-badge.badge-playing {
  background-color: var(--primary-coral) !important;
  color: #ffffff !important;
  transform: scale(1.15) !important;
  box-shadow: 0 2px 8px rgba(235, 87, 87, 0.4);
}

.ipa-badge.respelling {
  font-family: var(--font-sans);
  font-weight: 800;
  color: var(--accent-orange);
}

.modal-ipa-chips-wrapper {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  vertical-align: middle;
  margin-left: 4px;
}

.modal-ipa-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-ipa-chip:hover {
  border-color: var(--primary-coral);
  background: var(--primary-coral-light);
  color: var(--primary-coral);
  transform: translateY(-1px);
}

.modal-ipa-chip .ipa-speaker {
  font-size: 0.72rem;
  opacity: 0.8;
}


/* ==========================================================================
   Footer
   ========================================================================== */

.app-footer {
  margin-top: auto;
  padding: 24px 20px 32px;
  text-align: center;
  border-top: 1px solid var(--border-light);
  background-color: var(--bg-card);
  transition: background-color var(--transition-normal);
  content-visibility: auto;
  contain-intrinsic-size: auto none auto 110px;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.footer-heart {
  color: #ef4444;
  animation: heartBeat 1.8s infinite;
  display: inline-block;
}

@keyframes heartBeat {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.25);
  }
}

.api-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  background-color: var(--bg-pill-inactive);
  color: var(--text-secondary);
  margin-top: 8px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
}

/* ==========================================================================
   Modal Component (Reglas y Variantes)
   ========================================================================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background-color: var(--bg-card);
  border-radius: 24px;
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 620px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transform: translateY(20px) scale(0.96);
  transition: transform var(--transition-bounce);
}

.modal-backdrop.is-open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-light);
}

.modal-letter-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.modal-glyph-box {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background-color: var(--primary-coral-light);
  color: var(--primary-coral);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: 900;
}

.modal-letter-titles h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-dark);
}

.modal-letter-titles p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background-color: var(--bg-pill-inactive);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background-color: var(--primary-coral);
  color: #ffffff;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-sound-players {
  display: flex;
  gap: 12px;
}

.modal-audio-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-dark);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-audio-btn:hover {
  border-color: var(--primary-coral);
  color: var(--primary-coral);
  background-color: var(--primary-coral-light);
}

.rules-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rule-item-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background-color: var(--bg-main);
  border: 1px solid var(--border-light);
}

.rule-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-item-title .tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background-color: var(--primary-coral);
  color: white;
}

.rule-item-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.45;
}

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

.example-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.example-chip:hover {
  border-color: var(--primary-coral);
  transform: translateY(-1px);
}

.example-chip .word {
  font-weight: 700;
  color: var(--text-dark);
}

.example-chip .ipa {
  color: var(--primary-coral);
  font-size: 0.76rem;
}

.example-chip .trans {
  color: var(--text-muted);
  font-size: 0.74rem;
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1200px) {
  .alphabet-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .alphabet-grid>.letter-card:nth-child(25) {
    grid-column-start: auto;
  }
}

@media (max-width: 900px) {
  .alphabet-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .brand-wrapper {
    position: static;
    transform: none;
  }

  .header-top {
    flex-wrap: wrap;
    gap: 12px;
  }
}

@media (max-width: 600px) {
  .alphabet-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .letter-card {
    padding: 16px 8px 14px;
  }

  .card-glyph {
    font-size: 2.2rem;
  }

  .category-nav-list {
    gap: 16px;
  }

  .controls-section {
    margin: 20px auto 16px;
  }

  .modal-sound-players {
    flex-direction: column;
  }
}

/* ==========================================================================
   Module Views Transitions & Container
   ========================================================================== */

.module-section {
  animation: fadeInModule 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInModule {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   IPA Americano Section Hero Banner & Filters (aligned with BT Hub Hero)
   ========================================================================== */

.ipa-header-section {
  max-width: 1280px;
  margin: 22px auto 22px;
  padding: 0 24px;
}

.ipa-hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr);
  gap: 20px 22px;
  align-items: center;
  background: linear-gradient(135deg, rgba(223, 81, 56, 0.06), rgba(245, 158, 11, 0.05)), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px 26px;
  box-shadow: var(--shadow-card);
  max-width: 100%;
  box-sizing: border-box;
}

.ipa-hub-hero-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.ipa-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.ipa-main-title {
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.15;
}

.ipa-main-title .accent-coral {
  color: var(--primary-coral);
}

.ipa-badge-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background-color: var(--primary-coral-light);
  color: var(--primary-coral);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ipa-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  max-width: 680px;
  line-height: 1.5;
  margin: 0;
}

.ipa-hub-search-row {
  margin-top: 8px;
}

.ipa-hub-search-input {
  width: 100%;
  max-width: 460px;
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ipa-hub-search-input::placeholder {
  color: var(--text-muted);
}

.ipa-hub-search-input:focus-visible {
  outline: 2px solid var(--primary-coral);
  outline-offset: 2px;
}

.ipa-hub-hero-visual {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ipa-hero-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.ipa-hero-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ipa-hero-step strong {
  display: block;
  font-size: 0.83rem;
  color: var(--text-primary);
}

.ipa-hero-step small {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.ipa-hero-step-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(223, 81, 56, 0.14);
  color: var(--primary-coral);
}

.ipa-hero-step-num.is-amber {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

.ipa-hero-step-num.is-green {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

.ipa-filter-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  min-width: 0;
  max-width: 100%;
}

.ipa-filter-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.ipa-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-pill-inactive);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.79rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ipa-filter-pill:hover {
  border-color: var(--primary-coral-border);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.ipa-filter-pill:focus-visible {
  outline: 2px solid var(--primary-coral);
  outline-offset: 2px;
}

.ipa-filter-pill.active {
  background-color: var(--text-dark);
  border-color: var(--text-dark);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

body.dark-mode .ipa-filter-pill.active {
  background-color: var(--primary-coral);
  border-color: var(--primary-coral);
  color: #ffffff;
}

.ipa-filter-pill .count-pill {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.06);
  color: inherit;
}

body.dark-mode .ipa-filter-pill .count-pill {
  background: rgba(255, 255, 255, 0.1);
}

.ipa-filter-pill.active .count-pill {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.ipa-hub-empty {
  grid-column: 1 / -1;
  padding: 28px;
  text-align: center;
  border-radius: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: 600;
}

body.dark-mode .ipa-hub-hero {
  background: linear-gradient(135deg, rgba(223, 81, 56, 0.14), rgba(245, 158, 11, 0.08)), #0f172a;
  border-color: rgba(148, 163, 184, 0.18);
}

body.dark-mode .ipa-hub-hero-visual {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .ipa-badge-count {
  background: rgba(223, 81, 56, 0.18);
  color: #fb927c;
}

body.dark-mode .ipa-hub-search-input {
  background-color: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-primary);
}

body.dark-mode .ipa-hero-step-num {
  color: #fb927c;
}

body.dark-mode .ipa-hero-step-num.is-amber {
  color: #fbbf24;
}

body.dark-mode .ipa-hero-step-num.is-green {
  color: #6ee7b7;
}

@media (max-width: 820px) {
  .ipa-hub-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 18px;
    gap: 14px;
  }

  .ipa-hub-search-input {
    max-width: 100%;
  }
}

.dot-vowel,
.dot-consonant,
.dot-vowel-r,
.dot-starter,
.dot-abc {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.dot-starter {
  background-color: #f59e0b;
}

/* Starter Route Banner & Ordered Grid */
.ipa-starter-banner {
  margin: 0 auto 18px;
  padding: 14px 18px;
  border-radius: 16px;
  background-color: var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.35);
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
}

.ipa-starter-banner[hidden] {
  display: none;
}

.ipa-starter-banner-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.ipa-starter-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ipa-starter-summary {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.ipa-starter-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(195px, 1fr));
  gap: 8px;
}

.ipa-starter-steps li {
  padding: 8px 11px;
  border-radius: 10px;
  background-color: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-primary);
}

.ipa-starter-step-pill {
  position: relative;
  z-index: 2;
  display: inline-block;
  margin-bottom: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.ipa-master-grid.is-starter-mode {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

body.dark-mode .ipa-starter-banner {
  border-color: rgba(251, 191, 36, 0.35);
}

body.dark-mode .ipa-starter-badge,
body.dark-mode .ipa-starter-step-pill {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
}

/* ==========================================================================
   Contact & Suggestions Page (Light & Dark Mode)
   ========================================================================== */
.contact-page {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px 0 32px;
}

.contact-hero {
  text-align: center;
  margin-bottom: 24px;
}

.contact-kicker {
  display: inline-block;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(223, 81, 56, 0.12);
  color: var(--primary-coral);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.contact-title {
  margin: 0 0 8px;
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
  font-weight: 800;
  color: var(--text-primary);
}

.contact-subtitle {
  margin: 0 auto;
  max-width: 640px;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  align-items: start;
}

.contact-grid.contact-grid-single {
  grid-template-columns: minmax(0, 600px);
  justify-content: center;
}

.contact-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow-card);
  color: var(--text-primary);
}

.contact-card-title {
  margin: 0 0 10px;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-primary);
}

.contact-card-desc {
  margin: 0 0 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.contact-email-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background-color: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  margin-bottom: 16px;
}

.contact-email-link {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-coral);
  text-decoration: none;
  word-break: break-all;
}

.contact-email-link:hover {
  text-decoration: underline;
}

.contact-copy-btn,
.contact-secondary-btn {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.contact-copy-btn:hover,
.contact-secondary-btn:hover {
  border-color: var(--primary-coral);
  color: var(--primary-coral);
}

.contact-highlights {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.contact-field label {
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text-primary);
}

.contact-field input,
.contact-field select,
.contact-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.contact-field textarea {
  resize: vertical;
  min-height: 112px;
}

.contact-field input:focus-visible,
.contact-field select:focus-visible,
.contact-field textarea:focus-visible,
.contact-submit-btn:focus-visible,
.contact-copy-btn:focus-visible,
.contact-secondary-btn:focus-visible,
.contact-email-link:focus-visible,
.footer-contact-link:focus-visible {
  outline: 2px solid var(--primary-coral);
  outline-offset: 2px;
}

.contact-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.contact-submit-btn {
  padding: 10px 18px;
  border-radius: var(--radius-full);
  border: none;
  background-color: var(--primary-coral);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.contact-submit-btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.contact-form-note {
  margin: 12px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.footer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.footer-contact-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.footer-contact-link:hover {
  border-color: var(--primary-coral);
  color: var(--primary-coral);
}

body.dark-mode .footer-contact-link:hover {
  border-color: #fb927c;
  color: #fb927c;
}

body.dark-mode .contact-kicker {
  background: rgba(223, 81, 56, 0.2);
  color: #fb927c;
}

body.dark-mode .contact-email-link {
  color: #fb927c;
}

body.dark-mode .contact-field input,
body.dark-mode .contact-field select,
body.dark-mode .contact-field textarea {
  background-color: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.24);
  color: var(--text-primary);
}

.dot-vowel {
  background-color: #df5138;
}

.dot-consonant {
  background-color: #0277bd;
}

.dot-vowel-r {
  background-color: #e65100;
}

.dot-abc {
  background-color: #10b981;
}

/* ==========================================================================
   IPA Americano 7-Column Master Grid (Matching User Chart Image)
   ========================================================================== */

.ipa-master-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 32px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 16px;
}

.ipa-card {
  position: relative;
  aspect-ratio: 1 / 1.15;
  border-radius: 20px;
  padding: 16px 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #ffffff;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  border: none;
  outline: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

/* Vowel Cards (Coral Red - Exact Photo Tone) */
.ipa-card.vowel {
  background: linear-gradient(180deg, #e4573d 0%, #db462a 100%);
  box-shadow: 0 8px 18px -4px rgba(220, 70, 42, 0.38), 0 3px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Consonant Cards (Azure Blue - Exact Photo Tone) */
.ipa-card.consonant {
  background: linear-gradient(180deg, #0284c7 0%, #0270a8 100%);
  box-shadow: 0 8px 18px -4px rgba(2, 112, 168, 0.38), 0 3px 6px -2px rgba(0, 0, 0, 0.1);
}

/* R-Controlled Vowel Cards (Coral Red - Exact Photo Tone) */
.ipa-card.vowel-r {
  background: linear-gradient(180deg, #e4573d 0%, #db462a 100%);
  box-shadow: 0 8px 18px -4px rgba(220, 70, 42, 0.38), 0 3px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Special Practice Card (Slot 49) */
.ipa-card.special {
  background: linear-gradient(180deg, #d44329 0%, #b8321c 100%);
  box-shadow: 0 8px 18px -4px rgba(184, 50, 28, 0.38), 0 3px 6px -2px rgba(0, 0, 0, 0.1);
}

/* Hover & Active States */
.ipa-card:hover {
  transform: translateY(-5px) scale(1.02);
  filter: brightness(1.04);
}

.ipa-card.vowel:hover,
.ipa-card.vowel-r:hover {
  box-shadow: 0 16px 28px -4px rgba(220, 70, 42, 0.48), 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

.ipa-card.consonant:hover {
  box-shadow: 0 16px 28px -4px rgba(2, 112, 168, 0.48), 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

.ipa-card.special:hover {
  box-shadow: 0 16px 28px -4px rgba(184, 50, 28, 0.48), 0 6px 12px -2px rgba(0, 0, 0, 0.15);
}

.ipa-card:active {
  transform: scale(0.96);
}

/* Audio Playing State Animation */
.ipa-card.is-playing {
  animation: ipaCardPulse 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.75), 0 16px 32px rgba(0, 0, 0, 0.25) !important;
}

@keyframes ipaCardPulse {
  0% {
    transform: scale(0.96);
  }

  50% {
    transform: scale(1.05);
  }

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

/* Card Content Elements */
.ipa-card-glyph {
  font-family: 'Outfit', -apple-system, sans-serif;
  font-size: 2.45rem;
  font-weight: 800;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  letter-spacing: -0.02em;
}

.ipa-card-spelling {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 2px;
  letter-spacing: 0.01em;
}

.ipa-card-word {
  font-family: var(--font-sans);
  font-size: 1.08rem;
  font-weight: 800;
  color: #ffffff;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.ipa-card-word u {
  text-decoration: underline;
  text-underline-offset: 3.5px;
  text-decoration-thickness: 2.5px;
  color: #ffffff;
}

.ipa-sound-indicator {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.ipa-card:hover .ipa-sound-indicator {
  opacity: 0.85;
}

.ipa-card.is-playing .ipa-sound-indicator {
  opacity: 1;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-coral);
  animation: pulseIndicator 0.6s infinite alternate;
}

@keyframes pulseIndicator {
  from {
    transform: scale(0.9);
  }

  to {
    transform: scale(1.15);
  }
}

/* Hidden elements when filtered */
.ipa-card.is-filtered-out {
  display: none;
}

/* Pedagogical Hint */
.ipa-pedagogical-hint {
  max-width: 1280px;
  margin: 0 auto 36px;
  padding: 16px 20px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
}

.ipa-pedagogical-hint .hint-icon {
  font-size: 1.4rem;
}

.ipa-pedagogical-hint p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.ipa-pedagogical-hint .underline-demo {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 700;
  color: var(--primary-coral);
}

/* ==========================================================================
   Responsive Breakpoints for IPA Grid
   ========================================================================== */

@media (max-width: 1180px) {
  .ipa-master-grid {
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
  }
}

@media (max-width: 960px) {
  .ipa-master-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }

  .ipa-card-glyph {
    font-size: 2.15rem;
  }
}

@media (max-width: 640px) {
  .ipa-master-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .ipa-card {
    border-radius: 16px;
    padding: 12px 6px;
  }

  .ipa-card-glyph {
    font-size: 1.85rem;
  }

  .ipa-card-spelling {
    font-size: 0.86rem;
  }

  .ipa-card-word {
    font-size: 0.95rem;
  }

  .ipa-main-title {
    font-size: 1.45rem;
  }
}

@media (max-width: 420px) {
  .ipa-master-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ==========================================================================
   IPA Graphemes Badge on Grid Card
   ========================================================================== */

.ipa-card-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(4px);
  font-size: 0.72rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  transition: all var(--transition-fast);
}

.ipa-card-badge .badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  opacity: 0.9;
}

.ipa-card:hover .ipa-card-badge {
  background: rgba(255, 255, 255, 0.36);
  transform: translateY(-1px);
}

/* Botón invisible que cubre toda la tarjeta: tocar = escuchar el sonido */
.ipa-card-play {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
  border-radius: inherit;
  cursor: pointer;
  z-index: 1;
  padding: 0;
  margin: 0;
  -webkit-appearance: none;
  appearance: none;
}

.ipa-card-play:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: -5px;
  border-radius: inherit;
}

.ipa-card:has(.ipa-card-play:focus-visible) {
  box-shadow: 0 0 0 3px var(--primary-coral), 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* El contenido visual no intercepta toques (los recibe el botón de sonido) */
.ipa-card-glyph,
.ipa-card-spelling,
.ipa-card-word {
  position: relative;
  pointer-events: none;
}

/* Ícono de corneta: siempre en la esquina superior izquierda */
.ipa-card .ipa-sound-indicator {
  position: absolute;
  top: 8px;
  left: 8px;
  right: auto;
  pointer-events: none;
}

@media (max-width: 640px) {
  .ipa-card .ipa-sound-indicator {
    top: 6px;
    left: 6px;
  }
}

/* Botón "# grafemas": único elemento que abre el modal de grafemas y reglas */
.ipa-card-badge-btn {
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.55);
  font-family: var(--font-sans);
  cursor: pointer;
  min-height: 28px;
  padding: 4px 10px;
  -webkit-appearance: none;
  appearance: none;
}

.ipa-card-badge-btn .badge-arrow {
  font-size: 0.95em;
  line-height: 1;
  margin-left: 1px;
  transition: transform var(--transition-fast);
}

@media (hover: hover) {

  .ipa-card-badge-btn:hover,
  .ipa-card .ipa-card-badge-btn:hover {
    background: #ffffff;
    color: #0f172a;
    border-color: #ffffff;
    transform: translateY(-1px);
  }

  .ipa-card.vowel .ipa-card-badge-btn:hover,
  .ipa-card.vowel-r .ipa-card-badge-btn:hover {
    color: #b8321c;
  }

  .ipa-card.consonant .ipa-card-badge-btn:hover {
    color: #0270a8;
  }

  .ipa-card-badge-btn:hover .badge-dot {
    background: currentColor;
  }

  .ipa-card-badge-btn:hover .badge-arrow {
    transform: translateX(2px);
  }
}

.ipa-card-badge-btn:active {
  transform: scale(0.95);
}

.ipa-card-badge-btn:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  border-radius: var(--radius-full);
}

/* Al tocar el botón de grafemas no se anima la tarjeta completa */
.ipa-card:has(.ipa-card-badge-btn:active) {
  transform: none;
}

@media (max-width: 640px) {
  .ipa-card .ipa-card-badge-btn {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 0.7rem;
    margin-top: 8px;
  }
}

@media (max-width: 380px) {
  .ipa-card .ipa-card-badge-btn {
    padding: 5px 8px;
    gap: 4px;
  }
}

/* ==========================================================================
   IPA Graphemes & Rules Modal (.ipa-modal-dialog)
   ========================================================================== */

.ipa-modal-dialog {
  max-width: 820px;
  width: 95%;
  max-height: 90vh;
}

.ipa-modal-header {
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-light);
}

.ipa-modal-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.ipa-modal-glyph-box {
  width: 66px;
  height: 66px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Outfit', -apple-system, sans-serif;
  font-size: 2.3rem;
  font-weight: 900;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 8px 18px -4px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-bounce);
}

.ipa-modal-glyph-box.vowel,
.ipa-modal-glyph-box.vowel-r {
  background: linear-gradient(135deg, #e4573d 0%, #db462a 100%);
  box-shadow: 0 8px 20px -4px rgba(220, 70, 42, 0.4);
}

.ipa-modal-glyph-box.consonant {
  background: linear-gradient(135deg, #0284c7 0%, #0270a8 100%);
  box-shadow: 0 8px 20px -4px rgba(2, 112, 168, 0.4);
}

.ipa-modal-glyph-box.special {
  background: linear-gradient(135deg, #d44329 0%, #b8321c 100%);
  box-shadow: 0 8px 20px -4px rgba(184, 50, 28, 0.4);
}

.ipa-modal-titles {
  min-width: 0;
}

.ipa-modal-category-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 4px;
}

.ipa-modal-category-tag.vowel,
.ipa-modal-category-tag.vowel-r {
  background: rgba(235, 87, 87, 0.12);
  color: #db462a;
  border: 1px solid rgba(235, 87, 87, 0.25);
}

.ipa-modal-category-tag.consonant {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.25);
}

.ipa-modal-category-tag.special {
  background: rgba(234, 88, 12, 0.12);
  color: #ea580c;
  border: 1px solid rgba(234, 88, 12, 0.25);
}

.ipa-modal-titles h3 {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
}

.ipa-modal-titles p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.ipa-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.ipa-modal-play-btn {
  border: none;
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #ffffff;
  transition: all var(--transition-fast);
}

.ipa-modal-play-btn.vowel,
.ipa-modal-play-btn.vowel-r {
  background: linear-gradient(135deg, #eb5757 0%, #db462a 100%);
  box-shadow: 0 4px 14px rgba(235, 87, 87, 0.35);
}

.ipa-modal-play-btn.consonant {
  background: linear-gradient(135deg, #0284c7 0%, #0270a8 100%);
  box-shadow: 0 4px 14px rgba(2, 112, 168, 0.35);
}

.ipa-modal-play-btn.special {
  background: linear-gradient(135deg, #d44329 0%, #b8321c 100%);
  box-shadow: 0 4px 14px rgba(184, 50, 28, 0.35);
}

.ipa-modal-play-btn:hover {
  transform: translateY(-2px) scale(1.03);
  filter: brightness(1.08);
}

.ipa-modal-play-btn:active {
  transform: scale(0.97);
}

.ipa-modal-play-btn.is-playing {
  animation: playBtnPulse 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.5), 0 8px 24px rgba(0, 0, 0, 0.25) !important;
}

@keyframes playBtnPulse {
  0% {
    transform: scale(0.96);
  }

  50% {
    transform: scale(1.08);
  }

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

.ipa-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 12px;
  flex-wrap: wrap;
}

.ipa-graphemes-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-dark);
  background: var(--bg-pill-inactive);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.ipa-graphemes-count-badge .badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-coral);
}

.ipa-graphemes-count-badge.consonant .badge-dot {
  background: #0284c7;
}

.ipa-pedagogical-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 18px;
  background: rgba(235, 87, 87, 0.06);
  border: 1px solid rgba(235, 87, 87, 0.2);
  border-left: 4px solid var(--primary-coral);
  border-radius: 14px;
  margin-bottom: 20px;
}

.ipa-pedagogical-banner.consonant {
  background: rgba(2, 132, 199, 0.06);
  border-color: rgba(2, 132, 199, 0.2);
  border-left-color: #0284c7;
}

.ipa-pedagogical-banner .banner-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
}

.ipa-pedagogical-banner .banner-text strong {
  color: var(--text-dark);
  font-size: 0.92rem;
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

.ipa-pedagogical-banner .banner-text p {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.45;
  margin: 0;
}

.ipa-graphemes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ipa-grapheme-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.ipa-grapheme-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--primary-coral-border);
}

.ipa-grapheme-card.consonant:hover {
  border-color: rgba(2, 132, 199, 0.4);
}

.grapheme-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.grapheme-left-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.grapheme-letter-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--text-dark);
  letter-spacing: -0.01em;
  min-width: 36px;
}

.grapheme-type-tag {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
}

.grapheme-example-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-dark);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.grapheme-example-chip u {
  font-weight: 800;
  color: var(--primary-coral);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.grapheme-example-chip.consonant u {
  color: #0284c7;
}

.grapheme-example-chip:hover {
  border-color: var(--primary-coral);
  background: rgba(235, 87, 87, 0.08);
  transform: translateY(-1px);
}

.grapheme-example-chip.consonant:hover {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.08);
}

.grapheme-example-chip .chip-speaker {
  font-size: 0.85rem;
}

.grapheme-explore-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--primary-coral);
  background: transparent;
  color: var(--primary-coral);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.grapheme-explore-btn.consonant {
  border-color: #0284c7;
  color: #0284c7;
}

.grapheme-explore-btn:hover {
  background: var(--primary-coral);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(235, 87, 87, 0.3);
  transform: translateY(-1px);
}

.grapheme-explore-btn.consonant:hover {
  background: #0284c7;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.grapheme-explore-btn:active {
  transform: scale(0.97);
}

.grapheme-rule-box {
  background: var(--bg-pill-inactive);
  border-radius: 12px;
  padding: 12px 16px;
  border-left: 3px solid var(--primary-coral);
  margin-top: 4px;
}

.grapheme-rule-box.consonant {
  border-left-color: #0284c7;
}

.grapheme-rule-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--primary-coral);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grapheme-rule-header.consonant {
  color: #0284c7;
}

.grapheme-rule-header .rule-title-text {
  color: var(--text-dark);
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
}

.grapheme-rule-desc {
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   Toast Notification Component
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e293b;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  font-weight: 600;
  transform: translateY(20px);
  opacity: 0;
  animation: toastSlideIn 0.28s forwards cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-message.toast-fadeout {
  animation: toastFadeOut 0.25s forwards ease-in;
}

@keyframes toastSlideIn {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes toastFadeOut {
  to {
    transform: translateY(15px);
    opacity: 0;
  }
}

/* Dark mode adjustments */
body.dark-mode .ipa-grapheme-card {
  background: var(--bg-card);
  border-color: #334155;
}

body.dark-mode .grapheme-rule-box {
  background: #0f172a;
}

body.dark-mode .ipa-pedagogical-banner {
  background: rgba(235, 87, 87, 0.12);
}

body.dark-mode .ipa-pedagogical-banner.consonant {
  background: rgba(2, 132, 199, 0.12);
}

body.dark-mode .grapheme-explore-btn {
  border-color: #eb5757;
  color: #fca5a5;
}

body.dark-mode .grapheme-explore-btn.consonant {
  border-color: #38bdf8;
  color: #7dd3fc;
}

body.dark-mode .grapheme-explore-btn:hover {
  background: #eb5757;
  color: #ffffff;
}

body.dark-mode .grapheme-explore-btn.consonant:hover {
  background: #0284c7;
  color: #ffffff;
}

/* ==========================================================================
   Reading Module - Units & Timeline Design System
   ========================================================================== */

.reading-header-intro {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  position: relative;
}

/* Hamburger button for mobile/tablet */
.reading-hamburger-btn {
  display: none;
  /* Desktop default: hidden */
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 8px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border-subtle);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  user-select: none;
}

.reading-hamburger-btn .hamburger-line {
  display: block;
  width: 22px;
  height: 2.5px;
  background-color: #ea580c;
  border-radius: 2px;
  transition: all var(--transition-fast);
}

.reading-hamburger-btn:hover {
  background: var(--bg-pill-inactive);
  border-color: #ea580c;
  transform: translateY(-1px);
}

.reading-hamburger-btn:active {
  transform: scale(0.96);
}

body.dark-mode .reading-hamburger-btn {
  background: #1e293b;
  border-color: #334155;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

body.dark-mode .reading-hamburger-btn:hover {
  background: #0f172a;
  border-color: #ea580c;
}

/* Backdrop */
.reading-sidebar-backdrop {
  display: none;
}

/* Sidebar Header Actions */
.reading-sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reading-sidebar-close-btn {
  display: none;
  /* Desktop default: hidden */
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.05);
  color: #1e3a8a;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.reading-sidebar-close-btn:hover {
  background: rgba(235, 87, 87, 0.15);
  color: #ea580c;
  border-color: #ea580c;
}

body.dark-mode .reading-sidebar-close-btn {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* 2-Column Workspace: Left Lateral Sidebar (Images 1 & 7) + Right Unit Detail (Image 2) */
.reading-layout-container {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 28px;
  align-items: flex-start;
  max-width: 1140px;
  margin: 32px auto 64px;
  /* Separación superior uniforme (2rem) con respecto al navbar */
  padding: 0 16px;
}

#readingUnitsView.is-no-sidebar .reading-layout-container {
  grid-template-columns: 1fr;
}

/* Left Sidebar Menu (Basic level + Units 1 to 9) */
.reading-sidebar {
  background: #ffffff;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.06);
  font-family: var(--font-reading);
  overflow: hidden;
  position: sticky;
  top: 24px;
  transition: all var(--transition-normal);
}

.reading-sidebar-header {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  padding: 14px 18px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #bfdbfe;
}

.reading-sidebar-level-title {
  font-family: var(--font-reading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #1e3a8a;
  letter-spacing: -0.015em;
}

.reading-sidebar-illustration {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.reading-sidebar-illustration svg {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
}

.reading-units-list {
  list-style: none;
  padding: 12px 14px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reading-unit-nav-item {
  padding: 10px 14px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  user-select: none;
}

.reading-unit-nav-item:hover {
  background: #f1f5f9;
  transform: translateX(2px);
}

.reading-unit-nav-item .unit-nav-label {
  font-size: 11px;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.reading-unit-nav-item .unit-nav-name {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
}

/* Active selected unit item */
.reading-unit-nav-item.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.25);
}

.reading-unit-nav-item.active .unit-nav-label {
  color: rgba(255, 255, 255, 0.88);
}

.reading-unit-nav-item.active .unit-nav-name {
  color: #ffffff;
}

/* Right Detail Column */
.reading-unit-detail-col {
  width: 100%;
  min-width: 0;
}

/* Main Unit Card */
.reading-unit-card {
  max-width: 760px;
  width: 100%;
  margin: 0 auto 40px;
  /* Sin margin-top descompensado para alinear exactamente con el sidebar */
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.06);
  font-family: var(--font-reading);
  padding: 38px 44px 34px;
  position: relative;
  transition: box-shadow var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.reading-unit-card:hover {
  box-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.09);
}

/* Card Header */
.reading-card-header {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.reading-unit-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ea580c;
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.24);
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.reading-unit-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
}

.reading-unit-translation {
  font-size: 1.125rem;
  font-weight: 500;
  color: #475569;
  letter-spacing: normal;
}

/* Timeline Layout */
.reading-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 26px;
}

/* Vertical Connecting Line */
.reading-timeline::before {
  content: '';
  position: absolute;
  left: 21px;
  top: 28px;
  bottom: 38px;
  width: 2px;
  background: #e2e8f0;
  z-index: 1;
}

/* Timeline Item */
.reading-timeline-item {
  display: flex;
  align-items: flex-start;
  position: relative;
  z-index: 2;
  cursor: pointer;
  border-radius: 16px;
  transition: all var(--transition-normal);
}

/* Node / Target Circle Icon */
.reading-node {
  width: 44px;
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 18px;
  position: relative;
}

.reading-node::before {
  content: '';
  position: absolute;
  top: 17px;
  width: 24px;
  height: 24px;
  background: #ffffff;
  border-radius: 50%;
  z-index: 2;
}

.reading-target-icon {
  position: relative;
  z-index: 3;
  border-radius: 50%;
  transition: transform var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

.reading-target-icon.default-icon {
  color: #94a3b8;
}

.reading-target-icon.active-icon {
  color: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

.reading-timeline-item:hover .reading-target-icon {
  transform: scale(1.12);
}

/* Item Content Box — Inactive items */
.reading-timeline-item:not(.active) .reading-item-content {
  flex: 1;
  padding: 15px 20px;
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.8);
  border: 1px solid #e2e8f0;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), transform var(--transition-fast);
}

.reading-timeline-item:not(.active):hover .reading-item-content {
  background-color: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

/* Active Selected Item */
.reading-timeline-item.active .reading-item-content {
  flex: 1;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1.5px solid #93c5fd;
  border-left: 4px solid #2563eb;
  border-radius: 16px;
  box-shadow: 0 8px 22px -4px rgba(37, 99, 235, 0.12);
  padding: 18px 24px;
}

.reading-timeline-item.active .reading-node .reading-target-icon {
  color: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

/* Item Title & Translation */
.reading-item-head {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.reading-item-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.4;
  margin: 0;
}

.reading-timeline-item.active .reading-item-title {
  color: #1d4ed8;
  font-size: 1.0625rem;
}

.reading-item-sub {
  font-size: 14.5px;
  font-weight: 500;
  font-style: italic;
  color: #2563eb;
  margin-left: 4px;
}

/* Item Description */
.reading-item-desc {
  font-size: 0.9375rem;
  line-height: 1.68;
  max-width: 72ch;
  color: #334155;
  letter-spacing: -0.005em;
  margin: 8px 0 0;
}

/* Item Metadata Row (Level, Duration, Likes) */
.reading-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 12.5px;
  color: #64748b;
  font-weight: 600;
}

.reading-item-meta .meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  background: rgba(15, 23, 42, 0.045);
  padding: 4px 10px;
  border-radius: 999px;
  line-height: 1.1;
}

.reading-item-meta .meta-level {
  font-weight: 600;
}

.reading-item-meta .level-dot {
  font-size: 0.6rem;
  color: #f97316;
  line-height: 1;
}

.reading-item-meta .meta-duration svg,
.reading-item-meta .meta-likes svg {
  display: block;
  color: #64748b;
  flex-shrink: 0;
}

/* Unit Card Footer & Action Button */
.reading-card-footer {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: flex-start;
}

.reading-unit-test-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
  color: #ffffff;
  font-family: var(--font-reading);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.3);
  transition: all var(--transition-fast);
}

.reading-unit-test-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(234, 88, 12, 0.42);
  filter: brightness(1.05);
}

.reading-unit-test-btn:active {
  transform: translateY(0);
}

.reading-unit-test-btn .check-icon {
  stroke-width: 3;
}

/* Dark Mode Overrides for Reading Module */
body.dark-mode .reading-unit-card {
  background: #111827;
  border-color: #1e293b;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6), 0 8px 20px -4px rgba(0, 0, 0, 0.4);
}

body.dark-mode .reading-unit-card:hover {
  box-shadow: 0 24px 60px -8px rgba(0, 0, 0, 0.7), 0 10px 24px -4px rgba(0, 0, 0, 0.45);
}

body.dark-mode .reading-unit-badge {
  color: #fb923c;
  background: rgba(251, 146, 60, 0.14);
  border-color: rgba(251, 146, 60, 0.3);
}

body.dark-mode .reading-card-header {
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

body.dark-mode .reading-unit-title {
  color: #f8fafc;
}

body.dark-mode .reading-unit-translation {
  color: #94a3b8;
}

body.dark-mode .reading-timeline::before {
  background: #1e293b;
}

body.dark-mode .reading-node::before {
  background: #111827;
}

body.dark-mode .reading-target-icon.default-icon {
  color: #475569;
}

body.dark-mode .reading-target-icon.active-icon,
body.dark-mode .reading-timeline-item.active .reading-target-icon {
  color: #f97316;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}

body.dark-mode .reading-item-title {
  color: #f8fafc;
}

body.dark-mode .reading-item-sub {
  color: #60a5fa;
}

body.dark-mode .reading-item-desc {
  color: #cbd5e1;
}

body.dark-mode .reading-item-meta,
body.dark-mode .reading-item-meta .meta-tag {
  color: #cbd5e1;
}

body.dark-mode .reading-item-meta .meta-tag {
  background: rgba(148, 163, 184, 0.12);
}

body.dark-mode .reading-item-meta .meta-duration svg,
body.dark-mode .reading-item-meta .meta-likes svg {
  color: #94a3b8;
}

body.dark-mode .reading-timeline-item:not(.active) .reading-item-content {
  background: rgba(30, 41, 59, 0.32);
  border-color: rgba(148, 163, 184, 0.12);
}

body.dark-mode .reading-timeline-item:not(.active):hover .reading-item-content {
  background-color: rgba(30, 41, 59, 0.62);
  border-color: rgba(148, 163, 184, 0.25);
}

body.dark-mode .reading-timeline-item.active .reading-item-content {
  background: linear-gradient(135deg, #1e293b 0%, #172554 100%);
  border-color: rgba(96, 165, 250, 0.45);
  border-left: 4px solid #3b82f6;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.42);
}

body.dark-mode .reading-timeline-item.active .reading-item-title {
  color: #f8fafc;
}

body.dark-mode .reading-timeline-item.active .reading-item-sub {
  color: #60a5fa;
}

body.dark-mode .reading-card-footer {
  border-top-color: #1e293b;
}

body.dark-mode .reading-sidebar {
  background: #111827;
  border-color: #1e293b;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6), 0 8px 20px -4px rgba(0, 0, 0, 0.4);
}

body.dark-mode .reading-sidebar-header {
  background: #1e293b;
  border-bottom-color: #334155;
}

body.dark-mode .reading-sidebar-level-title {
  color: #60a5fa;
}

body.dark-mode .reading-unit-nav-item:hover {
  background: #1e293b;
}

body.dark-mode .reading-unit-nav-item .unit-nav-label {
  color: #94a3b8;
}

body.dark-mode .reading-unit-nav-item .unit-nav-name {
  color: #e2e8f0;
}

body.dark-mode .reading-unit-nav-item.active {
  background: #1d4ed8;
  border-color: #2563eb;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.35);
}

body.dark-mode .reading-unit-nav-item.active .unit-nav-label {
  color: rgba(255, 255, 255, 0.88);
}

body.dark-mode .reading-unit-nav-item.active .unit-nav-name {
  color: #ffffff;
}

/* Responsive adjustments for Reading / Books Module (< 1024px) */
@media (max-width: 1023px) {

  /* REGLA A: Texto Superior ("texto desaparece") */
  .reading-header-intro {
    justify-content: flex-start;
    margin: 16px auto 12px;
    padding: 0 16px;
    max-width: 820px;
  }

  /* Hamburger visible en mobile / tablet en la parte superior izquierda */
  .reading-hamburger-btn {
    display: inline-flex;
  }

  /* REGLA B: Contenedor Principal (Unit 1 ocupa todo el ancho sin desborde) */
  .reading-layout-container {
    display: block;
    max-width: 820px;
    margin: 0 auto 48px;
    padding: 0 16px;
    overflow-x: hidden;
  }

  .reading-unit-detail-col {
    width: 100%;
  }

  /* REGLA B: Menú Lateral como Sidebar Overlay / Drawer (Off-Canvas) */
  .reading-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    border-radius: 0 24px 24px 0;
    border-left: none;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    visibility: hidden;
    pointer-events: none;
    box-shadow: none;
  }

  /* Al abrirse solapa/superpone por encima de la sección que contiene las unidades (Unit 1) */
  .reading-units-view.sidebar-open .reading-sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    box-shadow: 14px 0 45px rgba(0, 0, 0, 0.65);
  }

  /* Fondo semitransparente oscuro (backdrop / overlay) */
  .reading-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 95;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  .reading-units-view.sidebar-open .reading-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Botón cerrar visible dentro del header del sidebar */
  .reading-sidebar-close-btn {
    display: inline-flex;
  }
}

@media (max-width: 640px) {
  .reading-unit-card {
    padding: 24px 18px;
    border-radius: 18px;
    margin-bottom: 40px;
  }

  .reading-header-intro {
    margin: 20px auto 16px;
  }

  .reading-unit-title {
    font-size: 1.6rem;
  }

  .reading-unit-translation {
    font-size: 1.05rem;
  }

  .reading-node {
    width: 36px;
    padding-top: 10px;
  }

  .reading-timeline::before {
    left: 17px;
    top: 22px;
  }

  .reading-node::before {
    width: 20px;
    height: 20px;
    top: 10px;
  }

  .reading-item-content {
    padding: 10px 14px;
  }

  .reading-timeline-item.active .reading-item-content {
    padding: 14px 16px;
  }

  .reading-item-meta {
    gap: 12px;
    flex-wrap: wrap;
  }
}



/* ==========================================================================
   Adaptación Móvil Integral (Responsive Mobile-First Overrides)
   ========================================================================== */

/* Áreas seguras (notch / barra de estado translúcida en iOS) */
.app-header {
  padding-top: env(safe-area-inset-top, 0px);
}

.header-top,
.category-nav-list {
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}

.app-footer {
  padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
}

/* Modales: altura dinámica real en navegadores móviles */
.modal-dialog {
  max-height: 88dvh;
}

.ipa-modal-dialog {
  max-height: 90dvh;
}

.modal-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Tablets */
@media (max-width: 900px) {

  .ipa-header-section,
  .controls-section,
  .vowel-filter-section,
  .ipa-master-grid {
    padding-left: 0;
    padding-right: 0;
  }

  .alphabet-grid.vowel-only-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 560px;
  }
}

/* Móviles */
@media (max-width: 640px) {
  .main-content {
    padding: 4px 14px 40px;
  }

  /* Header */
  .header-top {
    padding-top: 10px;
    padding-bottom: 10px;
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    flex-wrap: nowrap;
  }

  .brand-title {
    font-size: 1.35rem;
  }

  .header-icon-btn,
  .user-avatar {
    width: 40px;
    height: 40px;
  }

  /* Pestañas: se distribuyen a lo ancho y se desplazan si no caben */
  .category-nav-list {
    gap: 4px;
    padding-left: max(8px, env(safe-area-inset-left, 0px));
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    width: 100%;
    justify-content: space-around;
  }

  .nav-tab-btn {
    padding: 12px 8px 13px;
    font-size: 0.76rem;
    letter-spacing: 0.03em;
    min-height: 44px;
  }

  /* Barra "Escuchar" */
  .listening-bar {
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-lg);
  }

  .audio-mode-selector {
    width: 100%;
  }

  .audio-mode-btn {
    flex: 1;
    padding: 10px 8px;
    min-height: 40px;
  }

  .hint-instruction {
    text-align: left;
    font-size: 0.8rem;
  }

  /* Filtro de vocales */
  .vowel-filter-section {
    margin-bottom: 18px;
  }

  .vowel-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border-radius: var(--radius-lg);
  }

  .vowel-filter-label {
    text-align: center;
  }

  .vowel-filter-pills {
    flex-direction: column;
    border-radius: var(--radius-md);
  }

  .vowel-filter-pill {
    justify-content: center;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    min-height: 40px;
  }

  /* Rejilla ABC */
  .alphabet-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .alphabet-grid.vowel-only-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .letter-card {
    padding: 22px 6px 12px;
    border-radius: var(--radius-md);
    min-width: 0;
  }

  .card-glyph {
    font-size: 2rem;
    margin-bottom: 8px;
  }

  .rules-variant-btn {
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    padding: 5px 8px;
    max-width: 100%;
    margin-bottom: 8px;
  }

  .vowel-type-tag {
    top: 5px;
    right: 6px;
    font-size: 0.55rem;
    padding: 1px 6px;
  }

  .ipa-badge {
    font-size: 0.72rem;
    padding: 2px 4px;
  }

  /* IPA Hero Banner & Filters (Mobile) */
  .ipa-header-section {
    margin: 10px auto 14px;
    padding-left: 0;
    padding-right: 0;
  }

  .ipa-hub-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px;
    gap: 12px;
    border-radius: 16px;
    overflow: hidden;
  }

  .ipa-title-group {
    gap: 8px;
  }

  .ipa-main-title {
    font-size: 1.38rem;
  }

  .ipa-badge-count {
    font-size: 0.72rem;
    padding: 3px 10px;
  }

  .ipa-subtitle {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .ipa-hub-search-row {
    margin-top: 4px;
  }

  .ipa-hub-search-input {
    max-width: 100%;
    padding: 9px 13px;
    font-size: 0.85rem;
  }

  .ipa-hub-hero-visual {
    padding: 11px 12px;
    border-radius: 12px;
    gap: 8px;
  }

  .ipa-hero-steps {
    gap: 7px;
  }

  .ipa-hero-step {
    gap: 9px;
    align-items: flex-start;
  }

  .ipa-hero-step-num {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    font-size: 0.72rem;
    margin-top: 1px;
  }

  .ipa-hero-step strong {
    font-size: 0.8rem;
    line-height: 1.25;
  }

  .ipa-hero-step small {
    font-size: 0.72rem;
    line-height: 1.3;
  }

  .ipa-filter-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .ipa-filter-pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    max-width: 100%;
    padding: 2px 2px 4px;
    gap: 6px;
    scroll-snap-type: x proximity;
  }

  .ipa-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .ipa-filter-pill {
    flex-shrink: 0;
    white-space: nowrap;
    scroll-snap-align: start;
    padding: 6px 11px;
    font-size: 0.76rem;
    min-height: 36px;
  }

  .ipa-master-grid {
    padding-bottom: 24px;
  }

  .ipa-card {
    aspect-ratio: auto;
    min-height: 140px;
    min-width: 0;
  }

  .ipa-card-badge {
    font-size: 0.66rem;
    padding: 3px 7px;
  }

  .ipa-sound-indicator {
    opacity: 0.7;
  }

  .ipa-pedagogical-hint {
    align-items: flex-start;
    padding: 14px 16px;
    margin-bottom: 24px;
  }

  /* Modales tipo "hoja inferior" */
  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal-dialog,
  .ipa-modal-dialog {
    width: 100%;
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
    transform: translateY(40px);
  }

  .modal-header {
    padding: 16px 16px 14px;
    gap: 12px;
    align-items: flex-start;
  }

  .modal-letter-info {
    gap: 12px;
    min-width: 0;
  }

  .modal-glyph-box {
    width: 48px;
    height: 48px;
    font-size: 1.8rem;
    flex-shrink: 0;
  }

  .modal-letter-titles {
    min-width: 0;
  }

  .modal-letter-titles h3 {
    font-size: 1.15rem;
  }

  .modal-close-btn {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }

  .modal-body {
    padding: 16px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    gap: 16px;
  }

  .rule-item-card {
    padding: 14px;
  }

  .rule-item-title {
    flex-wrap: wrap;
  }

  .ipa-modal-header {
    flex-wrap: wrap;
    padding: 16px;
    gap: 12px;
  }

  .ipa-modal-banner {
    gap: 12px;
    flex: 1 1 100%;
  }

  .ipa-modal-glyph-box {
    width: 54px;
    height: 54px;
    font-size: 1.8rem;
    border-radius: 14px;
  }

  .ipa-modal-titles h3 {
    font-size: 1.2rem;
  }

  .ipa-modal-header-actions {
    width: 100%;
    gap: 10px;
  }

  .ipa-modal-play-btn {
    flex: 1;
    justify-content: center;
    min-height: 44px;
  }

  .ipa-modal-toolbar {
    margin-bottom: 14px;
  }

  .ipa-pedagogical-banner {
    padding: 12px 14px;
    gap: 10px;
  }

  .ipa-grapheme-card {
    padding: 14px;
    border-radius: 14px;
  }

  .grapheme-letter-badge {
    font-size: 1.45rem;
    min-width: 0;
  }

  .grapheme-explore-btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  .grapheme-rule-box {
    padding: 10px 12px;
  }

  /* Reading */
  .reading-header-intro {
    padding: 0 6px;
  }

  .reading-item-title {
    font-size: 1rem;
  }

  .reading-item-sub {
    font-size: 0.86rem;
  }

  .reading-item-desc {
    font-size: 0.9rem;
  }

  .reading-card-footer {
    margin-top: 24px;
    padding-top: 18px;
  }

  .reading-unit-test-btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }

  /* Toasts */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    align-items: center;
  }

  .toast-message {
    max-width: 100%;
  }

  /* Footer */
  .footer-text {
    flex-wrap: wrap;
    font-size: 0.8rem;
  }
}

/* Móviles pequeños (≤ 380px) */
@media (max-width: 380px) {
  .main-content {
    padding-left: 10px;
    padding-right: 10px;
  }

  .brand-title {
    font-size: 1.2rem;
  }

  .nav-tab-btn {
    font-size: 0.7rem;
    padding-left: 4px;
    padding-right: 4px;
  }

  .alphabet-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ipa-card-glyph {
    font-size: 1.65rem;
  }

  .reading-unit-card {
    padding: 20px 14px;
  }

  .reading-unit-title {
    font-size: 1.4rem;
  }

  .reading-item-content,
  .reading-timeline-item.active .reading-item-content {
    padding: 10px 12px;
  }
}

/* Pantallas táctiles: evitar estados hover "pegados" que desplazan elementos */
@media (hover: none) {

  .letter-card:hover:not(:active),
  .ipa-card:hover:not(:active),
  .ipa-filter-pill:hover,
  .ipa-grapheme-card:hover,
  .rules-variant-btn:hover,
  .header-icon-btn:hover,
  .user-avatar:hover,
  .reading-unit-test-btn:hover,
  .ipa-modal-play-btn:hover,
  .ipa-nav-step-btn:hover,
  .grapheme-example-chip:hover,
  .grapheme-explore-btn:hover,
  .example-chip:hover,
  .modal-ipa-chip:hover {
    transform: none;
  }
}

/* Orientación horizontal en móviles: modales ocupan casi toda la altura */
@media (max-height: 500px) and (orientation: landscape) {

  .modal-dialog,
  .ipa-modal-dialog {
    max-height: 96vh;
    max-height: 96dvh;
  }
}

/* ==========================================================================
   Interactive Story Reader (1.1 Personal Pronouns — Non-scrolling View)
   ========================================================================== */

body.story-reader-active .main-content {
  max-width: 1460px;
  padding: 12px 18px 24px;
}

.story-reader-view {
  width: 100%;
  animation: fadeInModule 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.story-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: stretch;
  min-height: calc(100dvh - 150px);
}

/* Main Left Panel (Light Mode default + Dark Mode support) */
.story-main-panel {
  background: #ffffff;
  color: #0f172a;
  border-radius: 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.06);
  font-family: var(--font-reading);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 24px 20px;
  overflow: hidden;
  position: relative;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
}

/* Top Bar: Back Button + Green Progress Bar + View Icons */
.story-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px;
}

.story-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-full);
  padding: 7px 14px;
  font-family: var(--font-reading);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.story-back-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Green Progress Bar with Circular Indicator */
.story-progress-wrapper {
  flex: 1;
  max-width: 440px;
  margin: 0 auto;
  padding: 8px 4px;
}

.story-progress-track {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  position: relative;
  cursor: pointer;
}

.story-progress-fill {
  height: 100%;
  width: 5%;
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
  border-radius: var(--radius-full);
  position: relative;
  transition: width 0.28s ease;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.story-progress-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 2.5px solid #22c55e;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.story-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.story-action-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #475569;
  font-size: 0.82rem;
  font-weight: 700;
  user-select: none;
}

/* Stage: Left/Right Page Pillars + Center Non-scrolling Canvas */
.story-stage {
  flex: 1;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: stretch;
  gap: 14px;
  margin: 6px 0 14px;
}

.story-page-pillar {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #475569;
  transition: all var(--transition-fast);
  padding: 0;
}

.story-page-pillar .pillar-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.story-page-pillar:hover:not(:disabled) {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.story-page-pillar:hover:not(:disabled) .pillar-circle {
  background: #22c55e;
  color: #ffffff;
  transform: scale(1.08);
}

.story-page-pillar:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Story Canvas */
.story-canvas {
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 6px 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.story-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

.story-avatar-badge {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1.5px solid #93c5fd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.92rem;
  color: #1e3a8a;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.1);
}

.story-header-meta {
  flex: 1;
  min-width: 200px;
}

.story-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.story-subtitle {
  font-size: 0.875rem;
  color: #64748b;
  margin-top: 2px;
}

.story-legend {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.legend-chip.subject-chip {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.legend-chip.object-chip {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
}

/* 1.2 Possessives Legend Chips */
.legend-chip.possessive-adj-chip {
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.legend-chip.possessive-pro-chip {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

/* 1.3 Demonstratives Legend Chips */
.legend-chip.demonstrative-near-chip {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.legend-chip.demonstrative-far-chip {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* 1.4 Reflexives Legend Chips */
.legend-chip.reflexive-chip {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.legend-chip.emphatic-chip {
  background: #fdf4ff;
  color: #a21caf;
  border: 1px solid #f5d0fe;
}

/* Non-scrolling Paginated Sentences Container */
.story-page-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.story-page-content.page-flip-anim {
  animation: storyBlockSwap 0.34s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes storyBlockSwap {
  from {
    opacity: 0;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.story-paragraph {
  margin: 0 0 18px 0;
  font-size: 1.18rem;
  line-height: 2.05;
  font-weight: 600;
  color: #1e293b;
  text-align: left;
}

.story-paragraph:last-child {
  margin-bottom: 0;
}

.story-sentence {
  display: inline;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  color: inherit;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  cursor: pointer;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  margin: 0;
}

.story-sentence:hover {
  background: #f8fafc;
}

.story-sentence.is-past {
  color: #64748b;
}

.story-sentence.is-active {
  background: #f0fdf4;
  border: 1.5px solid #22c55e;
  border-radius: 12px;
  color: #0f172a;
  box-shadow: 0 4px 14px -4px rgba(34, 197, 94, 0.16);
}

/* Word & Pronoun Highlights */
.story-word {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 1px;
  border-radius: 8px;
  cursor: pointer;
  user-select: text;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease, outline 0.15s ease;
}

.story-word:hover {
  outline: 1.5px solid #2563eb;
  transform: translateY(-1px);
}

.story-word.is-selected {
  outline: 2px solid #2563eb !important;
  background: #dbeafe !important;
  color: #1e3a8a !important;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.story-word.pronoun-subject {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 700;
}

.story-word.pronoun-object,
.story-word.word-amber {
  background: #fff7ed;
  color: #c2410c;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 2px 8px;
  font-weight: 700;
}

/* 1.2 Possessives Highlights */
.story-word.possessive-adj {
  background: #f5f3ff;
  color: #6d28d9;
  border-bottom: 2px solid #8b5cf6;
}

.story-word.possessive-pro {
  background: #fff1f2;
  color: #be123c;
  border-bottom: 2px solid #f43f5e;
}

/* 1.3 Demonstratives Highlights */
.story-word.demonstrative-near {
  background: #ecfdf5;
  color: #047857;
  border-bottom: 2px solid #10b981;
}

.story-word.demonstrative-far {
  background: #fffbeb;
  color: #b45309;
  border-bottom: 2px solid #f59e0b;
}

/* 1.4 Reflexives Highlights */
.story-word.reflexive-word {
  background: #f0fdfa;
  color: #0f766e;
  border-bottom: 2px solid #14b8a6;
}

.story-word.emphatic-word {
  background: #fdf4ff;
  color: #a21caf;
  border-bottom: 2px solid #d946ef;
}

.story-word.is-speaking {
  background: #22c55e !important;
  color: #ffffff !important;
  font-weight: 800;
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.35);
}

/* Enhanced Bottom Audio Player Bar */
.story-player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 12px 18px;
  margin-top: auto;
}

.player-main-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.player-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(34, 197, 94, 0.55);
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(34, 197, 94, 0.3);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), filter var(--transition-fast);
}

.player-play-btn:hover {
  transform: scale(1.06);
  filter: brightness(1.06);
}

.player-play-btn.is-playing {
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.2), 0 8px 22px rgba(34, 197, 94, 0.38);
}

.player-nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.player-nav-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.player-timeline {
  flex: 1;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.player-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
}

.player-voice-status {
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-counters {
  color: #334155;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.player-counters .counter-sep {
  color: #94a3b8;
}

.player-scrubber {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  overflow: hidden;
  cursor: pointer;
}

.player-scrubber-fill {
  height: 100%;
  width: 5%;
  background: linear-gradient(90deg, #16a34a, #22c55e);
  border-radius: var(--radius-full);
  transition: width 0.25s ease;
}

.player-extra-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.player-speed-btn {
  background: #ffffff;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 6px 12px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.player-speed-btn:hover {
  border-color: #16a34a;
  color: #15803d;
}

.player-view-badge,
.player-cards-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  padding: 5px 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
}

/* ==========================================================================
   Right Inspector Sidebar (Interactive Word Dictionary & Notes)
   ========================================================================== */

.story-inspector-sidebar {
  background: #ffffff;
  color: #0f172a;
  border-radius: 22px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.06);
  font-family: var(--font-reading);
  padding: 20px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  user-select: none;
  transition: background-color var(--transition-normal), border-color var(--transition-normal), color var(--transition-normal);
}

.inspector-top {
  padding-bottom: 14px;
  border-bottom: 1px solid #e2e8f0;
}

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

.inspector-audio-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.inspector-audio-circle:hover {
  background: #eff6ff;
  border-color: #2563eb;
  color: #1d4ed8;
  transform: scale(1.08);
}

.inspector-audio-circle.is-speaking {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 12px rgba(37, 99, 235, 0.35);
}

.inspector-word-text {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.inspector-tags-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.inspector-coin-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #334155;
}

.inspector-coin-badge .coin-dot {
  color: #f59e0b;
  font-size: 0.95rem;
}

.inspector-pos-tag {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
}

.inspector-add-tag {
  background: none;
  border: 1px dashed #94a3b8;
  font-size: 0.74rem;
  font-weight: 700;
  color: #64748b;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.inspector-add-tag:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inspector-section-head {
  background: none;
  border: none;
  width: 100%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 700;
  color: #0f172a;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.inspector-section-head:hover {
  color: #1d4ed8;
}

.inspector-section-head .accordion-arrow {
  transition: transform 0.22s ease;
}

.inspector-section.is-collapsed .inspector-section-head .accordion-arrow {
  transform: rotate(-90deg);
}

.inspector-section.is-collapsed .inspector-meaning-box,
.inspector-section.is-collapsed .inspector-phrases-list {
  display: none;
}

.inspector-meaning-box {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
}

.inspector-pin-icon {
  color: #f59e0b;
  display: inline-flex;
}

.inspector-phrases-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 0;
  margin: 0;
  font-size: 0.88rem;
  color: #334155;
}

.inspector-phrase-item {
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.inspector-phrase-item:hover {
  background: #eff6ff;
  color: #1d4ed8;
}

.inspector-notes-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 12px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.inspector-notes-box:focus-within {
  border-color: #2563eb;
  background: #ffffff;
}

.inspector-notes-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #0f172a;
  font-family: var(--font-reading);
  font-size: 0.86rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 48px;
  padding: 0;
}

.inspector-notes-input::placeholder {
  color: #94a3b8;
}

.inspector-mascot-badge {
  align-self: flex-end;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.inspector-mascot-badge:hover {
  transform: scale(1.1);
}

.inspector-bottom-bar {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.inspector-level-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.inspector-level-circle:hover {
  border-color: #2563eb;
  color: #1d4ed8;
  transform: scale(1.08);
}

.inspector-level-circle.active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.25);
}

/* Dark Mode Overrides for Interactive Story Reader */
body.dark-mode .story-main-panel,
body.dark-mode .story-inspector-sidebar {
  background: #111827;
  color: #f8fafc;
  border-color: #1e293b;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6), 0 8px 20px -4px rgba(0, 0, 0, 0.4);
}

body.dark-mode .story-back-btn {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
  box-shadow: none;
}

body.dark-mode .story-back-btn:hover {
  background: #334155;
  border-color: #475569;
  color: #f8fafc;
}

body.dark-mode .story-progress-track {
  background: #1e293b;
}

body.dark-mode .story-progress-thumb {
  background: #111827;
}

body.dark-mode .story-action-pill {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-mode .story-page-pillar {
  background: #0b0f19;
  border-color: #1e293b;
  color: #cbd5e1;
}

body.dark-mode .story-page-pillar .pillar-circle {
  background: #1e293b;
  color: #cbd5e1;
}

body.dark-mode .story-page-pillar:hover:not(:disabled) {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .story-header {
  border-bottom-color: #1e293b;
}

body.dark-mode .story-avatar-badge {
  background: #1e293b;
  border-color: #f59e0b;
  color: #fde68a;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

body.dark-mode .story-title {
  color: #f8fafc;
}

body.dark-mode .story-subtitle {
  color: #94a3b8;
}

body.dark-mode .legend-chip.subject-chip {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.38);
}

body.dark-mode .legend-chip.object-chip {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.42);
}

body.dark-mode .legend-chip.possessive-adj-chip {
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.42);
}

body.dark-mode .legend-chip.possessive-pro-chip {
  background: rgba(244, 63, 94, 0.18);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.42);
}

body.dark-mode .legend-chip.demonstrative-near-chip {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.42);
}

body.dark-mode .legend-chip.demonstrative-far-chip {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.42);
}

body.dark-mode .legend-chip.reflexive-chip {
  background: rgba(20, 184, 166, 0.18);
  color: #5eead4;
  border-color: rgba(20, 184, 166, 0.42);
}

body.dark-mode .legend-chip.emphatic-chip {
  background: rgba(217, 70, 239, 0.18);
  color: #f5d0fe;
  border-color: rgba(217, 70, 239, 0.42);
}

body.dark-mode .story-paragraph {
  color: #f8fafc;
}

body.dark-mode .story-sentence {
  color: #f8fafc;
}

body.dark-mode .story-sentence:hover {
  background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .story-sentence.is-past {
  color: #94a3b8;
}

body.dark-mode .story-sentence.is-active {
  background: rgba(34, 197, 94, 0.1);
  border-color: #22c55e;
  color: #f8fafc;
}

body.dark-mode .story-word:hover {
  outline-color: #38bdf8;
}

body.dark-mode .story-word.is-selected {
  outline: 2px solid #38bdf8 !important;
  background: rgba(56, 189, 248, 0.28) !important;
  color: #ffffff !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.45);
}

body.dark-mode .story-word.pronoun-subject {
  background: rgba(14, 55, 85, 0.85);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.45);
}

body.dark-mode .story-word.pronoun-object,
body.dark-mode .story-word.word-amber {
  background: rgba(62, 40, 12, 0.85);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.45);
}

body.dark-mode .story-word.possessive-adj {
  background: rgba(139, 92, 246, 0.22);
  color: #ddd6fe;
  border-bottom-color: rgba(139, 92, 246, 0.65);
}

body.dark-mode .story-word.possessive-pro {
  background: rgba(244, 63, 94, 0.24);
  color: #ffe4e6;
  border-bottom-color: rgba(244, 63, 94, 0.65);
}

body.dark-mode .story-word.demonstrative-near {
  background: rgba(16, 185, 129, 0.22);
  color: #a7f3d0;
  border-bottom-color: rgba(16, 185, 129, 0.65);
}

body.dark-mode .story-word.demonstrative-far {
  background: rgba(245, 158, 11, 0.25);
  color: #fef3c7;
  border-bottom-color: rgba(245, 158, 11, 0.65);
}

body.dark-mode .story-word.reflexive-word {
  background: rgba(20, 184, 166, 0.22);
  color: #99f6e4;
  border-bottom-color: rgba(20, 184, 166, 0.65);
}

body.dark-mode .story-word.emphatic-word {
  background: rgba(217, 70, 239, 0.24);
  color: #fae8ff;
  border-bottom-color: rgba(217, 70, 239, 0.65);
}

body.dark-mode .story-player-bar {
  background: #0b0f19;
  border-color: #1e293b;
}

body.dark-mode .player-nav-btn {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-mode .player-nav-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #475569;
}

body.dark-mode .player-voice-status {
  color: #94a3b8;
}

body.dark-mode .player-counters {
  color: #cbd5e1;
}

body.dark-mode .player-scrubber {
  background: #1e293b;
}

body.dark-mode .player-speed-btn {
  background: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

body.dark-mode .player-view-badge,
body.dark-mode .player-cards-count {
  background: #111827;
  border-color: #1e293b;
  color: #94a3b8;
}

body.dark-mode .inspector-top {
  border-bottom-color: #1e293b;
}

body.dark-mode .inspector-audio-circle {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-mode .inspector-audio-circle:hover {
  background: #334155;
  border-color: #60a5fa;
  color: #60a5fa;
}

body.dark-mode .inspector-word-text {
  color: #f8fafc;
}

body.dark-mode .inspector-coin-badge {
  color: #f8fafc;
}

body.dark-mode .inspector-pos-tag {
  background: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}

body.dark-mode .inspector-add-tag {
  border-color: #475569;
  color: #94a3b8;
}

body.dark-mode .inspector-section-head {
  color: #f8fafc;
}

body.dark-mode .inspector-meaning-box {
  background: #1e293b;
  border-color: #334155;
  color: #f8fafc;
}

body.dark-mode .inspector-phrases-list {
  color: #cbd5e1;
}

body.dark-mode .inspector-phrase-item:hover {
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
}

body.dark-mode .inspector-notes-box {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .inspector-notes-box:focus-within {
  border-color: #60a5fa;
  background: #0b0f19;
}

body.dark-mode .inspector-notes-input {
  color: #f8fafc;
}

body.dark-mode .inspector-mascot-badge {
  background: #111827;
  border-color: #334155;
}

body.dark-mode .inspector-bottom-bar {
  border-top-color: #1e293b;
}

body.dark-mode .inspector-level-circle {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

body.dark-mode .inspector-level-circle:hover {
  border-color: #60a5fa;
  color: #ffffff;
}

body.dark-mode .inspector-level-circle.active {
  background: #1d4ed8;
  border-color: #2563eb;
  color: #ffffff;
}

/* ==========================================================================
   Responsive Breakpoints for Story Reader (Tablet & Mobile)
   ========================================================================== */

@media (max-width: 1080px) {
  .story-workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .story-inspector-sidebar {
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  body.story-reader-active .main-content {
    padding: 8px 10px 28px;
  }

  .story-main-panel {
    padding: 14px 12px 16px;
    border-radius: 18px;
  }

  .story-topbar {
    gap: 10px;
  }

  .story-back-btn {
    padding: 6px 11px;
    font-size: 0.78rem;
  }

  .story-top-actions .story-action-pill:not(.story-sidebar-icon) {
    display: none;
  }

  .story-stage {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 6px;
  }

  .story-page-pillar {
    border-radius: 10px;
  }

  .story-page-pillar .pillar-circle {
    width: 24px;
    height: 24px;
  }

  .story-canvas {
    padding: 4px 4px;
  }

  .story-header {
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
  }

  .story-avatar-badge {
    width: 40px;
    height: 40px;
    font-size: 0.82rem;
  }

  .story-title {
    font-size: 1rem;
  }

  .story-subtitle {
    font-size: 0.76rem;
  }

  .story-sentence {
    font-size: 1.02rem;
    line-height: 1.45;
    padding: 6px 10px;
  }

  .story-page-content {
    gap: 8px;
  }

  .story-player-bar {
    flex-wrap: wrap;
    padding: 12px;
    gap: 12px;
  }

  .player-timeline {
    order: -1;
    flex: 1 1 100%;
  }

  .player-status-row {
    font-size: 0.72rem;
  }

  .player-view-badge {
    display: none;
  }

  .story-inspector-sidebar {
    padding: 16px 14px;
    border-radius: 18px;
  }
}

@media (max-width: 380px) {
  .story-stage {
    grid-template-columns: 26px minmax(0, 1fr) 26px;
    gap: 4px;
  }

  .story-sentence {
    font-size: 0.95rem;
    padding: 5px 8px;
  }

  .player-play-btn {
    width: 42px;
    height: 42px;
  }

  .player-nav-btn {
    width: 34px;
    height: 34px;
  }
}

/* ==========================================================================
   Grapheme Card Right Actions & Mini FSRS Mastery Badge (#ipaGraphemesModal)
   ========================================================================== */

.grapheme-right-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.grapheme-mini-stats {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  white-space: nowrap;
}

.grapheme-mini-stats.is-unstarted {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.24);
}

/* ==========================================================================
   Modo Grafema — Explorar 100 Palabras + FSRS Memory Scheduler
   ========================================================================== */

.gw-modal-backdrop {
  z-index: 1200;
  background: rgba(8, 10, 16, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 18px 16px;
  overflow-y: auto;
  align-items: flex-start;
  justify-content: center;
}

.gw-modal-backdrop.is-open {
  display: flex;
}

.gw-modal-stage {
  width: 100%;
  max-width: 56rem;
  margin: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #f8fafc;
  padding: 4px 0 16px;
  animation: fadeInModule 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================================
   Consola de Enfoque / Contenedor Envolvente Glassmorphism (Modo Grafema)
   ============================================================================ */
.gw-practice-wrapper {
  position: relative;
  width: 100%;
  max-width: 56rem;
  margin-left: auto;
  margin-right: auto;
  border-radius: 1.5rem;
  padding: 3rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;

  /* Modo Claro (Light Mode) */
  background-color: rgba(248, 250, 252, 0.85);
  border: 1px solid rgba(199, 210, 254, 0.80);
  box-shadow: inset 0 0 0 1px #ffffff, 0 20px 50px -12px rgba(79, 70, 229, 0.10);
}

@media (min-width: 640px) {
  .gw-practice-wrapper {
    padding: 3.25rem 2.25rem 2.25rem;
  }

  .gw-close-corner-btn {
    top: 0.875rem;
    right: 0.875rem;
  }
}

/* Modo Oscuro (Dark Mode) */
body.dark-mode .gw-practice-wrapper {
  background-color: rgba(11, 14, 23, 0.75);
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 60px -15px rgba(99, 102, 241, 0.18);
}

/* Botón de Cierre Superior Derecho ("X") */
.gw-close-corner-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s ease;
  line-height: 1;

  /* Modo Claro (Light Mode) */
  background-color: rgba(226, 232, 240, 0.60);
  border: 1px solid rgba(203, 213, 225, 0.70);
  color: #64748b;
}

.gw-close-corner-btn:hover {
  background-color: #eef2ff;
  border-color: #a5b4fc;
  color: #4f46e5;
  transform: scale(1.06);
}

.gw-close-corner-btn:active {
  transform: scale(0.94);
}

.gw-close-corner-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Modo Oscuro (Dark Mode) */
body.dark-mode .gw-close-corner-btn {
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: #94a3b8;
}

body.dark-mode .gw-close-corner-btn:hover {
  background-color: rgba(99, 102, 241, 0.20);
  border-color: rgba(129, 140, 248, 0.40);
  color: #ffffff;
}

.gw-close-corner-icon {
  width: 1rem;
  height: 1rem;
  display: block;
  pointer-events: none;
}

/* 1. Top FSRS Learning & Memory Strength Statistics Bar (integrated inside .gw-phonics-stage) */
.gw-stats-bar {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px 20px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  box-shadow: none;
}

.gw-stats-metrics {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.gw-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #cbd5e1;
  background: #1b202e;
  border: 1px solid #2a3142;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.gw-stat-chip strong {
  color: #ffffff;
  font-weight: 800;
}

.gw-stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gw-stat-learned .gw-stat-dot {
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.65);
}

.gw-stat-weak .gw-stat-dot {
  background: #e11d48;
  box-shadow: 0 0 8px rgba(225, 29, 72, 0.65);
}

.gw-stat-medium .gw-stat-dot {
  background: #f97316;
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.65);
}

.gw-stat-strong .gw-stat-dot {
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37, 99, 235, 0.65);
}

.gw-memory-meter-wrap {
  flex: 1 1 160px;
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.gw-memory-meter-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  color: #94a3b8;
}

.gw-memory-meter-labels strong {
  color: #e2e8f0;
  font-weight: 700;
}

.gw-memory-track {
  width: 100%;
  height: 6px;
  background: #232938;
  border-radius: var(--radius-full);
  overflow: hidden;
  display: flex;
}

.gw-memory-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.gw-seg-mastered {
  background: #10b981;
}

.gw-seg-strong {
  background: #2563eb;
}

.gw-seg-medium {
  background: #f97316;
}

.gw-seg-weak {
  background: #e11d48;
}

.gw-resort-btn {
  background: #1e2434;
  color: #cbd5e1;
  border: 1px solid #323b52;
  border-radius: 10px;
  padding: 6px 11px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
  white-space: nowrap;
}

.gw-resort-btn:hover {
  background: #283046;
  color: #ffffff;
  border-color: #6366f1;
}

/* 2. Unified Pronunciation & Voice Practice Stage */
.gw-phonics-stage {
  width: 100%;
  background: #0b0e16;
  border: 1px solid #1f263b;
  border-radius: 16px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gw-top-phoneme-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(auto, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 18px 20px 16px;
}

.gw-voice-controls {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: #111625;
  border: 1px solid #242c44;
}

.gw-stage-center {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.gw-phoneme-tiles {
  display: flex;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.gw-phoneme-tile {
  min-width: 64px;
  min-height: 86px;
  padding: 10px 14px 10px;
  background: #141929;
  border: 1px solid #28324d;
  border-radius: 14px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: center;
  cursor: pointer;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.30);
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.gw-phoneme-tile:hover {
  background: #1b2236;
  border-color: #3f4b70;
  transform: translateY(-2px);
}

.gw-phoneme-tile.is-target {
  border-color: rgba(244, 63, 94, 0.50);
  background: linear-gradient(180deg, #211624 0%, #171422 100%);
}

.gw-phoneme-tile.is-silent {
  opacity: 0.78;
}

.gw-phoneme-tile.is-playing {
  transform: scale(0.96);
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.28);
}

.gw-tile-letters {
  display: block;
  width: 100%;
  margin-block: auto;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  color: #f8fafc;
}

.gw-phoneme-tile:first-child .gw-tile-letters::first-letter {
  text-transform: uppercase;
}

.gw-tile-play-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.gw-phoneme-tile.is-target .gw-tile-play-badge {
  background: linear-gradient(135deg, #f43f5e 0%, #ef4444 100%);
  box-shadow: 0 3px 10px rgba(244, 63, 94, 0.34);
}

.gw-phoneme-tile.is-other .gw-tile-play-badge {
  background: linear-gradient(135deg, #fb923c 0%, #f97316 100%);
  box-shadow: 0 3px 10px rgba(249, 115, 22, 0.28);
}

.gw-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gw-word-play-btn {
  min-width: 64px;
  min-height: 86px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid #2b3552;
  background: #171d30;
  color: #e2e8f0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
}

.gw-word-play-top {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-block: auto;
  color: inherit;
}

.gw-word-play-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111625;
  border: 1px solid #2b3552;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.gw-word-play-btn:hover {
  transform: translateY(-2px);
  background: #1e2640;
  border-color: #475569;
  color: #f8fafc;
}

.gw-word-play-btn:hover .gw-word-play-badge,
.gw-word-play-btn.is-speaking .gw-word-play-badge {
  background: #e2e8f0;
  border-color: #e2e8f0;
  color: #0f172a;
}

.gw-word-play-btn.is-speaking {
  border-color: #64748b;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.24), 0 8px 18px rgba(0, 0, 0, 0.35);
}

.gw-word-play-btn.is-loading {
  opacity: 0.85;
  animation: gwAudioLoadingPulse 0.9s ease-in-out infinite;
}

@keyframes gwAudioLoadingPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.04); opacity: 1; }
}

.gw-voice-rec-btn,
.gw-voice-play-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid #2b3552;
  background-color: #171d30;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.gw-voice-rec-btn .gw-stop-icon {
  display: none;
}

.gw-voice-rec-btn.is-recording .gw-mic-icon {
  display: none;
}

.gw-voice-rec-btn.is-recording .gw-stop-icon {
  display: block;
}

.gw-voice-rec-btn:hover:not(:disabled) {
  transform: scale(1.05);
  border-color: #ef4444;
  color: #f87171;
  background-color: rgba(239, 68, 68, 0.12);
}

.gw-voice-rec-btn.is-recording {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #ef4444;
  color: #ffffff;
  animation: gwMicPulse 1.15s infinite ease-in-out;
}

@keyframes gwMicPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.gw-voice-play-btn:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  box-shadow: none;
}

.gw-voice-play-btn.has-recording {
  border-color: rgba(16, 185, 129, 0.55);
  color: #34d399;
  background-color: rgba(16, 185, 129, 0.14);
}

.gw-voice-play-btn.has-recording:hover {
  transform: scale(1.05);
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.30);
}

.gw-voice-play-btn.is-playing {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-color: #10b981;
  color: #ffffff;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.25), 0 6px 16px rgba(16, 185, 129, 0.45);
}

.gw-voice-rec-btn:focus-visible,
.gw-voice-play-btn:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

body.dark-mode .gw-voice-rec-btn,
body.dark-mode .gw-voice-play-btn {
  background-color: #171d30;
  border-color: #2b3552;
  color: #e2e8f0;
}

body.dark-mode .gw-voice-rec-btn.has-recording,
body.dark-mode .gw-voice-play-btn.has-recording {
  background-color: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.55);
  color: #34d399;
}

.gw-quick-next-btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #10141d;
  border: 1.5px solid rgba(16, 185, 129, 0.38);
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.24);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.gw-quick-next-btn:hover {
  transform: scale(1.06);
  border-color: #10b981;
  box-shadow: 0 0 24px rgba(16, 185, 129, 0.45);
}

/* 3. Integrated Word, IPA & Spanish Translation Strip */
.gw-ipa-bar {
  width: 100%;
  background: #111625;
  border: none;
  border-radius: 0 0 15px 15px;
  padding: 13px 20px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  cursor: pointer;
  transition: background-color 0.18s ease;
}

.gw-ipa-bar:hover {
  background: #161c30;
}

.gw-word-text {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #f8fafc;
}

.gw-word-text::first-letter {
  text-transform: uppercase;
}

.gw-ipa-text {
  font-family: var(--font-sans);
  font-size: 1.55rem;
  font-weight: 700;
  color: #a5b4fc;
  letter-spacing: 0.02em;
}

.gw-ipa-target {
  color: #fb7185;
  font-weight: 800;
}

.gw-dialect-tag {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f8fafc;
}

.gw-translation-text {
  font-size: 1.25rem;
  font-style: italic;
  font-weight: 500;
  color: #94a3b8;
}

.gw-grapheme-caption {
  font-size: 0.85rem;
  font-weight: 600;
  color: #94a3b8;
  text-align: center;
  margin-top: -4px;
}

/* 4. Main Pedagogical Context Card (Matching Word Image + Description + Sentence + Rating Bar) */
.gw-main-card {
  width: 100%;
  background: #0b0e16;
  border: 1px solid #1f263b;
  border-radius: 16px;
  padding: 20px 24px 20px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.gw-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid #1e2538;
}

.gw-category-title {
  text-align: left;
  font-size: 1.04rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f8fafc;
  margin: 0;
  line-height: 1.25;
}

.gw-card-grid {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
}

.gw-illustration-card {
  width: 200px;
  height: 200px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 18px;
  padding: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.gw-illustration-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45);
}

.gw-illustration-canvas {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gw-illustration-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.gw-details-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.gw-description-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 8px 14px 8px;
}

.gw-description-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gw-description-header .gw-block-kicker,
.gw-sentence-header .gw-block-kicker {
  margin-bottom: 0;
}

.gw-description-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gw-lang-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  background: #14192a;
  border: 1px solid #2d3654;
  border-radius: 999px;
  padding: 4px 11px;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #94a3b8;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.14s ease;
}

.gw-lang-toggle-btn:hover {
  background: #1b2238;
  border-color: #6366f1;
}

.gw-lang-icon {
  color: #818cf8;
  flex-shrink: 0;
}

.gw-lang-arrows {
  color: #64748b;
  font-size: 0.72rem;
}

.gw-lang-pill-en,
.gw-lang-pill-es {
  padding: 2px 6px;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.gw-lang-toggle-btn[data-lang="en"] .gw-lang-pill-en {
  background: rgba(99, 102, 241, 0.24);
  color: #c7d2fe;
}

.gw-lang-toggle-btn[data-lang="es"] .gw-lang-pill-es {
  background: rgba(245, 184, 65, 0.24);
  color: #fde68a;
}

.gw-block-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a5b4fc;
  margin-bottom: 4px;
}

.gw-word-description {
  font-size: 0.98rem;
  line-height: 1.55;
  max-width: 65ch;
  color: #cbd5e1;
  margin: 0;
}

.gw-sentence-box {
  background: #111625;
  border: 1px solid #242c44;
  border-radius: 12px;
  padding: 14px 8px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gw-sentence-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.gw-sentence-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  background: rgba(139, 92, 246, 0.15);
  color: #ddd6fe;
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.14s ease;
}

.gw-audio-icon {
  flex-shrink: 0;
}

.gw-sentence-play-btn:hover,
.gw-sentence-play-btn.is-speaking {
  background: #8b5cf6;
  color: #ffffff;
  border-color: #a78bfa;
}

.gw-sentence-play-btn.is-loading {
  background: rgba(139, 92, 246, 0.32);
  color: #ede9fe;
  border-color: #a78bfa;
  animation: gwAudioLoadingPulse 0.9s ease-in-out infinite;
}

.gw-sentence-en {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.5;
  max-width: 65ch;
  color: #f8fafc;
  margin: 0;
}

.gw-sentence-highlight {
  display: inline-block;
  background: rgba(245, 158, 11, 0.22);
  color: #fde68a;
  border: 1px solid rgba(245, 158, 11, 0.42);
  padding: 0 7px;
  border-radius: 6px;
  font-weight: 800;
  line-height: 1.38;
}

.gw-sentence-es {
  font-size: 0.84rem;
  font-style: italic;
  color: #94a3b8;
  margin: 0;
}

.gw-meta-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.gw-meta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.34);
  color: #fcd34d;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.gw-meta-pill-phoneme {
  cursor: pointer;
  font-family: var(--font-sans);
  background: rgba(245, 158, 11, 0.20);
  border-color: rgba(245, 158, 11, 0.48);
  color: #fef08a;
  font-weight: 800;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.14s ease;
}

.gw-meta-pill-phoneme:hover {
  background: #d97706;
  border-color: #f59e0b;
  color: #ffffff;
}

.gw-meta-pill-cefr[data-cefr="A1"],
.gw-meta-pill-cefr[data-cefr="A2"] {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.gw-meta-pill-cefr[data-cefr="B1"],
.gw-meta-pill-cefr[data-cefr="B2"] {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
}

.gw-meta-pill-cefr[data-cefr="C1"],
.gw-meta-pill-cefr[data-cefr="C2"] {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.48);
  color: #fde68a;
}

.gw-meta-pill-memory[data-tier="mastered"] {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
}

.gw-meta-pill-memory[data-tier="strong"] {
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.42);
  color: #7dd3fc;
}

.gw-meta-pill-memory[data-tier="medium"] {
  background: rgba(129, 140, 248, 0.16);
  border-color: rgba(129, 140, 248, 0.42);
  color: #c7d2fe;
}

.gw-meta-pill-memory[data-tier="weak"] {
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.5);
  color: #fdba74;
}

.gw-meta-pill-memory[data-tier="ignored"] {
  background: rgba(100, 116, 139, 0.16);
  border-color: rgba(100, 116, 139, 0.35);
  color: #94a3b8;
}

/* 5. Knowledge / Memory Rating Circles (Image 4: Crossed-Eye, 1, 2, 3, 4, Checkmark) */
.gw-rating-section {
  border-top: 1px solid #1e2436;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gw-rating-header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.gw-rating-prompt {
  font-size: 0.82rem;
  font-weight: 700;
  color: #e2e8f0;
}

.gw-rating-feedback {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}

.gw-rating-circles {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.gw-fsrs-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.gw-fsrs-interval {
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
  line-height: 1.1;
  letter-spacing: 0.01em;
  user-select: none;
}

.gw-fsrs-item-aux .gw-fsrs-interval {
  font-size: 0.7rem;
  opacity: 0.72;
}

.gw-rating-circle {
  width: 44px;
  height: 42px;
  border-radius: 10px;
  border: 1.6px solid #353c4f;
  background: #171b25;
  color: #e2e8f0;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.gw-rating-circle.gw-fsrs-btn {
  width: auto;
  min-width: 86px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

/* Harmonious continuous color transition:
   Again (Coral-Vermilion -> Orange)
   Hard  (Warm Orange -> Amber-Gold)
   Good  (Emerald -> Teal-Cyan)
   Easy  (Teal-Sky -> Royal Blue) */
.gw-rating-circle.gw-fsrs-again {
  background: linear-gradient(135deg, #e11d48 0%, #f97316 100%);
  border-color: rgba(251, 113, 133, 0.65);
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.24);
}

.gw-rating-circle.gw-fsrs-hard {
  background: linear-gradient(135deg, #f97316 0%, #eab308 100%);
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.24);
}

.gw-rating-circle.gw-fsrs-good {
  background: linear-gradient(135deg, #10b981 0%, #0d9488 100%);
  border-color: rgba(52, 211, 153, 0.65);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.24);
}

.gw-rating-circle.gw-fsrs-easy {
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
}

.gw-rating-circle:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
}

.gw-rating-circle[data-rating="0"].is-active {
  background: #334155;
  border-color: #94a3b8;
  color: #f8fafc;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.38);
}

.gw-rating-circle[data-rating="1"].is-active {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.45), 0 6px 16px rgba(225, 29, 72, 0.38);
}

.gw-rating-circle[data-rating="2"].is-active {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.48), 0 6px 16px rgba(249, 115, 22, 0.36);
}

.gw-rating-circle[data-rating="3"].is-active {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.48), 0 6px 16px rgba(16, 185, 129, 0.38);
}

.gw-rating-circle[data-rating="4"].is-active {
  transform: translateY(-2px);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.48), 0 6px 16px rgba(37, 99, 235, 0.38);
}

.gw-rating-circle[data-rating="5"].is-active {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: #34d399;
  color: #ffffff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.42);
}

/* 6. Bottom Pagination & Exit (Image 3) */
.gw-footer-nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 4px;
}

.gw-pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.gw-page-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 10px;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.gw-page-btn-next {
  color: #ffffff;
}

.gw-page-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
}

.gw-page-counter {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 800;
  color: #94a3b8;
  min-width: 72px;
  text-align: center;
}

.gw-exit-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 10px;
  transition: color 0.16s ease, background-color 0.16s ease;
}

.gw-exit-btn:hover {
  color: #f8fafc;
  background: rgba(239, 68, 68, 0.14);
}

/* ============================================================================
   Modo Claro (Light Mode) Overrides for Modo Grafema (.gw-practice-wrapper)
   Keeps body.dark-mode completely untouched.
   ============================================================================ */
body:not(.dark-mode) .gw-modal-backdrop {
  background: rgba(247, 247, 247, 0.90);
}

body:not(.dark-mode) .gw-practice-wrapper {
  color: #0f172a;
  background-color: rgba(248, 250, 252, 0.96);
}

body:not(.dark-mode) .gw-stats-bar {
  background: transparent;
  border: none;
  box-shadow: none;
}

body:not(.dark-mode) .gw-stat-chip {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #475569;
}

body:not(.dark-mode) .gw-stat-chip strong {
  color: #0f172a;
}

body:not(.dark-mode) .gw-memory-meter-labels {
  color: #64748b;
}

body:not(.dark-mode) .gw-memory-meter-labels strong {
  color: #0f172a;
}

body:not(.dark-mode) .gw-memory-track {
  background: #e2e8f0;
}

body:not(.dark-mode) .gw-resort-btn {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}

body:not(.dark-mode) .gw-resort-btn:hover {
  background: #eef2ff;
  border-color: #6366f1;
  color: #1e1b4b;
}

body:not(.dark-mode) .gw-phonics-stage {
  background: #ffffff;
  border-color: #e5e8f2;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

body:not(.dark-mode) .gw-voice-controls {
  background: #f8f9fc;
  border-color: #e5e8f2;
}

body:not(.dark-mode) .gw-voice-rec-btn,
body:not(.dark-mode) .gw-voice-play-btn {
  background-color: #ffffff;
  border-color: #dce2ef;
  color: #334155;
}

body:not(.dark-mode) .gw-voice-rec-btn:hover:not(:disabled) {
  border-color: #ef4444;
  color: #dc2626;
  background-color: #fef2f2;
}

body:not(.dark-mode) .gw-voice-play-btn:disabled {
  background-color: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
  opacity: 0.72;
}

body:not(.dark-mode) .gw-voice-play-btn.has-recording {
  background-color: #ecfdf5;
  border-color: #6ee7b7;
  color: #047857;
}

body:not(.dark-mode) .gw-word-play-btn {
  background: #ffffff;
  border-color: #dce2ef;
  color: #334155;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

body:not(.dark-mode) .gw-word-play-badge {
  background: #f8f9fc;
  border-color: #dce2ef;
  color: #334155;
}

body:not(.dark-mode) .gw-word-play-btn:hover {
  background: #f8f9fc;
  border-color: #94a3b8;
  color: #0f172a;
}

body:not(.dark-mode) .gw-word-play-btn:hover .gw-word-play-badge,
body:not(.dark-mode) .gw-word-play-btn.is-speaking .gw-word-play-badge {
  background: #334155;
  border-color: #334155;
  color: #ffffff;
}

body:not(.dark-mode) .gw-word-play-btn.is-speaking {
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.22), 0 6px 14px rgba(15, 23, 42, 0.08);
}

body:not(.dark-mode) .gw-phoneme-tile {
  background: #ffffff;
  border-color: #dce2ef;
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

body:not(.dark-mode) .gw-phoneme-tile:hover {
  background: #f8f9fc;
  border-color: #94a3b8;
}

body:not(.dark-mode) .gw-tile-letters {
  color: #0f172a;
}

body:not(.dark-mode) .gw-phoneme-tile.is-target {
  background: linear-gradient(180deg, #fff5f5 0%, #ffe8ea 100%);
  border-color: #fca5a5;
}

body:not(.dark-mode) .gw-quick-next-btn {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(16, 185, 129, 0.55);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.16);
}

body:not(.dark-mode) .gw-ipa-bar {
  background: #f8f9fc;
  border: none;
  box-shadow: none;
}

body:not(.dark-mode) .gw-ipa-bar:hover {
  background: #f1f4fb;
}

body:not(.dark-mode) .gw-word-text {
  color: #0f172a;
}

body:not(.dark-mode) .gw-ipa-text {
  color: #4f46e5;
}

body:not(.dark-mode) .gw-ipa-target {
  color: #e11d48;
}

body:not(.dark-mode) .gw-dialect-tag {
  color: #0f172a;
}

body:not(.dark-mode) .gw-translation-text {
  color: #475569;
}

body:not(.dark-mode) .gw-main-card {
  background: #ffffff;
  border-color: #e5e8f2;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.06);
}

body:not(.dark-mode) .gw-card-header {
  border-bottom-color: #eef1f7;
}

body:not(.dark-mode) .gw-category-title {
  color: #0f172a;
}

body:not(.dark-mode) .gw-illustration-card {
  border-color: #e5e8f2;
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

body:not(.dark-mode) .gw-block-kicker {
  color: #4f46e5;
}

body:not(.dark-mode) .gw-word-description {
  color: #334155;
}

body:not(.dark-mode) .gw-lang-toggle-btn {
  background: #f8f9fc;
  border-color: #dce2ef;
  color: #475569;
}

body:not(.dark-mode) .gw-lang-toggle-btn:hover {
  background: #eef2ff;
  border-color: #818cf8;
}

body:not(.dark-mode) .gw-lang-icon {
  color: #4f46e5;
}

body:not(.dark-mode) .gw-lang-toggle-btn[data-lang="en"] .gw-lang-pill-en {
  background: rgba(79, 70, 229, 0.12);
  color: #3730a3;
}

body:not(.dark-mode) .gw-lang-toggle-btn[data-lang="es"] .gw-lang-pill-es {
  background: #fde6c4;
  color: #7c3f00;
}

body:not(.dark-mode) .gw-sentence-box {
  background: #f8f9fc;
  border-color: #e5e8f2;
}

body:not(.dark-mode) .gw-sentence-play-btn {
  background: #f3f0ff;
  color: #5b21b6;
  border-color: #ddd6fe;
}

body:not(.dark-mode) .gw-sentence-play-btn:hover,
body:not(.dark-mode) .gw-sentence-play-btn.is-speaking {
  background: #6d28d9;
  color: #ffffff;
  border-color: #5b21b6;
}

body:not(.dark-mode) .gw-sentence-play-btn.is-loading {
  background: #ede9fe;
  color: #4c1d95;
  border-color: #8b5cf6;
}

body:not(.dark-mode) .gw-sentence-en {
  color: #0f172a;
}

body:not(.dark-mode) .gw-sentence-highlight {
  background: #fde6c4;
  color: #7c3f00;
  border: 1px solid #f3ca8c;
}

body:not(.dark-mode) .gw-meta-pill {
  background: #fff7eb;
  border-color: #f3d2a2;
  color: #7c3f00;
}

body:not(.dark-mode) .gw-meta-pill-phoneme {
  background: #fde6c4;
  border-color: #eab676;
  color: #7c3f00;
}

body:not(.dark-mode) .gw-meta-pill-phoneme:hover {
  background: #f8d29a;
  border-color: #d97706;
  color: #5c2d00;
}

body:not(.dark-mode) .gw-rating-section {
  border-top-color: #e2e8f0;
}

body:not(.dark-mode) .gw-rating-prompt {
  color: #0f172a;
}

body:not(.dark-mode) .gw-rating-feedback {
  color: #64748b;
}

body:not(.dark-mode) .gw-fsrs-interval {
  color: #475569;
}

body:not(.dark-mode) .gw-rating-circle.gw-fsrs-aux-btn {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

body:not(.dark-mode) .gw-rating-circle.gw-fsrs-aux-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

body:not(.dark-mode) .gw-rating-circle[data-rating="0"].is-active {
  background: #e2e8f0;
  border-color: #64748b;
  color: #0f172a;
}

body:not(.dark-mode) .gw-rating-circle[data-rating="5"].is-active {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  border-color: #34d399;
  color: #ffffff;
}

body:not(.dark-mode) .gw-page-btn {
  color: #475569;
}

body:not(.dark-mode) .gw-page-btn-next {
  color: #0f172a;
  font-weight: 800;
}

body:not(.dark-mode) .gw-page-btn:hover {
  color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
}

body:not(.dark-mode) .gw-page-counter {
  color: #334155;
}

body:not(.dark-mode) .gw-exit-btn {
  color: #475569;
}

body:not(.dark-mode) .gw-exit-btn:hover {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.08);
}

/* Focus-visible WCAG 2.1 AA outlines inside Modo Grafema */
.gw-phoneme-tile:focus-visible,
.gw-word-play-btn:focus-visible,
.gw-quick-next-btn:focus-visible,
.gw-ipa-bar:focus-visible,
.gw-illustration-card:focus-visible,
.gw-lang-toggle-btn:focus-visible,
.gw-sentence-play-btn:focus-visible,
.gw-meta-pill-phoneme:focus-visible,
.gw-rating-circle:focus-visible,
.gw-page-btn:focus-visible,
.gw-exit-btn:focus-visible,
.gw-resort-btn:focus-visible {
  outline: 2.5px solid #38bdf8;
  outline-offset: 2px;
}

/* Responsive Mobile Layout for Modo Grafema */
@media (max-width: 680px) {
  .grapheme-right-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .grapheme-mini-stats {
    align-self: flex-start;
  }

  .gw-modal-backdrop {
    padding: 10px 10px calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .gw-modal-stage {
    gap: 11px;
  }

  .gw-practice-wrapper {
    padding: 2.85rem 1rem 1rem;
    gap: 11px;
    border-radius: 1.25rem;
  }

  .gw-close-corner-btn {
    top: 0.65rem;
    right: 0.65rem;
  }

  .gw-stats-bar {
    padding: 10px 12px;
    gap: 8px;
  }

  .gw-stat-chip {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .gw-resort-btn {
    width: 100%;
    text-align: center;
  }

  .gw-top-phoneme-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 12px;
  }

  .gw-voice-controls {
    align-self: flex-start;
  }

  .gw-stage-center {
    width: 100%;
    gap: 10px;
  }

  .gw-phoneme-tiles {
    gap: 8px;
  }

  .gw-phoneme-tile {
    min-width: 54px;
    min-height: 74px;
    padding: 8px 10px 9px;
    gap: 6px;
    border-radius: 12px;
  }

  .gw-tile-letters {
    font-size: 1.45rem;
  }

  .gw-tile-play-badge,
  .gw-word-play-badge {
    width: 24px;
    height: 24px;
  }

  .gw-word-play-btn {
    min-width: 54px;
    min-height: 74px;
    padding: 8px 10px 9px;
    gap: 6px;
    border-radius: 12px;
  }

  .gw-quick-next-btn {
    width: 42px;
    height: 42px;
  }

  .gw-voice-rec-btn,
  .gw-voice-play-btn {
    width: 36px;
    height: 36px;
  }

  .gw-ipa-bar {
    padding: 11px 14px;
    gap: 8px 10px;
  }

  .gw-word-text,
  .gw-ipa-text {
    font-size: 1.38rem;
  }

  .gw-dialect-tag,
  .gw-translation-text {
    font-size: 1.08rem;
  }

  .gw-main-card {
    padding: 16px 15px 16px;
    border-radius: 16px;
    gap: 14px;
  }

  .gw-card-header {
    padding-bottom: 12px;
    gap: 10px;
  }

  .gw-category-title {
    font-size: 0.96rem;
  }

  .gw-card-grid {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }

  .gw-illustration-card {
    width: 172px;
    height: 172px;
  }

  .gw-illustration-canvas {
    height: 100%;
  }

  .gw-details-col {
    width: 100%;
  }

  .gw-rating-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .gw-rating-circles {
    gap: 8px;
  }

  .gw-rating-circle {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
  }

  .gw-rating-circle.gw-fsrs-btn {
    width: auto;
    min-width: 72px;
    padding: 0 12px;
  }

  .gw-pagination-row {
    gap: 16px;
  }
}

@media (max-width: 380px) {
  .gw-rating-circles {
    gap: 6px;
  }

  .gw-rating-circle {
    width: 36px;
    height: 36px;
    font-size: 0.84rem;
  }

  .gw-rating-circle.gw-fsrs-btn {
    width: auto;
    min-width: 62px;
    padding: 0 10px;
  }

  .gw-phoneme-tile {
    min-width: 48px;
    padding: 8px 9px;
  }

  .gw-tile-letters {
    font-size: 1.35rem;
  }
}

/* ==========================================================================
   Books Library Selection Hub & Discreet Back Bar
   ========================================================================== */

.books-hub-view {
  max-width: 1140px;
  margin: 32px auto 64px;
  padding: 0 16px;
  font-family: var(--font-reading);
}

.books-hub-header {
  margin-bottom: 24px;
  container: books-hero / inline-size;
}

.books-hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr);
  gap: 20px 22px;
  align-items: center;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(99, 102, 241, 0.06)), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px 26px;
  box-shadow: var(--shadow-card);
  max-inline-size: 100%;
  overflow: clip;
}

.books-hub-hero-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-inline-size: 0;
}

.books-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.books-hub-title {
  margin: 0;
  font-size: clamp(1.38rem, 1.05rem + 1.2vw, 1.75rem);
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.books-hub-title .accent-books {
  color: #059669;
}

.books-badge-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.books-hub-subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-secondary);
  max-inline-size: 660px;
  line-height: 1.5;
}

.books-level-tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  flex-wrap: balance;
  gap: 7px;
  margin-block-start: 4px;
  padding: 0;
  min-inline-size: 0;
}

.books-level-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.books-level-tag.is-bt {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.24);
}

.books-hub-hero-visual {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-inline-size: 0;
}

.books-hero-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.books-hero-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.books-hero-step strong {
  display: block;
  font-size: 0.83rem;
  color: var(--text-primary);
  line-height: 1.25;
}

.books-hero-step small {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.books-hero-step-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(99, 102, 241, 0.14);
  color: #4f46e5;
}

.books-hero-step-num.is-amber {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

.books-hero-step-num.is-green {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

body.dark-mode .books-hub-hero {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(99, 102, 241, 0.1)), #0f172a;
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .books-hub-title .accent-books {
  color: #34d399;
}

body.dark-mode .books-badge-count {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

body.dark-mode .books-level-tag {
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border-color: rgba(148, 163, 184, 0.22);
}

body.dark-mode .books-level-tag.is-bt {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.34);
}

body.dark-mode .books-hub-hero-visual {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(148, 163, 184, 0.18);
}

body.dark-mode .books-hero-step-num {
  color: #a5b4fc;
}

body.dark-mode .books-hero-step-num.is-amber {
  color: #fbbf24;
}

body.dark-mode .books-hero-step-num.is-green {
  color: #6ee7b7;
}

@container books-hero (inline-size <= 760px) {
  .books-hub-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
    gap: 14px;
    border-radius: 16px;
  }

  .books-hub-hero-visual {
    padding: 12px 14px;
    border-radius: 12px;
  }
}

@media (max-width: 820px) {
  .books-hub-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
    gap: 14px;
    border-radius: 16px;
  }
}

@media (max-width: 640px) {
  .books-hub-header {
    margin-bottom: 16px;
  }

  .books-hub-hero {
    padding: 14px;
    gap: 12px;
  }

  .books-hub-subtitle {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .books-badge-count {
    font-size: 0.72rem;
    padding: 3px 10px;
  }

  .books-hero-step {
    align-items: flex-start;
    gap: 9px;
  }

  .books-hero-step-num {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    font-size: 0.72rem;
    margin-block-start: 1px;
  }

  .books-hero-step strong {
    font-size: 0.8rem;
  }

  .books-hero-step small {
    font-size: 0.72rem;
  }
}

.books-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.book-select-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  box-shadow: 0 10px 30px -5px rgba(15, 23, 42, 0.06);
  font-family: var(--font-reading);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal), border-color var(--transition-fast), background-color var(--transition-normal);
}

.book-select-card:hover {
  transform: translateY(-3px);
  border-color: #cbd5e1;
  box-shadow: 0 16px 34px -6px rgba(15, 23, 42, 0.1), 0 6px 14px -3px rgba(15, 23, 42, 0.05);
}

.book-select-card:active {
  transform: translateY(-1px);
}

.book-select-card:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}

body.dark-mode .book-select-card {
  background: #111827;
  border-color: #1e293b;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.6), 0 8px 20px -4px rgba(0, 0, 0, 0.4);
}

body.dark-mode .book-select-card:hover {
  border-color: #334155;
  box-shadow: 0 24px 56px -8px rgba(0, 0, 0, 0.7);
}

.book-cover-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 97px;
  height: 107px;
  padding: 6px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
  flex-shrink: 0;
}

body.dark-mode .book-cover-frame {
  background: #1e293b;
  border-color: #334155;
}

.book-cover-thumb {
  width: 85px;
  height: 95px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.18));
}

.book-card-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.book-level-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: #fff7ed;
  color: #ea580c;
  border: 1px solid #fed7aa;
}

body.dark-mode .book-level-badge {
  background: rgba(249, 115, 22, 0.16);
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.35);
}

.book-card-title {
  margin: 0;
  font-size: 1.13rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

body.dark-mode .book-card-title {
  color: #f8fafc;
}

.book-card-meta {
  margin: 0;
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.55;
}

body.dark-mode .book-card-meta {
  color: #cbd5e1;
}

.book-card-cta {
  margin-top: 2px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.875rem;
  font-weight: 700;
  color: #ea580c;
}

body.dark-mode .book-card-cta {
  color: #fb923c;
}

.books-back-bar {
  max-width: 1140px;
  margin: 20px auto 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
}

.books-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  font-family: var(--font-reading);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.books-back-btn:hover {
  color: #0f172a;
  border-color: #94a3b8;
  background: #f1f5f9;
  transform: translateX(-2px);
}

.books-back-btn:focus-visible {
  outline: 3px solid #f97316;
  outline-offset: 2px;
}

body.dark-mode .books-back-btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

body.dark-mode .books-back-btn:hover {
  color: #f8fafc;
  border-color: #475569;
  background: #334155;
}

@media (max-width: 1023px) {
  .books-hub-view {
    max-width: 820px;
    margin: 24px auto 48px;
  }

  .books-back-bar {
    max-width: 820px;
    margin: 16px auto 0;
  }
}

@media (max-width: 480px) {
  .books-library-grid {
    grid-template-columns: 1fr;
  }

  .book-select-card {
    padding: 14px 15px;
    gap: 14px;
  }
}

/* Accessible ⓘ info button & modal for graphemes with real lexical caps (< 100 words) */
.grapheme-limit-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 6px;
  border-radius: 9999px;
  border: 1px solid rgba(99, 102, 241, 0.35);
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  vertical-align: middle;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.grapheme-limit-info-btn[hidden] {
  display: none;
}

.grapheme-limit-info-btn:hover {
  background: rgba(99, 102, 241, 0.22);
  border-color: rgba(99, 102, 241, 0.6);
  transform: scale(1.06);
}

.grapheme-limit-info-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

body.dark-mode .grapheme-limit-info-btn,
[data-theme="dark"] .grapheme-limit-info-btn,
.dark .grapheme-limit-info-btn {
  background: rgba(99, 102, 241, 0.2);
  border-color: rgba(129, 140, 248, 0.45);
  color: #a5b4fc;
}

.grapheme-limit-info-btn[hidden] {
  display: none;
}

.grapheme-limit-info-btn:hover {
  background: rgba(99, 102, 241, 0.35);
  color: #ffffff;
}

.grapheme-limit-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
}

.grapheme-limit-modal-backdrop.is-open {
  display: flex;
}

.grapheme-limit-modal-card {
  width: 100%;
  max-width: 460px;
  border-radius: 20px;
  padding: 22px 24px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-modal);
}

body.dark-mode .grapheme-limit-modal-card,
[data-theme="dark"] .grapheme-limit-modal-card,
.dark .grapheme-limit-modal-card {
  background: #111827;
  color: #f8fafc;
  border-color: rgba(129, 140, 248, 0.35);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.7);
}

.grapheme-limit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.grapheme-limit-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: #4f46e5;
}

body.dark-mode .grapheme-limit-modal-title,
[data-theme="dark"] .grapheme-limit-modal-title,
.dark .grapheme-limit-modal-title {
  color: #a5b4fc;
}

.grapheme-limit-modal-close {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.grapheme-limit-modal-close:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.grapheme-limit-modal-body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.58;
}


/* ================= Words Bucket (Global FSRS Dashboard) ================= */
.wb-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.wb-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wb-kicker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.wb-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.02em;
}

.wb-subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.wb-due-btn {
  background: linear-gradient(135deg, #e11d48, #f97316);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(225, 29, 72, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wb-due-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.34);
}

.wb-global-bar-card,
.wb-kpi-card,
.wb-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.wb-global-bar-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.wb-global-count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.wb-muted-label,
.wb-muted-note {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

.wb-global-track {
  height: 10px;
}

.wb-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.wb-kpi-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wb-kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.wb-kpi-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.wb-kpi-sub {
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.wb-insights-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.5fr);
  gap: 16px;
}

.wb-panel-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.wb-cefr-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wb-cefr-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 10px;
}

.wb-cefr-badge,
.wb-cefr-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.wb-cefr-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-pill-inactive);
  overflow: hidden;
}

.wb-cefr-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #10b981);
}

.wb-cefr-count {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.wb-decks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 10px;
}

.wb-deck-card {
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-pill-inactive);
}

.wb-deck-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.wb-deck-grapheme {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
}

.wb-deck-phoneme {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.wb-deck-progress {
  margin-left: auto;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.wb-deck-pills {
  display: flex;
  gap: 6px;
}

.wb-mini-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
}

.wb-mini-dot.is-mastered {
  background: #10b981;
}

.wb-mini-dot.is-strong {
  background: #2563eb;
}

.wb-mini-dot.is-medium {
  background: #f97316;
}

.wb-mini-dot.is-weak {
  background: #e11d48;
}

.wb-deck-open-btn,
.wb-practice-btn,
.wb-show-more-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.wb-deck-open-btn:hover,
.wb-practice-btn:hover,
.wb-show-more-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.wb-bucket-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.wb-controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wb-search-input,
.wb-select {
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.88rem;
  background: var(--bg-card);
  color: var(--text-primary);
}

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

.wb-search-input {
  min-width: 230px;
}

.wb-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.wb-filter-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.wb-filter-pill.is-active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.wb-filter-pill.is-mastered.is-active {
  background: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

.wb-filter-pill.is-strong.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.wb-filter-pill.is-medium.is-active {
  background: #f97316;
  border-color: #f97316;
  color: #ffffff;
}

.wb-filter-pill.is-weak.is-active {
  background: #e11d48;
  border-color: #e11d48;
  color: #ffffff;
}

.wb-entries-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wb-word-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.wb-word-row:hover {
  border-color: rgba(37, 99, 235, 0.45);
}

.wb-word-main {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wb-speak-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-primary);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.wb-word-text-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wb-word-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.wb-word-title {
  font-size: 1rem;
  color: var(--text-primary);
}

.wb-word-ipa {
  font-size: 0.88rem;
  color: var(--text-hint);
  font-weight: 600;
}

.wb-word-es {
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.wb-word-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.wb-deck-tag,
.wb-due-tag {
  font-size: 0.78rem;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
}

.wb-due-tag.is-due {
  background: rgba(225, 29, 72, 0.14);
  color: #e11d48;
  font-weight: 700;
}

.wb-tier-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  color: #ffffff;
}

.wb-tier-badge.is-mastered {
  background: #10b981;
}

.wb-tier-badge.is-strong {
  background: #2563eb;
}

.wb-tier-badge.is-medium {
  background: #f97316;
}

.wb-tier-badge.is-weak {
  background: #e11d48;
}

.wb-more-wrap {
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.wb-empty-state {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-secondary);
}

.wb-shell button:focus-visible,
.wb-shell input:focus-visible,
.wb-shell select:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* Dark Mode Refinements for Words Bucket */
body.dark-mode .wb-global-bar-card,
body.dark-mode .wb-kpi-card,
body.dark-mode .wb-panel {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

body.dark-mode .wb-deck-card {
  background: #172033;
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .wb-word-row {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.15);
}

body.dark-mode .wb-word-row:hover {
  border-color: rgba(96, 165, 250, 0.5);
  background: #131c31;
}

body.dark-mode .wb-cefr-badge,
body.dark-mode .wb-cefr-mini {
  background: rgba(96, 165, 250, 0.16);
  color: #93c5fd;
}

body.dark-mode .wb-search-input,
body.dark-mode .wb-select {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
}

body.dark-mode .wb-filter-pill {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

body.dark-mode .wb-filter-pill.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

body.dark-mode .wb-deck-open-btn,
body.dark-mode .wb-practice-btn,
body.dark-mode .wb-show-more-btn,
body.dark-mode .wb-speak-btn {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
}

body.dark-mode .wb-deck-open-btn:hover,
body.dark-mode .wb-practice-btn:hover,
body.dark-mode .wb-show-more-btn:hover,
body.dark-mode .wb-speak-btn:hover {
  border-color: #60a5fa;
  color: #93c5fd;
}

body.dark-mode .wb-due-tag.is-due {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
}

@media (max-width: 820px) {
  .wb-insights-grid {
    grid-template-columns: 1fr;
  }
}

@keyframes gwImgFadeIn {
  from {
    opacity: 0.25;
  }

  to {
    opacity: 1;
  }
}

.gw-illustration-img {
  animation: gwImgFadeIn 0.14s ease-out;
}


/* ================= BT (Bidirectional Translation Studio) ================= */
.bt-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 56px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.bt-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.bt-kicker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 4px;
}

.bt-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bt-level-pill {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.bt-subtitle {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 0.94rem;
}

.bt-phase-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.bt-phase-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.bt-phase-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.bt-wizard-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  opacity: 0.85;
  flex-shrink: 0;
  user-select: none;
}

.bt-phase-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.bt-audio-card,
.bt-block-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 18px 22px;
  box-shadow: var(--shadow-card);
}

.bt-audio-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bt-audio-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.bt-audio-primary-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.bt-audio-sec-btn,
.bt-speed-btn,
.bt-nav-btn,
.bt-tool-btn,
.bt-peek-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-primary);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
}

.bt-audio-sec-btn.is-active,
.bt-speed-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.bt-speed-group {
  display: inline-flex;
  gap: 4px;
}

.bt-time-label {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.bt-scrubber {
  width: 100%;
  accent-color: #2563eb;
  cursor: pointer;
}

/* Block 1: Source Texts (ES - EN) */
.bt-source-block {
  border-top: 1px solid var(--border-subtle);
}

.bt-block-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.bt-block-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.bt-block-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.bt-section-name {
  font-size: 1rem;
  color: var(--text-primary);
}

.bt-block-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

.bt-block-dots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.bt-block-dot {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.bt-block-dot.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.bt-source-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bt-lang-pane {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
}

.bt-lang-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 6px;
}

.bt-text-para {
  margin: 0;
  font-size: 1.03rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.bt-hidden-en-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px dashed var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.bt-diff-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.bt-diff-score {
  font-size: 0.88rem;
  color: var(--text-primary);
}

.bt-diff-tok {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 5px;
  margin-bottom: 2px;
}

.bt-diff-tok.is-hit {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
}

.bt-diff-tok.is-miss {
  background: rgba(225, 29, 72, 0.14);
  color: #be123c;
  text-decoration: underline wavy rgba(225, 29, 72, 0.45);
}

.bt-diff-legend {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.bt-dot-hit,
.bt-dot-miss {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.bt-dot-hit {
  background: #10b981;
}

.bt-dot-miss {
  background: #e11d48;
}

/* Block 2: Text Processor */
.bt-editor-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.bt-editor-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.bt-editor-kicker {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ea580c;
  margin-bottom: 2px;
}

.bt-editor-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.bt-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bt-tool-btn.is-danger {
  color: #e11d48;
}

.bt-editor-surface {
  min-height: 190px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 1.03rem;
  line-height: 1.7;
  outline: none;
}

.bt-editor-surface:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
}

.bt-editor-surface:empty::before,
.bt-editor-surface.is-empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  display: block;
}

body.dark-mode .bt-editor-surface.is-empty::before,
body.dark-mode .bt-editor-surface:empty::before {
  color: #94a3b8;
}

.bt-editor-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bt-editor-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.bt-autosave-pill {
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: #059669;
  font-weight: 700;
  font-size: 0.78rem;
}

.bt-compare-btn {
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  color: #ffffff;
  border: 2px solid rgba(96, 165, 250, 0.65);
  border-radius: 12px;
  padding: 10px 22px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.bt-compare-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.07);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.34);
}

/* Dark Mode Refinements for BT */
body.dark-mode .bt-audio-card,
body.dark-mode .bt-block-card {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-source-block,
body.dark-mode .bt-editor-block {
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-level-pill,
body.dark-mode .bt-block-badge {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

body.dark-mode .bt-lang-pane {
  background: #172033;
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-editor-surface {
  background: #0b0f19;
  border-color: rgba(148, 163, 184, 0.22);
  color: #f8fafc;
}

body.dark-mode .bt-diff-tok.is-hit {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

body.dark-mode .bt-diff-tok.is-miss {
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
}

body.dark-mode .bt-autosave-pill {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

body.dark-mode .bt-editor-kicker {
  color: #fb923c;
}

/* BT Stage Gate, Countdown & Word-Sync Karaoke Highlighting */
.bt-gate-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.bt-gate-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.bt-gate-badge {
  font-size: 0.74rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  text-transform: uppercase;
}

.bt-gate-badge.is-waiting {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
}

.bt-gate-badge.is-ready {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

.bt-countdown-val {
  font-family: var(--font-mono);
  color: var(--text-primary);
  font-size: 0.96rem;
}

.bt-understood-btn {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.bt-unlock-now-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-primary);
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.bt-phase-btn.is-locked {
  opacity: 0.58;
}

.bt-sync-word {
  cursor: pointer;
  border-radius: 4px;
  padding: 0 2px;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.bt-sync-word:hover {
  background: rgba(37, 99, 235, 0.12);
}

.bt-sync-word.is-spoken {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

.bt-sync-word.is-speaking {
  color: #ffffff;
  background: #f97316;
  font-weight: 700;
}

.bt-editor-surface ul,
.bt-editor-surface ol {
  padding-left: 22px;
  margin: 6px 0;
}

body.dark-mode .bt-gate-bar {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-gate-badge {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

body.dark-mode .bt-gate-badge.is-waiting {
  background: rgba(251, 146, 60, 0.2);
  color: #fdba74;
}

body.dark-mode .bt-gate-badge.is-ready {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

body.dark-mode .bt-sync-word.is-spoken {
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.16);
}

body.dark-mode .bt-sync-word.is-speaking {
  color: #ffffff;
  background: #ea580c;
}

/* Embedded audio inside Block 1 single container */
.bt-audio-embedded {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

/* BT Hub Cards & Back Button (Light & Dark Mode) */
.bt-back-row {
  display: flex;
  align-items: center;
}

.bt-back-hub-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.bt-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

.bt-lesson-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bt-lesson-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.bt-lesson-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bt-hub-duration,
.bt-hub-count {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
}

.bt-hub-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.bt-hub-status.is-waiting {
  background: rgba(249, 115, 22, 0.15);
  color: #ea580c;
}

.bt-hub-status.is-ready {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.bt-lesson-card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.bt-lesson-card-sub {
  margin: -6px 0 2px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.bt-hub-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 7px;
}

.bt-hub-sec-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-primary);
  font-size: 0.8rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.bt-hub-sec-pill:hover {
  border-color: #2563eb;
  transform: translateY(-1px);
}

.bt-hub-sec-num {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
  font-weight: 800;
  font-size: 0.74rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bt-hub-sec-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.bt-lesson-card-footer {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.bt-open-card-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

body.dark-mode .bt-lesson-card,
body.dark-mode .bt-back-hub-btn {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-hub-sec-pill {
  background: #172033;
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-hub-sec-num {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

.bt-hub-sec-pill.is-waiting .bt-hub-sec-num {
  background: rgba(249, 115, 22, 0.16);
  color: #ea580c;
}

.bt-hub-sec-pill.is-ready .bt-hub-sec-num {
  background: rgba(16, 185, 129, 0.18);
  color: #059669;
}

body.dark-mode .bt-hub-sec-pill.is-waiting .bt-hub-sec-num {
  background: rgba(251, 146, 60, 0.22);
  color: #fdba74;
}

body.dark-mode .bt-hub-sec-pill.is-ready .bt-hub-sec-num {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

/* Live Word Gloss Pill in Block Topbar */
.bt-active-gloss {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.12);
  border: 1px solid rgba(249, 115, 22, 0.25);
  font-size: 0.9rem;
  min-height: 32px;
}

.bt-active-gloss:empty {
  display: none;
}

.bt-gloss-en {
  font-weight: 700;
  color: var(--text-primary);
}

.bt-gloss-arrow {
  color: #f97316;
  font-weight: 800;
}

.bt-gloss-es {
  color: #ea580c;
  font-weight: 800;
}

body.dark-mode .bt-active-gloss {
  background: rgba(251, 146, 60, 0.16);
  border-color: rgba(251, 146, 60, 0.32);
}

body.dark-mode .bt-gloss-es {
  color: #fdba74;
}

.bt-lang-pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.bt-autosave-pill {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.bt-autosave-pill.is-visible {
  opacity: 1;
  visibility: visible;
}

.bt-diff-user-wrap {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-subtle);
}

.bt-diff-tok.is-extra {
  background: rgba(249, 115, 22, 0.16);
  color: #c2410c;
  text-decoration: underline wavy rgba(249, 115, 22, 0.5);
}

.bt-dot-extra {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  background: #f97316;
}

.bt-diff-empty {
  color: var(--text-muted);
  font-style: italic;
}

body.dark-mode .bt-diff-tok.is-extra {
  background: rgba(249, 115, 22, 0.22);
  color: #fdba74;
}

/* Coach Feedback Card & Hub 3-Step Mini Dots */
.bt-feedback-card {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.bt-feedback-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bt-feedback-badge {
  align-self: flex-start;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: #2563eb;
}

.bt-feedback-msg {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
}

.bt-feedback-list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.86rem;
  color: var(--text-secondary);
}

.bt-fb-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(225, 29, 72, 0.12);
  color: #be123c;
  font-weight: 600;
  font-size: 0.8rem;
}

.bt-mini-steps {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.bt-mini-step {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-subtle);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

.bt-mini-step.is-done {
  background: #10b981;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.2);
}

body.dark-mode .bt-feedback-card {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-feedback-badge {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
}

body.dark-mode .bt-fb-chip {
  background: rgba(244, 63, 94, 0.2);
  color: #fda4af;
}

body.dark-mode .bt-mini-step {
  background: rgba(148, 163, 184, 0.28);
}

body.dark-mode .bt-mini-step.is-done {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.45);
}

.bt-phase-btn.is-compared:not(.is-active) {
  border-color: rgba(16, 185, 129, 0.45);
  color: #047857;
  background: rgba(16, 185, 129, 0.08);
}

.bt-restart-btn {
  margin-left: auto;
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.bt-restart-btn:hover {
  border-color: rgba(244, 63, 94, 0.45);
  color: #be123c;
  background: rgba(244, 63, 94, 0.08);
}

.bt-restart-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

body.dark-mode .bt-phase-btn.is-compared:not(.is-active) {
  border-color: rgba(16, 185, 129, 0.45);
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.14);
}

body.dark-mode .bt-restart-btn {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(148, 163, 184, 0.22);
  color: #cbd5e1;
}

body.dark-mode .bt-restart-btn:hover {
  border-color: rgba(251, 113, 133, 0.5);
  color: #fda4af;
  background: rgba(244, 63, 94, 0.16);
}

.bt-confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: btFadeIn 0.16s ease-out;
}

@keyframes btFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.bt-confirm-modal {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 26px 24px 22px;
  text-align: center;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.25);
  animation: btPopIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes btPopIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(6px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.bt-confirm-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.bt-confirm-title {
  margin: 0 0 8px;
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--text-primary);
}

.bt-confirm-msg {
  margin: 0 0 22px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.bt-confirm-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.bt-confirm-cancel-btn,
.bt-confirm-ok-btn {
  flex: 1;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bt-confirm-cancel-btn {
  background: var(--bg-pill-inactive);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.bt-confirm-cancel-btn:hover {
  filter: brightness(0.96);
}

.bt-confirm-ok-btn {
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #ffffff;
  border: 1px solid rgba(190, 18, 60, 0.7);
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.25);
}

.bt-confirm-ok-btn:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

.bt-confirm-cancel-btn:focus-visible,
.bt-confirm-ok-btn:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

body.dark-mode .bt-confirm-backdrop {
  background: rgba(2, 6, 23, 0.72);
}

body.dark-mode .bt-confirm-modal {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

body.dark-mode .bt-confirm-icon {
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

body.dark-mode .bt-confirm-cancel-btn {
  background: rgba(30, 41, 59, 0.85);
  border-color: rgba(148, 163, 184, 0.24);
  color: #e2e8f0;
}

body.dark-mode .bt-confirm-cancel-btn:hover {
  background: rgba(51, 65, 85, 0.9);
}

/* ==========================================================================
   User Profile Popover & Local Profile Modal (YouTube-inspired)
   ========================================================================== */
.user-avatar {
  overflow: hidden;
  padding: 0;
}

.user-avatar-img,
.user-popover-img,
.user-switch-img,
.profile-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.user-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;
  max-width: calc(100vw - 24px);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  z-index: 1200;
  padding: 10px 0;
  text-align: left;
}

.user-popover-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 16px 12px;
}

.user-popover-ava {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

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

.user-popover-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-popover-handle {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.user-popover-link {
  background: none;
  border: none;
  padding: 0;
  color: #2563eb;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.user-popover-link:hover {
  text-decoration: underline;
}

.user-popover-sep {
  height: 1px;
  background: var(--border-subtle);
  margin: 6px 0;
}

.user-popover-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  padding: 10px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: background-color 0.14s ease;
}

.user-popover-item:hover {
  background: var(--bg-pill-inactive);
}

.user-pop-ico {
  width: 20px;
  text-align: center;
}

.user-pop-chevron {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 1rem;
}

.user-switch-list {
  padding: 6px 12px 8px;
  background: var(--bg-main);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.user-switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
}

.user-switch-row:hover {
  background: var(--bg-pill-inactive);
}

.user-switch-row.is-active {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
}

.user-switch-ava {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.user-switch-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.user-switch-meta strong {
  font-size: 0.83rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-switch-meta small {
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.user-switch-check {
  color: #10b981;
  font-weight: 800;
}

.user-switch-create {
  margin-top: 4px;
  border: 1px dashed var(--border-subtle);
  background: transparent;
  color: #2563eb;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.profile-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.profile-modal {
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.25);
}

.profile-modal-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.profile-hero-ava,
.profile-photo-preview {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-size: 1.4rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.profile-hero-name {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.profile-hero-sub {
  margin: 0;
  font-size: 0.83rem;
  color: var(--text-secondary);
}

.profile-hero-meta {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.profile-close-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.profile-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.profile-tab-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.profile-tab-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.profile-pane.is-hidden {
  display: none;
}

.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.profile-stat-card {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-stat-kicker {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.profile-stat-val {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-primary);
}

.profile-stat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.profile-wb-card {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px;
}

.profile-wb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-wb-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.profile-wb-head p {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.profile-wb-jump-btn {
  border: 1px solid rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.1);
  color: #2563eb;
  border-radius: 9px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.profile-tier-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.profile-tier-chip {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.profile-tier-chip.is-mastered {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
  border-color: rgba(16, 185, 129, 0.35);
}

.profile-tier-chip.is-strong {
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.35);
}

.profile-tier-chip.is-medium {
  background: rgba(249, 115, 22, 0.14);
  color: #c2410c;
  border-color: rgba(249, 115, 22, 0.35);
}

.profile-tier-chip.is-weak {
  background: rgba(225, 29, 72, 0.14);
  color: #be123c;
  border-color: rgba(225, 29, 72, 0.35);
}

.profile-wb-words {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.profile-wb-pill {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.profile-wb-pill small {
  color: var(--text-muted);
  font-weight: 600;
}

.profile-wb-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.profile-photo-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.profile-photo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #2563eb;
  color: #ffffff;
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.profile-remove-photo-btn,
.profile-cancel-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-primary);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.profile-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.profile-field input {
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
  color: var(--text-primary);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-family: inherit;
}

.profile-field input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.profile-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.profile-save-btn {
  border: none;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}

body.dark-mode .user-popover {
  background: #18181b;
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

body.dark-mode .user-popover-link,
body.dark-mode .user-switch-create {
  color: #60a5fa;
}

body.dark-mode .profile-modal {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .profile-wb-jump-btn {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.16);
}

body.dark-mode .profile-tier-chip.is-mastered {
  color: #6ee7b7;
}

body.dark-mode .profile-tier-chip.is-strong {
  color: #93c5fd;
}

body.dark-mode .profile-tier-chip.is-medium {
  color: #fdba74;
}

body.dark-mode .profile-tier-chip.is-weak {
  color: #fda4af;
}

body.dark-mode .profile-field input {
  background: #020617;
  border-color: rgba(148, 163, 184, 0.25);
  color: #f8fafc;
}

/* ==========================================================================
   Interactive Structured Course inside StoryReader (A1, A2 & B1)
   ========================================================================== */
.story-course-tabs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 10px 2px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: inline proximity;
  scroll-padding-inline: 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.story-course-tabs[hidden] {
  display: none;
}

.story-course-tabs::-webkit-scrollbar {
  display: none;
}

.story-course-tab-btn {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  white-space: nowrap;
  min-block-size: 34px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-pill-inactive);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.story-course-tab-btn:hover:not([aria-selected="true"]) {
  border-color: #2563eb;
  color: var(--text-primary);
}

.story-course-tab-btn:focus-visible,
.course-toggle-all-btn:focus-visible,
.course-nav-btn:focus-visible,
.course-speak-btn:focus-visible,
.course-speak-all-btn:focus-visible,
.course-mastered-btn:focus-visible,
.course-answer-details summary:focus-visible,
.course-table-wrap:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.story-course-tab-btn[aria-selected="true"],
.story-course-tab-btn.is-active {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

/* Mandatory non-color active tab indicator (survives Forced Colors Mode) */
.story-course-tab-btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 10px 3px;
  border-block-end: 2.5px solid currentColor;
  border-radius: 2px;
}

.story-page-content.is-course-mode {
  overflow: visible;
  max-height: none;
}

.course-lesson-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 18px;
  color: var(--text-primary);
}

.course-lesson-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.course-lesson-badges {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.course-badge {
  align-self: flex-start;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.14);
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.course-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background-color: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 800;
}

.course-progress-pill.has-progress {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.38);
  color: #047857;
}

.course-lesson-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}

.course-section {
  padding: 14px 16px;
  border-radius: 14px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.course-objective-box {
  border-left: 4px solid #2563eb;
}

.course-pronunciation-box {
  border-left: 4px solid #7c3aed;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.06), transparent 65%), var(--bg-card);
}

.course-traps-box {
  border-left: 4px solid #f59e0b;
}

.course-practice-box {
  border-left: 4px solid #10b981;
}

.course-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.course-sec-head .course-sec-title {
  margin: 0;
}

.course-sec-title {
  margin: 0 0 8px;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--text-primary);
}

.course-para {
  margin: 0 0 8px;
  font-size: 0.9rem;
  line-height: 1.58;
  color: var(--text-secondary);
}

.course-para code,
.course-traps-list code {
  padding: 1px 6px;
  border-radius: 6px;
  background-color: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.84em;
  font-weight: 700;
}

.course-para:last-child {
  margin-bottom: 0;
}

.course-table-wrap {
  margin-top: 12px;
  overflow-x: auto;
  max-inline-size: 100%;
  container-type: inline-size;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
}

.course-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.course-table thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
}

.course-table th,
.course-table td {
  text-align: left;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: top;
}

.course-table tbody tr:last-child td {
  border-bottom: none;
}

.course-table th {
  font-weight: 800;
  color: var(--text-primary);
  background-color: var(--bg-pill-inactive);
}

@container (width < 520px) {
  .course-table,
  .course-table thead,
  .course-table tbody,
  .course-table tr,
  .course-table th,
  .course-table td {
    display: block;
  }

  .course-table thead {
    display: none;
  }

  .course-table tbody tr {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .course-table tbody tr:last-child {
    border-bottom: none;
  }

  .course-table td {
    padding: 4px 2px;
    border-bottom: none;
  }

  .course-table td:first-child {
    padding-bottom: 5px;
    color: var(--text-primary);
  }

  .course-table td:nth-child(2)::before {
    content: var(--label-2, "Inglés") ": ";
    font-weight: 700;
    color: var(--text-secondary);
  }

  .course-table td:nth-child(3)::before {
    content: var(--label-3, "Regla") ": ";
    font-weight: 700;
    color: var(--text-secondary);
  }
}

.course-inline-word {
  cursor: pointer;
  border-bottom: 1px dashed rgba(59, 130, 246, 0.55);
}

.course-inline-word:hover {
  color: #2563eb;
}

.course-examples-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-example-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background-color: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
}

.course-speak-btn {
  min-inline-size: 36px;
  min-block-size: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.course-speak-btn:hover {
  border-color: #2563eb;
}

.course-speak-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-block-size: 32px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-pill-inactive);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.course-speak-all-btn:hover {
  border-color: #2563eb;
}

.course-speak-all-btn[aria-pressed="true"] {
  background: rgba(37, 99, 235, 0.14);
  border-color: #2563eb;
  color: #1d4ed8;
}

.course-example-en {
  margin: 0 0 3px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.course-example-es {
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.course-traps-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.88rem;
  line-height: 1.54;
  color: var(--text-secondary);
}

.course-practice-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.course-practice-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.course-practice-head .course-sec-title {
  margin: 0;
}

.course-toggle-all-btn,
.course-nav-btn {
  min-block-size: 34px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-pill-inactive);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.course-nav-btn.is-primary {
  background-color: #1d4ed8;
  border-color: #1d4ed8;
  color: #ffffff;
}

.course-exercises-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.course-exercise-card {
  padding: 11px 13px;
  border-radius: 10px;
  background-color: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease;
}

.course-exercise-card.is-mastered {
  border-color: rgba(16, 185, 129, 0.5);
}

.course-exercise-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.course-exercise-q {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-primary);
}

.course-mastered-btn {
  flex-shrink: 0;
  min-block-size: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.course-mastered-btn:hover {
  border-color: #10b981;
  color: var(--text-primary);
}

.course-mastered-btn[aria-pressed="true"] {
  background: rgba(16, 185, 129, 0.16);
  border-color: #10b981;
  color: #047857;
}

.course-answer-details summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
  min-block-size: 26px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1d4ed8;
  cursor: pointer;
  user-select: none;
}

.course-answer-details summary::-webkit-details-marker {
  display: none;
}

.course-answer-details summary::before {
  content: "";
  inline-size: 0.85em;
  block-size: 0.85em;
  flex-shrink: 0;
  background-color: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat center / contain;
  rotate: -90deg;
}

.course-answer-details[open] > summary::before {
  rotate: 0deg;
}

.course-answer-details::details-content {
  interpolate-size: allow-keywords;
  overflow: clip;
  contain: layout;
}

.course-answer-details:not([open])::details-content {
  block-size: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .course-answer-details summary::before {
    transition: rotate 0.18s ease;
  }

  .course-answer-details::details-content {
    transition: block-size 0.22s ease-in-out, content-visibility 0.22s ease-in-out allow-discrete;
  }
}

.course-exercise-a {
  margin: 6px 0 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.course-unit-jump-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.course-unit-jump-chip {
  min-block-size: 30px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-pill-inactive);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.course-unit-jump-chip:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.course-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

.reading-unit-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #047857;
  font-size: 0.74rem;
  font-weight: 800;
}

.meta-tag.meta-course-status {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-weight: 700;
}

.meta-tag.meta-course-status.is-evaluated {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

body.dark-mode .story-course-tab-btn:focus-visible,
body.dark-mode .course-toggle-all-btn:focus-visible,
body.dark-mode .course-nav-btn:focus-visible,
body.dark-mode .course-speak-btn:focus-visible,
body.dark-mode .course-speak-all-btn:focus-visible,
body.dark-mode .course-mastered-btn:focus-visible,
body.dark-mode .course-answer-details summary:focus-visible,
body.dark-mode .course-table-wrap:focus-visible {
  outline-color: #60a5fa;
}

body.dark-mode .course-badge,
body.dark-mode .course-answer-details summary,
body.dark-mode .course-speak-all-btn[aria-pressed="true"],
body.dark-mode .meta-tag.meta-course-status,
body.dark-mode .course-unit-jump-chip:hover {
  color: #93c5fd;
}

body.dark-mode .course-inline-word:hover {
  color: #60a5fa;
}

body.dark-mode .course-progress-pill.has-progress,
body.dark-mode .course-mastered-btn[aria-pressed="true"],
body.dark-mode .reading-unit-progress-pill,
body.dark-mode .meta-tag.meta-course-status.is-evaluated {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(52, 211, 153, 0.42);
  color: #6ee7b7;
}

body.dark-mode .course-pronunciation-box {
  border-left-color: #a78bfa;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.12), transparent 65%), rgba(15, 23, 42, 0.78);
}

body.dark-mode .course-section {
  background-color: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .course-example-item,
body.dark-mode .course-exercise-card {
  background-color: rgba(2, 6, 23, 0.5);
  border-color: rgba(148, 163, 184, 0.18);
}

body.dark-mode .course-exercise-card.is-mastered {
  border-color: rgba(52, 211, 153, 0.55);
}

/* ==========================================================================
   BT Hub Hero Banner (Light & Dark Mode)
   ========================================================================== */
.bt-hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr);
  gap: 22px;
  align-items: center;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(16, 185, 129, 0.05)), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px 26px;
  margin-bottom: 22px;
  box-shadow: var(--shadow-card);
}

.bt-hub-search-row {
  margin-top: 14px;
}

.bt-hub-search-input {
  width: 100%;
  max-width: 460px;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.bt-hub-search-input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

body.dark-mode .bt-hub-search-input {
  background-color: rgba(15, 23, 42, 0.65);
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-primary);
}

.bt-hub-empty {
  padding: 28px;
  text-align: center;
  border-radius: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 18px;
}

.bt-hub-filter-bar {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.bt-hub-filter-bar::-webkit-scrollbar {
  display: none;
}

.bt-hub-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.bt-hub-filter-btn span {
  opacity: 0.8;
  font-size: 0.74rem;
}

.bt-hub-filter-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.bt-hub-progress-chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: var(--bg-pill-inactive);
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  border-radius: 999px;
}

.bt-hub-hero-visual {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bt-hero-wave-badge {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #2563eb;
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 999px;
  padding: 4px 10px;
}

.bt-hero-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.bt-hero-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bt-hero-step strong {
  display: block;
  font-size: 0.83rem;
  color: var(--text-primary);
}

.bt-hero-step small {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.bt-hero-step-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(37, 99, 235, 0.14);
  color: #2563eb;
}

.bt-hero-step-num.is-amber {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

.bt-hero-step-num.is-green {
  background: rgba(16, 185, 129, 0.16);
  color: #059669;
}

@media (max-width: 820px) {
  .bt-hub-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .bt-hub-progress-chip {
    margin-left: 0;
  }
}

body.dark-mode .bt-hub-hero {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(16, 185, 129, 0.08)), #0f172a;
  border-color: rgba(148, 163, 184, 0.18);
}

body.dark-mode .bt-hub-hero-visual {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .bt-hero-wave-badge {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.16);
}

body.dark-mode .bt-hub-progress-chip {
  color: var(--text-secondary);
  background: var(--bg-pill-inactive);
  border-color: var(--border-subtle);
}

body.dark-mode .bt-hero-step-num {
  color: #93c5fd;
}

body.dark-mode .bt-hero-step-num.is-amber {
  color: #fbbf24;
}

body.dark-mode .bt-hero-step-num.is-green {
  color: #6ee7b7;
}

.book-cover-bt1 {
  width: 85px;
  height: 95px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 8px 18px rgba(29, 78, 216, 0.25);
}

.book-cover-bt-badge {
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
}

/* BT Books 1 Reader: match BT word-sync coloring */
#storyReaderView.is-bt-book-mode .story-sentence.is-active {
  background: rgba(37, 99, 235, 0.04);
  border-color: transparent;
  box-shadow: none;
}

#storyReaderView.is-bt-book-mode .story-word.is-spoken {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
}

#storyReaderView.is-bt-book-mode .story-word.is-speaking {
  color: #ffffff;
  background: #f97316;
  font-weight: 700;
}

body.dark-mode #storyReaderView.is-bt-book-mode .story-sentence.is-active {
  background: rgba(59, 130, 246, 0.06);
  border-color: transparent;
}

body.dark-mode #storyReaderView.is-bt-book-mode .story-word.is-spoken {
  color: #93c5fd;
  background: rgba(96, 165, 250, 0.16);
}

body.dark-mode #storyReaderView.is-bt-book-mode .story-word.is-speaking {
  color: #ffffff;
  background: #ea580c;
}

/* Compact FSRS pills inside Books inspector sidebar */
#inspectorRatingBar.inspector-fsrs-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-item {
  flex: 1 1 0;
  min-width: 0;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-item-aux {
  flex: 0 0 auto;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-btn {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 6px;
  font-size: 0.76rem;
  border-radius: 10px;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-aux-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-again,
#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-again.active {
  background: linear-gradient(135deg, #e11d48 0%, #f97316 100%);
  border-color: rgba(251, 113, 133, 0.65);
  color: #ffffff;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-hard,
#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-hard.active {
  background: linear-gradient(135deg, #f97316 0%, #eab308 100%);
  border-color: rgba(251, 191, 36, 0.65);
  color: #ffffff;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-good,
#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-good.active {
  background: linear-gradient(135deg, #10b981 0%, #0d9488 100%);
  border-color: rgba(52, 211, 153, 0.65);
  color: #ffffff;
}

#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-easy,
#inspectorRatingBar.inspector-fsrs-bar .gw-fsrs-easy.active {
  background: linear-gradient(135deg, #0891b2 0%, #2563eb 100%);
  border-color: rgba(96, 165, 250, 0.65);
  color: #ffffff;
}

#inspectorRatingBar.inspector-fsrs-bar .inspector-level-circle.active {
  outline: 2px solid #0f172a;
  outline-offset: 2px;
}

body.dark-mode #inspectorRatingBar.inspector-fsrs-bar .inspector-level-circle.active {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.inspector-word-trans {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #047857;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  max-width: 100%;
}

body.dark-mode .inspector-word-trans {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(52, 211, 153, 0.35);
}

.books-tag-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.28);
}

.books-tag-input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 18px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: 0.92rem;
  font-family: inherit;
}

.books-tag-input:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}

.books-tag-save-btn {
  flex: 1;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  cursor: pointer;
}

body.dark-mode .books-tag-input {
  background: #020617;
  border-color: rgba(148, 163, 184, 0.25);
  color: #f8fafc;
}

.inspector-add-note-btn {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.32);
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.inspector-add-note-btn:hover {
  background: rgba(16, 185, 129, 0.22);
  transform: scale(1.06);
}

.inspector-notes-counter {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.inspector-notes-meta {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.inspector-saved-notes {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
}

.inspector-note-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--text-primary);
  word-break: break-word;
}

.inspector-note-text {
  flex: 1;
}

.inspector-note-del {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.78rem;
  padding: 2px 4px;
  border-radius: 6px;
}

.inspector-note-del:hover {
  color: #e11d48;
  background: rgba(225, 29, 72, 0.12);
}

body.dark-mode .inspector-note-card {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

/* ==========================================================================
   Modern Dark Mode Surface Elevation & Depth Polish
   ========================================================================== */
body.dark-mode .app-header {
  background-color: rgba(11, 16, 29, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: rgba(148, 163, 184, 0.16);
}

body.dark-mode .letter-card,
body.dark-mode .modal-content,
body.dark-mode .ipa-modal-dialog,
body.dark-mode .grapheme-card,
body.dark-mode .book-select-card {
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: var(--shadow-card);
}

body.dark-mode .letter-card:hover,
body.dark-mode .book-select-card:hover {
  background-color: var(--bg-card-hover);
  border-color: rgba(242, 104, 104, 0.42);
}

body.dark-mode .listening-bar,
body.dark-mode .vowel-filter-bar {
  background-color: #111827;
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .audio-mode-selector,
body.dark-mode .vowel-filter-pills {
  background-color: #0b1120;
}

body.dark-mode input:focus-visible,
body.dark-mode textarea:focus-visible,
body.dark-mode select:focus-visible {
  box-shadow: 0 0 0 3px rgba(242, 104, 104, 0.24);
}

/* ==========================================================================
   Accessibility: Selective Reduced Motion (WCAG 2.1 / Modern Web Guidance)
   Dampens spatial transforms & continuous animations while keeping color
   feedback and final visibility states intact.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .letter-card:hover,
  .ipa-card:hover,
  .ipa-filter-pill:hover,
  .book-select-card:hover,
  .grapheme-card:hover {
    transform: none;
  }

  .letter-card,
  .ipa-card,
  .modal-content,
  .ipa-modal-dialog,
  .ipa-filter-pill,
  .book-select-card {
    transition-property: color, background-color, border-color, opacity;
  }
}

/* ==========================================================================
   Accessibility: Forced Colors Mode (Windows High Contrast)
   ========================================================================== */
@media (forced-colors: active) {
  .letter-card,
  .ipa-card,
  .ipa-hub-hero,
  .bt-hub-hero,
  .books-hub-hero,
  .modal-content,
  .ipa-modal-dialog,
  .ipa-filter-pill,
  .book-select-card {
    border: 1px solid CanvasText;
  }

  .ipa-filter-pill.active,
  .nav-tab-btn.active,
  .audio-mode-btn.active {
    border: 2px solid Highlight;
    forced-color-adjust: auto;
  }

  *:focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 2px;
  }
}

/* ==========================================================================
   Backup Export / Import Native Modal Dialog (<dialog class="backup-dialog">)
   ========================================================================== */
dialog.backup-dialog {
  margin: auto;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-modal);
  inline-size: min(92dvw, 540px);
  max-block-size: 90dvh;
}

dialog.backup-dialog[open] {
  display: block;
}

dialog.backup-dialog:modal {
  overscroll-behavior: contain;
}

dialog.backup-dialog::backdrop {
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.backup-dialog-surface {
  padding: 22px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.backup-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.backup-dialog-title {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.backup-dialog-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.backup-dialog-subtitle code,
.backup-action-head code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  padding: 1px 5px;
  border-radius: 6px;
  background: var(--bg-pill-inactive);
  color: var(--text-primary);
}

.backup-close-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.backup-close-btn:hover {
  background: var(--primary-coral-light);
  color: var(--primary-coral);
  border-color: var(--primary-coral-border);
}

.backup-stats-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.backup-stat-pill {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 10px 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.backup-stat-pill strong {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.backup-stat-pill span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.25;
}

.backup-actions-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.backup-action-card {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 15px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.backup-action-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.backup-action-ico {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
  margin-block-start: 2px;
}

.backup-action-head h3 {
  margin: 0 0 3px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text-primary);
}

.backup-action-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.backup-mode-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.backup-mode-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.backup-mode-option strong {
  color: var(--text-primary);
}

.backup-btn-primary,
.backup-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  inline-size: 100%;
  padding: 10px 16px;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.backup-btn-primary {
  border: 1px solid var(--primary-coral);
  background: var(--primary-coral);
  color: #ffffff;
}

.backup-btn-primary:hover {
  background: var(--primary-coral-hover);
  border-color: var(--primary-coral-hover);
}

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

.backup-btn-secondary:hover {
  border-color: var(--primary-coral-border);
  background: var(--primary-coral-light);
  color: var(--primary-coral);
}

.backup-status-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 0.83rem;
  font-weight: 600;
  line-height: 1.4;
}

.backup-status-msg.is-success {
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #047857;
}

.backup-status-msg.is-error {
  background: rgba(225, 29, 72, 0.12);
  border: 1px solid rgba(225, 29, 72, 0.35);
  color: #be123c;
}

body.dark-mode dialog.backup-dialog {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.24);
}

body.dark-mode dialog.backup-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
}

body.dark-mode .backup-stat-pill,
body.dark-mode .backup-action-card {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .backup-btn-secondary {
  background: #182235;
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

body.dark-mode .backup-btn-secondary:hover {
  background: rgba(242, 104, 104, 0.16);
  border-color: rgba(248, 113, 113, 0.45);
  color: #fca5a5;
}

body.dark-mode .backup-status-msg.is-success {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
}

body.dark-mode .backup-status-msg.is-error {
  background: rgba(225, 29, 72, 0.18);
  color: #fda4af;
}

@media (max-width: 520px) {
  .backup-dialog-surface {
    padding: 18px 16px 20px;
  }

  .backup-stats-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .backup-stat-pill {
    padding: 8px 6px;
  }
}

@media (forced-colors: active) {
  dialog.backup-dialog,
  .abc-hub-hero {
    border: 2px solid CanvasText;
  }
}

/* ==========================================================================
   ABC & Vowel Section Hero Banner (aligned with Sound Lab, BT & Books)
   ========================================================================== */
.abc-header-section {
  max-width: 1280px;
  margin: 22px auto 24px;
  padding: 0 24px;
  container: abc-hero / inline-size;
}

.abc-hub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 1fr);
  gap: 18px 22px;
  align-items: center;
  background: linear-gradient(135deg, rgba(235, 87, 87, 0.07), rgba(14, 165, 233, 0.06)), var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 24px 26px;
  box-shadow: var(--shadow-card);
  max-inline-size: 100%;
  overflow: clip;
}

.abc-hub-hero-main {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-inline-size: 0;
}

.abc-title-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
}

.abc-main-title {
  margin: 0;
  font-size: clamp(1.38rem, 1.05rem + 1.2vw, 1.72rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.15;
}

.abc-main-title .accent-abc {
  color: var(--primary-coral);
}

.abc-badge-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.abc-subtitle {
  margin: 0;
  font-size: 0.91rem;
  color: var(--text-secondary);
  max-inline-size: 660px;
  line-height: 1.5;
}

.abc-mode-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  margin-block-start: 4px;
  min-inline-size: 0;
}

.abc-hub-hero .listening-bar {
  margin: 0;
  max-inline-size: 100%;
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}

.abc-hub-hero .hint-instruction {
  margin: 0;
  text-align: left;
  font-size: 0.8rem;
}

.abc-hub-hero-visual {
  background: var(--bg-main);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-inline-size: 0;
}

.abc-hero-steps {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.abc-hero-step {
  display: flex;
  align-items: center;
  gap: 10px;
}

.abc-hero-step strong {
  display: block;
  font-size: 0.83rem;
  color: var(--text-primary);
  line-height: 1.25;
}

.abc-hero-step small {
  display: block;
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.3;
}

.abc-hero-step-num {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 800;
  background: rgba(235, 87, 87, 0.14);
  color: var(--primary-coral);
}

.abc-hero-step-num.is-amber {
  background: rgba(245, 158, 11, 0.16);
  color: #d97706;
}

.abc-hero-step-num.is-green {
  background: rgba(14, 165, 233, 0.16);
  color: #0284c7;
}

.abc-filter-toolbar {
  grid-column: 1 / -1;
  padding-block-start: 14px;
  border-top: 1px solid var(--border-subtle);
  min-inline-size: 0;
  max-inline-size: 100%;
}

.abc-filter-toolbar .vowel-filter-bar {
  display: flex;
  width: 100%;
  max-inline-size: 100%;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  border-radius: 0;
  gap: 10px;
}

.abc-filter-toolbar .vowel-filter-pills {
  flex: 1;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: transparent;
  padding: 0;
}

.abc-filter-toolbar .vowel-filter-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-pill-inactive);
}

.abc-filter-toolbar .vowel-filter-pill.active {
  background: var(--primary-coral);
  border-color: var(--primary-coral);
  color: #ffffff;
}

.abc-filter-toolbar .pill-back-soundlab {
  margin-inline-start: auto;
}

body.dark-mode .abc-hub-hero {
  background: linear-gradient(135deg, rgba(235, 87, 87, 0.14), rgba(14, 165, 233, 0.1)), #0f172a;
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .abc-badge-count {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}

body.dark-mode .abc-hub-hero .listening-bar {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(148, 163, 184, 0.2);
}

body.dark-mode .abc-hub-hero-visual {
  background: rgba(2, 6, 23, 0.65);
  border-color: rgba(148, 163, 184, 0.18);
}

body.dark-mode .abc-hero-step-num {
  color: #fb927c;
}

body.dark-mode .abc-hero-step-num.is-amber {
  color: #fbbf24;
}

body.dark-mode .abc-hero-step-num.is-green {
  color: #7dd3fc;
}

body.dark-mode .abc-filter-toolbar .vowel-filter-bar {
  background: transparent;
  border: none;
}

body.dark-mode .abc-filter-toolbar .vowel-filter-pills {
  background: transparent;
}

body.dark-mode .abc-filter-toolbar .vowel-filter-pill {
  background: var(--bg-pill-inactive);
  border-color: rgba(148, 163, 184, 0.22);
  color: var(--text-secondary);
}

body.dark-mode .abc-filter-toolbar .vowel-filter-pill.active {
  background: var(--primary-coral);
  border-color: var(--primary-coral);
  color: #ffffff;
}

@container abc-hero (inline-size <= 760px) {
  .abc-hub-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
    gap: 14px;
    border-radius: 16px;
  }

  .abc-hub-hero-visual {
    padding: 12px 14px;
    border-radius: 12px;
  }

  .abc-filter-toolbar .pill-back-soundlab {
    margin-inline-start: 0;
  }
}

@media (max-width: 900px) {
  .abc-header-section {
    padding-left: 0;
    padding-right: 0;
  }
}

@media (max-width: 820px) {
  .abc-hub-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px;
    gap: 14px;
    border-radius: 16px;
  }

  .abc-filter-toolbar .pill-back-soundlab {
    margin-inline-start: 0;
  }
}

@media (max-width: 640px) {
  .abc-header-section {
    margin: 10px auto 16px;
  }

  .abc-hub-hero {
    padding: 14px;
    gap: 12px;
  }

  .abc-badge-count {
    font-size: 0.72rem;
    padding: 3px 10px;
  }

  .abc-subtitle {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .abc-mode-row {
    width: 100%;
  }

  .abc-hub-hero .listening-bar {
    width: 100%;
    padding: 8px 10px;
  }

  .abc-hero-step {
    align-items: flex-start;
    gap: 9px;
  }

  .abc-hero-step-num {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    font-size: 0.72rem;
    margin-block-start: 1px;
  }

  .abc-hero-step strong {
    font-size: 0.8rem;
  }

  .abc-hero-step small {
    font-size: 0.72rem;
  }

  .abc-filter-toolbar {
    padding-block-start: 10px;
  }

  .abc-filter-toolbar .vowel-filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .abc-filter-toolbar .vowel-filter-label {
    text-align: left;
  }

  .abc-filter-toolbar .vowel-filter-pills {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    padding: 2px 2px 4px;
    gap: 6px;
    scroll-snap-type: x proximity;
  }

  .abc-filter-toolbar .vowel-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .abc-filter-toolbar .vowel-filter-pill {
    flex-shrink: 0;
    white-space: nowrap;
    scroll-snap-align: start;
    padding: 6px 11px;
    font-size: 0.76rem;
    min-height: 36px;
  }
}