:root {
  --bg: #eef2f9;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --surface-alt: #f4f7fc;
  --stage-bg: linear-gradient(145deg, #101b33 0%, #1a2847 52%, #0b1326 100%);
  --stage-text: #f8fafc;
  --stage-muted: #94a3b8;
  --text: #0f172a;
  --text-muted: #475569;
  --border: rgba(148, 163, 184, 0.28);
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.11);
  --pro-gradient: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --success: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

html.dark {
  --bg: #070c17;
  --surface: rgba(17, 24, 39, 0.88);
  --surface-solid: #111827;
  --surface-alt: #182234;
  --stage-bg: linear-gradient(145deg, #070b14 0%, #111b32 55%, #080f1f 100%);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.18);
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input {
  touch-action: manipulation;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 10%, rgba(37, 99, 235, 0.14), transparent 36%),
    radial-gradient(circle at 88% 16%, rgba(6, 182, 212, 0.12), transparent 34%),
    radial-gradient(circle at 50% 92%, rgba(245, 158, 11, 0.08), transparent 40%);
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 28px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Topbar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.25);
  flex-shrink: 0;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.plan-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.plan-badge.plan-free {
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.plan-badge.plan-pro {
  background: var(--pro-gradient);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.35);
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pill-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.15s, border-color 0.15s;
}

.pill-cta:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.pill-install {
  background: rgba(6, 182, 212, 0.12);
  border-color: rgba(6, 182, 212, 0.36);
  color: #0284c7;
}

html.dark .pill-install {
  color: #67e8f9;
}

.pill-pro {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(234, 88, 12, 0.14));
  border-color: rgba(245, 158, 11, 0.4);
  color: #b45309;
}

html.dark .pill-pro {
  color: #fcd34d;
}

.pill-account {
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.32);
  color: var(--accent);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #94a3b8;
  display: inline-block;
  flex-shrink: 0;
}

.sync-dot.synced {
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22);
}

.sync-dot.syncing {
  background: #f59e0b;
  animation: pulseDot 1s infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.stats-pill,
.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.stats-pill strong {
  color: var(--accent);
}

.timer-pill select {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.countdown-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--warn);
  background: rgba(217, 119, 6, 0.14);
  padding: 4px 10px;
  border-radius: 999px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.15s;
}

.icon-btn:hover {
  background: var(--accent-soft);
}

/* Main Workspace */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 18px;
  align-items: start;
}

@media (max-width: 1020px) {
  .workspace {
    grid-template-columns: 1fr;
  }
}

.deck-panel,
.library-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.tts-warning {
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.35);
  color: var(--warn);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* Stage Card */
.stage-card {
  position: relative;
  overflow: hidden;
  background: var(--stage-bg);
  color: var(--stage-text);
  border-radius: 16px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.stage-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.28) 0%, transparent 70%);
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s;
  opacity: 0.55;
}

.stage-card.is-playing .stage-glow {
  opacity: 0.95;
  transform: scale(1.18);
}

.stage-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.stage-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge-num {
  background: rgba(59, 130, 246, 0.28);
  color: #bfdbfe;
  font-variant-numeric: tabular-nums;
}

.badge-cat {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

.badge-rep {
  background: rgba(16, 185, 129, 0.22);
  color: #a7f3d0;
  font-variant-numeric: tabular-nums;
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--stage-muted);
}

.wave-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
}

.wave-bars i {
  display: block;
  width: 3px;
  height: 4px;
  border-radius: 2px;
  background: #60a5fa;
  transition: height 0.2s;
}

.wave-bars.active i {
  animation: wavePulse 0.8s ease-in-out infinite;
}

.wave-bars.active i:nth-child(2) { animation-delay: 0.15s; }
.wave-bars.active i:nth-child(3) { animation-delay: 0.3s; }
.wave-bars.active i:nth-child(4) { animation-delay: 0.45s; }

.wave-bars.paused i {
  background: #fbbf24;
  height: 6px;
}

@keyframes wavePulse {
  0%, 100% { height: 4px; }
  50% { height: 14px; }
}

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

.pattern-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.14);
  padding: 2px 8px;
  border-radius: 6px;
}

.pattern-text {
  font-size: 14px;
  font-weight: 600;
  color: #fde68a;
}

.sentence-en-wrap {
  min-height: 76px;
  display: flex;
  align-items: center;
  cursor: pointer;
  border-radius: 10px;
  padding: 6px 4px;
  transition: background 0.15s;
}

.sentence-en-wrap:hover {
  background: rgba(255, 255, 255, 0.04);
}

.sentence-en {
  margin: 0;
  font-size: clamp(21px, 2.3vw, 28px);
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: -0.01em;
  color: #ffffff;
  transition: filter 0.2s, opacity 0.2s;
}

.sentence-zh-wrap {
  min-height: 36px;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
}

.sentence-zh {
  margin: 0;
  font-size: 16px;
  color: #cbd5e1;
  transition: filter 0.2s, opacity 0.2s;
}

.masked-text {
  filter: blur(8px);
  opacity: 0.45;
  user-select: none;
}

.masked-text.peek {
  filter: none;
  opacity: 0.95;
}

.stage-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.mask-toggles,
.mark-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.chip-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.chip-btn.active {
  background: rgba(59, 130, 246, 0.35);
  border-color: #60a5fa;
  color: #ffffff;
}

.chip-btn.fav-active {
  background: rgba(245, 158, 11, 0.28);
  border-color: #fbbf24;
  color: #fde68a;
}

.chip-btn.master-active {
  background: rgba(16, 185, 129, 0.28);
  border-color: #34d399;
  color: #a7f3d0;
}

/* Transport Controls */
.transport-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.ctrl-btn {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.ctrl-btn:hover {
  background: var(--accent-soft);
}

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

.ctrl-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

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

.ctrl-primary.playing {
  background: #d97706;
  border-color: #d97706;
}

/* A-B Bar */
.ab-bar {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.jump-group,
.ab-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ab-bar input[type="number"] {
  width: 62px;
  padding: 4px 6px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  text-align: center;
}

.small-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.small-btn:hover {
  background: var(--accent-soft);
}

.toggle-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Settings Grid */
.settings-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 560px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .setting-span-2 {
    grid-column: span 1 !important;
  }
}

.setting-span-2 {
  grid-column: span 2;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.setting-item label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.setting-item select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

/* Library Panel */
.library-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: calc(100vh - 122px);
  min-height: 540px;
}

@media (max-width: 1020px) {
  .library-panel {
    height: 600px;
  }
}

.library-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-row input[type="search"] {
  flex: 1;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.search-row input[type="search"]:focus {
  border-color: var(--accent);
}

.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cat-tab {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.14s;
}

.cat-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.cat-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.library-subbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.progress-actions {
  display: flex;
  gap: 12px;
}

.link-btn {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.link-btn.danger {
  color: var(--danger);
}

/* Sentence List */
.sentence-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.sentence-row {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sentence-row:hover {
  border-color: var(--accent);
}

.sentence-row.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.sentence-row.mastered {
  opacity: 0.78;
}

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

.row-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.row-id {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.row-pat {
  background: rgba(100, 116, 139, 0.14);
  padding: 1px 6px;
  border-radius: 5px;
}

.row-en {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.row-zh {
  font-size: 13px;
  color: var(--text-muted);
}

.row-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.mini-action {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mini-action.fav-on {
  color: #d97706;
  border-color: #f59e0b;
}

.mini-action.master-on {
  color: #059669;
  border-color: #10b981;
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

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

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.shortcut-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shortcut-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--surface-alt);
}

kbd {
  display: inline-block;
  padding: 2px 7px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
}

.modal-tip {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--accent-soft);
  padding: 10px 12px;
  border-radius: 9px;
}


/* Speed & Score Stage Badges */
.badge-speed {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
  font-variant-numeric: tabular-nums;
}

.badge-score {
  background: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
  font-variant-numeric: tabular-nums;
}

.badge-score.grade-S,
.badge-score.grade-A {
  background: rgba(16, 185, 129, 0.28);
  color: #a7f3d0;
}

.badge-score.grade-B {
  background: rgba(59, 130, 246, 0.3);
  color: #bfdbfe;
}

.badge-score.grade-C,
.badge-score.grade-D {
  background: rgba(239, 68, 68, 0.28);
  color: #fecaca;
}

/* Multi-Speed Control Bar */
.speed-bar {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.speed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.speed-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.speed-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.speed-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: all 0.14s;
}

.speed-chip:hover {
  border-color: var(--accent);
  color: var(--text);
}

.speed-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.speed-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-bound {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.speed-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}

.rate-value-badge {
  min-width: 54px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* Pronunciation Practice & Scoring Studio */
.practice-card {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.practice-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.practice-title-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
}

.practice-title-wrap h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.practice-best {
  font-size: 12px;
  color: var(--text-muted);
}

.auto-master-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.protocol-tip,
.practice-warning {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.32);
  color: var(--warn);
}

.protocol-tip code {
  background: rgba(15, 23, 42, 0.12);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.practice-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
}

@media (max-width: 720px) {
  .practice-actions {
    grid-template-columns: repeat(2, 1fr);
  }
  .p-btn-record {
    grid-column: span 2;
    order: -1;
  }
}

.p-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 9px;
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.p-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.p-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.p-btn-record {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

.p-btn-record:hover:not(:disabled) {
  background: #047857;
  border-color: #047857;
}

.p-btn-record.recording {
  background: #dc2626;
  border-color: #dc2626;
  animation: recordPulse 1.2s ease-in-out infinite;
}

@keyframes recordPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
}

.mic-monitor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mic-meter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mic-state-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--danger);
}

.mic-meter-track {
  flex: 1;
  max-width: 180px;
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.mic-meter-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #f59e0b, #ef4444);
  transition: width 0.08s linear;
}

.live-transcript {
  font-size: 13px;
  color: var(--text-muted);
  min-height: 20px;
  font-style: italic;
}

/* Score Result Card */
.score-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.score-overview {
  display: flex;
  align-items: center;
  gap: 14px;
}

.score-circle {
  width: 74px;
  height: 74px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 4px solid var(--accent);
  background: var(--accent-soft);
}

.score-circle.grade-S,
.score-circle.grade-A {
  border-color: var(--success);
  background: rgba(5, 150, 105, 0.12);
}

.score-circle.grade-B {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.score-circle.grade-C {
  border-color: var(--warn);
  background: rgba(217, 119, 6, 0.12);
}

.score-circle.grade-D {
  border-color: var(--danger);
  background: rgba(220, 38, 38, 0.12);
}

.score-num {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.score-grade {
  font-size: 11px;
  font-weight: 700;
  opacity: 0.85;
  margin-top: 2px;
}

.score-summary {
  flex: 1;
  min-width: 0;
}

.score-feedback-title {
  font-size: 14px;
  font-weight: 700;
}

.score-feedback-tip {
  margin: 2px 0 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.subscores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.subscore-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.subscore-item strong {
  color: var(--text);
}

.sub-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.sub-bar i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.35s ease;
}

.word-breakdown-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.word-breakdown-head {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

.word-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.word-chip {
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.15s;
}

.word-chip:hover {
  transform: translateY(-1px);
}

.word-chip.word-correct {
  background: rgba(5, 150, 105, 0.14);
  border-color: rgba(5, 150, 105, 0.35);
  color: var(--success);
}

.word-chip.word-close {
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.4);
  color: var(--warn);
}

.word-chip.word-wrong,
.word-chip.word-missed {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
}

.word-chip.word-neutral {
  background: var(--surface-alt);
  border-color: var(--border);
  color: var(--text);
}

.recognized-line {
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}

.rec-text {
  color: var(--text);
}

/* Row Score Pill & Quick Buttons */
.row-score-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(5, 150, 105, 0.14);
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.row-score-pill.low {
  background: rgba(217, 119, 6, 0.15);
  color: var(--warn);
}

.row-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 28px);
  gap: 4px;
}

/* =========================================================
   Retention Strip, Auth Modals, Pro Pricing & Toasts (v2)
   ========================================================= */
.retention-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
}

.daily-goal-box {
  display: flex;
  align-items: center;
  gap: 10px;
}

.daily-ring {
  width: 38px;
  height: 38px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.daily-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 3.5;
}

.daily-ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.35s ease, stroke 0.25s;
}

.daily-ring-fg.goal-done {
  stroke: var(--success);
}

.daily-goal-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.daily-goal-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.daily-goal-value {
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.daily-goal-select {
  border: 1px solid var(--border);
  background: var(--surface-solid);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 3px 6px;
  font-size: 11.5px;
  cursor: pointer;
}

.retention-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.metric-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.metric-chip strong {
  color: var(--text);
}

.metric-btn {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.metric-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.guest-sync-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.11), rgba(6, 182, 212, 0.1));
  border: 1px solid rgba(37, 99, 235, 0.28);
  font-size: 12.5px;
}

.guest-sync-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.primary-mini {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #ffffff !important;
}

.icon-mini-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 6px;
}

/* Auth & Profile Modals */
.modal-card-auth {
  max-width: 440px;
}

.modal-card-wide {
  max-width: 720px;
}

.auth-benefit-box {
  background: var(--accent-soft);
  border: 1px solid rgba(37, 99, 235, 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--text);
  margin-bottom: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.auth-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
}

.auth-tab.active {
  background: var(--surface-solid);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.auth-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.auth-field input,
.promo-row input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.auth-field input:focus,
.promo-row input:focus {
  border-color: var(--accent);
}

.auth-error {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: var(--danger);
  font-size: 12.5px;
}

.auth-submit-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.auth-submit-btn:hover {
  background: var(--accent-hover);
}

.auth-submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  margin-bottom: 14px;
}

.profile-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-email {
  font-size: 12.5px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-sync-meta {
  font-size: 11.5px;
  color: var(--success);
  margin-top: 3px;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.promo-redeem-box {
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.promo-redeem-box label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.promo-row {
  display: flex;
  gap: 8px;
}

.promo-feedback {
  font-size: 12px;
  color: var(--success);
}

.promo-feedback.error {
  color: var(--danger);
}

/* Pricing Grid */
.upgrade-intro {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-muted);
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 640px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
}

.pricing-card {
  border: 1px solid var(--border);
  background: var(--surface-alt);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-card-pro {
  border-color: rgba(245, 158, 11, 0.55);
  background: linear-gradient(160deg, rgba(245, 158, 11, 0.08), rgba(37, 99, 235, 0.06));
}

.pricing-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pricing-badge.pro-tag {
  background: var(--pro-gradient);
  color: #ffffff;
  border: none;
}

.pricing-card h3 {
  margin: 0;
  font-size: 16px;
}

.pricing-price {
  font-size: 26px;
  font-weight: 800;
}

.pricing-price span,
.pricing-price small {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.pricing-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
}

/* Install Guide & Achievements */
.install-native-box {
  margin-bottom: 12px;
}

.install-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.install-step {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 12.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 560px) {
  .achievements-grid {
    grid-template-columns: 1fr;
  }
}

.ach-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  opacity: 0.52;
  transition: opacity 0.2s, border-color 0.2s;
}

.ach-card.unlocked {
  opacity: 1;
  border-color: rgba(5, 150, 105, 0.45);
  background: rgba(5, 150, 105, 0.08);
}

.ach-icon {
  font-size: 24px;
  line-height: 1;
}

.ach-meta strong {
  display: block;
  font-size: 13px;
}

.ach-meta span {
  font-size: 11.5px;
  color: var(--text-muted);
}

.achievements-footer {
  display: flex;
  justify-content: flex-end;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.28);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  animation: toastIn 0.22s ease;
}

.site-legal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 2px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

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

.footer-links a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Mobile-only elements hidden on desktop */
@media (min-width: 861px) {
  .mobile-bottom-nav,
  .mobile-mini-player,
  .mobile-swipe-hint,
  .mobile-quick-settings,
  .mobile-settings-tips {
    display: none !important;
  }
}

/* =========================================================
   Mobile-First App Mode (<= 860px)
   ========================================================= */
@media (max-width: 860px) {
  .app-shell {
    padding: 10px 12px calc(76px + env(safe-area-inset-bottom));
    gap: 10px;
    overflow-x: clip;
  }

  body.has-mini-player .app-shell {
    padding-bottom: calc(146px + env(safe-area-inset-bottom));
  }

  /* Compact Two-Row Mobile Topbar */
  .topbar {
    padding: 10px 12px;
    gap: 8px;
    border-radius: 12px;
  }

  .brand {
    gap: 8px;
  }

  .brand-icon {
    font-size: 22px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .subtitle {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .stats-pill {
    order: 10;
    width: 100%;
    justify-content: center;
    padding: 5px 10px;
    font-size: 12px;
    gap: 5px;
    flex-wrap: wrap;
  }

  .timer-pill {
    flex: 1;
    justify-content: center;
    padding: 5px 10px;
    font-size: 13px;
    min-height: 36px;
  }

  .timer-pill select {
    font-size: 14px;
  }

  .icon-btn {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
  }

  /* Prevent iOS Safari input auto-zoom (<16px) & improve touch targets */
  input,
  select {
    font-size: 16px !important;
  }

  .workspace {
    gap: 10px;
  }

  .deck-panel,
  .library-panel {
    padding: 12px;
    border-radius: 12px;
  }

  /* Tab-based panel switching on mobile */
  body[data-mobile-tab="player"] .practice-card,
  body[data-mobile-tab="player"] .ab-bar,
  body[data-mobile-tab="player"] .settings-grid,
  body[data-mobile-tab="player"] .mobile-settings-tips,
  body[data-mobile-tab="player"] .library-panel {
    display: none;
  }

  body[data-mobile-tab="practice"] .transport-bar,
  body[data-mobile-tab="practice"] .speed-bar,
  body[data-mobile-tab="practice"] .ab-bar,
  body[data-mobile-tab="practice"] .settings-grid,
  body[data-mobile-tab="practice"] .mobile-quick-settings,
  body[data-mobile-tab="practice"] .mobile-swipe-hint,
  body[data-mobile-tab="practice"] .mobile-settings-tips,
  body[data-mobile-tab="practice"] .library-panel {
    display: none;
  }

  body[data-mobile-tab="library"] .deck-panel {
    display: none;
  }

  body[data-mobile-tab="settings"] .tts-warning,
  body[data-mobile-tab="settings"] .stage-card,
  body[data-mobile-tab="settings"] .retention-strip,
  body[data-mobile-tab="settings"] .guest-sync-banner,
  body[data-mobile-tab="settings"] .transport-bar,
  body[data-mobile-tab="settings"] .speed-bar,
  body[data-mobile-tab="settings"] .practice-card,
  body[data-mobile-tab="settings"] .mobile-quick-settings,
  body[data-mobile-tab="settings"] .mobile-swipe-hint,
  body[data-mobile-tab="settings"] .library-panel {
    display: none;
  }

  .retention-strip {
    padding: 8px 10px;
    gap: 8px;
  }

  .guest-sync-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .pill-cta {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Stage Card mobile ergonomics */
  .stage-card {
    padding: 14px 14px 12px;
    gap: 10px;
    border-radius: 12px;
    touch-action: pan-y;
  }

  body[data-mobile-tab="practice"] .stage-card {
    padding: 12px 14px;
    gap: 8px;
  }

  body[data-mobile-tab="practice"] .sentence-en-wrap {
    min-height: 52px;
  }

  body[data-mobile-tab="practice"] .sentence-zh-wrap {
    min-height: 26px;
  }

  .sentence-en-wrap {
    min-height: 64px;
    padding: 4px 2px;
  }

  .sentence-en {
    font-size: clamp(19px, 5.4vw, 25px);
    line-height: 1.38;
    overflow-wrap: anywhere;
  }

  .sentence-zh {
    font-size: 15px;
  }

  .stage-card-actions {
    gap: 8px;
    padding-top: 8px;
  }

  .chip-btn {
    padding: 7px 10px;
    font-size: 12px;
    min-height: 36px;
  }

  .mobile-swipe-hint {
    display: block;
    text-align: center;
    font-size: 11px;
    color: var(--stage-muted);
    opacity: 0.78;
    margin-top: -2px;
  }

  /* Thumb-friendly Transport Bar: Primary full row + 4 secondary controls */
  .transport-bar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-top: 10px;
  }

  .ctrl-primary {
    grid-column: span 4;
    order: -1;
    min-height: 48px;
    font-size: 16px;
    border-radius: 12px;
  }

  .ctrl-btn:not(.ctrl-primary) {
    min-height: 44px;
    padding: 8px 4px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Speed Bar single-row presets & larger slider thumb */
  .speed-bar {
    margin-top: 10px;
    padding: 10px 12px;
    gap: 8px;
  }

  .speed-presets {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
    order: 2;
  }

  .speed-chip {
    padding: 7px 2px;
    font-size: 12px;
    text-align: center;
    min-height: 34px;
  }

  .speed-bound {
    display: none;
  }

  .speed-slider-row input[type="range"] {
    height: 28px;
  }

  .speed-slider-row input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .mobile-quick-settings {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    text-align: left;
  }

  .mobile-quick-settings strong {
    color: var(--text);
    font-weight: 600;
  }

  .mobile-quick-arrow {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
  }

  /* Pronunciation Practice Mobile Layout */
  .practice-card {
    margin-top: 10px;
    padding: 12px;
  }

  .practice-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .p-btn-record {
    grid-column: span 2;
    order: -1;
    min-height: 48px;
    font-size: 15px;
  }

  .p-btn:not(.p-btn-record) {
    min-height: 42px;
    font-size: 13px;
  }

  .mic-meter-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .mic-meter-track {
    max-width: none;
    width: 100%;
  }

  .word-chip {
    padding: 6px 10px;
    font-size: 14px;
  }

  .score-overview {
    gap: 10px;
  }

  .score-circle {
    width: 60px;
    height: 60px;
  }

  .score-num {
    font-size: 20px;
  }

  .subscores {
    gap: 6px;
  }

  .subscore-item {
    font-size: 10.5px;
    white-space: nowrap;
  }

  /* Settings & A-B Mobile Layout */
  .ab-bar {
    margin-top: 0;
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .jump-group,
  .ab-group {
    width: 100%;
    justify-content: space-between;
  }

  .ab-bar input[type="number"] {
    width: 66px;
    min-height: 38px;
  }

  #abToggleBtn {
    width: 100%;
    margin-top: 2px;
  }

  .small-btn {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .setting-item select {
    min-height: 42px;
  }

  .mobile-settings-tips {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 10px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
  }

  .mobile-tips-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text);
  }

  .mobile-settings-tips p {
    margin: 0;
  }

  /* Library Panel Mobile Full-Flow Scroll + Sticky Header */
  .library-panel {
    height: auto;
    min-height: 0;
    gap: 10px;
  }

  .library-header {
    position: sticky;
    top: 0;
    z-index: 15;
    background: var(--surface);
    margin: -12px -12px 0;
    padding: 12px 12px 8px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--border);
  }

  .search-row input[type="search"] {
    min-height: 42px;
    padding: 8px 12px;
  }

  .category-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 4px;
  }

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

  .cat-tab {
    flex-shrink: 0;
    padding: 6px 12px;
    font-size: 13px;
  }

  .library-subbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .sentence-list {
    overflow: visible;
    padding-right: 0;
    gap: 8px;
  }

  .sentence-row {
    padding: 12px;
    align-items: center;
    content-visibility: auto;
    contain-intrinsic-size: 98px;
    scroll-margin-top: 165px;
  }

  .row-top {
    flex-wrap: wrap;
  }

  .row-en {
    font-size: 15px;
    overflow-wrap: anywhere;
  }

  .row-zh {
    font-size: 13px;
  }

  .row-actions-grid {
    grid-template-columns: repeat(2, 36px);
    gap: 6px;
    flex-shrink: 0;
  }

  .mini-action {
    width: 36px;
    height: 36px;
    font-size: 15px;
    border-radius: 9px;
  }

  /* Sticky Mini-Player */
  .mobile-mini-player {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 40;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 8px 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  }

  html.dark .mobile-mini-player {
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
  }

  .mini-player-info {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    padding: 2px 4px;
    text-align: left;
    color: var(--text);
    cursor: pointer;
  }

  .mini-player-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
  }

  .mini-player-num {
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
  }

  .mini-player-text {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
  }

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

  .mini-ctrl-btn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }

  .mini-ctrl-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
  }

  .mini-ctrl-primary.playing {
    background: #d97706;
    border-color: #d97706;
  }

  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 18px rgba(15, 23, 42, 0.08);
  }

  .mobile-nav-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
  }

  .mobile-nav-icon {
    font-size: 18px;
    line-height: 1.1;
  }

  .mobile-nav-label {
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-nav-btn.active {
    color: var(--accent);
    background: var(--accent-soft);
  }
}
