/* Night study: deep navy like a room with the lights off.
   Four surface steps: page < card < something to press < something chosen. Colour has one job each:
   lamp amber for the one main action on a screen (and progress), green for good, pink for heads-up,
   blue for plain information; mine colours only mark which mine.
   One deliberate dark theme. Fonts are the ones the desktop app bundles (SIL OFL). */
/* Bear Round: jf open 粉圓 cut to the Big5 common characters and renamed (fonts/BearRound-NOTICE.txt), a quarter of
   the original size; rarer characters fall back to the phone's font. Cubic 11 is cut to Latin, digits and a few
   marks, since it only sets numbers and short labels (anything else falls back to Bear Round). */
@font-face { font-family: "Bear Round"; src: url("fonts/BearRound-common.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Cubic 11"; src: url("fonts/Cubic_11-latin.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Study Serif"; src: url("fonts/StudySerif-common.woff2") format("woff2"); font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #131F24;            /* the page, darkest */
  --surface: #1D2C34;       /* cards stand one step lighter */
  --surface-2: #27383F;     /* things to press */
  --surface-3: #14384D;     /* the chosen one: sky, dimmed */
  --border: #2F3F47;
  --edge: #0B1418;          /* the pressed edge under a card */
  --line-strong: #1CB0F6;   /* outline of the chosen one */
  --text: #F1F7FB;
  --sub: #9DB0BC;
  --faint: #677C88;
  --lamp: #1CB0F6;          /* the brand colour: 小白's night sky, lit up. The one main action on a screen */
  --lamp-soft: #14384D;
  --lamp-text: #49C0F8;
  --lamp-deep: #1182B8;     /* the pressed edge under a main button */
  --good: #58CC02;
  --good-soft: #1F3A16;
  --pink: #FF6B9D;
  --pink-soft: #45202F;
  --info: #49C0F8;
  --info-soft: #14384D;
  --on-lamp: #FFFFFF;
  --gold: #FFC800;          /* gold and rewards only */
  --gold-soft: #3D3210;
  --tile: #F1EFE8;
  --font: "Bear Round", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  --serif: "Study Serif", "Noto Serif TC", "Songti TC", serif; /* the text of questions and answers (Noto Serif TC, cut to common characters) */
  --pixel: "Cubic 11", "Bear Round", monospace;
  --tabs-h: 64px;
}
/* while studying the screen goes dark, like a room with the lights off: the same names, night values */
.study-screen, #studybar, .clock-preview {
  color-scheme: dark;
  --bg: #0F131C;
  --surface: #1A2030;       /* cards */
  --surface-2: #262E42;     /* things to press */
  --surface-3: #333C54;     /* the chosen one */
  --border: #2A3144;
  --line-strong: #8A93A8;   /* outline of the chosen one */
  --text: #EDE8DD;
  --sub: #A7AEBE;
  --faint: #6B7387;
  --lamp: #F2C879;
  --lamp-soft: #3A3526;
  --lamp-text: #F7D99A;
  --lamp-deep: #C9A35A;
  --good: #9FD3BD;
  --good-soft: #213A31;
  --pink: #F0A8B3;
  --pink-soft: #3F2A31;
  --info: #9CC3F0;
  --info-soft: #1E2F45;
  --on-lamp: #2A2213;
  --gold: #F2C879;
  --gold-soft: #362C18;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.6; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
img { max-width: 100%; }
p { margin: 0; }
h1 { font-size: 24px; margin: 0; font-weight: 400; text-wrap: balance; }
h2 { font-size: 17px; margin: 0; font-weight: 400; text-wrap: balance; }
.sub { color: var(--sub); font-size: 13px; }
.err { color: var(--pink); font-size: 13px; }
.pixel { font-family: var(--pixel); letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.infoc { color: var(--info); }
.goodc { color: var(--good); }

.view {
  max-width: 680px; margin: 0 auto;
  padding-inline: 16px;
  padding-block: calc(18px + env(safe-area-inset-top, 0px)) calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom, 0px));
  display: grid; gap: 18px; align-content: start;
}
body.bare .view { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }

/* ---------- controls ---------- */
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 2px solid var(--border); background: var(--surface-2); border-radius: 14px; padding: 9px 16px; transition: border-color .15s, background .15s; }
button:hover { border-color: var(--faint); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, canvas:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
button.primary { background: var(--lamp); border-color: var(--lamp); color: var(--on-lamp); box-shadow: 0 4px 0 var(--lamp-deep); font-weight: 500; }
button.primary:hover { filter: brightness(1.05); }
button.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--lamp-deep); }
button.big { margin-bottom: 4px; }
/* a text button looks like a link: blue, so it reads as something to tap */
button.quiet { background: none; border-color: transparent; color: var(--info); padding-inline: 8px; }
button.quiet:hover { color: var(--text); }
button.danger { color: var(--pink); }
button:disabled { opacity: .45; cursor: default; }
button.big { padding: 13px 20px; font-size: 16px; border-radius: 16px; }
button.icon-btn { display: inline-flex; align-items: center; gap: 8px; }

label { display: grid; gap: 6px; font-size: 13px; color: var(--sub); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], input[type="url"], input[type="time"], input[type="email"], textarea, select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; width: 100%;
}
textarea { resize: vertical; min-height: 70px; }
::placeholder { color: var(--faint); }

.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.stack { display: grid; gap: 8px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 16px; display: grid; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* a choice: outlined when not picked, filled light (inverted) when picked, so the pick is obvious at a glance */
.chip { border-radius: 999px; padding: 5px 13px; font-size: 13px; background: transparent; border-color: var(--line-strong); color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; display: inline-block; }
.tag { font-size: 12px; border-radius: 999px; padding: 1px 9px; background: var(--info-soft); color: var(--info); white-space: nowrap; }
.tag.open { background: var(--pink-soft); color: var(--pink); }
.tag.got { background: var(--good-soft); color: var(--good); }

.icon { display: inline-block; flex: none; }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---------- bear ---------- */
/* the bear: a pixel sprite, drawn straight on the dark background (it has its own outline) */
.bear-box { display: grid; place-items: end center; flex: none; }
img.bear { image-rendering: pixelated; width: auto; max-width: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.bear-box.bob { animation: bob 1.4s steps(2, jump-none) infinite; }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
.say { display: flex; align-items: flex-end; gap: 12px; }
.bubble { background: var(--surface); border: 1px solid var(--border); border-radius: 18px 18px 18px 4px; padding: 11px 15px; flex: 1; min-width: 0; }
.bubble b { font-weight: 400; color: var(--text); }

/* ---------- tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs button { height: var(--tabs-h); border: 0; border-radius: 0; background: none; color: var(--faint); font-size: 12px; display: grid; justify-items: center; align-content: center; gap: 3px; }
.tabs button .icon { width: 22px; height: 22px; }
.tabs button[aria-current="page"] { color: var(--text); }
.tabs button[aria-current="page"] .icon { background: var(--surface-3); border-radius: 10px; box-shadow: 0 0 0 6px var(--surface-3); }
.tabs button.snap { color: var(--text); }
.tabs button.snap .icon { width: 26px; height: 26px; color: var(--text); }
.tabs button.snap .ring { width: 48px; height: 48px; border-radius: 16px; background: var(--surface-3); display: grid; place-items: center; margin-top: -18px; border: 4px solid var(--bg); box-sizing: content-box; }
body.bare .tabs { display: none; }

/* ---------- home: mines side by side ---------- */
.mines { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
/* 首頁: one row of mines, swiped sideways, bleeding to the screen edges */
.mines.scroll { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 124px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin-inline: -16px; padding: 2px 16px 4px; scroll-padding-inline: 16px; scrollbar-width: none; }
.mines.scroll::-webkit-scrollbar { display: none; }
.mines.scroll > * { scroll-snap-align: start; }
.mines.scroll .mine-card.add { min-height: 0; }
.home-go { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.home-go button { display: grid; justify-items: center; gap: 6px; padding: 16px 8px; border-radius: 18px; font-size: 16px; }
.mine-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 0; overflow: hidden; text-align: left; display: grid; }
.mine-card:hover { border-color: var(--faint); }
.mine-card canvas { width: 100%; image-rendering: pixelated; display: block; }
.mine-card .label { padding: 8px 10px 10px; display: grid; gap: 1px; }
.mine-card .depth { font-family: var(--pixel); font-size: 20px; color: var(--text); letter-spacing: 1px; }
.mine-card .depth small { font-size: 12px; margin-left: 2px; color: var(--sub); }
.mine-card.add { place-items: center; min-height: 200px; color: var(--sub); border-style: dashed; background: none; gap: 6px; text-align: center; }

.today-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
/* numbers to read, not to press: no card around them */
.stat { padding: 2px 0; display: grid; gap: 2px; }
.stat b { font-weight: 400; font-family: var(--pixel); font-size: 22px; color: var(--text); letter-spacing: 1px; }
.stat b small { font-family: var(--font); font-size: 12px; color: var(--sub); margin-left: 3px; letter-spacing: 0; }

.exam { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.exam .days { font-family: var(--pixel); font-size: 20px; color: var(--info); }
.exam .days small { font-family: var(--font); font-size: 12px; color: var(--sub); margin-left: 2px; }

/* ---------- a mine up close ---------- */
.shaft-wrap { position: relative; max-width: 420px; width: 100%; margin: 0 auto; }
.shaft-wrap canvas { width: 100%; image-rendering: pixelated; display: block; border-radius: 18px; cursor: pointer; }
.shaft-labels { position: absolute; inset: 0; pointer-events: none; }
.shaft-labels span { position: absolute; left: -2px; transform: translate(-100%, -50%); font-size: 11px; color: var(--sub); white-space: nowrap; font-family: var(--pixel); }
.layer-name { position: absolute; right: 8px; transform: translateY(4px); font-size: 12px; color: rgba(236,230,218,.75); background: rgba(12,16,24,.55); border-radius: 8px; padding: 1px 8px; }
.mine-head { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; }
.bigdepth { font-family: var(--pixel); font-size: 40px; line-height: 1; color: var(--text); letter-spacing: 2px; }
.bigdepth small { font-size: 16px; color: var(--sub); margin-left: 4px; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--lamp); border-radius: 4px; }
.finds { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.find { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 10px; display: grid; justify-items: center; gap: 4px; text-align: center; font-size: 13px; }
.find canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.find.locked { color: var(--faint); border-style: dashed; background: none; }
.find.locked canvas { filter: brightness(0) opacity(.35); }

/* ---------- to-dos ---------- */
.todo-list { display: grid; gap: 6px; }
.todo { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px 8px 8px 12px; }
.todo .title { min-width: 0; overflow-wrap: anywhere; }
.todo.done .title { color: var(--faint); text-decoration: line-through; }
.check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--faint); background: none; padding: 0; display: grid; place-items: center; }
.check[aria-checked="true"] { background: var(--good); border-color: var(--good); }
.check[aria-checked="true"]::after { content: ""; width: 10px; height: 6px; border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(-45deg) translate(1px, -1px); }
.todo .go { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.add-todo { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.add-opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- questions / gems ---------- */
.q-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.q-card { text-align: left; background: var(--surface); border-radius: 16px; padding: 0; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.thumb { aspect-ratio: 4 / 3; max-width: 100%; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .q { padding: 10px; font-size: 13px; color: var(--sub); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.meta { padding: 9px 11px 11px; display: grid; gap: 4px; }
.meta .topic { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop { border: 1.5px dashed var(--border); border-radius: 16px; padding: 26px 16px; text-align: center; color: var(--sub); cursor: pointer; display: grid; gap: 10px; place-items: center; }
.drop:hover { border-color: var(--line-strong); color: var(--text); }
.drop img { max-height: 280px; border-radius: 10px; }
.photo { border-radius: 14px; border: 1px solid var(--border); display: block; }
.facts { display: grid; gap: 8px; margin: 0; }
.facts div { display: grid; grid-template-columns: 4.5em 1fr; gap: 8px; }
.facts dt { color: var(--sub); font-size: 13px; }
.facts dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat { display: grid; gap: 10px; }
.msg { max-width: 90%; padding: 10px 14px; border-radius: 18px; border: 1px solid var(--border); overflow-wrap: anywhere; }
.msg.me { justify-self: end; background: var(--surface-3); border-color: transparent; border-radius: 18px 4px 18px 18px; }
.msg.bear { justify-self: start; background: var(--bg); border-radius: 4px 18px 18px 18px; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin: 0; }
.msg ul, .msg ol { margin: 4px 0; padding-left: 20px; }
.ask { display: flex; gap: 8px; }
.ask input { flex: 1; min-width: 0; }
.empty { border: 1.5px dashed var(--border); border-radius: 18px; padding: 26px 16px; text-align: center; color: var(--sub); display: grid; justify-items: center; gap: 12px; }

/* ---------- studying ---------- */
.study-screen {
  position: fixed; inset: 0; z-index: 20; background: var(--bg); overflow-y: auto;
  padding-inline: 16px;
  padding-block: calc(16px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-bottom, 0px));
}
.study-screen .inner { width: 100%; max-width: 460px; margin: 0 auto; display: grid; gap: 14px; justify-items: center; text-align: center; }
.study-screen .dig { width: min(100%, 300px); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); }
.study-screen .dig canvas { width: 100%; image-rendering: pixelated; display: block; }
.clock { font-family: var(--pixel); font-size: 60px; line-height: 1; letter-spacing: 3px; font-variant-numeric: tabular-nums; }
.cells { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; width: 100%; }
.cells i { width: 16px; height: 9px; border-radius: 3px; background: var(--surface-2); }
.cells i.on { background: var(--lamp); }
.study-screen .actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.study-screen .actions.even { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); width: 100%; }
.study-screen .actions.even button { padding-inline: 6px; white-space: nowrap; }
.todo-toggle { display: flex; justify-content: space-between; align-items: center; width: 100%; background: var(--surface); text-align: left; font-size: 16px; }
.todo-toggle .chev { color: var(--sub); transition: transform .15s; }
.study-side:not(.open) > :not(.todo-toggle) { display: none; }
.study-side.open .todo-toggle .chev { transform: rotate(180deg); }
.panel { width: 100%; text-align: left; }
.hold { position: relative; overflow: hidden; }
.hold i { position: absolute; inset: 0; background: var(--pink-soft); transform-origin: left; transform: scaleX(0); }
.hold span { position: relative; }
.discovery { display: grid; gap: 10px; justify-items: center; }
.discovery canvas { width: 64px; height: 64px; image-rendering: pixelated; }

/* ---------- records ---------- */
/* every week fits the card: cells shrink with the width instead of scrolling */
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, auto); grid-auto-columns: minmax(0, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--surface-2); }
.heat i.l1 { background: #0F4461; } .heat i.l2 { background: #136A99; } .heat i.l3 { background: #1893CC; } .heat i.l4 { background: var(--lamp); }
.heat i.today { outline: 1px solid var(--text); outline-offset: 1px; }
.heat-legend { display: flex; gap: 4px; align-items: center; justify-content: flex-end; font-size: 12px; color: var(--sub); }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.bars { display: grid; gap: 10px; }
.barrow { display: grid; grid-template-columns: 5em 1fr 4em; gap: 8px; align-items: center; font-size: 14px; }
.barrow .track, .unit-track { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.barrow .track i, .unit-track i { display: block; height: 100%; border-radius: 5px; }
.barrow .num { text-align: right; font-family: var(--pixel); color: var(--sub); }
.history { display: grid; gap: 8px; }
.history div { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; font-size: 14px; }

/* ---------- onboarding ---------- */
.onboard { width: 100%; min-height: calc(100vh - 60px); display: grid; align-content: center; gap: 20px; max-width: 460px; margin: 0 auto; }
.onboard .big-bear { display: grid; justify-items: center; gap: 14px; text-align: center; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom, 0px));
  background: var(--text); color: var(--bg); border-radius: 14px; padding: 9px 16px; font-size: 14px; max-width: calc(100% - 32px);
}
.celebrate {
  position: fixed; inset: 0; z-index: 30; background: rgba(5,10,13,.8); display: grid; place-items: center; padding-inline: 16px;
}
.celebrate .card { max-width: 360px; width: 100%; text-align: center; justify-items: center; }

@media (prefers-reduced-motion: reduce) { .bear-box.bob { animation: none; } * { transition: none !important; } }

/* ---------- studying, minimized ---------- */
.studybar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding-inline: 16px; padding-block: calc(8px + env(safe-area-inset-top, 0px)) 8px;
}
.studybar button { padding: 6px 14px; }
body.has-studybar .view { padding-top: calc(76px + env(safe-area-inset-top, 0px)); }
body.locked .tabs { display: none; }
body.locked .view { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }

/* ---------- study screen with the to-do list beside it ---------- */
.study-layout { width: 100%; max-width: 1000px; margin: 0 auto; display: grid; gap: 28px; }
.study-side { display: grid; gap: 12px; align-content: start; text-align: left; border-top: 1px solid var(--border); padding-top: 22px; width: 100%; max-width: 460px; margin: 0 auto; }
@media (min-width: 860px) {
  .study-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; padding-top: 12px; }
  .study-side { border-top: 0; border-left: 1px solid var(--border); padding: 4px 0 4px 28px; min-height: 60vh; }
}

/* ---------- 拍照問 is the headline feature ---------- */
button.snap-btn { background: var(--surface-2); border-color: var(--border); color: var(--text); }
button.snap-btn:hover { border-color: var(--line-strong); }

/* ---------- 問小白：pixel dialog ---------- */
.qtop { position: sticky; top: 0; z-index: 5; background: var(--bg); margin: calc(-18px - env(safe-area-inset-top, 0px)) -16px 0; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--border); }
.qtitle { flex: 1; min-width: 0; }
.qtitle h2 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qmenu { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.qstrip { display: flex; align-items: center; gap: 10px; text-align: left; background: var(--surface); border-radius: 10px; padding: 7px 10px; }
.qstrip .qtext { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qstrip img { width: 40px; height: 32px; object-fit: cover; border-radius: 6px; flex: none; }
.qphoto { border-radius: 10px; border: 1px solid var(--border); max-height: 60vh; object-fit: contain; width: 100%; background: var(--surface); }

.dialog { display: grid; gap: 12px; padding-top: 6px; align-content: start; }
.line { overflow-wrap: anywhere; }
.line.me { justify-self: end; max-width: 82%; background: var(--surface-3); color: var(--text); padding: 8px 13px; border-radius: 6px; }
.line.bear { position: relative; background: var(--surface); border: 2px solid var(--border); border-radius: 6px; padding: 11px 14px; }
.line.bear .name { position: absolute; top: -10px; left: 10px; background: var(--bg); padding: 0 6px; font-family: var(--pixel); font-size: 12px; line-height: 18px; letter-spacing: 1px; color: var(--sub); }
.line.bear:has(.name) { margin-top: 8px; }
.line.bear b, .line.bear strong { font-weight: 400; color: var(--info); }
.line.bear p { margin: 0 0 6px; } .line.bear p:last-child { margin: 0; }
.line.bear ul, .line.bear ol { margin: 2px 0 6px; padding-left: 20px; }
.line.thinking { color: var(--sub); }
.line.thinking div { animation: blink 1s steps(2, jump-none) infinite; }
@keyframes blink { from { opacity: 1; } to { opacity: .35; } }

.composer { position: sticky; bottom: 0; z-index: 5; background: var(--bg); margin: 0 -16px calc(-28px - env(safe-area-inset-bottom, 0px)); padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); display: grid; gap: 8px; }
.composer .chips { flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-inline: -12px; padding-inline: 12px; }
.composer .chips::-webkit-scrollbar { display: none; }
.composer .chips .chip { white-space: nowrap; flex: none; }
.composer .ask input { border-radius: 999px; padding-inline: 16px; }
.composer .ask button { border-radius: 999px; }
.view:has(> .composer) { min-height: 100dvh; grid-template-rows: auto 1fr auto; }

/* ---------- figures in the bear's replies ---------- */
.said { display: grid; gap: 8px; }
.fig { margin: 2px 0; background: var(--bg); border-radius: 6px; padding: 8px; display: grid; gap: 4px; }
.fig-svg { display: block; max-width: 420px; margin: 0 auto; font-family: var(--font); overflow: visible; }
.fig figcaption { color: var(--sub); font-size: 12px; text-align: center; }
.fig.bad { color: var(--faint); font-size: 12px; }
.fig-table { overflow-x: auto; }
.fig-table table { border-collapse: collapse; margin: 0 auto; font-size: 13px; font-variant-numeric: tabular-nums; }
.fig-table th, .fig-table td { border: 1px solid var(--border); padding: 4px 12px; text-align: center; }
.fig-table th { color: var(--sub); font-weight: 400; background: var(--surface); }
.fig-table td.hl { background: var(--lamp-soft); color: var(--lamp-text); }
.motion { display: grid; gap: 8px; }
.motion-read { text-align: center; font-size: 12px; color: var(--lamp-text); white-space: pre; }
.motion-graphs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.motion-ctl { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.motion-slider { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 8px; width: 100%; font-size: 12px; color: var(--sub); }
.motion-slider input { accent-color: var(--lamp); width: 100%; }
.motion-slider .pixel { color: var(--lamp-text); text-align: right; font-size: 11px; }
.motion-ask { color: var(--lamp-text); font-size: 13px; text-align: center; }
.qpoints { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ---------- 錯題（review）page ---------- */
.rv-tabs { display: flex; gap: 6px; overflow-x: auto; margin-inline: -16px; padding: 2px 16px; scrollbar-width: none; }
.rv-tabs::-webkit-scrollbar { display: none; }
.rv-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 6px 14px; font-size: 14px; background: transparent; border-color: var(--line-strong); }
.rv-tab .dot { width: 7px; height: 7px; }
.rv-tab[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

.rv-next { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 18px; padding: 14px 16px; }
.rv-next-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.rv-next-name { font-size: 19px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-next .primary { flex: none; white-space: nowrap; }


.rv-weak, .rv-qs { list-style: none; margin: 0; padding: 0; display: grid; background: var(--surface); border-radius: 18px; overflow: hidden; }
.rv-weak li + li, .rv-qs li + li { border-top: 1px solid var(--border); }
.rv-weak-row { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0; border-radius: 0; padding: 12px 12px 12px 16px; }
.rv-weak-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rv-weak-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-badge { flex: none; display: inline-flex; align-items: baseline; gap: 3px; font-size: 12px; border-radius: 999px; padding: 2px 10px; color: var(--sub); }
.rv-badge b { font-weight: 400; font-size: 15px; }
.rv-badge.open { background: var(--pink-soft); color: var(--pink); }
.rv-badge.done { background: var(--good-soft); color: var(--good); }
/* 熟練度 (mastery.js): a short bar and the number */
.rv-mastery { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); }
.rv-mastery b { font-weight: 400; font-size: 13px; min-width: 3ch; text-align: right; }
.rv-mastery-bar { width: 44px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.rv-mastery-bar i { display: block; height: 100%; background: var(--lamp); border-radius: 3px; }
.rv-mastery.low .rv-mastery-bar i { background: var(--pink); }
.rv-mastery.low b { color: var(--pink); }
.rv-mastery.high .rv-mastery-bar i { background: var(--good); }
.rv-mastery.high b { color: var(--good); }
.rv-chev { color: var(--faint); display: inline-flex; }
.rv-chev .icon, .rv-cta .icon { transform: rotate(180deg); }
.rv-none { padding: 4px 2px; }

.rv-point { display: grid; gap: 6px; }
.rv-progress { display: grid; gap: 6px; }
.rv-progress-bar { height: 8px; border-radius: 4px; background: var(--pink-soft); overflow: hidden; }
.rv-progress-bar span { display: block; height: 100%; background: var(--good); border-radius: 4px; }
.rv-related { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.rv-book-head { display: grid; gap: 10px; }
.rv-point-chip { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border-radius: 12px; padding: 3px; }
.rv-seg button { border: 0; background: none; border-radius: 9px; padding: 6px 0; font-size: 14px; color: var(--sub); }
.rv-seg button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.rv-seg button[aria-selected="true"] .rv-count { color: var(--bg); opacity: .7; }

.rv-q { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; background: none; border: 0; border-radius: 0; padding: 10px 12px; }
.rv-q-photo { width: 48px; height: 48px; flex: none; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.rv-q-photo.text { display: grid; place-items: center; padding: 4px; font-size: 10px; line-height: 1.3; color: var(--sub); overflow: hidden; text-align: center; word-break: break-all; }
.rv-q-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rv-q-topic, .rv-q-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-q[data-status="got"] .rv-q-topic { color: var(--sub); }

.rv-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; border: 1.5px dashed var(--border); background: none; border-radius: 18px; padding: 12px 16px; }
.rv-cta > span { display: grid; }
.rv-cta b { font-weight: 400; }
.rv-cta:disabled { opacity: 1; cursor: default; }
.rv-cta:disabled b { color: var(--sub); }

/* ---------- inside the Android app: no web-page gestures ---------- */
html.native, html.native body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.native input, html.native textarea, html.native .said, html.native .line { -webkit-user-select: text; user-select: text; }
html.native img, html.native canvas { -webkit-user-drag: none; }
html.native { scrollbar-width: none; }
html.native ::-webkit-scrollbar { display: none; }

/* ---------- native feel: screen changes, press feedback, offline ---------- */
@keyframes enter-push { from { transform: translateX(32px); opacity: 0; } }
@keyframes enter-back { from { transform: translateX(-32px); opacity: 0; } }
@keyframes enter-fade { from { transform: translateY(6px); opacity: 0; } }
.view.enter-push { animation: enter-push .24s cubic-bezier(.2, .8, .2, 1); }
.view.enter-back { animation: enter-back .24s cubic-bezier(.2, .8, .2, 1); }
.view.enter-fade { animation: enter-fade .18s ease-out; }

button { transition: transform .08s ease-out, background .12s, border-color .15s; }
button:active:not(:disabled) { transform: scale(.97); }
.rv-weak-row:active, .rv-q:active, .rv-cta:active:not(:disabled), .q-card:active, .qstrip:active { transform: none; background: var(--surface-2); }
.tabs button:active { transform: none; }
.tabs button:active .icon, .tabs button:active .ring { transform: scale(.9); transition: transform .08s; }

.offline-bar { position: sticky; top: 0; z-index: 20; background: var(--surface-2); color: var(--sub); font-size: 13px; text-align: center; padding: 6px 16px calc(6px); }

/* ---------- 考卷 ---------- */
.ex-making { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 8px 0; }
.ex-top { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; align-items: center; gap: 10px; margin: calc(-18px - env(safe-area-inset-top, 0px)) -16px 0; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 10px; }
.ex-progress { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ex-progress span { display: block; height: 100%; background: var(--lamp); border-radius: 3px; transition: width .2s; }
.ex-count { color: var(--sub); font-size: 13px; }
.ex-stem { font-size: 17px; line-height: 1.7; }
.ex-options { display: grid; gap: 10px; }
.ex-option { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); border-radius: 14px; padding: 13px 14px; font-size: 16px; }
.ex-option[aria-pressed="true"] { border-color: var(--line-strong); background: var(--surface-3); color: var(--text); }
.ex-letter { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--surface-2); color: var(--sub); font-size: 13px; }
.ex-option[aria-pressed="true"] .ex-letter { background: var(--text); color: var(--bg); }
.ex-fill { font-size: 13px; }
.ex-fill input { font-size: 18px; padding: 12px 14px; }
.ex-nav { position: sticky; bottom: 0; z-index: 5; background: var(--bg); display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -16px calc(-28px - env(safe-area-inset-bottom, 0px)); padding: 10px 12px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); }
.view:has(> .ex-nav) { min-height: 100dvh; grid-template-rows: auto auto auto 1fr auto; }
.view:has(> .ex-nav) > .ex-options, .view:has(> .ex-nav) > .ex-fill { align-content: start; align-self: start; }
.ex-score { display: grid; gap: 12px; justify-items: center; background: var(--surface); border-radius: 18px; padding: 18px 16px; }
.ex-score > div:first-child b { font-weight: 400; font-size: 48px; color: var(--text); }
.ex-score > div:first-child span { font-size: 22px; color: var(--sub); }
.ex-score .say { width: 100%; }
.ex-review { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); background: var(--surface); border-radius: 18px; overflow: hidden; }
.ex-review li + li { border-top: 1px solid var(--border); }
.ex-review summary { display: flex; gap: 10px; align-items: baseline; padding: 12px 14px; cursor: pointer; list-style: none; }
.ex-review summary::-webkit-details-marker { display: none; }
.ex-mark { flex: none; width: 18px; font-size: 15px; }
.ex-review li[data-right="true"] .ex-mark { color: var(--good); }
.ex-review li[data-right="false"] .ex-mark { color: var(--pink); }
.ex-review-stem { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-review-body { padding: 0 14px 14px 42px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

/* ---------- printable pages (drawn off-screen, then turned into a PDF) ---------- */
.print-stage { position: fixed; left: -12000px; top: 0; display: grid; gap: 20px; pointer-events: none; }
.print-page {
  --text: #1b1b1b; --sub: #555; --faint: #888; --border: #cfcfcf; --surface: #f6f6f6; --surface-2: #eeeeee; --bg: #ffffff;
  --lamp: #b8860b; --lamp-text: #7a5800; --lamp-soft: #fbf3dc; --good: #2e8b57; --pink: #c0392b;
  width: 794px; height: 1123px; background: #fff; color: var(--text); font-family: var(--font); font-size: 13.5px; line-height: 1.55;
  padding: 34px 44px 26px; display: grid; grid-template-rows: auto 1fr auto; gap: 10px; box-sizing: border-box;
}
.print-head { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1.2px solid #1b1b1b; padding-bottom: 5px; }
.print-head b { font-weight: 400; font-size: 17px; }
.print-head span, .print-foot { color: var(--sub); font-size: 11px; }
.print-foot { text-align: center; }
.print-body { overflow: hidden; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.print-q { display: grid; gap: 4px; }
.print-q-head { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.print-q-head b { font-weight: 400; }
.print-q-head span { color: var(--sub); font-size: 10.5px; }
.print-stem .fig { background: none; padding: 0; margin: 2px 0; }
.print-stem .fig-svg { max-width: 220px; margin: 0; }
.print-stem p { margin: 0 0 2px; }
.print-options { margin: 0; padding-left: 0; list-style: none; display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 2px 28px; }
.print-options.long { grid-template-columns: 1fr 1fr; }
.print-lines { min-height: 84px; border: 1px solid var(--border); border-radius: 4px; padding: 3px 8px; color: var(--faint); font-size: 10.5px;
  background: repeating-linear-gradient(to bottom, transparent 0 25px, #c8c8c8 25px 26px); }
.print-lines.short { min-height: 34px; background: none; }
/* 錯題本: the question on the left, the space to rewrite it on the right */
.print-q.book { grid-template-columns: 1fr 1fr; column-gap: 16px; align-items: stretch; }
.print-q.book .print-q-head { grid-column: 1 / -1; }
.print-photo { max-width: 100%; max-height: 230px; object-fit: contain; justify-self: start; border: 1px solid var(--border); }
.print-key-title { font-weight: 400; font-size: 16px; margin: 0; }
.print-key { display: grid; gap: 1px; font-size: 12.5px; }
.print-keys { display: grid; gap: 6px; }
.print-key-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; align-items: start; }
.print-page.d2 .print-key, .print-page.d3 .print-key { font-size: 11px; line-height: 1.35; }
.print-page.d3 .print-lines.short { min-height: 26px; }
.print-key b { font-weight: 400; }

/* tighter levels, tried in turn until everything fits on one sheet (two sides) */
.print-page.d1 { font-size: 12.5px; line-height: 1.5; padding: 30px 40px 22px; }
.print-page.d1 .print-body { gap: 9px; }
.print-page.d1 .print-stem .fig-svg { max-width: 180px; }
.print-page.d1 .print-lines { min-height: 64px; }
.print-page.d1 .print-photo { max-height: 180px; }
.print-page.d2 { font-size: 11.5px; line-height: 1.45; padding: 26px 36px 20px; }
.print-page.d2 .print-body { gap: 7px; }
.print-page.d2 .print-stem .fig-svg { max-width: 150px; }
.print-page.d2 .print-lines { min-height: 50px; background: repeating-linear-gradient(to bottom, transparent 0 20px, #c8c8c8 20px 21px); }
.print-page.d2 .print-photo { max-height: 150px; }
.print-page.d2 .print-options { gap: 0 20px; }
.print-page.d3 { font-size: 10.5px; line-height: 1.4; padding: 22px 30px 16px; }
.print-page.d3 .print-body { gap: 5px; }
.print-page.d3 .print-stem .fig-svg { max-width: 120px; }
.print-page.d3 .print-lines { min-height: 40px; background: repeating-linear-gradient(to bottom, transparent 0 17px, #c8c8c8 17px 18px); }
.print-page.d3 .print-photo { max-height: 120px; }
.print-page.d3 .print-q.book { grid-template-columns: 3fr 2fr; }
.print-page.d3 .print-options { gap: 0 14px; }

/* ---------- 徽章 ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.badge { background: var(--surface); border-radius: 14px; padding: 12px 8px 10px; display: grid; justify-items: center; gap: 4px; text-align: center; }
.badge-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); }
.badge[data-earned="true"] .badge-icon { background: var(--good-soft); color: var(--good); }
.badge-name { font-size: 13px; }
.badge[data-earned="false"] .badge-name { color: var(--sub); }
.badge-how { font-size: 11px; line-height: 1.4; }

/* ---------- sign in ---------- */
button.google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
button.google svg { background: #fff; border-radius: 50%; padding: 3px; box-sizing: content-box; }
.onboard .fine { text-align: center; font-size: 12px; color: var(--faint); }
.onboard .fine a { color: var(--sub); }
.gsi { display: flex; justify-content: center; min-height: 44px; }

/* ---------- onboarding: stage and subjects ---------- */
.stage-list { display: grid; gap: 10px; }
button.stage { display: grid; gap: 2px; text-align: left; padding: 14px 18px; border-radius: 16px; background: var(--surface); }
button.stage span { font-size: 18px; }
button.stage small { color: var(--sub); font-size: 13px; }
.subject-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
button.subject-tile { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 0 16px; border-radius: 14px; background: var(--surface); font-size: 16px; color: var(--sub); }
button.subject-tile i { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border); display: grid; place-items: center; }
button.subject-tile[aria-pressed="true"] { border-color: var(--line-strong); background: var(--surface-3); color: var(--text); }
button.subject-tile[aria-pressed="true"] i { background: var(--text); border-color: var(--text); }
button.subject-tile[aria-pressed="true"] i::after { content: ""; width: 5px; height: 10px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.split-row { display: grid; gap: 2px; justify-items: start; margin-top: -8px; }
button.quiet.split { font-size: 13px; padding: 4px 2px; color: var(--sub); text-decoration: underline; text-underline-offset: 3px; }

/* A session is running: pages opened from it (the bear's answer) are part of studying, not the rest of the app. */
body.has-studybar .tabs { display: none; }
body.has-studybar .view { padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px)); }

/* Grid children may shrink below their content, so a long unbroken line (a read-in question) ellipsizes
   instead of widening the whole page. */
.view > *, .qtop > * { min-width: 0; }

/* ---------- 拍照問: frame one question ---------- */
.crop-screen { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: grid; grid-template-rows: auto 1fr auto; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)); }
.crop-hint { text-align: center; color: var(--sub); font-size: 14px; }
.crop-stage { position: relative; min-height: 0; overflow: hidden; touch-action: none; }
.crop-stage img { width: 100%; height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.crop-box { position: absolute; border: 2px solid var(--lamp); border-radius: 10px; box-shadow: 0 0 0 9999px rgba(20, 25, 37, .62); cursor: move; touch-action: none; }
.read-check { align-items: center; margin-bottom: 6px; }
.crop-box.mark { box-shadow: none; border-color: #FF2878; background: rgba(255, 40, 120, .22); }
.crop-h { position: absolute; width: 28px; height: 28px; }
.crop-h::after { content: ""; position: absolute; inset: 8px; background: var(--lamp); border-radius: 3px; }
.crop-h[data-c="nw"] { left: -14px; top: -14px; cursor: nwse-resize; }
.crop-h[data-c="ne"] { right: -14px; top: -14px; cursor: nesw-resize; }
.crop-h[data-c="sw"] { left: -14px; bottom: -14px; cursor: nesw-resize; }
.crop-h[data-c="se"] { right: -14px; bottom: -14px; cursor: nwse-resize; }
.crop-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.crop-actions button { padding: 13px; font-size: 16px; border-radius: 16px; }

/* 幫我鎖住: the permission steps before the first locked session */
.perm-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 4px 0; }
.perm-row b { font-weight: 400; }
.perm-row p.sub { margin: 2px 0 0; }
.perm-row > button, .perm-row > .tag { flex: none; }

/* Screens over the study screen (申請使用, 記下念頭, 結束): one thing per screen, centred. The main button comes
   first at full width, the alternative under it, the way out last as quiet text. */
.study-screen .inner.sheet { align-content: center; min-height: 100%; }
.sheet h2 { margin: 4px 0 0; }
.sheet > .sub { margin: -6px 0 4px; }
.sheet > p.infoc { margin: -4px 0 4px; }
.sheet > button, .sheet-actions button, .request-choices button { width: 100%; }
.sheet > button.quiet { width: auto; }
.sheet-form { width: 100%; display: grid; gap: 10px; }
.sheet-actions { width: 100%; display: grid; gap: 8px; margin-top: 4px; }

.reason-list { width: 100%; display: grid; gap: 8px; }
.reason-row { display: grid; gap: 2px; text-align: left; padding: 12px 16px; border-radius: 16px; background: var(--surface); }
.reason-row b { font-weight: 400; }
.request-instead { width: 100%; display: grid; gap: 8px; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--border); }
.request-instead > .sub { margin: 0; text-align: left; }
.request-instead.alone { border-top: 0; padding-top: 0; }
.request-choices { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.countdown { font-size: 64px; line-height: 1; color: var(--text); margin: 8px 0; }

/* 這一場挖完了 */
.end-dig { width: min(100%, 220px); border-radius: 18px; overflow: hidden; border: 1px solid var(--border); }
.end-dig canvas { width: 100%; image-rendering: pixelated; display: block; }
.sheet.end .bigdepth { font-size: 48px; }
.end-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.end-stats span { font-size: 12px; color: var(--sub); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; }
.notes-card h2 { font-size: 15px; margin: 0; }
.notes-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.note-row > button, .note-row > .tag { flex: none; }

/* 讀書設定: 開始挖 stays in reach above the tab bar however long the choices get */
.study-start { position: sticky; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px) + 12px); z-index: 2; }

/* 錯題: counts inside the filter, and the knowledge-point ranking folded under the book */
.rv-count { margin-left: 5px; font-size: 12px; color: var(--sub); }
.rv-fold { border: 1px solid var(--border); border-radius: 16px; padding: 0 14px; background: var(--surface); }
.rv-fold > summary { list-style: none; cursor: pointer; padding: 12px 0; display: flex; justify-content: space-between; align-items: center; }
.rv-fold > summary::-webkit-details-marker { display: none; }
.rv-fold > summary::after { content: "▾"; color: var(--sub); }
.rv-fold[open] > summary::after { transform: rotate(180deg); }
.rv-fold[open] { padding-bottom: 12px; }

/* 礦坑: the shaft in its own scrolling frame */
.shaft-frame { max-height: 56vh; overflow-y: auto; overflow-x: hidden; border-radius: 16px; scrollbar-width: none; overscroll-behavior: contain; }
.shaft-frame::-webkit-scrollbar { display: none; }

/* 桌鐘模式: dark but on, only the clock (and whose clock), drifting a little against burn-in */
.study-screen { transition: background .6s; }
.study-screen.dim { background: #000; }
.study-screen.dim .study-layout { min-height: 100%; align-content: center; }
.study-screen.dim .study-side,
.study-screen.dim .inner > :not(h1):not(.clock) { display: none; }
.study-screen.dim .inner { transform: translate(var(--drift-x, 0), var(--drift-y, 0)); transition: transform 2s; }
.study-screen.dim h1 { color: var(--sub); font-size: 18px; }
.study-screen.dim .clock { color: var(--clock-color, var(--text)); }
/* landscape desk clock: the clock as big as the screen allows */
@media (orientation: landscape) {
  .study-screen.dim .study-layout { grid-template-columns: 1fr; padding-top: 0; }
  .study-screen.dim .inner { max-width: none; gap: 4px; }
  .study-screen.dim .clock { font-size: min(22vw, 58vh); letter-spacing: 1vw; }
  .study-screen.dim h1 { font-size: 16px; }
}

/* 窗景 (window.js): the desk clock with a window above it and the mine as a thin strip on the right */
.study-screen.dim.windowed { background: #121726; }
.window-layer { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.study-screen.dim.windowed .study-layout { position: relative; z-index: 1; align-content: end; padding-bottom: 13vh; }
.study-screen.dim.windowed h1 { font-size: 15px; }
.study-screen.dim.windowed .inner { transform: none; } /* under a window the clock stays put, exactly centred */
/* each window: the whole screen is its wall (a 1080×2340 3D render with the glass left clear, media/*-frame.webp),
   and the looping view (media/clouds.mp4, city.mp4) sits behind the glass. The screen takes the wall's colour. */
.win { position: absolute; top: 0; left: 0; width: 100%; aspect-ratio: 1080 / 2340; }
.win-glass { position: absolute; overflow: hidden; background: #0B0F1A; }
.win video.view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; pointer-events: none; }
.win .win-frame { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; user-select: none; }
.study-screen.dim.windowed[data-win="plane"] { background: #414249; }
.win.plane .win-glass { left: 10%; top: 7.7%; width: 80%; height: 56.6%; }
.study-screen.dim.windowed[data-win="bus"] { background: #4D5057; }
.win.bus .win-glass { left: 6%; top: 12%; width: 88%; height: 38%; }
/* the bus window is wide and a grab pole stands on the right: the strip goes below the rail, on the left */
.study-screen[data-win="bus"] .mine-strip { top: 60vh; bottom: 12vh; left: 10px; right: auto; }
.study-screen[data-win="bus"] .mine-label { right: auto; left: 16px; }
/* the window buttons at the bottom: clear for a few seconds, then quieter but still there */
.window-switch { position: absolute; left: 0; right: 0; bottom: calc(4vh + env(safe-area-inset-bottom, 0px)); z-index: 2; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0 16px; animation: winswitch 7s forwards; }
.window-switch .window-hint { flex-basis: 100%; margin: 2px 0 0; text-align: center; font-size: 12px; color: var(--faint); }
@keyframes winswitch { 75% { opacity: 1; } 100% { opacity: .45; } }
.mine-strip { position: absolute; right: 10px; top: 14vh; bottom: 14vh; width: 10px; }
.mine-bands { display: flex; flex-direction: column; height: 100%; border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.mine-bands i { display: block; }
.mine-dug { position: absolute; left: 1px; right: 1px; top: 1px; height: calc(var(--at, 0) * 100%); background: rgba(15, 19, 28, .55); }
.mine-mark { position: absolute; left: -3px; right: -3px; top: calc(var(--at, 0) * 100%); height: 4px; margin-top: -2px; border-radius: 2px; background: var(--lamp); }
.mine-label { position: absolute; right: 16px; top: calc(var(--at, 0) * 100%); transform: translateY(-50%); font-size: 11px; color: var(--lamp-text); white-space: nowrap; }
@media (orientation: landscape) {
  .win { width: auto; height: 100%; left: 50%; transform: translateX(-50%); }
  .study-screen.dim.windowed .study-layout { padding-bottom: 6vh; }
  .study-screen.dim.windowed .clock { font-size: min(12vw, 26vh); }
  .mine-strip { top: 8vh; bottom: 8vh; }
}

/* number styles for the study clock and desk clock (設定 → 桌鐘) */
.clock { color: var(--clock-color, var(--text)); }
.clock[data-style="round"] { font-family: var(--font); letter-spacing: 1px; }
.clock[data-style="thin"] { font-family: system-ui, "Roboto", "Noto Sans TC", sans-serif; font-weight: 200; letter-spacing: 0; }
.clock[data-style="mono"] { font-family: ui-monospace, "Roboto Mono", "Consolas", monospace; letter-spacing: 0; }
.clock[data-style="flip"] { font-family: var(--font); letter-spacing: 0; display: flex; justify-content: center; align-items: center; gap: .06em; }
.clock[data-style="flip"] .d { position: relative; background: #1F2433; border-radius: .14em; padding: .06em .14em; line-height: 1.1; }
.clock[data-style="flip"] .d::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: #000; }
.clock[data-style="flip"] .sep { opacity: .6; }
.clock-preview { background: #000; border-radius: 16px; padding: 22px 12px; display: grid; place-items: center; }
.clock-preview .clock { font-size: 52px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; padding: 0; border: 2px solid transparent; }
.swatch[aria-pressed="true"] { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.clock-colors { gap: 10px; }

/* 設定 → 提醒: checkbox, name and time on one line */
label.switch-row { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--text); }
label.switch-row > span { flex: 1; }
label.switch-row input[type="checkbox"] { width: 20px; height: 20px; flex: none; accent-color: var(--good); }
label.switch-row input[type="time"] { width: auto; flex: none; }

/* 設定: grouped lists like the phone's own settings; each row shows its value and opens its own page */
.set-group { display: grid; gap: 6px; }
.set-group > h2 { font-size: 13px; color: var(--sub); font-weight: 400; margin: 0 4px; }
.set-list { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; border: 0; border-radius: 0; background: none;
  padding: 14px 16px; text-align: left; font-size: 15px; color: var(--text); }
.set-row + .set-row { border-top: 1px solid var(--border); }
.set-row.static { cursor: default; }
.set-row.add { color: var(--info); }
.set-value { display: flex; align-items: center; gap: 8px; color: var(--sub); font-size: 14px; min-width: 0; text-align: right; }
.chev { color: var(--faint); font-size: 18px; line-height: 1; }

/* 紀錄 → the player card: who, a title from total depth, progress to the next layer, every number in one place */
.player { background: var(--surface); border-radius: 20px; padding: 18px 16px; display: grid; gap: 16px; }
.player-head { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; background: none; border: 0; padding: 0; }
.player-head .player-who { flex: 1; }
.tag.plan { background: var(--surface-3); color: var(--text); }
.player-allow { margin: 0; text-align: center; }
.player-who { display: grid; gap: 2px; min-width: 0; }
.player-who b { font-weight: 400; font-size: 19px; }
.player-depth { display: grid; gap: 6px; }
.player-depth .bigdepth { font-size: 44px; }
.player-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; padding-top: 14px; border-top: 1px solid var(--border); }
.player-stats .stat b { font-size: 20px; }

/* 設定 → 讀書時可以用的 App: icon, name and a check on the right */
.app-row img, .app-icon, .app-noicon { width: 32px; height: 32px; border-radius: 8px; flex: none; background: var(--surface-2); }
.app-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; }
.app-row[aria-checked="true"] .app-check { background: var(--good); border-color: var(--good); }
.app-row[aria-checked="true"] .app-check::after { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--bg); border-bottom: 2px solid var(--bg); transform: rotate(-45deg) translate(1px, -1px); }

/* 新手引導 → how it works: dots for where you are, one idea per page */
.tour-dots { display: flex; justify-content: center; gap: 6px; }
.tour-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--surface-3); }
.tour-dots i.on { width: 20px; border-radius: 4px; background: var(--text); }
.tour-icon { width: 76px; height: 76px; border-radius: 22px; background: var(--surface-2); display: grid; place-items: center; justify-self: center; color: var(--text); }
.tour-points { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; text-align: left; }
.tour-points li { background: var(--surface); border-radius: 14px; padding: 12px 14px; }
.onboard > h1 { text-align: center; }

/* 金塊: the counts on the home page, the gold page, and the lines on the end screen */
img.item { image-rendering: pixelated; flex: none; display: block; }
.gold-chips { display: flex; gap: 8px; }
.gold-chip { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--surface-3); font-family: var(--pixel); font-size: 19px; color: var(--sub); }
.gold-chip.flame.lit { color: #FF9600; background: #3D2610; border-color: #5A3818; }
.gold-chip.nugget { color: var(--gold); background: var(--gold-soft); border-color: #5A4A18; }
.gold-chip:active { transform: scale(0.96); }
.gold-head { display: grid; justify-items: center; gap: 6px; padding: 4px 0 8px; }
.gold-big { display: flex; align-items: center; gap: 10px; font-family: var(--pixel); font-size: 40px; line-height: 1; color: var(--lamp); }
.gold-big small { font-family: inherit; font-size: 16px; color: var(--sub); }
.gold-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; display: grid; gap: 12px; }
.streak-now { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 700; color: var(--sub); }
.streak-now.lit { color: var(--text); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-day { display: grid; justify-items: center; gap: 4px; font-size: 12px; color: var(--faint); }
.week-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; }
.week-day.on .week-dot { background: #3D2610; }
.week-day.frozen .week-dot { background: var(--info-soft); }
.week-day.today { color: var(--text); }
.week-day.today .week-dot { box-shadow: 0 0 0 2px var(--line-strong); }
.task { gap: 12px; }
.task-body { flex: 1; display: grid; gap: 6px; min-width: 0; }
.task-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.task-bar i { display: block; height: 100%; background: var(--lamp); border-radius: 3px; }
.task.done .task-body > span { color: var(--sub); }
.task.done .task-bar i { background: var(--good); }
.task-gold { font-family: var(--pixel); color: var(--lamp); font-size: 15px; }
.task.done .task-gold { color: var(--faint); }
.shop-row { gap: 12px; }
.shop-row .task-body { gap: 2px; }
.shop-row .task-body .sub { font-size: 12px; }
button.small { padding: 6px 12px; font-size: 14px; border-radius: 999px; flex: none; }
button.price { display: inline-flex; align-items: center; gap: 4px; font-family: var(--pixel); background: var(--surface-2); border-color: var(--surface-3); color: var(--lamp); }
button.price.armed { background: var(--lamp); border-color: var(--lamp); color: var(--on-lamp); font-family: inherit; }
button.price.off { color: var(--faint); }
.gold-log summary { font-size: 13px; color: var(--sub); margin: 0 4px 6px; cursor: pointer; }
.end-gold { display: flex; justify-content: center; align-items: center; gap: 6px; background: none; border: 0; padding: 2px 8px; font-family: var(--pixel); font-size: 18px; color: var(--lamp); }
.end-streak { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; display: grid; gap: 10px; justify-items: center; }
.shop-entry { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.shop-entry b { font-size: 17px; }
.shop-entry.ready { background: var(--gold-soft); border-color: #5A4A18; }
.shop-entry.ready .sub { color: var(--lamp); }
/* the top bar of a page one level down (金塊, 商店) */
.app-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 48px; margin-bottom: 4px; }
.app-bar h1 { margin: 0; font-size: 19px; text-align: center; }
.app-back { width: 44px; height: 44px; border-radius: 50%; padding: 0; display: grid; place-items: center; justify-self: start;
  background: var(--surface-2); border: 1px solid var(--surface-3); color: var(--text); }
.app-back:active { transform: scale(0.94); }
.app-bar-right { justify-self: end; }
.app-bar .gold-chip { height: 36px; font-size: 17px; }
#streak, #tasks { scroll-margin-top: 16px; }

/* 聚焦式教學 (coach.js): everything dims but the spotlight; the bear's line sits above or below it */
.coach { position: fixed; inset: 0; z-index: 900; }
.coach-hole { position: fixed; box-shadow: 0 0 0 200vmax rgba(5, 10, 13, 0.78); border: 2px solid var(--lamp); pointer-events: none;
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease; }
.coach-bubble { position: fixed; left: 16px; right: 16px; max-width: 420px; margin: 0 auto; background: var(--surface); border: 1px solid var(--surface-3);
  border-radius: 18px; padding: 14px 16px; display: grid; gap: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); transition: top .25s ease; }
.coach-head { display: flex; align-items: center; gap: 10px; font-size: 17px; }
.coach-bubble p { margin: 0; color: var(--sub); line-height: 1.6; }
.coach-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.coach-count { font-family: var(--pixel); color: var(--faint); }
.coach-foot button { padding: 8px 16px; }

/* Plus (pages/plus.js) */
.plus-cta { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 14px;
  background: var(--gold-soft); border: 1px solid #5A4A18; color: var(--sub); font-size: 13px; }
.plus-cta b { color: var(--lamp); font-size: 15px; flex: none; }
.plus-cta span:not(.chev) { flex: 1; }

/* 小白 page: the plan, the questions it waits on, one place to ask */
.plan-card { background: var(--surface); border-radius: 20px; padding: 16px; display: grid; gap: 12px; }
.plan-head { display: flex; justify-content: space-between; align-items: center; }
.plan-say { color: var(--text); }
.plan-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.plan-step { display: flex; gap: 10px; align-items: flex-start; }
.plan-text { display: grid; line-height: 1.4; }
.plan-mark { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--faint); display: grid; place-items: center; }
.plan-step[data-state="next"] .plan-mark { border-color: var(--lamp); background: radial-gradient(circle, var(--lamp) 0 4px, transparent 5px); }
.plan-step[data-state="done"] .plan-mark { border-color: var(--good); background: var(--good); }
.plan-step[data-state="done"] .plan-mark::after { content: ""; width: 4px; height: 8px; border: solid var(--bg); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.plan-step[data-state="done"] .plan-text > span:first-child { color: var(--sub); text-decoration: line-through; }
.plan-step[data-state="later"] .plan-text > span:first-child { color: var(--sub); }
.plan-done { color: var(--good); }
.plan-times { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.plan-times button { flex: 1; padding: 10px 0; }
.plan-times.small button { flex: none; padding: 4px 12px; font-size: 13px; border-radius: 999px; }
.plan-times button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.bear-composer input { flex: 1; min-width: 0; border: 0; background: none; padding: 8px 4px; }
.bear-composer input:focus { outline: none; }
.bear-composer button.icon-btn { flex: none; width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 50%; }
.bear-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rv-cards { display: flex; align-items: center; gap: 14px; background: var(--surface); border-radius: 18px; padding: 14px 16px; }
.rv-cards .primary { flex: none; }
.card-front, .card-back { background: var(--surface); border-radius: 20px; padding: 16px; display: grid; gap: 10px; }
.card-back { border: 2px solid var(--border); background: none; }
.card-q { font-size: 17px; }
.card-photo { border-radius: 12px; max-height: 40vh; object-fit: contain; background: var(--tile); }
.card-concept { color: var(--lamp-text); }
.card-answer { max-height: 38vh; overflow: auto; }
.card-grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; position: sticky; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
.card-grades button { display: grid; justify-items: center; gap: 0; padding: 10px 4px; border-radius: 16px; }
.card-grades button small { color: var(--sub); font-size: 12px; }
.card-grades [data-grade="forgot"] { background: var(--pink-soft); color: var(--pink); }
.card-grades [data-grade="good"] { background: var(--good-soft); color: var(--good); }
.study-mine { position: relative; border-radius: 18px; overflow: hidden; background: var(--surface); }
.study-mine canvas { display: block; width: 100%; height: 180px; object-fit: cover; object-position: center 24%; image-rendering: pixelated; }
.study-mine-label { position: absolute; left: 12px; bottom: 10px; display: flex; align-items: center; gap: 6px; background: color-mix(in srgb, var(--bg) 80%, transparent); padding: 3px 10px; border-radius: 999px; font-size: 14px; }
.study-mine-label .sub { margin-left: 4px; }
.study-plan .plan-say { font-size: 17px; }
.end-plan { width: 100%; display: grid; gap: 0; text-align: left; padding: 10px 14px; border-radius: 14px; background: var(--surface); }
.end-plan.done { color: var(--good); background: var(--good-soft); }

/* 首頁: big blocks, one thing and one action each */
.home-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.block { background: var(--surface); border: 0; border-radius: 22px; padding: 18px; display: grid; gap: 8px; align-content: start; text-align: left; color: var(--text); }
.block.big { gap: 10px; padding: 20px 18px 18px; }
.block-link { padding: 0; min-height: 0; color: var(--info); }
.block-title { font-size: 26px; line-height: 1.3; }
.block-why { color: var(--sub); }
.block-chain { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.block-chain li { padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--sub); }
.block-chain li + li::before { content: none; }
.block-chain li[data-state="next"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--lamp); }
.block-chain li[data-state="done"] { background: var(--good-soft); color: var(--good); }
.block-choices { display: flex; gap: 8px; }
.block-choices button { flex: 1; padding: 12px 0; font-size: 16px; border-radius: 14px; }
.block-choices button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.block-adjust { display: grid; gap: 6px; padding-top: 4px; }
.block-go { margin-top: 8px; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.block.tile { min-height: 132px; gap: 4px; }
.block.tile .icon { width: 26px; height: 26px; margin-bottom: 10px; color: var(--sub); }
.tile-num { font-size: 28px; line-height: 1; margin-bottom: 8px; color: var(--text); }
.tile-title { font-size: 17px; }
.block.line { grid-template-columns: 1fr auto; align-items: center; padding: 14px 18px; }
.line-main { display: grid; gap: 2px; font-size: 16px; }
.block.line .chev { color: var(--faint); font-size: 20px; }
.after { width: 100%; display: grid; gap: 10px; text-align: left; }
.after-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.after-choices .quiet { grid-column: 1 / -1; }
.mine-block { gap: 12px; }
.mine-block .study-mine { margin: -6px -6px 0; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 76px; }
.week-bar { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 4px; }
.week-bar i { align-self: end; width: 100%; max-width: 22px; border-radius: 6px; background: var(--surface-3); }
.week-bar.today i { background: var(--info); }
.week-bar span { font-size: 11px; color: var(--faint); }
.mine-block .study-mine canvas { object-position: center 16%; }
/* 首頁 in three levels: the page is grey, cards are white and stand on it (a pressed edge), and the one
   block that matters is solid sky */
.card, .block { border: 0; box-shadow: 0 3px 0 var(--edge); }
.block { background: var(--surface); }
.block.big { background: var(--lamp); color: #fff; box-shadow: 0 4px 0 var(--lamp-deep); }
.block.big .sub, .block.big .block-why, .block.big .block-link { color: rgba(255, 255, 255, .88); }
.block.big .block-link { font-weight: 500; }
.block-chain li { background: rgba(255, 255, 255, .2); color: #fff; }
.block-chain li[data-state="next"] { background: #fff; color: var(--lamp-deep); box-shadow: none; }
.block-chain li[data-state="done"] { background: rgba(255, 255, 255, .35); color: #fff; text-decoration: line-through; }
.block.big button.primary { background: #fff; border-color: #fff; color: var(--lamp-deep); box-shadow: 0 4px 0 rgba(0, 60, 100, .25); }
.block.big .block-choices button { background: rgba(255, 255, 255, .2); border-color: transparent; color: #fff; }
.block.big .block-choices button[aria-pressed="true"] { background: #fff; color: var(--lamp-deep); box-shadow: none; }
.block.big .block-adjust .quiet, .block.big .quiet { color: #fff; }
.block.tile { transition: transform .08s; }
.block.tile .icon { width: 48px !important; height: 48px !important; padding: 12px; border-radius: 16px; box-sizing: border-box; margin-bottom: 12px; }
.tiles .tile:nth-child(1) .icon { background: var(--pink-soft); color: var(--pink); }
.tiles .tile:nth-child(2) .icon { background: var(--gold-soft); color: var(--gold); }
.tiles .tile:nth-child(2) .tile-num { color: var(--gold); font-size: 34px; margin-bottom: 14px; }
.block.tile:active, .block.line:active { transform: translateY(2px); box-shadow: none; }
.week-bar i { background: var(--surface-2); }
.week-bar.today i { background: var(--lamp); }
.chip { border-color: var(--border); }
/* formulas (KaTeX): the text's size, and a block formula scrolls sideways on its own instead of the page */
.katex { font-size: 1.08em; }
.math-block { display: block; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.math-block .katex-display { margin: 0; }
.katex .katex-error, .katex-error { color: var(--pink); }
.math-nb { white-space: nowrap; }
.memory-row > span { flex: 1; text-align: left; }
.memory-row button { color: var(--faint); padding: 6px; }
.line.me .work-photo { display: block; max-width: 220px; max-height: 260px; border-radius: 10px; margin-bottom: 6px; background: var(--tile); }
/* 小白考你一題: the check question, set apart from the chat in the brand colour */
.check-card { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--lamp-soft); border: 2px solid var(--lamp); }
.check-label { display: flex; justify-content: space-between; align-items: baseline; color: var(--lamp-text); font-weight: 500; }
.check-q { font-size: 16px; }
/* a printed question's marks (ui.js marks()): underline, wavy underline, boxed characters, numbered blanks,
   a quote's source, and 注音 in a column right of its character with the tone mark beside it */
.m-u { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.m-w { padding-bottom: 5px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 3.5 Q2 0.5 4 3.5 T8 3.5' fill='none' stroke='%239DB0BC' stroke-width='1.3'/%3E%3C/svg%3E") repeat-x left bottom; }
.m-box { border: 1.5px solid currentColor; border-radius: 3px; padding: 0 2px; }
.blank { display: inline-block; min-width: 3.2em; margin: 0 3px; padding: 0 6px; border-bottom: 2px solid var(--sub); text-align: center; font-size: .85em; color: var(--sub); line-height: 1.3; }
.blank.on { border-color: var(--lamp); color: var(--lamp-text); background: var(--lamp-soft); border-radius: 6px 6px 0 0; }
p.src { text-align: right; color: var(--sub); font-size: .92em; }
.zy { display: inline-flex; align-items: center; vertical-align: middle; margin-right: 1px; }
.zy-r { position: relative; display: inline-flex; align-items: center; margin-left: 1px; font-family: "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", sans-serif; }
.zy-b { display: inline-flex; flex-direction: column; font-size: .42em; line-height: 1.08; }
.zy-b i { font-style: normal; }
.zy-t { font-weight: 400; font-size: .42em; align-self: flex-end; margin-left: 1px; margin-bottom: .25em; }
.zy-l { position: absolute; top: -.55em; left: 0; width: .42em; text-align: center; font-weight: 400; font-size: 1em; line-height: 1; }
/* 題目本身 (doc.js), laid out like a school test sheet (校用卷): white paper, a serif (Study Serif: Noto Serif TC),
   (　) and the number on the left, options by length, a 題組 opened by ㈠, 注釋 in a small box with a book mark */
.paper {
  --text: #111; --sub: #444; --faint: #777; --border: #bbb; --surface: #fff; --surface-2: #f3f3f3; --surface-3: #e6e6e6; --bg: #fff;
  --lamp: #1182B8; --lamp-soft: #DDF1FB; --lamp-text: #0B5E86; --info: #0B5E86; --good: #2E7D32; --pink: #C2185B;
  color-scheme: light; background: #fff; color: #111; border-radius: 6px; padding: 16px 16px 18px;
  font-family: var(--serif);
  font-size: 16px; line-height: 1.8;
}
.doc { display: grid; gap: 12px; }
.doc-text p { margin: 0; } .doc-text p + p { margin-top: 2px; }
.doc-q { display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: 2px; align-items: start; }
.doc-paren { white-space: pre; padding-right: 2px; }
.doc-no { text-align: left; }
.doc-body { display: grid; gap: 6px; min-width: 0; }
.doc-options { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 2px 12px; }
.doc-options.row { display: flex; flex-wrap: wrap; column-gap: 1.6em; }
.doc-options.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.doc-options li { display: flex; align-items: baseline; min-width: 0; }
.doc-options li .doc-text { min-width: 0; }
.doc-letter { flex: none; }
.doc-fig { margin: 6px 0 2px; display: grid; justify-items: center; gap: 2px; }
.paper .fig { padding: 0; }
.print-page .doc-fig figcaption { font-size: 11.5px; }
.doc-fig figcaption { font-size: 14px; }
.doc-crop { max-width: 100%; max-height: 50vh; }
details.doc-group { display: grid; gap: 6px; }
details.doc-group > summary { font-size: 15px; }
.doc-passage { display: grid; gap: 4px; }
.doc-group.sheet { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 2px; }
.doc-gbody { display: grid; gap: 4px; min-width: 0; }
.doc-passage .doc-fig { text-indent: 0; }
.doc-notes { justify-self: end; margin-top: 6px; border: 1px solid #111; padding: 4px 10px; font-size: 14px; line-height: 1.6; display: grid; max-width: 100%; }
.doc-book { display: block; line-height: 0; margin-bottom: 2px; }
.doc-note-ref { font-size: .6em; vertical-align: .5em; line-height: 0; }
.paper .blank { color: #111; border-bottom-color: #111; }
.paper .blank.on { background: #DDF1FB; color: #0B5E86; border-bottom-color: #0B5E86; }
.paper .m-w { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 3.5 Q2 0.5 4 3.5 T8 3.5' fill='none' stroke='%23111' stroke-width='1.2'/%3E%3C/svg%3E"); }
.paper p.src { color: #111; }
.scan-wait { display: grid; justify-items: center; gap: 8px; padding: 40px 0; text-align: center; }
.scan-q, .scan-group { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: grid; gap: 10px; box-shadow: 0 3px 0 var(--edge); }
.scan-q[data-on="false"] { opacity: .5; }
.scan-pick { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.scan-pick input { width: 20px; height: 20px; accent-color: var(--lamp); }
.scan-fix { justify-self: start; padding-inline: 0; font-size: 13px; }
.scan-edit { min-height: 160px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.scan-unsure { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); font-size: 13px; }
.scan-bang { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: var(--gold-soft); display: grid; place-items: center; font-size: 12px; margin-top: 1px; }
.scan-actions { display: grid; gap: 6px; position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--bg); border-top: 1px solid var(--border); }
.scan-actions .row { justify-content: center; }
.qdoc { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
details.doc-group > summary { list-style: none; display: flex; justify-content: space-between; gap: 8px; }
details.doc-group > summary::-webkit-details-marker { display: none; }
details.doc-group > summary::after { content: "收起"; color: var(--info); font-size: 13px; flex: none; }
details.doc-group:not([open]) > summary::after { content: "展開"; }
.doc-stem { display: flex; gap: 6px; align-items: baseline; }
.doc-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.scan-group details.doc-group { background: none; padding: 0; }
/* printed sheets use the exam face too, and a question kept as text sits on the page without its own card */
.print-page { font-family: var(--serif); }
.print-page .paper { padding: 0; border-radius: 0; font-size: 13.5px; line-height: 1.7; }
.print-page .paper .doc-crop { max-height: 220px; }
.print-page .paper .fig-svg { max-width: 240px; }
.qdoc > *, .scan-q > *, .scan-group > *, .card-q > *, .doc-body > *, .doc-passage > * { min-width: 0; }
.paper { max-width: 100%; overflow-wrap: anywhere; }
/* on paper: no screen controls, no colour */
.print-page details.doc-group > summary::after { content: none; }
.print-page .paper .blank.on { background: none; color: #111; border-bottom-color: #111; }
.print-q.sheet { display: block; }
.print-q.sheet + .print-q.sheet { margin-top: 8px; }
.print-foot { position: relative; }
.print-turn { position: absolute; right: 0; bottom: -2px; border: 1px solid #111; padding: 1px 10px; font-weight: 400; color: #111; font-size: 12px; letter-spacing: 2px; }
/* A4 is wider than a phone: options that fit share a line, as 題本 set them */
.print-page .paper .doc-options.grid { display: flex; flex-wrap: wrap; column-gap: 2.6em; }
/* the exam as a school test sheet (校用卷): a header box, two columns with a rule between, bold 黑體 headings */
.print-page.sheet { padding: 30px 36px 24px; }
/* the rule between the columns is drawn as a background: html2canvas doesn't draw column-rule */
.print-page.sheet .print-body { display: block; column-count: 2; column-gap: 30px; column-fill: auto; height: 100%;
  background: linear-gradient(#111, #111) center / 1px 100% no-repeat; }
.print-page.sheet .print-q.sheet { break-inside: avoid; margin: 0 0 18px; }
.print-page.sheet .paper { font-size: 13.5px; line-height: 1.95; }
.print-page.sheet .doc-no { font-weight: 700; padding-right: 2px; }
/* stem, options and a figure beside them flow as one block, so the figure can sit at the right of the text */
.print-page.sheet .doc-body { display: flow-root; }
.print-page.sheet .doc-body > .doc { display: block; }
.print-page.sheet .doc-body > * + *, .print-page.sheet .doc-body > .doc > * + * { margin-top: 2px; }
.print-page.sheet .sheet-fig { float: right; width: 40%; margin: 4px 0 4px 10px; }
.print-page.sheet .doc-body .fig:not(.sheet-fig) .fig-svg, .print-page.sheet .doc-fig:not(.sheet-fig) .doc-crop { max-width: 60%; max-height: 150px; }
.print-page.sheet .doc-body .sheet-fig .fig-svg, .print-page.sheet .doc-body .sheet-fig .doc-crop { max-width: 100%; max-height: 160px; }
.print-page.sheet .doc-fig figcaption { font-size: 11px; }
.print-page.sheet .doc-options { margin-top: 2px; row-gap: 0; }
.print-page.sheet .doc-options.row { display: grid; grid-template-columns: repeat(4, 1fr); }
.print-page.sheet .doc-options.grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 8px; }
.print-page.sheet .print-blank { margin-top: 4px; }
.print-page.sheet.d1 .paper { font-size: 13px; line-height: 1.8; }
.print-page.sheet.d1 .print-q.sheet { margin-bottom: 13px; }
.print-page.sheet.d2 .paper { font-size: 12.5px; line-height: 1.65; }
.print-page.sheet.d2 .print-q.sheet { margin-bottom: 9px; }
.print-page.sheet.d3 .paper { font-size: 12px; line-height: 1.5; }
.print-page.sheet.d3 .print-q.sheet { margin-bottom: 6px; }
.print-page.sheet .fig-svg, .print-page.sheet .doc-crop { max-width: 100%; max-height: 190px; }
.print-page.sheet .print-photo { max-height: 200px; }
.sheet-head { display: grid; grid-template-columns: 1fr auto auto; border: 1.5px solid #111; margin-bottom: 4px; font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif; }
.sheet-title { font-size: 26px; font-weight: 700; padding: 8px 16px; align-self: center; letter-spacing: 1px; }
.sheet-range { display: grid; grid-template-columns: auto auto; align-items: center; border-left: 1px dashed #111; font-size: 13px; text-align: center; }
.sheet-range-label { writing-mode: vertical-rl; letter-spacing: 4px; padding: 4px; border-right: 1px dashed #111; height: 100%; display: grid; place-items: center; font-size: 11px; }
.sheet-range > div { padding: 4px 14px; font-weight: 700; }
.sheet-who { display: grid; gap: 6px; align-content: center; padding: 6px 14px; border-left: 1px dashed #111; font-size: 12px; }
.sheet-score { font-size: 13.5px; font-family: var(--serif); }
.sheet-range > div { font-size: 15px; padding-inline: 28px; }
/* a 填充題's blank in the sentence (ui.js md): a line to write on */
.fill-blank { display: inline-block; min-width: 4.5em; height: 1.1em; margin: 0 .1em; border-bottom: 1px solid currentColor; vertical-align: -0.25em; }
.fill-blank.long { min-width: 9em; }
.fill-at { white-space: nowrap; }
h3.sheet-section { margin: 2px 0 4px; font-size: 14px; font-weight: 700; font-family: "Microsoft JhengHei", "Noto Sans TC", sans-serif; break-after: avoid; }
/* 單元考卷: the units to pick from, and 你之前也錯過 under a wrong answer */
.unit-list { display: grid; gap: 6px; }
button.unit-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 2px solid transparent; box-shadow: 0 2px 0 var(--edge); }
button.unit-row[aria-pressed="true"] { background: var(--lamp-soft); border-color: var(--lamp); }
.unit-name { color: var(--text); }
.ex-before { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: var(--pink-soft); margin-top: 6px; }
.ex-before p { margin: 0 0 6px; color: var(--text); }
.ex-before-list { display: flex; flex-wrap: wrap; gap: 6px; }
.print-blank { margin-top: 4px; }

/* 岩石煉製 prototype */
.craft-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.craft-chip { padding: 10px 14px; border-radius: 12px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; box-shadow: 0 3px 0 var(--edge); position: relative; transition: transform .08s; }
.craft-chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.craft-chip.on { border-color: var(--line-strong); background: var(--surface-3); }
.craft-chip.new { border-color: var(--gold); animation: craft-in .45s cubic-bezier(.2,1.6,.4,1); }
.craft-chip.new::after { content: ""; position: absolute; top: -5px; right: -5px; width: 10px; height: 10px; background: var(--gold); border-radius: 2px; }
.craft-bar { height: 8px; background: var(--surface-2); border-radius: 4px; margin: 10px 0 12px; overflow: hidden; }
.craft-bar span { display: block; height: 100%; background: var(--good); border-radius: 4px; transform-origin: left; animation: craft-fill .6s ease-out; }
.craft-rocks { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.craft-rock { padding: 4px 10px; border-radius: 8px; border: 2px dashed var(--border); color: var(--faint); font-size: 14px; }
.craft-rock.got { border: 2px solid var(--gold); color: var(--gold); background: var(--gold-soft); }
.craft-stage { position: relative; min-height: 130px; margin-top: 4px; }
.craft-stage.no { animation: craft-nope .3s; }
.craft-eq { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 12px; }
.craft-op { color: var(--sub); }
.craft-slot { min-width: 64px; padding: 10px 8px; text-align: center; border-radius: 10px; border: 2px dashed var(--border); color: var(--faint); min-height: 24px; }
.craft-slot.full { border: 2px solid var(--border); color: var(--text); background: var(--surface-2); }
.craft-slot.pop { border-color: var(--gold); background: var(--gold-soft); color: var(--gold); animation: craft-pop .5s cubic-bezier(.2,1.8,.4,1); }
.craft-note { text-align: center; line-height: 1.5; min-height: 3em; }
.craft-combo { display: block; text-align: center; color: var(--gold); margin-top: 6px; font-size: 14px; animation: craft-in .35s cubic-bezier(.2,1.6,.4,1); }
.craft-bit { position: absolute; left: 50%; top: 38px; width: 8px; height: 8px; pointer-events: none; animation: craft-bit .75s ease-out forwards; }
.craft-shake { animation: craft-nope .35s; }
@keyframes craft-in { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes craft-pop { 0% { transform: scale(.3); } 100% { transform: scale(1); } }
@keyframes craft-fill { from { transform: scaleX(.85); } to { transform: scaleX(1); } }
@keyframes craft-nope { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes craft-bit { from { transform: translate(-50%, 0) rotate(0); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), var(--dy)) rotate(var(--r)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .craft-chip.new, .craft-slot.pop, .craft-combo, .craft-stage.no, .craft-shake, .craft-bar span { animation: none; } }

/* 規劃 / 成績 / 小白: one row of a list (a test, a score, a conversation) */
.test-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 0.5px solid var(--border); width: 100%; background: none; text-align: left; color: var(--text); }
.test-row:first-child { border-top: 0; }
.test-row .title { min-width: 0; overflow-wrap: anywhere; font-size: 16px; }
button.test-row.link { border-radius: 0; min-height: 0; }
.test-row .chev { color: var(--sub); }
.test-row .go { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
button.test-row { border: 0; border-top: 0.5px solid var(--border); background: none; border-radius: 0; box-shadow: none; padding: 12px 0; }
button.test-row:first-child { border-top: 0; }
/* the box to write in stays above the tab bar on the pages that have one (小白) */
body:not(.bare) .composer { bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom, 0px)); }

/* 測驗卡: the card is the page. Paper-coloured, the question set in the serif, tap to turn it over. Inside the card the
   colour words are re-pointed at ink on paper, so what rich() draws (math, figures) reads dark on light. */
.flash-top { display: flex; justify-content: space-between; align-items: center; }
.flash-progress { display: flex; gap: 4px; }
.flash-progress i { width: 18px; height: 4px; border-radius: 2px; background: var(--surface-2); }
.flash-progress i.done { background: var(--sub); }
.flash-progress i.on { background: var(--text); }
.flash-bar { width: 120px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.flash-bar i { display: block; height: 100%; background: var(--text); }
.flash {
  --text: #22201C; --sub: #6F6A5E; --faint: #A39E90; --border: #DDD7C8; --info: #1182B8; --lamp-text: #1182B8;
  background: #F4F1E8; color: var(--text); border-radius: 18px; padding: 18px 18px 14px; width: 100%; border: 0; text-align: left;
  min-height: calc(100dvh - 230px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 12px; cursor: pointer; animation: flash-in .22s ease-out;
}
.flash.back { cursor: default; }
.flash-label { font-size: 12px; color: var(--sub); }
.flash-front { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.flash-q { font-family: var(--serif); font-size: 22px; line-height: 1.75; text-align: center; overflow-wrap: anywhere; }
.flash-q-small { font-family: var(--serif); font-size: 15px; line-height: 1.6; color: var(--sub); }
.flash-photo { max-width: 100%; max-height: 50vh; border-radius: 8px; align-self: center; }
.flash-hint { font-size: 12px; color: var(--faint); text-align: center; }
.flash-line { height: 1px; background: var(--border); }
.flash-concept { font-size: 13px; color: var(--sub); }
.flash-a { font-family: var(--serif); font-size: 18px; line-height: 1.8; flex: 1; overflow-wrap: anywhere; }
.flash-more { background: none; border: 0; padding: 0; color: var(--info); font-size: 13px; align-self: flex-start; }
.flash-grades { display: flex; border-top: 0.5px solid var(--border); }
.flash-grades button { flex: 1; background: none; border: 0; border-radius: 0; padding: 12px 0 2px; display: grid; gap: 2px; justify-items: center; color: var(--text); font-size: 16px; }
.flash-grades button + button { border-left: 0.5px solid var(--border); }
.flash-grades button small { font-size: 11px; color: var(--faint); }
.flash-grades button[data-grade="good"] span { color: var(--good); }
.flash-done { display: grid; gap: 12px; padding-top: 18vh; }
@keyframes flash-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .flash { animation: none; } }

/* 複習 page, plainer: subject tabs as underlined words, the day's cards as a number, the 錯題本 as the questions
   themselves in the serif (two lines at most), lines for the rest. No boxes around each part. */
.rv-tabs { gap: 20px; border-bottom: 0.5px solid var(--border); padding-bottom: 0; }
.rv-tab { border: 0; border-radius: 0; padding: 4px 0 10px; background: none; color: var(--faint); font-size: 15px; border-bottom: 2px solid transparent; }
.rv-tab[aria-selected="true"] { background: none; color: var(--text); border-bottom-color: var(--text); }
.rv-cards { background: none; padding: 0; justify-content: space-between; }
.rv-cards-n { font-size: 15px; color: var(--sub); }
.rv-cards-n b { font-size: 38px; font-weight: 500; color: var(--text); line-height: 1; margin-right: 2px; }
.rv-start { background: var(--text); color: var(--bg); border: 0; border-radius: 999px; padding: 10px 22px; font-size: 15px; flex: none; }
.rv-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; background: none; border: 0; border-radius: 0;
  border-top: 0.5px solid var(--border); border-bottom: 0.5px solid var(--border); padding: 14px 0; text-align: left; color: var(--text); }
.rv-line > span:first-child { display: grid; gap: 2px; }
.rv-line b { font-weight: 500; font-size: 16px; }
.rv-line:disabled { opacity: .55; }
.rv-chev { color: var(--faint); font-size: 18px; }
.rv-book-head .section-head { align-items: baseline; }
.rv-filter { display: flex; gap: 14px; }
.rv-filter button { background: none; border: 0; padding: 2px 0; font-size: 13px; color: var(--faint); }
.rv-filter button[aria-selected="true"] { color: var(--text); }
.rv-book-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rv-list { list-style: none; margin: 0; padding: 0; border-top: 0.5px solid var(--border); }
.rv-row { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; border-radius: 0; border-bottom: 0.5px solid var(--border);
  padding: 13px 0; text-align: left; color: var(--text); }
.rv-row-main { flex: 1; min-width: 0; display: grid; gap: 4px; }
.rv-row-text { font-family: var(--serif); font-size: 16px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rv-row-text p { margin: 0; display: inline; }
.rv-row-text figure, .rv-row-text svg, .rv-row-text img, .rv-row-text canvas, .rv-row-text table { display: none; }
.rv-row-meta { font-size: 12px; color: var(--faint); display: flex; gap: 8px; }
.rv-row-status.open { color: var(--pink); }
.rv-row-status.got { color: var(--good); }
.rv-row-photo { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; flex: none; }

/* 測驗卡, refined: the cards still to come peek out underneath, the subject as a tinted label, the page count in the
   pixel figures, and the back marked like a paper: 解 in red pen, the answer's bold words underlined in red. */
.flash-count { font-size: 13px; color: var(--sub); letter-spacing: 1px; }
.flash-stack { position: relative; display: flex; min-height: calc(100dvh - 250px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); }
.flash-stack.n1 { margin-bottom: 9px; }
.flash-stack.n2 { margin-bottom: 18px; }
.flash-under { position: absolute; left: 10px; right: 10px; top: 10px; bottom: -9px; background: #DED8C8; border-radius: 20px; }
.flash-under.far { left: 20px; right: 20px; top: 20px; bottom: -18px; background: #C9C2B0; }
.flash { position: relative; z-index: 1; flex: 1; min-height: 0; background: #F6F2E7; border-radius: 20px; box-shadow: 0 10px 28px rgba(0, 0, 0, .35); }
.flash-head { display: flex; align-items: center; gap: 8px; }
.flash-tag { --c: #8E95A8; background: color-mix(in srgb, var(--c) 32%, #F6F2E7); color: color-mix(in srgb, var(--c) 40%, #1D1B17); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; }
.flash-topic { font-size: 12px; color: var(--sub); }
.flash-q { font-size: 25px; line-height: 1.65; }
.flash-hint { display: flex; align-items: center; justify-content: center; gap: 6px; }
.flash-hint .icon { width: 14px; height: 14px; }
.flash-solve { display: flex; align-items: center; gap: 8px; }
.flash-mark { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #C8423A; color: #C8423A; font-family: var(--serif); font-size: 13px; display: grid; place-items: center; flex: none; }
.flash-solve .flash-concept { font-size: 12px; color: var(--sub); }
.flash-a { padding-left: 32px; font-size: 18px; line-height: 1.9; }
.flash-a strong, .flash-a b { color: #C8423A; font-weight: 500; box-shadow: inset 0 -1.5px #C8423A; }
.flash-grades { gap: 6px; background: var(--surface); border-radius: 16px; padding: 5px; border-top: 0; }
.flash-grades button { border-radius: 12px; padding: 9px 0; }
.flash-grades button + button { border-left: 0; }
.flash-grades button[data-grade="good"] { background: var(--good-soft); }
.flash-grades button[data-grade="good"] span { color: #7BDB3A; font-weight: 500; }
.flash-grades button[data-grade="good"] small { color: #8FB878; }

/* 複習, refined: the cards as a little pile of paper, the 錯題本 in one grouped panel with each subject's colour as a
   thin bar, and the single lines (先補, 出考卷) as small panels too. */
.rv-cards { background: var(--surface); border-radius: 18px; padding: 16px; gap: 14px; }
.rv-cards .primary { flex: none; }
.rv-cards-n { font-size: 15px; color: var(--text); }
.rv-cards-n b { font-size: 34px; }
.rv-pile { position: relative; width: 62px; height: 70px; flex: none; }
.rv-pile i { position: absolute; left: 13px; top: 2px; width: 44px; height: 58px; border-radius: 7px; background: #C9C2B0; transform: rotate(12deg); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.rv-pile i:nth-child(2) { left: 9px; top: 5px; background: #DED8C8; transform: rotate(4deg); }
.rv-pile i:nth-child(3) { left: 4px; top: 9px; background: #F6F2E7; transform: rotate(-7deg); display: grid; place-items: center; font-style: normal; font-family: var(--serif); font-size: 18px; color: #22201C; }
.rv-list { background: var(--surface); border-radius: 16px; border-top: 0; padding: 0 14px; }
.rv-list li:last-child .rv-row { border-bottom: 0; }
.rv-row { gap: 10px; align-items: stretch; }
.rv-row::before { content: ""; width: 3px; border-radius: 2px; background: var(--c, var(--faint)); flex: none; }
.rv-row-text { font-size: 15px; }
.rv-line { background: var(--surface); border: 0; border-radius: 16px; padding: 13px 14px; justify-content: flex-start; }
.rv-line > .icon { color: var(--info); flex: none; }
.rv-line > span:nth-child(2) { display: grid; gap: 2px; }

/* ---------- 題目頁: the question on paper, the bear's lines plain, one pill to talk in ---------- */
.qtop { gap: 6px; padding-bottom: 8px; }
.qmeta { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qmeta .dot { width: 7px; height: 7px; flex: none; }
.qstatus { font-size: 13px; color: var(--pink); flex: none; }
.qstatus.got { color: var(--good); }
.qpaper {
  --text: #22201C; --sub: #6F6A5E; --faint: #A39E90; --border: #DDD7C8; --info: #1182B8; --lamp-text: #1182B8;
  background: #F6F2E7; color: var(--text); border-radius: 16px; padding: 16px 16px 10px; display: grid; gap: 10px; margin-bottom: 4px;
}
.qpaper-q { font-family: var(--serif); font-size: 19px; line-height: 1.65; overflow-wrap: anywhere; }
.qpaper-doc { font-family: var(--serif); font-size: 17px; line-height: 1.7; display: grid; gap: 8px; }
.qpaper-doc > * { min-width: 0; }
.qpaper-wait { color: var(--sub); }
.qpaper .qphoto { border: 0; background: #ECE7D9; max-height: 50vh; }
.qpaper-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--faint); }
.qpaper-foot button { all: unset; cursor: pointer; color: var(--faint); font-size: 12px; padding: 4px 0; }
.line.me { border-radius: 16px 16px 4px 16px; padding: 8px 13px; }
.line.bear { background: none; border: 0; padding: 0 0 0 34px; position: relative; }
.line.bear:has(.name) { margin-top: 2px; }
.line.bear .face { position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 8px; background: var(--surface); display: grid; place-items: center; overflow: hidden; }
.line.bear .name { position: static; display: block; background: none; padding: 0; font-family: inherit; font-size: 12px; line-height: 1.4; letter-spacing: 0; color: var(--sub); margin-bottom: 4px; }
.line-body { display: grid; gap: 6px; min-width: 0; }
.line.bear.solved .flash-mark { border-color: #E0675E; color: #E0675E; }
.line.bear.solved .said { font-family: var(--serif); font-size: 17px; line-height: 1.85; }
.line.bear.solved strong, .line.bear.solved b { color: #E0675E; text-decoration: underline 1.5px; text-underline-offset: 5px; }
.q-actions { display: flex; align-items: center; gap: 6px; }
.q-actions .chip { white-space: nowrap; }
.q-actions .chip.got { margin-left: auto; color: var(--good); background: var(--good-soft); border-color: transparent; }
.ask.pill { align-items: center; gap: 6px; background: var(--surface); border-radius: 999px; padding: 4px 4px 4px 6px; }
.ask.pill input { background: none; border: 0; box-shadow: none; padding: 0 4px; height: 40px; border-radius: 0; }
.ask.pill input:focus { outline: none; }
.ask.pill:focus-within { box-shadow: 0 0 0 1.5px var(--info); }
.pill-cam { all: unset; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; color: var(--sub); border-radius: 50%; flex: none; }
.pill-send { all: unset; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--border); color: var(--sub); flex: none; transition: background .15s, color .15s; }
.pill-send.ready { background: var(--info); color: var(--bg); }
.pill-cam:disabled, .pill-send:disabled { opacity: .45; cursor: default; }

/* ---------- 首頁: the mine as the one big thing, today as one list, the week as a line ---------- */
.home-top { align-items: flex-end; }
.home-top .gold-chips { gap: 4px; }
.home-top .gold-chip { height: 32px; padding: 0 6px; gap: 4px; background: none !important; border: 0; font-family: var(--pixel); font-size: 15px; color: var(--text); }
.home-top .gold-chip.flame.lit { color: #FF9F43; }
.home-top .gold-chip.nugget { color: var(--gold); }
.home-top .gold-chip .pixel-img, .home-top .gold-chip img { width: 20px !important; height: 20px !important; }
.home-nudge { all: unset; box-sizing: border-box; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; width: 100%; font-size: 14px; color: var(--pink); padding: 2px 2px; }
.home-nudge.plain { color: var(--sub); }
.home-hero { background: var(--surface); border-radius: 18px; overflow: hidden; display: grid; }
.home-mine { all: unset; cursor: pointer; display: block; }
.home-mine canvas { display: block; width: 100%; height: 132px; object-fit: cover; object-position: center 16%; image-rendering: pixelated; }
.home-hero-body { padding: 13px 14px 14px; display: grid; gap: 10px; }
.home-mine-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 15px; }
.home-mine-name .dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; vertical-align: 2px; }
.home-mine-name .pixel { font-size: 12px; color: var(--sub); }
.home-plan-title { font-size: 20px; line-height: 1.35; margin: 0; }
.home-hero .block-chain li { background: var(--surface-2); color: var(--sub); }
.home-hero .block-chain li[data-state="next"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--info); }
.home-hero .block-chain li[data-state="done"] { background: var(--good-soft); color: var(--good); text-decoration: line-through; }
.home-times { display: flex; justify-content: center; align-items: center; gap: 4px; font-size: 13px; color: var(--sub); }
.home-times > span { margin-right: 6px; }
.home-times button { all: unset; cursor: pointer; padding: 6px 9px; border-radius: 8px; color: var(--text); font-size: 13px; }
.home-times button[aria-pressed="true"] { background: var(--surface-3); }
.home-today { gap: 8px; }
.home-label { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; font-size: 13px; color: var(--sub); }
.home-label .pixel { font-size: 12px; }
.home-list { background: var(--surface); border-radius: 16px; overflow: hidden; }
.home-list > * + * { border-top: 0.5px solid var(--border); }
.home-row { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 11px; padding: 13px 14px; font-size: 15px; color: var(--text); }
.home-row .sub { font-size: 12px; }
.home-row .chev { margin-left: auto; color: var(--faint); }
.home-row.add { color: var(--sub); }
.home-lead { width: 24px; height: 26px; flex: none; display: grid; place-items: center; position: relative; }
.home-row-main .pixel { font-size: 15px; }
.mini-pile i { position: absolute; width: 15px; height: 20px; border-radius: 3px; left: 6px; top: 1px; background: #C9C2B0; transform: rotate(10deg); }
.mini-pile i + i { left: 2px; top: 4px; background: #F6F2E7; transform: rotate(-6deg); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.mini-bear { background: var(--surface-3); border-radius: 7px; width: 24px; height: 24px; overflow: hidden; }
.home-list .todo { background: none; border: 0; border-radius: 0; padding: 9px 10px 9px 14px; }
.home-week { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 4px 2px 8px; }
.home-week > span:first-child { display: grid; gap: 2px; }
.home-week .pixel { font-size: 15px; }
.home-week-bars { display: flex; align-items: flex-end; gap: 5px; height: 34px; }
.home-week-bars i { width: 8px; border-radius: 2px; background: var(--surface-2); }
.home-week-bars i.today { background: var(--info); }

/* ---------- 小白: the bear on a strip of ground, the talk left half-way, the talks by day ---------- */
.chat-hello { display: flex; align-items: flex-end; gap: 14px; padding: 8px 2px 4px; }
.chat-hello h1 { font-size: 22px; margin: 0; }
.chat-hello .sub { margin: 2px 0 6px; }
.chat-bear { display: grid; justify-items: center; width: 72px; flex: none; }
.chat-bear::after { content: ""; width: 72px; height: 6px; background: #3E6B4A; box-shadow: inset 0 -2px #2E5238; margin-top: -2px; }
.chat-resume { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; gap: 6px; background: var(--surface); border-radius: 16px; padding: 13px 14px; }
.chat-resume-head, .chat-resume-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--sub); }
.chat-resume-q { font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chat-resume-foot .sub { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-resume-go { color: var(--info); font-size: 13px; flex: none; }
.serif { font-family: var(--serif); }
.chat-group { gap: 6px; }
.chat-group > .sub { font-size: 12px; padding: 0 2px; }
.chat-row-text { display: block; font-size: 15px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-row { display: flex; align-items: center; gap: 8px; }
.ask-row .ask.pill { flex: 1; min-width: 0; padding-left: 14px; }
.big-cam { all: unset; cursor: pointer; width: 46px; height: 46px; border-radius: 50%; background: var(--surface-3); color: var(--info); display: grid; place-items: center; flex: none; }
.big-cam:disabled { opacity: .45; }
.chat-body { display: grid; gap: 18px; align-content: start; }

/* ---------- 規劃: two weeks at a glance, the 聯絡簿 on paper, tests by date like the 聯絡簿, scores as small lines ---------- */
.plan-head { display: flex; justify-content: space-between; align-items: baseline; }
.plan-head h1 { margin: 0; }
.fortnight { display: grid; grid-template-columns: repeat(14, 1fr); gap: 2px; }
.fortnight-day { display: grid; justify-items: center; gap: 3px; font-size: 11px; color: var(--faint); }
.fortnight-day b { font-weight: 400; font-size: 12px; color: var(--text); min-width: 20px; text-align: center; line-height: 20px; border-radius: 6px; }
.fortnight-day.today b { background: var(--info); color: var(--bg); }
.fortnight-dots { display: flex; gap: 2px; height: 5px; }
.fortnight-dots i { width: 5px; height: 5px; border-radius: 50%; }
.plan-paper { display: flex; align-items: center; gap: 8px; background: #F6F2E7; color: #22201C; border-radius: 16px; padding: 4px 6px 4px 4px; }
.plan-paper button { all: unset; cursor: pointer; box-sizing: border-box; }
.plan-paper .plan-paper-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 10px; }
.plan-paper-icon { width: 36px; height: 36px; border-radius: 10px; background: #E6DFCB; color: #6F6A5E; display: grid; place-items: center; flex: none; }
.plan-paper-title { display: block; font-size: 15px; }
.plan-paper-sub { display: block; font-size: 12px; color: #6F6A5E; }
.plan-paper .plan-paper-add { flex: none; font-size: 13px; color: #6F6A5E; padding: 10px 8px; }
.plan-edit { background: var(--surface); border-radius: 16px; padding: 14px; }
.plan-group { gap: 6px; }
.plan-group > .sub, .plan-group-head .sub { font-size: 12px; padding: 0 2px; }
.plan-group-head { display: flex; justify-content: space-between; align-items: baseline; }
.plan-link { all: unset; cursor: pointer; font-size: 12px; color: var(--info); padding: 2px; }
.plan-dates { background: var(--surface); border-radius: 16px; overflow: hidden; }
.plan-date + .plan-date { border-top: 0.5px solid var(--border); }
.plan-date-head { font-size: 12px; color: var(--sub); padding: 10px 14px 0; }
.plan-date-head .pixel { color: var(--text); }
.plan-list { list-style: none; margin: 0; padding: 0 14px; }
.plan-list li:last-child .rv-row { border-bottom: 0; }
.plan-row .rv-row-main { all: unset; cursor: pointer; flex: 1; min-width: 0; display: grid; gap: 3px; }
.plan-row-title { font-size: 15px; }
.plan-score { align-self: center; font-size: 12px; color: var(--info); background: none; border: 0.5px solid color-mix(in srgb, var(--info) 45%, transparent); border-radius: 999px; padding: 5px 11px; min-height: 0; }
.plan-score-row { align-items: center; }
.plan-score-row::before { align-self: stretch; }
.plan-score-name { width: 44px; font-size: 15px; text-align: left; flex: none; }
.plan-score-num { margin-left: auto; font-size: 16px; }
.plan-diff { width: 30px; font-size: 12px; text-align: right; }
.plan-diff.up { color: var(--good); }
.plan-diff.down { color: var(--pink); }
.plan-empty { color: var(--sub); font-size: 13px; background: var(--surface); border-radius: 16px; padding: 14px; margin: 0; }
.plan-form:empty { display: none; }
.fortnight-day { all: unset; cursor: pointer; display: grid; justify-items: center; gap: 3px; padding: 4px 0; border-radius: 8px; font-size: 11px; color: var(--faint); -webkit-tap-highlight-color: transparent; user-select: none; }
.fortnight-day:active { background: var(--surface); }
.fortnight-day.picked b { box-shadow: inset 0 0 0 1.5px var(--info); }
.fortnight-day:focus-visible { outline: 2px solid var(--info); }
.plan-edit-head { margin: 0 0 10px; font-size: 14px; color: var(--sub); }
.plan-date.flash-on { animation: plan-flash 1.2s ease-out; }
@keyframes plan-flash { 0%, 30% { background: color-mix(in srgb, var(--info) 18%, transparent); } 100% { background: transparent; } }

/* 規劃's calendar: two weeks in a row, or the month; a dot per test, green for a day studied, a day's things under it */
.cal { display: grid; gap: 10px; }
.cal-toggle { font-size: 13px; }
.cal-strip { display: grid; grid-template-columns: repeat(14, 1fr); }
.cal-col { display: grid; justify-items: center; gap: 2px; }
.cal-wd { font-size: 11px; color: var(--faint); text-align: center; }
.cal-day { all: unset; cursor: pointer; display: grid; justify-items: center; gap: 3px; padding: 3px 0; border-radius: 8px; user-select: none; -webkit-tap-highlight-color: transparent; }
.cal-day b { font-weight: 400; font-size: 12px; color: var(--text); min-width: 22px; line-height: 22px; text-align: center; border-radius: 6px; }
.cal-day.past b { color: var(--faint); }
.cal-day.studied b { background: var(--good-soft); color: var(--good); }
.cal-day.today b { background: var(--info); color: var(--bg); }
.cal-day.picked b { box-shadow: inset 0 0 0 1.5px var(--info); }
.cal-day.today.picked b { box-shadow: inset 0 0 0 1.5px var(--bg), 0 0 0 1.5px var(--info); }
.cal-day:active { background: var(--surface); }
.cal-day:focus-visible { outline: 2px solid var(--info); }
.cal-dots { display: flex; gap: 2px; height: 5px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; }
.cal-month { display: grid; gap: 8px; }
.cal-month-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; }
.cal-flip { all: unset; cursor: pointer; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--sub); font-size: 20px; }
.cal-flip:active { background: var(--surface); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.cal-grid .cal-wd { padding-bottom: 4px; }
.cal-panel { background: var(--surface); border-radius: 16px; padding: 8px 14px 10px; display: grid; gap: 6px; }
.cal-panel-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--sub); }
.cal-panel-head .pixel { color: var(--text); }
.cal-record { margin: 0; font-size: 13px; color: var(--sub); }
.cal-list { background: none; padding: 0; border-top: 0.5px solid var(--border); border-radius: 0; }
.cal-list .plan-row { padding: 10px 0; }
.cal-kind { align-self: center; font-size: 12px; color: var(--faint); }
.cal-todo { border-bottom: 0.5px solid var(--border); }
.cal-todo:last-child { border-bottom: 0; }
.cal-todo .todo { background: none; border: 0; border-radius: 0; padding: 8px 0; }
.cal-panel-body:empty { display: none; }
.cal-panel-body { padding-top: 4px; }
.cal-add { display: flex; gap: 16px; padding-top: 2px; }
.cal-add button { all: unset; cursor: pointer; font-size: 13px; color: var(--info); padding: 6px 0; }

/* 規劃, second pass: actions at the top, 行事曆 | 成績, a row of days over one list by date */
.plan-head { align-items: center; gap: 8px; }
.plan-head h1 { flex: 1; }
.plan-icon { all: unset; cursor: pointer; width: 38px; height: 38px; border-radius: 12px; background: var(--surface); color: var(--text); display: grid; place-items: center; flex: none; }
.plan-icon:active { background: var(--surface-2); }
.seg { display: flex; background: var(--surface); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { all: unset; cursor: pointer; flex: 1; text-align: center; font-size: 14px; padding: 8px 0; border-radius: 9px; color: var(--sub); }
.seg button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.seg.small { margin-bottom: 10px; }
.seg.small button { font-size: 13px; padding: 6px 0; }
.plan-edit .seg { background: var(--bg); }
.cal { gap: 8px; }
.cal-head { display: flex; justify-content: space-between; align-items: center; min-height: 32px; }
.cal-title { display: flex; align-items: center; gap: 4px; font-size: 15px; }
.cal-head .plan-link { font-size: 13px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.cal-grid .cal-wd { padding-bottom: 2px; }
.cal-col { display: grid; justify-items: center; gap: 4px; }
.cal-day b { min-width: 28px; line-height: 28px; font-size: 13px; border-radius: 8px; }
.agenda { gap: 14px; margin-top: 6px; }
.agenda-day { display: grid; gap: 6px; }
.agenda-head { display: flex; align-items: baseline; gap: 8px; padding: 0 2px; font-size: 12px; color: var(--sub); }
.agenda-head b { font-weight: 400; font-size: 14px; color: var(--text); }
.agenda-head .plan-link { margin-left: auto; }
.agenda-todo { border-bottom: 0.5px solid var(--border); }
.agenda-todo:last-child { border-bottom: 0; }
.agenda-todo .todo { background: none; border: 0; border-radius: 0; padding: 9px 0; }
.plan-kind { align-self: center; font-size: 11px; color: var(--faint); }
.plan-edit.inline { background: none; padding: 10px 0; }
.agenda > .plan-link { justify-self: start; font-size: 13px; }

/* 規劃: the picked day as one card, every row the same shape */
.day { gap: 8px; margin-top: 6px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 2px; font-size: 15px; }
.day-head .sub { font-size: 12px; }
.day-head .plan-link { font-size: 13px; }
.day-record { margin: 0; padding: 0 2px; font-size: 13px; color: var(--sub); }
.day-list { list-style: none; margin: 0; padding: 0 14px; background: var(--surface); border-radius: 16px; }
.day-list > li + li { border-top: 0.5px solid var(--border); }
.day-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; box-sizing: border-box; }
.day-lead { width: 22px; height: 22px; flex: none; display: grid; place-items: center; color: var(--sub); font-size: 18px; }
.day-square { width: 12px; height: 12px; border-radius: 3px; }
.day-check { all: unset; cursor: pointer; width: 22px; height: 22px; flex: none; display: grid; place-items: center; }
.day-check::before { content: ""; grid-area: 1 / 1; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--faint); box-sizing: border-box; }
.day-check.on::before { background: var(--good); border-color: var(--good); }
.day-check.on .icon { grid-area: 1 / 1; color: var(--bg); z-index: 1; }
.day-row-main { all: unset; cursor: pointer; flex: 1; min-width: 0; display: grid; gap: 2px; }
.day-row-title { font-size: 15px; overflow-wrap: anywhere; }
.day-row-note { font-size: 12px; color: var(--sub); }
.day-score { font-size: 14px; }
.day-add { all: unset; cursor: pointer; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; color: var(--sub); font-size: 14px; }
.day-list .plan-edit.inline { padding: 12px 0; }
.day-next { margin: 0; padding: 0 2px; font-size: 12px; color: var(--faint); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.day-next-item { color: var(--sub); }

/* 規劃: the day as a page of the 聯絡簿 — paper, ruled lines, a red margin, 考 in red pen */
.nb-page {
  --text: #22201C; --sub: #6F6A5E; --faint: #A39E90; --border: #E3DCCB; --info: #1182B8;
  list-style: none; margin: 0; padding: 10px 16px 6px; color: var(--text); background: #F6F2E7; border-radius: 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35); position: relative; overflow: hidden;
}
.nb-page::before { content: ""; position: absolute; left: 44px; top: 0; bottom: 0; width: 1px; background: #E7B7B0; }
.nb-date { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0 8px 40px; font-family: var(--serif); font-size: 18px; border-bottom: 1px solid var(--border); }
.nb-tag { font-family: var(--font, inherit); font-size: 12px; color: var(--faint); }
.nb-date .plan-link { font-family: inherit; font-size: 13px; color: var(--info); }
.nb-line { display: flex; align-items: center; gap: 14px; min-height: 46px; border-bottom: 1px solid var(--border); }
.nb-line:last-child { border-bottom: 0; }
.nb-mark { width: 22px; height: 22px; flex: none; display: grid; place-items: center; color: var(--sub); }
.nb-kao { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid #C8423A; color: #C8423A; font-family: var(--serif); font-size: 12px; display: grid; place-items: center; transform: rotate(-6deg); }
.nb-box { all: unset; cursor: pointer; width: 22px; height: 22px; display: grid; place-items: center; }
.nb-box::before { content: ""; grid-area: 1 / 1; width: 16px; height: 16px; border: 1.5px solid #9A917E; border-radius: 4px; box-sizing: border-box; }
.nb-box.on::before { border-color: #3E8E5A; }
.nb-box.on .icon { grid-area: 1 / 1; color: #3E8E5A; }
.nb-main { all: unset; cursor: pointer; flex: 1; min-width: 0; font-family: var(--serif); font-size: 16px; line-height: 1.5; padding: 10px 0; overflow-wrap: anywhere; }
.nb-main.done { color: var(--faint); text-decoration: line-through; }
.nb-note { font-family: var(--font, inherit); font-size: 12px; color: var(--sub); margin-left: 8px; }
.nb-record { font-family: inherit; font-size: 14px; color: var(--sub); cursor: default; }
.nb-score { font-family: var(--serif); color: #C8423A; font-size: 15px; }
.nb-action { all: unset; cursor: pointer; font-size: 12px; color: var(--info); padding: 6px 0 6px 8px; }
.nb-edit { flex: 1; padding: 10px 0; }
.nb-edit select, .nb-edit input { background: #fff; color: #22201C; border-color: var(--border); }
.nb-writing { display: block; padding: 2px 0 6px; }
.nb-write-row { display: flex; align-items: center; gap: 14px; min-height: 46px; }
.nb-pen { color: var(--faint); }
.nb-input { all: unset; flex: 1; min-width: 0; font-family: var(--serif); font-size: 16px; color: var(--text); padding: 10px 0; }
.nb-input::placeholder { color: var(--faint); }
.nb-labels { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding-left: 36px; }
.nb-labels:empty { display: none; }
.nb-label { all: unset; cursor: pointer; font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #E9E2D0; color: #4A4436; }
.nb-label.plain { cursor: default; background: none; padding: 4px 2px; color: var(--sub); }
.nb-label.empty { background: none; box-shadow: inset 0 0 0 1px #C8423A; color: #C8423A; }
.nb-save { all: unset; cursor: pointer; margin-left: auto; font-size: 13px; color: #fff; background: #22201C; padding: 5px 14px; border-radius: 999px; }
.day { margin-top: 10px; }
.nb-page input.nb-input { background: none; border: 0; box-shadow: none; height: auto; border-radius: 0; color: #22201C; padding: 10px 0; }

/* 規劃: the day back in the app's own dark surface (the paper look stood out too much); the marks and the write line stay */
.nb-page { --text: inherit; --sub: inherit; --faint: inherit; --border: inherit; --info: inherit;
  background: var(--surface); color: var(--text); box-shadow: none; padding: 4px 14px; }
.nb-page::before { content: none; }
.nb-date { padding: 10px 0 10px; font-family: inherit; font-size: 15px; border-bottom: 0.5px solid var(--border); }
.nb-line { border-bottom: 0.5px solid var(--border); gap: 12px; }
.nb-main, .nb-input, .nb-page input.nb-input { font-family: inherit; font-size: 15px; color: inherit; }
.nb-kao { border-color: var(--pink); color: var(--pink); font-family: inherit; font-size: 11px; transform: none; }
.nb-box::before { border-color: var(--faint); border-radius: 5px; }
.nb-box.on::before { background: var(--good); border-color: var(--good); }
.nb-box.on .icon { color: var(--bg); }
.nb-score { font-family: inherit; color: var(--text); }
.nb-label { background: var(--surface-2); color: var(--text); }
.nb-label.empty { box-shadow: inset 0 0 0 1px var(--pink); color: var(--pink); background: none; }
.nb-save { background: var(--info); color: var(--bg); }
.nb-edit select, .nb-edit input { background: var(--bg); color: var(--text); }

/* 規劃: some depth in the app's own colours — the card lifted, the date as a big figure, tests raised in their subject's
   colour above the to-dos, the line to write on sunk in */
.nb-page { background: var(--surface); padding: 6px 12px 12px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 24px rgba(0, 0, 0, .28); border-radius: 18px; }
.nb-date { align-items: center; border-bottom: 0; padding: 10px 4px 8px; }
.nb-day { display: flex; align-items: center; gap: 10px; }
.nb-day b { font-weight: 400; font-size: 30px; line-height: 1; color: var(--text); }
.nb-day > span { display: grid; gap: 1px; }
.nb-month { font-size: 12px; color: var(--sub); }
.nb-week { font-size: 14px; }
.nb-tag { align-self: center; font-size: 12px; color: var(--sub); background: var(--surface-2); padding: 3px 10px; border-radius: 999px; }
.nb-line { border-bottom: 0; border-top: 0.5px solid var(--border); padding: 0 4px; }
.nb-date + .nb-line { border-top: 0; }
.nb-line.nb-test { border-top: 0; margin: 4px 0; padding: 0 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--c) 14%, var(--surface)); box-shadow: inset 3px 0 0 var(--c); }
.nb-line.nb-test + .nb-line { border-top: 0; }
.nb-line.nb-test .nb-kao { border-color: var(--c); color: var(--c); }
.nb-line.nb-test .nb-main { font-weight: 500; }
.nb-writing { border-top: 0; margin-top: 8px; padding: 0; }
.nb-write-row { background: var(--bg); border-radius: 12px; padding: 0 12px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .35); min-height: 44px; }
.nb-labels { padding: 8px 2px 0; }

/* 規劃: three clear blocks — the calendar in its own card, the day, then the tests to come with days left */
.plan-body { gap: 16px; }
.cal-card { background: var(--surface); border-radius: 18px; padding: 10px 12px 8px; display: grid; gap: 6px; }
.day { margin-top: 0; }
.next-tests { gap: 8px; }
.next-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; font-size: 14px; }
.next-head .sub { font-size: 12px; }
.next-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.next-row { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px;
  background: var(--surface); border-radius: 14px; }
.next-row:active { background: var(--surface-2); }
.next-count { width: 48px; height: 48px; flex: none; border-radius: 12px; display: grid; place-content: center; justify-items: center; gap: 1px;
  background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.next-count b { font-weight: 400; font-size: 20px; line-height: 1; }
.next-count span { font-size: 10px; }
.next-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.next-title { font-size: 15px; }
.next-note { font-size: 12px; color: var(--sub); }
.next-row .chev { color: var(--faint); }
.week-card { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; display: grid; gap: 14px; padding: 14px 16px; background: var(--surface); border-radius: 16px; }
.week-total { display: grid; gap: 3px; }
.week-total b { font-weight: 400; font-size: 20px; }
.week-total .sub { font-size: 12px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 72px; }
.week-col { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 4px; }
.week-col i { align-self: end; width: 100%; max-width: 20px; border-radius: 5px; background: var(--surface-2); }
.week-col.today i { background: var(--info); }
.week-col span { font-size: 11px; color: var(--faint); }

/* ---------- 我: who, how deep (the one big card), this month, today's tasks, badges, links ---------- */
.me-head { display: flex; justify-content: space-between; align-items: center; }
.me-head h1 { margin: 0; }
.me-who { all: unset; cursor: pointer; box-sizing: border-box; display: flex; align-items: center; gap: 12px; padding: 0 2px; }
.me-avatar { width: 48px; height: 48px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; overflow: hidden; flex: none; }
.me-who-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.me-name { font-size: 17px; }
.me-who .sub { font-size: 12px; }
.me-who .chev { color: var(--faint); }
.me-card { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: grid; gap: 10px; }
.me-depth { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 24px rgba(0, 0, 0, .22); }
.me-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.me-row .sub { font-size: 12px; }
.me-big { font-size: 34px; line-height: 1; }
.me-big small { font-family: inherit; font-size: 13px; color: var(--sub); margin-left: 6px; }
.me-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.me-meter i { display: block; height: 100%; border-radius: 3px; background: var(--gold); }
.me-meter.thin { height: 5px; margin-top: 6px; }
.me-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 10px; border-top: 0.5px solid var(--border); }
.me-stat { display: grid; gap: 2px; }
.me-stat b { font-weight: 400; font-size: 18px; }
.me-stat small { font-size: 11px; color: var(--sub); }
.me-stat .sub { font-size: 12px; }
.me-group { gap: 8px; }
.me-label { display: flex; justify-content: space-between; align-items: baseline; padding: 0 4px; font-size: 12px; color: var(--sub); }
.me-label-btn { all: unset; cursor: pointer; display: flex; justify-content: space-between; padding: 0 4px; font-size: 12px; color: var(--sub); }
.me-allow .pixel { font-size: 13px; }
.me-foot { align-items: center; }
.me-plus { all: unset; cursor: pointer; flex: none; font-size: 13px; color: var(--gold); }
.me-gold { color: var(--gold); font-size: 12px; }
.me-tasks { list-style: none; margin: 0; padding: 2px 16px; gap: 0; }
.me-task { display: flex; align-items: center; gap: 10px; padding: 11px 0; font-size: 14px; }
.me-tasks > li + li { border-top: 0.5px solid var(--border); }
.me-task-mark { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--faint); box-sizing: border-box; display: grid; place-items: center; flex: none; }
.me-task.done .me-task-mark { background: var(--good); border-color: var(--good); color: var(--bg); }
.me-task.done .me-task-label { color: var(--faint); text-decoration: line-through; }
.me-task-label { flex: 1; min-width: 0; }
.me-task .pixel { font-size: 12px; }
.me-more { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; justify-content: space-between; padding: 11px 0; font-size: 13px; color: var(--sub); }
.me-task-note { padding: 10px 0; font-size: 12px; color: var(--sub); }
.me-badges { display: flex; gap: 8px; }
.me-badge { width: 44px; height: 44px; border-radius: 12px; background: var(--surface); color: color-mix(in srgb, var(--faint) 60%, transparent); display: grid; place-items: center; }
.me-badge.on { background: var(--gold-soft); color: var(--gold); }
.me-links { list-style: none; margin: 4px 0 0; padding: 0 16px; background: var(--surface); border-radius: 18px; }
.me-links > li + li { border-top: 0.5px solid var(--border); }
.me-link { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px; padding: 13px 0; }
.me-link-main { flex: 1; display: grid; gap: 2px; font-size: 15px; }
.me-link-main .sub { font-size: 12px; }
.me-link .chev { color: var(--faint); }

/* ---------- 讀書 (before a session): the mine fills the screen, the choices float over it at the bottom ---------- */
.study-bg { position: fixed; inset: 0; z-index: 0; background: #0B1620; overflow: hidden; }
.study-bg canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; image-rendering: pixelated; }
.study-top { position: fixed; z-index: 2; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.study-round { all: unset; cursor: pointer; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #F1F7FB;
  background: rgba(19, 31, 36, .72); backdrop-filter: blur(6px); }
.study-where { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px; font-size: 13px; color: #F1F7FB;
  background: rgba(19, 31, 36, .72); backdrop-filter: blur(6px); }
.study-where .dot { width: 7px; height: 7px; }
.study-where .pixel { font-size: 12px; color: #9DB0BC; }
.study-sheet { position: fixed; z-index: 2; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); max-width: 660px; margin: 0 auto;
  display: grid; gap: 12px; padding: 14px 14px 12px; border-radius: 22px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
.study-suggest { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--sub); padding-bottom: 10px; border-bottom: 0.5px solid var(--border); }
.study-suggest > span { flex: 1; min-width: 0; color: var(--text); line-height: 1.45; }
.study-link { all: unset; cursor: pointer; flex: none; font-size: 13px; color: var(--info); }
.study-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.study-chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; font-size: 13px;
  background: var(--surface-2); color: var(--sub); }
.study-chip .dot { width: 7px; height: 7px; }
.study-chip[aria-pressed="true"] { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--info); }
.study-todo { display: grid; gap: 8px; }
.study-todo-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.study-time { display: grid; gap: 8px; }
.study-seg { background: var(--bg); }
.study-seg button { font-size: 13px; padding: 7px 0; }
.study-custom-row { display: flex; align-items: center; gap: 8px; }
.study-custom { width: 96px; }
.study-go { margin-top: 2px; }
.study-note { margin: 0; text-align: center; font-size: 11px; color: var(--faint); }

/* ---------- 首頁, second pass: the bear's one line, the plan as steps on a line, to-dos, the streak ---------- */
.hello { display: flex; align-items: center; gap: 12px; }
.hello-bear { width: 48px; height: 48px; border-radius: 14px; background: var(--surface); display: grid; place-items: center; overflow: hidden; flex: none; }
.hello-main { flex: 1; min-width: 0; }
.hello-main h1 { margin: 0; font-size: 22px; }
.hello-main p { margin: 2px 0 0; font-size: 14px; line-height: 1.45; color: var(--sub); }
.hello-gold { all: unset; cursor: pointer; align-self: flex-start; display: flex; align-items: center; gap: 4px; color: var(--gold); font-size: 14px; padding: 4px 2px; }
.plan-hero { background: var(--surface); border-radius: 20px; padding: 16px; display: grid; gap: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 24px rgba(0, 0, 0, .25); }
.plan-hero .sub { margin: 0; }
.ph-head { display: flex; justify-content: space-between; align-items: baseline; }
.ph-title { font-size: 19px; }
.ph-steps { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; display: grid; }
.ph-steps::before { content: ""; position: absolute; left: 11px; top: 18px; bottom: 18px; width: 2px; background: var(--border); }
.ph-step { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; color: var(--sub); }
.ph-dot { width: 16px; height: 16px; border-radius: 50%; flex: none; box-sizing: border-box; border: 2px solid var(--faint); background: var(--surface); display: grid; place-items: center; z-index: 1; }
.ph-step.now { color: var(--text); }
.ph-step.now .ph-dot { border: 0; background: var(--info); box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 22%, transparent); }
.ph-step.done .ph-dot { border: 0; background: var(--good); color: var(--bg); }
.ph-step.done .ph-label { text-decoration: line-through; color: var(--faint); }
.ph-label { flex: 1; min-width: 0; }
.ph-min { font-size: 12px; color: var(--faint); }
.ph-bar { display: flex; align-items: center; gap: 10px; }
.ph-track { flex: 1; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.ph-track i { display: block; height: 100%; background: var(--info); border-radius: 3px; }
.ph-bar .pixel { font-size: 12px; color: var(--sub); }
.home-list > li > .home-row { width: 100%; box-sizing: border-box; }
div.home-row { display: flex; align-items: center; gap: 11px; padding: 11px 14px; }
div.home-row .home-row-main { all: unset; cursor: pointer; flex: 1; min-width: 0; font-size: 15px; }
.home-check { all: unset; cursor: pointer; width: 24px; height: 24px; flex: none; display: grid; place-items: center; }
.home-check::before { content: ""; width: 17px; height: 17px; border-radius: 5px; border: 1.5px solid var(--faint); box-sizing: border-box; }
.home-row .sub { font-size: 12px; }
.streak-card { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: var(--surface); border-radius: 18px; }
.streak-count { display: grid; gap: 2px; flex: none; }
.streak-count b { font-weight: 400; font-size: 22px; line-height: 1; }
.streak-count small { font-size: 12px; color: var(--sub); }
.streak-count .sub { font-size: 12px; }
.streak-days { flex: 1; display: flex; justify-content: space-between; }
.streak-day { display: grid; justify-items: center; gap: 4px; font-size: 10px; color: var(--faint); }
.streak-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; }
.streak-day.on .streak-mark { background: #3D2610; }
.streak-day.frozen .streak-mark { background: color-mix(in srgb, var(--info) 18%, transparent); }
.streak-day.today:not(.on) .streak-mark { background: none; box-shadow: inset 0 0 0 1.5px #FF9F43; }
ul.home-list { list-style: none; margin: 0; padding: 0; }

/* ---------- 讀書中: the dig fills the screen, the clock floats at the top, the buttons at the bottom ---------- */
.study-screen:has(> .focus) { padding: 0; overflow: hidden; }
.focus { position: absolute; inset: 0; }
.focus-bg { position: absolute; inset: 0; background: #2A2018; }
.focus-bg canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; image-rendering: pixelated; }
.focus-top { position: absolute; left: 0; right: 0; top: 0; display: grid; justify-items: center; gap: 6px; text-align: center;
  padding: calc(18px + env(safe-area-inset-top, 0px)) 18px 34px;
  background: linear-gradient(var(--bg) 55%, color-mix(in srgb, var(--bg) 0%, transparent)); }
.focus-title { display: flex; align-items: center; gap: 7px; font-size: 14px; color: var(--sub); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-title .dot { width: 7px; height: 7px; flex: none; }
.focus-top .clock { margin: 0; }
.focus-goal { width: min(220px, 70%); display: flex; align-items: center; gap: 8px; }
.focus-track { flex: 1; height: 5px; border-radius: 3px; background: color-mix(in srgb, var(--text) 14%, transparent); overflow: hidden; }
.focus-track i { display: block; height: 100%; width: 0; background: var(--info); border-radius: 3px; transition: width .6s; }
.focus-goal .pixel { font-size: 12px; color: var(--sub); }
.focus-status { margin: 0; font-size: 12px; color: var(--sub); }
.focus-pill { all: unset; cursor: pointer; position: absolute; right: 12px; top: 46%; padding: 6px 12px; border-radius: 999px; font-size: 12px; color: #F1F7FB;
  background: rgba(19, 31, 36, .78); backdrop-filter: blur(6px); }
.focus-todos { position: absolute; left: 10px; right: 10px; bottom: calc(108px + env(safe-area-inset-bottom, 0px)); max-height: 46vh; overflow-y: auto;
  padding: 12px 14px; border-radius: 20px; background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 -6px 30px rgba(0, 0, 0, .45); text-align: left; }
.focus-todos:not(.open) { display: none; }
.focus-bar { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); max-width: 520px; margin: 0 auto;
  display: flex; padding: 10px 6px; border-radius: 22px; background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(10px);
  box-shadow: 0 -6px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
.focus-btn { all: unset; cursor: pointer; flex: 1; min-width: 0; display: grid; justify-items: center; gap: 4px; font-size: 11px; color: var(--sub); text-align: center; }
.focus-btn > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-ic { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); color: var(--text); display: grid; place-items: center; }
.focus-btn.go .focus-ic { background: var(--info); color: var(--bg); }
.focus-btn.end .focus-ic { background: color-mix(in srgb, var(--pink) 18%, var(--surface)); color: var(--pink); }
.focus-btn:disabled { opacity: .45; cursor: default; }
.focus-btn:active .focus-ic { transform: scale(.94); }
.ph-change { justify-self: center; font-size: 13px; }
.ph-actions { display: flex; gap: 8px; }
.ph-actions .primary { flex: 1; min-width: 0; }
.ph-skip { flex: none; padding: 0 20px; border-radius: 14px; font-size: 15px; background: var(--surface-2); color: var(--text); border: 0; }
.ph-step.skipped .ph-label { color: var(--faint); }
.ph-step.skipped .ph-dot { border-style: dashed; }
.ph-step.skipped { cursor: pointer; }

/* ---------- 結算: the mine at its new depth, what it came to at the top, one floating card at the bottom ---------- */
.study-screen:has(> .end-screen) { padding: 0; overflow: hidden; }
.end-screen { position: absolute; inset: 0; }
.end-bg { position: absolute; inset: 0; background: #2A2018; }
.end-bg canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; image-rendering: pixelated; }
.end-top { position: absolute; left: 0; right: 0; top: 0; display: grid; justify-items: center; gap: 4px; text-align: center;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 18px 36px; background: linear-gradient(var(--bg) 60%, transparent); }
.end-what { margin: 0; font-size: 13px; color: var(--sub); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end-minutes { font-size: 48px; line-height: 1; }
.end-minutes small { font-family: var(--font, inherit); font-size: 15px; color: var(--sub); }
.end-depth { margin: 0; font-size: 14px; color: var(--text); }
.end-depth .pixel { font-size: 14px; }
.end-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 8px; }
.end-chip { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 12px;
  background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--text); }
.end-sheet { position: absolute; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); max-width: 560px; margin: 0 auto;
  display: grid; gap: 12px; padding: 14px; border-radius: 22px; max-height: 62vh; overflow-y: auto;
  background: color-mix(in srgb, var(--surface) 97%, transparent); box-shadow: 0 -6px 30px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
.end-sheet > * + * { border-top: 0.5px solid var(--border); padding-top: 12px; }
.end-sheet > .end-actions { border-top: 0; padding-top: 0; }
.end-q { display: grid; gap: 8px; }
.end-q p { margin: 0; font-size: 14px; }
.end-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.end-choice { all: unset; cursor: pointer; padding: 7px 13px; border-radius: 999px; font-size: 13px; background: var(--surface-2); color: var(--text); }
.end-choice.main { background: var(--info); color: var(--bg); }
.end-done { margin: 0; font-size: 13px; color: var(--sub); }
.end-plan-line { all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; }
.end-plan-line .sub { font-size: 12px; }
.end-actions { display: flex; gap: 8px; }
.end-actions button { flex: 1; }
.end-again { background: var(--surface-2); color: var(--text); border: 0; }
.end-actions .primary { box-shadow: 0 3px 0 var(--lamp-deep); }

/* ---------- 讀書紀錄: 日 / 週 / 月, after YPT ---------- */
.rec-head { display: flex; align-items: center; gap: 10px; }
.rec-head h1 { margin: 0; }
.rec-back { background: var(--surface); color: var(--text); backdrop-filter: none; }
.rec-step { display: flex; justify-content: space-between; align-items: center; font-size: 14px; margin-top: -4px; }
.rec-step .cal-flip:disabled { opacity: .3; cursor: default; }
.rec-card { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: grid; gap: 12px; }
.rec-hero { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 24px rgba(0, 0, 0, .22); }
.rec-total { display: grid; justify-items: center; gap: 4px; }
.rec-total.left { justify-items: start; }
.rec-total b { font-weight: 400; font-size: 34px; line-height: 1; }
.rec-total.left b { font-size: 26px; }
.rec-total .sub, .rec-three .sub { font-size: 12px; }
.rec-three { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; gap: 6px; }
.rec-hero .rec-total + .rec-three { border-top: 0.5px solid var(--border); padding-top: 12px; }
.rec-three > span { display: grid; gap: 3px; }
.rec-three b { font-weight: 400; font-size: 16px; }
.rec-label { margin: 0; font-size: 12px; color: var(--sub); }
.rec-grid { display: grid; grid-template-columns: 22px repeat(6, 1fr); gap: 3px; align-items: center; }
.rec-grid i { height: 12px; border-radius: 3px; background: var(--surface-2); }
.rec-hour { font-size: 10px; color: var(--faint); font-family: var(--pixel); }
.rec-subjects { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rec-subjects li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.rec-subjects .dot { width: 8px; height: 8px; flex: none; }
.rec-sname { width: 64px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-sbar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.rec-sbar i { display: block; height: 100%; border-radius: 3px; }
.rec-stime { width: 54px; text-align: right; font-size: 13px; color: var(--sub); }
.rec-empty { margin: 0; font-size: 13px; color: var(--sub); }
.rec-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.rec-change { font-size: 12px; }
.rec-change.up { color: var(--good); }
.rec-change.down { color: var(--pink); }
.rec-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 130px; }
.rec-bar { display: grid; grid-template-rows: 1fr auto; justify-items: center; gap: 5px; }
.rec-stack { width: 100%; max-width: 26px; height: 100%; display: flex; flex-direction: column-reverse; gap: 1px; border-radius: 5px; overflow: hidden; background: var(--surface-2); }
.rec-stack i { display: block; width: 100%; }
.rec-wd { font-size: 11px; color: var(--faint); text-align: center; }
.rec-bar.today .rec-wd { color: var(--info); }
.rec-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.rec-day { all: unset; cursor: pointer; aspect-ratio: 1; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-family: var(--pixel); color: var(--sub); background: var(--surface-2); }
.rec-day.l1 { background: #0F4461; color: #CFDAE2; }
.rec-day.l2 { background: #136A99; color: #F1F7FB; }
.rec-day.l3 { background: #1893CC; color: #F1F7FB; }
.rec-day.l4 { background: var(--lamp, #49C0F8); color: #0B1A22; }
.rec-day.today { box-shadow: inset 0 0 0 1.5px var(--text); }
.rec-link { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--surface); border-radius: 18px; font-size: 15px; }
.rec-link .sub { font-size: 12px; }

/* ---------- 從 YPT 搬家 ---------- */
.ypt { gap: 14px; }
.ypt-steps, .ypt-rules { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; line-height: 1.5; }
.ypt-rules { list-style: none; padding: 0; }
.ypt-rules li { padding-left: 22px; position: relative; color: var(--text); }
.ypt-rules li::before { content: "・"; position: absolute; left: 4px; color: var(--sub); }
.ypt-rules li.yes::before { content: "✓"; color: var(--good); }
.ypt-rules li.no::before { content: "✕"; color: var(--pink); }
.ypt-rules li.gift::before { content: "+"; color: var(--gold); }
.ypt-map { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.ypt-map > span:first-child { flex: 1; min-width: 0; }
.ypt-select { width: auto; min-width: 110px; }
.ypt-days { list-style: none; margin: 0; padding: 0; display: grid; max-height: 46vh; overflow-y: auto; }
.ypt-days li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 0.5px solid var(--border); font-size: 14px; }
.ypt-days li:first-child { border-top: 0; }
.ypt-date { flex: none; width: 82px; }
.ypt-subj { flex: 1; min-width: 0; font-size: 12px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ypt-min { flex: none; font-size: 13px; }
.ypt-days { overflow-x: hidden; }
/* time brought over from YPT: the same colours, lighter, so what was timed here stands out */
.rec-grid i.ypt, .rec-stack i.ypt { opacity: .4; }
.rec-day.ypt { opacity: .5; }
.rec-moved { margin: 0; display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--sub); }
.rec-moved i { width: 10px; height: 10px; border-radius: 3px; background: var(--info); opacity: .4; }
.ypt-boost { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--gold-soft); color: var(--gold); font-size: 14px; }

/* ---------- 成績 ---------- */
.scores-add { margin-left: auto; font-size: 14px; }
.scores-subjects { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.scores-subjects .study-chip { flex: none; }
.scores { gap: 12px; }
.scores-big b { font-weight: 400; font-size: 44px; line-height: 1.05; }
.scores-big small { font-size: 14px; color: var(--sub); }
.rec-hero .rec-row + .rec-three { border-top: 0.5px solid var(--border); padding-top: 12px; }
.scores-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.scores-tiles > span { display: grid; gap: 3px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.scores-tiles b { font-weight: 400; font-size: 16px; }
.scores-tiles .sub { font-size: 12px; }
.scores-more { margin: 0; font-size: 14px; }
.scores-more .up { color: var(--good); }
.scores-more .down { color: var(--pink); }
.rec-empty.small { font-size: 12px; color: var(--faint); }
.scores-list { list-style: none; margin: 0; padding: 0 14px; background: var(--surface); border-radius: 16px; }
.scores-list li + li { border-top: 0.5px solid var(--border); }
.scores-row { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 0; font-size: 14px; }
.scores-row.on .scores-name { color: var(--gold); }
.scores-date { width: 40px; font-size: 12px; color: var(--sub); }
.scores-name { flex: 1; min-width: 0; }
.scores-score { font-size: 15px; }

/* ---------- 設定, second pass ---------- */
.set-list { border: 0; }
.set-row + .set-row { border-top: 0.5px solid var(--border); }
.set-group h2 { font-size: 12px; font-weight: 400; color: var(--sub); margin: 0 4px 6px; }
.set-name { display: flex; align-items: center; gap: 11px; min-width: 0; }
.set-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text); }
.set-ic.mint { background: color-mix(in srgb, #7FD1B9 18%, transparent); color: #7FD1B9; }
.set-ic.sky { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.set-ic.violet { background: color-mix(in srgb, #C9A8FF 18%, transparent); color: #C9A8FF; }
.set-ic.orange { background: color-mix(in srgb, #FF9F43 18%, transparent); color: #FF9F43; }
.set-new { margin-left: 8px; padding: 2px 7px; border-radius: 999px; font-size: 11px; background: var(--gold-soft); color: var(--gold); }
.set-account { all: unset; cursor: pointer; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border-radius: 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 10px 24px rgba(0, 0, 0, .22); }
.set-avatar { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; }
.set-who { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 16px; }
.set-who .sub { font-size: 12px; }
.set-plus { font-size: 13px; color: var(--gold); flex: none; }
.set-account .chev { color: var(--faint); }
.set-version { margin: 4px 0 0; text-align: center; font-size: 12px; color: var(--faint); }

/* ---------- 商店 ---------- */
.shop-gold { margin-left: auto; display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-size: 15px; }
.shop-preview { position: relative; aspect-ratio: 1 / 0.6; border-radius: 18px; overflow: hidden; background: #0E2433; }
.shop-preview canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; image-rendering: pixelated; }
.shop-trying { position: absolute; left: 10px; bottom: 8px; padding: 3px 10px; border-radius: 999px; font-size: 12px; color: #F1F7FB; background: rgba(19, 31, 36, .8); }
.shop-earn { all: unset; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 4px; font-size: 13px; color: var(--info); }
.shop-earn .sub { font-size: 12px; }
.shop-group { gap: 6px; }
.shop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.shop-tile { all: unset; cursor: pointer; position: relative; box-sizing: border-box; display: grid; gap: 6px; padding: 10px; border-radius: 16px; background: var(--surface); }
.shop-tile.on { box-shadow: inset 0 0 0 2px var(--info); }
.shop-tile.locked { opacity: .55; }
.shop-pic { height: 58px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; }
.shop-name { font-size: 14px; }
.shop-note { font-size: 12px; color: var(--sub); }
.shop-price { display: flex; align-items: center; gap: 4px; color: var(--gold); font-size: 13px; }
.shop-badge { position: absolute; top: 8px; right: 8px; padding: 2px 7px; border-radius: 999px; font-size: 10px; z-index: 1; }
.shop-badge.use { background: var(--good-soft); color: var(--good); }
.shop-badge.month { background: color-mix(in srgb, #FF9F43 20%, transparent); color: #FF9F43; }
.shop-bar { position: sticky; bottom: calc(var(--tabs-h, 64px) + 10px + env(safe-area-inset-bottom, 0px)); z-index: 3; display: flex; align-items: center; gap: 12px;
  padding: 10px 10px 10px 14px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 97%, transparent); box-shadow: 0 -6px 24px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06); margin-top: 4px; }
.shop-bar-main { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 15px; }
.shop-bar-main .sub { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-act { all: unset; cursor: pointer; flex: none; display: flex; align-items: center; gap: 5px; padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500;
  background: var(--gold); color: #2A2008; }
.shop-act.off { background: var(--surface-2); color: var(--sub); font-weight: 400; }
.shop-act.quiet-act { background: var(--info); color: var(--bg); }

/* ---------- 關於你 (onboarding): the mine behind, one question at a time floating at the bottom ---------- */
.onb-top { position: fixed; z-index: 2; left: 12px; right: 12px; top: calc(12px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 10px; }
.onb-space { width: 40px; height: 40px; flex: none; }
.onb-bar { flex: 1; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.onb-bar i { display: block; height: 100%; background: var(--info); border-radius: 3px; transition: width .3s; }
.onb-count { font-size: 12px; color: #CFDAE2; flex: none; }
.onb-sheet { gap: 10px; }
.onb-q { margin: 0 2px 2px; font-size: 16px; line-height: 1.45; }
.onb-options { display: grid; gap: 8px; }
.onb-option { all: unset; cursor: pointer; box-sizing: border-box; display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); font-size: 15px; }
.onb-option small { font-size: 12px; color: var(--sub); }
.onb-option[aria-pressed="true"] { background: var(--surface-3); box-shadow: inset 0 0 0 1.5px var(--info); }
.onb-option:active { transform: scale(.98); }
.onb-subjects { display: flex; flex-wrap: wrap; gap: 8px; }
.onb-note { margin: 0 2px; font-size: 12px; color: var(--sub); }
.onb-title { margin: 0 2px; font-size: 19px; }
.onb-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.onb-points li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.onb-points .icon { color: var(--info); flex: none; }

/* ---------- 小白's cards for a 聯絡簿 or a 成績單 ---------- */
.pc-card { margin-top: 8px; display: grid; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--surface); }
.pc-card.reading { color: var(--sub); }
.pc-row { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.pc-row + .pc-row, .pc-row + .pc-editing, .pc-editing + .pc-row { border-top: 0.5px solid var(--border); padding-top: 8px; }
.pc-row.unsure .pc-main > span:first-child { color: var(--pink); }
.pc-check { all: unset; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--faint); }
.pc-check.on { background: var(--info); box-shadow: none; color: var(--bg); }
.pc-row.unsure .pc-check { box-shadow: inset 0 0 0 1.5px var(--pink); }
.pc-sq { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.pc-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pc-main .sub { font-size: 12px; }
.pc-edit, .pc-link { all: unset; cursor: pointer; font-size: 12px; color: var(--info); flex: none; }
.pc-row.unsure .pc-edit { color: var(--pink); }
.pc-link { justify-self: start; color: var(--sub); }
.pc-editing { display: grid; gap: 6px; }
.pc-editing .nb-write-row { background: var(--bg); border-radius: 10px; padding: 0 6px 0 10px; box-shadow: inset 0 0 0 1px var(--pink); min-height: 40px; }
.pc-editing .nb-labels { padding: 0 2px; }
.pc-card input.pc-input { background: none; border: 0; box-shadow: none; height: auto; color: var(--text); padding: 8px 0; font-family: inherit; font-size: 14px; }
.pc-go-btn { margin-top: 2px; }
.pc-done { all: unset; cursor: pointer; box-sizing: border-box; margin-top: 8px; width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px; background: var(--surface); font-size: 14px; }
.pc-done > span:first-child { display: flex; align-items: center; gap: 7px; }
.pc-done .icon { color: var(--good); }
.pc-go { color: var(--info); font-size: 13px; }
.pc-score { margin: 0; font-size: 15px; }
.pc-score b { font-weight: 400; font-size: 24px; }
.pc-diff { margin: 0; font-size: 13px; }
.pc-diff.up { color: var(--good); }
.pc-diff.down { color: var(--pink); }
.pc-unsure { margin: 0; font-size: 12px; color: var(--pink); }
.pc-buttons { display: flex; gap: 8px; }
.pc-buttons button { flex: 1; }
.pc-score-edit { display: flex; gap: 8px; }
.pc-score-edit select { flex: 1; min-width: 0; }
.pc-score-edit input { width: 84px; }

/* ---------- Plus: the upgrade page, the welcome, the member page, and 小白's card when the month ran out ---------- */
.plus-top { display: flex; justify-content: space-between; align-items: center; }
.plus-link { all: unset; cursor: pointer; font-size: 13px; color: var(--sub); padding: 8px 4px; }
.plus-hero { position: relative; aspect-ratio: 1 / 0.62; border-radius: 20px; overflow: hidden; background: #0E2433; }
.plus-hero canvas { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center bottom; image-rendering: pixelated; }
.plus-title { display: grid; gap: 2px; padding: 0 2px; }
.plus-title h1 { margin: 0; font-size: 24px; }
.plus-title p { margin: 0; }
.plus-steps { display: grid; padding: 4px 2px; }
.plus-step { position: relative; display: grid; grid-template-columns: 14px 44px 1fr; gap: 0 10px; align-items: start; padding-bottom: 14px; }
.plus-step:last-child { padding-bottom: 0; }
.plus-step > i { width: 10px; height: 10px; margin: 5px 2px 0; border-radius: 50%; background: var(--surface-3); position: relative; z-index: 1; }
.plus-step.on > i { background: var(--info); box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 22%, transparent); }
.plus-step:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: -4px; width: 2px; background: var(--surface-2); }
.plus-step-when { font-size: 13px; color: var(--sub); padding-top: 1px; }
.plus-step.on .plus-step-when { color: var(--info); }
.plus-step-what { display: grid; gap: 1px; font-size: 14px; }
.plus-step-what .sub { font-size: 12px; }
.plus-fine { font-size: 11px; color: var(--faint); margin: 0; line-height: 1.6; }
.plus-bar { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 3; display: grid; gap: 6px; justify-items: center; margin-top: 2px;
  padding: 10px; border-radius: 20px; background: var(--surface); box-shadow: 0 -6px 24px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06); }
.plus-bar button { width: 100%; }
.plus-bar-note { font-size: 12px; color: var(--sub); }
.plus-welcome { text-align: left; }
.plus-welcome p { margin: 0; }
.plus-welcome-title { font-size: 22px; font-weight: 500; }
.plus-welcome-big { display: flex; align-items: baseline; gap: 8px; }
.plus-welcome-big b { color: var(--info); font-size: 34px; font-weight: 400; }
.plus-status { display: grid; gap: 4px; padding: 16px; border-radius: 18px; background: var(--surface); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05); }
.plus-status p { margin: 0; }
.plus-status-main { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; font-weight: 500; }
.plus-status-days { font-size: 14px; font-weight: 400; color: var(--sub); }
.plus-status-days b { font-size: 28px; color: var(--info); font-weight: 400; }
.plus-use { display: grid; gap: 9px; padding: 14px; border-radius: 18px; background: var(--surface); }
.plus-use-row, .quota-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.plus-use-row.line { padding-top: 10px; border-top: 0.5px solid var(--border); }
.plus-meter { display: block; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.plus-meter i { display: block; height: 100%; border-radius: 3px; background: var(--info); }
.plus-meter.full i { background: var(--pink); }
.plus-reset { font-size: 12px; color: var(--faint); }
.plus-manage { width: 100%; }
.plus-declined { margin-top: 6px; font-size: 13px; color: var(--pink); }
.quota-card .sub { font-size: 12px; }
.quota-wait { font-size: 12px; color: var(--sub); text-align: center; }
.plus-hero.small { aspect-ratio: 1 / 0.5; }
.plus-badge { position: absolute; left: 10px; top: 10px; padding: 3px 10px; border-radius: 999px; font-size: 12px; letter-spacing: 1px; color: #062033; background: var(--info); }
.plus-status .plus-meter { margin: 6px 0 4px; }
.plus-why-line { margin: 0; padding: 8px 12px; border-radius: 12px; font-size: 13px; color: var(--pink); background: var(--pink-soft); }
.plan-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.plan-card { position: relative; display: grid; gap: 4px; padding: 14px; border-radius: 18px; background: var(--surface); }
.plan-card.plus { box-shadow: inset 0 0 0 2px var(--info); background: color-mix(in srgb, var(--info) 8%, var(--surface)); }
.plan-bear { position: absolute; right: 8px; top: 6px; }
.plan-name { font-size: 15px; font-weight: 500; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price b { font-size: 28px; font-weight: 400; line-height: 1.1; }
.plan-card.plus .plan-price b { color: var(--info); }
.plan-price .sub { font-size: 12px; }
.plan-tag { justify-self: start; margin-top: 2px; padding: 2px 9px; border-radius: 999px; font-size: 11px; color: var(--sub); background: var(--surface-2); }
.plan-tag.on { color: #062033; background: var(--info); }
.plan-table { display: grid; gap: 4px; padding: 4px 14px 12px; border-radius: 18px; background: var(--surface); }
.plan-head, .plan-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.plan-head { position: sticky; top: 0; z-index: 2; padding: 10px 0 8px; font-size: 13px; color: var(--sub); background: var(--surface); border-bottom: 0.5px solid var(--border); }
.plan-head > span:not(:first-child) { text-align: center; }
.plan-head .plus { color: var(--info); font-weight: 500; }
.plan-group { display: grid; padding-top: 10px; }
.plan-group-title { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--faint); padding-bottom: 4px; }
.plan-row { padding: 9px 0; font-size: 13px; }
.plan-row + .plan-row { border-top: 0.5px solid var(--border); }
.plan-row.diff { margin: 2px -8px; padding: 10px 8px; border-radius: 12px; background: color-mix(in srgb, var(--info) 9%, transparent); border-top: 0; }
.plan-row.diff + .plan-row { border-top: 0; }
.plan-feature { color: var(--text); line-height: 1.35; }
.plan-cell { display: grid; justify-items: center; text-align: center; gap: 1px; color: var(--sub); }
.plan-cell b { font-size: 17px; font-weight: 400; color: var(--text); }
.plan-cell b:not(.pixel) { font-size: 15px; font-weight: 500; }
.plan-cell small { font-size: 10px; color: var(--faint); }
.plan-cell.plus b { color: var(--info); }
.plan-yes { color: var(--good); display: grid; }
.plan-cell.plus .plan-yes { color: var(--info); }

/* ---------- 讀書直到…: the row to swipe through on the study page ---------- */
.until-row { display: grid; gap: 2px; margin: 0 -14px; }
.until-track { position: relative; display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 4px calc(50% - 40px) 2px; }
.until-track::-webkit-scrollbar { display: none; }
.until-item { all: unset; cursor: pointer; position: relative; flex: none; width: 80px; height: 92px; scroll-snap-align: center; display: grid; place-items: center;
  border-radius: 18px; background: var(--surface-2); transition: background .2s; transform-origin: center bottom; }
.until-item.on { background: var(--surface-3); box-shadow: inset 0 0 0 2px var(--info); }
.until-item canvas { width: 60px; height: 72px; image-rendering: pixelated; }
.until-clock { color: var(--sub); display: grid; }
.until-item.on .until-clock { color: var(--info); }
.until-lock { position: absolute; top: 6px; right: 6px; color: var(--faint); display: grid; }
.until-name { margin: 6px 0 0; text-align: center; font-size: 15px; font-weight: 500; display: grid; gap: 2px; }
.until-why { font-size: 12px; font-weight: 400; color: var(--sub); }
.until-scene { display: block; width: 100%; height: 100%; }
.until-item canvas { width: 80px; height: 92px; image-rendering: auto; border-radius: 18px; }
.until-item { overflow: hidden; }
.study-bg canvas.until-scene { image-rendering: auto; }
.until-item.on { box-shadow: none; outline: 2px solid var(--info); outline-offset: 2px; }
/* 讀書直到… while studying: the scene is the screen; the clock is small and quiet at the top, no dark band behind it */
.focus-bg canvas.until-scene { image-rendering: auto; object-position: center; }
.focus-top.until { background: linear-gradient(rgba(0, 0, 0, .45), transparent); padding-bottom: 28px; }
.focus-top.until .focus-title { color: #F1F5F8; }
.focus-top.until .clock { font-size: 26px; letter-spacing: 2px; color: rgba(241, 245, 248, .7); }
.focus-top.until .focus-status { color: rgba(241, 245, 248, .55); }
.until-done { position: absolute; z-index: 5; left: 12px; right: 12px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); max-width: 520px; margin: 0 auto;
  display: grid; gap: 8px; padding: 18px 16px 12px; border-radius: 22px; text-align: center;
  background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 -8px 32px rgba(0, 0, 0, .5); animation: until-in .5s ease-out; }
.until-done p { margin: 0; }
.until-done-title { font-size: 22px; font-weight: 500; }
@keyframes until-in { from { opacity: 0; transform: translateY(16px); } }

/* 窗景 and 只有數字 on the study screen as it is now: only the clock stays (and the window behind it); the dig, the
   buttons and the to-dos step aside until a tap. 讀書直到… keeps its scene and its small clock at the top. */
.study-screen.dim .focus { z-index: 1; pointer-events: none; }
.study-screen.dim .focus-bg, .study-screen.dim .focus-bar, .study-screen.dim .focus-pill, .study-screen.dim .focus-todos,
.study-screen.dim .focus-status, .study-screen.dim .focus-goal, .study-screen.dim .until-done { display: none; }
.study-screen.dim .focus-top { bottom: 0; align-content: center; background: none; transform: translateY(var(--drift-y, 0)); transition: transform 2s; }
.study-screen.dim .focus-top .clock { font-size: min(22vw, 58vh); letter-spacing: 1vw; }
.study-screen.dim.windowed .focus-top { align-content: end; padding-bottom: calc(20vh + env(safe-area-inset-bottom, 0px)); transform: none; }
.study-screen.dim.windowed .focus-top .clock { font-size: min(16vw, 36vh); }
.study-screen.dim.scene { background: #000; }
.study-screen.dim.scene .focus-bg { display: block; filter: brightness(.75); }
.study-screen.dim.scene .focus-top { bottom: auto; align-content: start; transform: none; background: none; }
.study-screen.dim.scene .focus-top .clock { font-size: 26px; letter-spacing: 2px; }

/* 結算: three tiles for what the session came to; for 讀書直到…, the picture to share at the top of the card */
.end-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(100%, 360px); margin-top: 10px; }
.end-tile { all: unset; cursor: pointer; display: grid; justify-items: center; gap: 2px; padding: 10px 4px 9px; border-radius: 16px;
  background: rgba(15, 22, 28, .72); backdrop-filter: blur(8px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.end-tile-pic { display: grid; height: 20px; place-items: center; }
.end-tile b { font-size: 20px; font-weight: 400; color: #F1F5F8; line-height: 1.1; }
.end-tile > span:last-child { font-size: 11px; color: #9DB0BC; text-align: center; }
.end-top.until { background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.end-top.until .end-what { color: #F1F5F8; font-size: 15px; font-weight: 500; }
.end-bg canvas.until-scene { image-rendering: auto; object-position: center; }
.end-share { display: flex; align-items: center; gap: 12px; }
.end-share-pic { width: 54px; height: 68px; border-radius: 8px; object-fit: cover; background: #000; flex: none; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.end-share-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 14px; }
.end-share-text .sub { font-size: 12px; }
.end-share-btn { all: unset; cursor: pointer; flex: none; display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 12px; font-size: 14px; font-weight: 500;
  background: var(--info); color: var(--bg); }
.end-share-btn { background: #2BB3F0; color: #062033; }

/* ---------- AI 成本 (settings, admins only) ---------- */
.cost-card { display: grid; gap: 6px; padding: 14px; border-radius: 18px; background: var(--surface); }
.cost-big { font-size: 34px; font-weight: 400; line-height: 1.1; }
.cost-pace { font-size: 13px; color: var(--info); }
.cost-bars { display: flex; align-items: flex-end; gap: 3px; height: 96px; }
.cost-bar { flex: 1; min-width: 3px; border-radius: 3px 3px 1px 1px; background: var(--info); opacity: .85; }
.cost-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); }
.cost-kind { display: grid; gap: 5px; }
.cost-kind + .cost-kind { padding-top: 8px; border-top: 0.5px solid var(--border); }
.cost-kind-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; }
.cost-kind-row .sub { font-size: 12px; }
.cost-share { display: block; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.cost-share i { display: block; height: 100%; background: var(--info); border-radius: 3px; }
.cost-note { margin: 0; font-size: 11px; color: var(--faint); line-height: 1.6; }

/* 改好的考卷 in 小白's chat: the two sides, the score typed in, the questions marked wrong */
.pp-sides { display: flex; gap: 8px; }
.pp-side { display: grid; gap: 3px; justify-items: center; }
.pp-side img, .pp-empty { width: 64px; height: 84px; border-radius: 8px; object-fit: cover; background: var(--bg); }
.pp-empty { display: grid; place-items: center; color: var(--faint); box-shadow: inset 0 0 0 1.5px var(--border); }
.pp-side .sub { font-size: 11px; }
.pp-subjects { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-score-row { display: flex; align-items: baseline; gap: 6px; }
.pc-card input.pp-score { width: 120px; font-size: 40px; height: auto; padding: 4px 10px; text-align: center; background: var(--bg); border: 0; border-radius: 12px; color: var(--text); }
.pc-card input.pp-total { width: 64px; text-align: center; background: var(--bg); border: 0; border-radius: 10px; color: var(--sub); }
.pp-of { color: var(--faint); font-size: 22px; }
.pp-finding { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); }
.pp-finding.found { color: var(--info); }
.pp-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); animation: pp-pulse 1s ease-in-out infinite alternate; }
@keyframes pp-pulse { from { opacity: .3; } }
.pp-head { margin: 0; font-size: 14px; }
.pp-wrong { all: unset; cursor: pointer; display: flex; align-items: flex-start; gap: 9px; }
.pp-wrong .pc-check { margin-top: 2px; }
.pp-no { font-size: 12px; color: var(--sub); }
.pp-text { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-buttons .primary { flex: 2; white-space: nowrap; }

/* ---------- the web version's front door: taking 小白 home (pages/door.js) ---------- */
.door { min-height: calc(100svh - 46px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.door:has(> .door-point.bottom, > .door-point.bottom-right) { padding-bottom: 112px; }
.door:has(> .door-point.top-right) { padding-top: 92px; }
.door-title { display: grid; gap: 6px; }
.door-title h1 { font-size: 26px; }
.door-title .sub { font-size: 14px; }
.door-act { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
.door-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.door-steps li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; color: var(--sub); font-size: 15px; line-height: 1.55; transition: color .25s; }
.door-steps .n { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--sub); font: 14px var(--pixel); transition: background .25s, color .25s; }
.door-steps li.on { color: var(--text); }
.door-steps li.on .n { background: var(--lamp); color: var(--on-lamp); }
.door-steps li.done .n { background: var(--good-soft); color: var(--good); }
.door-steps small { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; }
.glyph { display: inline-block; width: 1.15em; height: 1.15em; margin: 0 2px; vertical-align: -.2em; color: var(--lamp-text); }
.glyph svg { display: block; width: 100%; height: 100%; }
.door-actions { display: grid; gap: 10px; }
.door-actions button.quiet { justify-self: center; }
.door-hint { color: var(--faint); font-size: 13px; text-align: center; }
a.door-btn { display: block; padding: 13px 20px; border-radius: 16px; font-size: 16px; text-align: center; text-decoration: none; }
a.door-btn.primary { background: var(--lamp); color: var(--on-lamp); box-shadow: 0 4px 0 var(--lamp-deep); }

/* 小白 with a sign, pointing at the browser's own button outside the page */
.door-point { position: fixed; z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none; }
.door-point.bottom { left: 50%; bottom: calc(4px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); }
.door-point.bottom-right { right: 4px; bottom: calc(4px + env(safe-area-inset-bottom, 0px)); }
.door-point.top-right { right: 6px; top: calc(2px + env(safe-area-inset-top, 0px)); flex-direction: column-reverse; }
.door-sign { position: relative; width: 64px; height: 84px; }
.door-sign img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
/* the board in the sprite: x 7 to 28, y 27 to 34 of 32 x 42 */
.door-sign b { position: absolute; left: 21.9%; width: 68.8%; top: 64.3%; height: 19%; display: grid; place-items: center; font-weight: 400; font-size: 13px; line-height: 1; color: #5C3C24; }
.door-sign .glyph { width: 17px; height: 17px; margin: 0; color: #5C3C24; }
.door-arrow { width: 21px; height: 21px; color: var(--lamp); animation: door-bob .8s steps(2, jump-none) infinite; }
.door-arrow svg { display: block; width: 100%; height: 100%; }
.door-point.top-right .door-arrow { transform: rotate(180deg); animation-name: door-bob-up; }
@keyframes door-bob { 50% { translate: 0 5px; } }
@keyframes door-bob-up { 50% { translate: 0 -5px; } }

.door-jump, .door-done { display: grid; justify-items: center; gap: 10px; text-align: center; }
.door-jump-bear { width: 92px; image-rendering: pixelated; animation: door-hop .5s cubic-bezier(.3, 0, .5, 1) infinite alternate; }
.door-done-bear { width: 110px; image-rendering: pixelated; }
@keyframes door-hop { to { translate: 0 -16px; } }

/* the little phone acting the steps out; everything inside is in em, so the phone is drawn at any size */
.mp { --w: clamp(112px, min(38vw, calc((100svh - 330px) * 9 / 19)), 176px); flex: none; width: var(--w); aspect-ratio: 9 / 19; padding: .45em; border-radius: 2.3em; background: #070B0D; box-shadow: inset 0 0 0 .18em #2A3740; font-size: calc(var(--w) / 16); line-height: 1.3; }
.mp-screen { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 1.85em; background: var(--bg); }
.mp-site { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: .7em; padding: 2em 1.6em; }
.mp-site img { height: 4.4em; image-rendering: pixelated; }
.mp-site .mp-site-happy { display: none; }
.mp-site b { font-weight: 400; font-size: 1.5em; }
.mp-site i { width: 80%; height: .5em; border-radius: .25em; background: var(--surface-2); }
.mp-site i.short { width: 55%; }
.mp-offer { margin-top: .6em; padding: .55em 1.1em; border-radius: .9em; background: var(--lamp); color: #fff; font-size: 1.05em; box-shadow: 0 .3em 0 var(--lamp-deep); }
.mp-bar { position: absolute; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-around; gap: .5em; padding-inline: .9em; background: #1B262C; color: var(--lamp-text); transition: opacity .3s; }
.mp-bar.bottom { bottom: 0; height: 4em; padding-bottom: .7em; }
.mp-bar.top { top: 0; height: 4.4em; padding-top: 1.4em; }
.mp-bar .glyph { width: 1.6em; height: 1.6em; margin: 0; }
.mp-bar > span { display: grid; place-items: center; border-radius: .6em; }
.mp-url { flex: 1; min-width: 0; height: 2.1em; padding-inline: .6em; border-radius: 1.05em; background: #2A3740; color: var(--sub); font-size: .9em; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mp-app-title { flex: 1; color: var(--text); text-align: center; }
.mp-bar.alt { opacity: 0; }
.mp[data-scene^="out"] .mp-bar.app { opacity: 0; }
.mp[data-scene^="out"] .mp-bar.alt { opacity: 1; }
.mp[data-scene="out-bear"] .mp-site-bear { display: none; }
.mp[data-scene="out-bear"] .mp-site-happy { display: block; }
.mp-dim { position: absolute; inset: 0; z-index: 3; background: rgba(0, 0, 0, .45); opacity: 0; transition: opacity .3s; }
.mp[data-scene^="sheet"] .mp-dim, .mp[data-scene="menu"] .mp-dim, .mp[data-scene="dialog"] .mp-dim { opacity: 1; }
.mp-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; height: 64%; overflow: hidden; padding: .9em .8em; border-radius: 1.4em 1.4em 0 0; background: #22303A; transform: translateY(105%); transition: transform .4s cubic-bezier(.2, .8, .2, 1); }
.mp-sheet.app { height: auto; }
.mp[data-scene^="sheet"] .mp-sheet { transform: none; }
.mp-sheet-head { display: flex; align-items: center; gap: .7em; margin-bottom: .6em; padding-bottom: .7em; border-bottom: 1px solid var(--border); }
.mp-sheet-head img, .mp-dialog img { width: 2.6em; height: 2.6em; border-radius: .6em; }
.mp-sheet-head b, .mp-dialog-body b { display: block; font-weight: 400; font-size: 1.1em; }
.mp-sheet-head small, .mp-dialog small { color: var(--sub); font-size: .85em; }
.mp-rows { display: grid; gap: .35em; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.mp[data-scene="sheet2"] .mp-rows { transform: translateY(-3.4em); }
.mp-row { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: .6em; padding: .55em .8em; border-radius: .8em; background: #2C3B46; color: var(--text); font-size: 1.05em; transition: background .2s, filter .2s; }
.mp-row .glyph { width: 1.5em; height: 1.5em; margin: 0; color: var(--text); }
.mp-row.t-add, .mp-row.t-out, .mp-row.t-install, .mp-row.t-menu-share { box-shadow: inset 0 0 0 .15em var(--lamp); }
.mp-menu { position: absolute; z-index: 4; width: 70%; display: grid; gap: .1em; padding: .4em; border-radius: 1em; background: #22303A; opacity: 0; transform: scale(.85); transition: opacity .25s, transform .3s cubic-bezier(.2, .8, .2, 1); }
.mp-menu.br { right: .6em; bottom: 4.4em; transform-origin: bottom right; }
.mp-menu.tr { right: .6em; top: 4.6em; transform-origin: top right; }
.mp[data-scene="menu"] .mp-menu { opacity: 1; transform: none; }
.mp-menu .mp-row { flex-direction: row; justify-content: flex-start; padding: .5em .6em; background: none; }
.mp-dialog { position: absolute; z-index: 5; opacity: 0; transition: opacity .3s, transform .35s cubic-bezier(.2, .8, .2, 1); }
.mp-dialog.ios { inset: 0; padding: 1.8em .9em; background: #1B262C; transform: translateY(8%); }
.mp-dialog.droid { left: 8%; right: 8%; top: 28%; display: grid; justify-items: center; gap: .35em; padding: 1.2em 1em 1em; border-radius: 1.4em; background: #22303A; text-align: center; transform: scale(.9); }
.mp-dialog.droid img { width: 3.4em; height: 3.4em; border-radius: 1em; }
.mp-dialog.droid b { font-weight: 400; font-size: 1.1em; }
.mp[data-scene="dialog"] .mp-dialog { opacity: 1; transform: none; }
.mp-dialog-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.2em; font-size: 1.05em; }
.mp-dialog-top span { color: var(--lamp-text); }
.mp-dialog-top b { font-weight: 400; }
.mp-dialog-body, .mp-dialog-row { display: flex; align-items: center; gap: .8em; padding: .8em; border-radius: .9em; background: #22303A; }
.mp-dialog-row { justify-content: space-between; margin-top: .8em; font-size: .95em; }
.mp-toggle { position: relative; width: 2.6em; height: 1.5em; border-radius: .75em; background: var(--good); }
.mp-toggle::after { content: ""; position: absolute; right: .15em; top: .15em; width: 1.2em; height: 1.2em; border-radius: 50%; background: #fff; }
.mp-dialog-btns { display: flex; justify-content: flex-end; gap: 1.4em; width: 100%; margin-top: .7em; color: var(--lamp-text); }
.mp-home { position: absolute; inset: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 4.4em; align-content: start; gap: 1em .8em; padding: 3.4em 1.2em; background: #0E1A20; opacity: 0; transition: opacity .35s; }
.mp[data-scene="home"] .mp-home, .mp[data-scene="bear"] .mp-home { opacity: 1; }
.mp-tile { align-self: start; aspect-ratio: 1; border-radius: .8em; }
.mp-slot { position: relative; display: grid; justify-items: center; align-content: start; gap: .25em; }
.mp-icon { width: 100%; aspect-ratio: 1; border-radius: .8em; opacity: 0; }
.mp[data-scene="home"] .mp-icon, .mp[data-scene="bear"] .mp-icon { animation: mp-drop .55s .2s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes mp-drop { from { opacity: 0; transform: translateY(-5em); } 50% { opacity: 1; } to { opacity: 1; transform: none; } }
.mp-slot small { font-size: .78em; white-space: nowrap; opacity: 0; transition: opacity .3s .5s; }
.mp[data-scene="home"] .mp-slot small, .mp[data-scene="bear"] .mp-slot small { opacity: 1; }
.mp-home-bear { position: absolute; left: 50%; bottom: 72%; width: 2.8em; image-rendering: pixelated; opacity: 0; transform: translate(-50%, 1.6em) scale(.4); transition: transform .45s cubic-bezier(.3, 1.6, .5, 1), opacity .2s; }
.mp[data-scene="bear"] .mp-home-bear { opacity: 1; transform: translate(-50%, 0); }
.mp-tap { position: absolute; z-index: 9; width: 2.8em; height: 2.8em; margin: -1.4em 0 0 -1.4em; border-radius: 50%; background: rgba(255, 255, 255, .55); opacity: 0; pointer-events: none; }
.mp-tap.go { animation: mp-tap .55s ease-out; }
@keyframes mp-tap { from { opacity: .95; transform: scale(.35); } to { opacity: 0; transform: scale(1.25); } }
.mp .pressed { filter: brightness(1.6); }

/* the first launch from the home screen: 小白 digs up into its new home */
/* the whole window (a phone's screen or a computer's): the night sky, and the ground running off its bottom edge */
.arrive { position: fixed; inset: 0; z-index: 25; overflow-y: auto; display: flex; flex-direction: column; text-align: center; background: var(--bg) url("media/stars.png") repeat 0 0 / 360px 360px; image-rendering: pixelated; }
.arrive-text { margin-top: auto; padding: calc(24px + env(safe-area-inset-top, 0px)) 24px 30px; display: grid; gap: 8px; animation: arrive-in .45s 1.1s both; }
.arrive-text h1 { font-size: 30px; }
.arrive-text .sub { font-size: 14px; }
.arrive-hole { position: relative; flex: none; height: 150px; overflow: hidden; }
.arrive-bear { position: absolute; left: 50%; bottom: 0; image-rendering: pixelated; translate: -50% 105%; animation: arrive-up .5s .45s cubic-bezier(.2, .9, .3, 1.2) forwards, arrive-hop .45s 1.05s ease-out; }
.arrive-bit { position: absolute; left: 50%; bottom: 0; width: 8px; height: 8px; background: #8B5A3C; opacity: 0; animation: arrive-bit .7s calc(.3s + var(--d)) ease-out; }
.arrive-bit:nth-child(3n) { background: #6B4430; }
.arrive-ground { position: relative; flex: none; min-height: calc(max(150px, 34vh) + env(safe-area-inset-bottom, 0px)); display: grid; align-content: end; padding: 40px 20px calc(28px + env(safe-area-inset-bottom, 0px)); background: #5C4331 url("media/ground.png") repeat-x center top / 480px 90px; image-rendering: pixelated; }
.arrive-ground::before { content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 6px; background: url("media/grass-top.png") repeat-x center top / 480px 6px; image-rendering: pixelated; }
.arrive-go { width: 100%; max-width: 420px; justify-self: center; animation: arrive-in .4s 1.5s both; }
@keyframes arrive-up { to { translate: -50% 0; } }
@keyframes arrive-hop { 50% { transform: translateY(-22px); } }
@keyframes arrive-bit { from { opacity: 1; transform: none; } to { opacity: 0; transform: translate(var(--dx), var(--dy)); } }
@keyframes arrive-in { from { opacity: 0; translate: 0 10px; } }
@media (prefers-reduced-motion: reduce) {
  .door-arrow, .door-jump-bear, .arrive-text, .arrive-go, .arrive-bit { animation: none; }
  .arrive-bear { animation: none; translate: -50% 0; }
}

/* ---------- a computer, or a tablet held sideways: the tabs become a side bar and the page a column beside it,
   instead of the phone's layout stretched across the screen ---------- */
.tabs-brand { display: none; }
@media (min-width: 1000px) {
  :root { --tabs-h: 0px; --side-w: 232px; }
  body:not(.bare):not(.has-studybar):not(.locked) { padding-left: var(--side-w); }
  body:not(.bare):not(.has-studybar):not(.locked) .toast { left: calc(50% + var(--side-w) / 2); }
  .view { max-width: 760px; }
  .tabs { top: 0; right: auto; width: var(--side-w); display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    padding: calc(22px + env(safe-area-inset-top, 0px)) 14px 22px; border-top: 0; border-right: 1px solid var(--border); }
  .tabs-brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 22px; font-size: 19px; letter-spacing: .08em; color: var(--text); }
  .tabs-brand img { width: 36px; height: 36px; border-radius: 10px; }
  .tabs button { height: 48px; display: flex; align-items: center; justify-content: flex-start; gap: 14px; padding: 0 14px; border-radius: 14px; font-size: 15px; color: var(--sub); }
  .tabs button:hover { background: var(--surface-2); color: var(--text); }
  .tabs button[aria-current="page"] { background: var(--surface-3); color: var(--text); }
  .tabs button[aria-current="page"] .icon { background: none; box-shadow: none; }
  .tabs button.snap .ring { width: 30px; height: 30px; margin: 0; border: 0; border-radius: 0; background: none; }
  .tabs button.snap .bear-box { width: 30px !important; height: 30px !important; }
  .tabs button.snap .bear-box img { height: 30px !important; }
  * { scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
}
