/* 英语时间
   版式：单列（最宽 640px），顶部细栏 + 底部固定标签栏，和训练手册同一套骨架。
   视觉线索取自绘本和荧光笔：英文句子用黄色荧光笔划过，书的绿色做主色。 */
:root {
  --bg: #F4F7F5;
  --surface: #FFFFFF;
  --surface-2: #E8EEEA;
  --ink: #1C2638;
  --ink-2: #4F5B6B;
  --ink-3: #7D8796;
  --line: #DCE3E0;
  --accent: #2C7A4B;
  --accent-ink: #FFFFFF;
  --accent-soft: #E2F0E7;
  --marker: #FFE27A;
  --dad: #2D5A9B;
  --dad-soft: #E1EAF7;
  --mom: #B4466B;
  --mom-soft: #F8E3EA;
  --good: #2C7A4B;
  --good-soft: #E2F0E7;
  --warn: #A06A10;
  --warn-soft: #FBEFD5;
  --bad: #B8432F;
  --bad-soft: #F9E2DC;
  --heard: #2D5A9B;
  --heard-soft: #E1EAF7;

  --font-ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans CJK SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-en: "Avenir Next", "Avenir", "Trebuchet MS", "Segoe UI", -apple-system, system-ui, sans-serif;
  --r: 14px;
  --tabbar-h: 60px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10161C; --surface: #172029; --surface-2: #1F2A34; --ink: #E5EAF0; --ink-2: #A3AEBB; --ink-3: #75808E;
    --line: #2A3540; --accent: #6CC892; --accent-ink: #0B1A11; --accent-soft: #19322A; --marker: rgba(255, 214, 90, .28);
    --dad: #8FB4EC; --dad-soft: #1C2A44; --mom: #EE97B5; --mom-soft: #3A1F2A;
    --good: #6CC892; --good-soft: #19322A; --warn: #E8B45A; --warn-soft: #3A2C10; --bad: #F08A72; --bad-soft: #3A1D17;
    --heard: #8FB4EC; --heard-soft: #1C2A44;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10161C; --surface: #172029; --surface-2: #1F2A34; --ink: #E5EAF0; --ink-2: #A3AEBB; --ink-3: #75808E;
  --line: #2A3540; --accent: #6CC892; --accent-ink: #0B1A11; --accent-soft: #19322A; --marker: rgba(255, 214, 90, .28);
  --dad: #8FB4EC; --dad-soft: #1C2A44; --mom: #EE97B5; --mom-soft: #3A1F2A;
  --good: #6CC892; --good-soft: #19322A; --warn: #E8B45A; --warn-soft: #3A2C10; --bad: #F08A72; --bad-soft: #3A1D17;
  --heard: #8FB4EC; --heard-soft: #1C2A44;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-ui);
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; text-wrap: balance; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- 英文句子：荧光笔 */
.en { font-family: var(--font-en); background: linear-gradient(transparent 60%, var(--marker) 60%); padding: 0 2px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.phrases { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.phrases li { font-family: var(--font-en); font-size: 17px; line-height: 1.45; display: flex; gap: 8px; align-items: baseline; }
.phrases li .tag { font-family: var(--font-ui); }

/* ---------- 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
}
.topbar-in { width: 100%; max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .02em; color: var(--accent); }
.brand span { color: var(--ink); }
.brand-mark { width: 22px; height: 22px; color: var(--accent); }
.brand-mark.big { width: 44px; height: 44px; }
.top-right { display: flex; gap: 8px; align-items: center; }
.who { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 600; }
.who.dad { color: var(--dad); background: var(--dad-soft); border-color: transparent; }
.who.mom { color: var(--mom); background: var(--mom-soft); border-color: transparent; }
.sync {
  border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 3px 10px 3px 8px; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px;
}
.sync::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.sync.ok::before { background: var(--good); }
.sync.busy::before { background: var(--dad); }
.sync.warn::before { background: var(--warn); }

/* ---------- 主体 */
.view { max-width: 640px; margin: 0 auto; padding: 18px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 16px; outline: none; }
.view > * { min-width: 0; }
.boot { color: var(--ink-3); text-align: center; padding: 40px 0; }
.eyebrow { font-size: 13px; color: var(--ink-2); letter-spacing: .04em; }
.muted { color: var(--ink-2); font-size: 14px; }
.small { font-size: 13px; }
.sec-title { font-size: 14px; font-weight: 700; color: var(--ink-2); letter-spacing: .06em; }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.page-head h1 { font-size: 22px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-head h3 { font-size: 17px; }
.card-head .who-tag { flex: none; }
.card.done { border-color: color-mix(in srgb, var(--good) 45%, var(--line)); }
.card.quiet { opacity: .75; }
.sub-block { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.sub-block:first-child { padding-top: 0; border-top: 0; }
.sub-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.banner { border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; }
.banner.info { background: var(--dad-soft); }
.banner.warn { background: var(--warn-soft); }
.banner.go { background: var(--accent-soft); }
.banner strong { font-size: 15px; }
.banner .row { display: flex; gap: 8px; flex-wrap: wrap; }

.tag { display: inline-flex; align-items: center; font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 6px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.tag.new { background: var(--marker); color: var(--ink); }
.tag.dad { background: var(--dad-soft); color: var(--dad); }
.tag.mom { background: var(--mom-soft); color: var(--mom); }
.tag.like { background: var(--good-soft); color: var(--good); }
.tag.ok { background: var(--surface-2); color: var(--ink-2); }
.tag.no { background: var(--bad-soft); color: var(--bad); }
.tag.stage { background: var(--accent-soft); color: var(--accent); }
.tag.pause { background: var(--warn-soft); color: var(--warn); }

/* ---------- 按钮 */
.btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: 12px; min-height: 44px; padding: 0 16px;
  font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--ink);
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-block { width: 100%; min-height: 50px; font-size: 17px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-danger { color: var(--bad); }
.btn-done { background: var(--good-soft); border-color: transparent; color: var(--good); }
.btn-big { min-height: 64px; font-size: 20px; flex: 1; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-row .grow { flex: 1; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 绘本 */
.book-title { font-family: var(--font-en); font-weight: 700; font-size: 18px; line-height: 1.3; }
.book-meta { font-size: 13px; color: var(--ink-2); }
.stage-box { background: var(--accent-soft); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.stage-box b { color: var(--accent); }
.pages { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0; counter-reset: pg; }
.pages li { padding: 10px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 28px 1fr; gap: 2px 8px; }
.pages li:first-child { border-top: 0; }
.pages .pno { grid-row: span 4; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding-top: 2px; }
.pages .pcn { font-weight: 600; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pages .pact { font-size: 14px; color: var(--ink-2); }
.pages .ppoint { font-size: 16px; }
.pages .pedit { justify-self: start; }
.pages form { grid-column: 2; display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
details.fold > summary { cursor: pointer; font-weight: 600; color: var(--accent); list-style: none; display: flex; align-items: center; gap: 6px; min-height: 36px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { details.fold > summary::before { transition: none; } }
.core { font-family: var(--font-en); font-size: 17px; }
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-book { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.mini-book .t { font-family: var(--font-en); font-weight: 600; min-width: 0; }
.mini-book .s { font-size: 13px; color: var(--ink-2); }
.mini-book > div { min-width: 0; }

.book-list { display: flex; flex-direction: column; gap: 8px; }
.book-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); }
.book-row .t { font-family: var(--font-en); font-weight: 700; min-width: 0; }
.book-row .s { font-size: 13px; color: var(--ink-2); grid-column: 1; }
.book-row .r { grid-row: span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.book-row.off { opacity: .6; }

/* ---------- 打卡记录 */
.log-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.log-item { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.log-item .main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.log-item .line1 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.log-item .what { font-weight: 600; }
.log-item .words { font-size: 14px; color: var(--ink-2); }
.log-item .note { font-size: 14px; color: var(--ink-2); }
.day-head { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-top: 6px; }

/* ---------- 每周汇总 */
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.week-nav .t { text-align: center; }
.dots { display: flex; gap: 6px; }
.dots span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: var(--surface-2); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.dots span.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.dots span.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--ink-2); }
.word-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wchip { font-family: var(--font-en); font-size: 15px; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid transparent; }
.wchip.heard { background: var(--heard-soft); color: var(--heard); }
.wchip.said { background: var(--good-soft); color: var(--good); font-weight: 700; }
.vocab-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.vocab-table th, .vocab-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.vocab-table th { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.vocab-table td:first-child { font-family: var(--font-en); font-weight: 600; }
.vocab-table td { font-variant-numeric: tabular-nums; }

/* ---------- 表单 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.input, select.input, textarea.input { width: 100%; min-height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 12px; }
textarea.input { min-height: 72px; resize: vertical; }
.check-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin-top: 3px; flex: none; accent-color: var(--accent); }
.seg { display: flex; gap: 6px; }
.seg button { flex: 1; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.seg button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.seg button.on.no { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--font-en); border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 15px; min-height: 36px; }
.chip.heard { background: var(--heard-soft); color: var(--heard); border-color: var(--heard); }
.chip.said { background: var(--good-soft); color: var(--good); border-color: var(--good); font-weight: 700; }
.chip.pick { font-family: var(--font-ui); }
.chip.pick.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

/* ---------- 打卡面板 */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(10, 16, 22, .45); }
.sheet-box {
  position: relative; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto;
  background: var(--bg); border-radius: 18px 18px 0 0;
  padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sheet-head h2 { font-size: 18px; }
.sheet-body { display: flex; flex-direction: column; gap: 14px; }

/* ---------- 底部标签栏 */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabbar-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--tabbar-h); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; color: var(--ink-3); text-decoration: none; }
.tabbar a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); font-weight: 700; }

/* ---------- 登录 */
.login { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.login-box { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; text-align: center; }
.login-box .brand-mark { align-self: center; }
.login-box h2 { font-size: 22px; }
.login-box input[type=password] { min-height: 50px; border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--surface); font-size: 17px; }
.login-msg { color: var(--bad); font-size: 14px; min-height: 1.2em; }
.who-choices { display: flex; gap: 10px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px); z-index: 70; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }

@media (max-width: 380px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dots span { width: 26px; height: 26px; }
}
