@font-face { font-family: 'Bricolage Grotesque'; font-style: normal; font-weight: 500 800; font-stretch: 75% 100%; font-display: swap; src: url(/fonts/bricolage.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/figtree.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/figtree-italic.woff2) format('woff2'); }

/* Palette: graph-paper mint ground, bottle-ink green for ticks, highlighter yellow for "revisit". */
:root {
  color-scheme: light;
  --paper: #E9EFED;
  --grid: rgba(24, 74, 62, .06);
  --sheet: #FAFCFB;
  --sheet-2: #F0F5F3;
  --ink: #15201D;
  --ink-2: #53625E;
  --ink-3: #85938F;
  --rule: #D8E0DD;
  --rule-2: #C4D0CC;
  --accent: #0B7A66;
  --accent-ink: #FFFFFF;
  --accent-soft: #D2EBE4;
  --hl: #FFE14D;
  --hl-mark: rgba(255, 222, 60, .62);
  --easy: #13805A;
  --med: #A2650A;
  --hard: #BF3A2A;
  --lift: 0 1px 0 rgba(21, 32, 29, .04), 0 10px 30px -18px rgba(21, 32, 29, .35);
  --fab: #15201D;
  --fab-ink: #F4F8F6;
  --toast-act: #FFE14D;

  --f-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --f-body: 'Figtree', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --s-12: .75rem; --s-14: .875rem; --s-16: 1rem; --s-18: 1.125rem; --s-22: 1.375rem; --s-28: 1.75rem; --s-44: 2.75rem;
  --gutter: 16px;
  --nav-h: 64px;
  --maxw: 680px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #0E1413;
    --grid: rgba(150, 220, 196, .045);
    --sheet: #151D1B;
    --sheet-2: #1B2522;
    --ink: #E3ECE9;
    --ink-2: #9BABA6;
    --ink-3: #6B7B77;
    --rule: #25312E;
    --rule-2: #33423E;
    --accent: #3DCBA8;
    --accent-ink: #062019;
    --accent-soft: #163730;
    --hl: #EBD03F;
    --hl-mark: rgba(235, 208, 63, .30);
    --easy: #4CC592;
    --med: #E3A640;
    --hard: #F27461;
    --lift: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 32px -16px rgba(0, 0, 0, .7);
    --fab: #E3ECE9;
    --fab-ink: #0E1413;
    --toast-act: #0B7A66;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--ink);
  font: 400 var(--s-16)/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); }
svg { display: block; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  background: var(--sheet-2); color: var(--ink); font-weight: 600; font-size: var(--s-14);
  border: 1px solid var(--rule); text-decoration: none; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--ink-2); padding: 0 10px; }
.btn.danger { color: var(--hard); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: var(--sheet-2); }

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter); }
.login-card { width: 100%; max-width: 380px; display: grid; gap: 12px; }
.login-card h1 { font-size: var(--s-44); font-weight: 800; letter-spacing: -.02em; line-height: 1; margin-top: 8px; }
.login-card .lede { color: var(--ink-2); margin: 0 0 16px; }
.login-card label { font-weight: 600; font-size: var(--s-14); }
.login-card input {
  min-height: 52px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--rule-2);
  background: var(--sheet); font-size: var(--s-16);
}
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.pass-wrap { position: relative; }
.pass-wrap input { width: 100%; padding-right: 96px; }
.pass-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  min-height: 40px; padding: 0 12px; border-radius: 10px; display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-2); font-size: var(--s-14); font-weight: 600;
}
.pass-eye:hover { background: var(--sheet-2); color: var(--ink); }
.pass-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.pass-eye .eye-shut, .pass-eye[aria-pressed="true"] .eye-open { display: none; }
.pass-eye[aria-pressed="true"] .eye-shut { display: block; }
.brand-mark svg { width: 56px; height: 56px; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: none; stroke: var(--accent-ink); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
.err { color: var(--hard); font-size: var(--s-14); margin: 0; }

/* ---------- App frame ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.top.scrolled { border-bottom-color: var(--rule); }
.top-in { max-width: var(--maxw); margin: 0 auto; padding: 10px var(--gutter) 10px; display: flex; align-items: center; gap: 8px; min-height: 60px; }
.top h1 { font-size: var(--s-28); font-weight: 750; letter-spacing: -.02em; flex: 1; min-width: 0; line-height: 1.1; }
.top-actions { display: flex; align-items: center; gap: 2px; }
.sync { display: inline-flex; align-items: center; gap: 6px; font-size: var(--s-12); color: var(--ink-3); padding: 0 6px; white-space: nowrap; }
.sync i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.sync[data-state="pending"] i { background: var(--med); animation: pulse 1s ease-in-out infinite; }
.sync[data-state="offline"] i, .sync[data-state="error"] i { background: var(--ink-3); }
@keyframes pulse { 50% { opacity: .3; } }

main {
  padding: 4px var(--gutter) calc(var(--nav-h) + 110px + env(safe-area-inset-bottom, 0px));
  outline: none;
}

.view-in { max-width: calc(var(--maxw) - 2 * var(--gutter)); margin: 0 auto; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: color-mix(in srgb, var(--sheet) 92%, transparent);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs-in { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11.5px; font-weight: 600; position: relative; }
.tabs button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs button[aria-current="page"] { color: var(--ink); }
.tabs button[aria-current="page"] svg { stroke: var(--accent); stroke-width: 2.1; }
.tabs button[aria-current="page"]::after {
  content: ''; position: absolute; top: 0; left: 50%; width: 28px; height: 3px; margin-left: -14px;
  border-radius: 0 0 3px 3px; background: var(--accent);
}

.fab {
  position: fixed; z-index: 31; right: max(var(--gutter), calc((100vw - var(--maxw)) / 2 + var(--gutter)));
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px));
  height: 52px; padding: 0 20px 0 16px; border-radius: 26px;
  background: var(--fab); color: var(--fab-ink);
  display: inline-flex; align-items: center; gap: 8px; font-weight: 650; font-size: var(--s-16);
  box-shadow: 0 10px 24px -8px rgba(0,0,0,.45);
}
.fab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fab:active { transform: scale(.97); }
body.timing .fab { bottom: calc(var(--nav-h) + 84px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Home ---------- */
.hero { padding: 8px 0 22px; }
.hero-week { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.hero-week b { font-family: var(--f-display); font-size: clamp(3.4rem, 17vw, 5.2rem); font-weight: 800; letter-spacing: -.045em; line-height: .9; font-variant-numeric: tabular-nums; }
.hero-week span { font-family: var(--f-display); font-size: var(--s-22); font-weight: 600; color: var(--ink-2); }
.hero-sub { color: var(--ink-2); margin: 10px 0 0; max-width: 34em; }
.hero-sub strong { color: var(--ink); font-weight: 650; }

.tape { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; margin: 20px 0 6px; }
.tape i { height: 22px; border-radius: 3px; background: var(--rule); }
.tape i.past { background: var(--ink-2); opacity: .55; }
.tape i.now { background: var(--hl); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 25%, transparent); height: 30px; margin-top: -4px; }
.tape i.gap { margin-right: 5px; }
.tape-legend { display: grid; grid-template-columns: 8fr 6fr 6fr 4fr; gap: 8px; font-size: var(--s-12); color: var(--ink-3); }
.tape-legend span.on { color: var(--ink); font-weight: 650; }
.startline { margin-top: 14px; display: flex; align-items: center; gap: 8px; font-size: var(--s-14); color: var(--ink-2); flex-wrap: wrap; }
.startline input[type="date"] { min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--rule-2); background: var(--sheet); }
.link-btn { color: var(--accent); font-weight: 600; font-size: var(--s-14); min-height: 36px; padding: 0 4px; }

.block { margin-top: 26px; }
.block-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.block-h h2 { font-size: var(--s-18); font-weight: 700; letter-spacing: -.01em; }
.block-h .aside { font-size: var(--s-14); color: var(--ink-3); }

.paper { background: var(--sheet); border: 1px solid var(--rule); border-radius: 16px; box-shadow: var(--lift); overflow: hidden; }

.progress-list { list-style: none; margin: 0; padding: 0; }
.progress-list li + li { border-top: 1px solid var(--rule); }
.prog { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; align-items: center; }
.prog-name { font-weight: 650; }
.prog-count { font-family: var(--f-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.prog-count small { color: var(--ink-3); font-weight: 500; font-size: var(--s-14); }
.bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--sheet-2); box-shadow: inset 0 0 0 1px var(--rule); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s cubic-bezier(.2,.8,.2,1); }
.prog-next { grid-column: 1 / -1; font-size: var(--s-14); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prog-next b { color: var(--ink-3); font-weight: 500; }

.due-list { list-style: none; margin: 0; padding: 0; }
.due-list li + li { border-top: 1px solid var(--rule); }
.due { width: 100%; text-align: left; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 16px; align-items: center; min-height: 56px; }
.due-t { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.due-w { font-size: var(--s-14); color: var(--ink-3); }
.due-when { font-size: var(--s-14); font-weight: 650; color: var(--ink-2); grid-row: 1 / span 2; grid-column: 2; }
.due-when.late { color: var(--hard); }
.due-when.today { color: var(--accent); }
.empty-line { padding: 16px; color: var(--ink-2); margin: 0; font-size: var(--s-14); }

.heat-wrap { padding: 16px; }
.heat-top { display: flex; gap: 22px; margin-bottom: 14px; flex-wrap: wrap; }
.stat b { display: block; font-family: var(--f-display); font-size: var(--s-28); font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: var(--s-12); color: var(--ink-3); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; width: 100%; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--sheet-2); box-shadow: inset 0 0 0 1px var(--rule); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 28%, var(--sheet)); box-shadow: none; }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 52%, var(--sheet)); box-shadow: none; }
.heat i.l3 { background: color-mix(in srgb, var(--accent) 76%, var(--sheet)); box-shadow: none; }
.heat i.l4 { background: var(--accent); box-shadow: none; }
.heat i.today { outline: 2px solid var(--ink); outline-offset: 1px; }
.heat i.future { visibility: hidden; }
.heat-foot { display: flex; justify-content: space-between; font-size: var(--s-12); color: var(--ink-3); margin-top: 8px; }

.rating { padding: 16px; display: grid; gap: 14px; }
.rating-now { display: flex; align-items: baseline; gap: 10px; }
.rating-now b { font-family: var(--f-display); font-size: var(--s-44); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.rating-now .delta { font-weight: 650; font-size: var(--s-14); }
.delta.up { color: var(--easy); } .delta.down { color: var(--hard); }
.scale { position: relative; height: 34px; }
.scale-track { position: absolute; left: 0; right: 0; top: 8px; height: 8px; border-radius: 4px; background: var(--sheet-2); box-shadow: inset 0 0 0 1px var(--rule); }
.scale-fill { position: absolute; left: 0; top: 8px; height: 8px; border-radius: 4px; background: var(--accent); }
.scale-mark { position: absolute; top: 2px; width: 2px; height: 20px; background: var(--ink); border-radius: 1px; }
.scale-mark span { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--ink-2); white-space: nowrap; font-weight: 600; }
.rating-form { display: flex; gap: 8px; }
.rating-form input { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--rule-2); background: var(--sheet); font-variant-numeric: tabular-nums; }
.rating-help { font-size: var(--s-14); color: var(--ink-2); margin: 0; }

/* ---------- Section intro, segments, chips ---------- */
.intro { display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; padding: 6px 0 16px; flex-wrap: wrap; }
.intro-count { font-family: var(--f-display); font-weight: 800; font-size: var(--s-44); letter-spacing: -.035em; line-height: .95; font-variant-numeric: tabular-nums; }
.intro-count small { font-size: var(--s-22); color: var(--ink-3); font-weight: 600; letter-spacing: -.01em; }
.intro p { margin: 6px 0 0; color: var(--ink-2); font-size: var(--s-14); max-width: 32em; }
.intro-l { flex: 1 1 240px; }

.seg { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gutter)) 12px; padding: 2px var(--gutter); scroll-snap-type: x proximity; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 20px; font-weight: 600; font-size: var(--s-14);
  background: var(--sheet); border: 1px solid var(--rule); color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; scroll-snap-align: start;
}
.seg button small { font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.seg button[aria-pressed="true"] small { color: color-mix(in srgb, var(--paper) 70%, transparent); }

.chips { display: flex; gap: 4px; margin: 0 0 14px; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: var(--s-14); font-weight: 600; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.chips button small { font-variant-numeric: tabular-nums; font-weight: 500; }
.chips button[aria-pressed="true"] { color: var(--ink); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule-2); }
.chips button.hl-chip[aria-pressed="true"] { background: var(--hl-mark); box-shadow: none; }

/* ---------- Checklist rows ---------- */
.group { margin-bottom: 10px; }
.group.is-open { margin-bottom: 22px; }
.group-h {
  width: 100%; text-align: left; display: grid; grid-template-columns: 1fr 22px; align-items: center; gap: 8px 12px;
  padding: 14px 16px; border-radius: 14px; background: var(--sheet); border: 1px solid var(--rule);
}
.group.is-open .group-h { background: transparent; border-color: transparent; padding: 10px 4px 10px 2px; }
.group-n { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-width: 0; }
.group-h h2 { font-size: var(--s-16); font-weight: 700; letter-spacing: -.005em; }
.group-h .count { font-size: var(--s-14); color: var(--ink-3); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.group-h .count.full { color: var(--accent); }
.gbar { grid-column: 1; height: 4px; border-radius: 2px; background: var(--sheet-2); overflow: hidden; }
.gbar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.group.is-open .gbar { display: none; }
.chev { grid-column: 2; grid-row: 1 / span 2; color: var(--ink-3); transition: transform .2s; }
.chev svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.group.is-open .chev { transform: rotate(180deg); grid-row: 1; }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: 52px 1fr 48px; align-items: start; position: relative; }
.row + .row { border-top: 1px solid var(--rule); }
.row.open { background: var(--sheet-2); }
.row.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { background: var(--hl-mark); } }

.chk { width: 52px; min-height: 56px; display: grid; place-items: center; align-self: stretch; }
.chk .box {
  width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--rule-2); background: var(--sheet);
  display: grid; place-items: center; transition: background .18s, border-color .18s, transform .12s;
}
.chk svg { width: 16px; height: 16px; fill: none; stroke: var(--accent-ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.chk svg path { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset .26s cubic-bezier(.3,.7,.2,1) .05s; }
.chk:active .box { transform: scale(.88); }
.row.done .chk .box { background: var(--accent); border-color: var(--accent); }
.row.done .chk svg path { stroke-dashoffset: 0; }

.ring3 { width: 26px; height: 26px; position: relative; display: grid; place-items: center; transition: transform .12s; }
.ring3 svg { position: absolute; inset: 0; width: 26px; height: 26px; transform: rotate(-90deg); }
.ring3 circle { fill: none; stroke: var(--rule-2); stroke-width: 3; stroke-linecap: round; transition: stroke .2s; }
.ring3 circle.on { stroke: var(--accent); }
.ring3 b { font-size: 11px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.chk:active .ring3 { transform: scale(.88); }

.body { text-align: left; padding: 15px 2px 14px 0; min-height: 56px; display: grid; gap: 5px; min-width: 0; }
.title { font-size: var(--s-16); line-height: 1.4; font-weight: 500; overflow-wrap: anywhere; }
.title .num { color: var(--ink-3); font-weight: 600; font-variant-numeric: tabular-nums; margin-right: 6px; font-size: var(--s-14); }
.row.done .title { color: var(--ink-3); }
.row.done .title .mark { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--accent) 70%, transparent); text-decoration-thickness: 1.5px; }
.row.hl .title .mark {
  background: linear-gradient(104deg, transparent .2em, var(--hl-mark) .3em, var(--hl-mark) calc(100% - .3em), transparent calc(100% - .2em)) 0 72% / 100% 58% no-repeat;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
  color: var(--ink);
}
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: var(--s-12); color: var(--ink-3); font-weight: 500; }
.meta svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.meta .has-note { display: inline-flex; align-items: center; gap: 4px; }
.diff { font-weight: 650; display: inline-flex; align-items: center; gap: 5px; }
.diff::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.diff.e { color: var(--easy); } .diff.m { color: var(--med); } .diff.h { color: var(--hard); }
.often { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 600; }
.often svg { fill: currentColor; stroke: none; width: 12px; height: 12px; }
.sec-tag { color: var(--ink-2); font-weight: 600; }
.pips { display: inline-flex; gap: 4px; }
.pips i { width: 16px; height: 6px; border-radius: 3px; background: var(--rule-2); }
.pips i.ok { background: var(--accent); }
.pips i.log { background: var(--ink-2); }
.pips i.over { background: var(--med); }

.hlbtn { width: 48px; min-height: 56px; display: grid; place-items: center; color: var(--ink-3); align-self: stretch; }
.hlbtn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hlbtn[aria-pressed="true"] { color: var(--ink); }
.hlbtn[aria-pressed="true"] svg .tip { fill: var(--hl); stroke: var(--ink); }

.detail { grid-column: 2 / 4; padding: 0 16px 16px 0; display: grid; gap: 14px; }
.detail p { margin: 0; color: var(--ink-2); font-size: var(--s-14); max-width: 60ch; }
.detail .lbl { display: block; font-size: var(--s-12); font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.detail .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.attempts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.att { border-radius: 12px; border: 1px solid var(--rule); background: var(--sheet); padding: 10px; display: grid; gap: 2px; text-align: left; min-height: 76px; align-content: start; }
.att-k { font-size: var(--s-12); font-weight: 700; }
.att-w { font-size: 11.5px; color: var(--ink-3); }
.att-v { font-size: var(--s-14); font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; }
.att.filled { border-color: transparent; background: var(--accent-soft); }
.att.filled.over { background: color-mix(in srgb, var(--med) 16%, var(--sheet)); }
.att.next { border: 1.5px dashed var(--rule-2); }
.att.next .att-v { color: var(--accent); }
.att.locked { opacity: .55; }
.att .undo { font-size: 11.5px; color: var(--ink-3); text-decoration: underline; text-underline-offset: 2px; margin-top: 2px; justify-self: start; }
.due-note { font-size: var(--s-14); color: var(--ink-2); margin: -4px 0 0; }
.due-note b { color: var(--ink); }

.note-field { display: grid; gap: 6px; }
.note-field span { font-size: var(--s-12); font-weight: 700; }
.note-field textarea {
  width: 100%; min-height: 76px; resize: none; overflow: hidden; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--rule-2); background: var(--sheet); font-size: var(--s-16); line-height: 1.5;
}
.note-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.today-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; padding: 0 2px; flex-wrap: wrap; }
.today-foot p { margin: 0; font-size: var(--s-14); color: var(--ink-2); flex: 1 1 200px; }
.signout { margin: 36px 0 0; text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.att-v small { font-size: 11px; font-weight: 600; color: var(--ink-3); }

.empty { padding: 28px 20px; text-align: center; color: var(--ink-2); }
.empty b { display: block; font-family: var(--f-display); font-size: var(--s-18); color: var(--ink); margin-bottom: 4px; }

/* ---------- Timer pill ---------- */
.timer {
  position: fixed; z-index: 32; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  width: min(calc(100vw - 2 * var(--gutter)), calc(var(--maxw) - 2 * var(--gutter)));
  background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 18px; box-shadow: var(--lift);
  display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 8px 8px 16px;
}
.timer-t { min-width: 0; }
.timer-name { font-size: var(--s-12); color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.timer-clock { font-family: var(--f-display); font-weight: 750; font-size: var(--s-22); font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer-clock small { font-size: var(--s-14); color: var(--ink-3); font-weight: 600; }
.timer.over .timer-clock { color: var(--hard); }
.timer-bar { grid-column: 1 / -1; height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; margin: 0 8px 0 0; }
.timer-bar i { display: block; height: 100%; background: var(--accent); }
.timer.over .timer-bar i { background: var(--hard); }
.timer-actions { display: flex; gap: 6px; }

/* ---------- Bottom sheet (notes) ---------- */
.sheet-ov { position: fixed; inset: 0; z-index: 50; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(8, 16, 14, .42); animation: fade .2s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: var(--maxw);
  height: calc(100dvh - 48px - env(safe-area-inset-top, 0px));
  background: var(--sheet); border-radius: 22px 22px 0 0; display: flex; flex-direction: column;
  animation: rise .28s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -10px 40px -10px rgba(0,0,0,.3);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--rule-2); margin: 8px auto 0; flex: none; }
.sheet-h { display: flex; align-items: center; gap: 8px; padding: 8px 12px 10px 20px; flex: none; border-bottom: 1px solid var(--rule); }
.sheet-h h2 { font-size: var(--s-22); font-weight: 750; flex: 1; letter-spacing: -.015em; }
.sheet-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px 24px; }
.note-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.note-item { width: 100%; text-align: left; display: grid; gap: 3px; padding: 14px 4px; border-bottom: 1px solid var(--rule); }
.note-item-t { font-weight: 650; display: flex; align-items: center; gap: 6px; min-width: 0; }
.note-item-t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-t svg { width: 14px; height: 14px; flex: none; fill: var(--hl); stroke: var(--ink); stroke-width: 1.5; }
.note-item-p { color: var(--ink-2); font-size: var(--s-14); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-item-d { color: var(--ink-3); font-size: var(--s-12); }
.sheet-sub { font-size: var(--s-14); font-weight: 700; color: var(--ink-2); margin: 22px 4px 2px; font-family: var(--f-body); }
.editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.editor textarea {
  flex: 1; width: 100%; border: 0; resize: none; background: transparent; padding: 16px 20px 40px;
  font-size: var(--s-18); line-height: 1.6; outline: none;
}
.editor textarea::placeholder { color: var(--ink-3); }
.saved { font-size: var(--s-12); color: var(--ink-3); padding: 0 6px; white-space: nowrap; }
.icon-btn[aria-pressed="true"] svg { fill: var(--hl); stroke: var(--ink); }

/* ---------- Full overlays (search, practice) ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: var(--paper); display: flex; flex-direction: column; animation: fade .15s; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.ov-head { max-width: var(--maxw); width: 100%; margin: 0 auto; display: flex; gap: 8px; align-items: center; padding: 10px var(--gutter); }
.ov-head input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--rule-2);
  background: var(--sheet); font-size: var(--s-16);
}
.ov-head input:focus { outline: none; border-color: var(--accent); }
.ov-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.ov-in { max-width: var(--maxw); margin: 0 auto; padding: 4px var(--gutter) 40px; }
.hint { color: var(--ink-3); font-size: var(--s-14); padding: 8px 2px; }

.practice { flex: 1; display: flex; flex-direction: column; max-width: var(--maxw); width: 100%; margin: 0 auto; padding: 8px var(--gutter) 20px; gap: 18px; overflow-y: auto; }
.practice-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.practice-top span { font-size: var(--s-14); color: var(--ink-2); font-weight: 600; }
.practice-q { font-family: var(--f-display); font-size: clamp(1.45rem, 6vw, 2rem); font-weight: 650; line-height: 1.22; letter-spacing: -.015em; flex: 1; display: flex; align-items: center; }
.practice-q .mark { background: none; }
.ring-wrap { display: grid; place-items: center; }
.ring { width: 150px; height: 150px; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: var(--rule); }
.ring .prog { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ring.over .prog { stroke: var(--hard); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-display); font-size: var(--s-28); font-weight: 750; font-variant-numeric: tabular-nums; }
.ring.over b { color: var(--hard); }
.practice-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.practice-actions .btn { min-height: 54px; font-size: var(--s-16); }
.practice-actions .full { grid-column: 1 / -1; }
.btn.hl-btn { background: var(--hl-mark); border-color: transparent; color: var(--ink); }

/* ---------- Add flow ---------- */
.add-btn { color: var(--accent); }
.add-btn svg { stroke-width: 2.4; }
.add-row button {
  width: 100%; min-height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 18px;
  color: var(--accent); font-weight: 600; font-size: var(--s-14); border-top: 1px dashed var(--rule-2);
}
.add-row svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.add-row button:hover { background: var(--sheet-2); }
.mine { color: var(--accent); font-weight: 600; }

.wiz-h h2 { text-align: center; font-size: var(--s-16); font-weight: 650; font-family: var(--f-body); color: var(--ink-2); letter-spacing: 0; }
.wiz-sp { width: 44px; height: 44px; flex: none; }
.wiz-bar { display: flex; gap: 4px; padding: 0 20px 4px; flex: none; }
.wiz-bar i { flex: 1; height: 4px; border-radius: 2px; background: var(--rule); transition: background .2s; }
.wiz-bar i.past { background: color-mix(in srgb, var(--accent) 45%, var(--rule)); }
.wiz-bar i.now { background: var(--accent); }
.wiz-body { padding: 20px 20px 24px; display: flex; flex-direction: column; gap: 14px; }
.wiz-q { font-family: var(--f-display); font-size: clamp(1.6rem, 6.5vw, 2rem); font-weight: 750; letter-spacing: -.02em; line-height: 1.12; }
.wiz-sub { margin: -6px 0 4px; color: var(--ink-2); font-size: var(--s-14); max-width: 40ch; }
.opts { display: grid; gap: 8px; margin-top: 4px; }
.opts-row { grid-template-columns: repeat(3, 1fr); }
.opts-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.opt {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px 12px 16px;
  border-radius: 16px; background: var(--sheet); border: 1.5px solid var(--rule); transition: border-color .15s, background .15s, transform .1s;
}
.opt:hover { border-color: var(--rule-2); }
.opt:active { transform: scale(.985); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.opt-l { flex: 1; min-width: 0; display: grid; gap: 2px; }
.opt-l b { font-weight: 650; font-size: var(--s-16); display: inline-flex; align-items: center; gap: 8px; }
.opt-l b svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.opt-l small { color: var(--ink-3); font-size: var(--s-14); }
.opt-go { color: var(--ink-3); flex: none; }
.opt-go svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transform: rotate(-90deg); }
.opt.on .opt-go { color: var(--accent); }
.opt.on .opt-go svg { transform: none; stroke-width: 3; }
.opt.ghost { border-style: dashed; background: transparent; color: var(--accent); min-height: 58px; }
.opt.ghost small { color: var(--ink-3); }
.diffopt, .timeopt { justify-content: center; text-align: center; flex-direction: column; gap: 2px; min-height: 72px; padding: 10px 6px; }
.diffopt b, .timeopt b { font-size: var(--s-16); font-weight: 700; font-variant-numeric: tabular-nums; }
.timeopt small { font-size: 11px; color: var(--accent); font-weight: 650; }
.diffopt.d-e b { color: var(--easy); } .diffopt.d-m b { color: var(--med); } .diffopt.d-h b { color: var(--hard); }
.diffopt.d-e.on { border-color: var(--easy); background: color-mix(in srgb, var(--easy) 12%, var(--sheet)); }
.diffopt.d-m.on { border-color: var(--med); background: color-mix(in srgb, var(--med) 12%, var(--sheet)); }
.diffopt.d-h.on { border-color: var(--hard); background: color-mix(in srgb, var(--hard) 12%, var(--sheet)); }
.opt-new { display: flex; gap: 8px; }
.opt-new input, .wiz-field input, .wiz-field textarea {
  flex: 1; min-width: 0; width: 100%; min-height: 54px; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--rule-2);
  background: var(--sheet); font-size: var(--s-18); line-height: 1.45; resize: none; overflow: hidden;
}
.opt-new input:focus, .wiz-field input:focus, .wiz-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.opt-new .btn { min-height: 54px; }
.wiz-field { display: grid; gap: 6px; }
.wiz-field > span { font-size: var(--s-14); font-weight: 650; }
.wiz-foot { flex: none; display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px 16px; border-top: 1px solid var(--rule); background: var(--sheet); }
.wiz-foot .btn.primary { min-height: 52px; padding: 0 26px; font-size: var(--s-16); flex: 1; max-width: 340px; }
.rev-list { display: grid; border: 1px solid var(--rule); border-radius: 16px; overflow: hidden; background: var(--sheet); }
.rev { width: 100%; text-align: left; display: grid; gap: 2px; padding: 12px 16px; }
.rev + .rev { border-top: 1px solid var(--rule); }
.rev small { font-size: var(--s-12); color: var(--ink-3); font-weight: 650; }
.rev span { font-size: var(--s-16); overflow-wrap: anywhere; }
.rev span i { color: var(--ink-3); }
.rev:hover { background: var(--sheet-2); }
.dup { padding: 12px 14px; border-radius: 12px; background: var(--hl-mark); font-size: var(--s-14); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 80; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 80px + env(safe-area-inset-bottom, 0px));
  background: var(--fab); color: var(--fab-ink); border-radius: 14px; padding: 6px 6px 6px 16px;
  display: flex; align-items: center; gap: 12px; font-size: var(--s-14); font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); max-width: calc(100vw - 32px); animation: rise .22s cubic-bezier(.2,.8,.2,1);
  min-height: 48px;
}
.toast button { color: var(--toast-act); font-weight: 700; min-height: 36px; padding: 0 12px; border-radius: 10px; }
.toast:not(:has(button)) { padding-right: 16px; }

/* ---------- Larger screens ---------- */
.rail-brand { display: none; }
.home-grid { display: block; }

@media (min-width: 768px) {
  :root { --rail: 92px; --gutter: 32px; --maxw: 820px; }
  body[data-tab="home"] { --maxw: 760px; }
  .top h1 { font-size: 2.1rem; }
  .top, main { margin-left: var(--rail); }
  main { padding-bottom: 140px; }

  .tabs {
    top: 0; bottom: 0; right: auto; width: var(--rail);
    border-top: 0; border-right: 1px solid var(--rule);
    padding: calc(env(safe-area-inset-top, 0px) + 18px) 0 18px;
    background: var(--sheet);
  }
  .tabs-in { height: auto; grid-template-columns: 1fr; grid-auto-rows: 74px; gap: 2px; max-width: none; }
  .tabs button { font-size: 12px; border-radius: 14px; margin: 0 10px; }
  .tabs button:hover { background: var(--sheet-2); color: var(--ink); }
  .tabs button[aria-current="page"] { background: var(--sheet-2); }
  .tabs button[aria-current="page"]::after { top: 50%; left: -10px; width: 3px; height: 30px; margin: -15px 0 0; border-radius: 0 3px 3px 0; }

  .seg, .chips { margin-inline: 0; padding-inline: 0; flex-wrap: wrap; overflow: visible; }
  .fab { right: 32px; bottom: 28px; }
  body.timing .fab { bottom: 28px; }
  .timer { bottom: 28px; left: calc(var(--rail) + (100vw - var(--rail)) / 2); width: min(560px, calc(100vw - var(--rail) - 260px)); }
  .toast { bottom: 100px; left: calc(var(--rail) + (100vw - var(--rail)) / 2); }

  .sheet-panel {
    left: auto; right: 0; top: 0; bottom: 0; height: auto; width: min(480px, 100vw); max-width: none;
    border-radius: 24px 0 0 24px; animation: slide-in .28s cubic-bezier(.2,.8,.2,1);
    padding-top: env(safe-area-inset-top, 0px);
  }
  .sheet-panel .grab { display: none; }
  .sheet-h { padding: 18px 16px 14px 24px; }
  .ov-head, .ov-in, .practice { max-width: 820px; }
  .practice { padding-top: 32px; }
  .practice-q { font-size: 2.2rem; }
  .ring { width: 180px; height: 180px; }
  .heat { max-width: 560px; }
  .row { grid-template-columns: 58px 1fr 54px; }
  .chk { width: 58px; }
  .hlbtn { width: 54px; }
  .hlbtn:hover, .chk:hover .box { color: var(--ink); border-color: var(--ink-3); }
  .body:hover .mark { color: var(--ink); }
  .group-h:hover { border-color: var(--rule-2); }
}
@keyframes slide-in { from { transform: translateX(40px); opacity: 0; } }

@media (min-width: 1100px) {
  :root { --rail: 240px; --gutter: 44px; }
  body[data-tab="home"] { --maxw: 1180px; }
  .tabs { padding-top: calc(env(safe-area-inset-top, 0px) + 22px); }
  .rail-brand {
    display: flex; align-items: center; gap: 10px; padding: 0 22px 26px;
    font-family: var(--f-display); font-size: 1.35rem; font-weight: 750; letter-spacing: -.02em; color: var(--ink);
  }
  .rail-brand svg { width: 30px; height: 30px; }
  .rail-brand rect { fill: var(--accent); }
  .rail-brand path { fill: none; stroke: var(--accent-ink); stroke-width: 4.5; stroke-linecap: round; stroke-linejoin: round; }
  .tabs-in { grid-auto-rows: 50px; gap: 4px; }
  .tabs button { flex-direction: row; justify-content: flex-start; gap: 14px; padding: 0 14px; font-size: 15px; margin: 0 12px; }
  .tabs button svg { width: 22px; height: 22px; }
  .tabs button[aria-current="page"]::after { left: -12px; height: 24px; margin-top: -12px; }

  .home-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: 0 56px; align-items: start; }
  .home-grid .col-b { padding-top: 14px; }
  .home-grid .col-b > .block:first-child { margin-top: 0; }
  .hero { padding-top: 14px; }
  .hero-week b { font-size: 6rem; }
  .signout { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
