/* 一日 · 极简生活管家
 * 目标机型 iPhone 12（390 × 844），同时兼容更小屏与桌面浏览
 */
:root {
  --bg: #f7f4ee; --card: #fffdf8; --tx: #2a2622; --sub: #8b8378; --ln: #e7e1d4;
  --ac: #9a5b3f; --ac2: #b08a5a; --ac-soft: rgba(154,91,63,.1); --ac-line: rgba(154,91,63,.24);
  --shadow: 0 8px 26px rgba(30,24,16,.06);
  --fs: 16px; --lh: 1.75;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --tex: none; --tex-size: auto; --bg-img: none;
  --r: 18px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: var(--lh);
  color: var(--tx);
  background: var(--bg);
  background-image: var(--tex), var(--bg-img);
  background-size: var(--tex-size), cover;
  background-position: 0 0, center;
  background-attachment: scroll, fixed;
  background-repeat: repeat, no-repeat;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; padding: 0; }
a { color: var(--ac); text-decoration: none; }
::selection { background: var(--ac-soft); }

.hidden { display: none !important; }
.muted { color: var(--sub); }
.tiny { font-size: 12px; line-height: 1.6; }
.num { font-variant-numeric: tabular-nums; letter-spacing: .2px; }

.app { min-height: 100dvh; }
#view { padding: 0 18px calc(96px + var(--safe-b)); max-width: 560px; margin: 0 auto; }

/* ================= 顶栏 ================= */
.hd {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px;
  padding: calc(14px + var(--safe-t)) 18px 10px;
  max-width: 560px; margin: 0 auto;
  background: linear-gradient(180deg, var(--bg) 62%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.hd-t { font-size: 21px; font-weight: 650; letter-spacing: 3px; line-height: 1.2; }
.hd-d { font-size: 12px; color: var(--sub); letter-spacing: .6px; margin-top: 3px; }
.hd-r { display: flex; gap: 6px; padding-bottom: 2px; }
.icobtn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--sub); border: 1px solid transparent;
  transition: .18s;
}
.icobtn:active { background: var(--ac-soft); color: var(--ac); }

/* ================= 底栏 ================= */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: flex; align-items: stretch;
  padding: 6px 8px calc(6px + var(--safe-b));
  background: var(--card);
  border-top: 1px solid var(--ln);
  max-width: 560px; margin: 0 auto;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0 4px; color: var(--sub); border-radius: 12px;
  transition: color .18s;
}
.tab span { font-size: 10.5px; letter-spacing: .6px; }
.tab.on { color: var(--ac); }
.tab.on svg { transform: translateY(-1px); }
.tab svg { transition: transform .2s; }

/* ================= 通用块 ================= */
.sec { margin-top: 22px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.sec-t {
  font-size: 12px; letter-spacing: 2.2px; color: var(--sub); font-weight: 600;
  text-transform: uppercase;
}
.sec-a { font-size: 12.5px; color: var(--ac); letter-spacing: .4px; }
.sec-a:active { opacity: .6; }

.card {
  background: var(--card); border: 1px solid var(--ln); border-radius: var(--r);
  padding: 16px; position: relative;
}
.card + .card { margin-top: 10px; }
.card.soft { background: var(--ac-soft); border-color: var(--ac-line); }
.card.pad0 { padding: 0; overflow: hidden; }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--ln); background: var(--card);
  font-size: 14px; font-weight: 600; letter-spacing: .3px;
  transition: .16s;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn.primary { background: var(--ac); color: var(--on-ac, #fff); border-color: var(--ac); }
.btn.ghost { background: transparent; color: var(--ac); border-color: var(--ac-line); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .45; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--ln);
  font-size: 12.5px; color: var(--sub); background: transparent; transition: .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip.on { border-color: var(--ac); color: var(--ac); background: var(--ac-soft); }

/* ================= 今天 · 头部 ================= */
.hero { margin-top: 8px; }
.hero-greet { font-size: 13px; color: var(--sub); letter-spacing: .5px; }
.hero-big { font-family: var(--font); font-size: 30px; font-weight: 600; letter-spacing: 1px; margin: 4px 0 2px; line-height: 1.25; }
.hero-sub { font-size: 13px; color: var(--sub); }
.hero-sub b { color: var(--ac); font-weight: 650; }

.ringwrap { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.ring { width: 116px; height: 116px; flex: 0 0 116px; }
.ring-c { font-size: 21px; font-weight: 650; fill: var(--tx); }
.ring-s { font-size: 9.5px; fill: var(--sub); letter-spacing: 1.4px; }
.legend { flex: 1; display: grid; grid-template-columns: 1fr; gap: 5px; }
.legend div { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--sub); }
.legend i { width: 7px; height: 7px; border-radius: 2px; flex: 0 0 7px; }
.legend b { color: var(--tx); font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 6px; }

/* 快捷统计 */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.q {
  background: var(--card); border: 1px solid var(--ln); border-radius: 14px;
  padding: 10px 8px; text-align: center; transition: .15s;
}
.q:active { background: var(--ac-soft); }
.q i { font-style: normal; font-size: 10.5px; color: var(--sub); letter-spacing: .8px; display: block; }
.q b { display: block; font-size: 16px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.q small { font-size: 10px; color: var(--sub); font-weight: 400; }

/* ================= 时间轴 ================= */
.tl {
  position: relative; margin-top: 4px;
  border-top: 1px solid var(--ln);
}
.tl-inner { position: relative; }
.tl-hour {
  position: absolute; left: 0; right: 0; height: 0;
  border-top: 1px dashed var(--ln);
}
.tl-hour.half { border-top-style: dotted; opacity: .55; }
.tl-lbl {
  position: absolute; left: 0; top: -8px; width: 38px;
  font-size: 10.5px; color: var(--sub); font-variant-numeric: tabular-nums;
  background: var(--bg); padding-right: 4px; letter-spacing: .3px;
}
.tl-col { position: absolute; left: 44px; right: 0; top: 0; bottom: 0; }
.blk {
  position: absolute; border-radius: 11px; overflow: hidden;
  padding: 6px 9px; display: flex; flex-direction: column; justify-content: center;
  border: 1px solid; cursor: pointer;
  transition: transform .12s;
}
.blk:active { transform: scale(.985); }
.blk b { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.blk span { font-size: 10px; opacity: .72; font-variant-numeric: tabular-nums; margin-top: 1px; }
.blk .dot { position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.blk.mini { padding: 2px 8px; }
.blk.mini b { font-size: 11.5px; }
.tl-now {
  position: absolute; left: 38px; right: 0; height: 0; z-index: 3;
  border-top: 1.5px solid var(--ac);
}
.tl-now::before {
  content: ''; position: absolute; left: -3px; top: -4px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--ac);
}
.tl-now em {
  position: absolute; right: 0; top: -16px; font-style: normal; font-size: 9.5px;
  color: var(--on-ac, #fff); background: var(--ac); padding: 1px 5px; border-radius: 5px;
  font-variant-numeric: tabular-nums;
}
.tl-empty-box {
  border: 1px dashed var(--ln); border-radius: 14px; padding: 20px 12px;
  text-align: center; margin-top: 4px;
}
.tl-empty { padding: 34px 0 0; text-align: center; color: var(--sub); font-size: 12.5px; line-height: 1.9; }

/* ================= 三餐 / 清单 ================= */
.list { display: flex; flex-direction: column; }
.it {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--ln);
}
.it:last-child { border-bottom: none; }
.it .cb {
  width: 19px; height: 19px; border-radius: 6px; border: 1.4px solid var(--ln);
  flex: 0 0 19px; margin-top: 2px; display: flex; align-items: center; justify-content: center;
  color: transparent; font-size: 11px; transition: .15s;
}
.it.done .cb { background: var(--ac); border-color: var(--ac); color: var(--on-ac, #fff); }
.it.done .it-t { text-decoration: line-through; color: var(--sub); }
.it-t { font-size: 13.5px; line-height: 1.55; }
.it-m { font-size: 11px; color: var(--sub); margin-top: 2px; letter-spacing: .2px; }
.it .del { color: var(--sub); font-size: 15px; padding: 0 2px; opacity: .55; }

.meal { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--ln); }
.meal:last-child { border-bottom: none; }
.meal-t { width: 44px; font-size: 12px; color: var(--sub); flex: 0 0 44px; letter-spacing: .5px; }
.meal-b { flex: 1; font-size: 13.5px; }
.meal-k { font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; }
.meal-add { color: var(--ac); font-size: 18px; padding: 0 4px; }

/* 文字表达 */
.note-area {
  width: 100%; min-height: 128px; resize: vertical;
  background: transparent; border: none; outline: none;
  font-size: var(--fs); line-height: var(--lh); color: var(--tx);
  padding: 0;
}
.note-area::placeholder { color: var(--sub); opacity: .7; }
.note-tools { display: flex; gap: 7px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.note-count { margin-left: auto; font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; }

/* AI 卡 */
.ai-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ai-h .sp { color: var(--ac); }
.ai-h b { font-size: 13.5px; letter-spacing: .5px; }
.ai-h small { font-size: 10.5px; color: var(--sub); margin-left: auto; letter-spacing: .4px; }
.ai-body { font-size: 13.5px; line-height: 1.85; }
.ai-body p { margin: 0 0 8px; }
.ai-body p:last-child { margin-bottom: 0; }
.ai-kv { display: flex; gap: 8px; margin-bottom: 7px; font-size: 13px; line-height: 1.7; }
.ai-kv i { font-style: normal; color: var(--ac); flex: 0 0 10px; }
.ai-quote {
  margin-top: 12px; padding: 10px 12px; border-left: 2px solid var(--ac);
  background: var(--ac-soft); border-radius: 0 10px 10px 0;
  font-size: 13px; line-height: 1.7; color: var(--tx);
}
.digest {
  white-space: pre-wrap; line-height: 1.85; max-height: 178px; overflow: auto;
  -webkit-mask-image: linear-gradient(180deg, #000 84%, transparent);
  mask-image: linear-gradient(180deg, #000 84%, transparent);
}
.datafold summary {
  list-style: none; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
}
.datafold summary::-webkit-details-marker { display: none; }
.datafold .fold-tip { color: var(--ac); }
.datafold[open] .fold-tip { opacity: 0; }
.datafold-b {
  white-space: pre-wrap; line-height: 1.85; margin-top: 10px;
  max-height: 240px; overflow: auto; padding-top: 10px; border-top: 1px solid var(--ln);
}
.skel { height: 12px; border-radius: 6px; background: var(--ln); margin: 7px 0; animation: pulse 1.3s infinite ease-in-out; }
.skel:nth-child(2) { width: 86%; } .skel:nth-child(3) { width: 70%; }
@keyframes pulse { 0%,100% { opacity: .55 } 50% { opacity: 1 } }
.spin {
  width: 13px; height: 13px; border-radius: 50%; border: 1.6px solid var(--ac-line);
  border-top-color: var(--ac); animation: spin .8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg) } }

/* ================= 领域 ================= */
.dom { margin-top: 12px; }
.dom-h { display: flex; align-items: center; gap: 11px; }
.dom-ic {
  width: 38px; height: 38px; border-radius: 12px; flex: 0 0 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ac-soft); color: var(--ac); font-size: 17px;
}
.dom-n { font-size: 15px; font-weight: 650; letter-spacing: .6px; }
.dom-k { font-size: 11px; color: var(--sub); margin-top: 1px; font-variant-numeric: tabular-nums; }
.dom-ai {
  font-size: 11px; color: var(--ac); border: 1px solid var(--ac-line);
  padding: 5px 9px; border-radius: 8px; display: inline-flex; align-items: center; gap: 4px;
  background: var(--ac-soft);
}
.dom-b { margin-top: 12px; }
.dom-empty { font-size: 12.5px; color: var(--sub); padding: 6px 0 2px; }
.plan-h {
  font-size: 10.5px; letter-spacing: 1.6px; color: var(--sub);
  margin: 14px 0 4px; display: flex; align-items: center; gap: 6px;
}
.plan-h .ln { flex: 1; height: 1px; background: var(--ln); }
.bars { display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.bar-row { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.bar-row .nm { width: 52px; color: var(--sub); flex: 0 0 52px; }
.bar { flex: 1; height: 5px; border-radius: 3px; background: var(--ln); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ac); border-radius: 3px; transition: width .4s; }
.bar-row .vl { width: 34px; text-align: right; font-size: 11px; color: var(--sub); font-variant-numeric: tabular-nums; }

/* ================= 导图 ================= */
.mind-wrap {
  position: relative; border: 1px solid var(--ln); border-radius: var(--r);
  background: var(--card); overflow: hidden; height: 58dvh; min-height: 380px; max-height: 620px;
  touch-action: none;
}
.mind-svg { display: block; width: 100%; height: 100%; }
.mind-svg text { font-family: var(--font); }
.mind-tools {
  position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px;
}
.mind-tools button {
  width: 32px; height: 32px; border-radius: 10px; background: var(--card);
  border: 1px solid var(--ln); color: var(--sub); font-size: 15px;
  display: flex; align-items: center; justify-content: center;
}
.mind-tip {
  position: absolute; left: 10px; bottom: 12px; font-size: 10.5px;
  color: var(--sub); letter-spacing: .4px; pointer-events: none;
}
.mind-info { margin-top: 12px; }

/* ================= AI ================= */
.seg {
  display: flex; gap: 4px; padding: 4px; background: var(--card);
  border: 1px solid var(--ln); border-radius: 12px; margin-top: 4px;
}
.seg button {
  flex: 1; height: 32px; border-radius: 9px; font-size: 12.5px; color: var(--sub);
  transition: .16s; letter-spacing: .4px;
}
.seg button.on { background: var(--ac); color: var(--on-ac, #fff); font-weight: 600; }

.chat { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.msg { max-width: 88%; font-size: 13.5px; line-height: 1.8; padding: 10px 13px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.ai { background: var(--card); border: 1px solid var(--ln); border-bottom-left-radius: 5px; align-self: flex-start; }
.msg.me { background: var(--ac); color: var(--on-ac, #fff); border-bottom-right-radius: 5px; align-self: flex-end; }
.msg.ai b, .msg.ai strong { font-weight: 650; }
.composer {
  position: fixed; left: 0; right: 0; bottom: calc(64px + var(--safe-b)); z-index: 30;
  max-width: 560px; margin: 0 auto; padding: 8px 18px 10px;
  background: linear-gradient(180deg, transparent, var(--bg) 38%);
  display: flex; gap: 8px; align-items: flex-end;
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid var(--ln); border-radius: 14px;
  background: var(--card); padding: 9px 12px; max-height: 100px; min-height: 40px;
  font-size: 13.5px; line-height: 1.6; outline: none;
}
.composer textarea:focus { border-color: var(--ac-line); }
.send {
  width: 40px; height: 40px; border-radius: 50%; background: var(--ac); color: var(--on-ac, #fff);
  display: flex; align-items: center; justify-content: center; flex: 0 0 40px;
}
.send:disabled { opacity: .4; }

.srch { display: flex; gap: 8px; margin-top: 12px; }
.srch input {
  flex: 1; height: 40px; border-radius: 12px; border: 1px solid var(--ln);
  background: var(--card); padding: 0 13px; font-size: 13.5px; outline: none;
}
.srch input:focus { border-color: var(--ac-line); }
.res { padding: 12px 0; border-bottom: 1px solid var(--ln); }
.res:last-child { border-bottom: none; }
.res-t { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.res-d {
  font-size: 12px; color: var(--sub); line-height: 1.6; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.res-s { font-size: 10.5px; color: var(--ac); margin-top: 4px; letter-spacing: .3px; opacity: .85; }

/* 阅读器 */
.reader {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: flex; flex-direction: column;
  animation: slideUp .22s ease-out;
}
@keyframes slideUp { from { transform: translateY(14px); opacity: .4 } to { transform: none; opacity: 1 } }
.rd-h {
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-t)) 16px 10px; border-bottom: 1px solid var(--ln);
}
.rd-h b { font-size: 13.5px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-body {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 20px 22px calc(28px + var(--safe-b)); max-width: 620px; margin: 0 auto; width: 100%;
  font-size: 15.5px; line-height: 1.95;
}
.rd-body h1 { font-size: 20px; line-height: 1.5; margin: 0 0 14px; letter-spacing: .5px; }
.rd-body p { margin: 0 0 14px; }
.rd-foot { padding: 10px 22px 18px; display: flex; gap: 8px; border-top: 1px solid var(--ln); }

/* ================= 我的 / 设置 ================= */
.pal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.seedhint {
  margin-top: 10px; font-size: 11.5px; line-height: 1.7; color: var(--sub);
  background: var(--ac-soft); border-radius: 10px; padding: 9px 12px;
  display: flex; align-items: flex-start; gap: 8px;
}
.seedhint strong { color: var(--tx); font-weight: 600; }
.seedhint button {
  margin-left: auto; flex: 0 0 auto; background: none; border: 0; padding: 0;
  font-size: 11.5px; color: var(--ac); font-weight: 600; white-space: nowrap;
}
.nowc {
  display: flex; align-items: center; gap: 11px; margin-top: 14px;
  padding: 10px 14px 10px 13px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--ln); border-left: 3px solid var(--ac);
}
.nowc.idle { background: transparent; }
.nowc-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; animation: pulse 2.6s ease-in-out infinite; }
.nowc.idle .nowc-dot { animation: none; }
.nowc-t {
  font-size: 13.5px; font-weight: 600; letter-spacing: .2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nowc-s { font-size: 11px; color: var(--sub); margin-top: 3px; line-height: 1.45; }
.nowc-r { font-size: 10.5px; color: var(--sub); white-space: nowrap; text-align: right; flex: 0 0 auto; letter-spacing: .3px; }
.nowc-r b { display: block; font-size: 15px; color: var(--tx); font-weight: 650; margin-top: 1px; font-variant-numeric: tabular-nums; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.78); } }

.pal-scroll {
  max-height: 210px; overflow-y: auto; padding-right: 2px;
  -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(180deg, #000 calc(100% - 22px), transparent);
  scrollbar-width: none;
}
.pal-scroll::-webkit-scrollbar { width: 0; height: 0; }
.pal {
  border: 1px solid var(--ln); border-radius: 12px; overflow: hidden; background: transparent;
  padding: 0; transition: .16s; position: relative;
}
.pal.on { border-color: var(--ac); box-shadow: 0 0 0 2px var(--ac-soft); }
.pal-c { height: 40px; display: flex; }
.pal-c i { flex: 1; }
.pal-n { font-size: 9.5px; color: var(--sub); padding: 3px 0 4px; text-align: center; letter-spacing: .2px; }
.pal.on .pal-n { color: var(--ac); font-weight: 600; }

.fld { margin-top: 14px; }
.fld > label { display: block; font-size: 11.5px; color: var(--sub); letter-spacing: .6px; margin-bottom: 6px; }
.inp, select.inp, textarea.inp {
  width: 100%; height: 40px; border-radius: 11px; border: 1px solid var(--ln);
  background: var(--card); padding: 0 12px; font-size: 13.5px; outline: none;
  -webkit-appearance: none; appearance: none;
}
textarea.inp { height: auto; min-height: 72px; padding: 9px 12px; line-height: 1.65; resize: vertical; }
.inp:focus { border-color: var(--ac-line); }
select.inp {
  background-image: linear-gradient(45deg, transparent 50%, var(--sub) 50%), linear-gradient(135deg, var(--sub) 50%, transparent 50%);
  background-position: calc(100% - 16px) 18px, calc(100% - 11px) 18px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.sld { display: flex; align-items: center; gap: 10px; }
.sld input[type=range] {
  flex: 1; -webkit-appearance: none; appearance: none; height: 3px; border-radius: 3px;
  background: var(--ln); outline: none;
}
.sld input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--ac); border: 2px solid var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.sld .v { width: 40px; text-align: right; font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; }
.swatches { display: flex; align-items: center; gap: 10px; }
.swatches input[type=color] {
  width: 38px; height: 30px; border: 1px solid var(--ln); border-radius: 8px;
  background: var(--card); padding: 2px;
}
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--ln); }
.opt-row:last-child { border: none; }
.opt-row .lb { font-size: 13.5px; }
.opt-row .ds { font-size: 11px; color: var(--sub); margin-top: 1px; }

/* ================= 弹层 ================= */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-mask { position: absolute; inset: 0; background: rgba(10,8,6,.42); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade .2s; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 88dvh; overflow-y: auto;
  background: var(--bg); border-radius: 22px 22px 0 0;
  padding: 8px 18px calc(22px + var(--safe-b));
  animation: up .26s cubic-bezier(.2,.8,.3,1);
  -webkit-overflow-scrolling: touch;
}
@keyframes up { from { transform: translateY(40px) } to { transform: none } }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--ln); margin: 4px auto 12px; }
.sheet-h { font-size: 15px; font-weight: 650; letter-spacing: .8px; margin-bottom: 4px; }
.sheet-s { font-size: 11.5px; color: var(--sub); margin-bottom: 4px; line-height: 1.6; }
.sheet-b { margin-top: 6px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet-actions .btn { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--safe-b)); transform: translate(-50%, 12px);
  background: var(--tx); color: var(--bg); font-size: 12.5px; padding: 9px 15px;
  border-radius: 10px; opacity: 0; pointer-events: none; transition: .22s; z-index: 200;
  max-width: 80vw; text-align: center; line-height: 1.5;
}
.toast.on { opacity: .94; transform: translate(-50%, 0); }

@media (min-width: 640px) {
  body { background-attachment: scroll, fixed; }
  .tabbar { border-radius: 0; }
}

/* ================= 学习系统专用 ================= */
.brand { font-family: var(--font); letter-spacing: 1.5px; }

/* 统计行 */
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.st {
  background: var(--card); border: 1px solid var(--ln); border-radius: 13px;
  padding: 9px 6px; text-align: center;
}
.st i { display: block; font-style: normal; font-size: 10.5px; color: var(--sub); letter-spacing: .4px; }
.st b { display: block; font-size: 17px; font-weight: 650; margin-top: 2px; font-variant-numeric: tabular-nums; }
.st b small { font-size: 10px; font-weight: 400; color: var(--sub); margin-left: 1px; }

/* 细进度条 */
.pbar { height: 5px; border-radius: 3px; background: var(--ln); overflow: hidden; }
.pbar i { display: block; height: 100%; border-radius: 3px; background: var(--ac); transition: width .3s; }

/* 学科 / 课程 折叠头 */
.subj { margin-bottom: 10px; }
.subj-h {
  display: flex; align-items: center; gap: 9px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--ln); border-radius: 14px; cursor: pointer;
}
.subj-h .dot2 { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.subj-h .nm { font-size: 14px; font-weight: 650; letter-spacing: .3px; }
.subj-h .mt { font-size: 11px; color: var(--sub); margin-top: 1px; }
.subj-h .pc { font-size: 11.5px; color: var(--sub); font-variant-numeric: tabular-nums; }
.subj-b { padding: 2px 0 0 0; }
.co { margin: 8px 0 0 6px; border-left: 1px solid var(--ln); padding-left: 12px; }
.co-h { display: flex; align-items: center; gap: 8px; padding: 3px 0 5px; }
.co-h .cn { font-size: 13px; font-weight: 600; }
.co-h .cm { font-size: 11px; color: var(--sub); margin-left: auto; font-variant-numeric: tabular-nums; }

/* 章节行 */
.ch {
  display: flex; align-items: center; gap: 9px; padding: 8px 0; cursor: pointer;
  border-bottom: 1px solid var(--ln);
}
.ch:last-child { border-bottom: none; }
.ch .mark {
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 16px;
  border: 1.5px solid var(--ln); display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: transparent;
}
.ch.s1 .mark { border-color: var(--ac); background: var(--ac-soft); color: var(--ac); }
.ch.s2 .mark { border-color: var(--ac); background: var(--ac); color: var(--on-ac, #fff); }
.ch .ct { font-size: 13px; line-height: 1.35; }
.ch.s2 .ct { color: var(--sub); }
.ch .cs { font-size: 10.5px; color: var(--sub); margin-top: 1px; line-height: 1.4; }
.ch .cv { flex: 0 0 auto; font-size: 10px; color: var(--ac); opacity: .8; }

/* 知识点 */
.kp { display: flex; align-items: flex-start; gap: 8px; padding: 7px 0; }
.kp .kb {
  width: 15px; height: 15px; border-radius: 4px; border: 1.4px solid var(--ln);
  flex: 0 0 15px; margin-top: 1px; display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: transparent; cursor: pointer;
}
.kp.on .kb { background: var(--ac); border-color: var(--ac); color: var(--on-ac, #fff); }
.kp .kt { font-size: 12.5px; line-height: 1.55; }
.kp.on .kt { color: var(--sub); }

/* 今日队列 */
.qrow {
  display: flex; align-items: center; gap: 11px; padding: 12px 0;
  border-bottom: 1px solid var(--ln); cursor: pointer;
}
.qrow:last-child { border-bottom: none; }
.qrow .qi {
  width: 30px; height: 30px; border-radius: 9px; flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; background: var(--ac-soft); color: var(--ac);
}
.qrow .qt { font-size: 13px; font-weight: 600; line-height: 1.4; }
.qrow .qs { font-size: 11px; color: var(--sub); margin-top: 2px; }
.qrow .qr { font-size: 11px; color: var(--ac); white-space: nowrap; }
.qrow.done .qt { color: var(--sub); text-decoration: line-through; }

/* 复习卡 */
.rv { border: 1px solid var(--ln); border-radius: 14px; background: var(--card); padding: 16px; }
.rv .rq { font-size: 15px; font-weight: 600; line-height: 1.5; }
.rv .ra { margin-top: 12px; font-size: 13px; line-height: 1.8; color: var(--tx); white-space: pre-wrap; }
.rv .rmeta { font-size: 11px; color: var(--sub); margin-top: 8px; }
.rvbtn { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.rvbtn .btn { justify-content: center; }

/* 视频 */
.vidbox {
  position: relative; width: 100%; height: 470px; border-radius: 14px;
  overflow: hidden; background: var(--card); border: 1px solid var(--ln); margin-top: 10px;
}
.vidbox iframe { border: 0; display: block; transform-origin: 0 0; background: #fff; }
.vidmask { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); }

/* 计时条 */
.timerbar {
  position: sticky; bottom: 8px; z-index: 20; margin-top: 14px;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 15px; background: var(--ac); color: var(--on-ac, #fff);
  box-shadow: var(--shadow);
}
.timerbar .tt { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.timerbar .tn { font-size: 11.5px; opacity: .82; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.timerbar button { background: rgba(255,255,255,.18); border: 0; color: inherit; border-radius: 9px; height: 32px; padding: 0 12px; font-size: 12.5px; }

/* 章节详情里的问答 */
.qa { border-top: 1px solid var(--ln); padding-top: 12px; margin-top: 12px; text-align: left; }
.qa .q { font-size: 13px; font-weight: 600; line-height: 1.7; text-align: left; }
.qa .a { font-size: 12.5px; color: var(--sub); line-height: 1.8; margin-top: 10px; white-space: pre-wrap; text-align: left; }

/* 空态 */
.empty2 { text-align: center; padding: 26px 10px; color: var(--sub); font-size: 12.5px; line-height: 1.9; }

/* 主题里的 hero 环 */
.heroRing { display: flex; align-items: center; gap: 14px; }
