:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --replay: #f59e0b;
  --replay-soft: #fef3c7;
  --next: #10b981;
  --next-soft: #d1fae5;
  --danger: #ef4444;
  --radius: 14px;
  --sidebar-w: 300px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* 登录门禁 */
.auth-gate {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background:
    radial-gradient(1200px 600px at 10% -10%, #dbeafe 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #fef3c7 0%, transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 20px;
  padding: 28px 24px 22px; box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}
.auth-brand { font-size: 28px; font-weight: 800; letter-spacing: 0.02em; }
.auth-sub { margin: 6px 0 18px; color: var(--muted); font-size: 14px; }
.auth-tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.auth-tabs button {
  flex: 1; border: none; background: transparent; border-radius: 9px; padding: 10px 8px;
  font-size: 14px; font-weight: 600; color: var(--muted);
}
.auth-tabs button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.auth-form { display: grid; gap: 12px; }
.auth-field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
/* iPad/Safari：不用 type=password，避免「使用强密码」挡住手动输入 */
.password-mask {
  -webkit-text-security: disc;
  text-security: disc;
}
.auth-field input {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 12px; font-size: 16px; color: var(--ink);
}
.auth-field input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.auth-submit {
  border: none; border-radius: 12px; padding: 14px; font-size: 16px; font-weight: 700;
  background: var(--accent); color: #fff; margin-top: 4px;
}
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-msg { min-height: 1.2em; margin: 0; font-size: 13px; color: var(--danger); }
.auth-msg.ok { color: var(--next); }
.auth-note { margin: 14px 0 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.account-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.catalog-hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; line-height: 1.5; }
.catalog-editor { display: grid; gap: 12px; max-height: 60dvh; overflow: auto; }
.catalog-row {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--bg);
  display: grid; gap: 8px;
}
.catalog-folder { font-size: 11px; color: var(--muted); word-break: break-all; }
.catalog-row label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.catalog-row input {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; color: var(--ink); background: #fff;
}
.catalog-actions { display: flex; gap: 10px; align-items: center; }
.catalog-actions .cat-save {
  border: none; border-radius: 8px; padding: 8px 14px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 600;
}
.account-bar {
  flex: 0 0 auto;
  padding: 8px 12px 4px; border-bottom: 1px solid var(--line); display: grid; gap: 4px;
}
.account-email { font-size: 12px; color: var(--muted); word-break: break-all; }

#app { display: flex; height: 100dvh; }

/* 侧栏：默认抽屉收起，不占主学习区；点左上角 ☰ 再打开 */
#sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  max-width: 86vw;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
#sidebar.open { transform: translateX(0); }
.sidebar-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 8px;
}
.brand { font-weight: 700; font-size: 18px; }
.icon-btn {
  border: none; background: transparent; font-size: 20px; color: var(--muted);
  width: 40px; height: 40px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg); }
#closeSidebar, #openSidebar { display: inline-flex; }
.course-tabs { display: flex; gap: 6px; padding: 8px 12px; flex-wrap: wrap; }
.course-tabs.folders {
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: none;
}
.course-tab {
  flex: 1 1 auto; border: 1px solid var(--line); background: var(--bg); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; color: var(--muted); text-align: left; line-height: 1.3;
}
.course-tab.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.series-folder {
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
  overflow: visible; flex: 0 0 auto;
}
.series-folder.open { border-color: #fdba74; background: #fffbeb; }
.series-head {
  width: 100%; display: flex; align-items: center; gap: 8px;
  border: none; background: transparent; padding: 12px 12px; text-align: left; color: var(--ink);
}
.series-head.active { color: #9a3412; font-weight: 700; }
.series-head .folder-ico { font-size: 16px; flex: 0 0 auto; }
.series-head .series-name {
  flex: 1; font-size: 15px; font-weight: 650; line-height: 1.35;
  white-space: normal; word-break: break-word;
}
.series-head .meta { font-size: 12px; color: var(--muted); flex: 0 0 auto; }
.book-picker {
  display: grid; gap: 6px; padding: 0 12px 8px;
}
.book-picker-label {
  font-size: 12px; color: var(--muted);
}
.book-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid #fdba74;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239a3412' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 12px center;
  border-radius: 10px;
  padding: 11px 36px 11px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}
.book-select:focus {
  outline: 2px solid #fed7aa;
  border-color: #ea580c;
}
.series-units {
  border-top: 1px dashed #fdba74;
  margin: 0 8px 10px;
  padding: 4px 4px 2px;
  max-height: min(48vh, 420px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(255,255,255,0.55);
  border-radius: 10px;
}
.unit-list-label {
  position: sticky; top: 0; z-index: 1;
  padding: 8px 8px 6px; font-size: 12px; font-weight: 700; color: var(--muted);
  background: #fffbeb;
}
.unit-list {
  display: none;
}
.unit-item {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  border: none; background: transparent; border-radius: 10px; padding: 10px 12px;
  font-size: 15px; color: var(--ink); text-align: left;
}
.unit-item:hover { background: var(--bg); }
.unit-item.active { background: var(--accent); color: #fff; }
.unit-item .meta { font-size: 12px; color: var(--muted); }
.unit-item.active .meta { color: rgba(255,255,255,0.8); }
.unit-item.no-seg .meta { color: var(--danger); }
.unit-item.bank { border: 1px dashed #fdba74; background: #fff7ed; margin: 6px 0; }
.unit-item.bank.active { background: #ea580c; border-color: #ea580c; }
.unit-item.bank.locked { opacity: 0.55; }
.sidebar-foot { flex: 0 0 auto; padding: 10px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* 主区 */
#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.title-block { flex: 1; min-width: 0; }
.unit-title { font-size: 20px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-title { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode-switch { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 4px; }
.mode-btn {
  border: none; background: transparent; padding: 8px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted);
}
.mode-btn.active { background: var(--panel); color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.mode-btn:disabled,
.mode-btn.locked {
  opacity: 0.45; cursor: not-allowed; color: var(--muted);
}
.w.ok-mark { color: #047857; }

.options {
  display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 14px;
}
.opt { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.opt select { font-size: 14px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.opt.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }
.opt-btn {
  margin-left: auto; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 12px; font-size: 13px; color: var(--muted);
}
.opt-btn.active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

.mode-btn .step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; background: var(--line); color: var(--muted);
  font-size: 11px; margin-right: 6px; vertical-align: 1px;
}
.mode-btn.active .step { background: var(--accent); color: #fff; }
.opt.info { font-size: 13px; color: var(--muted); }

/* 关卡条 */
.stage-bar { align-items: center; }
.stage-bar .mode-btn { display: inline-flex; align-items: center; gap: 4px; position: relative; }
.stage-bar .mode-btn .sub {
  font-size: 11px; font-weight: 700; color: var(--muted); background: var(--line); border-radius: 999px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.stage-bar .mode-btn .sub:empty { display: none; }
.stage-bar .mode-btn.done .step { background: var(--next); color: #fff; }
.stage-bar .mode-btn.done .sub { background: var(--next-soft); color: #047857; }
.stage-bar .mode-btn.active.done .sub { background: var(--next); color: #fff; }
.stage-bar .mode-btn[data-mode="record"].done .sub { background: #fef3c7; color: #b45309; }
.stage-bar .mode-btn.locked .sub { background: transparent; }
.stage-link { width: 14px; height: 2px; background: var(--line); border-radius: 2px; flex: 0 0 auto; }
.star-pill {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid #fde68a; background: #fffbeb; color: #b45309;
  border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer;
  transition: transform 0.1s;
}
.star-pill:hover { transform: scale(1.05); background: #fef3c7; }
.pick-course-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  border: 1px solid #93c5fd; background: #2563eb; color: #fff;
  border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 700;
  white-space: nowrap; cursor: pointer; transition: transform 0.1s, box-shadow 0.2s;
}
.pick-course-btn:hover { background: #1d4ed8; transform: scale(1.03); }
.pick-course-btn .pick-course-ico { font-size: 15px; line-height: 1; }
.pick-course-btn.need-tap {
  animation: need-tap-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55);
}
.unit-item.crowned { background: linear-gradient(90deg, #fffbeb, transparent); }

/* 庆祝弹窗 */
.cele { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15,23,42,0.45); opacity: 0; transition: opacity 0.25s; overflow: hidden; }
.cele.show { opacity: 1; }
.cele.hidden { display: none; }
.cele-fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cele-card {
  position: relative; background: #fff; border-radius: 24px; padding: 28px 28px 22px; max-width: 460px; width: 100%; text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25); transform: translateY(24px) scale(0.92); transition: transform 0.35s cubic-bezier(.2,1.4,.4,1);
}
.cele.show .cele-card { transform: none; }
.cele-close { position: absolute; top: 10px; right: 10px; }
.cele-emoji { font-size: 64px; line-height: 1; margin-bottom: 8px; display: inline-block; animation: cele-pop 0.7s cubic-bezier(.2,1.6,.4,1); }
.cele-card h2 { margin: 6px 0 6px; font-size: 24px; letter-spacing: 0.5px; }
.cele-card p { margin: 0 0 10px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.cele-extra { margin: 6px 0 14px; }
.cele-extra.hidden { display: none; }
.cele-stars { font-size: 30px; letter-spacing: 4px; color: #f59e0b; margin: 4px 0; }
.cele-stars .off { color: #e2e8f0; }
.cele-tip { font-size: 14px; color: #92400e; background: #fffbeb; border-radius: 12px; padding: 8px 12px; margin-top: 8px; }
.cele-tip code { background: #fff; border: 1px solid #fde68a; border-radius: 6px; padding: 1px 6px; font-size: 14px; margin: 0 2px; }
.cele-crown { font-size: 16px; font-weight: 700; color: #b45309; margin-top: 6px; animation: cele-glow 1.4s ease-in-out infinite; }
.cele-btn {
  display: block; width: 100%; border: none; border-radius: 16px; padding: 14px; font-size: 17px; font-weight: 700; color: #fff;
  background: var(--accent); cursor: pointer; transition: transform 0.1s;
}
.cele-btn:hover { transform: scale(1.02); }
.cele-btn2 { display: block; margin: 10px auto 0; font-size: 14px; color: var(--muted); }
.cele-btn2.hidden { display: none; }
.cele.epic .cele-card { background: radial-gradient(circle at 50% 0%, #fff7ed, #fff 60%); border: 3px solid #fbbf24; box-shadow: 0 0 0 8px rgba(251,191,36,0.25), 0 24px 60px rgba(0,0,0,0.3); }
.cele.epic .cele-emoji { font-size: 84px; animation: cele-trophy 1s cubic-bezier(.2,1.6,.4,1); }
.cele.epic h2 { color: #b45309; font-size: 28px; }
.cele.epic .cele-btn { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.cele.big .cele-btn { background: var(--next); }
.cele.warm { background: rgba(15,23,42,0.3); }
.cele.warm .cele-card { background: #fffdf7; }
.cele.warm .cele-btn { background: #f59e0b; }
.cele.small .cele-card { max-width: 380px; padding: 22px 22px 18px; }
.cele.small .cele-emoji { font-size: 44px; }
.cele.small h2 { font-size: 20px; }
@keyframes cele-pop { 0% { transform: scale(0.2) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.15) rotate(5deg); opacity: 1; } 100% { transform: none; } }
@keyframes cele-trophy { 0% { transform: scale(0.1) translateY(60px); opacity: 0; } 60% { transform: scale(1.25) translateY(-8px); opacity: 1; } 100% { transform: none; } }
@keyframes cele-glow { 0%,100% { text-shadow: 0 0 0 rgba(245,158,11,0); } 50% { text-shadow: 0 0 18px rgba(245,158,11,0.8); } }

/* 彩带 */
.confetti { position: absolute; top: -20px; border-radius: 2px; opacity: 0.95; animation: confetti-fall 3s linear forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg) translateX(0); opacity: 1; }
  25% { transform: translateY(25vh) rotate(180deg) translateX(20px); }
  50% { transform: translateY(50vh) rotate(360deg) translateX(-20px); }
  75% { transform: translateY(75vh) rotate(540deg) translateX(15px); }
  100% { transform: translateY(105vh) rotate(720deg) translateX(0); opacity: 0.6; }
}
/* 烟花 */
.firework { position: absolute; width: 0; height: 0; animation: fw-fade 1.4s ease-out forwards; }
.firework i { position: absolute; width: 7px; height: 7px; border-radius: 50%; left: 0; top: 0; animation: fw-burst 1.2s ease-out forwards; animation-delay: inherit; opacity: 0; }
@keyframes fw-burst { 0% { transform: translate(0,0) scale(0.6); opacity: 0; } 8% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } }
@keyframes fw-fade { 0%,100% { opacity: 1; } }

/* 逐句过关：飞星 + 连击 */
.fly-star { position: fixed; z-index: 70; font-size: 28px; pointer-events: none; animation: fly-star 1s ease-out forwards; }
@keyframes fly-star { 0% { transform: translateY(0) scale(0.4); opacity: 0; } 20% { transform: translateY(-10px) scale(1.3); opacity: 1; } 100% { transform: translateY(-90px) scale(0.8); opacity: 0; } }
.sentence.just-passed { animation: row-pass 0.9s ease-out; }
@keyframes row-pass { 0% { background: #d1fae5; box-shadow: 0 0 0 0 rgba(16,185,129,0.6); } 100% { background: transparent; box-shadow: 0 0 0 16px rgba(16,185,129,0); } }
.combo-bubble {
  position: fixed; z-index: 70; left: 50%; top: 22%; transform: translate(-50%, 20px) scale(0.6); opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, #f59e0b, #ef4444); color: #fff; font-size: 22px; font-weight: 800; padding: 12px 26px; border-radius: 999px;
  box-shadow: 0 12px 30px rgba(239,68,68,0.35); transition: transform 0.35s cubic-bezier(.2,1.6,.4,1), opacity 0.3s;
}
.combo-bubble.show { transform: translate(-50%, 0) scale(1); opacity: 1; }
.combo-bubble b { font-size: 30px; margin-right: 4px; }

/* 荣誉墙 */
.honor-top { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 10px; }
.honor-stat { background: #fffbeb; border-radius: 14px; padding: 10px 6px; text-align: center; }
.honor-stat b { display: block; font-size: 24px; color: #b45309; }
.honor-stat span { font-size: 12px; color: var(--muted); }
.honor-hint { text-align: center; color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; border: 1px solid var(--line); border-radius: 14px; padding: 10px 6px; }
.badge.earned { border-color: #fde68a; background: linear-gradient(180deg, #fffbeb, #fff); }
.badge.locked { opacity: 0.55; filter: grayscale(0.6); }
.badge-ico { font-size: 28px; line-height: 1.2; }
.badge-name { font-size: 13px; font-weight: 700; }
.badge-desc { font-size: 11px; color: var(--muted); line-height: 1.3; }
.honor-h { margin: 14px 0 6px; font-size: 14px; }
.honor-list { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); columns: 2; }
@media (max-width: 720px) {
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .honor-list { columns: 1; }
}
.link-btn { border: none; background: transparent; color: var(--accent); font-size: 13px; padding: 2px 4px; text-decoration: underline; }
.banner {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: #fff7ed; color: #9a3412; border-bottom: 1px solid #fed7aa; font-size: 13px;
}
.content { flex: 1; overflow-y: auto; padding: 16px; scroll-behavior: smooth; }

/* 逐词点亮 */
.w { border-radius: 4px; padding: 0 1px; transition: background 0.08s, color 0.08s; }
.w.done { color: var(--accent); }
.w.on { background: #fde047; color: #1e293b; box-shadow: 0 0 0 2px #fde047; }
.w.wrong {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  text-decoration: underline wavy #ef4444;
  text-decoration-thickness: 3px;
  cursor: help;
  box-shadow: 0 0 0 2px #fecaca;
}
.w.wrong.on {
  background: #fecaca !important;
  box-shadow: 0 0 0 3px #ef4444;
}
.w.missing { color: #b91c1c; text-decoration: line-through; opacity: 0.7; }

/* 成段显示（连读 / 录音） */
.passage {
  background: var(--panel); border-radius: var(--radius); padding: 28px 32px;
  font-family: Georgia, "Times New Roman", serif; font-size: 26px; line-height: 1.9; color: var(--ink);
  max-width: 900px; margin: 0 auto;
}
.passage .sent { cursor: pointer; border-radius: 6px; padding: 2px 3px; margin: 0 -3px; transition: background 0.15s; }
.passage .sent:hover { background: #f1f5f9; }
.passage .sent.current { background: #eef4ff; }
.passage .sent.heading { display: block; font-weight: 700; margin-bottom: 8px; }
.passage.hide-text .sent:not(.current) { filter: blur(8px); user-select: none; }
.passage.hide-text.recite-mask .sent { filter: blur(10px); user-select: none; }
.passage.hide-text.recite-mask.peek .sent { filter: none; user-select: text; }
.passage.hide-text.recite-mask.peek .w.wrong { text-decoration: underline wavy #ef4444; }
.round-info { text-align: center; color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.round-info b { color: var(--accent); }

/* 句子列表 */
.sentence-list { flex: 1; overflow-y: auto; padding: 16px; scroll-behavior: smooth; }
.empty { color: var(--muted); text-align: center; padding: 60px 20px; font-size: 16px; }
.sentence {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel); border: 2px solid transparent; border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sentence:hover { border-color: var(--line); }
.sentence.current { border-color: var(--accent); background: #eef4ff; }
.sentence.current.playing { box-shadow: 0 0 0 4px rgba(37,99,235,0.15); }
.sentence.passed { border-color: #86efac; }
.sentence.failed { border-color: #fca5a5; }
.sentence.failed.current { border-color: #ef4444; background: #fff1f2; }
.sentence .num {
  flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--bg); color: var(--muted);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.sentence.current .num { background: var(--accent); color: #fff; }
.sentence .txt { flex: 1; font-size: 22px; line-height: 1.45; font-family: Georgia, "Times New Roman", serif; }
.sentence .mid { flex: 1; min-width: 0; display: grid; gap: 4px; }
.sentence .verdict { font-size: 12px; color: var(--muted); line-height: 1.35; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.sentence .verdict.ok { color: #047857; font-weight: 600; }
.sentence .verdict.bad { color: #b91c1c; font-weight: 600; }
.sentence .verdict.scoring { color: var(--accent); }
.sentence.locked-ahead { opacity: 0.45; }
.sentence.locked-ahead .txt { filter: grayscale(0.3); }
.sentence.current .txt { font-weight: 600; }
.sentence .dur { flex: 0 0 auto; font-size: 12px; color: var(--muted); padding-top: 8px; font-variant-numeric: tabular-nums; }
.sentence-list.hide-text .sentence:not(.current) .txt,
.sentence-list.hide-text .sentence.current:not(.revealed) .txt { filter: blur(8px); user-select: none; }

/* 跟读录音角标 */
.sentence .rec {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 10px;
  font-size: 12px; color: var(--muted); margin-top: 4px;
}
.sentence .rec.has { border-color: #fbbf24; background: #fffbeb; color: #92400e; cursor: pointer; }
.sentence .rec.has:hover { background: #fef3c7; }
.sentence .rec.pass { border-color: #86efac; background: #ecfdf5; color: #047857; cursor: pointer; }
.sentence .rec.fail { border-color: #fca5a5; background: #fef2f2; color: #b91c1c; cursor: pointer; }
.sentence .rec.scoring { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sentence .rec.live { border-color: var(--danger); background: #fef2f2; color: var(--danger); font-weight: 600; }
.sentence .rec.playing { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.rec-indicator { color: var(--danger); font-weight: 600; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* 录音环节 */
.record-wrap { max-width: 900px; margin: 0 auto; }
.record-hint { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0; }
.attempts { display: grid; gap: 10px; margin-top: 16px; }
.attempt {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--panel); border: 2px solid transparent; border-radius: var(--radius); padding: 12px 16px; cursor: pointer;
}
.attempt:hover { border-color: var(--line); }
.attempt.selected { border-color: var(--accent); }
.attempt .n { flex: 0 0 auto; font-weight: 700; font-size: 16px; }
.attempt .dur { flex: 0 0 auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.attempt .stars { flex: 0 0 auto; font-size: 20px; letter-spacing: 2px; color: #f59e0b; }
.attempt .stars .off { color: #e2e8f0; }
.attempt .acc { flex: 1 1 auto; font-size: 13px; color: var(--muted); }
.attempt .acc .up { color: var(--next); font-weight: 600; }
.attempt .acc .down { color: var(--muted); }
.attempt .best { background: #fef3c7; color: #92400e; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.attempt .playbtn {
  flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; width: 38px; height: 38px;
  font-size: 15px; color: var(--ink);
}
.attempt .playbtn.playing { background: var(--accent); color: #fff; border-color: var(--accent); }
.attempt .scoring { color: var(--muted); font-size: 13px; }
.attempt .scoring::after { content: "…"; animation: blink 1s steps(2) infinite; }
.attempt .err { color: var(--danger); font-size: 12px; }
.attempts-head { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; font-size: 14px; color: var(--muted); }
.attempts-head button { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 5px 10px; font-size: 13px; color: var(--danger); }
.ctl.record { background: #fee2e2; color: #b91c1c; width: 220px; }
.ctl.record:hover { background: #fecaca; }
.ctl.record.live { background: var(--danger); color: #fff; animation: pulse-red 1.2s ease-in-out infinite; }
.ctl.record.coach { background: #ffedd5; color: #9a3412; animation: none; width: min(280px, 86vw); }
@keyframes pulse-red { 0%,100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5);} 50% { box-shadow: 0 0 0 12px rgba(239,68,68,0);} }
.ctl.record:disabled { background: var(--bg); color: var(--muted); animation: none; }
.passage .sent.coach-focus .w.on,
.content .sent.coach-focus .w.on {
  background: #86efac;
  color: #14532d;
  box-shadow: 0 0 0 2px #4ade80;
}
.passage .sent.coach-focus {
  outline: 2px solid #f59e0b;
  background: #fffbeb;
  border-radius: 10px;
}
.celebrate { text-align: center; font-size: 15px; color: #b45309; margin-top: 12px; font-weight: 600; }

/* 今日复习 / 记忆曲线背诵：默认收起，不挡选课 */
.review-today {
  flex: 0 0 auto;
  margin: 0 12px 8px; padding: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #ecfdf5 0%, #eff6ff 100%);
  border: 1px solid #bbf7d0;
  overflow: hidden;
}
.review-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; border: none; background: transparent; padding: 10px 12px;
  font-size: 13px; font-weight: 700; color: #047857; text-align: left; cursor: pointer;
}
.review-toggle-label { min-width: 0; }
.review-chev {
  flex: 0 0 auto; width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid #047857;
  transition: transform 0.2s ease;
}
.review-today.open .review-chev { transform: rotate(180deg); }
.review-body {
  display: none;
  max-height: min(32vh, 260px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 8px 8px;
}
.review-today.open .review-body { display: block; }
.review-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%;
  border: none; background: rgba(255,255,255,0.7); border-radius: 10px; padding: 8px 10px;
  text-align: left; margin-bottom: 6px; color: var(--ink);
}
.review-item:last-child { margin-bottom: 0; }
.review-item:hover { background: #fff; }
.review-item .t { font-size: 14px; font-weight: 600; }
.review-item .m { font-size: 12px; color: var(--muted); }
.unit-item.due-review { border-left: 3px solid #10b981; }
.srs-panel {
  margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px;
  background: #f8fafc; border: 1px solid var(--line); font-size: 13px; color: var(--muted);
  line-height: 1.5;
}
.srs-panel .srs-line { margin: 0 0 4px; }
.srs-panel .srs-line b { color: var(--ink); }
.srs-panel .srs-tip { margin-top: 6px; font-size: 12px; color: #64748b; }
.link-btn.peek-text {
  display: block; margin: 8px auto 0; border: none; background: transparent;
  color: var(--accent); font-size: 13px; text-decoration: underline; text-underline-offset: 3px;
}

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 16px; max-width: 560px; width: 100%; max-height: 90dvh; overflow: auto; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 18px; font-size: 14px; line-height: 1.7; }
.modal-body ol { padding-left: 20px; }
.modal-body code { background: var(--bg); padding: 2px 6px; border-radius: 6px; font-size: 13px; word-break: break-all; }
.modal-body a { color: var(--accent); }

/* 编辑模式 */
.sentence-list.editing .sentence { cursor: default; flex-wrap: wrap; }
.sentence .txt[contenteditable] { outline: 1px dashed var(--accent); border-radius: 6px; padding: 2px 6px; cursor: text; }
.edit-tools { flex: 1 0 100%; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); padding-top: 6px; }
.edit-tools .grp { display: inline-flex; align-items: center; gap: 2px; background: var(--bg); border-radius: 8px; padding: 2px 6px; }
.edit-tools button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 8px; font-size: 12px; color: var(--ink); }
.edit-tools button.danger { color: var(--danger); }
.edit-tools .t { font-variant-numeric: tabular-nums; min-width: 52px; text-align: center; }
.editor-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: #fff8e1; border-top: 1px solid #fde68a; font-size: 13px; color: #92400e;
}
.editor-actions button { border: 1px solid #fcd34d; background: #fff; border-radius: 8px; padding: 6px 14px; font-size: 14px; }
.editor-actions button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 底部控制 */
.controls {
  background: var(--panel); border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.progress-wrap { display: flex; align-items: center; gap: 12px; }
.progress { position: relative; flex: 1; height: 10px; background: var(--line); border-radius: 6px; cursor: pointer; overflow: hidden; }
.progress .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); border-radius: 6px; }
.progress .ticks { position: absolute; inset: 0; }
.progress .tick { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(0,0,0,0.25); }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.status-line { display: flex; justify-content: center; gap: 12px; font-size: 14px; color: var(--muted); padding: 6px 0 2px; min-height: 22px; }
.repeat-count { color: var(--replay); font-weight: 600; }
.buttons { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 6px 0; }
.ctl {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: none; border-radius: 18px; background: var(--bg); color: var(--ink);
  width: 84px; height: 72px; transition: transform 0.08s, background 0.15s;
}
.ctl:active { transform: scale(0.96); }
.ctl .ico { font-size: 26px; line-height: 1; }
.ctl .lbl { font-size: 12px; }
.ctl.big { width: 120px; height: 92px; }
.ctl.big .ico { font-size: 34px; }
.ctl.big .lbl { font-size: 14px; font-weight: 600; }
.ctl.replay { background: var(--replay-soft); color: #b45309; }
.ctl.replay:hover { background: #fde68a; }
.ctl.play { background: var(--accent); color: #fff; }
.ctl.play:hover { background: #1d4ed8; }
.ctl.next { background: var(--next-soft); color: #047857; }
.ctl.next:hover { background: #a7f3d0; }
.ctl.pulse { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.4);} 50% { box-shadow: 0 0 0 10px rgba(16,185,129,0);} }
.ctl:disabled { opacity: 0.4; cursor: not-allowed; }
.keys { text-align: center; font-size: 12px; color: var(--muted); padding-top: 4px; }

.toast {
  position: fixed; left: 50%; bottom: 140px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 下一步提示条：告诉学生此刻该做什么 */
.next-step {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin: 0; padding: 12px 16px; background: #eff6ff; border-bottom: 1px solid #bfdbfe;
  color: #1e3a8a;
}
.next-step.hidden { display: none; }
.next-step-main { display: flex; align-items: flex-start; gap: 10px; flex: 1; min-width: 0; }
.next-step-tag {
  flex: 0 0 auto; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  background: #2563eb; color: #fff; border-radius: 8px; padding: 4px 8px; line-height: 1.2;
}
.next-step-text { font-size: 15px; font-weight: 600; line-height: 1.45; }
.next-step-text small { display: block; font-weight: 500; color: #64748b; margin-top: 2px; font-size: 13px; }
.next-step-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.next-step-go {
  border: none; background: #2563eb; color: #fff; font-weight: 700; font-size: 14px;
  border-radius: 10px; padding: 8px 14px; cursor: pointer;
}
.next-step-go:hover { background: #1d4ed8; }
.next-step.done-hint { background: #ecfdf5; border-bottom-color: #a7f3d0; color: #065f46; }
.next-step.done-hint .next-step-tag { background: #059669; }
.next-step.done-hint .next-step-go { background: #059669; }
.next-step.done-hint .next-step-go:hover { background: #047857; }

.ctl.play.need-tap {
  animation: need-tap-pulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55);
}
@keyframes need-tap-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); transform: scale(1.04); }
}

.start-intro {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 23, 42, 0.5);
}
.start-intro.hidden { display: none; }
.start-intro-card {
  width: min(420px, 100%); background: #fff; border-radius: 20px; padding: 26px 24px 20px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28); text-align: center;
}
.start-intro-brand {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; color: #2563eb; margin-bottom: 6px;
}
.start-intro-card h2 { margin: 0 0 16px; font-size: 22px; color: #0f172a; }
.start-intro-steps {
  list-style: none; padding: 0; margin: 0 0 18px; text-align: left; display: grid; gap: 10px;
  counter-reset: start-step;
}
.start-intro-steps li {
  display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 12px 12px 10px;
  counter-increment: start-step;
}
.start-intro-steps li::before {
  content: counter(start-step);
  width: 28px; height: 28px; border-radius: 50%; background: #2563eb; color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.start-intro-steps b { display: block; color: #0f172a; font-size: 15px; }
.start-intro-steps span { display: block; color: #64748b; font-size: 13px; margin-top: 2px; }
.start-intro-go {
  width: 100%; border: none; background: #2563eb; color: #fff; font-size: 16px; font-weight: 700;
  border-radius: 12px; padding: 14px 16px; cursor: pointer; margin-bottom: 8px;
}
.start-intro-go:hover { background: #1d4ed8; }
.start-intro-card > .link-btn { margin-top: 4px; }

/* 触屏 / 小屏 */
@media (max-width: 860px) {
  .keys { display: none; }
  .sentence .txt { font-size: 20px; }
  .ctl { width: 70px; height: 64px; }
  .ctl.big { width: 96px; height: 84px; }
  .buttons { gap: 10px; }
  .options { gap: 8px 12px; font-size: 13px; }
  .opt-btn { margin-left: 0; }
  .mode-btn { padding: 8px 10px; font-size: 14px; }
  .mode-btn .step { display: none; }
  .stage-link { display: none; }
  .star-pill { padding: 5px 9px; font-size: 13px; }
  .pick-course-btn { padding: 7px 11px; font-size: 13px; }
  .passage { padding: 18px 20px; font-size: 22px; line-height: 1.8; }
  .ctl.record { width: 170px; }
}
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .title-block { flex: 1 1 100%; }
  .stage-bar { flex: 1; justify-content: space-between; }
  .stage-bar .mode-btn { padding: 6px 8px; font-size: 13px; }
  .stage-bar .mode-btn .sub { font-size: 10px; padding: 0 5px; }
  .unit-title { font-size: 17px; }
  .options { padding: 8px 12px; }
  .sentence-list { padding: 12px; }
  .sentence { padding: 12px; gap: 10px; }
  .sentence .txt { font-size: 18px; }
  .sentence .dur { display: none; }
  .controls { padding-left: 10px; padding-right: 10px; }
  .buttons { gap: 8px; }
  .ctl { width: 64px; height: 60px; border-radius: 14px; }
  .ctl.big { width: 88px; height: 78px; }
  .ctl.big .ico { font-size: 28px; }
  .ctl.big .lbl { font-size: 13px; }
}
#backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 30; display: none; }
#backdrop.show { display: block; }

.mic-ask {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15, 23, 42, 0.45);
}
.mic-ask-card {
  width: 100%; max-width: 420px; background: #fff; border-radius: 20px;
  padding: 28px 24px 22px; text-align: center;
  box-shadow: 0 16px 50px rgba(15, 23, 42, 0.2);
}
.mic-ask-ico { font-size: 42px; line-height: 1; }
.mic-ask-card h2 { margin: 12px 0 8px; font-size: 22px; }
.mic-ask-card p { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.mic-ask-card #micAskBtn {
  width: 100%; border: none; border-radius: 12px; padding: 14px;
  font-size: 17px; font-weight: 700; background: var(--accent); color: #fff;
}

.wrong-summary {
  max-width: 900px; margin: 18px auto 8px; background: #fff7ed;
  border: 2px solid #fdba74; border-radius: var(--radius); padding: 16px 18px;
}
.wrong-summary h3 { margin: 0 0 8px; font-size: 16px; color: #9a3412; }
.wrong-summary .hint { margin: 0 0 10px; font-size: 13px; color: #9a3412; }
.word-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid #fed7aa; background: #fff; color: #9a3412;
  border-radius: 999px; padding: 6px 8px 6px 12px; font-size: 16px; font-weight: 700;
}
.word-chip b { font-size: 12px; font-weight: 600; color: #c2410c; margin-left: 4px; }
.word-chip .chip-x {
  margin-left: 4px; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #c2410c; background: #ffedd5;
}
.word-chip .chip-x:hover { background: #fdba74; color: #7c2d12; }
.wrong-summary .restore-words { margin-top: 8px; }
.wrong-summary.empty { background: #f0fdf4; border-color: #86efac; }
.wrong-summary.empty h3, .wrong-summary.empty .hint { color: #047857; }

.word-bank { max-width: 820px; margin: 0 auto; }
.word-bank-lead { color: var(--muted); font-size: 15px; margin: 0 0 16px; line-height: 1.5; }
.bank-card {
  background: var(--panel); border: 2px solid #fed7aa; border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px;
}
.bank-card .word { font-size: 32px; font-weight: 800; color: #9a3412; font-family: Georgia, serif; }
.bank-card .meta { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.bank-card .sent { font-size: 16px; line-height: 1.45; margin-bottom: 10px; }
.bank-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bank-card button {
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent);
  border-radius: 10px; padding: 8px 12px; font-weight: 600;
}
.bank-card .bank-drop {
  border-color: #fdba74; background: #fff7ed; color: #9a3412;
}

/* ---------- 我的教材：家长自助上传 ---------- */
.auth-check {
  display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.5; color: var(--muted);
}
.auth-check input { margin-top: 3px; flex: 0 0 auto; }
.auth-check a { color: var(--accent); }
.series-head.my-add { color: var(--muted); border-top: 1px dashed var(--line); margin-top: 4px; }
.series-head.my-add .series-name { color: var(--accent); }
.book-picker .my-manage { justify-self: start; padding: 4px 0 0; }
.my-uploads .my-upload-form { display: grid; gap: 10px; }
.my-uploads select, .my-uploads input[type="text"] {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; color: var(--ink); background: #fff;
}
.my-uploads input[type="file"] { font-size: 13px; }
.my-progress { display: grid; gap: 4px; }
.my-progress .bar { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.my-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.my-progress .txt { font-size: 12px; color: var(--muted); word-break: break-all; }
.my-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.my-h4 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); }
.my-course-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.my-course-head .meta { font-size: 12px; color: var(--muted); margin-right: auto; }
.my-units { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.my-units li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; padding: 4px 0; border-top: 1px dashed var(--line); }
.my-units .my-file { flex: 1 1 160px; word-break: break-all; }
.my-units .my-st { color: var(--muted); font-size: 12px; }
.my-units .bad { color: var(--danger); }
.my-units .muted, .muted { color: var(--muted); }
.link-btn.danger { color: var(--danger); }
.empty .ghost {
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 8px 14px; margin-top: 10px; font-size: 14px;
}

/* ---------- TED / 课文视频（底部硬字幕已裁切或遮罩） ---------- */
.video-stage {
  max-width: 920px;
  margin: 0 auto 10px;
  padding: 0 12px;
}
.video-frame {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #0b1220;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: min(42vh, 420px);
  min-height: 140px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, .18);
}
.video-frame video {
  width: 100%;
  height: auto;
  max-height: min(42vh, 420px);
  object-fit: contain;
  object-position: center center;
  display: block;
  background: #000;
}
.video-loading {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(11, 18, 32, 0.72); color: #e2e8f0; font-size: 14px; font-weight: 600;
  letter-spacing: .02em; pointer-events: none;
}
.video-loading.hidden { display: none; }
/* 用英语介绍中国：竖屏模板裁成横条后仍限高，给课文留空间 */
.video-stage--china .video-frame,
.video-stage--china .video-frame video {
  max-height: min(28vh, 280px);
}
.video-sub-mask {
  display: none; /* 原片保留中英硬字幕时不遮；TED 等已预裁字幕的不受影响 */
}
.video-hint {
  margin: 6px 2px 0;
  font-size: 12px;
  color: var(--muted);
}
@media (max-width: 720px) {
  .video-frame,
  .video-frame video { max-height: min(36vh, 320px); }
  .video-stage--china .video-frame,
  .video-stage--china .video-frame video { max-height: min(26vh, 220px); }
  .video-frame { border-radius: 10px; }
  .video-sub-mask { height: 16%; }
}

/* ===== 激励系统：HUD（星币 / 火苗 / 今日目标） ===== */
.hud { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.hud-pill {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 6px 11px;
  font-size: 14px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: transform 0.1s, background 0.2s;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
}
.hud-pill:hover { transform: scale(1.05); }
.coin-pill { border-color: #fcd34d; background: linear-gradient(180deg, #fffbeb, #fef3c7); color: #92400e; position: relative; }
.coin-pill.bump { animation: coin-bump 0.5s ease; }
@keyframes coin-bump { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-6deg); } 100% { transform: scale(1); } }
.coin-pill.has-chest::after {
  content: "🎁"; position: absolute; top: -9px; right: -6px; font-size: 14px; animation: chest-wiggle 1.4s ease-in-out infinite;
}
@keyframes chest-wiggle { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(12deg) translateY(-2px); } }
.streak-pill { color: #9ca3af; filter: grayscale(1); opacity: 0.8; }
.streak-pill.lit { color: #c2410c; border-color: #fdba74; background: linear-gradient(180deg, #fff7ed, #ffedd5); filter: none; opacity: 1; }
.streak-pill.lit:hover { background: #ffedd5; }
.goal-ring { position: relative; width: 40px; height: 40px; border: none; background: transparent; padding: 0; cursor: pointer; }
.goal-ring svg { width: 40px; height: 40px; transform: rotate(-90deg); }
.goal-ring circle { fill: none; stroke-width: 3.5; }
.goal-ring .bg { stroke: var(--line); }
.goal-ring .fg { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.goal-ring.done .fg { stroke: #f59e0b; }
.goal-ring .goal-txt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: var(--ink); }
.goal-ring.done .goal-txt { color: #b45309; font-size: 14px; }
.coin-float {
  position: fixed; z-index: 80; pointer-events: none; padding: 6px 12px; border-radius: 999px;
  background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; font-size: 14px; font-weight: 700;
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.25); opacity: 0; transform: translateY(0) scale(0.9); transition: all 0.35s ease;
  max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.coin-float span { font-weight: 500; color: #b45309; font-size: 12px; }
.coin-float.show { opacity: 1; transform: translateY(8px) scale(1); animation: coin-rise 2.2s ease forwards; }
@keyframes coin-rise { 0% { opacity: 0; transform: translateY(0) scale(0.9); } 15% { opacity: 1; transform: translateY(8px) scale(1.05); } 70% { opacity: 1; transform: translateY(12px) scale(1); } 100% { opacity: 0; transform: translateY(-30px) scale(0.95); } }

/* 侧栏：装扮 / 称号 / 联赛 */
.account-flair { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; padding-top: 4px; }
.flair-avatar { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); font-size: 15px; }
.flair-avatar.big { width: 52px; height: 52px; font-size: 30px; }
.flair-name { font-weight: 700; }
.flair-title { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: #fef3c7; color: #92400e; font-weight: 700; margin-left: 4px; }
.flair-pet { font-size: 16px; }
.flair-league { margin-left: auto; font-size: 11px; color: var(--muted); }

/* 奖励中心 */
.modal-card.wide { max-width: 720px; }
.rc-tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 12px; margin: -4px 0 14px; overflow-x: auto; }
.rc-tabs button { flex: 1 0 auto; border: none; background: transparent; border-radius: 9px; padding: 8px 10px; font-size: 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.rc-tabs button.active { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.rc-body { min-height: 200px; }
.rc-top { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.rc-stat { background: var(--bg); border-radius: 14px; padding: 10px 6px; text-align: center; }
.rc-stat b { display: block; font-size: 22px; color: var(--ink); line-height: 1.2; }
.rc-stat b i { font-style: normal; font-size: 12px; color: var(--muted); }
.rc-stat span { font-size: 11px; color: var(--muted); }
.rc-stat.coins { background: linear-gradient(180deg, #fffbeb, #fef3c7); }
.rc-stat.coins b { color: #b45309; }
.rc-goal { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; }
.rc-goal.done { border-color: #fdba74; background: linear-gradient(180deg, #fff7ed, #fff); }
.rc-goal-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.rc-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.rc-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #f59e0b); border-radius: 999px; transition: width 0.5s ease; }
.rc-bar.small { height: 6px; margin-top: 4px; }
.rc-muted { color: var(--muted); font-size: 12px; }
.rc-muted.center { text-align: center; }
.rc-note { background: var(--accent-soft); color: var(--ink); border-radius: 10px; padding: 8px 12px; font-size: 13px; margin: 0 0 12px; }
.rc-h { margin: 16px 0 8px; font-size: 14px; }
.rc-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.rc-inline select, .rc-inline input { font-size: 14px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.rc-chests { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.rc-chest {
  display: inline-flex; align-items: center; gap: 6px; border: 1px dashed #f59e0b; background: #fffbeb; border-radius: 12px; padding: 8px 12px;
  font-size: 14px; font-weight: 700; color: #92400e; animation: chest-glow 1.6s ease-in-out infinite;
}
.rc-chest span { font-weight: 500; font-size: 13px; }
.rc-chest em { font-style: normal; font-size: 11px; color: #b45309; }
@keyframes chest-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0.3); } 50% { box-shadow: 0 0 0 6px rgba(245,158,11,0); } }
.rc-quests { display: grid; gap: 8px; }
.rc-quest { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.rc-quest.done { background: var(--next-soft); border-color: #a7f3d0; }
.rc-quest .q-ico { font-size: 24px; }
.rc-quest .q-main { flex: 1; min-width: 0; }
.rc-quest .q-main b { font-size: 14px; }
.rc-quest .q-right { text-align: right; font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1.5; }
.coin-tag { display: inline-block; font-size: 12px; font-weight: 700; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 1px 8px; }
.rc-details { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.rc-details summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); }
.rc-rules { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.rc-ledger { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; display: grid; gap: 4px; max-height: 240px; overflow: auto; }
.rc-ledger li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding: 3px 0; }
.rc-ledger b { color: #059669; }
.rc-ledger b.neg { color: var(--danger); }
.rc-shop-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.rc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rc-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: #fff; }
.rc-card.dim { opacity: 0.7; }
.rc-card.owned { border-color: #a7f3d0; }
.rc-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rc-card .c-ico { font-size: 32px; line-height: 1; width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; }
.rc-card b { font-size: 14px; }
.rc-btn { border: none; border-radius: 10px; padding: 8px 14px; background: var(--accent); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.rc-btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.rc-btn.ghost { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.rc-btn.small { padding: 5px 10px; font-size: 13px; }
.rc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.rc-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.rc-list.muted li { border: none; padding: 2px 0; color: var(--muted); }
.rc-row-actions { display: inline-flex; gap: 6px; }
.rc-actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.rc-preview { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 14px; padding: 12px; }
.rc-preview b { font-size: 16px; }
.rc-pets { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; margin-bottom: 12px; }
.rc-pet-pick { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 6px; font-size: 13px; font-weight: 700; display: grid; gap: 4px; justify-items: center; }
.rc-pet-pick span { font-size: 34px; }
.rc-pet-pick.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rc-pet-stage { text-align: center; border-radius: 16px; padding: 18px 14px 14px; background: radial-gradient(400px 200px at 50% 0%, var(--accent-soft), transparent), var(--bg); }
.rc-pet-stage h3 { margin: 8px 0 2px; font-size: 20px; }
.rc-pet-stage h3 small { font-size: 13px; color: var(--muted); font-weight: 600; }
.rc-pet-stage .rc-bar { margin: 10px auto 6px; max-width: 320px; }
.rc-pet-stage .rc-actions { justify-content: center; }
.rc-pet-emoji { font-size: 76px; line-height: 1; display: inline-block; animation: pet-idle 2.4s ease-in-out infinite; }
.mood-happy .rc-pet-emoji { animation: pet-happy 1.2s ease-in-out infinite; }
.mood-sleepy .rc-pet-emoji { filter: grayscale(0.4); animation: pet-sleepy 3.6s ease-in-out infinite; }
.rc-pet-emoji.nom { animation: pet-nom 0.7s ease; }
@keyframes pet-idle { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pet-happy { 0%, 100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-10px); } }
@keyframes pet-sleepy { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(3px) rotate(-4deg); } }
@keyframes pet-nom { 0% { transform: scale(1); } 30% { transform: scale(1.3) rotate(-10deg); } 60% { transform: scale(1.15) rotate(10deg); } 100% { transform: scale(1); } }
.rc-stages { display: flex; justify-content: space-between; gap: 4px; margin-top: 12px; font-size: 11px; color: var(--muted); text-align: center; }
.rc-stages span { flex: 1; opacity: 0.4; filter: grayscale(1); font-size: 12px; line-height: 1.4; }
.rc-stages span.on { opacity: 1; filter: none; }
.rc-league { display: flex; align-items: center; gap: 12px; background: var(--bg); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.lg-badge { font-size: 36px; }
.rc-rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rc-rank li { display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.rc-rank li.top { background: linear-gradient(90deg, #fffbeb, #fff); }
.rc-rank li.me { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.rc-rank li.ghost { opacity: 0.6; border-style: dashed; }
.rc-rank .rk { font-weight: 800; text-align: center; color: var(--muted); }
.rc-rank .nm { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-rank .nm i { font-style: normal; margin-right: 4px; }
.rc-rank .nm small { font-size: 11px; padding: 0 6px; margin-left: 6px; border-radius: 999px; background: #fef3c7; color: #92400e; }
.rc-rank .nm em { font-style: normal; font-size: 11px; margin-left: 6px; color: var(--accent); }
.rc-rank .st { font-size: 12px; color: #c2410c; }
.rc-days { display: flex; justify-content: space-between; gap: 4px; margin-bottom: 12px; }
.rc-days span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); line-height: 1.5; border-radius: 10px; padding: 6px 0; background: var(--bg); }
.rc-days span.on { background: #fff7ed; color: #c2410c; font-weight: 700; }
.rc-days span.today { outline: 2px solid var(--accent-soft); }
.rc-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rc-table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 8px; }
.rc-table td { padding: 6px 8px; border-top: 1px solid var(--line); }
.rc-table td:first-child { color: var(--muted); font-size: 13px; }
.rc-form { display: grid; gap: 10px; }
.rc-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.rc-form input, .rc-form select { border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; font-size: 15px; color: var(--ink); background: #fff; }
.rc-form.inline { grid-template-columns: auto auto 1fr auto; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.rc-form.inline input { padding: 6px 8px; font-size: 14px; }
.rc-check { display: flex !important; flex-direction: row; align-items: center; gap: 8px; color: var(--ink) !important; }
.rc-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.rc-msg { min-height: 1.2em; margin: 0; font-size: 13px; color: var(--danger); }
.rc-parent-head { display: flex; justify-content: space-between; align-items: center; }
.rc-reward-rows { display: grid; gap: 6px; }
.rc-reward-row { display: grid; grid-template-columns: 48px 1fr 84px 36px; gap: 6px; align-items: center; }
.rc-reward-row input { border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; font-size: 14px; color: var(--ink); background: #fff; min-width: 0; }
.rc-reward-row input.emo { text-align: center; }
.rc-reward-row .icon-btn { width: 34px; height: 34px; font-size: 15px; }
@media (max-width: 860px) {
  .hud-pill { padding: 5px 9px; font-size: 13px; }
  .goal-ring, .goal-ring svg { width: 36px; height: 36px; }
  .rc-top { grid-template-columns: repeat(2, 1fr); }
  .rc-form.inline { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .hud { margin-left: auto; gap: 4px; }
  .rc-cards { grid-template-columns: repeat(2, 1fr); }
  .rc-rank li { grid-template-columns: 28px 1fr auto; }
  .rc-rank .st { display: none; }
}
