:root {
  --bg-page: #f4f7f3;
  --bg-surface: #ffffff;
  --bg-subtle: #edf2ec;
  --bg-hover: #edf6f1;
  --border-light: #e0e7de;
  --border-strong: #c8d4c7;

  --text-primary: #1e2a23;
  --text-secondary: #4f6057;
  --text-muted: #7a8b82;

  --accent: #2c7a5b;
  --accent-hover: #226349;
  --accent-soft: #e4f3ec;
  --accent-ring: rgba(44, 122, 91, 0.24);

  --vowel-tag-bg: #e6f4ed;
  --vowel-tag-text: #22664b;
  --consonant-tag-bg: #e7f0f6;
  --consonant-tag-text: #2e5877;

  --star-active: #e59a24;
  --star-soft: #fef6e4;

  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 3px rgba(24, 38, 30, 0.05);
  --shadow-md: 0 4px 16px rgba(24, 38, 30, 0.06);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-ipa: "Charis SIL", "Doulos SIL", "Lucida Sans Unicode", "Segoe UI", "Noto Sans", system-ui, sans-serif;
}

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

html,
body {
  height: 100%;
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* 桌面端整页一屏容器：不翻页 */
.app-shell {
  height: 100vh;
  max-width: 1680px;
  margin: 0 auto;
  padding: 10px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

/* 顶部紧凑标题栏 */
.app-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.header-title-group {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.app-header h1 {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

.subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.header-hints {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.offline-cache-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid #b9d9ca;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.offline-cache-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.offline-cache-btn.cached {
  background: var(--bg-subtle);
  border-color: var(--border-light);
  color: var(--text-muted);
  cursor: default;
}

.kbd-hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  font-size: 0.7rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--border-light);
}

/* 左右分栏主体：左视频(44%)，右音标(56%) */
.workspace-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 44%) 1fr;
  gap: 12px;
  align-items: stretch;
}

/* 左侧播放器面板 */
.player-panel {
  height: 100%;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.video-stage {
  flex: 1 1 0;
  min-height: 0;
  background: #111613;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.video-stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #111613;
  object-fit: contain;
}

/* 抽查模式防剧透遮罩 */
.video-spoiler-mask {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 20, 0.94);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  text-align: center;
  color: #e6efe9;
  z-index: 4;
}

.spoiler-icon {
  font-size: 2rem;
}

.spoiler-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.spoiler-desc {
  font-size: 0.8rem;
  color: #a4b8ac;
  max-width: 280px;
}

.spoiler-desc kbd {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  color: #ffffff;
  box-shadow: none;
}

.video-error-banner {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  padding: 10px 14px;
  background: #fff7e6;
  color: #8c5a0b;
  border-radius: 8px;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-pick-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
}

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

/* 仅听声音模式面板（占满左侧主区域） */
.audio-only-bar {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, #ebf5f0 0%, #f7fbf8 100%);
  border-bottom: 1px solid var(--border-light);
}

.audio-only-center {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}

.audio-only-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: #ffffff;
  border: 1px solid #cce5d9;
  padding: 3px 12px;
  border-radius: 999px;
}

.audio-wave {
  display: inline-flex;
  align-items: flex-end;
  gap: 5px;
  height: 36px;
}

.audio-wave span {
  display: block;
  width: 5px;
  height: 8px;
  background: var(--accent);
  border-radius: 3px;
  opacity: 0.4;
  transition: height 0.15s ease;
}

.audio-wave.playing span {
  opacity: 1;
  animation: waveBounce 0.85s ease-in-out infinite;
}

.audio-wave.playing span:nth-child(2) {
  animation-delay: 0.15s;
}

.audio-wave.playing span:nth-child(3) {
  animation-delay: 0.3s;
}

.audio-wave.playing span:nth-child(4) {
  animation-delay: 0.45s;
}

@keyframes waveBounce {

  0%,
  100% {
    height: 8px;
  }

  50% {
    height: 36px;
  }
}

.audio-only-symbol {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-ipa);
}

.audio-only-progress-wrap {
  width: 100%;
  height: 6px;
  background: #d8e7df;
  border-radius: 999px;
  overflow: hidden;
}

.audio-only-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.06s linear;
}

/* 左侧底部控制条 */
.controls-bar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
}

.now-playing-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nav-buttons {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.icon-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

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

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

.current-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.current-symbol {
  font-family: var(--font-ipa);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  min-width: 44px;
  text-align: center;
  padding: 2px 8px;
  background: var(--accent-soft);
  border-radius: 8px;
  line-height: 1.3;
  flex-shrink: 0;
}

.current-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.current-category {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.current-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

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

.tool-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tool-pill:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.tool-pill.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #9fd1bc;
  font-weight: 600;
}

.star-filter-pill.active {
  background: var(--star-soft);
  color: #b8730a;
  border-color: #f0ca82;
}

.star-filter-pill.active svg {
  fill: var(--star-active);
  stroke: var(--star-active);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
}

.star-filter-pill.active .badge {
  background: #f8dfa9;
  color: #8f5704;
}

.speed-segmented {
  display: inline-flex;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 2px;
  height: 32px;
}

.speed-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0 7px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.speed-btn:hover {
  color: var(--text-primary);
}

.speed-btn.active {
  background: var(--bg-surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* 右侧：音标全览面板（一屏铺满，不翻页） */
.phonemes-panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.phonemes-container {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.major-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 10px 14px 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.major-section.vowel-section {
  flex: 3 1 0;
}

.major-section.consonant-section {
  flex: 4 1 0;
}

.major-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--bg-subtle);
}

.major-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
}

.major-badge.vowel {
  background: var(--vowel-tag-bg);
  color: var(--vowel-tag-text);
}

.major-badge.consonant {
  background: var(--consonant-tag-bg);
  color: var(--consonant-tag-text);
}

.major-count {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.subgroups-list {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.subgroup-block {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subgroups-inline-row {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.subgroup-title {
  flex: 0 0 auto;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.2;
}

.subgroup-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 11px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.75;
}

.major-section.consonant-section .subgroup-title::before {
  background: #467497;
}

/* 桌面端每组固定单行 9 列对齐，保证卡片整齐且不换行撑高 */
.cards-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 6px;
}

.compact-subgroup .cards-grid {
  grid-template-columns: repeat(var(--item-count, 3), minmax(0, 1fr));
}

/* 紧凑型音标卡片 */
.phoneme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  height: 100%;
  padding: 6px 4px 5px;
  background: #fafcfa;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  user-select: none;
  transition: transform 0.12s ease, border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  overflow: hidden;
  text-align: center;
}

.phoneme-card:hover {
  background: var(--bg-hover);
  border-color: #a4ccbc;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(44, 122, 91, 0.09);
}

.phoneme-card:active {
  transform: translateY(0);
}

.phoneme-card.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.phoneme-card.starred {
  border-color: #edd095;
}

.phoneme-card.active.starred {
  border-color: var(--accent);
}

.phoneme-symbol {
  font-family: var(--font-ipa);
  font-size: clamp(1.05rem, 1.45vw, 1.38rem);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.15;
}

.phoneme-card.active .phoneme-symbol {
  color: var(--accent);
}

.phoneme-sub {
  margin-top: 1px;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--accent);
  background: rgba(44, 122, 91, 0.11);
  padding: 0 5px;
  border-radius: 999px;
  line-height: 1.35;
}

/* 右上角小星星 */
.star-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #c5cfc8;
  border-radius: 5px;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease, background-color 0.15s ease;
  z-index: 2;
}

.star-btn:hover {
  color: var(--star-active);
  background: rgba(229, 154, 36, 0.14);
  transform: scale(1.1);
}

.star-btn.is-starred {
  color: var(--star-active);
}

.star-btn svg {
  width: 12px;
  height: 12px;
}

.star-btn.is-starred svg {
  fill: var(--star-active);
}

/* 卡片底部播放进度条 */
.card-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  transition: width 0.06s linear;
}

/* 左上角历史错题角标 */
.wrong-badge {
  position: absolute;
  top: 3px;
  left: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  color: #c04a3e;
  background: #fdeceb;
  padding: 0 4px;
  border-radius: 4px;
  line-height: 1.4;
  pointer-events: none;
}

/* 随机抽查面板 */
.quiz-pill.active {
  background: #ebf0fb;
  color: #2f5aa8;
  border-color: #b4c8f2;
}

.quiz-panel {
  flex: 1 1 0;
  min-height: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--bg-subtle);
  flex-wrap: wrap;
}

.quiz-scopes {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.quiz-scope-btn {
  border: 1px solid var(--border-light);
  background: var(--bg-page);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.quiz-scope-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.quiz-scope-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.quiz-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.quiz-autostar-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.quiz-autostar-label input {
  accent-color: var(--accent);
  cursor: pointer;
}

.quiz-text-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.76rem;
  cursor: pointer;
  padding: 2px 4px;
}

.quiz-text-btn:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.quiz-exit-btn {
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.quiz-exit-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

/* 题目区 */
.quiz-question-view {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.quiz-progress-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}

.quiz-counter {
  font-weight: 700;
  color: var(--text-primary);
}

.quiz-live-score {
  display: inline-flex;
  gap: 10px;
  font-size: 0.78rem;
}

.score-good {
  color: var(--accent);
}

.score-bad {
  color: #c84b3e;
}

.quiz-progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-subtle);
  border-radius: 999px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.quiz-flashcard {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #fafcfa;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.quiz-card-badges {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quiz-cat-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  padding: 3px 10px;
  border-radius: 999px;
}

.quiz-history-badge {
  font-size: 0.74rem;
  font-weight: 600;
  color: #c04a3e;
  background: #fdeceb;
  padding: 3px 9px;
  border-radius: 999px;
}

.quiz-symbol-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.quiz-symbol {
  font-family: var(--font-ipa);
  font-size: clamp(3.4rem, 6vw, 5.2rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
}

.quiz-sub-tag {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 12px;
  border-radius: 999px;
}

.quiz-prompt-tip {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
}

.quiz-listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border: 1.5px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quiz-listen-btn:hover {
  background: var(--accent);
  color: #ffffff;
}

.quiz-listen-btn:hover kbd {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
  box-shadow: none;
}

.quiz-grade-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 380px;
  margin-top: 4px;
}

.quiz-grade-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 11px;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

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

.quiz-grade-btn.pass {
  border: 1.5px solid #96d1b6;
  background: #edf8f2;
  color: #1e6b4c;
}

.quiz-grade-btn.pass:hover {
  background: #2c7a5b;
  border-color: #2c7a5b;
  color: #ffffff;
}

.quiz-grade-btn.fail {
  border: 1.5px solid #f0b5af;
  background: #fef2f1;
  color: #b83e32;
}

.quiz-grade-btn.fail:hover {
  background: #d14d40;
  border-color: #d14d40;
  color: #ffffff;
}

.quiz-grade-btn:hover kbd {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
  box-shadow: none;
}

/* 结算页 */
.quiz-summary-view {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-score-card {
  background: linear-gradient(135deg, #ebf6f0 0%, #f7fbf8 100%);
  border: 1px solid #d4e8dd;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  text-align: center;
}

.summary-rate {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.15;
}

.summary-detail {
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.summary-wrong-section {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.summary-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.summary-wrong-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.summary-wrong-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border: 1.5px solid #f0c2bd;
  background: #fff7f6;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.summary-wrong-chip:hover {
  border-color: #d14d40;
  background: #fdeceb;
  transform: translateY(-1px);
}

.summary-wrong-chip .chip-sym {
  font-family: var(--font-ipa);
  font-size: 1.28rem;
  font-weight: 700;
  color: #a6372c;
}

.summary-wrong-chip .chip-sub {
  font-size: 0.66rem;
  color: var(--text-muted);
}

.summary-all-clear {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  background: #f5fbf7;
  border: 1px dashed #b5dcc8;
  border-radius: var(--radius-md);
  padding: 24px;
}

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

.quiz-primary-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 9px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

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

.quiz-secondary-btn {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.quiz-secondary-btn:hover {
  background: var(--bg-subtle);
}

.quiz-ghost-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.84rem;
  cursor: pointer;
}

.quiz-ghost-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.quiz-empty-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

/* 空状态 */
.empty-state {
  flex: 1;
  background: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 36px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-secondary);
}

.empty-icon {
  font-size: 2rem;
  color: var(--star-active);
  margin-bottom: 6px;
}

.empty-title {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.reset-filter-btn {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
}

.reset-filter-btn:hover {
  background: var(--accent-hover);
}

/* 手机竖屏（专为 iPhone 16 Pro Max 440×956 等大屏优化）：上视频+控制，下49音标一屏不翻页 */
@media (max-width: 920px) {

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    overflow: hidden;
    padding: max(6px, env(safe-area-inset-top)) 8px max(6px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .app-header {
    padding: 0 2px;
    gap: 6px;
  }

  .app-header h1 {
    font-size: 0.96rem;
  }

  .subtitle,
  .header-hints .kbd-hint {
    display: none;
  }

  .offline-cache-btn {
    padding: 2px 8px;
    font-size: 0.7rem;
  }

  /* 上下分栏 */
  .workspace-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  /* 顶部区域：左上竖屏视频 + 右上整齐控制坞 */
  .player-panel {
    flex: 0 0 auto;
    height: auto;
    display: grid;
    grid-template-columns: 118px 1fr;
    align-items: stretch;
    border-radius: 12px;
  }

  .player-panel:has(.video-stage.hidden) {
    grid-template-columns: 1fr;
  }

  .video-stage {
    width: 118px;
    height: 196px;
    flex: none;
  }

  .video-stage video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .video-spoiler-mask {
    padding: 8px;
    gap: 4px;
  }

  .spoiler-icon {
    font-size: 1.35rem;
  }

  .spoiler-title {
    font-size: 0.78rem;
  }

  .spoiler-desc {
    font-size: 0.66rem;
    line-height: 1.3;
  }

  .audio-only-bar {
    flex: none;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
  }

  .audio-only-center {
    max-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 10px;
  }

  .audio-only-label {
    font-size: 0.68rem;
    padding: 1px 8px;
  }

  .audio-wave {
    height: 18px;
    gap: 3px;
  }

  .audio-wave span {
    width: 3px;
  }

  .audio-only-symbol {
    font-size: 0.92rem;
  }

  .audio-only-progress-wrap {
    height: 4px;
  }

  /* 右上紧凑控制坞 */
  .controls-bar {
    padding: 8px;
    gap: 6px;
    border-top: none;
    border-left: 1px solid var(--border-light);
    justify-content: space-between;
  }

  .player-panel:has(.video-stage.hidden) .controls-bar {
    border-left: none;
  }

  .now-playing-group {
    gap: 6px;
  }

  .nav-buttons {
    gap: 4px;
  }

  .icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
  }

  .icon-btn svg {
    width: 14px;
    height: 14px;
  }

  .current-info {
    gap: 6px;
  }

  .current-symbol {
    font-size: 1rem;
    min-width: 32px;
    padding: 2px 5px;
    border-radius: 6px;
  }

  .current-category {
    font-size: 0.72rem;
  }

  .current-time {
    display: none;
  }

  .tools-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
  }

  .speed-segmented {
    grid-column: 1 / -1;
    width: 100%;
    height: 28px;
    padding: 2px;
  }

  .speed-btn {
    flex: 1;
    height: 22px;
    font-size: 0.72rem;
    padding: 0;
  }

  .tool-pill {
    width: 100%;
    justify-content: center;
    height: 28px;
    padding: 0 6px;
    font-size: 0.72rem;
    border-radius: 7px;
    gap: 3px;
  }

  .tool-pill svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }

  .quiz-pill {
    grid-column: 1 / -1;
    height: 30px;
    font-weight: 600;
    background: #eef4ff;
    color: #2c55a3;
    border-color: #c5d7f7;
  }

  .badge {
    min-width: 15px;
    height: 15px;
    font-size: 0.64rem;
  }

  /* 下半区域：49 个音标 7 行一屏全览，零翻页 */
  .phonemes-panel {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }

  .phonemes-container {
    gap: 6px;
  }

  .major-section {
    padding: 6px 7px 7px;
    border-radius: 12px;
  }

  .major-section.vowel-section {
    flex: 3 1 0;
  }

  .major-section.consonant-section {
    flex: 4 1 0;
  }

  .major-header {
    margin-bottom: 4px;
    padding-bottom: 3px;
    gap: 6px;
  }

  .major-badge {
    font-size: 0.7rem;
    padding: 1px 7px;
  }

  .major-count {
    font-size: 0.66rem;
  }

  .subgroups-list {
    gap: 4px;
  }

  .subgroup-block {
    gap: 2px;
  }

  .subgroups-inline-row {
    flex-direction: row;
    gap: 6px;
  }

  .subgroup-title {
    font-size: 0.65rem;
    gap: 4px;
  }

  .subgroup-title::before {
    width: 2.5px;
    height: 9px;
  }

  /* 每行按实际音标数量等宽铺满，无留白、不换行 */
  .cards-grid,
  .compact-subgroup .cards-grid {
    grid-template-columns: repeat(var(--item-count, 6), minmax(0, 1fr));
    gap: 4px;
  }

  .phoneme-card {
    min-height: 0;
    height: 100%;
    padding: 2px 1px;
    border-radius: 8px;
    border-width: 1px;
  }

  .phoneme-card:hover {
    transform: none;
  }

  .phoneme-symbol {
    font-size: clamp(0.9rem, 3.7vw, 1.15rem);
  }

  .phoneme-sub {
    margin-top: 0;
    font-size: 0.56rem;
    padding: 0 3px;
    line-height: 1.25;
  }

  .star-btn {
    top: 1px;
    right: 1px;
    width: 15px;
    height: 15px;
  }

  .star-btn svg {
    width: 10px;
    height: 10px;
  }

  .wrong-badge {
    top: 1px;
    left: 2px;
    font-size: 0.54rem;
    padding: 0 2px;
  }

  /* 抽查模式在手机一屏内也极简紧凑 */
  .quiz-panel {
    padding: 10px 12px;
    gap: 8px;
    border-radius: 12px;
  }

  .quiz-topbar {
    padding-bottom: 6px;
    gap: 6px;
  }

  .quiz-scope-btn {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .quiz-autostar-label,
  .quiz-text-btn,
  .quiz-exit-btn {
    font-size: 0.7rem;
  }

  .quiz-flashcard {
    padding: 12px;
    gap: 10px;
  }

  .quiz-symbol {
    font-size: 3.2rem;
  }

  .quiz-prompt-tip {
    font-size: 0.74rem;
  }

  .quiz-listen-btn {
    padding: 8px 18px;
    font-size: 0.86rem;
  }

  .quiz-listen-btn kbd,
  .quiz-grade-btn kbd {
    display: none;
  }

  .quiz-grade-btn {
    padding: 10px 12px;
    font-size: 0.88rem;
  }

  .summary-score-card {
    padding: 10px 12px;
  }

  .summary-rate {
    font-size: 1.75rem;
  }
}