﻿/* 莱茵英语 · 样式 */
:root {
  --bg-deep: #061826;
  --bg-mid: #082338;
  --ink: #eaf7ff;
  --muted: #93b4c8;
  --line: rgba(140, 210, 255, 0.14);
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.09);
  --accent: #54e0c8;
  --accent-ink: #04241f;
  --accent-2: #7cc4ff;
  --ok: #59e0a0;
  --danger: #ff7a8a;
  --warn: #ffc46b;
  --radius: 20px;
  --shadow: 0 18px 50px rgba(0, 10, 20, 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  background:
    radial-gradient(1100px 560px at 12% -8%, rgba(70, 150, 255, 0.26), transparent 62%),
    radial-gradient(900px 520px at 92% 2%, rgba(60, 220, 200, 0.15), transparent 55%),
    linear-gradient(180deg, #061826 0%, #082338 46%, #061a2b 100%);
  background-attachment: fixed;
}

button { font-family: inherit; }

a { color: var(--accent-2); }

/* 背景气泡 */
.ocean-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.bubble {
  position: absolute;
  bottom: -120px;
  border-radius: 50%;
  border: 1px solid rgba(140, 220, 255, 0.22);
  background: radial-gradient(circle at 32% 30%, rgba(190, 240, 255, 0.22), rgba(120, 200, 255, 0.02) 65%);
  animation: rise linear infinite;
}
.b1 { width: 90px; height: 90px; left: 6%; animation-duration: 26s; animation-delay: 0s; }
.b2 { width: 40px; height: 40px; left: 22%; animation-duration: 19s; animation-delay: 4s; }
.b3 { width: 130px; height: 130px; left: 44%; animation-duration: 34s; animation-delay: 2s; opacity: 0.55; }
.b4 { width: 26px; height: 26px; left: 63%; animation-duration: 16s; animation-delay: 7s; }
.b5 { width: 72px; height: 72px; left: 79%; animation-duration: 28s; animation-delay: 1s; opacity: 0.7; }
.b6 { width: 52px; height: 52px; left: 92%; animation-duration: 22s; animation-delay: 9s; }
@keyframes rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.8; }
  100% { transform: translateY(-120vh) translateX(40px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .bubble { animation: none; }
}

/* 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(6, 24, 38, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}
.brand-penguin {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  font-size: 24px;
  border-radius: 16px;
  background: linear-gradient(150deg, rgba(84, 224, 200, 0.24), rgba(124, 196, 255, 0.16));
  border: 1px solid rgba(140, 235, 220, 0.32);
  box-shadow: 0 8px 24px rgba(20, 120, 110, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 18px; letter-spacing: 0.06em; }
.brand-text small { color: var(--muted); font-size: 11.5px; letter-spacing: 0.04em; }

.main-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 14.5px;
  cursor: pointer;
  transition: 0.2s ease;
}
.nav-btn span { font-size: 15px; }
.nav-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.nav-btn.is-active {
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), #8ff0e2);
  font-weight: 700;
  box-shadow: 0 8px 24px rgba(84, 224, 200, 0.28);
}

/* 页面容器 */
.page {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px clamp(14px, 3.4vw, 28px) 64px;
}
.view { display: none; }
.view.is-active { display: block; animation: fadeUp 0.4s ease both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.view-head { margin: 6px 0 22px; }
.view-head h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3.4vw, 32px);
  letter-spacing: 0.02em;
}
.view-head h1 .en {
  font-size: 0.56em;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.12em;
  margin-left: 6px;
}
.view-head p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* 面板 */
.panel {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.028));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel h3 {
  margin: 0 0 14px;
  font-size: 16px;
  letter-spacing: 0.03em;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--ink);
  font-size: 14.5px;
  cursor: pointer;
  transition: 0.18s ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #8ff0e2);
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(84, 224, 200, 0.24);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* 分段控件 */
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.seg {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
}
.seg-btn {
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  transition: 0.18s ease;
}
.seg-btn.is-active {
  background: rgba(124, 196, 255, 0.2);
  color: var(--ink);
  font-weight: 700;
}
.progress-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  min-width: 180px;
}
.progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.35s ease;
}
.progress-text { color: var(--muted); font-size: 12.5px; white-space: nowrap; }

/* 单词卡 */
.card-area { min-height: 420px; }

.word-card {
  perspective: 1400px;
  max-width: 620px;
  margin: 0 auto;
  height: 350px;
  cursor: pointer;
}
.word-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.1, 0.2, 1);
}
.word-card.is-flipped .word-card-inner { transform: rotateY(180deg); }
.word-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 26px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(84, 224, 200, 0.12), transparent 60%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
}
.word-face.back {
  transform: rotateY(180deg);
  justify-content: flex-start;
  padding-top: 46px;
}
.card-tag {
  position: absolute;
  top: 18px;
  left: 20px;
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}
.card-hint {
  position: absolute;
  bottom: 16px;
  font-size: 11.5px;
  color: rgba(147, 180, 200, 0.7);
}
.word-main {
  font-size: clamp(38px, 7vw, 56px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  word-break: break-word;
}
.word-phonetic { color: var(--accent); font-size: 17px; margin-top: 10px; }
.word-pos { color: var(--muted); font-size: 13px; margin-top: 16px; letter-spacing: 0.08em; }
.word-meaning {
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  margin-bottom: 6px;
}
.word-example {
  margin-top: 18px;
  font-size: 15px;
  color: #d6ecfa;
  max-width: 480px;
}
.word-example-ec { margin-top: 6px; font-size: 13.5px; color: var(--muted); }

.card-controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* 拼写模式 */
.spell-panel {
  max-width: 620px;
  margin: 0 auto;
  padding: 30px;
  border-radius: 26px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.03));
  box-shadow: var(--shadow);
  text-align: center;
}
.spell-prompt { font-size: 26px; font-weight: 700; }
.spell-pos { color: var(--muted); font-size: 13px; margin-top: 4px; }
.spell-hint { color: var(--muted); font-size: 13.5px; margin: 12px 0 18px; }
.spell-input {
  width: min(100%, 360px);
  padding: 13px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 19px;
  letter-spacing: 0.06em;
  text-align: center;
  outline: none;
  transition: 0.18s ease;
}
.spell-input:focus { border-color: rgba(84, 224, 200, 0.6); box-shadow: 0 0 0 4px rgba(84, 224, 200, 0.12); }
.spell-feedback { min-height: 26px; margin-top: 12px; font-size: 14.5px; }
.spell-feedback.ok { color: var(--ok); }
.spell-feedback.bad { color: var(--danger); }
.spell-actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 70px 20px;
}
.empty-state .big { font-size: 42px; display: block; margin-bottom: 10px; }

/* 口语 */
.chips { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: 0.18s ease;
}
.chip:hover { color: var(--ink); background: rgba(255, 255, 255, 0.09); }
.chip.is-active {
  color: var(--accent);
  border-color: rgba(84, 224, 200, 0.5);
  background: rgba(84, 224, 200, 0.1);
  font-weight: 700;
}
.speak-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.dialog-head h3 { margin-bottom: 4px; }
.dialog-head p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.dialog-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.dialog-line {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  transition: 0.18s ease;
}
.dialog-line:hover { background: rgba(255, 255, 255, 0.065); }
.dialog-line.is-speaking {
  border-color: rgba(84, 224, 200, 0.45);
  background: rgba(84, 224, 200, 0.08);
}
.line-index {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--accent);
  border: 1px solid rgba(84, 224, 200, 0.35);
  margin-top: 2px;
}
.line-body { flex: 1; min-width: 0; }
.line-en { font-size: 15.5px; color: var(--ink); }
.line-cn { font-size: 13px; color: var(--muted); margin-top: 2px; }
.play-line {
  flex: none;
  align-self: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  cursor: pointer;
  transition: 0.18s ease;
}
.play-line:hover { background: rgba(84, 224, 200, 0.2); }
.tip-body { color: #cfe7f5; font-size: 14px; }
.tip-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.record-status { color: var(--muted); font-size: 12.5px; margin: 12px 0 0; }
.record-status.is-recording { color: var(--danger); }
.record-status.is-recording::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  margin-right: 7px;
  animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0.2; } }
.playback { width: 100%; margin-top: 12px; }

/* 阅读 */
.read-library {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}
.read-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.028));
  cursor: pointer;
  transition: 0.2s ease;
  box-shadow: var(--shadow);
}
.read-card:hover { transform: translateY(-4px); border-color: rgba(84, 224, 200, 0.4); }
.read-card h3 { margin: 10px 0 8px; font-size: 18.5px; line-height: 1.35; }
.read-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.badge {
  display: inline-block;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid rgba(124, 196, 255, 0.3);
  color: var(--accent-2);
  background: rgba(124, 196, 255, 0.08);
}
.read-meta { display: flex; gap: 12px; color: var(--muted); font-size: 12px; margin-top: 14px; }
.back-btn { margin-bottom: 16px; }
.article { padding: 30px clamp(20px, 4vw, 40px); }
.article-head h2 { margin: 0 0 10px; font-size: clamp(22px, 3vw, 28px); }
.article-meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.read-timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--accent); }
.article-body { margin-top: 24px; font-size: 16.5px; line-height: 1.95; }
.article-body p { margin: 0 0 20px; }
.article-body .cn-trans {
  display: block;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid rgba(84, 224, 200, 0.35);
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}
.v-word {
  border-bottom: 1.5px dashed rgba(124, 196, 255, 0.6);
  cursor: pointer;
  transition: 0.15s ease;
}
.v-word:hover { color: var(--accent); border-bottom-color: var(--accent); }
.article-tools { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 6px; }
.word-pop {
  position: fixed;
  z-index: 50;
  max-width: 280px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(84, 224, 200, 0.4);
  background: #0b2b42;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-size: 13.5px;
  pointer-events: none;
}
.word-pop strong { color: var(--accent); font-size: 15px; }
.word-pop .pop-phonetic { color: var(--muted); margin-left: 6px; font-size: 12.5px; }
.word-pop .pop-cn { color: var(--ink); margin-top: 3px; }

.quiz { margin-top: 34px; padding-top: 24px; border-top: 1px solid var(--line); }
.quiz h3 { margin: 0 0 18px; font-size: 17px; }
.quiz-q { margin-bottom: 24px; }
.quiz-q .q-title { font-weight: 700; margin-bottom: 10px; font-size: 15px; }
.quiz-options { display: flex; flex-direction: column; gap: 8px; }
.option {
  text-align: left;
  padding: 11px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  font-size: 14.5px;
  cursor: pointer;
  transition: 0.16s ease;
}
.option:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); }
.option.is-correct { border-color: var(--ok); background: rgba(89, 224, 160, 0.14); }
.option.is-wrong { border-color: var(--danger); background: rgba(255, 122, 138, 0.13); }
.option:disabled { cursor: default; }
.explain {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  padding-left: 12px;
  border-left: 2px solid rgba(84, 224, 200, 0.35);
}
.quiz-result {
  margin-top: 6px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(84, 224, 200, 0.35);
  background: rgba(84, 224, 200, 0.08);
  font-size: 14.5px;
}

/* 学习页 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.025));
  padding: 18px 20px;
}
.stat-value { font-size: 30px; font-weight: 800; color: var(--accent); line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.study-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: 0.16s ease;
}
.task-item:hover { background: rgba(255, 255, 255, 0.07); }
.task-item.is-done { opacity: 0.62; }
.task-item.is-done .task-title { text-decoration: line-through; }
.task-check { font-size: 18px; line-height: 1.3; flex: none; }
.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 14.5px; font-weight: 600; }
.task-desc { color: var(--muted); font-size: 12.5px; }
.task-time {
  flex: none;
  font-size: 11.5px;
  color: var(--accent-2);
  border: 1px solid rgba(124, 196, 255, 0.3);
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.task-progress { color: var(--muted); font-size: 13px; margin: 16px 0 0; }

.timer-panel { display: flex; flex-direction: column; align-items: center; text-align: center; }
.timer-display {
  font-size: 54px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1.2;
  margin: 6px 0 18px;
  color: var(--ink);
}
.timer-display.is-running { color: var(--accent); }
.timer-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.timer-hint { color: var(--muted); font-size: 12.5px; margin: 14px 0 0; }

.week-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  height: 160px;
  padding: 10px 6px 0;
}
.week-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
  justify-content: flex-end;
}
.week-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.week-bar {
  width: min(100%, 42px);
  border-radius: 10px 10px 6px 6px;
  background: rgba(255, 255, 255, 0.1);
  transition: height 0.4s ease;
  min-height: 6px;
}
.week-bar.is-checked { background: linear-gradient(180deg, var(--accent), rgba(84, 224, 200, 0.35)); }
.week-day { font-size: 12px; color: var(--muted); }
.week-day.is-today { color: var(--accent); font-weight: 700; }

.plan-table-wrap { overflow-x: auto; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 620px; }
.plan-table th, .plan-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.plan-table th { color: var(--muted); font-weight: 600; font-size: 12.5px; letter-spacing: 0.04em; }
.plan-table tbody tr:hover { background: rgba(255, 255, 255, 0.035); }

/* 补充：隐藏与表格小标题 */
.is-hidden { display: none !important; }
.read-library[hidden] { display: none; }
.tip-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.8;
}
.tip-list li { margin-bottom: 4px; }
.table-sub {
  margin: 22px 0 10px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
}
.table-sub.first { margin-top: 0; }

/* 页脚 */
.site-footer {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px clamp(14px, 3.4vw, 28px) 46px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: rgba(147, 180, 200, 0.7);
  font-size: 12px;
  border-top: 1px solid var(--line);
}

/* 响应式 */
@media (max-width: 820px) {
  .speak-layout, .study-grid { grid-template-columns: 1fr; }
  .word-card { height: 330px; }
  .week-chart { height: 130px; }
  .main-nav { gap: 2px; }
  .nav-btn { padding: 8px 11px; font-size: 13px; }
  .brand-text small { display: none; }
}
@media (max-width: 520px) {
  .topbar {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .brand-penguin { width: 38px; height: 38px; font-size: 20px; border-radius: 12px; }
  .brand-text strong { font-size: 15.5px; }
  .main-nav { width: 100%; justify-content: space-between; gap: 4px; }
  .nav-btn { flex: 1 1 0; justify-content: center; padding: 8px 4px; }
  .nav-btn span { display: none; }
  .page { padding-top: 22px; }
  .word-face { padding: 22px; }
  .word-card { height: 340px; }
  .progress-box { margin-left: 0; width: 100%; }
  .timer-display { font-size: 44px; }
  .view-head p { font-size: 13.5px; }
}

/* ================= 扩展模块：音标 / 语法 ================= */

.stat-value { font-size: 26px; }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.panel-head h3 { margin: 0 0 4px; }
.panel-sub { margin: 0; color: var(--muted); font-size: 12.5px; }

.task-go {
  flex: none;
  align-self: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(84, 224, 200, 0.35);
  background: rgba(84, 224, 200, 0.1);
  color: var(--accent);
  font-size: 11.5px;
  cursor: pointer;
  transition: 0.15s ease;
}
.task-go:hover { background: rgba(84, 224, 200, 0.2); }

/* 音标 */
.phonetic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}
.phonetic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}
.phonetic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 8px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  color: var(--ink);
  cursor: pointer;
  transition: 0.18s ease;
}
.phonetic-card:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.1); }
.phonetic-card.is-selected {
  border-color: rgba(84, 224, 200, 0.65);
  box-shadow: 0 0 0 3px rgba(84, 224, 200, 0.12);
}
.phonetic-card.is-known { border-color: rgba(89, 224, 160, 0.42); }
.phonetic-symbol { font-size: 24px; font-weight: 800; color: var(--accent); line-height: 1.2; }
.phonetic-type { font-size: 10.5px; color: var(--muted); }
.phonetic-example { font-size: 11px; color: rgba(147, 180, 200, 0.85); }
.phonetic-check { position: absolute; top: 6px; right: 8px; font-size: 11px; color: var(--ok); }

.phonetic-detail { position: sticky; top: 84px; min-height: 280px; }
.empty-detail { color: var(--muted); font-size: 13px; text-align: center; padding: 48px 10px; }
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.detail-symbol { font-size: 34px; font-weight: 800; color: var(--accent); }
.detail-type { font-size: 13px; color: var(--ink); }
.detail-letters { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.detail-mouth { font-size: 13.5px; color: #cfe7f5; margin: 0 0 14px; }
.detail-words { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.word-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  cursor: pointer;
  font-size: 12.5px;
  transition: 0.15s ease;
}
.word-chip:hover { border-color: rgba(84, 224, 200, 0.4); background: rgba(255, 255, 255, 0.09); }
.word-en { font-weight: 700; color: var(--accent-2); }
.word-cn { font-size: 11px; color: var(--muted); }
.detail-tip { font-size: 12px; color: var(--warn); margin: 0 0 14px; }
.phonetic-detail .btn { width: 100%; }

.quiz-placeholder {
  color: var(--muted);
  font-size: 13.5px;
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}
.quiz-progress { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.phonetic-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.question-word { font-size: 26px; font-weight: 800; }
.question-cn { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 10px; }
.phonetic-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.phonetic-option { text-align: center; font-size: 17px; padding: 12px; }
.phonetic-feedback { min-height: 22px; font-size: 13px; color: var(--muted); }
.phonetic-feedback.ok { color: var(--ok); }
.phonetic-feedback.bad { color: var(--danger); }
.quiz-actions { margin-top: 14px; }
.quiz-panel { margin-top: 18px; }

/* 语法 */
.grammar-list { display: flex; flex-direction: column; gap: 12px; }
.grammar-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  overflow: hidden;
  box-shadow: var(--shadow);
}
.grammar-card.is-open { border-color: rgba(84, 224, 200, 0.35); }
.grammar-card.is-done .grammar-title { color: var(--ok); }
.grammar-head {
  display: block;
  width: 100%;
  padding: 16px 18px;
  background: transparent;
  border: 0;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: 0.15s ease;
}
.grammar-head:hover { background: rgba(255, 255, 255, 0.04); }
.grammar-head p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.grammar-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grammar-title { font-size: 16.5px; font-weight: 700; }
.done-tag {
  font-size: 11px;
  color: var(--ok);
  border: 1px solid rgba(89, 224, 160, 0.35);
  border-radius: 999px;
  padding: 1px 8px;
}
.grammar-arrow { margin-left: auto; color: var(--muted); font-size: 12px; }
.grammar-body { padding: 0 18px 20px; border-top: 1px solid var(--line); }
.grammar-body > p { margin: 14px 0 0; font-size: 14px; color: #d6ecfa; }
.grammar-examples { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.grammar-example {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  border-left: 3px solid rgba(84, 224, 200, 0.4);
}
.ex-en { font-size: 14.5px; color: var(--ink); }
.ex-cn { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ex-note { font-size: 12px; color: var(--accent-2); margin-top: 4px; }
.grammar-tip { margin: 16px 0 0; font-size: 12.5px; color: var(--warn); }
.grammar-quiz { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.grammar-quiz h4 { margin: 0 0 12px; font-size: 14px; }
.grammar-result {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(84, 224, 200, 0.08);
  border: 1px solid rgba(84, 224, 200, 0.3);
  font-size: 13.5px;
}

@media (max-width: 820px) {
  .phonetic-layout { grid-template-columns: 1fr; }
  .phonetic-detail { position: static; }
  .phonetic-options { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  #bankSeg .seg-btn { padding: 6px 8px; font-size: 12px; }
  .task-time { display: none; }
  .grammar-head { padding: 14px; }
  .grammar-body { padding: 0 14px 16px; }
  .phonetic-grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
}

/* 完整词库：长释义与缺省字段 */
.word-face.back { overflow-y: auto; }
.word-meaning { font-size: clamp(19px, 2.6vw, 26px); line-height: 1.45; max-width: 520px; }
.word-phonetic.is-empty { color: rgba(147, 180, 200, 0.6); font-style: italic; font-size: 14px; }
.word-example.is-empty { color: rgba(147, 180, 200, 0.65); font-size: 13.5px; }

/* 词卡背面单词与错题本 */
.word-back-word { font-size: 22px; font-weight: 800; color: var(--accent-2); margin-bottom: 4px; }
#readLevels { margin-top: -6px; }
.mistake-head { color: var(--muted); font-size: 13.5px; margin-bottom: 14px; text-align: center; }
.mistake-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; margin: 0 auto; }
.mistake-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025));
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.mistake-word { font-size: 26px; font-weight: 800; letter-spacing: 0.02em; }
.mistake-phonetic { color: var(--accent); font-size: 13.5px; margin-top: 2px; }
.mistake-meaning { color: var(--ink); font-size: 14px; margin-top: 6px; }
.mistake-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mistake-input {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  font-size: 15px;
  outline: none;
}
.mistake-input:focus { border-color: rgba(84, 224, 200, 0.6); box-shadow: 0 0 0 3px rgba(84, 224, 200, 0.1); }
.mistake-feedback { min-height: 18px; font-size: 12.5px; margin-top: 6px; color: var(--muted); }
.mistake-feedback.ok { color: var(--ok); }
.mistake-feedback.bad { color: var(--danger); }

@media (max-width: 520px) {
  .mistake-item { padding: 14px; }
  .mistake-word { font-size: 22px; }
  .mistake-actions { flex-direction: column; align-items: stretch; }
  .mistake-actions .btn { width: 100%; }
}


/* 音标发音按钮 */
.phonetic-audio {
  position: absolute;
  left: 7px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(84, 224, 200, 0.12);
  border: 1px solid rgba(84, 224, 200, 0.28);
  color: var(--accent);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: 0.15s ease;
}
.phonetic-audio:hover { background: rgba(84, 224, 200, 0.24); }
.phonetic-sound-btn { width: 100%; margin: 0 0 12px; }
