/* Andika - 本地 IPA 字体 */
@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url('assets/fonts/Andika-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-weight: 700;
  font-display: block;
  src: url('assets/fonts/Andika-Bold.ttf') format('truetype');
}

:root {
  /* Default Theme: Modern Ivory (新雅象牙白) */
  --bg: #fdfbf7;
  --bg-elev: #ffffff;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --ink-faint: #78716c;
  --line: #e7e2d4;
  --line-soft: #efe9da;
  
  --op: #c2410c;
  --op-bg: #ffedd5;
  --gt: #15803d;
  --gt-bg: #dcfce7;
  --pt: #b45309;
  --pt-bg: #fef9c3;
  --qg: #1d4ed8;
  --qg-bg: #dbeafe;
  --qo: #6d28d9;
  --qo-bg: #ede9fe;

  --glass-bg: rgba(253, 251, 247, 0.85);
  --glass-border: rgba(231, 226, 212, 0.5);
  --shadow: 0 8px 30px rgba(28, 25, 23, 0.04);
  --shadow-hover: 0 20px 48px rgba(28, 25, 23, 0.08);
  
  --serif: 'Cormorant Garamond', 'Noto Serif SC', Georgia, serif;
  --sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --zh-serif: 'Noto Serif SC', 'Songti SC', serif;
  --font-ui: 'Outfit', sans-serif;
  --ipa: 'Andika','Segoe UI','Arial Unicode MS','Lucida Sans Unicode',Tahoma,sans-serif;
}


.ipa-inline { font-family: var(--ipa); }

body.theme-obsidian {
  /* Midnight Obsidian (曜石极夜暗黑) */
  --bg: #09090b;
  --bg-elev: #121215;
  --ink: #f4f4f5;
  --ink-soft: #a1a1aa;
  --ink-faint: #71717a;
  --line: #27272a;
  --line-soft: #18181b;

  --op: #fb923c;
  --op-bg: #2a1b10;
  --gt: #4ade80;
  --gt-bg: #0b2210;
  --pt: #facc15;
  --pt-bg: #221d0a;
  --qg: #60a5fa;
  --qg-bg: #0c1a2e;
  --qo: #a78bfa;
  --qo-bg: #1d122b;

  --glass-bg: rgba(9, 9, 11, 0.85);
  --glass-border: rgba(39, 39, 42, 0.5);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-hover: 0 24px 56px rgba(0, 0, 0, 0.7);
}

body.theme-sage {
  /* Eucalyptus Sage (静谧草本绿) */
  --bg: #f4f6f3;
  --bg-elev: #ffffff;
  --ink: #202b25;
  --ink-soft: #4f5e55;
  --ink-faint: #7b8e83;
  --line: #dfdfdb;
  --line-soft: #ecece7;

  --op: #0284c7;
  --op-bg: #e0f2fe;
  --gt: #0f766e;
  --gt-bg: #ccfbf1;
  --pt: #d97706;
  --pt-bg: #fef3c7;
  --qg: #2563eb;
  --qg-bg: #dbeafe;
  --qo: #7c3aed;
  --qo-bg: #f5f3ff;

  --glass-bg: rgba(244, 246, 243, 0.85);
  --glass-border: rgba(223, 223, 219, 0.5);
  --shadow: 0 8px 24px rgba(32, 43, 37, 0.03);
  --shadow-hover: 0 18px 36px rgba(32, 43, 37, 0.06);
}

/* ==================== GLOBAL STYLES ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.6;
  padding-bottom: 80px;
  padding-bottom: 80px;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

/* ==================== HERO HEADER ==================== */
.hero {
  padding: 58px 24px 44px;
  text-align: left;
  max-width: 1180px;
  margin: 0 auto;
  position: relative;
}
.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(380px, 1.1fr);
  align-items: center;
  gap: 36px;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--op-bg);
  color: var(--op);
  font-family: var(--font-ui);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(3.4rem, 8vw, 5.8rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 0.95;
  color: var(--ink);
  margin-bottom: 12px;
}
.hero h1 em {
  font-style: italic;
  font-weight: 400;
  color: var(--op);
}
.hero .subtitle {
  font-family: var(--font-ui);
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  font-weight: 800;
  letter-spacing: 0;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.hero .meta {
  max-width: 420px;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--ink-faint);
  margin-bottom: 24px;
}

.learning-path {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  max-width: 420px;
  margin: 0;
}
.path-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 3px 12px;
  align-items: center;
  min-width: 0;
  padding: 13px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.path-step:hover {
  transform: translateY(-2px);
  border-color: var(--ink-faint);
}
.path-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: var(--op-bg);
  color: var(--op);
  font-family: var(--font-ui);
  font-weight: 800;
}
.path-step strong {
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.2;
}
.path-step em {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--ink-faint);
  font-style: normal;
  font-size: 0.8rem;
  white-space: nowrap;
}
.hero-training {
  display: grid;
  gap: 14px;
}

.today-card {
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  padding: 26px;
  background: linear-gradient(135deg, var(--bg-elev), var(--op-bg));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-hover);
  text-align: left;
}
.today-kicker {
  color: var(--op);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.today-card h2 {
  font-family: var(--font-ui);
  font-size: clamp(1.65rem, 3.8vw, 2.45rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
}
.today-card p {
  color: var(--ink-soft);
  font-size: 0.96rem;
  line-height: 1.65;
}
.today-lesson-detail {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(194, 65, 12, 0.16);
  color: var(--ink-soft);
  font-size: 0.86rem;
}
.today-lesson-detail div {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}
.today-lesson-detail strong {
  color: var(--op);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}
.today-lesson-detail span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.today-actions {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
}
.today-actions a,
.today-actions button,
.nav-link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--ink-soft);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.today-actions a:hover,
.today-actions button:hover,
.nav-link-pill:hover {
  border-color: var(--ink-faint);
  color: var(--ink);
  background: var(--line-soft);
}
.today-actions a:first-child,
.today-actions button:first-child {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.output-progress {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 0.82rem;
}
.output-progress span {
  background: var(--line-soft);
  border-radius: 999px;
  padding: 5px 9px;
}
.output-progress strong {
  color: var(--ink);
  font-family: var(--font-ui);
}

/* Mastery Progress Dashboard */
.progress-card {
  max-width: none;
  margin: 0;
  background-color: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  text-align: left;
}
.progress-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--ink-faint);
}
.progress-card-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.progress-card-title {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress-card-title svg {
  width: 18px;
  height: 18px;
  color: var(--gt);
}
.progress-pct {
  font-family: var(--font-ui);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 16px;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gt), var(--op));
  border-radius: 99px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.progress-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.progress-details strong {
  font-family: var(--font-ui);
  font-size: 1rem;
  color: var(--ink);
}
.btn-reset-prog {
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.2s;
}
.btn-reset-prog:hover {
  color: #ef4444;
  background-color: rgba(239, 68, 68, 0.06);
}

/* ==================== NAVIGATION BAR ==================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 20px;

}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Search Box */
.search {
  position: relative;
  width: 100%;
  max-width: 330px; /* 限制Web端宽度，防止拉伸过长，与下方完美对齐 */
}
.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  background-color: var(--bg-elev);
  border-radius: 12px;
  padding: 0 42px 0 38px;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: all 0.2s ease;
}
.search input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(28, 25, 23, 0.06);
}
.search kbd {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 1px 5px;
  pointer-events: none;
}

/* Category Pills */
.pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pill {
  white-space: nowrap;
  background-color: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  border-radius: 10px;
  padding: 7px 12px;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  display: flex;
  align-items: center;
  gap: 6px;
}
.pill:hover {
  background-color: var(--line-soft);
  color: var(--ink);
  border-color: var(--ink-soft);
}
.pill.active {
  background-color: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.pill .count {
  font-size: 0.75rem;
  font-weight: 500;
  opacity: 0.7;
}

/* Navigation Actions Group */
.nav-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

/* Mastery Filter Button */
.mastery-filter-pill {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--bg-elev);
  color: var(--ink-soft);
  padding: 0 12px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.mastery-filter-pill:hover {
  background-color: var(--line-soft);
  color: var(--ink);
}
.mastery-filter-pill.active {
  background-color: var(--gt-bg);
  color: var(--gt);
  border-color: var(--gt);
}

/* Control Button Groups */
.ctrl-group {
  display: inline-flex;
  background-color: var(--line-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  height: 38px;
}
.ctrl-group button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ctrl-group button.active {
  background-color: var(--bg-elev);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

/* ==================== AMBIENT NOISE WIDGET ==================== */
.ambient-widget {
  position: relative;
}
.btn-ambient {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--bg-elev);
  color: var(--ink-soft);
  padding: 0 12px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.btn-ambient:hover {
  background-color: var(--line-soft);
  color: var(--ink);
}
.btn-ambient.playing {
  background-color: var(--op-bg);
  color: var(--op);
  border-color: var(--op);
}

/* Equalizer animations */
.ambient-icon-wrap {
  width: 14px;
  height: 12px;
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.eq-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  height: 100%;
}
.eq-bar {
  width: 2.5px;
  background-color: currentColor;
  border-radius: 99px;
  height: 8px;
  transition: height 0.15s ease;
}
.eq-bar:nth-child(1) { height: 5px; }
.eq-bar:nth-child(2) { height: 11px; }
.eq-bar:nth-child(3) { height: 7px; }
.btn-ambient.playing .eq-bar:nth-child(1) {
  animation: eqBounce 1.2s ease-in-out infinite alternate;
}
.btn-ambient.playing .eq-bar:nth-child(2) {
  animation: eqBounce 0.8s ease-in-out infinite alternate 0.2s;
}
.btn-ambient.playing .eq-bar:nth-child(3) {
  animation: eqBounce 1.0s ease-in-out infinite alternate 0.4s;
}
@keyframes eqBounce {
  0% { height: 3px; }
  100% { height: 12px; }
}

/* Dropdown Menu */
.ambient-menu[hidden] {
  display: none !important;
}
.ambient-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 160px;
  background-color: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 120;
}
.ambient-menu button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
}
.ambient-menu button:hover {
  background-color: var(--line-soft);
  color: var(--ink);
}
.ambient-menu button.active {
  background-color: var(--line);
  color: var(--ink);
  font-weight: 700;
}

/* Flashcard Button */
.flash-btn {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--ink);
  background-color: var(--ink);
  color: var(--bg);
  padding: 0 14px;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.flash-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.flash-btn svg {
  width: 14px;
  height: 14px;
}

.learning-section {
  max-width: 1200px;
  margin: 0 auto 72px;
  padding: 0 24px;
}
.learning-section-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 20px;
}
.section,
.learning-section,
#today-section {
  scroll-margin-top: 150px;
}
.learning-eyebrow {
  display: block;
  color: var(--op);
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.learning-section-header h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.15;
}
.learning-count {
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
}
.learning-map-section {
  padding-top: 30px;
}
.learning-map-subtitle {
  margin-top: 8px;
  max-width: 560px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.learning-map-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.learning-map-head-actions button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--ink);
  font-family: var(--font-ui);
  font-weight: 800;
  cursor: pointer;
}
.learning-map-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.learning-map-grid.is-expanded {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  overflow-x: visible;
  padding-bottom: 0;
  scroll-snap-type: none;
}
.lesson-day-card {
  position: relative;
  flex: 0 0 230px;
  min-width: 0;
  padding: 13px 42px 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
  cursor: pointer;
  scroll-snap-align: start;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.learning-map-grid.is-expanded .lesson-day-card {
  flex-basis: auto;
}
.lesson-day-card:hover {
  transform: translateY(-2px);
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-hover);
}
.lesson-day-card.is-active {
  border-color: rgba(194, 65, 12, 0.55);
  background: linear-gradient(180deg, var(--bg-elev), var(--op-bg));
}
.lesson-day-card.is-done {
  border-color: var(--gt);
  background: linear-gradient(180deg, var(--bg-elev), var(--gt-bg));
}
.lesson-day-check {
  position: absolute;
  top: 12px;
  right: 12px;
  display: none;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--gt);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 900;
  box-shadow: 0 0 0 4px var(--gt-bg);
}
.lesson-day-card.is-done .lesson-day-check {
  display: grid;
}
.lesson-day-index,
.lesson-day-meta {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.lesson-day-card strong {
  display: block;
  margin-top: 7px;
  font-family: var(--font-ui);
  font-size: 0.94rem;
  line-height: 1.25;
}
.lesson-day-card em {
  display: block;
  margin-top: 5px;
  color: var(--ink-soft);
  font-style: normal;
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lesson-day-meta {
  margin-top: 9px;
}
.patterns-grid,
.stories-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 760px) {
  .patterns-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .stories-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1120px) {
  .patterns-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.pattern-card,
.story-card {
  min-width: 0;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.pattern-card:hover,
.story-card:hover {
  transform: translateY(-2px);
  border-color: var(--ink-faint);
  box-shadow: var(--shadow-hover);
}
.pattern-card.is-done,
.story-card.is-done {
  border-color: var(--gt);
  background: linear-gradient(180deg, var(--bg-elev), var(--gt-bg));
}
.pattern-card.is-today-lesson,
.story-card.is-today-lesson,
.card.today-word-card {
  border-color: rgba(194, 65, 12, 0.42);
  box-shadow: 0 18px 44px rgba(194, 65, 12, 0.08);
}
.today-badge {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--op-bg);
  color: var(--op);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.learning-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.learning-index,
.story-level {
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.learning-play,
.pattern-example-play,
.story-line-play {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--line-soft);
  color: var(--ink-soft);
  cursor: pointer;
}
.learning-play svg,
.pattern-example-play svg,
.story-line-play svg {
  width: 15px;
  height: 15px;
}
.learning-play.playing,
.pattern-example-play.playing,
.story-line-play.playing,
.story-play-all.playing,
.say-line.playing {
  color: var(--op);
  border-color: var(--op);
  background: var(--op-bg);
}
.pattern-card h3,
.story-card h3 {
  font-family: var(--font-ui);
  font-size: 1.22rem;
  line-height: 1.25;
  margin-bottom: 8px;
}
.pattern-card p,
.story-title-zh {
  color: var(--ink-soft);
  font-size: 0.92rem;
}
.pattern-examples {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 16px 0;
}
.pattern-examples li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg);
}
.pattern-example-en {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.pattern-example-zh {
  grid-column: 2;
  color: var(--ink-faint);
  font-size: 0.86rem;
}
.learning-complete {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-ui);
  font-weight: 800;
  cursor: pointer;
}
.learning-complete.is-done {
  border-color: var(--gt);
  background: var(--gt);
  color: #fff;
}
.story-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px 0 18px;
  color: var(--ink-soft);
  font-size: 0.88rem;
}
.story-toolbar button,
.story-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-elev);
  color: var(--ink-soft);
  padding: 0 10px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}
.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.story-lines {
  display: grid;
  gap: 10px;
}
.story-line {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--bg);
}
.story-line-en {
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.story-line-zh {
  color: var(--ink-faint);
  font-size: 0.86rem;
}
.retell-box {
  margin: 14px 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--line-soft);
}
.retell-box strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
}
.retell-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.retell-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--ink-soft);
  font-size: 0.8rem;
}
.say-practice {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.say-practice-title {
  margin-bottom: 8px;
  color: var(--ink-faint);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.say-practice-title em {
  font-style: normal;
  opacity: 0.7;
}
.say-line {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
}
.say-line span {
  overflow-wrap: anywhere;
}
.say-line em {
  color: var(--ink-faint);
  font-style: normal;
  font-size: 0.82rem;
}
.say-line svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}

@media (max-width: 920px) {
  .hero {
    padding: 54px 24px 36px;
  }

  .hero-content {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .hero-intro {
    text-align: center;
  }

  .hero .meta {
    margin-left: auto;
    margin-right: auto;
  }

  .learning-path {
    max-width: 680px;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 44px 14px 30px;
  }

  .hero h1 {
    font-size: clamp(3rem, 16vw, 4rem);
  }

  .hero .subtitle {
    font-size: 1.05rem;
  }

  .hero .meta {
    font-size: 0.9rem;
  }

  .learning-path {
    grid-template-columns: 1fr;
    max-width: 350px;
  }

  .path-step {
    min-height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    text-align: left;
  }

  .path-step strong {
    overflow-wrap: anywhere;
  }

  .path-step em {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .today-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 20px;
  }

  .today-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .today-actions a,
  .today-actions button {
    padding: 0 8px;
  }

  .nav {
    padding: 8px 12px;
  }

  .nav-inner {
    gap: 8px;
  }

  .search {
    max-width: none;
  }

  .search input {
    height: 40px;
    border-radius: 12px;
    padding-left: 36px;
    padding-right: 118px;
    font-size: 0.9rem;
  }

  .search svg {
    left: 12px;
  }

  .search kbd {
    display: none;
  }

  .pills {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

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

  .pills {
    gap: 6px;
    margin: 0 -12px;
    padding: 0 12px;
  }

  .pill {
    flex: 0 0 auto;
    min-height: 34px;
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  .pill .count {
    font-size: 0.7rem;
  }

  .nav-actions {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: center;
    gap: 7px;
    margin: 0 -12px;
    padding: 0 12px;
    overflow: visible;
  }

  .mastery-filter-pill,
  .ctrl-group,
  .btn-ambient,
  .nav-link-pill,
  .flash-btn {
    flex: 0 0 auto;
    height: 34px;
    border-radius: 10px;
  }

  .mastery-filter-pill,
  .btn-ambient,
  .nav-link-pill,
  .flash-btn {
    padding: 0 10px;
    font-size: 0.76rem;
  }

  .mastery-filter-pill {
    grid-column: span 2;
  }

  #audio-toggle {
    grid-column: span 3;
  }

  #hans-toggle {
    grid-column: span 1;
  }

  .ambient-widget {
    grid-column: span 2;
    min-width: 0;
  }

  .btn-ambient {
    width: 100%;
    justify-content: center;
  }

  .ambient-menu {
    left: 0;
    right: auto;
    width: min(190px, calc(100vw - 32px));
  }

  .flash-btn {
    grid-column: span 2;
    justify-content: center;
  }

  .nav-link-pill {
    grid-column: span 2;
    min-height: 34px;
    min-width: 0;
    white-space: nowrap;
  }

  #flash-btn {
    grid-column: 3 / span 2;
  }

  #flash-phonetics-btn {
    grid-column: span 2;
  }

  #flash-sentences-btn {
    grid-column: span 2;
  }

  .ctrl-group {
    padding: 2px;
  }

  .ctrl-group button {
    padding: 0 8px;
    font-size: 0.76rem;
  }

  .flash-btn svg {
    width: 13px;
    height: 13px;
  }

  main {
    margin-top: 18px;
    padding: 0 16px;
  }

  .section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 4px 12px;
  }

  .section-header h2 {
    grid-column: 1;
    font-size: 1.75rem;
    line-height: 1;
  }

  .section-header .zh {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.96rem;
    line-height: 1.35;
    max-width: 100%;
  }

  .section-header .count {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-left: 0;
    align-self: center;
    text-align: right;
  }

  .float-user {
    top: 11px;
    right: 18px;
    gap: 6px;
  }

  .theme-toggle-float {
    width: 36px;
    height: 32px;
  }

  .float-user-btn {
    width: 36px;
    height: 36px;
  }

  .flash-card-wrap.sentence-step-mode {
    height: 430px;
  }

  .flash-card-wrap.sentence-step-mode .flash-front {
    padding: 28px 20px 22px;
  }

  .sentence-card {
    gap: 10px;
  }

  .sentence-line {
    font-size: 1.2rem;
    line-height: 1.4;
  }

  .sentence-picked,
  .sentence-bank {
    min-height: 58px;
    padding: 9px;
    gap: 6px;
  }

  .sentence-bank {
    min-height: 78px;
  }

  .sentence-token {
    padding: 7px 10px;
    font-size: 0.88rem;
  }

  .sentence-actions button {
    padding: 7px 12px;
    font-size: 0.78rem;
  }
}

/* ==================== MAIN DICTIONARY GRID ==================== */
main {
  max-width: 1200px;
  margin: 40px auto 0;
  padding: 0 24px;
}

.section {
  margin-bottom: 60px;
}
.section-header {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
  margin-bottom: 24px;
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.section-header h2 {
  font-family: var(--font-ui);
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--ink);
}
.section-header .zh {
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.section-header .count {
  margin-left: auto;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

/* The Grid */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1200px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==================== WORD CARDS ==================== */
.card {
  background-color: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.215, 0.61, 0.355, 1), box-shadow 0.3s, border-color 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--ink-soft);
}

/* Category Left Border Accents */
.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  transition: background-color 0.4s;
}
.card[data-cat="op"]::before { background-color: var(--op); }
.card[data-cat="gt"]::before { background-color: var(--gt); }
.card[data-cat="pt"]::before { background-color: var(--pt); }
.card[data-cat="qg"]::before { background-color: var(--qg); }
.card[data-cat="qo"]::before { background-color: var(--qo); }

/* Card Head */
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 4px;
}
.word-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.word {
  background: transparent;
  border: 0;
  font-family: var(--serif);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  line-height: 1.2;
}
.word:hover {
  color: var(--op);
  text-decoration: underline;
}

/* Pronounce Buttons */
button.speak {
  background: transparent;
  border: 0;
  color: var(--ink-faint);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.2s;
}
button.speak:hover {
  color: var(--ink);
  background-color: var(--line-soft);
}
button.speak svg {
  width: 16px;
  height: 16px;
}
button.speak.playing {
  color: var(--op);
  animation: speakPulse 1s infinite alternate;
}
@keyframes speakPulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.15); opacity: 1; }
}

/* Card Actions */
.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-mastery {
  width: 24px;
  height: 24px;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background-color: var(--bg-elev);
  color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn-mastery svg {
  width: 12px;
  height: 12px;
}
.btn-mastery:hover {
  border-color: var(--gt);
  color: var(--ink-faint);
}
.btn-mastery.word-mastered {
  background-color: var(--gt);
  border-color: var(--gt);
  color: var(--bg);
}

/* Card Style for Mastered Word */
.card.word-mastered {
  opacity: 0.75;
  border-color: var(--line);
}
.card.word-mastered:hover {
  opacity: 1.0;
}

/* Category Badge tags */
.tag {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 2px 6px;
  border-radius: 5px;
  background-color: var(--line-soft);
  color: var(--ink-soft);
}
.card[data-cat="op"] .tag { background-color: var(--op-bg); color: var(--op); }
.card[data-cat="gt"] .tag { background-color: var(--gt-bg); color: var(--gt); }
.card[data-cat="pt"] .tag { background-color: var(--pt-bg); color: var(--pt); }
.card[data-cat="qg"] .tag { background-color: var(--qg-bg); color: var(--qg); }
.card[data-cat="qo"] .tag { background-color: var(--qo-bg); color: var(--qo); }

/* IPA */
.ipa {
  font-family: var(--ipa);
  font-size: 0.85rem;
  color: var(--ink-faint);
  margin-bottom: 12px;
  min-height: 20px;
}

/* Translations & Card Body */
.card-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.def-zh {
  font-family: var(--zh-serif);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
}
.def-en {
  font-size: 0.9rem;
  color: var(--ink-soft);
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.speak-inline {
  flex-shrink: 0;
  margin-top: 1px;
}
.example {
  background-color: var(--line-soft);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
  position: relative;
}
.example button.speak {
  position: absolute;
  right: 10px;
  top: 10px;
}
.example .en {
  color: var(--ink);
  font-weight: 500;
  padding-right: 24px;
  margin-bottom: 4px;
}
.example .zh {
  color: var(--ink-soft);
}

/* Synonyms section */
.syns-header {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-top: 8px;
  margin-bottom: 4px;
}
.syns-header em {
  font-style: italic;
  font-weight: 500;
  text-transform: none;
}
.syns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.syn {
  background-color: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 10px;
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.2s;
}
.syn:hover {
  background-color: var(--line-soft);
  color: var(--ink);
}
.syn.active {
  background-color: var(--op-bg);
  border-color: var(--op);
  color: var(--op);
  font-weight: 700;
}

/* Synonym Expansion Panel */
.syn-panel {
  background-color: var(--bg-elev);
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.8rem;
  margin-top: 4px;
  animation: slideDown 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.syn-panel-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.sp-word {
  background: transparent;
  border: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
}
.sp-word:hover {
  color: var(--op);
  text-decoration: underline;
}
.sp-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background-color: var(--op-bg);
  color: var(--op);
  padding: 1px 4px;
  border-radius: 4px;
}
.sp-vs {
  font-size: 0.75rem;
  color: var(--ink-faint);
}
.sp-main {
  background: transparent;
  border: 0;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}
.sp-main:hover {
  color: var(--ink);
  text-decoration: underline;
}
.sp-row {
  display: flex;
  margin-bottom: 4px;
  gap: 8px;
}
.sp-row:last-child {
  margin-bottom: 0;
}
.sp-label {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-faint);
  width: 50px;
  flex-shrink: 0;
  margin-top: 2px;
}
.sp-label em {
  display: block;
  font-size: 0.55rem;
  text-transform: none;
  font-style: italic;
  font-weight: 500;
  line-height: 1;
}
.sp-val {
  color: var(--ink);
}
.sp-empty {
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
  padding: 4px 0;
}

.empty {
  display: none;
  text-align: center;
  padding: 60px 24px;
  font-size: 1.1rem;
  color: var(--ink-faint);
  background-color: var(--bg-elev);
  border: 1px dashed var(--line);
  border-radius: 20px;
  margin-top: 40px;
}
.empty.show {
  display: block;
}

/* ==================== IMMERSIVE FLASHCARD OVERLAY ==================== */
.flash-overlay[hidden] {
  display: none !important;
}
.flash-overlay {
  position: fixed;
  inset: 0;
  background-color: #0b0b0d;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  color: #e4e4e7;
  overflow: hidden;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Topbar */
.flash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #1f1f23;
  background-color: #0d0d11;
}
.flash-progress {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  color: #a1a1aa;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.flash-topbar-btns {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}
.flash-topbar-btns button {
  background-color: transparent;
  border: 1px solid #27272a;
  color: #a1a1aa;
  border-radius: 99px;
  padding: 4px 10px;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.flash-topbar-btns button:hover {
  color: #ffffff;
  border-color: #52525b;
}
.flash-topbar-btns button.active {
  background-color: #e4e4e7;
  color: #09090b;
  border-color: #e4e4e7;
}
.flash-topbar-btns svg {
  width: 14px;
  height: 14px;
}
.flash-close-btn {
  color: #f87171 !important;
  border-color: #7f1d1d !important;
}
.flash-close-btn:hover {
  background-color: #ef4444 !important;
  color: #ffffff !important;
  border-color: #ef4444 !important;
}

/* Category Selection Nav inside Flashcard */
.flash-cat-nav {
  width: 100%;
  border-bottom: 1px solid #1f1f23;
  padding: 8px 14px;
  background-color: #09090b;
}
.flash-cat-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Category Dropdown */
.flash-cat-dropdown {
  position: relative;
  flex-shrink: 0;
}
.flash-cat-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background-color: #121215;
  border: 1px solid #27272a;
  border-radius: 8px;
  color: #a1a1aa;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.flash-cat-trigger:hover {
  background-color: #1f1f23;
  color: #ffffff;
}
.flash-cat-trigger.active {
  background-color: #e4e4e7;
  color: #09090b;
  border-color: #e4e4e7;
}
.flash-cat-trigger .count {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.6;
}
.flash-cat-arrow {
  font-size: 0.65rem;
  line-height: 1;
  transition: transform 0.2s;
  display: inline-block;
}
.flash-cat-dropdown.open .flash-cat-arrow {
  transform: rotate(180deg);
}

.flash-cat-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  max-height: min(420px, 70vh);
  overflow-y: auto;
  background-color: #18181b;
  border: 1px solid #27272a;
  border-radius: 10px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  z-index: 200;
}
.flash-cat-menu[hidden] {
  display: none;
}
.flash-cat-menu button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  padding: 7px 12px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  color: #a1a1aa;
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
}
.flash-cat-menu button:hover {
  background-color: #27272a;
  color: #ffffff;
}
.flash-cat-menu button.active {
  background-color: #e4e4e7;
  color: #09090b;
}
.flash-cat-menu .count {
  font-size: 0.7rem;
  opacity: 0.5;
  margin-left: 4px;
}

/* Phonetics Example Words */
.flash-phonetics-ex {
  display: inline-block;
  background-color: #1f1f23;
  border: 1px solid #27272a;
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--ipa);
  font-size: 0.85rem;
  color: #d4d4d8;
  margin: 2px 4px 2px 0;
  cursor: pointer;
  transition: all 0.15s;
}
.flash-phonetics-focus {
  border-color: #e4e4e7;
  color: #ffffff;
}
.flash-phonetics-ex:hover {
  background-color: #27272a;
  color: #ffffff;
}
.flash-phonetics-ex-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}
.flash-card-wrap.phonetics-step-mode .flash-phonetics-ex-row {
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 10px;
  padding: 0;
}

.flash-card-wrap.phonetics-step-mode.phonetics-first-step .flash-phonetics-ex-row {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center;
  overflow: visible;
  gap: 12px;
}


/* The Stage */
.flash-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-perspective: 1200px;
  perspective: 1200px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

/* The Card Wrapper */
.flash-card-wrap {
  width: 100%;
  max-width: 520px;
  height: 380px;
  position: relative;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

/* Card Inner with 3D Preserves */
.flash-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  -webkit-transition: -webkit-transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.flash-card-wrap.flipped .flash-card-inner {
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
}
.flash-card-wrap.flipped .flash-front {
  opacity: 0;
  pointer-events: none;
}
.flash-card-wrap.phonetics-step-mode.flipped .flash-card-inner {
  -webkit-transform: none;
  transform: none;
}
.flash-card-wrap.phonetics-step-mode.flipped .flash-front {
  opacity: 1;
  pointer-events: auto;
}

.flash-face {
  position: absolute;
  inset: 0;
  border-radius: 24px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  padding: 28px 28px 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
}

/* Front Face */
.flash-front {
  background-color: #121215;
  border: 1px solid #27272a;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.flash-card-wrap.phonetics-step-mode {
  height: 440px;
}
.flash-card-wrap.phonetics-step-mode.phonetics-first-step {
  height: 440px;
}
.flash-card-wrap.phonetics-step-mode.phonetics-mouth-step {
  height: 440px;
}
.flash-card-wrap.sentence-step-mode {
  max-width: min(920px, calc(100vw - 96px));
  height: 440px;
}
.flash-card-wrap.day-pattern-mode,
.flash-card-wrap.day-story-mode {
  max-width: min(720px, calc(100vw - 96px));
  height: 520px;
}
.flash-card-wrap.day-pattern-mode .flash-front,
.flash-card-wrap.day-story-mode .flash-front {
  justify-content: flex-start;
  overflow: hidden;
  cursor: default;
  padding: 54px 34px 28px;
}
.flash-card-wrap.phonetics-step-mode .flash-front {
  justify-content: center;
  cursor: default;
  overflow: hidden;
  padding: 34px 34px 28px;
}
.flash-card-wrap.sentence-step-mode .flash-front {
  justify-content: center;
  cursor: default;
  overflow: hidden;
  padding: 34px 34px 28px;
}
.flash-card-wrap.phonetics-step-mode.phonetics-first-step .flash-front {
  justify-content: center;
  cursor: pointer;
  overflow: visible;
}
.flash-card-wrap.phonetics-step-mode.phonetics-first-step .flash-flip-btn {
  border: 1px solid #27272a;
  background-color: #18181b;
  color: #e4e4e7;
  border-radius: 999px;
  padding: 9px 24px;
  min-width: 116px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.1;
}
.flash-card-wrap.phonetics-step-mode.phonetics-first-step .flash-flip-btn:hover {
  background-color: #27272a;
  color: #ffffff;
}
.flash-card-wrap.phonetics-step-mode:not(.phonetics-first-step) .flash-flip-btn {
  display: none;
}
.flash-speak-front {
  position: absolute;
  top: 24px;
  left: 24px;
  right: auto;
  background-color: #1f1f23;
  border: 1px solid #27272a;
  width: 38px;
  height: 38px;
  border-radius: 99px;
  color: #a1a1aa;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: 10;
}
.flash-speak-front:hover {
  background-color: #27272a;
  color: #ffffff;
  transform: scale(1.05);
  border-color: #3f3f46;
}
.flash-speak-front.playing {
  color: var(--op);
  border-color: var(--op);
  animation: speakPulse 1s infinite alternate;
}
.flash-speak-front svg {
  width: 18px;
  height: 18px;
}

.flash-mastery-top {
  position: absolute;
  top: 24px;
  right: 24px;
  background-color: #1f1f23;
  border: 1px solid #27272a;
  width: 38px;
  height: 38px;
  border-radius: 99px;
  color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 10;
}
.flash-mastery-top svg {
  width: 14px;
  height: 14px;
}
.flash-mastery-top:hover {
  background-color: #27272a;
  border-color: var(--gt);
  color: #a1a1aa;
  transform: scale(1.05);
}
.flash-mastery-top.word-mastered {
  background-color: var(--gt);
  border-color: var(--gt);
  color: #ffffff;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
}
.flash-word-big {
  background: transparent;
  border: 0;
  font-family: var(--serif);
  font-size: clamp(2.5rem, 8vw, 4.2rem);
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  line-height: 1.1;
  margin-bottom: 16px;
  cursor: pointer;
}
.flash-word-big:hover {
  text-decoration: underline;
  opacity: 0.95;
}
.flash-card-wrap.day-pattern-mode .flash-word-big,
.flash-card-wrap.day-story-mode .flash-word-big {
  width: 100%;
  max-width: 620px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.08;
  cursor: default;
}
.flash-card-wrap.day-story-mode .flash-word-big {
  font-size: clamp(1.35rem, 2.8vw, 2rem);
}
.flash-card-wrap.day-pattern-mode .flash-phonetics-ex-row,
.flash-card-wrap.day-story-mode .flash-phonetics-ex-row {
  width: 100%;
  max-width: 620px;
  display: grid !important;
  grid-template-columns: 1fr;
  overflow-y: auto;
  padding-right: 4px;
}
.flash-card-wrap.day-story-mode .flash-phonetics-ex-row {
  max-height: 300px;
}
.flash-card-wrap.day-pattern-mode .flash-phonetics-ex-row {
  max-height: 260px;
}

.flash-word-big.phonetics-symbol,
.flash-back-title.phonetics-symbol {
  font-family: var(--ipa) !important;
  font-size: clamp(2.5rem,8vw,4.2rem) !important;
  cursor: default;
  text-decoration: none !important;
}
.flash-word-big.phonetics-symbol {
  font-size: clamp(3.5rem,10vw,5.5rem) !important;
}
.flash-word-big.phonetics-symbol:hover,
.flash-back-title.phonetics-symbol:hover {
  text-decoration: none;
  opacity: 1;
}

/* Spelling Practice in Card Front */
.flash-spell-row {
  width: 100%;
  max-width: 360px;
  position: relative;
  margin-bottom: 10px;
  cursor: text;
}
.spell-slots {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.spell-slot {
  width: 24px;
  height: 34px;
  border-bottom: 2px solid #3f3f46;
  font-family: var(--sans);
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: lowercase;
  color: #ffffff;
  text-align: center;
  line-height: 30px;
  transition: all 0.15s;
}
.spell-slot.filled {
  border-bottom-color: #a1a1aa;
}
.spell-slot.correct {
  border-bottom-color: #22c55e;
  color: #22c55e;
}
.spell-slot.wrong {
  border-bottom-color: #ef4444;
  color: #ef4444;
  animation: shake 0.3s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
.spell-hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  left: 0;
  right: 0;
}
.fc-hint-btn {
  background-color: rgba(239, 68, 68, 0.08);
  border: 1px dashed rgba(239, 68, 68, 0.35);
  color: #f87171;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 8px;
  padding: 5px 12px;
  margin-top: 6px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeIn 0.2s ease;
}
.fc-hint-btn:hover {
  background-color: rgba(239, 68, 68, 0.18);
  color: #ffffff;
  border-color: #ef4444;
}

.flash-cat-badge {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #71717a;
  background-color: #1a1a1e;
  padding: 4px 10px;
  border-radius: 99px;
  margin-top: 10px;
}
.flash-flip-btn {
  background-color: transparent;
  border: 0;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #a1a1aa;
  cursor: pointer;
  margin-top: 24px;
  padding: 6px 12px;
  border-radius: 8px;
  transition: all 0.2s;
}
.flash-flip-btn:hover {
  background-color: #1f1f23;
  color: #ffffff;
}

/* Success Spell passed state */
.flash-card-wrap.spell-passed .flash-front {
  border-color: #22c55e;
  background-color: #06200f;
  animation: celebrateGlow 0.8s;
}
@keyframes celebrateGlow {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
  100% { box-shadow: 0 0 30px 10px rgba(34, 197, 94, 0); }
}

.sentence-perfect-toast {
  position: fixed;
  left: 50%;
  top: max(116px, 15vh);
  z-index: 2100;
  transform: translate(-50%, 14px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  color: #facc15;
  font-family: var(--sans);
  font-size: clamp(1.75rem, 3.4vw, 3rem);
  font-weight: 900;
  font-style: italic;
  letter-spacing: 0;
  text-align: center;
  text-shadow: 0 0 18px rgba(250, 204, 21, 0.55), 0 0 44px rgba(250, 204, 21, 0.22);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.sentence-perfect-toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  animation: sentencePerfectPop 0.82s ease both;
}
@keyframes sentencePerfectPop {
  0% { opacity: 0; transform: translate(-50%, 18px) scale(0.9); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  62% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -8px) scale(0.98); }
}

.sentence-card {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  color: #e4e4e7;
}
.sentence-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-ui);
}
.sentence-word {
  border: 1px solid #27272a;
  background-color: #1f1f23;
  color: #ffffff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 800;
}
.sentence-mode-pill {
  color: #a1a1aa;
  font-size: 0.78rem;
  font-weight: 800;
}
.sentence-type-zone {
  width: 100%;
  min-height: 104px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: text;
}
.sentence-line {
  width: 100%;
  border: 0;
  background: transparent;
  color: #ffffff;
  font-family: var(--sans);
  font-size: clamp(1.35rem, 2.8vw, 1.78rem);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  cursor: text;
  pointer-events: none;
}
.sentence-line.dictation-line .sentence-char.pending:not(.masked) {
  color: #a1a1aa;
}
.sentence-char {
  display: inline-block;
  min-width: 0.38em;
  border-bottom: 2px solid #3f3f46;
  margin: 0 1px 5px;
}
.sentence-char.correct {
  color: #4ade80;
  border-bottom-color: rgba(74, 222, 128, 0.75);
}
.sentence-char.wrong {
  color: #f87171;
  border-bottom-color: rgba(248, 113, 113, 0.8);
  animation: shake 0.25s;
}
.sentence-char.pending {
  color: #e4e4e7;
}
.sentence-char.masked {
  color: transparent;
  border-bottom-color: #52525b;
}
.sentence-char.gap {
  min-width: 0.5em;
}
.sentence-char.skip {
  min-width: 0;
  border-bottom-color: transparent;
  color: #a1a1aa;
  margin-left: 1px;
}
.sentence-zh,
.sentence-target {
  color: #a1a1aa;
  text-align: center;
  font-family: var(--ipa);
  font-size: 1rem;
  line-height: 1.35;
}
.sentence-hidden-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: auto;
  cursor: text;
}
.sentence-picked,
.sentence-bank {
  min-height: 70px;
  border: 1px solid #27272a;
  border-radius: 14px;
  background-color: rgba(255,255,255,0.03);
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.sentence-bank {
  min-height: 92px;
}
.sentence-empty {
  color: #71717a;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 700;
}
.sentence-token {
  border: 1px solid #3f3f46;
  background-color: #1f1f23;
  color: #f4f4f5;
  border-radius: 10px;
  padding: 8px 12px;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s;
}
.sentence-token:hover {
  background-color: #27272a;
  transform: translateY(-1px);
}
.sentence-token.picked {
  border-color: rgba(74, 222, 128, 0.55);
  background-color: rgba(34, 197, 94, 0.12);
}
.sentence-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sentence-status {
  color: #71717a;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 800;
}
.sentence-actions button {
  border: 1px solid #27272a;
  background-color: #18181b;
  color: #e4e4e7;
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 800;
  cursor: pointer;
}
.sentence-actions button:hover {
  background-color: #27272a;
  color: #ffffff;
}

/* Back Face */
.flash-back {
  background-color: #121215;
  border: 1px solid #27272a;
  -webkit-transform: rotateY(180deg);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  overflow: hidden;
  padding: 24px 28px 24px;
}

/* Scroll Wrapper on back */
.flash-back-scroll-wrapper {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 2px;
}

/* Center Header for Word & IPA (Same Line!) */
.flash-back-header {
  text-align: center;
  margin-bottom: 6px;
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
}

.flash-back-title {
  background: transparent;
  border: 0;
  font-family: var(--serif);
  font-size: clamp(2.15rem, 6.4vw, 3.35rem);
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  line-height: 1;
  text-align: center;
}

.flash-back-title:hover {
  text-decoration: underline;
  opacity: 0.95;
}

.flash-back-ipa {
  font-family: var(--ipa);
  font-size: 1rem;
  color: #a1a1aa;
}

/* Content Body */
.flash-back-body {
  display: flex;
  flex-direction: column;
  gap: 10px; /* reduced from 16px */
  text-align: left;
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

.flash-back-zh-row {
  margin-bottom: 0px;
}

.flash-back-zh {
  font-family: var(--ipa);
  font-size: 1.15rem; /* reduced from 1.25rem */
  font-weight: 600;
  color: #ffffff;
  border-left: 3px solid var(--op);
  padding-left: 10px;
  line-height: 1.3;
}

/* Flash Back Item spacing & labels */
.flash-back-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.flash-back-label {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a; /* zinc-400 */
}

.flash-back-def-content {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.flash-back-en-text {
  font-size: 0.88rem; /* reduced from 0.92rem */
  color: #d4d4d8;
  line-height: 1.45;
  margin-top: 1px;
}

/* Example Sentence Card */
.flash-back-ex-card {
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 8px 12px; /* reduced from 12px 14px */
  display: flex;
  flex-direction: column;
  gap: 4px; /* reduced from 6px */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.flash-back-ex-en-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.flash-back-ex-en {
  font-size: 0.88rem; /* reduced from 0.9rem */
  color: #ffffff;
  font-weight: 500;
  line-height: 1.4;
  margin-top: 1px;
}

.flash-back-ex-zh {
  font-size: 0.82rem; /* reduced from 0.85rem */
  color: #a1a1aa;
  padding-left: 24px; /* align perfectly */
  line-height: 1.3;
}

/* Synonyms Pills */
.flash-back-syns-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0px;
}

.flash-back-syn {
  background-color: #1f1f23;
  border: 1px solid #27272a;
  border-radius: 8px;
  padding: 3px 8px; /* reduced from 4px 10px */
  font-family: var(--sans);
  font-size: 0.75rem; /* reduced from 0.78rem */
  color: #d4d4d8;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  white-space: nowrap;
}

.flash-back-syn:hover {
  background-color: #27272a;
  color: #ffffff;
  border-color: #3f3f46;
  transform: translateY(-1px);
}

.phonetics-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.phonetics-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 16px;
  border: 1px solid #27272a;
  border-radius: 999px;
  background-color: #1f1f23;
  color: #e4e4e7;
  font-family: var(--ipa);
  font-size: 1.05rem;
  line-height: 1.2;
  white-space: nowrap;
}

button.phonetics-chip {
  cursor: pointer;
}

button.phonetics-chip:hover {
  background-color: #27272a;
  border-color: #3f3f46;
  color: #ffffff;
}

.phonetics-step-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  align-self: start;
}

.phonetics-step-current {
  border: 1px solid #e4e4e7;
  background-color: #e4e4e7;
  color: #09090b;
  border-radius: 999px;
  padding: 7px 18px;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.1;
}

.phonetics-step-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  width: 100%;
  margin-bottom: 0;
}

.phonetics-step-dot {
  border: 1px solid #27272a;
  background-color: #18181b;
  color: #a1a1aa;
  border-radius: 999px;
  width: 9px;
  height: 9px;
  padding: 0;
  cursor: pointer;
  line-height: 0;
}

.phonetics-step-dot.active {
  background-color: #e4e4e7;
  border-color: #e4e4e7;
  color: #09090b;
}

.phonetics-step-panel {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 100%;
}

.phonetics-mouth-media {
  width: 100%;
  max-width: 650px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, 0.8fr);
  gap: 12px;
  align-items: stretch;
}

.phonetics-mouth-video,
.phonetics-mouth-image {
  width: 100%;
  height: 150px;
  border: 1px solid #27272a;
  border-radius: 14px;
  background-color: #09090b;
  object-fit: cover;
  display: block;
}

.phonetics-mouth-video {
  object-fit: contain;
}

.phonetics-mouth-step .phonetics-step-copy {
  max-width: 720px;
  font-size: 1rem;
  line-height: 1.48;
}

.phonetics-combo-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-width: 660px;
  overflow-x: hidden;
}

.phonetics-combo-card {
  min-height: 50px;
  border: 1px solid #27272a;
  border-radius: 12px;
  background-color: #1b1b1f;
  padding: 5px 9px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 6px;
}

.phonetics-combo-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
  justify-self: center;
  width: min(100%, 260px);
  min-width: 0;
}

.phonetics-combo-key {
  min-width: 34px;
  height: 32px;
  border-radius: 10px;
  background-color: #27272a;
  color: #e4e4e7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--ipa);
  font-size: 0.94rem;
  font-weight: 800;
}

.phonetics-combo-words {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

button.phonetics-combo-word.speak {
  width: 100%;
  min-width: 0;
  min-height: 21px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d8d8dc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 1px 1px;
  font-family: var(--ipa);
  font-size: 0.82rem;
  line-height: 1.1;
  text-align: left;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
}

button.phonetics-combo-word.speak .phonetics-combo-word-text {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.phonetics-combo-word.speak .phonetics-mini-play {
  margin-left: 2px;
}

button.phonetics-combo-word.speak:hover {
  background-color: #27272a;
  color: #ffffff;
}

.phonetics-combo-word mark {
  background: transparent;
  color: #2cc36b;
  font-weight: 800;
}

.phonetics-mini-play {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background-color: rgba(239, 166, 172, 0.95);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.phonetics-mini-play svg {
  width: 9px;
  height: 9px;
  margin-left: 1px;
}

.phonetics-step-title {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffffff;
}

.phonetics-step-copy {
  margin: 0;
  color: #d4d4d8;
  font-size: 1.2rem;
  line-height: 1.6;
  text-align: center;
}

.phonetics-step-copy.compact {
  font-size: 0.98rem;
  color: #a1a1aa;
}

.phonetics-step-content {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 2px 10px;
}

.phonetics-mouth-step .phonetics-step-content {
  align-items: stretch;
  overflow: visible;
}

.phonetics-first-step .phonetics-step-content {
  overflow: visible;
  padding: 0;
}

.phonetics-mouth-step .phonetics-step-panel {
  justify-content: center;
  gap: 12px;
}

.phonetics-combos-step .flash-phonetics-ex-row {
  gap: 10px;
}

.phonetics-combos-step .phonetics-step-content {
  align-items: flex-start;
  padding: 0 8px;
}

.phonetics-combos-step .phonetics-step-panel {
  justify-content: flex-start;
  gap: 0;
}

.phonetics-sentences-step .flash-phonetics-ex-row {
  gap: 10px;
}

.phonetics-sentences-step .phonetics-step-content {
  align-items: flex-start;
  padding: 0 8px;
}

.phonetics-sentences-step .phonetics-step-panel {
  justify-content: flex-start;
  gap: 0;
}

.phonetics-practice-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.phonetics-practice-list.dense {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.phonetics-practice-list.wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 720px;
}

button.phonetics-practice-card.speak {
  border: 1px solid #27272a;
  background: #1f1f23;
  background-color: #1f1f23;
  color: #e4e4e7;
  border-radius: 14px;
  min-height: 66px;
  padding: 9px 52px 9px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  font-family: var(--sans);
  cursor: pointer;
  position: relative;
  text-align: left;
}

.phonetics-first-step button.phonetics-practice-card.speak {
  min-height: 46px;
  border-radius: 12px;
  padding: 6px 30px 6px 10px;
}

.phonetics-first-step .phonetics-step-panel {
  max-width: 860px;
  min-height: auto;
}

.phonetics-first-step .phonetics-practice-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.phonetics-first-step .phonetics-practice-text {
  font-size: 0.92rem;
  white-space: nowrap;
}

.phonetics-practice-list.dense .phonetics-practice-text {
  font-size: 1.05rem;
  white-space: nowrap;
}

.phonetics-practice-list.dense button.phonetics-practice-card.speak {
  min-height: 54px;
  border-radius: 12px;
  padding: 7px 32px 7px 10px;
}

.phonetics-practice-list.dense .phonetics-practice-play {
  right: 7px;
  width: 24px;
  height: 24px;
}

.phonetics-practice-list.dense .phonetics-practice-play svg {
  width: 12px;
  height: 12px;
}

.phonetics-first-step .phonetics-practice-play {
  right: 6px;
  width: 22px;
  height: 22px;
}

.phonetics-first-step .phonetics-practice-play svg {
  width: 12px;
  height: 12px;
}

.phonetics-practice-text {
  font-family: var(--ipa);
  font-size: 1.5rem;
  line-height: 1.2;
  color: #d8d8dc;
  overflow-wrap: anywhere;
}

.phonetics-practice-text mark {
  background: transparent;
  color: #2cc36b;
  font-weight: 800;
}

.phonetics-practice-zh {
  color: #a1a1aa;
  font-size: 0.82rem;
  line-height: 1.25;
}

.phonetics-practice-play {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(239, 166, 172, 0.95);
  color: #ffffff;
}

.phonetics-practice-play svg {
  width: 15px;
  height: 15px;
  margin-left: 2px;
}

button.phonetics-practice-card.phrases.speak,
button.phonetics-practice-card.sentences.speak {
  min-height: 74px;
  align-items: center;
  text-align: center;
  padding: 8px 48px;
}

.phonetics-practice-card.phrases .phonetics-practice-text,
.phonetics-practice-card.sentences .phonetics-practice-text {
  font-size: 1.24rem;
}

.phonetics-practice-card.phrases .phonetics-practice-zh,
.phonetics-practice-card.sentences .phonetics-practice-zh {
  font-size: 0.86rem;
}

button.phonetics-practice-card.sentences.speak {
  grid-column: 1 / -1;
  min-height: 66px;
  border-radius: 12px;
  padding: 7px 46px 7px 18px;
}

button.phonetics-practice-card.sentences.speak .phonetics-practice-text {
  font-size: 1.08rem;
  line-height: 1.18;
}

.phonetics-practice-card.sentences .phonetics-practice-zh {
  font-size: 0.78rem;
  line-height: 1.12;
}

.phonetics-practice-card.sentences .phonetics-practice-play {
  right: 10px;
  width: 26px;
  height: 26px;
}

.phonetics-practice-card.sentences .phonetics-practice-play svg {
  width: 13px;
  height: 13px;
}

@media (max-width: 560px) {
  .flash-card-wrap.phonetics-step-mode .flash-front {
    padding: 28px 22px 22px;
  }

  .flash-card-wrap.phonetics-step-mode .flash-phonetics-ex-row {
    gap: 10px;
  }

  .phonetics-step-nav {
    gap: 7px;
  }

  .phonetics-step-current {
    padding: 6px 16px;
    font-size: 0.84rem;
  }

  .phonetics-step-dots {
    gap: 6px;
  }

  .phonetics-step-content {
    padding: 0 4px;
  }

  .phonetics-practice-list.wide {
    gap: 8px;
  }

  .phonetics-practice-list.dense {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phonetics-first-step .phonetics-practice-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .phonetics-combo-grid {
    gap: 6px;
    max-width: 100%;
  }

  .phonetics-combo-card {
    min-height: 46px;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 5px;
    padding: 5px 7px;
    border-radius: 12px;
  }

  .phonetics-combo-key {
    min-width: 30px;
    height: 30px;
    border-radius: 10px;
    font-size: 0.88rem;
  }

  button.phonetics-combo-word.speak {
    min-height: 20px;
    padding: 1px 0;
    font-size: 0.74rem;
    gap: 2px;
  }

  .phonetics-mini-play {
    width: 16px;
    height: 16px;
  }

  button.phonetics-practice-card.phrases.speak {
    min-height: 56px;
    border-radius: 12px;
    padding: 6px 34px 6px 10px;
    gap: 1px;
  }

  .phonetics-practice-card.phrases .phonetics-practice-text {
    font-size: 1rem;
    line-height: 1.08;
    overflow-wrap: normal;
    word-break: normal;
  }

  .phonetics-practice-card.phrases .phonetics-practice-zh {
    font-size: 0.72rem;
    line-height: 1.1;
  }

  .phonetics-practice-card.phrases .phonetics-practice-play {
    right: 8px;
    width: 24px;
    height: 24px;
  }

  .phonetics-practice-card.phrases .phonetics-practice-play svg {
    width: 12px;
    height: 12px;
  }

  .phonetics-sentences-step .flash-phonetics-ex-row {
    gap: 8px;
  }

  button.phonetics-practice-card.sentences.speak {
    min-height: 58px;
    border-radius: 12px;
    padding: 6px 34px 6px 10px;
  }

  button.phonetics-practice-card.sentences.speak .phonetics-practice-text {
    font-size: 0.96rem;
    line-height: 1.12;
  }

  .phonetics-practice-card.sentences .phonetics-practice-zh {
    font-size: 0.7rem;
    line-height: 1.08;
  }

  .phonetics-practice-card.sentences .phonetics-practice-play {
    right: 8px;
    width: 24px;
    height: 24px;
  }

  .phonetics-practice-card.sentences .phonetics-practice-play svg {
    width: 12px;
    height: 12px;
  }

  .phonetics-step-actions button {
    padding: 8px 22px;
    font-size: 0.84rem;
  }
}

button.phonetics-practice-card.speak:hover {
  background: #27272a;
  background-color: #27272a;
  color: #ffffff;
}

button.phonetics-practice-card.speak.playing,
button.phonetics-combo-word.speak.playing {
  animation: none;
  transform: none;
  border-color: #27272a;
  background: #1f1f23;
  background-color: #1f1f23;
  color: #e4e4e7;
  box-shadow: none;
}

button.phonetics-practice-card.speak.playing .phonetics-practice-play,
button.phonetics-combo-word.speak.playing .phonetics-mini-play {
  box-shadow: 0 0 0 3px rgba(239, 166, 172, 0.18);
}

.phonetics-step-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  width: 100%;
  margin-top: 0;
  align-self: end;
}

.phonetics-step-actions button {
  border: 1px solid #27272a;
  background-color: #18181b;
  color: #e4e4e7;
  border-radius: 999px;
  padding: 9px 24px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  line-height: 1.1;
}

.phonetics-step-actions button:hover:not(:disabled) {
  background-color: #27272a;
  color: #ffffff;
}

.phonetics-step-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Flip Back Button */
.flash-back-flip {
  align-self: center;
  background-color: transparent;
  border: 1px solid #27272a;
  color: #a1a1aa;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  cursor: pointer;
  margin-top: 12px;
  padding: 8px 18px;
  border-radius: 8px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.flash-back-flip:hover {
  background-color: #1f1f23;
  color: #ffffff;
  border-color: #3f3f46;
}

/* Flash Navigation Controls */
.flash-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  background-color: #09090b;
}
.flash-nav-btn {
  height: 44px;
  border-radius: 12px;
  border: 1px solid #27272a;
  background-color: #121215;
  color: #e4e4e7;
  padding: 0 20px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}
.flash-nav-btn:hover {
  background-color: #1f1f23;
  color: #ffffff;
}
.flash-counter {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  color: #71717a;
  font-variant-numeric: tabular-nums;
}
.flash-hint-key {
  min-height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.98rem;
  font-weight: 800;
  color: #a1a1aa;
  text-align: center;
  padding: 0 24px 24px;
  background-color: #09090b;
  font-family: var(--font-ui);
}
.flash-hint-actions,
.flash-hint-shortcuts {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 24px;
}
.flash-hint-actions button {
  height: 38px;
  border: 1px solid #3f3f46;
  border-radius: 999px;
  background: #18181b;
  color: #f4f4f5;
  padding: 0 18px;
  font-family: var(--font-ui);
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
}
.flash-hint-actions button:hover {
  background: #27272a;
}
.flash-shortcut-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.flash-hint-key kbd {
  min-width: 38px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid #3f3f46;
  border-bottom-color: #52525b;
  border-radius: 8px;
  background-color: #18181b;
  color: #f4f4f5;
  box-shadow: inset 0 -2px 0 rgba(255,255,255,0.04);
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
}

/* ==================== FOOTER ==================== */
footer {
  text-align: center;
  padding: 40px 24px;
  border-top: 1px solid var(--line);
  max-width: 1200px;
  margin: 60px auto 0;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ==================== USER AREA ==================== */
.user-area { display: flex; align-items: center; gap: 8px; }
.btn-login {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--ink-soft); font-family: var(--font-ui);
  font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all 0.2s;
}
.btn-login:hover { border-color: var(--op); color: var(--op); }
.btn-login svg { width: 16px; height: 16px; }
.user-info { display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--line); }
.user-name { font-family: var(--font-ui); font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.user-vip {
  font-size: 0.65rem; font-weight: 800; padding: 2px 6px; border-radius: 4px;
  background: #facc15; color: #854d0e; letter-spacing: 0.05em;
}
.btn-vip {
  font-size: 0.72rem; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--op); background: var(--op-bg);
  color: var(--op); font-weight: 700; cursor: pointer; transition: all 0.2s;
}
.btn-vip:hover { background: var(--op); color: #fff; }
.btn-logout {
  font-size: 0.72rem; padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--line); background: transparent;
  color: var(--ink-faint); cursor: pointer; transition: all 0.15s;
}
.btn-logout:hover { color: #ef4444; border-color: #ef4444; }

/* ==================== LOGIN MODAL ==================== */
.js-modal-mask {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  background: rgba(15,23,42,.45); backdrop-filter: blur(8px);
}
.js-modal-mask.is-open { display: flex; }
.js-modal-card {
  position: relative; width: 340px; max-width: calc(100vw - 32px);
  padding: 32px 28px 28px; border-radius: 22px;
  background: var(--bg-elev); box-shadow: 0 26px 70px rgba(15,23,42,.26);
  text-align: center; color: var(--ink);
}
.js-modal-close {
  position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--ink-faint); font-size: 24px; line-height: 1; cursor: pointer;
}
.js-modal-title { font-family: var(--font-ui); font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.js-modal-sub { font-size: 0.82rem; color: var(--ink-faint); margin-bottom: 20px; }
.js-memory-card { width: 380px; padding: 34px 30px 28px; }
.js-memory-copy {
  max-width: 280px;
  margin: 8px auto 22px;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.js-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}
.js-modal-btn {
  min-width: 98px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 18px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s ease;
}
.js-modal-btn.primary {
  border-color: var(--ink);
  background-color: var(--ink);
  color: var(--bg);
}
.js-modal-btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.js-modal-btn.secondary {
  background-color: var(--bg-elev);
  color: var(--ink-soft);
}
.js-modal-btn.secondary:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
  background-color: var(--line-soft);
}
.js-qr-wrap { width: 200px; height: 200px; margin: 0 auto; background: #f8f8f8; border-radius: 12px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.js-qr-wrap img { width: 100%; height: 100%; }
.js-qr-loading { color: var(--ink-faint); font-size: 0.85rem; }
.js-qr-hint { margin-top: 14px; font-size: 0.78rem; color: var(--ink-faint); }

/* ==================== PAYMENT MODAL ==================== */
.js-pay-modal-mask {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  background: rgba(15,23,42,.38); backdrop-filter: blur(8px);
}
.js-pay-modal-mask.is-open { display: flex; }
.js-pay-card {
  position: relative; width: 360px; max-width: calc(100vw - 24px);
  box-sizing: border-box; padding: 28px 34px 30px; border-radius: 26px;
  background: #fff; box-shadow: 0 26px 70px rgba(15,23,42,.26);
  text-align: center; color: #3f3f46;
}
.js-pay-close {
  position: absolute; top: 20px; right: 18px; width: 34px; height: 34px;
  border: 0; border-radius: 50%; background: transparent; color: #3f3f46;
  font-size: 30px; line-height: 1; cursor: pointer;
}
.js-pay-title { display: inline-flex; align-items: center; gap: 10px; min-height: 38px; font-size: 24px; font-weight: 400; color: #4a4a4a; }
.js-pay-wechat { width: 34px; height: 34px; border-radius: 50%; background: #46a948; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 24px; }
.js-pay-scan { margin-top: 22px; font-size: 20px; line-height: 1.2; }
.js-pay-amount { margin-top: 16px; font-size: 40px; line-height: 1; font-weight: 800; }
.js-pay-iframe-wrap { width: 224px; height: 238px; margin: 30px auto 0; overflow: hidden; position: relative; background: transparent; }
.js-pay-iframe { width: 400px; height: 560px; border: 0; background: #fff; transform: translate(-88px,-250px) scale(1); transform-origin: top left; }
.js-pay-loading { height: 238px; display: flex; align-items: center; justify-content: center; color: #888; font-size: 14px; }
.js-pay-expire { margin-top: 28px; font-size: 16px; line-height: 1.5; color: #888; }

/* ==================== FLOATING USER BUTTON ==================== */
.float-user {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle-float {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background-color: var(--bg-elev);
  color: var(--ink-soft);
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-toggle-float:hover {
  border-color: var(--ink-faint);
  color: var(--ink);
}
.float-user-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--ink-soft); display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all 0.2s;
  box-shadow: var(--shadow);
}
.float-user-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.float-user-btn svg { width: 18px; height: 18px; }
.float-user-menu {
  position: absolute; top: 48px; right: 0; width: 200px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-hover);
  padding: 10px; display: flex; flex-direction: column; gap: 4px;
}
.float-user-menu[hidden] { display: none; }
.float-user-menu button {
  width: 100%; text-align: left; padding: 10px 14px; border: 0;
  border-radius: 10px; background: transparent; font-family: var(--sans);
  font-size: 0.88rem; color: var(--ink); cursor: pointer; transition: all 0.15s;
}
.float-user-menu button:hover { background: var(--line-soft); }
.float-user-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.float-user-head img { width: 36px; height: 36px; border-radius: 50%; background: var(--line); }
.fu-name { font-size: 0.9rem; font-weight: 600; color: var(--ink); }
.fu-vip { font-size: 0.7rem; color: #b45309; font-weight: 700; }

/* OLD USER AREA (remove) */
.user-area, .btn-login, .user-info, .user-avatar, .user-name, .user-vip, .btn-vip, .btn-logout { display: none !important; }

.float-user-logged { display: flex; flex-direction: column; gap: 4px; }
.float-user-guest { display: flex; flex-direction: column; gap: 4px; }

/* ==================== BACK TO TOP ==================== */
.btn-back-top {
  position: fixed; bottom: 24px; right: 16px; z-index: 150;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--ink-soft); display: flex; align-items: center;
  justify-content: center; cursor: pointer; transition: all 0.25s;
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(8px);
}
.btn-back-top.visible {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.btn-back-top:hover { border-color: var(--ink-faint); color: var(--ink); transform: translateY(-2px); }
.btn-back-top.visible:hover { transform: translateY(-2px); }
.btn-back-top svg { width: 18px; height: 18px; }

/* ==================== AVATAR PICKER ==================== */
.avatar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.avatar-item { width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; cursor: pointer; border: 3px solid transparent; transition: all 0.15s; }
.avatar-item:hover { border-color: var(--line); transform: scale(1.05); }
.avatar-item.selected { border-color: var(--op); box-shadow: 0 0 0 3px var(--op-bg); }
.avatar-item img { width: 100%; height: 100%; object-fit: cover; }
.flash-front-zh { font-family: var(--ipa); font-size: 1.1rem; color: #a1a1aa; margin-bottom: 8px; text-align: center; }

@media (max-width: 640px) {
  main {
    margin-top: 18px;
    padding: 0 16px;
  }

  .section-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 4px 12px;
  }

  .section-header h2 {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.75rem;
    line-height: 1;
  }

  .section-header .zh {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.96rem;
    line-height: 1.35;
    max-width: 100%;
  }

  .section-header .count {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin-left: 0;
    align-self: center;
    text-align: right;
  }

  .float-user {
    top: 11px;
    right: 18px;
    gap: 6px;
  }

  .theme-toggle-float {
    width: 36px;
    height: 32px;
  }

  .float-user-btn {
    width: 36px;
    height: 36px;
  }
}
