@font-face {
  font-family: "Geist";
  src: url("/fonts/geist-latin.woff2") format("woff2");
  font-weight: 400 650;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f6f4ef;          /* detail pane and pages */
  --side: #efebe3;        /* sidebar */
  --surface: #fffefb;     /* list pane, blocks */
  --hover: #f5f1ea;
  --sel: #ede5d7;
  --sunk: #ebe6dd;
  --ink: #2a2722;
  --tx: #4a463f;
  --mut: #6c675f;
  --faint: #9b9589;
  --line: #e5e0d6;
  --line-strong: #d5cec1;
  --acc: #6f604c;
  --acc-hover: #5e5140;
  --accsoft: #e7dfd1;
  --age: #96643f;
  --ok: #557a52;
  --danger: #a24a3a;
  --shadow-up: 0 12px 32px rgba(55, 45, 30, .14), 0 2px 6px rgba(55, 45, 30, .06);
  --font: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; background: var(--bg); color: var(--tx); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: 600; }
h1 { font-size: 25px; line-height: 1.25; letter-spacing: -.02em; }
h2 { font-size: 18px; line-height: 1.3; letter-spacing: -.01em; }
h3 { font-size: 13px; font-weight: 600; color: var(--mut); }
p { margin: 0; }
.mut { color: var(--mut); }
.small { font-size: 13px; }
.age { color: var(--age); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accsoft); }
kbd { font: 500 10.5px/1 var(--font); background: var(--surface); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; color: var(--mut); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { min-width: 0; }
.row.center { justify-content: center; }
.center-text { text-align: center; }

/* ── controls ─────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color .12s, border-color .12s, opacity .12s; }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.pri { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn.pri:hover { background: var(--acc-hover); border-color: var(--acc-hover); }
.btn.soft { background: var(--accsoft); border-color: transparent; }
.btn.soft:hover { background: #ddd3c2; }
.btn.quiet { background: transparent; border-color: transparent; color: var(--mut); }
.btn.quiet:hover { color: var(--ink); background: var(--sunk); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 7px; }
.btn.danger-btn { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn[aria-busy="true"] { opacity: .6; cursor: progress; }
.btn.pri kbd { background: rgba(255, 255, 255, .16); border-color: transparent; color: #fff; }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--sunk); border-radius: 9px; max-width: 100%; overflow-x: auto; scrollbar-width: none; flex: none; }
.seg::-webkit-scrollbar { display: none; }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--mut); font-size: 13px; font-weight: 500; height: 28px; padding: 0 11px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.seg button span { color: var(--faint); margin-left: 2px; font-variant-numeric: tabular-nums; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(55, 45, 30, .12); }

input[type=text], input[type=search], input[type=password], input[type=url], textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 11px; background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
input:focus, textarea:focus { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 14%, transparent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input.short { width: 110px; }
textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
.plus { width: 12px; height: 12px; position: relative; display: inline-block; flex: none; }
.plus::before, .plus::after { content: ""; position: absolute; background: currentColor; border-radius: 1px; }
.plus::before { left: 5px; top: 0; width: 2px; height: 12px; }
.plus::after { top: 5px; left: 0; height: 2px; width: 12px; }

/* ── app frame: sidebar, list, detail ─────────────────────────────── */
.shell { display: grid; grid-template-columns: 240px 420px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.side { grid-column: 1; grid-row: 1; overflow-y: auto; background: var(--side); border-right: 1px solid var(--line); padding: 14px 12px 12px; display: flex; flex-direction: column; gap: 16px; }
.list { grid-column: 2; grid-row: 1; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding-bottom: 40px; }
.detail { grid-column: 3; grid-row: 1; overflow-y: auto; background: var(--bg); }
.page-pane { display: none; }
.shell.page .list, .shell.page .detail { display: none; }
.shell.page .page-pane { display: block; grid-column: 2 / -1; grid-row: 1; overflow-y: auto; }
.tabs, .mtop, .dback { display: none; }

/* sidebar */
.brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.save { width: 100%; justify-content: flex-start; height: 38px; }
.save kbd { margin-left: auto; }
.nav, .grp { display: grid; gap: 1px; }
.grp h3 { padding: 0 10px 4px; font-size: 12px; }
.nv { display: flex; align-items: center; gap: 9px; padding: 6px 10px; border-radius: 7px; color: var(--tx); font-size: 14px; font-weight: 500; min-width: 0; }
.nv:hover { background: rgba(55, 45, 30, .05); color: var(--ink); }
.nv.on { background: var(--sel); color: var(--ink); }
.nv.sm { font-size: 13.5px; font-weight: 400; padding: 5px 10px; }
.nv.sel { color: var(--ink); font-weight: 600; }
.nv .ct { margin-left: auto; color: var(--mut); font-size: 12.5px; font-weight: 400; font-variant-numeric: tabular-nums; flex: none; }
.md { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.md-work { background: #8e9fb4; } .md-research { background: #a796b8; } .md-watch { background: #c79c8a; } .md-grow { background: #93ad8a; } .md-light { background: #d2b57f; }
.course-nv { display: grid; grid-template-columns: minmax(0, 1fr) auto; row-gap: 5px; }
.course-nv .cn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--line-strong); overflow: hidden; }
.mini i { display: block; height: 100%; background: var(--acc); }
.foot { margin-top: auto; display: grid; gap: 6px; padding-top: 10px; }
.weekline { display: flex; align-items: center; gap: 9px; padding: 6px 10px; font-size: 13px; color: var(--mut); }
.weekline b { color: var(--ink); }
.keys-hint { padding: 2px 10px; font-size: 12px; color: var(--faint); }
.dots { display: inline-flex; gap: 4px; align-items: center; flex: none; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.dots i.on { background: var(--acc); }
.dots.big i { width: 9px; height: 9px; }

/* ── list pane ─────────────────────────────── */
.lh { position: sticky; top: 0; z-index: 2; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); padding: 18px 22px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lh-t { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex-wrap: wrap; }
.lh-t .mut { font-size: 13px; }
.lh-tools { padding: 0 22px 8px; display: grid; gap: 8px; }
.lh-tools > * { min-width: 0; }
.lh-tools .search input { height: 38px; }
.moods-seg { display: none !important; }   /* the sidebar holds the moods */
.lg { padding: 2px 0 6px; }
.lg h3 { padding: 14px 22px 6px; display: flex; justify-content: space-between; gap: 8px; }
.lg h3 span { font-weight: 400; color: var(--faint); }
.notes-strip { margin: 0 14px 4px; display: grid; gap: 4px; }
.notes-strip > * { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--ink); }
.notes-strip > *::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--age); flex: none; }
.notes-strip a:hover { background: var(--hover); }
.empty { margin: 24px 22px; padding: 26px 18px; border: 1.5px dashed var(--line-strong); border-radius: 12px; text-align: center; color: var(--mut); display: grid; gap: 12px; justify-items: center; font-size: 14px; }

.li, .course-head { scroll-margin: 64px 0 12px; }
.li { position: relative; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 0 8px; padding: 9px 12px 9px 10px; border-radius: 10px; }
.li:hover { background: var(--hover); }
.li.sel { background: var(--sel); }
.th { position: relative; width: 56px; height: 42px; border-radius: 7px; overflow: hidden; background: var(--sunk); display: grid; place-items: center; flex: none; }
.th .pic-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.88); }
.th::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(55, 45, 30, .07); }
.th .len { position: absolute; right: 3px; bottom: 3px; font-size: 9.5px; font-weight: 600; color: #fff; background: rgba(30, 27, 22, .75); border-radius: 3px; padding: 0 3px; line-height: 14px; z-index: 1; }
.ic { position: relative; flex: none; width: 20px; height: 20px; border-radius: 5px; background: #fff; display: inline-grid; place-items: center; font-size: 11px; font-weight: 650; color: var(--mut); overflow: hidden; box-shadow: 0 0 0 1px rgba(55, 45, 30, .09); }
.ic.file { background: #fff; }
.ic.file::before { content: ""; width: 9px; height: 12px; border: 1.5px solid var(--mut); border-radius: 1.5px 4px 1.5px 1.5px; }
.ic img { position: absolute; inset: 2px; width: 16px; height: 16px; object-fit: contain; background: #fff; }
.lb { min-width: 0; display: grid; gap: 2px; }
.lt { color: var(--ink); font-weight: 550; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.lm { display: flex; gap: 10px; font-size: 12.5px; color: var(--mut); min-width: 0; overflow: hidden; }
.lm > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 100%; }
.lm > span:last-child { flex: 0 1 auto; }
.tk { font-size: 13px; color: var(--tx); border-left: 2px solid var(--line-strong); padding-left: 8px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lr { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11.5px; color: var(--age); background: #f3e9df; border-radius: 99px; padding: 2px 8px; white-space: nowrap; }
.pring { width: 18px; height: 18px; border-radius: 50%; background: conic-gradient(var(--acc) var(--p), var(--line-strong) 0); -webkit-mask: radial-gradient(circle, transparent 5px, #000 5.5px); mask: radial-gradient(circle, transparent 5px, #000 5.5px); flex: none; }
.th.num { background: var(--bg); color: var(--mut); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.th.num.week, .th.num.reading { background: var(--accsoft); color: var(--acc); }
.th.num.done { background: var(--acc); }
.th.num .tick { width: 7px; height: 13px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg) translate(-1px, -2px); }
.chn { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; min-width: 16px; text-align: right; }
@media (hover: hover) {
  .li .lr .btn { opacity: 0; transition: opacity .12s; }
  .li:hover .lr .btn, .li.sel .lr .btn, .li:focus-within .lr .btn { opacity: 1; }
}
.slot { display: grid; grid-template-columns: 56px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-items: center; margin: 2px 8px; padding: 8px 12px 8px 10px; border-radius: 10px; color: var(--faint); font-size: 13.5px; }
.slot .slot-n { grid-row: 1 / span 2; width: 56px; height: 42px; border: 1.5px dashed var(--line-strong); border-radius: 7px; display: grid; place-items: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.slot .mut { font-size: 12.5px; color: var(--faint); }
.slot:hover { background: var(--hover); color: var(--mut); }
.course-li .track { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 5px; }
.track i { width: 10px; height: 5px; border-radius: 3px; background: var(--line); }
.track i.done { background: var(--acc); }
.track i.reading { background: linear-gradient(90deg, var(--acc) 50%, var(--line) 50%); }
.track i.week { background: var(--accsoft); box-shadow: inset 0 0 0 1.2px var(--acc); }
.course-head { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center; margin: 4px 8px 8px; padding: 9px 12px 9px 10px; border-radius: 10px; }
.course-head > span:last-child { display: grid; }
.course-head:hover { background: var(--hover); }
.course-head.sel { background: var(--sel); }
.chlist { list-style: none; margin: 0; padding: 0; }
.recall { margin: 4px 14px 10px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); display: grid; gap: 8px; }
.recall .rt { font-weight: 600; color: var(--ink); }

/* ── detail pane ─────────────────────────────── */
.dv { max-width: 740px; margin: 0 auto; padding: 28px 40px 80px; display: grid; gap: 18px; }
.hero { display: block; cursor: pointer; }
.hero .pic { position: relative; display: block; aspect-ratio: 16 / 9; max-height: 300px; width: 100%; border-radius: 14px; overflow: hidden; background: hsl(var(--h) var(--s) 90%); }
.hero .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(.9); opacity: 0; transition: opacity .25s; }
.th .pic-img { opacity: 0; transition: opacity .2s; }
.hero .pic img[data-ok], .th .pic-img[data-ok] { opacity: 1; }
.hero .pic img:not([data-ok]), .th .pic-img:not([data-ok]) { animation: show 0s 1.5s forwards; }   /* never stay hidden */
@keyframes show { to { opacity: 1; } }
.hero .pic::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(55, 45, 30, .07); }
.play { position: absolute; inset: 0; margin: auto; width: 62px; height: 62px; border-radius: 50%; background: rgba(30, 27, 22, .55); backdrop-filter: blur(4px); transition: background-color .15s, transform .15s; z-index: 1; }
.play::after { content: ""; position: absolute; left: 25px; top: 20px; border-left: 18px solid #fff; border-top: 11px solid transparent; border-bottom: 11px solid transparent; }
.hero:hover .play { background: rgba(30, 27, 22, .72); transform: scale(1.04); }
.len { position: absolute; right: 8px; bottom: 8px; font-size: 12px; font-weight: 600; color: #fff; background: rgba(30, 27, 22, .78); border-radius: 5px; padding: 1px 6px; z-index: 1; }
.dh { display: grid; gap: 8px; }
.crumb { font-size: 13px; color: var(--acc); font-weight: 500; }
.crumb:hover { text-decoration: underline; text-underline-offset: 3px; }
.state { font-size: 12.5px; font-weight: 600; color: var(--mut); }
.state.st-reading, .state.st-week { color: var(--acc); }
.state.st-done { color: var(--ok); }
.dh .meta, .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 13.5px; color: var(--mut); }
.site { display: inline-flex; align-items: center; gap: 7px; color: var(--tx); }
a.site:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.actions { gap: 8px; }
.progress { display: grid; gap: 6px; }
.bar { height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar.thin { height: 3px; margin: 0 0 16px; }
.bar i { display: block; height: 100%; background: var(--acc); border-radius: inherit; transition: width .3s; }
.lead { font-size: 16px; line-height: 1.65; color: var(--tx); }
.post { position: relative; margin: 0; padding: 18px 20px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 8px; font-size: 16px; line-height: 1.55; color: var(--ink); }
.post p { white-space: pre-line; }
.post cite { font-style: normal; font-size: 13px; color: var(--mut); }
.why { font-size: 14px; color: var(--tx); border-left: 2px solid var(--line-strong); padding-left: 10px; }
.recap { background: var(--sunk); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.quote { margin: 0; border-left: 2px solid var(--acc); padding: 2px 0 2px 12px; color: var(--ink); }
/* sections of the detail: spacing and a hairline, not boxes */
.sec { display: grid; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.sec h3 { display: flex; align-items: center; gap: 8px; }
.sec h3 .ct { font-weight: 500; color: var(--faint); font-variant-numeric: tabular-nums; }
.sec .seg, .rbody .seg { justify-self: start; width: max-content; }
.sec.keep { border-top: 0; padding: 16px 18px; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.sec.keep h3 { color: var(--ink); }
.sec.keep textarea { resize: none; }
.composer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.composer textarea { min-height: 38px; height: 38px; resize: none; padding-top: 8px; padding-bottom: 8px; overflow: hidden; }
.composer .btn { height: 40px; }
.composer .btn kbd { margin-left: 2px; font-size: 10px; padding: 1px 4px; }
.composer .btn .hint { display: inline-flex; gap: 3px; margin-left: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px 0 10px; border-radius: 99px; border: 1px solid var(--line-strong); background: transparent; color: var(--tx); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .12s, border-color .12s; }
.chip:hover { border-color: var(--faint); color: var(--ink); }
.chip.on { background: var(--surface); border-color: var(--ink); color: var(--ink); box-shadow: 0 1px 2px rgba(55, 45, 30, .1); }
input.bare { border-color: transparent; border-radius: 6px; background: transparent; padding-left: 8px; margin-left: -8px; height: 32px; }
input.bare:placeholder-shown:not(:focus) { background: linear-gradient(var(--line-strong), var(--line-strong)) 8px calc(100% - 6px) / calc(100% - 16px) 1px no-repeat; }
input.bare.short:placeholder-shown:not(:focus) { background-size: 60px 1px; }
input.bare::placeholder { color: var(--mut); }
input.bare:hover:placeholder-shown:not(:focus) { background-color: var(--sunk); }
input.bare:hover { background: var(--sunk); }
input.bare:focus { background: var(--surface); border-color: var(--acc); }
.pv { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--tx); min-height: 32px; flex-wrap: wrap; }
.fullnote { font-size: 13.5px; color: var(--mut); margin-top: -6px; }
.fullnote a { color: var(--acc); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.nopv { font-size: 14px; color: var(--mut); padding: 14px 16px; border-radius: 12px; background: var(--sunk); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--acc); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.linkbtn:hover { text-decoration-color: currentColor; }
.block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: grid; gap: 10px; }
.block h3:not(:first-child) { margin-top: 4px; }
.quiet-block { background: transparent; border-style: dashed; }
.props { gap: 6px; }
.prop { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: start; gap: 12px; min-height: 34px; }
.prop > .pk { line-height: 32px; }
.prop .pk { font-size: 13px; color: var(--mut); }
.prop .mut.small { grid-column: 2; }
.notes { display: grid; gap: 8px; }
.note { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.note:first-child { border-top: 0; padding-top: 0; }
.note .at { color: var(--acc); font-weight: 600; font-size: 12px; background: var(--accsoft); padding: 2px 7px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.note .x { border: 0; background: none; color: var(--faint); font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; opacity: 0; }
.note:hover .x, .note .x:focus-visible { opacity: 1; }
.note .x:hover { color: var(--danger); background: var(--sunk); }
.checks { display: grid; gap: 2px; max-height: 320px; overflow: auto; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; font-size: 13.5px; padding: 5px 0; }
.dfoot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; color: var(--mut); font-size: 13.5px; padding-top: 14px; border-top: 1px solid var(--line); }
.dfoot > :first-child { margin-left: -11px; }
.dfoot > .btn[data-act="askDelete"] { margin-left: auto; margin-right: -11px; }
.next-ch { max-width: min(360px, 100%); overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 34px; }
.grab { cursor: grab; }
.dfoot > span:first-child { margin-left: 0; }
.dfoot .btn.quiet:last-child:not(.danger-btn):hover { color: var(--danger); }
.dempty { min-height: 100%; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center; color: var(--mut); padding: 40px; }
.dempty b { color: var(--ink); font-weight: 600; }

/* ── pages: review, year, settings ─────────────────────────────── */
.pg { max-width: 860px; margin: 0 auto; padding: 12px 40px 80px; display: grid; gap: 16px; }
.pg.narrow { max-width: 640px; }
.pg > .lh, .review > .lh { position: static; background: none; backdrop-filter: none; padding: 18px 0 4px; }
.review { max-width: 620px; margin: 0 auto; padding: 12px 24px 80px; display: grid; gap: 4px; }
.rcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.rcard > .pic { position: relative; display: block; aspect-ratio: 16 / 9; max-height: 280px; width: 100%; overflow: hidden; background: hsl(var(--h) var(--s) 90%); }
.rcard > .pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.rbody { padding: 22px 24px 20px; display: grid; gap: 12px; }
.rt { font-size: 21px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.rt:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.rcard .keys { display: flex; gap: 8px; justify-content: center; padding: 14px; background: var(--bg); border-top: 1px solid var(--line); flex-wrap: wrap; }
.review > p { margin-top: 10px; }
.year { overflow-x: auto; padding-bottom: 6px; }
.hm { display: grid; grid-auto-flow: column; grid-template-columns: repeat(53, minmax(9px, 1fr)); grid-template-rows: 16px repeat(7, auto); gap: 3px; min-width: 560px; }
.hm i { aspect-ratio: 1; border-radius: 3px; background: #ebe7df; display: block; }
.legend i { width: 12px; height: 12px; border-radius: 3px; background: #ebe7df; display: block; }
.hm .l1, .legend .l1 { background: #dfe4d4; } .hm .l2, .legend .l2 { background: #c3cfb4; } .hm .l3, .legend .l3 { background: #a1b28f; } .hm .l4, .legend .l4 { background: #7f936b; }
.hm i.future { background: transparent; }
.hm .mo { font-size: 11px; color: var(--mut); white-space: nowrap; width: 0; overflow: visible; }
.legend { display: flex; gap: 4px; align-items: center; font-size: 12px; color: var(--mut); margin-top: 6px; }
.legend .today { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; padding: 4px 0 8px; }
.stat { display: grid; gap: 2px; padding: 0 18px; border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat b { font-size: 24px; font-weight: 600; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--mut); }
.saved h1 { font-size: 21px; }
.settings .block { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: 18px 0 4px; }
.settings .block h3 { color: var(--ink); font-size: 14px; }

/* ── sheet, toast, login, boot ─────────────────────────────── */
.veil { position: fixed; inset: 0; z-index: 40; background: rgba(45, 40, 32, 0); display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; transition: background-color .16s; }
.veil.open { background: rgba(45, 40, 32, .3); }
.sheet { width: min(480px, 100%); min-width: 0; overflow-wrap: anywhere; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-up); padding: 22px; display: grid; gap: 14px; opacity: 0; transform: translateY(8px) scale(.98); transition: opacity .16s, transform .16s; }
.veil.open .sheet { opacity: 1; transform: none; }
.sheet label { font-weight: 500; color: var(--ink); }
.add-form { display: grid; gap: 12px; }
.add-form input[type=url] { height: 46px; font-size: 15px; }
.done-head { display: flex; gap: 12px; align-items: center; }
.done-head .check { width: 34px; height: 34px; border-radius: 50%; background: var(--ok); flex: none; position: relative; animation: pop .35s ease-out; }
.done-head .check::after { content: ""; position: absolute; left: 12px; top: 8px; width: 8px; height: 14px; border-right: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(45deg); }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 14px; background: #37322b; color: #fff; padding: 10px 12px 10px 16px; border-radius: 11px; font-size: 13.5px; box-shadow: var(--shadow-up); max-width: calc(100% - 32px); animation: toast-in .18s ease-out; }
.toast button { background: none; border: 0; color: #f0d9b5; font-weight: 600; cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.toast button:hover { background: rgba(255, 255, 255, .1); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .block { width: min(380px, 100%); justify-items: start; padding: 28px; gap: 12px; }
.login .btn { width: 100%; height: 42px; }
.err { color: var(--danger); min-height: 1em; }
.boot { max-width: 900px; margin: 0 auto; padding: 60px 24px; display: grid; gap: 12px; }
.sk { height: 64px; border-radius: 12px; background: linear-gradient(90deg, var(--sunk), #f3f0ea, var(--sunk)); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
.sk.short { width: 40%; height: 36px; }
@keyframes sk { to { background-position: -200% 0; } }

::view-transition-group(*) { animation-duration: .26s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
@media (hover: none) { kbd, .hint, .keys-hint { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } .hero .pic img, .th .pic-img { opacity: 1 !important; } }

/* ── medium: sidebar and one pane ─────────────────────────────── */
@media (max-width: 1099px) {
  .shell { grid-template-columns: 220px minmax(0, 1fr); }
  .list, .detail { grid-column: 2; }
  .shell.has-item .list { display: none; }
  .shell.no-item .detail { display: none; }
  .shell.v-course.no-item .detail { display: none; }
  .dback { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--mut); justify-self: start; }
  .dback::before { content: ""; width: 6px; height: 6px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
  .dback:hover { color: var(--ink); }
  .list { border-right: 0; }
  .li, .slot, .course-head { margin: 0 12px; }
}

/* ── phone: one pane, tabs at the bottom ─────────────────────────────── */
@media (max-width: 759px) {
  html, body { background: var(--surface); }
  .shell { display: flex; flex-direction: column; height: auto; min-height: 100vh; }
  .mtop { order: -1; }
  .side, .dback { display: none !important; }
  .list, .detail, .shell.page .page-pane { overflow: visible; }
  .list { padding-bottom: 120px; }
  .detail { background: var(--bg); min-height: calc(100vh - 52px); padding-bottom: 100px; }
  .page-pane { padding-bottom: 100px; }
  .mtop { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px 0 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
  .shell.has-item .mtop { background: var(--bg); }
  .mtop h1 { font-size: 17px; letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mback { width: 34px; height: 34px; margin-left: -8px; display: grid; place-items: center; border-radius: 8px; }
  .mback::before { content: ""; width: 9px; height: 9px; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: translateX(2px) rotate(45deg); }
  .mright { margin-left: auto; display: flex; align-items: center; gap: 10px; }
  .gear { width: 36px; height: 36px; display: grid; place-items: center; color: var(--mut); border-radius: 8px; }
  .tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabs a { flex: 1; text-align: center; padding: 10px 4px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--mut); }
  .tabs a.on { color: var(--ink); background: var(--sel); }
  .fab { position: fixed; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom)); width: 54px; height: 54px; border-radius: 16px; border: 0; background: var(--acc); color: #fff; box-shadow: var(--shadow-up); display: grid; place-items: center; cursor: pointer; }
  .fab { transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
  .fab.away { transform: translateY(calc(100% + 96px)); }
  .shell.v-week .mtop .dots { display: none; }
  .pg > .lh:not(:has(.lh-tools)) { display: none; }
  .fab .plus { width: 18px; height: 18px; } .fab .plus::before { left: 8px; height: 18px; } .fab .plus::after { top: 8px; width: 18px; }
  .shell.has-item .fab, .shell.v-review .fab { display: none; }
  .lh { position: static; backdrop-filter: none; background: none; padding: 14px 16px 8px; }
  .lh h2, .lh > .dots { display: none; }
  .lh-tools .moods-seg { -webkit-mask: linear-gradient(90deg, #000 88%, transparent); mask: linear-gradient(90deg, #000 88%, transparent); }
  .lh-tools .moods-seg:has(button:last-child.on) { -webkit-mask: none; mask: none; }
  .seg button span { display: none; }
  .shell.v-course .lh h2 { display: block; }
  .lh-tools { padding: 0 16px 8px; }
  .lh-tools .seg { justify-self: start; }
  .moods-seg { display: inline-flex !important; }
  .lg h3 { padding: 14px 16px 6px; }
  .li, .slot, .course-head { margin: 0 6px; padding-left: 10px; padding-right: 10px; }
  .li { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .th { width: 64px; height: 48px; }
  .slot { grid-template-columns: 64px minmax(0, 1fr); }
  .slot .slot-n { width: 64px; height: 48px; }
  .slot ~ .slot { display: none; }   /* one free place is enough to show on the phone */
  .notes-strip { margin: 0 12px 4px; }
  .dv { padding: 16px 16px 40px; gap: 16px; }
  .hero .pic { border-radius: 12px; }
  h1 { font-size: 22px; }
  .dv .actions .btn { height: 40px; }
  .pg, .review { padding: 4px 16px 40px; }
  .stats { grid-template-columns: 1fr 1fr; row-gap: 16px; }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .veil { place-items: end center; padding: 0; }
  .sheet { width: 100%; border-radius: 18px 18px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); transform: translateY(24px); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .note .x { opacity: 1; }
  input.bare:placeholder-shown:not(:focus) { background: var(--sunk); }
  .prop { grid-template-columns: 56px minmax(0, 1fr); gap: 10px; }
  .rcard .keys .btn { flex: 1; }
}
