:root {
  --bg: #f6f3ee; --card: #ffffff; --fg: #1f1d1a; --muted: #77716a; --line: #e6e0d7;
  --accent: #c2603a; --accent-soft: #f3dfd5; --ok: #3f7d58; --ok-soft: #dcebe1;
  --warn: #b5832a; --warn-soft: #f4e7cc; --bad: #b4473a; --chip: #efeae2;
  --i: #6a5acd; --p: #2f86a6; --o: #c2603a; --x: #9a7b2c;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1a18; --card: #252320; --fg: #eeeae4; --muted: #a39d94; --line: #36332e;
    --accent: #e0845f; --accent-soft: #4a3329; --ok: #7cc095; --ok-soft: #26392d;
    --warn: #e0b45e; --warn-soft: #3f3422; --bad: #e57b6d; --chip: #302d29;
    --i: #a99cf0; --p: #6cc0de; --o: #e0845f; --x: #d9b65e;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 16px; -webkit-text-size-adjust: 100%; }
body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

#main { max-width: 600px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px 24px; }
.view { display: flex; flex-direction: column; gap: 14px; }

h1.title { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 4px 0 0; letter-spacing: .01em; }
.sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.today-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.today-tools { display: flex; gap: 8px; }
.today-tools .btn { min-height: 44px; }
h2 { font-size: 15px; font-weight: 600; margin: 8px 0 0; color: var(--muted); letter-spacing: .02em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; }

/* A small entry point, with lecture records available on demand. */
.lecture-focus { border-top: 3px solid var(--accent); padding: 20px; }
.lecture-focus h2 { margin: 0 0 14px; color: var(--fg); font-size: 18px; }
.lf-next { background: var(--chip); border-radius: 10px; padding: 16px; min-width: 0; }
.lf-kicker { color: var(--muted); font-size: 13px; }
.lf-next h3 { font-size: 20px; font-weight: 500; margin: 8px 0; line-height: 1.4; overflow-wrap: anywhere; }
.lf-copy { font-size: 15px; line-height: 1.65; margin: 10px 0; }
.lf-note, .lf-footnote { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 8px 0 0; }
.lf-next .btns { margin-top: 14px; }
.lecture-focus .btn { min-height: 44px; }
button:focus-visible, summary:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.lecture-focus .btn:disabled { opacity: .65; cursor: wait; }
.lf-upcoming { margin-top: 16px; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.lf-upcoming b { display: block; margin-top: 4px; }
.lf-location { display: block; color: var(--muted); font-size: 13px; }
.lf-backlog { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; font-size: 14px; }
.lf-backlog summary, .study-recap summary { cursor: pointer; line-height: 1.6; min-height: 32px; }
.lf-backlog .btn { margin-top: 10px; }
.lf-stats { display: flex; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.lf-stats > div { display: flex; flex-direction: column; gap: 3px; }
.lf-stats b { font-size: 20px; font-weight: 500; }
.lf-stats span { font-size: 12px; color: var(--muted); }
.study-clock { font-family: var(--serif); font-size: 32px; line-height: 1.3; margin-top: 16px; }
.study-recap { background: var(--ok-soft); border-radius: 10px; padding: 12px 16px; margin-bottom: 14px; font-size: 14px; line-height: 1.6; }
.study-recap .row { align-items: flex-start; }
.study-recap details { margin-top: 6px; }
.q-practice { margin: 0; font-size: 14px; line-height: 1.65; padding: 10px 12px; border-radius: 10px; background: var(--chip); }
@media (max-width: 700px) {
  .lecture-focus { padding: 16px; }
  .lf-next .btns { flex-direction: column; align-items: stretch; }
  .lf-stats { gap: 12px; }
  .study-recap { padding: 12px; }
}

/* countdown strip */
.counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.count { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); }
.count .n { font-family: var(--serif); font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count .n small { font-family: var(--sans); font-size: 13px; color: var(--muted); margin-left: 2px; }
.count .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* phase banner */
.phase { border-radius: var(--radius); padding: 12px 14px; background: var(--accent-soft); font-size: 14px; line-height: 1.5; }
.phase b { font-weight: 600; }

/* tasks */
.tasks { display: flex; flex-direction: column; }
.task { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.task:last-child { border-bottom: 0; }
.task .box { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; color: transparent; }
.task.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.task.done .t-main { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.task .t-main { font-size: 15px; line-height: 1.35; }
.task .t-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.task .grow { flex: 1; min-width: 0; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--chip); color: var(--muted); margin-right: 4px; white-space: nowrap; }
.tag.I { color: var(--i); } .tag.P { color: var(--p); } .tag.O { color: var(--o); } .tag.X { color: var(--x); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.acc { background: var(--accent-soft); color: var(--accent); }

.btn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-size: 14px; }
.btn.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

.info-list { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.info-list .d { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 4.8em; display: inline-block; margin-right: 8px; }

/* chips / filters */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
input[type=search], input[type=text], input[type=password], input[type=date], input[type=number], textarea {
  width: 100%; font: inherit; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
textarea { min-height: 70px; resize: vertical; }

/* course cards */
.course { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.course:last-child { border-bottom: 0; }
.course .name { font-size: 15px; font-weight: 500; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; }
.dots i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.dots i.on { background: var(--muted); }
.dots i.today { background: var(--accent); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; }
.step { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 4px 10px; font-size: 13px; cursor: pointer; color: var(--muted); }
.step.on { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.step.locked { opacity: .55; }

/* paper list */
.q-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.q-row:last-child { border-bottom: 0; }
.q-row .grow { flex: 1; min-width: 0; }
.q-row .q-title { font-size: 14.5px; }
.q-row .q-topic { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.done { background: var(--ok-soft); color: var(--ok); }
.pill.solid { background: var(--ok); color: var(--card); }
.pill.redo { background: var(--warn-soft); color: var(--warn); }

/* progress bars */
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; display: flex; }
.bar i { display: block; height: 100%; }
.prog { display: grid; grid-template-columns: 6.5em 1fr 5em; align-items: center; gap: 10px; font-size: 14px; padding: 4px 0; }
.prog .v { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }

/* heatmap */
.heat { display: grid; gap: 3px; font-size: 11px; align-items: center; }
.heat .lab { color: var(--muted); white-space: nowrap; padding-right: 4px; }
.heat .yr { color: var(--muted); text-align: center; }
.heat .c { aspect-ratio: 1; border-radius: 4px; background: var(--line); position: relative; }
.heat .c span { position: absolute; inset: 0; border-radius: 4px; background: var(--ok); }
.heat .c.w::after { content: ""; position: absolute; top: 2px; right: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }

/* week bars */
.wk { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; align-items: end; height: 110px; }
.wk .b { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 11px; color: var(--muted); }
.wk .b i { display: block; width: 70%; max-width: 26px; border-radius: 4px 4px 2px 2px; background: var(--accent); min-height: 2px; }
.wk .b.cur i { background: var(--fg); }
.wk .b i.zero { background: var(--line); }
a.btn { color: inherit; text-decoration: none; }

.settings { display: grid; grid-template-columns: 1fr 9.5em; gap: 8px 12px; align-items: center; font-size: 14px; }

/* tab bar */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
#tabs button { flex: 1; max-width: 150px; background: none; border: 0; padding: 8px 0 9px; display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
#tabs button .ic { margin-bottom: 1px; }
#tabs button[aria-current="page"] { color: var(--fg); font-weight: 600; }

/* bottom sheet */
#sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 20; }
#sheet { position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 600px; background: var(--card); border-radius: 18px 18px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); z-index: 21; display: flex; flex-direction: column; gap: 12px; max-height: 85vh; overflow: auto; }
#sheet h3 { margin: 0; font-size: 18px; font-weight: 600; }
.status-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.status-btns button { padding: 12px 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; }
.status-btns button.sel-done { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.status-btns button.sel-solid { background: var(--ok); color: var(--card); border-color: var(--ok); }
.status-btns button.sel-redo { background: var(--warn-soft); color: var(--warn); border-color: var(--warn); }

#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom)); background: var(--fg); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-size: 14px; z-index: 30; }

.login { max-width: 320px; margin: 22vh auto 0; display: flex; flex-direction: column; gap: 12px; padding: 0 16px; }
.login h1 { font-family: var(--serif); font-weight: 400; font-size: 28px; margin: 0 0 8px; text-align: center; }
.err { color: var(--bad); font-size: 14px; min-height: 1.2em; margin: 0; text-align: center; }
.empty { color: var(--muted); font-size: 14px; padding: 6px 0; line-height: 1.5; }
.more { text-align: center; padding-top: 10px; }

/* layout containers (stack on phones) */
.two, .grid2, .grid3 { display: flex; flex-direction: column; gap: 14px; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.heat .c b { display: none; }

/* topic table */
.tscroll { max-height: 460px; overflow: auto; margin: 0 -4px; }
table.tt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tt th { position: sticky; top: 0; background: var(--card); text-align: left; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 6px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tt td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tt tbody tr { cursor: pointer; }
.tt tbody tr:hover td { background: var(--chip); }
.tt .r { text-align: right; }
@media (max-width: 560px) { .hide-sm { display: none; } }

/* ---------------- desktop ---------------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 210px; }
  #tabs { top: 0; bottom: 0; right: auto; width: 210px; flex-direction: column; justify-content: flex-start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); padding: 28px 14px; background: var(--bg); backdrop-filter: none; }
  #tabs::before { content: "Part IB"; font-family: var(--serif); font-size: 22px; padding: 0 12px 18px; }
  #tabs button { flex: none; max-width: none; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 15px; padding: 10px 12px; border-radius: 10px; }
  #tabs button:hover { background: var(--chip); }
  #tabs button[aria-current="page"] { background: var(--chip); }
  #main { max-width: 1180px; padding: 36px 44px 48px; }
  h1.title { font-size: 34px; }
  .counts { grid-template-columns: repeat(3, minmax(0, 220px)); }
  .two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; gap: 18px; }
  .grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .grid2 .span2 { grid-column: 1 / -1; }
  .grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; align-items: start; }
  #view-papers .card { max-width: 820px; }
  .heat { gap: 4px; font-size: 12px; }
  .heat .c { aspect-ratio: auto; height: 34px; }
  .heat .c b { display: grid; place-items: center; position: absolute; inset: 0; font-weight: 400; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
  .heat .c b.inv { color: var(--card); }
  .heat .c { cursor: pointer; }
  .heat .c:hover { outline: 2px solid var(--fg); outline-offset: 1px; }
  .task:hover .box { border-color: var(--muted); }
  #sheet { top: 50%; bottom: auto; left: 50%; right: auto; transform: translate(-50%, -50%); width: 520px; border-radius: 18px; padding: 24px; }
  #toast { bottom: 28px; margin-left: 105px; }
  .settings { max-width: 560px; }
}

/* lecture timetable */
.task.lec { gap: 14px; }
.lec-time { flex: none; width: 3.2em; font-size: 14px; color: var(--accent); font-weight: 600; }
.task.lec.past .lec-time { color: var(--muted); font-weight: 400; }

/* lectures page */
.counts.four { grid-template-columns: repeat(4, 1fr); }
.count.c-done .n { color: var(--ok); } .count.c-missed .n { color: var(--bad); } .count.c-today .n { color: var(--accent); }
.ld-done { background: var(--ok); } .ld-missed { background: var(--bad); } .ld-today { background: var(--accent); } .ld-upcoming { background: var(--line); }
.lc-row { display: grid; grid-template-columns: minmax(0, 16em) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.lc-row:last-of-type { border-bottom: 0; }
.lc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.lc-dots i { width: 14px; height: 14px; border-radius: 50%; cursor: pointer; }
.lc-dots i:hover { outline: 2px solid var(--fg); outline-offset: 1px; }
.lc-num { color: var(--muted); font-size: 13px; text-align: right; white-space: nowrap; }
.lc-miss { color: var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.lw { display: flex; gap: 8px; align-items: flex-end; height: 150px; margin-top: 10px; overflow-x: auto; }
.lw-col { flex: 1; min-width: 34px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; color: var(--muted); }
.lw-bar { width: 70%; max-width: 30px; display: flex; flex-direction: column; border-radius: 5px; overflow: hidden; min-height: 4px; }
.lw-bar i { display: block; }
.lw-col.cur span { color: var(--fg); font-weight: 600; }
.lec-day { font-size: 12.5px; color: var(--muted); padding: 12px 0 2px; font-weight: 600; position: sticky; top: 0; background: var(--card); z-index: 1; }
.lec-day.today { color: var(--accent); }
.lec-list { max-height: 560px; }
.pill.lp-done { background: var(--ok-soft); color: var(--ok); }
.pill.lp-missed { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.pill.lp-today { background: var(--accent-soft); color: var(--accent); }
.pill.lp-upcoming { background: var(--chip); color: var(--muted); }
.task.lec.st-missed .lec-time { color: var(--bad); }
.task.lec.st-upcoming .lec-time { color: var(--muted); font-weight: 400; }
.feed-box { white-space: pre-wrap; word-break: break-all; background: var(--chip); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; line-height: 1.6; margin: 0 0 10px; font-family: inherit; }
@media (max-width: 560px) { .counts.four { grid-template-columns: repeat(2, 1fr); } .lc-row { grid-template-columns: minmax(0, 8em) 1fr auto; } }
.lw-col span { white-space: nowrap; font-size: 11px; }

/* per-lecture chips on the courses page */
.lchips { display: flex; flex-wrap: wrap; gap: 6px; }
.lchip { border: 1px solid var(--line); background: transparent; color: var(--fg); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; cursor: pointer; display: inline-flex; gap: 5px; align-items: baseline; font-variant-numeric: tabular-nums; }
.lchip small { color: var(--muted); font-size: 11px; }
.lchip.lc-done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.lchip.lc-missed { border-color: var(--bad); color: var(--bad); }
.lchip.lc-today { border-color: var(--accent); color: var(--accent); }
.lchip.lc-upcoming { opacity: .6; }
.lchip .lchip-cu { color: var(--warn); font-weight: 600; }
.cu-tag { color: var(--warn); }

/* courses page: charts + term folds */
.term-select { font: inherit; font-size: 13.5px; color: var(--fg); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.subj-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.subj { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.subj.total { background: var(--chip); border-color: transparent; }
.subj-h { font-size: 13.5px; font-weight: 600; }
.donut { --p: 0; --c: var(--fg); width: 104px; height: 104px; border-radius: 50%; margin: 2px auto; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; }
.donut-in { width: 76px; height: 76px; border-radius: 50%; background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.subj.total .donut-in { background: var(--chip); }
.donut-in b { font-family: var(--serif); font-weight: 400; font-size: 22px; line-height: 1.1; }
.donut-in small { font-size: 10.5px; color: var(--muted); }
.mini { display: flex; flex-direction: column; gap: 4px; }
.mini .small { font-size: 11.5px; }
details.term-fold { background: transparent; }
details.term-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
details.term-fold > summary::-webkit-details-marker { display: none; }
details.term-fold > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.term-fold[open] > summary::before { transform: rotate(90deg); }
details.term-fold[open] > summary { margin-bottom: 12px; }
.term-name { font-family: var(--serif); font-size: 19px; }
.term-meta { margin-left: auto; }
.term-grid { margin-bottom: 4px; }
@media (min-width: 900px) { .term-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); } }
.term-grid .span-all { grid-column: 1 / -1; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
.opt-card { padding-top: 2px; padding-bottom: 2px; }
.opt-card .course { border-bottom: 0; }
/* weekly report */
.weekly .counts { margin-bottom: 12px; }
.weekly .count { box-shadow: none; }
@media (max-width: 560px) { .counts.four { grid-template-columns: repeat(2, 1fr); } }
.wk-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.wk-sec h3 { font-size: 13.5px; font-weight: 600; margin: 0 0 6px; }
.wk-sec { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wk-row { display: flex; align-items: center; gap: 6px; font-size: 13.5px; line-height: 1.35; }
.wk-row .grow { flex: 1; min-width: 0; }
.wk-row .d { color: var(--muted); min-width: 3.2em; font-size: 12.5px; }
.week-banner { cursor: pointer; background: var(--accent-soft); border-color: transparent; }
/* quotes */
.quote-card { display: flex; flex-direction: column; gap: 8px; }
.quote-line { font-family: var(--serif); font-size: 17px; line-height: 1.55; cursor: pointer; }
.quote-line.big { font-size: 21px; cursor: default; }
.quote-hero { display: flex; flex-direction: column; gap: 10px; background: var(--accent-soft); border-color: transparent; margin-bottom: 14px; line-height: 1.6; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.seg button { font: inherit; font-size: 13.5px; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.seg button.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.quote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 12px; }
.quote-item { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.quote-item .quote-line { cursor: default; }
.q-why { font-size: 13.5px; line-height: 1.6; }
.q-use { font-size: 13.5px; line-height: 1.6; background: var(--chip); border-radius: 10px; padding: 8px 10px; align-self: stretch; }
/* morning screen */
#morning { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow: auto; display: flex; align-items: center; justify-content: center; padding: calc(24px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom)); }
#morning .m-inner { max-width: 560px; width: 100%; display: flex; flex-direction: column; gap: 14px; }
#morning .m-hello { font-family: var(--serif); font-size: 18px; color: var(--accent); }
#morning .m-quote { font-family: var(--serif); font-size: clamp(24px, 6.4vw, 32px); line-height: 1.45; }
#morning .m-why { font-size: 14.5px; line-height: 1.7; color: var(--muted); }
#morning .m-next { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 4px; font-size: 16px; }
#morning .m-btns { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.btn.big { font-size: 17px; padding: 14px 18px; border-radius: 14px; }
.m-steps { margin: 0 0 10px; padding-left: 20px; font-size: 13.5px; line-height: 1.7; }
.wk.wake { grid-template-columns: repeat(10, 1fr); gap: 3px; }
.wk.wake .b { font-size: 10px; }
/* recording links */
.rec-btn { flex: none; font: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 5px 10px; cursor: pointer; }
.rec-btn.unset { background: transparent; border-color: var(--line); color: var(--muted); font-weight: 400; }
.rec-btn:active { transform: scale(.97); }
.rec-edit { font: inherit; font-size: 12px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; }
/* tap text = recording, tap circle = done */
.name.rec-link { cursor: pointer; }
.task .box { position: relative; cursor: pointer; }
.task .box::after { content: ""; position: absolute; inset: -12px; }
/* tap text = recording, tap circle = done */
.rec-link { cursor: pointer; }
.task .box { position: relative; cursor: pointer; }
.task .box::after { content: ""; position: absolute; inset: -12px; }
