/* Stage layout (after Flocus): a full-screen scene; wordmark + quote on top, the clock or timer
   dead centre, tool buttons bottom-left, modes + settings bottom-right. Everything else lives in
   popovers (small) or the sheet (a full app window) and only appears when called. */
:root {
  --accent: #6c47ff; --accent-ink: #ffffff; --accent-soft: color-mix(in srgb, var(--accent) 22%, transparent);
  --good: #4ade80; --warn: #fbbf24; --bad: #f87171;
  --dim: 0;
  --f-ui: "Plus Jakarta Sans", "Avenir Next", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --f-note: "Newsreader", Georgia, serif;
  --f-hand: "Caveat", "Bradley Hand", cursive;
  --r: 12px; --r-lg: 18px;
  /* light ink on dark scenes (default) */
  --ink: #ffffff; --ink-2: rgba(255, 255, 255, .7); --ink-3: rgba(255, 255, 255, .42);
  --btn: color-mix(in srgb, var(--accent) 22%, rgba(8, 8, 16, .42)); --btn-hover: color-mix(in srgb, var(--accent) 30%, rgba(8, 8, 16, .62));
  --pop: rgba(15, 15, 24, .94); --sheet: #0c0c10; --sheet-nav: #111117;
  --fg: #ecebf3; --muted: #8f8ba3; --panel: rgba(255, 255, 255, .035); --panel-2: rgba(255, 255, 255, .065);
  --line: rgba(255, 255, 255, .085); --dot-off: rgba(255, 255, 255, .13); --bg: #0c0c10;
  --paper: #15141c; --paper-rule: rgba(255, 255, 255, .06); --paper-margin: rgba(248, 113, 113, .35);
  color-scheme: dark;
}
:root[data-ink="dark"] {
  --ink: #131313; --ink-2: rgba(0, 0, 0, .62); --ink-3: rgba(0, 0, 0, .38);
  --btn: rgba(255, 255, 255, .55); --btn-hover: rgba(255, 255, 255, .8);
  --pop: rgba(255, 255, 255, .95); --sheet: #f6f6f4; --sheet-nav: #ededea;
  --fg: #141414; --muted: #77766f; --panel: rgba(0, 0, 0, .025); --panel-2: rgba(0, 0, 0, .05);
  --line: rgba(0, 0, 0, .08); --dot-off: rgba(0, 0, 0, .1); --bg: #f6f6f4;
  --paper: #ffffff; --paper-rule: rgba(0, 0, 0, .07); --paper-margin: rgba(220, 38, 38, .3);
  --good: #16a34a; --warn: #b45309; --bad: #dc2626;
  color-scheme: light;
}
:root[data-font="classic"] { --f-ui: "Newsreader", Georgia, serif; }
:root[data-font="mono"] { --f-ui: "JetBrains Mono", ui-monospace, monospace; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: #0d0b1a; color: var(--ink); font: 15px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ellip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spacer { flex: 1; }

/* ---------- background ---------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #0d0b1a; }
.bg-photo { position: absolute; inset: 0; background-size: cover; background-position: center; transition: background .6s ease; }
.bg-photo img, .bg-photo video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.bg-photo iframe { position: absolute; top: 50%; left: 50%; width: max(100vw, 177.78vh); height: max(100vh, 56.25vw); transform: translate(-50%, -50%) scale(1.02); border: 0; pointer-events: none; }
.bg::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, var(--dim)); pointer-events: none; }
.grain { position: absolute; inset: -50%; z-index: 1; opacity: .2; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.sticker-stage { position: fixed; inset: 0; z-index: 2; pointer-events: none; }

/* ---------- top ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 5; display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  padding: calc(34px + env(safe-area-inset-top, 0px)) max(46px, env(safe-area-inset-right, 0px)) 0 max(46px, env(safe-area-inset-left, 0px)); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.wordmark { font: 800 34px/1 var(--f-ui); letter-spacing: -.04em; text-decoration: none; color: var(--ink); }
.quote { margin: 0; max-width: 340px; text-align: right; font: 600 19px/1.3 var(--f-ui); letter-spacing: -.01em; color: var(--ink); cursor: pointer; text-wrap: balance; }
.mini-card { background: var(--pop); color: var(--fg); border-radius: 16px; padding: 12px 18px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 180px; }
.mini-card small { font-weight: 700; letter-spacing: .06em; font-size: 12px; color: var(--muted); text-transform: uppercase; }
.mini-card .t-clock { font-size: 42px; color: var(--fg); margin: 0; }

/* ---------- centre ---------- */
.center { position: fixed; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; padding: 120px 20px 110px; }
.center > * { pointer-events: auto; }
.home, .focus { display: flex; flex-direction: column; align-items: center; text-align: center; }
.greet { margin: 0; font: 600 clamp(22px, 2.6vw, 28px)/1.25 var(--f-ui); letter-spacing: -.015em; max-width: 520px; text-wrap: balance; }
.clock { font: 800 clamp(76px, 11vw, 132px)/1 var(--f-ui); letter-spacing: -.045em; margin-top: 6px; }
.dg { font-variant-numeric: tabular-nums; }
.colon { display: inline-block; margin: 0 .02em; transform: translateY(-.06em); }
.lec-row { display: flex; gap: 10px; margin-top: 34px; flex-wrap: wrap; justify-content: center; max-width: min(900px, 92vw); }
.lec { display: flex; flex-direction: column; gap: 6px; width: 188px; padding: 12px 14px; border-radius: 14px; background: var(--btn); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); text-decoration: none; color: var(--ink); text-align: left; transition: background .2s; }
.lec:hover { background: var(--btn-hover); }
.lec .code { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; color: var(--ink-2); display: flex; gap: 6px; align-items: center; }
.lec .code i { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.lec .code .live { margin-left: auto; color: var(--bad); }
.lec b { font-size: 15px; line-height: 1.2; }
.lec small { font-size: 12px; color: var(--ink-2); }
.lec .bar { flex: none; height: 3px; background: color-mix(in srgb, var(--ink) 18%, transparent); }
.lec .bar span { background: var(--ink); }
.ticker { margin-top: 14px; border: 0; background: none; color: var(--ink-2); font-size: 14px; font-weight: 500; cursor: pointer; padding: 6px 10px; border-radius: 99px; }
.ticker:hover { color: var(--ink); background: var(--btn); }
.ticker b { color: var(--ink); }

.focus-q { width: min(560px, 90vw); text-align: center; background: none; border: 0; font: 700 clamp(20px, 2.4vw, 26px)/1.3 var(--f-ui); letter-spacing: -.015em; color: var(--ink); padding: 4px; }
.focus-q::placeholder { color: var(--ink-2); }
.focus-q:focus { outline: none; }
.t-modes { display: flex; gap: 16px; margin-top: 22px; }
.t-modes button { border: 0; background: none; cursor: pointer; font: 600 17px var(--f-ui); text-transform: uppercase; letter-spacing: .01em; color: var(--ink-3); padding: 0; }
.t-modes button.on { color: var(--ink); }
.t-dots { display: flex; gap: 6px; margin-top: 12px; }
.t-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.t-dots i.on { background: var(--ink); }
.t-clock { font: 800 clamp(96px, 14vw, 170px)/1 var(--f-ui); letter-spacing: -.045em; color: color-mix(in srgb, var(--ink) 86%, transparent); margin-top: 8px; }
.running .t-clock { color: var(--ink); }
.t-ctrls { display: flex; gap: 12px; margin-top: 18px; }
.sq { width: 50px; height: 50px; border-radius: 13px; border: 0; background: var(--btn); color: var(--ink); display: grid; place-items: center; cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: background .15s, transform .15s; flex: none; text-decoration: none; }
.sq:hover { background: var(--btn-hover); }
.sq:active { transform: scale(.96); }
.sq svg { width: 20px; height: 20px; }
.sq.sm { width: 36px; height: 36px; border-radius: 10px; }
.sq.sm svg { width: 17px; height: 17px; }
.sq.accent, .sq.on { background: var(--accent); color: var(--accent-ink); }
.t-subj { margin-top: 18px; font-size: 13.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.t-subj select { background: none; border: 0; color: var(--ink); font-weight: 700; cursor: pointer; padding: 2px; max-width: 220px; }

/* ---------- corners ---------- */
.corner { position: fixed; z-index: 8; bottom: calc(30px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 9px; }
.corner.bl { left: max(46px, env(safe-area-inset-left, 0px)); }
.corner.br { right: max(46px, env(safe-area-inset-right, 0px)); }
.seg { position: relative; display: flex; align-items: center; background: var(--btn); border-radius: 12px; height: 36px; padding: 0 2px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.seg button { width: 34px; height: 36px; border: 0; background: none; color: var(--ink); display: grid; place-items: center; cursor: pointer; position: relative; }
.seg button svg { width: 17px; height: 17px; position: relative; z-index: 1; }
.seg button.on::before { content: ""; position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); transform: translate(-50%, -50%); }
.seg button.on { color: var(--accent-ink); }
.seg button .lbl { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); font-size: 12.5px; font-weight: 600; color: var(--ink); white-space: nowrap; display: none; }
.seg button.on .lbl { display: block; }
.pill-btn { height: 36px; border-radius: 12px; border: 0; padding: 0 12px; background: var(--btn); color: var(--ink); font-weight: 700; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pill-btn:hover { background: var(--btn-hover); }
.pill-btn svg { width: 15px; height: 15px; }
.eq { display: inline-flex; gap: 2px; align-items: flex-end; height: 13px; position: absolute; right: -4px; top: -4px; background: var(--accent); border-radius: 6px; padding: 2px 3px; }
.eq i { width: 2px; background: #fff; animation: eq 1s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; } .eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 3px; } 50% { height: 9px; } }
.sq.has-eq { position: relative; }

/* ---------- popovers (anchored above the bottom-left tools) ---------- */
.pop { position: fixed; z-index: 9; left: max(30px, env(safe-area-inset-left, 0px)); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 150px); overflow-y: auto;
  background: var(--pop); color: var(--fg); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); display: flex; flex-direction: column; animation: pop-in .18s ease; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px); } }
.pop.closed { left: -10000px !important; right: auto !important; width: 360px !important; top: 0; bottom: auto; animation: none; }
.pop-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); font-size: 16px; }
.chip-ic { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: #b9a6ff; display: grid; place-items: center; flex: none; }
:root[data-ink="dark"] .chip-ic { color: var(--accent); }
.chip-ic svg { width: 17px; height: 17px; }
.pop .sq { background: var(--panel-2); color: var(--fg); backdrop-filter: none; }
.pop .sq:hover { background: var(--line); }
.pop .sq.accent { background: var(--accent); color: var(--accent-ink); }
.pop-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.pop-foot { border-top: 1px solid var(--line); padding: 14px 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.add-big { border: 0; background: none; font-weight: 700; font-size: 15px; cursor: pointer; color: var(--fg); }
.add-big:hover { color: var(--accent); }
.g-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 6px 2px; display: flex; gap: 6px; }
.g-label.overdue { color: var(--bad); }
.trow { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); font-size: 14.5px; }
.trow .t { flex: 1; min-width: 0; cursor: pointer; }
.trow .t small { display: block; color: var(--muted); font-size: 12px; }
.trow.done .t { text-decoration: line-through; color: var(--muted); }
.stats-line { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.stats-line b { color: var(--fg); }

/* music popover */
.now-row { display: flex; gap: 14px; align-items: center; padding: 16px 18px 8px; }
.thumb { width: 64px; height: 64px; border-radius: 12px; background: var(--panel-2) center / cover; flex: none; }
.np-meta { min-width: 0; }
.np-meta b { font-size: 15.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.np-meta small { color: var(--muted); }
.np-controls { display: flex; gap: 8px; align-items: center; padding: 6px 18px 12px; }
.np-controls .sq { width: 40px; height: 40px; border-radius: 11px; }
.np-controls .sq svg { width: 16px; height: 16px; }
.np-controls input { flex: 1; min-width: 60px; }
.yt-frame { position: relative; aspect-ratio: 16 / 9; margin: 0 18px; border-radius: 12px; overflow: hidden; background: #000; flex: none; }
.yt-frame #yt-host, .yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.err { margin: 8px 18px 0; font-size: 13px; color: var(--bad); }
.row-input { display: flex; gap: 8px; padding: 14px 18px 8px; }
.row-input input, .input { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; color: var(--fg); font-size: 14px; }
.pill { border: 0; border-radius: 10px; padding: 0 14px; font-weight: 700; font-size: 14px; cursor: pointer; background: var(--panel-2); color: var(--fg); min-height: 38px; }
.pill.accent { background: var(--accent); color: var(--accent-ink); }
.tracks { display: flex; flex-direction: column; padding: 4px 10px 12px; }
.track { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 7px 8px; border-radius: 10px; cursor: pointer; border: 0; background: none; color: inherit; text-align: left; font-size: 14px; }
.track:hover, .track.on { background: var(--panel-2); }
.track .tt { width: 44px; height: 30px; border-radius: 6px; background: var(--panel-2) center / cover; }
.track small { display: block; color: var(--muted); font-size: 12px; }
.track .x { opacity: 0; width: 28px; height: 28px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 7px; }
.track:hover .x { opacity: 1; }
.track.on b { color: #b9a6ff; }
:root[data-ink="dark"] .track.on b { color: var(--accent); }

/* ---------- sheet: the full app window ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .35); display: grid; padding: 14px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { display: grid; grid-template-columns: 236px minmax(0, 1fr); background: var(--sheet); color: var(--fg); border-radius: 20px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); min-height: 0; animation: rise .22s ease; }
@keyframes rise { from { transform: translateY(10px) scale(.99); opacity: .6; } }
.sheet-nav { background: var(--sheet-nav); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.sheet-nav .close { align-self: flex-start; margin: 0 0 14px 4px; width: 34px; height: 34px; border: 0; background: none; color: var(--fg); cursor: pointer; border-radius: 9px; display: grid; place-items: center; flex: none; }
.sheet-nav .close:hover { background: var(--panel-2); }
.sheet-nav .close svg { width: 22px; height: 22px; }
.sheet-nav a, .sheet-nav button.navl { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--fg); text-decoration: none; font-weight: 500; font-size: 14.5px; border: 0; background: none; cursor: pointer; text-align: left; }
.sheet-nav a:hover, .sheet-nav button.navl:hover { background: var(--panel-2); }
.sheet-nav a.on { background: var(--panel-2); font-weight: 700; }
.sheet-nav a svg, .sheet-nav button.navl svg { width: 18px; height: 18px; color: #a48cff; flex: none; }
:root[data-ink="dark"] .sheet-nav a svg, :root[data-ink="dark"] .sheet-nav button.navl svg { color: var(--accent); }
.sheet-nav .sub-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; margin: 0 4px; }
.sheet-nav .pct { margin-left: auto; font-size: 12px; color: var(--muted); }
.sheet-nav .nav-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; padding: 16px 12px 6px; }
.sheet-nav .foot { margin-top: auto; padding: 14px 10px 4px; font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }
.sheet-body { position: relative; overflow-y: auto; min-width: 0; container-type: inline-size; padding: 44px max(28px, min(56px, 4vw)) 80px; }
.page { max-width: 900px; display: flex; flex-direction: column; gap: 28px; }
.page.wide { max-width: 1100px; }
.ph h1 { margin: 0; font: 800 34px/1.1 var(--f-ui); letter-spacing: -.03em; text-wrap: balance; }
.ph p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.ph { display: flex; flex-direction: column; }
.ph-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.ph-row .ph { flex: 1; min-width: 220px; }
h2 { margin: 0; font: 700 18px/1.3 var(--f-ui); letter-spacing: -.01em; }
.sec { display: flex; flex-direction: column; gap: 12px; }
.sec-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.cols > * { min-width: 0; }

/* shared controls inside the sheet */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 0; background: var(--panel-2); border-radius: 10px; padding: 8px 13px; cursor: pointer; font-size: 13.5px; font-weight: 600; white-space: nowrap; color: var(--fg); text-decoration: none; }
.btn:hover { background: var(--line); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--fg); background: var(--panel-2); }
.btn.danger { color: var(--bad); }
.btn svg { width: 15px; height: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--panel-2); color: var(--fg); }
.icon-btn svg { width: 16px; height: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.field input, .field select, .field textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; color: var(--fg); font-size: 14px; }
.field textarea { min-height: 110px; resize: vertical; font-family: var(--f-mono); font-size: 13px; }
select option { color: #111; background: #fff; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 7px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.pri-high { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.pri-med { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.tabs { display: flex; gap: 4px; background: var(--panel-2); padding: 4px; border-radius: 12px; align-self: flex-start; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 7px 14px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13.5px; border-radius: 9px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); }
.tabs .count { opacity: .7; font-weight: 500; }
.empty { border: 1px dashed var(--line); border-radius: var(--r); padding: 20px; color: var(--muted); text-align: center; font-size: 14px; }
.example-note button { border: 0; background: none; padding: 0; color: var(--fg); text-decoration: underline; cursor: pointer; font-size: inherit; text-align: left; }
.check { appearance: none; width: 19px; height: 19px; border: 1.5px solid var(--muted); border-radius: 5px; margin: 0; cursor: pointer; flex: none; display: grid; place-items: center; background: transparent; }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after { content: ""; width: 5px; height: 10px; border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.add-link { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13.5px; padding: 5px 0; text-align: left; display: inline-flex; gap: 6px; align-items: center; font-weight: 500; }
.add-link:hover { color: var(--accent); }
.add-link svg { width: 14px; height: 14px; }
.bar { height: 5px; border-radius: 99px; background: var(--dot-off); overflow: hidden; flex: 1; min-width: 40px; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width .35s ease; }
.prog { display: flex; align-items: center; gap: 10px; }
.prog .num { font-size: 12px; color: var(--muted); width: 36px; text-align: right; }

/* subject tiles (sheet) */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.tile { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--fg); border: 0; background: none; padding: 0; text-align: left; cursor: pointer; font: inherit; }
.tile-cover { position: relative; aspect-ratio: 16 / 10; max-width: 100%; border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; color: #fff; transition: transform .2s ease; background-size: cover; background-position: center; }
.tile-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(0, 0, 0, .45)); }
.tile-cover > * { position: relative; z-index: 1; }
.tile:hover .tile-cover { transform: translateY(-2px); }
.tile-cover .code { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; opacity: .85; }
.tile-cover b { font-size: 20px; line-height: 1.15; letter-spacing: -.01em; }
.tile-meta { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); padding: 0 2px; }
.tile.add .tile-cover { border: 1.5px dashed var(--line); background: none; color: var(--muted); align-items: center; justify-content: center; font-weight: 600; }
.tile.add .tile-cover::after { display: none; }

/* tables */
.table-wrap { overflow-x: auto; }
table.db { width: 100%; border-collapse: collapse; font-size: 14px; }
table.db th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.db td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.db tr.click { cursor: pointer; }
table.db tr.click:hover td { background: var(--panel); }
table.db .title-cell { display: flex; align-items: center; gap: 10px; font-weight: 600; min-width: 180px; }
table.db .title-cell svg { width: 16px; height: 16px; color: var(--muted); flex: none; }

/* due rows inside the sheet */
.due-group { display: flex; flex-direction: column; gap: 6px; }
.due-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel-2); font-size: 14.5px; }
.due-item .t { flex: 1 1 180px; min-width: 0; cursor: pointer; }
.due-item.done .t { text-decoration: line-through; color: var(--muted); }

/* widgets (today) */
.widgets { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.w-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 15px; }
.dots { display: grid; grid-template-columns: repeat(var(--cols, 8), 1fr); gap: 7px; }
.dots i { aspect-ratio: 1; border-radius: 50%; background: var(--dot-off); }
.dots i.on { background: var(--fg); }
.dots i.now { background: var(--accent); }
.bigdate .d { font: 800 64px/1 var(--f-ui); letter-spacing: -.04em; }
.weekbars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; align-items: end; height: 70px; }
.weekbars div { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 10px; color: var(--muted); }
.weekbars span { width: 100%; border-radius: 4px; background: var(--accent); min-height: 3px; }
.stat-big { font: 800 34px/1 var(--f-ui); letter-spacing: -.02em; }

/* calendar */
.cal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-head .m { font-weight: 800; font-size: 20px; margin-right: auto; letter-spacing: -.01em; }
.cal-wrap { overflow-x: auto; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(90px, 1fr)); gap: 4px; min-width: 660px; }
.cal .dow { font-size: 12px; font-weight: 600; color: var(--muted); padding: 4px 8px; }
.cal .day { min-height: 106px; border-radius: 12px; background: var(--panel); padding: 7px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-width: 0; }
.cal .day:hover { background: var(--panel-2); }
.cal .day.out { opacity: .35; }
.cal .dnum { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.cal .day.today .dnum span { background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 1px 7px; }
.cal .ev { font-size: 11.5px; font-weight: 600; background: var(--panel-2); border-radius: 7px; padding: 4px 7px; border-left: 3px solid var(--c, var(--accent)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal .ev.done { opacity: .5; text-decoration: line-through; }
.cal .lec { font-size: 10.5px; color: var(--muted); display: flex; gap: 4px; align-items: center; overflow: hidden; white-space: nowrap; }
.cal .lec i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.cal .focusmin { margin-top: auto; font-size: 10.5px; color: var(--muted); }

/* subject page */
.subj-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.subj-head .dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.levels { display: flex; gap: 22px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.levels b { color: var(--fg); font-size: 15px; }
.tree { display: flex; flex-direction: column; gap: 10px; }
.unit { border-radius: 16px; background: var(--panel); border: 1px solid var(--line); }
.unit > summary, .chapter > summary { list-style: none; cursor: pointer; }
.unit > summary::-webkit-details-marker, .chapter > summary::-webkit-details-marker { display: none; }
.node-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) minmax(90px, 200px) auto; align-items: center; gap: 10px; padding: 13px 14px; }
.node-row .caret { transition: transform .2s; color: var(--muted); width: 14px; height: 14px; }
details[open] > summary .caret { transform: rotate(90deg); }
.node-row .name { font-weight: 700; min-width: 0; }
.node-row .name small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.node-row .acts { display: flex; opacity: 0; transition: opacity .15s; }
.node-row:hover .acts { opacity: 1; }
.unit > .unit-body { padding: 0 10px 10px 28px; display: flex; flex-direction: column; gap: 4px; }
.chapter { border-radius: 12px; }
.chapter > summary .node-row { padding: 9px 12px; }
.chapter > summary .node-row .name { font-weight: 600; }
.chapter[open] { background: var(--panel-2); }
.topics { display: flex; flex-direction: column; padding: 0 10px 10px 40px; }
.topic { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14.5px; }
.topic label { flex: 1; cursor: pointer; min-width: 0; }
.topic.done label { color: var(--muted); text-decoration: line-through; }
.topic .acts { opacity: 0; display: flex; }
.topic:hover .acts { opacity: 1; }

/* courses & embeds */
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.course .top { display: flex; gap: 12px; align-items: flex-start; }
.course .fav { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-weight: 800; flex: none; }
.course .top .info { flex: 1; min-width: 0; }
.course .top b { display: block; }
.course .top small { color: var(--muted); }
.embed { padding: 0; overflow: hidden; gap: 0; }
.embed .e-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; font-weight: 600; }
.embed .e-head .t { flex: 1; min-width: 0; }
.embed .frame { position: relative; aspect-ratio: 16 / 10; background: var(--panel-2); max-width: 100%; }
.embed .frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed .e-foot { font-size: 12px; color: var(--muted); padding: 7px 12px; }

/* resource pages */
.res-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.res-bar .crumbs { margin-right: auto; font-size: 13.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.res-bar .crumbs a { color: var(--muted); text-decoration: none; }
.res-bar .crumbs a:hover { color: var(--fg); }
.title-input { width: 100%; background: none; border: 0; font: 800 clamp(26px, 3.4vw, 36px)/1.15 var(--f-ui); letter-spacing: -.03em; color: var(--fg); padding: 0; }
.title-input:focus { outline: none; }
.props { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 6px 12px; font-size: 14px; align-items: center; }
.props .k { color: var(--muted); display: flex; gap: 7px; align-items: center; }
.props .k svg { width: 15px; height: 15px; }
.props select, .props input { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 5px 7px; max-width: 100%; color: var(--fg); }
.props select:hover, .props input:hover, .props select:focus, .props input:focus { border-color: var(--line); background: var(--panel-2); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.editor { width: 100%; min-height: 64vh; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; font: 13.5px/1.65 var(--f-mono); color: var(--fg); resize: vertical; }
.md-help { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; }
.md-help code { background: var(--panel-2); padding: 0 4px; border-radius: 4px; }
.viewer { border-radius: var(--r); overflow: hidden; background: var(--panel-2); }
.viewer iframe { width: 100%; height: 72vh; border: 0; display: block; background: #fff; }
.drop { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 22px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 8px; align-items: center; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { width: 22px; height: 22px; }

/* the note sheet */
.sheet-note { background: var(--paper); border-radius: 10px; box-shadow: 0 1px 0 var(--line), 0 18px 40px rgba(0, 0, 0, .18); padding: 34px 40px 44px 64px; font: 17px/32px var(--f-note); color: var(--fg); position: relative; min-width: 0; overflow-wrap: anywhere; }
.sheet-note.ruled { background-image: linear-gradient(var(--paper-rule) 1px, transparent 1px); background-size: 100% 32px; background-position: 0 30px; }
.sheet-note.ruled::before { content: ""; position: absolute; top: 0; bottom: 0; left: 46px; width: 1.5px; background: var(--paper-margin); }
.sheet-note.grid { background-image: linear-gradient(var(--paper-rule) 1px, transparent 1px), linear-gradient(90deg, var(--paper-rule) 1px, transparent 1px); background-size: 24px 24px; }
.sheet-note.clean { padding-left: 40px; }
.sheet-note > :first-child { margin-top: 0; }
.sheet-note h1, .sheet-note h2, .sheet-note h3 { font-family: var(--f-ui); line-height: 1.25; margin: 22px 0 8px; letter-spacing: -.01em; }
.sheet-note h1 { font-size: 28px; font-weight: 800; }
.sheet-note h2 { font-size: 21px; }
.sheet-note h3 { font-size: 17px; }
.sheet-note.ruled h1, .sheet-note.ruled h2 { font-family: var(--f-hand); font-size: 36px; font-weight: 600; letter-spacing: 0; }
.sheet-note.ruled h2 { font-size: 30px; }
.sheet-note p, .sheet-note ul, .sheet-note ol { margin: 0 0 12px; }
.sheet-note mark { background: color-mix(in srgb, var(--warn) 40%, transparent); color: inherit; padding: 0 3px; border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.sheet-note code { font: 14px var(--f-mono); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; }
.sheet-note pre { background: var(--panel-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; line-height: 1.5; }
.sheet-note pre code { background: none; padding: 0; }
.sheet-note blockquote { margin: 0 0 12px; border-left: 3px solid var(--line); padding-left: 14px; color: var(--muted); }
.sheet-note table { border-collapse: collapse; margin: 8px 0 16px; font: 15px/1.5 var(--f-ui); display: block; overflow-x: auto; }
.sheet-note th, .sheet-note td { border: 1px solid var(--line); padding: 5px 10px; }
.sheet-note th { background: var(--panel-2); }
.sheet-note hr { border: 0; border-top: 1.5px dashed var(--line); margin: 20px 0; }
.sheet-note li.task { list-style: none; margin-left: -22px; display: flex; gap: 10px; align-items: flex-start; }
.sheet-note li.task input { margin-top: 8px; accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; flex: none; }
.sheet-note li.task.done > span { text-decoration: line-through; color: var(--muted); }
.callout { display: flex; flex-direction: column; gap: 4px; border-radius: 12px; padding: 10px 14px; margin: 0 0 14px; font: 15.5px/1.6 var(--f-ui); background: var(--c-bg); border: 1px solid var(--c-line); }
.callout .c-title { font-weight: 700; display: flex; gap: 8px; align-items: center; color: var(--c-ink); }
.callout p:last-child { margin-bottom: 0; }
.callout.note { --c-bg: color-mix(in srgb, var(--accent) 10%, transparent); --c-line: color-mix(in srgb, var(--accent) 35%, transparent); --c-ink: #a48cff; }
.callout.tip { --c-bg: color-mix(in srgb, var(--good) 10%, transparent); --c-line: color-mix(in srgb, var(--good) 35%, transparent); --c-ink: var(--good); }
.callout.warn, .callout.exam { --c-bg: color-mix(in srgb, var(--bad) 10%, transparent); --c-line: color-mix(in srgb, var(--bad) 35%, transparent); --c-ink: var(--bad); }
.callout.example, .callout.summary { --c-bg: color-mix(in srgb, var(--warn) 10%, transparent); --c-line: color-mix(in srgb, var(--warn) 35%, transparent); --c-ink: var(--warn); }
.defn { display: grid; grid-template-columns: minmax(110px, 30%) minmax(0, 1fr); gap: 14px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.defn dt { font-weight: 700; font-family: var(--f-ui); font-size: 15px; }
.defn dd { margin: 0; }
.sheet-note .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.sheet-note.cornell { padding: 0; }
.cornell-top { padding: 26px 32px 6px; border-bottom: 2px solid var(--line); }
.cornell-row { display: grid; grid-template-columns: minmax(120px, 28%) minmax(0, 1fr); border-bottom: 1px solid var(--line); }
.cornell-row .cue { padding: 16px 18px; border-right: 2px solid var(--paper-margin); font: 600 22px/1.25 var(--f-hand); }
.cornell-row .cn-body { padding: 16px 24px; min-width: 0; }
.cornell-sum { padding: 16px 32px 22px; background: var(--panel-2); }
.cornell-sum .k { font: 700 12px var(--f-ui); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* settings: background library */
.seg-tabs { display: inline-flex; background: var(--panel-2); border-radius: 12px; padding: 4px; gap: 2px; align-self: flex-start; }
.seg-tabs button { border: 0; background: none; padding: 8px 18px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--fg); font-size: 14px; }
.seg-tabs button.on { background: var(--accent); color: var(--accent-ink); }
.bg-preview { position: relative; aspect-ratio: 16 / 7; border-radius: 16px; overflow: hidden; display: grid; place-items: center; color: #fff; font: 800 44px var(--f-ui); letter-spacing: -.04em; background-size: cover; background-position: center; }
.bg-preview span { position: relative; text-shadow: 0 2px 20px rgba(0, 0, 0, .3); }
.bg-preview small { position: absolute; left: 12px; bottom: 10px; font: 600 12px var(--f-ui); letter-spacing: 0; background: rgba(0, 0, 0, .45); padding: 3px 9px; border-radius: 7px; }
.lib-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.lib-card { border: 0; background: none; padding: 0; cursor: pointer; text-align: center; color: var(--fg); font-weight: 600; font-size: 13.5px; display: flex; flex-direction: column; gap: 8px; }
.lib-card .im { aspect-ratio: 16 / 9; border-radius: 12px; background-size: cover; background-position: center; border: 2px solid transparent; position: relative; }
.lib-card.on .im { border-color: var(--fg); }
.lib-card .badge { position: absolute; top: 7px; left: 7px; font-size: 10.5px; font-weight: 700; background: var(--accent); color: var(--accent-ink); padding: 1px 7px; border-radius: 6px; }
.lib-card small { color: var(--muted); font-weight: 500; font-size: 11.5px; margin-top: -6px; }
details.custom { border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
details.custom > summary { list-style: none; cursor: pointer; padding: 18px 20px; font-weight: 700; font-size: 17px; display: flex; justify-content: space-between; }
details.custom > summary::-webkit-details-marker { display: none; }
details.custom > div { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 12px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; color: var(--fg); }
.switch input { accent-color: var(--accent); width: 18px; height: 18px; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--sheet); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--fg); }
input[type=range] { accent-color: var(--accent); }

/* ---------- aesthetic studio ---------- */
.studio-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.studio-imgs .si { position: relative; aspect-ratio: 1; border-radius: 10px; background: var(--panel-2) center / cover; overflow: hidden; }
.studio-imgs .si button { position: absolute; border: 0; cursor: pointer; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 3px 6px; opacity: 0; transition: opacity .15s; }
.studio-imgs .si:hover button { opacity: 1; }
.studio-imgs .si .rm { top: 4px; right: 4px; background: rgba(0, 0, 0, .6); color: #fff; }
.studio-imgs .si .use { left: 4px; bottom: 4px; background: #fff; color: #111; }
.palette { display: flex; gap: 8px; flex-wrap: wrap; }
.palette button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }
.palette button.on { border-color: var(--fg); }
.palette small { display: block; font: 500 10.5px var(--f-mono); color: var(--muted); text-align: center; margin-top: 4px; }
.gh-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.gh-item { border-radius: 12px; background: var(--panel-2); overflow: hidden; display: flex; flex-direction: column; font-size: 12.5px; }
.gh-item .im { aspect-ratio: 16 / 10; background: var(--panel) center / cover; }
.gh-item .nm { padding: 6px 8px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.gh-item .acts { display: flex; gap: 4px; padding: 6px 6px 8px; flex-wrap: wrap; }
.gh-item .acts button { border: 0; background: var(--panel-2); color: var(--fg); font-size: 11.5px; font-weight: 600; border-radius: 7px; padding: 4px 7px; cursor: pointer; }
.gh-item .acts button:hover { background: var(--accent); color: var(--accent-ink); }
.gh-folder { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); border: 0; color: var(--fg); cursor: pointer; font-weight: 600; font-size: 13.5px; text-align: left; }
.gh-folder:hover { background: var(--line); }
.gh-folder svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.crumbs-gh { display: flex; gap: 4px; flex-wrap: wrap; font-size: 13px; color: var(--muted); align-items: center; }
.crumbs-gh button { border: 0; background: none; color: var(--fg); cursor: pointer; padding: 2px 4px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.crumbs-gh button:hover { background: var(--panel-2); }
.ex-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-chips button { border: 1px solid var(--line); background: none; color: var(--muted); border-radius: 99px; padding: 4px 10px; font-size: 12.5px; cursor: pointer; }
.ex-chips button:hover { color: var(--fg); border-color: var(--muted); }
.saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.saved-card { border-radius: 14px; overflow: hidden; background: var(--panel-2); display: flex; flex-direction: column; }
.saved-card .im { aspect-ratio: 16 / 9; background-size: cover; background-position: center; display: grid; place-items: center; font: 800 26px var(--f-ui); color: #fff; letter-spacing: -.03em; }
.saved-card .row { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.saved-card .row b { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-card .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }

/* ---------- the study room ---------- */
.room-host { position: fixed; inset: 0; z-index: 1; }
.room-host canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
body.in-room .bg-photo { filter: blur(10px) brightness(.55) saturate(1.1); transform: scale(1.06); }
body.in-room .quote { display: none; }
.room-tip { position: absolute; pointer-events: none; background: var(--pop); color: var(--fg); font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 9px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.center.room-mode { place-items: start center; padding-top: calc(28px + env(safe-area-inset-top, 0px)); }
@media (max-width: 1180px) { .center.room-mode { padding-top: calc(84px + env(safe-area-inset-top, 0px)); } }
.room-hud { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 16px; background: var(--btn); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); flex-wrap: wrap; justify-content: center; max-width: 92vw; }
.room-hud .rh-timer { display: flex; align-items: center; gap: 10px; padding: 0 4px 0 12px; }
.room-hud .rh-timer small { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.room-hud .rh-timer b { font: 800 22px var(--f-ui); letter-spacing: -.02em; font-variant-numeric: tabular-nums; min-width: 64px; }
.room-hud .rh-task { background: rgba(255, 255, 255, .08); border: 0; border-radius: 10px; padding: 8px 12px; color: var(--ink); width: 240px; font-size: 14px; font-weight: 600; }
.room-hud .rh-task::placeholder { color: var(--ink-2); }
.room-hud .rh-task:focus { outline: none; background: rgba(255, 255, 255, .14); }
.room-hint { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-2); text-align: center; }
.room-loading { position: fixed; inset: 0; display: grid; place-items: center; z-index: 1; color: var(--ink-2); font-weight: 600; pointer-events: none; }
.mixer { border-top: 1px solid var(--line); padding: 12px 18px 16px; display: flex; flex-direction: column; gap: 8px; }
.mixer h4 { margin: 0 0 2px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mix-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: center; font-size: 14px; font-weight: 600; }
/* room customiser */
.rc-sec { display: flex; flex-direction: column; gap: 8px; }
.rc-sec > b { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); border-radius: 99px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.chips button.on { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.chips .swatch { width: 26px; height: 26px; }
.chips .swatch.auto { background: conic-gradient(from 45deg, #6c47ff, #e0725f, #4fb3a9, #6c47ff); }
.vis-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
.vis { border: 2px solid transparent; border-radius: 12px; padding: 0; background: var(--panel-2); cursor: pointer; overflow: hidden; display: flex; flex-direction: column; color: var(--fg); font: 600 12px var(--f-ui); transition: transform .12s, border-color .12s; }
.vis:hover { transform: translateY(-1px); }
.vis svg { display: block; width: 100%; height: auto; }
.vis span { padding: 5px 4px 6px; }
.vis.on { border-color: var(--accent); }
.vis.off { opacity: .45; }
/* together */
.tg-members { display: flex; flex-direction: column; gap: 6px; }
.tg-m { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--panel-2); font-size: 14px; }
.tg-m .av { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; flex: none; }
.tg-m .who { flex: 1; min-width: 0; }
.tg-m .who small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-m .st { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tg-m .st.focus { color: var(--good); } .tg-m .st.break { color: var(--warn); } .tg-m .st.idle { color: var(--muted); }
.tg-chat { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; padding: 2px; }
.tg-line { font-size: 13.5px; line-height: 1.4; }
.tg-line b { margin-right: 6px; }
.tg-line.sys { color: var(--muted); font-style: italic; }
.code-chip { font: 800 22px var(--f-mono); letter-spacing: .14em; background: var(--panel-2); padding: 6px 12px; border-radius: 10px; }

/* ---------- modal & toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--sheet); color: var(--fg); border: 1px solid var(--line); border-radius: 18px; width: min(520px, 100%); max-height: 88vh; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.modal-box h3 { margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.modal-box form { display: flex; flex-direction: column; gap: 12px; }
.modal-box .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-box .acts { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.modal-box .acts .left { margin-right: auto; }
.toast { position: fixed; left: 50%; top: calc(24px + env(safe-area-inset-top, 0px)); transform: translateX(-50%); background: var(--pop); color: var(--fg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 70; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); display: flex; align-items: center; gap: 10px; }

/* ---------- stickers ---------- */
.sticker-layer { position: absolute; top: 0; left: 0; right: 0; height: 100%; pointer-events: none; z-index: 6; overflow: hidden; }
.sticker { position: absolute; pointer-events: auto; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .3)); }
.sticker:active { cursor: grabbing; }
.sticker img { width: 100%; display: block; pointer-events: none; border-radius: 6px; }
.sticker.img { background: #fff; padding: 5px; border-radius: 10px; }
.sticker.text { font-family: var(--f-hand); font-weight: 600; background: var(--accent); color: var(--accent-ink); padding: .12em .6em .18em; border-radius: 999px; white-space: nowrap; }
.sticker.sel { outline: 2px dashed var(--accent); outline-offset: 6px; }
.st-tools { position: absolute; transform: translateX(-50%); pointer-events: auto; display: flex; gap: 2px; background: var(--pop); border: 1px solid var(--line); border-radius: 10px; padding: 3px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); z-index: 7; }
.st-tools button { width: 30px; height: 28px; border: 0; background: none; border-radius: 7px; cursor: pointer; font-size: 15px; color: var(--fg); }
.st-tools button:hover { background: var(--panel-2); }
.st-tools [data-st="del"] { color: var(--bad); }
.tray { position: fixed; right: max(30px, env(safe-area-inset-right, 0px)); bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 9; width: min(380px, calc(100vw - 32px)); max-height: min(560px, calc(100vh - 150px)); overflow-y: auto; background: var(--pop); color: var(--fg); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); padding: 16px; display: flex; flex-direction: column; gap: 12px; animation: pop-in .18s ease; }
.tray-head { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.tray-head b { font-size: 15px; }
.tray-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 4px; }
.tray-grid button { aspect-ratio: 1; border: 0; background: var(--panel-2); border-radius: 10px; font-size: 22px; cursor: pointer; transition: transform .12s; padding: 0; }
.tray-grid button:hover { transform: scale(1.12) rotate(-4deg); }
.tray-grid.pack { grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.tray-grid .pk { position: relative; }
.tray-grid .pk > button:first-child { width: 100%; overflow: hidden; }
.tray-grid .pk img { width: 100%; height: 100%; object-fit: contain; }
.tray-grid .pk-x { position: absolute; top: -5px; right: -5px; width: 20px !important; height: 20px; aspect-ratio: auto !important; font-size: 10px !important; border-radius: 50% !important; background: var(--bad) !important; color: #fff; opacity: 0; }
.tray-grid .pk:hover .pk-x { opacity: 1; }
.pk-add { aspect-ratio: 1; border: 1.5px dashed var(--line); border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.pk-add:hover { border-color: var(--accent); color: var(--accent); }
.pk-add svg { width: 20px; height: 20px; }
.tray-texts { display: flex; flex-wrap: wrap; gap: 6px; }
.sticker-chip { font: 600 17px var(--f-hand); background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 99px; padding: 2px 12px 4px; cursor: pointer; }
.tray .row-input { padding: 0; }

@container (max-width: 760px) { .cols, .split { grid-template-columns: minmax(0, 1fr); } .cols > .sec[style*=sticky] { position: static !important; } }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .topbar { padding: calc(20px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) 0 max(18px, env(safe-area-inset-left, 0px)); }
  .wordmark { font-size: 26px; }
  .quote { display: none; }
  .center { padding: 80px 14px 150px; }
  .lec { width: calc(50% - 5px); }
  .lec-row { gap: 8px; }
  .lec-row .lec:nth-child(n+5) { display: none; }
  .corner.bl { left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  .corner.br { right: max(16px, env(safe-area-inset-right, 0px)); }
  .seg button .lbl { display: none !important; }
  .pop, .tray { left: 12px; right: 12px; width: auto; bottom: calc(126px + env(safe-area-inset-bottom, 0px)); max-height: calc(100vh - 200px); }
  .sheet-wrap { padding: 0; }
  .sheet { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); border-radius: 0; }
  .sheet-nav { flex-direction: row; overflow-x: auto; padding: 10px; gap: 4px; align-items: center; }
  .sheet-nav .close { margin: 0; }
  .sheet-nav .nav-label, .sheet-nav .foot, .sheet-nav .subj-link { display: none; }
  .sheet-nav a, .sheet-nav button.navl { white-space: nowrap; padding: 8px 10px; }
  .sheet-body { padding: 24px 16px 60px; }
  .cols, .split { grid-template-columns: minmax(0, 1fr); }
  .sheet-note { padding: 24px 18px 30px 30px; font-size: 16px; }
  .sheet-note.ruled::before { left: 18px; }
  .cornell-row { grid-template-columns: minmax(0, 1fr); }
  .cornell-row .cue { border-right: 0; border-bottom: 1px dashed var(--paper-margin); padding-bottom: 6px; }
  .node-row { grid-template-columns: 18px minmax(0, 1fr) auto; }
  .node-row .prog { grid-column: 2 / -1; }
  .props { grid-template-columns: 100px minmax(0, 1fr); }
  .defn { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* gallery wall posters in the room customiser */
.rc-note { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.poster-slots { display: grid; grid-template-columns: 1.15fr .75fr; grid-template-rows: 1fr 1fr; gap: 8px; height: 168px; }
.poster-slot { position: relative; min-height: 0; }
.poster-slot.portrait { grid-row: span 2; }
.ps-img { width: 100%; height: 100%; border-radius: 10px; border: 1.5px dashed var(--muted); background: rgba(255,255,255,.04) center / cover no-repeat; color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: transform .15s, border-color .15s; }
.ps-img[style*="background-image"] { border: 4px solid #f3eee6; box-shadow: 0 0 0 2px #241f2e, 0 6px 16px rgba(0,0,0,.3); }
.ps-img:hover { transform: translateY(-1px); border-color: var(--accent); }
.ps-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: #241f2e; color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.poster-studio { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.poster-studio button { flex: none; width: 44px; height: 56px; border-radius: 6px; border: 0; background: #2a2537 center / cover no-repeat; cursor: pointer; }
.poster-studio button:hover { outline: 2px solid var(--accent); }
.ps-img svg, .ps-x svg { width: auto; height: auto; flex: none; }

/* small toggle chips (visualiser style, cat options) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--fg); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.mix-note { margin: 2px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* music visualiser strip along the bottom of the stage */
.viz { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: min(760px, 70vw); height: 72px; z-index: 1; pointer-events: none; opacity: 0; transition: opacity .8s ease; }
@media (max-width: 640px) { .viz { width: 100vw; height: 56px; } }

/* room backdrop picker; a chosen backdrop shows sharp behind the room */
body.in-room.room-bg .bg-photo { filter: none; transform: none; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; }
.bd { position: relative; aspect-ratio: 1; border-radius: 10px; border: 2px solid transparent; background: #222 center / cover no-repeat; cursor: pointer; padding: 0; display: grid; place-items: end center; overflow: hidden; color: #fff; }
.bd span { font-size: 10.5px; font-weight: 700; padding: 0 0 4px; text-shadow: 0 1px 3px rgba(0,0,0,.6); filter: none; }
.bd:hover { transform: translateY(-1px); }
.bd.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.bd.add { place-items: center; background: var(--panel-2); border: 1.5px dashed var(--muted); color: var(--muted); }

/* room brightness slider in the room's top bar */
.rh-bright { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: 12px; background: var(--btn); color: var(--ink); }
.rh-bright input { width: 84px; accent-color: var(--accent); }
@media (max-width: 640px) { .rh-bright input { width: 56px; } }
