:root {
  --bg: #fff9f1;
  --card: #ffffff;
  --ink: #3d2a1a;
  --ink-soft: #6f5946;
  --muted: #9a7350;
  --muted-2: #b08a66;
  --line: #ffedd8;
  --line-strong: #ffd9b0;
  --accent: #ff8a3d;
  --accent-deep: #e8731f;
  --accent-soft: #fff1e0;
  --accent-softer: #fff7ec;
  --green: #18a66a;
  --green-soft: #e6f8ef;
  --shadow: 0 14px 34px rgba(198, 122, 54, 0.09);
  --shadow-soft: 0 8px 20px rgba(198, 122, 54, 0.06);
  --radius: 24px;
  --lyric-scale: 1;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 480px at 82% -10%, rgba(255, 224, 188, 0.55), transparent 65%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  overflow-x: hidden;
}

button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

audio { display: none; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: calc(14px + env(safe-area-inset-top)) clamp(16px, 4vw, 40px) 14px;
  background: rgba(255, 249, 241, 0.88);
  border-bottom: 1px solid rgba(255, 217, 176, 0.65);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff9f43, #ffb75f);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 20px rgba(255, 138, 61, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 18px; letter-spacing: 0.3px; white-space: nowrap; }
.brand-text small { margin-top: 3px; font-size: 11px; color: var(--muted-2); white-space: nowrap; }

.header-actions { display: flex; align-items: center; gap: 14px; }
.local-pill {
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.header-link { color: var(--muted); font-size: 14px; font-weight: 600; }
.header-link:hover { color: var(--accent-deep); }

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(18px, 3vw, 34px) 0 54px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 28px;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 12px;
  text-align: center;
}

/* ---------- home ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 46px);
  border-radius: 32px;
  background: linear-gradient(135deg, #fff6e8 0%, #ffe2bd 100%);
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -150px;
  top: -190px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}
.hero-kicker { position: relative; z-index: 1; color: #c07a35; font-size: 12px; font-weight: 800; letter-spacing: 2px; }
.hero h1 { position: relative; z-index: 1; margin: 12px 0 0; font-size: clamp(30px, 4.2vw, 48px); line-height: 1.22; letter-spacing: 0.5px; }
.hero p { position: relative; z-index: 1; margin: 12px 0 0; color: var(--muted); font-size: clamp(14px, 1.6vw, 17px); line-height: 1.7; }
.hero-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 26px; }
.hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(255, 138, 61, 0.26);
  transition: transform 0.18s ease, background 0.18s ease;
}
.hero-btn:hover { transform: translateY(-1px); background: var(--accent-deep); }
.hero-note { color: var(--muted-2); font-size: 12px; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; position: relative; z-index: 1; }
.stat {
  min-width: 112px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--muted);
  font-size: 12px;
}
.stat strong { display: block; color: var(--ink); font-size: 22px; line-height: 1.2; margin-bottom: 3px; }

.resume-card {
  display: flex; align-items: center; gap: 16px;
  margin-top: 18px; padding: 18px 20px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.resume-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.resume-icon {
  width: 52px; height: 52px; border-radius: 16px; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-deep); font-size: 18px; padding-left: 3px;
}
.resume-body { flex: 1; min-width: 0; }
.resume-kicker { display: block; color: var(--accent-deep); font-size: 11px; font-weight: 800; letter-spacing: .5px; }
.resume-title { display: block; margin-top: 3px; font-size: 15px; font-weight: 800; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.resume-meta { display: block; margin-top: 3px; color: var(--muted-2); font-size: 12px; }
.resume-progress { display: block; width: 100%; height: 5px; margin-top: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.resume-progress .progress-fill { display: block; height: 100%; }
.resume-arrow { color: #d9a878; font-size: 24px; }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.step { display: flex; align-items: center; gap: 12px; padding: 15px 16px; background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: 18px; }
.step > span { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); font-size: 13px; font-weight: 800; }
.step strong { display: block; font-size: 13px; }
.step small { display: block; margin-top: 2px; color: var(--muted-2); font-size: 11px; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 34px 4px 16px; }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 800; }
.section-title img { width: 38px; height: 38px; padding: 6px; border-radius: 12px; background: var(--accent-soft); }
.section-sub { margin-top: 5px; color: var(--muted-2); font-size: 13px; }
.section-count { padding: 6px 13px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 800; white-space: nowrap; }

.course-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.course-card {
  display: flex;
  gap: 18px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.course-card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.course-cover { width: 96px; height: 128px; object-fit: cover; border-radius: 15px; flex-shrink: 0; background: var(--accent-soft); box-shadow: 0 8px 18px rgba(170, 92, 20, 0.16); }
.course-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.course-top { display: flex; align-items: flex-start; gap: 8px; }
.course-title { flex: 1; min-width: 0; margin: 0; font-size: 18px; line-height: 1.35; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.chip-version { background: var(--accent-soft); color: var(--accent-deep); }
.chip-version.is-old { background: #f3e7d9; color: #8a6a4f; }
.chip-level { background: var(--accent-softer); color: var(--muted); }
.course-sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted-2); font-size: 12px; }
.course-progress { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 14px; color: var(--muted-2); font-size: 12px; }
.progress-track { flex: 1; height: 7px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #ff9f43, #ffc266); }

/* ---------- lessons ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 13px; font-weight: 700; }
.back-link:hover { color: var(--accent-deep); }
.course-banner {
  position: relative;
  display: flex;
  gap: 22px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: 30px;
  background: linear-gradient(135deg, #fff6e8, #ffe7c7);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.course-banner::after {
  content: "";
  position: absolute;
  width: 300px; height: 300px; right: -100px; top: -130px;
  border-radius: 50%; background: rgba(255,255,255,.45);
}
.banner-cover { position: relative; z-index: 1; width: 112px; height: 150px; object-fit: cover; border-radius: 16px; flex-shrink: 0; box-shadow: 0 10px 22px rgba(170,92,20,.2); }
.banner-body { position: relative; z-index: 1; flex: 1; min-width: 0; }
.banner-body h1 { margin: 0; font-size: clamp(24px, 3.2vw, 34px); line-height: 1.3; }
.banner-body p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.banner-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.banner-progress { display: flex; align-items: center; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.banner-progress .progress-track { background: rgba(255,255,255,.72); }
.banner-progress .progress-fill { background: linear-gradient(90deg, #ff9f43, #ffbe5c); }

.lesson-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 28px 4px 14px; }
.lesson-toolbar h2 { margin: 0; font-size: 22px; }
.lesson-search { width: min(280px, 48vw); padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 13px; outline: none; }
.lesson-search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,138,61,.12); }
.lesson-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.lesson-row {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow-soft);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.lesson-row:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.lesson-play {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 15px; font-weight: 800;
}
.lesson-row.is-done .lesson-play { background: var(--green-soft); color: var(--green); }
.lesson-body { flex: 1; min-width: 0; }
.lesson-name { display: block; margin: 0; font-size: 16px; font-weight: 800; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 5px; color: var(--muted-2); font-size: 12px; }
.state-pill { padding: 3px 9px; border-radius: 999px; background: #f5f1ec; color: var(--muted-2); font-size: 11px; font-weight: 700; }
.state-pill.is-doing { background: var(--accent-soft); color: var(--accent-deep); }
.state-pill.is-done { background: var(--green-soft); color: var(--green); }
.note-pill { padding: 3px 9px; border-radius: 999px; background: #fff7e6; color: #b26a00; font-size: 11px; font-weight: 700; }
.lesson-progress { display: block; height: 6px; margin-top: 9px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.lesson-progress .progress-fill { display: block; height: 100%; }
.lesson-arrow { color: #d9a878; font-size: 22px; }

.empty { padding: 50px 20px; text-align: center; color: var(--muted-2); border: 1px dashed var(--line-strong); border-radius: 22px; background: rgba(255,255,255,.6); }

/* ---------- player ---------- */
.player-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; align-items: start; }
.player-main { min-width: 0; }
.player-titlebar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.player-titlebar h1 { margin: 0; font-size: clamp(22px, 2.8vw, 32px); line-height: 1.3; }
.player-titlebar .course-line { margin-bottom: 5px; color: var(--accent-deep); font-size: 12px; font-weight: 800; }
.player-titlebar .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; color: var(--muted-2); font-size: 12px; }
.player-tools { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.tool-btn {
  padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tool-btn:hover, .tool-btn.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tool-btn:disabled { opacity: .35; cursor: default; }
.tool-btn.plain { background: transparent; }

.lyrics-scroll {
  height: clamp(400px, calc(100vh - 270px), 720px);
  height: clamp(400px, calc(100dvh - 270px), 720px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 6px 34vh;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 28px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22px, #000 calc(100% - 28px), transparent 100%);
}
.lyric-line {
  display: block; width: 100%;
  padding: 12px 18px 12px 22px;
  border: 1px solid transparent;
  border-left: 5px solid transparent;
  border-radius: 16px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  opacity: .56;
  transition: opacity .18s ease, background .18s ease, border-color .18s ease, transform .18s ease;
}
.lyric-line:hover { opacity: .85; background: rgba(255,255,255,.55); }
.lyric-line.is-active {
  opacity: 1;
  background: var(--accent-soft);
  border-color: var(--line-strong);
  border-left-color: var(--accent);
  transform: translateX(2px);
  box-shadow: 0 8px 20px rgba(255, 138, 61, 0.09);
}
.lyric-en {
  display: block;
  color: var(--muted);
  font-size: calc(clamp(18px, 1.65vw, 25px) * var(--lyric-scale));
  line-height: 1.5;
  font-weight: 700;
  transition: color .18s ease, font-size .18s ease;
}
.lyric-line.is-active .lyric-en { color: var(--accent-deep); font-weight: 800; }
.lyric-zh {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: calc(clamp(13px, 1.1vw, 16px) * var(--lyric-scale));
  line-height: 1.55;
}
.lyric-line.is-active .lyric-zh { color: var(--muted); }
.lyrics-scroll.mode-en .lyric-zh { display: none; }
.lyrics-scroll.mode-zh .lyric-en { display: none; }
.lyrics-empty { padding: 40px 20px; text-align: center; color: var(--muted-2); }

.player-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 92px; }
.side-card { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.side-course { display: flex; gap: 14px; align-items: center; }
.side-course img { width: 64px; height: 86px; object-fit: cover; border-radius: 11px; }
.side-course h2 { margin: 0; font-size: 16px; line-height: 1.35; }
.side-course p { margin: 5px 0 0; color: var(--muted-2); font-size: 12px; }

.seek-row { display: flex; align-items: center; gap: 10px; }
.seek-row input[type="range"] { flex: 1; accent-color: var(--accent); cursor: pointer; }
.time { color: var(--muted-2); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.play-row { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 14px 0 12px; }
.skip-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--accent-soft); color: var(--accent-deep);
  font-size: 12px; font-weight: 800; cursor: pointer;
}
.play-btn {
  width: 66px; height: 66px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; font-size: 22px; cursor: pointer;
  box-shadow: 0 14px 26px rgba(255, 138, 61, 0.3);
}
.play-btn:hover { background: var(--accent-deep); }
.side-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nav-row { display: flex; gap: 10px; margin-top: 12px; }
.nav-row a { flex: 1; text-align: center; padding: 10px 8px; border-radius: 14px; background: var(--accent-softer); color: var(--muted); font-size: 12px; font-weight: 700; }
.nav-row a:hover { background: var(--accent-soft); color: var(--accent-deep); }
.nav-row a.is-disabled { pointer-events: none; opacity: .35; }
.local-note { color: var(--muted-2); font-size: 11px; line-height: 1.6; text-align: center; }

.countdown {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 60; display: flex; align-items: center; gap: 14px;
  min-width: min(420px, calc(100vw - 36px));
  padding: 14px 18px; border-radius: 18px;
  background: rgba(61, 42, 26, 0.95); color: #fff;
  box-shadow: 0 18px 40px rgba(61, 42, 26, 0.28);
}
.countdown[hidden] { display: none; }
.countdown strong { display: block; font-size: 14px; }
.countdown small { display: block; margin-top: 2px; color: #ffd9a8; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.countdown .count { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); font-weight: 800; }
.countdown button { border: 0; border-radius: 999px; padding: 8px 14px; background: rgba(255,255,255,.16); color: #ffe7c7; font-size: 12px; font-weight: 700; cursor: pointer; }

.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  z-index: 80; max-width: min(440px, calc(100vw - 40px));
  padding: 12px 18px; border-radius: 14px;
  background: rgba(61, 42, 26, .94); color: #fff; font-size: 13px;
  box-shadow: 0 14px 30px rgba(61,42,26,.25);
}
.toast[hidden] { display: none; }

/* ---------- study notes ---------- */
.study-section { margin-top: 34px; padding-top: 26px; border-top: 1px dashed var(--line-strong); scroll-margin-top: 88px; }
.study-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.study-title { display: flex; align-items: center; gap: 10px; font-size: 24px; font-weight: 800; }
.study-title img { width: 38px; height: 38px; padding: 6px; border-radius: 12px; background: var(--accent-soft); }
.study-sub { margin-top: 5px; color: var(--muted-2); font-size: 13px; }
.study-badge { padding: 6px 13px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 800; white-space: nowrap; }
.study-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.study-tags span { padding: 4px 11px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }

.study-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; padding-bottom: 0; }
.study-tab {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 15px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.study-tab small { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent-softer); color: var(--muted-2); font-size: 10px; display: inline-grid; place-items: center; }
.study-tab:hover { border-color: var(--line-strong); color: var(--accent-deep); }
.study-tab.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.study-tab.is-active small { background: rgba(255,255,255,.24); color: #fff; }

.study-content { margin-top: 16px; }
.study-empty { padding: 34px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 22px; background: rgba(255,255,255,.6); color: var(--muted-2); font-size: 13px; }
.study-empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 6px; }
.study-empty p { margin: 0; line-height: 1.7; }

.vocab-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.vocab-card { padding: 14px 15px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-soft); }
.vocab-card.is-key { border-color: #ffd6ac; background: linear-gradient(180deg, #fffaf3, #fff); }
.vocab-top { display: flex; align-items: center; gap: 7px; }
.vocab-top strong { font-size: 17px; line-height: 1.3; }
.vocab-star { color: var(--accent); font-size: 12px; }
.speak-btn { margin-left: auto; border: 0; background: var(--accent-softer); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 13px; color: var(--accent-deep); }
.speak-btn:hover { background: var(--accent-soft); }
.vocab-line2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 6px; }
.vocab-phonetic { color: var(--muted-2); font-size: 12px; font-family: "Segoe UI", "PingFang SC", sans-serif; white-space: nowrap; }
.vocab-meaning { color: var(--ink-soft); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.pos { display: inline-block; padding: 1px 6px; border-radius: 6px; background: var(--accent-softer); color: var(--muted); font-size: 10px; font-weight: 800; }

.study-card, .pattern-card {
  margin-bottom: 12px; padding: 20px 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-soft);
}
.study-card h3, .pattern-head code { margin: 0 0 8px; font-size: 17px; font-weight: 800; color: var(--ink); }
.study-card p { margin: 7px 0 0; color: var(--ink-soft); font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.study-notes { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.study-table-wrap { margin-top: 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 14px; }
.study-table { width: 100%; border-collapse: collapse; min-width: 520px; font-size: 13px; }
.study-table th, .study-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.study-table th { background: var(--accent-softer); color: var(--muted); font-weight: 800; white-space: nowrap; }
.study-table tr:last-child td { border-bottom: 0; }
.study-table td { color: var(--ink-soft); line-height: 1.65; }

.block-heading { margin: 18px 0 8px; color: var(--ink); font-size: 16px; line-height: 1.5; font-weight: 800; }
.block-heading:first-child { margin-top: 0; }
.block-heading--2 { font-size: 18px; }
.block-heading--3 { padding-left: 10px; border-left: 4px solid var(--accent); }
.block-heading--4 { color: var(--accent-deep); font-size: 15px; }
.block-paragraph { margin: 8px 0; color: var(--ink-soft); font-size: 14px; line-height: 1.9; overflow-wrap: anywhere; }
.block-quote { margin: 10px 0; padding: 11px 14px; border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--accent-softer); color: var(--muted); font-size: 13px; line-height: 1.8; }
.block-note { margin: 10px 0; padding: 12px 14px; border-radius: 12px; background: #fff7e6; color: #8a5a20; font-size: 13px; line-height: 1.8; }
.block-list { margin: 8px 0; padding-left: 20px; color: var(--ink-soft); font-size: 14px; line-height: 1.9; }
.block-code { margin: 10px 0; padding: 12px 14px; border-radius: 12px; background: #3d2a1a; color: #ffe7c7; font-size: 13px; line-height: 1.7; overflow-x: auto; white-space: pre-wrap; }

.example-line { margin-top: 12px; padding: 11px 14px; border-left: 4px solid var(--accent); border-radius: 0 12px 12px 0; background: var(--accent-softer); }
.example-en { display: block; color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.5; }
.example-zh { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }

.pattern-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.pattern-head code { padding: 3px 8px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-deep); font-size: 15px; }
.pattern-head span { color: var(--muted); font-size: 13px; }

.word-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.word-chips span { padding: 6px 12px; border-radius: 999px; background: var(--accent-softer); border: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; }

.quiz-summary { margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-deep); font-size: 13px; font-weight: 700; }
.quiz-card { margin-bottom: 12px; padding: 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-soft); }
.quiz-card.is-correct { border-color: #b9ebd1; background: #fbfffd; }
.quiz-card.is-wrong { border-color: #ffd0c9; background: #fffaf9; }
.quiz-head { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.quiz-head > span { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); font-size: 12px; font-weight: 800; }
.quiz-head strong { flex: 1; min-width: 0; font-size: 15px; line-height: 1.6; }
.quiz-head em { padding: 2px 8px; border-radius: 999px; background: #f5f1ec; color: var(--muted-2); font-size: 10px; font-style: normal; font-weight: 700; }
.quiz-options { display: grid; gap: 8px; margin-top: 12px; }
.quiz-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink-soft); text-align: left; font-size: 13px; cursor: pointer;
}
.quiz-option > span { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-softer); color: var(--muted); font-size: 11px; font-weight: 800; }
.quiz-option:hover { border-color: var(--line-strong); }
.quiz-option.is-selected { border-color: var(--accent); background: var(--accent-softer); }
.quiz-option.is-correct { border-color: #8ed9b4; background: var(--green-soft); }
.quiz-option.is-wrong { border-color: #f2a59b; background: #fff1ef; }
.quiz-option:disabled { cursor: default; }
.quiz-fill { display: flex; gap: 8px; margin-top: 12px; }
.quiz-fill input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 13px; outline: none; }
.quiz-fill input:focus { border-color: var(--accent); }
.quiz-submit { margin-top: 10px; padding: 9px 18px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-size: 13px; font-weight: 800; cursor: pointer; }
.quiz-submit:hover { background: var(--accent-deep); }
.quiz-feedback { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-softer); color: var(--muted); font-size: 12px; line-height: 1.7; }

@media (max-width: 900px) {
  .course-grid { grid-template-columns: 1fr; }
  .lesson-list { grid-template-columns: 1fr; }
  .player-layout { display: flex; flex-direction: column; }
  .player-side { order: -1; position: static; }
  .player-side .side-card:first-child { display: none; }
  .player-side .local-note { display: none; }
  .lyrics-scroll { height: 58vh; height: 58dvh; min-height: 360px; padding-bottom: 24vh; }
  .player-titlebar { flex-direction: column; }
  .player-tools { justify-content: flex-start; }
  .vocab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .study-table-wrap { overflow: visible; border: 0; border-radius: 0; }
  .study-table { min-width: 0; border-collapse: separate; border-spacing: 0; }
  .study-table thead { display: none; }
  .study-table tbody, .study-table tr, .study-table td { display: block; width: 100%; }
  .study-table tr { margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
  .study-table td { display: block; padding: 9px 12px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 13px; line-height: 1.65; }
  .study-table tr td:last-child { border-bottom: 0; }
  .study-table td::before { content: attr(data-label); display: block; margin-bottom: 3px; color: var(--muted-2); font-size: 12px; font-weight: 700; line-height: 1.6; }
  .study-table td[data-label=""]::before { display: none; }
  .study-table--cols-2 td::before { display: none; }
  .study-table--cols-2 td:first-child { color: var(--ink); font-weight: 700; }
}

@media (max-width: 640px) {
  .app { width: min(100% - 22px, 1180px); padding-top: 14px; }
  .site-header { padding: calc(11px + env(safe-area-inset-top)) 14px 11px; }
  .local-pill { display: none; }
  .brand-text small { display: none; }
  .brand-text strong { font-size: 16px; }
  .hero { border-radius: 26px; padding: 24px 20px; }
  .hero h1 { font-size: 30px; }
  .hero-actions { gap: 10px; }
  .hero-btn { padding: 12px 20px; font-size: 14px; }
  .steps { grid-template-columns: 1fr; }
  .course-banner { flex-direction: column; gap: 16px; }
  .banner-cover { width: 88px; height: 118px; }
  .lesson-toolbar { flex-direction: column; align-items: flex-start; }
  .lesson-search { width: 100%; }
  .course-card { padding: 14px; gap: 14px; }
  .course-cover { width: 82px; height: 110px; }
  .course-title { font-size: 16px; }
  .lyric-line { padding: 10px 12px 10px 16px; }
  .lyric-en { font-size: calc(19px * var(--lyric-scale)); }
  .lyric-zh { font-size: calc(13px * var(--lyric-scale)); }
  .side-card { padding: 16px; }
  .tool-btn { min-height: 38px; }
  .countdown { bottom: calc(16px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
}

@media (max-width: 520px) {
  .vocab-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .study-card, .pattern-card { padding: 16px; }
}

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