:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #1c1c1e;
  --ink-2: #5c5c66;
  --ink-3: #8e8e98;
  --line: #e6e3dd;
  --accent: #0f6e5c;
  --accent-soft: #e3f1ec;
  --guide: #0f6e5c;
  --qa: #36618f;
  --trans: #7c4f9e;
  --manner: #c2622a;
  --gold: #d9a03a;
  --radius: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { display: flex; flex-direction: column; height: 100dvh; }

/* ---------- 顶栏 ---------- */
header {
  flex: none;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: rgba(244, 242, 238, .92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  position: sticky; top: 0; z-index: 30;
}
header .title { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
header .sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
header .grow { flex: 1; }
.pill {
  font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.pill.warn { background: #fbeee0; color: var(--manner); }

/* ---------- 主区域 ---------- */
main {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 14px 14px calc(96px + var(--safe-bottom));
}
.view { display: none; }
.view.active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 底部标签 ---------- */
nav {
  flex: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-bottom);
}
nav button {
  flex: 1; border: 0; background: none; padding: 8px 0 7px;
  font-size: 10.5px; color: var(--ink-3); font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
nav button .ic { font-size: 19px; line-height: 1; filter: grayscale(1); opacity: .55; }
nav button.on { color: var(--accent); font-weight: 700; }
nav button.on .ic { filter: none; opacity: 1; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px -12px rgba(0,0,0,.18);
  margin-bottom: 12px;
}
.card.tight { padding: 12px; }
h2.sec { font-size: 13px; color: var(--ink-3); font-weight: 600; margin: 18px 4px 8px; letter-spacing: .3px; }
h2.sec:first-child { margin-top: 4px; }

.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11px; }

.btn {
  border: 0; border-radius: 12px; padding: 11px 16px; font-size: 14.5px; font-weight: 650;
  font-family: inherit; background: var(--accent); color: #fff; width: 100%;
}
.btn.ghost { background: #eceae5; color: var(--ink); }
.btn.line { background: #fff; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn.mini { width: auto; padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
.btn:active { transform: scale(.985); }

.seg {
  display: flex; background: #e9e6e0; border-radius: 11px; padding: 3px; gap: 2px;
  margin-bottom: 12px;
}
.seg button {
  flex: 1; min-width: 0; border: 0; background: none; font-family: inherit; font-size: 12.5px;
  padding: 7px 4px; border-radius: 9px; color: var(--ink-2); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---------- 今日 ---------- */
.hero {
  background: linear-gradient(135deg, #0f6e5c, #14856d 55%, #1c9a78);
  color: #fff; border-radius: 20px; padding: 16px 16px 15px; margin-bottom: 12px;
  box-shadow: 0 10px 30px -14px rgba(15,110,92,.65);
}
.hero .day { font-size: 27px; font-weight: 800; letter-spacing: -.5px; }
.hero .day small { font-size: 14px; font-weight: 600; opacity: .8; margin-left: 2px; }
.hero .meta { font-size: 12.5px; opacity: .88; margin-top: 3px; }
.hero .bar { height: 7px; border-radius: 999px; background: rgba(255,255,255,.28); margin-top: 13px; overflow: hidden; }
.hero .bar > i { display: block; height: 100%; background: #fff; border-radius: 999px; transition: width .3s; }
.hero .bar-txt { font-size: 11.5px; opacity: .9; margin-top: 6px; display: flex; justify-content: space-between; }

.task {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 12px;
  background: #fff; border-radius: 14px; margin-bottom: 9px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  border-left: 3.5px solid var(--line);
}
.task.guide { border-left-color: var(--guide); }
.task.qa { border-left-color: var(--qa); }
.task.trans { border-left-color: var(--trans); }
.task.manner { border-left-color: var(--manner); }
.task .chk {
  flex: none; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px;
  border: 2px solid #d5d2cb; display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent; background: #fff;
}
.task.done .chk { background: var(--accent); border-color: var(--accent); color: #fff; }
.task.done .t-title { text-decoration: line-through; color: var(--ink-3); }
.t-title { font-size: 14.5px; font-weight: 640; line-height: 1.34; }
.t-detail { font-size: 12px; color: var(--ink-2); line-height: 1.5; margin-top: 3px; }
.t-go {
  flex: none; align-self: center; border: 0; font-family: inherit; font-size: 12px;
  font-weight: 650; color: var(--accent); background: var(--accent-soft);
  padding: 8px 10px; border-radius: 10px;
}
.task.done .t-go { display: none; }
.t-tag { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 6px; margin-right: 6px; }
.t-tag.guide { background: var(--accent-soft); color: var(--guide); }
.t-tag.qa { background: #e6eefa; color: var(--qa); }
.t-tag.trans { background: #f1e9f7; color: var(--trans); }
.t-tag.manner { background: #fbeade; color: var(--manner); }

/* ---------- 列表行 ---------- */
.item {
  display: flex; align-items: center; gap: 11px; padding: 12px 13px;
  background: #fff; border-radius: 14px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.item:active { background: #faf9f7; }
.item .lead { font-size: 17px; }
.item .t { font-size: 14.5px; font-weight: 620; }
.item .s { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.item .arrow { color: #c9c6bf; font-size: 15px; }

.badge {
  font-size: 11px; font-weight: 700; padding: 2.5px 7px; border-radius: 999px;
  background: #efede9; color: var(--ink-2);
}
.badge.ok { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: #fbeade; color: var(--manner); }

/* ---------- 讲解 ---------- */
.en {
  font-size: var(--en-size, 18px); line-height: 1.72; letter-spacing: .1px;
  font-family: "Iowan Old Style", Georgia, "Times New Roman", serif;
}
.en.mask { letter-spacing: .5px; color: var(--ink-2); }
.cn { font-size: 13px; line-height: 1.72; color: var(--ink-2); margin-top: 12px;
      padding-top: 12px; border-top: 1px dashed var(--line); }
.vocab { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.vocab span { font-size: 11.5px; background: #f2f0eb; border-radius: 7px; padding: 3.5px 8px; color: var(--ink-2); }
.vocab b { color: var(--ink); font-weight: 650; }
.vocab i { font-style: normal; color: var(--ink-3); font-size: 10.5px; margin-left: 3px; }

.ladder { display: flex; gap: 6px; margin: 12px 0 0; }
.ladder button {
  flex: 1; border: 0; font-family: inherit; font-size: 12px; font-weight: 650;
  padding: 8px 2px; border-radius: 10px; background: #ecebe7; color: var(--ink-2);
}
.ladder button.on { background: var(--accent); color: #fff; }

.toolbar { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.toolbar .btn { flex: 1; min-width: 96px; }

.blocklist { display: flex; flex-direction: column; gap: 8px; }
.blk {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; background: #fff;
  border-radius: 13px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.blk .dot {
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: #efede9;
  color: var(--ink-3); font-size: 11.5px; font-weight: 700; display: flex;
  align-items: center; justify-content: center;
}
.blk.ok .dot { background: var(--accent); color: #fff; }
.blk .t { font-size: 14px; font-weight: 600; }
.blk .s { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ---------- 题库 ---------- */
.qhead {
  font-size: 15.5px; font-weight: 650; line-height: 1.55; margin-bottom: 10px;
}
.qen { font-size: 13.5px; color: var(--qa); line-height: 1.6; margin-bottom: 12px; font-weight: 600; }
.answer {
  font-size: var(--en-size, 18px);
  font-family: "Iowan Old Style", Georgia, serif; line-height: 1.72;
}
.hidden-box {
  text-align: center; padding: 26px 12px; color: var(--ink-3); font-size: 13px;
  background: #f7f6f3; border-radius: 12px; border: 1px dashed #ddd9d2;
}

/* ---------- 日历 ---------- */
.cal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.cal .cell {
  aspect-ratio: 1; border-radius: 10px; background: #ecebe7; display: flex;
  flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; color: var(--ink-3); gap: 1px;
}
.cal .cell b { font-size: 12.5px; color: var(--ink-2); font-weight: 700; }
.cal .cell.part { background: #cfe6df; color: #0b5a4b; }
.cal .cell.part b { color: #0b5a4b; }
.cal .cell.full { background: var(--accent); color: #fff; }
.cal .cell.full b { color: #fff; }
.cal .cell.today { box-shadow: 0 0 0 2.5px var(--gold); }

/* ---------- 悬浮开始按钮 ---------- */
.fab {
  position: fixed; right: 16px; bottom: calc(74px + var(--safe-bottom)); z-index: 35;
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 13px 20px; font-size: 14.5px; font-weight: 700; font-family: inherit;
  box-shadow: 0 8px 24px -8px rgba(15,110,92,.8);
}

/* ---------- 计时 / 会话浮层 ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: none; flex-direction: column;
}
.sheet.on { display: flex; }
.sheet .head {
  flex: none; padding: calc(var(--safe-top) + 12px) 16px 12px;
  border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px;
  background: #fff;
}
.sheet .body { flex: 1; overflow-y: auto; padding: 16px 16px calc(20px + var(--safe-bottom)); }
.sheet .foot { flex: none; padding: 12px 16px calc(16px + var(--safe-bottom)); background: #fff; border-top: 1px solid var(--line); }
.clock { font-size: 54px; font-weight: 800; text-align: center; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.clock.over { color: var(--manner); }

/* ---------- 底部导航适配 ---------- */
@media (min-width: 620px) {
  body { max-width: 620px; margin: 0 auto; box-shadow: 0 0 40px rgba(0,0,0,.08); }
  nav { max-width: 620px; left: 50%; transform: translateX(-50%); }
}
