/*
 * Shoebox: Grape soda.
 * A lavender-white page, deep grape ink and one violet signature, with a
 * soft gold underline on your own words. Dark mode is a deep plum, not black,
 * with the same violet. Photos carry the rest of the colour, and each one
 * tints its own post faintly.
 * Instrument Serif for your own words and headlines, Geist for everything else.
 *
 * Layout: one timeline column (max 600px). Your face sits in a rail on the
 * left of each post; photos run edge to edge across the rail; actions span
 * the full width under the post. Sheets rise from the bottom.
 *
 * Rules kept: the page body never pans or zooms (only the timeline, the
 * reader and sheets scroll), text fields are 16px or more, icons are SVG at
 * one stroke weight, type follows the phone's text size (rem from the
 * system body size), every control is at least 44px.
 */

:root {
  --bg: #FBF8FF;
  --fg: #22123B;
  --muted: #5E5270;
  --faint: #6E6285;
  --line: #EBE3F8;
  --line-2: #DED2F2;
  --soft: #EFE6FF;
  --panel: #F6F1FF;
  --sig: #7B3FF2;
  --sig-ink: #6A2FE0;
  --sig-soft: #EFE6FF;
  --on-sig: #FFFFFF;
  --hl: rgba(255, 210, 63, 0.55);
  --gold: #FFD23F;      /* the + button: never the same colour as the violet buttons under it */
  --on-gold: #22123B;
  --later: #7A5300;
  --later-soft: #FFF1C9;
  --love: #E0457B;
  --warn: #B3261E;
  --scrim: rgba(34, 18, 59, 0.42);
  --toast-bg: #22123B;
  --toast-fg: #FFFFFF;
  --toast-act: #FFD23F;
  --mix: 5%;
  --logo-box: #7B3FF2;
  --logo-rim: #4B1FA8;
  --logo-card: #FFF7DA;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", -apple-system, "SF Pro Text", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, Menlo, monospace;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --gutter-l: max(16px, var(--safe-l));
  --gutter-r: max(16px, var(--safe-r));
  --rail: 40px;
  --fade: 0px; /* the iPhone's blur under the status bar, in the installed app (see below) */
  --gap: 12px;

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1033;
    --fg: #F3ECFF;
    --muted: #B9A9D6;
    --faint: #9D8DBB;
    --line: #2E2050;
    --line-2: #3A2A63;
    --soft: #2A1B4A;
    --panel: #22163F;
    --sig: #7B3FF2;
    --sig-ink: #B794FF;
    --sig-soft: #33215C;
    --on-sig: #FFFFFF;
    --hl: rgba(230, 184, 0, 0.42);
    --later: #FFD23F;
    --later-soft: #3A2E0A;
    --love: #FF6FA0;
    --warn: #FF8A80;
    --scrim: rgba(8, 4, 20, 0.6);
    --toast-bg: #F3ECFF;
    --toast-fg: #1B1033;
    --toast-act: #6A2FE0;
    --mix: 10%;
    --logo-box: #7B3FF2;
    --logo-rim: #B794FF;
    --logo-card: #2A1B4A;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --bg: #1B1033;
    --fg: #F3ECFF;
    --muted: #B9A9D6;
    --faint: #9D8DBB;
    --line: #2E2050;
    --line-2: #3A2A63;
    --soft: #2A1B4A;
    --panel: #22163F;
    --sig: #7B3FF2;
    --sig-ink: #B794FF;
    --sig-soft: #33215C;
    --on-sig: #FFFFFF;
    --hl: rgba(230, 184, 0, 0.42);
    --later: #FFD23F;
    --later-soft: #3A2E0A;
    --love: #FF6FA0;
    --warn: #FF8A80;
    --scrim: rgba(8, 4, 20, 0.6);
    --toast-bg: #F3ECFF;
    --toast-fg: #1B1033;
    --toast-act: #6A2FE0;
    --mix: 10%;
    --logo-box: #7B3FF2;
    --logo-rim: #B794FF;
    --logo-card: #2A1B4A;
    color-scheme: dark;
}

/* On iPhone, an installed web app gets a blurred fade under the status bar that covers
   whatever is there. Everything pinned to the top starts below it, as in Scales. */
@media (display-mode: standalone) { :root { --fade: 44px; } }

/* ---------- Lock the page: no pan, no bounce, no zoom ---------- */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 100%; }
@supports (font: -apple-system-body) { html { font: -apple-system-body; } } /* follow the phone's text size */
html, body { margin: 0; height: 100%; width: 100%; overflow: hidden; overscroll-behavior: none; background: var(--bg); color: var(--fg); }
body {
  position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%);
  font-family: var(--sans); font-size: 0.9375rem; line-height: 1.45; -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
button, a, input, textarea, label { touch-action: manipulation; }
input, textarea, .prose, .quote, .summary, .say, .body, .guess, .why-line, .story-replies { -webkit-user-select: text; user-select: text; }
button, input, textarea { font: inherit; color: inherit; }
input, textarea { font-size: max(16px, 1rem); }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--sig); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.i.fill { fill: currentColor; stroke: none; }
.label { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }

/* ================= Loading screen =================
 * In the page itself, so it shows the moment the app opens. The lid lifts
 * once; the screen fades when the timeline is ready.
 */
.splash {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: var(--safe-t) var(--gutter-r) var(--safe-b) var(--gutter-l); text-align: center;
  transition: opacity 0.35s ease;
}
.splash.out { opacity: 0; pointer-events: none; }
.splash-mark { width: 112px; height: 112px; margin-bottom: 10px; }
.splash-mark .lid { transform-box: view-box; transform-origin: 6px 26px; animation: lid-open 0.8s cubic-bezier(0.3, 0.7, 0.2, 1) 0.15s both; }
@keyframes lid-open { from { transform: rotate(0deg); } to { transform: rotate(-16deg); } }
.splash-name { margin: 0; font: 400 2.75rem/1 var(--serif); color: var(--sig-ink); letter-spacing: -0.01em; }
.splash-line { margin: 0; font-size: 1rem; color: var(--muted); }

/* ================= Timeline ================= */
.tl {
  position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%);
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--safe-b) + 112px);
}
.tl > header, .tl > main { max-width: 600px; margin: 0 auto; }
.top {
  position: sticky; top: 0; z-index: 5; background: var(--bg);
  padding: calc(var(--safe-t) + var(--fade)) var(--gutter-r) 0 var(--gutter-l); border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 10px; min-height: 56px; }
.mark { margin: 0; display: flex; align-items: center; gap: 8px; font: 400 1.85rem/1 var(--serif); color: var(--sig-ink); letter-spacing: -0.005em; }
.logo, .logo-svg { width: 32px; height: 32px; display: block; flex: none; }
.icon-btn { width: 44px; height: 44px; margin: 0 -10px 0 auto; display: grid; place-items: center; border-radius: 22px; color: var(--fg); }
.icon-btn:active { background: var(--soft); }
.tabs { display: flex; }
.tab { flex: 1; min-height: 44px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--sig); font-weight: 600; }

/* The Today strip: greeting, what's left, and a circle per item in today's six. */
.strip { display: flex; align-items: center; gap: 12px; padding: 14px var(--gutter-r) 12px var(--gutter-l); border-bottom: 1px solid var(--line); }
.hello { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.hi { margin: 0; font: 400 1.3rem/1.1 var(--serif); }
.strip .left { margin: 2px 0 0; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.dots { display: flex; gap: 0; flex: none; }
.dot { position: relative; width: 34px; height: 34px; margin-left: -6px; border-radius: 50%; overflow: hidden; background: var(--soft); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--sig); }
.dot:first-child { margin-left: 0; }
.dot::before { content: ""; position: absolute; inset: -5px; } /* a 44px target around the 34px circle */
.dot img, .dot-l { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; }
.dot-l { background: var(--c, var(--sig)); color: #fff; font: 600 0.8125rem var(--sans); }
.dot.done { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--gold); }
.dot.done img, .dot.done .dot-l { opacity: 0.35; }
.dot .tick { position: absolute; inset: 0; display: grid; place-items: center; color: var(--fg); }
.dot .tick .i { width: 18px; height: 18px; stroke-width: 2.6; }
.cleared { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-weight: 600; font-size: 0.875rem; }
.cleared .i { width: 16px; height: 16px; stroke-width: 2.4; }

.av { width: var(--rail); height: var(--rail); border-radius: 50%; flex: none; display: block; object-fit: cover; background: var(--soft); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--sig); }
.av.sm { width: 32px; height: 32px; }
.av.lg { width: 72px; height: 72px; }
.av-none { display: grid; place-items: center; color: var(--sig); background: var(--sig-soft); }
.av-none .i { width: 60%; height: 60%; }
.av-sb { display: grid; place-items: center; background: var(--sig-soft); box-shadow: none; padding: 6px; }
.av-sb .logo-svg { width: 100%; height: 100%; }

.sep {
  margin: 0; display: flex; align-items: baseline; gap: 10px; padding: 22px var(--gutter-r) 8px var(--gutter-l);
  font: 400 1.5rem/1.1 var(--serif); color: var(--fg);
}
.sep-note { margin-left: auto; font: 500 0.8125rem/1.3 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Posts ---- */
.post {
  --t: var(--fg);
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); column-gap: var(--gap);
  padding: 16px var(--gutter-r) 6px var(--gutter-l); border-bottom: 1px solid var(--line);
}
.post.tinted { background: color-mix(in srgb, var(--t) var(--mix), var(--bg)); }
.post:has(+ .replies) { border-bottom: 0; }
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rail .line { flex: 1; width: 2px; border-radius: 2px; background: var(--line-2); margin-bottom: -6px; }
.main { min-width: 0; }
.meta { display: flex; align-items: baseline; gap: 4px; min-height: 24px; min-width: 0; }
.meta .who { flex: none; }
.who { font-weight: 600; }
.when { color: var(--faint); font-size: 0.875rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .tag { flex: none; }
.reply .when, .story-replies .when { white-space: normal; }
.meta .more { margin: -10px -10px -10px auto; color: var(--faint); }
.meta .tag + .more { margin-left: 2px; }
.tag { margin-left: auto; font-size: 0.75rem; font-weight: 500; color: var(--muted); background: var(--soft); border-radius: 999px; padding: 2px 9px; }
.tag.fade { color: var(--later); background: var(--later-soft); }
.tag.love { display: inline-flex; align-items: center; gap: 4px; color: var(--love); background: none; padding: 0; }
.tag.love .i { width: 14px; height: 14px; }
.say { margin: 4px 0 0; font: 400 1.35rem/1.22 var(--serif); text-wrap: pretty; overflow-wrap: anywhere; white-space: pre-line;
  text-decoration-line: underline; text-decoration-color: var(--hl); text-decoration-thickness: 0.32em; text-underline-offset: -0.12em; text-decoration-skip-ink: none; }
.body { margin: 4px 0 0; overflow-wrap: anywhere; }
.guess { margin: 4px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.why-line { margin: 10px 0 0; font: 400 1.1rem/1.3 var(--serif); text-decoration-line: underline; text-decoration-color: var(--hl); text-decoration-thickness: 0.32em; text-underline-offset: -0.12em; text-decoration-skip-ink: none; }
.why-line span { text-decoration: none; }
.why-line span { display: block; font: 500 0.8125rem/1.3 var(--sans); color: var(--muted); }
.busy { margin: 8px 0 0; font-size: 0.8125rem; color: var(--sig-ink); }
.quote { margin: 6px 0 0; }
.quote blockquote { margin: 0; font: 400 1.85rem/1.1 var(--serif); text-wrap: balance; overflow-wrap: anywhere; white-space: pre-line; }
.quote.long blockquote { font-size: 1.4rem; line-height: 1.2; }
.quote figcaption { margin-top: 8px; font-size: 0.875rem; color: var(--muted); }

/* Pictures. A photo runs edge to edge, across the rail; a link gets a card. */
.pic { position: relative; background: var(--soft); overflow: hidden; }
.pic img { display: block; width: 100%; height: 100%; object-fit: cover; max-width: 100%; }
.pic .open { display: block; width: 100%; height: 100%; }
.bleed { margin: 12px calc(-1 * var(--gutter-r)) 0 calc(-1 * (var(--rail) + var(--gap) + var(--gutter-l))); aspect-ratio: 4 / 5; max-height: 78vh; }
.bleed.small { margin-left: 0; margin-right: 0; aspect-ratio: 4 / 3; border-radius: 14px; }
@media (min-width: 640px) { .bleed { margin-left: 0; margin-right: 0; border-radius: 16px; } }
.badge-on { position: absolute; left: 12px; bottom: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(23, 18, 15, 0.72); color: #fff; font-size: 0.8125rem; font-weight: 500; }
.burst { position: absolute; left: 50%; top: 46%; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: #fff; opacity: 0; pointer-events: none; filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.35)); }
.burst .i { width: 100%; height: 100%; }
.burst.go { animation: burst 0.8s ease-out; }
@keyframes burst { 0% { opacity: 0; transform: scale(0.4); } 20% { opacity: 1; transform: scale(1.15); } 45% { transform: scale(0.95); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1); } }

.card { margin-top: 12px; border: 1px solid var(--line-2); border-radius: 16px; overflow: hidden; background: color-mix(in srgb, var(--t) calc(var(--mix) * 1.4), var(--bg)); }
.card .pic.wide { aspect-ratio: 16 / 9; }
.card > .open { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; min-height: 56px; }
.card .lk { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card .site { font-size: 0.8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .ttl { font-weight: 600; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.fav, .ext { width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--c, var(--sig)); color: #fff; font-weight: 600; }
.ext { font: 500 0.75rem var(--mono); }
.play { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.play .i { width: 56px; height: 56px; padding: 16px; border-radius: 50%; background: rgba(23, 18, 15, 0.62); color: #fff; fill: #fff; stroke: none; }

.quick { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--t) 9%, var(--soft)); font-size: 0.875rem; }
.quick h3 { margin: 0 0 4px; font-size: 0.8125rem; font-weight: 600; color: var(--sig-ink); }
.quick ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }

/* Actions span the post, under the rail too, so they fit a phone. */
.acts-row { grid-column: 1 / -1; padding-top: 4px; }
.acts { display: flex; align-items: center; gap: 0; flex-wrap: wrap; margin: 0 -6px 0 -10px; }
.acts .grow { flex: 1; }
.act {
  min-width: 44px; min-height: 44px; padding: 0 8px; border-radius: 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  color: var(--muted); font-size: 0.875rem; font-weight: 500;
}
.act:active { filter: brightness(0.95); }
.acts .act[data-v] { background: var(--soft); color: var(--fg); margin-left: 5px; padding: 0 11px 0 9px; min-height: 40px; border-radius: 20px; }
.acts .act[data-v] .i { color: var(--sig-ink); }
.act.icon { padding: 0; }
.act .n { font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.act[data-love][aria-pressed="true"] { color: var(--love); }
.acts .act.done { background: var(--sig); color: var(--on-sig); padding: 0 14px 0 11px; font-weight: 600; box-shadow: 0 4px 12px color-mix(in srgb, var(--sig) 35%, transparent); }
.acts .act.done .i { color: var(--on-sig); }
.act.done:active { background: var(--sig-ink); }
.post.settled .say, .post.settled .quote, .post.settled .pic, .post.settled .card, .post.settled .quick, .post.settled .guess, .post.settled .why-line { opacity: 0.45; }
/* What you decided, as status text (not a button), with Undo or Bring back beside it. */
.settled-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.stamp { margin: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 500; }
.stamp .i { width: 16px; height: 16px; flex: none; }
.stamp.done { color: var(--sig-ink); }
.stamp.later { color: var(--later); }
.stamp.go { color: var(--muted); }
.settled-row .act { background: var(--soft); color: var(--fg); padding: 0 12px 0 10px; min-height: 40px; border-radius: 20px; margin-right: -6px; }
.settled-row .act .i { width: 18px; height: 18px; color: var(--sig-ink); }
.undo { min-height: 44px; padding: 0 12px; font-weight: 600; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }

/* Replies to yourself hang off the post, joined by the line under your face. */
.replies { border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.reply { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); column-gap: var(--gap); padding: 8px var(--gutter-r) 8px var(--gutter-l); }
.reply .rail { align-items: center; }
.reply .say { font-size: 1.15rem; }
.more-replies { min-height: 44px; padding: 0 var(--gutter-r) 0 calc(var(--gutter-l) + var(--rail) + var(--gap)); color: var(--muted); font-size: 0.875rem; font-weight: 500; text-align: left; width: 100%; }

/* ---- The end of Today ---- */
.end { text-align: center; padding: 40px var(--gutter-r) 24px var(--gutter-l); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.end h2 { margin: 0; font: 400 2.1rem/1.05 var(--serif); color: var(--sig-ink); text-wrap: balance; }
.end.quiet h2 { color: var(--fg); font-size: 1.6rem; }
.end p { margin: 0; color: var(--muted); max-width: 34ch; }
.end-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.collage { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; width: min(100%, 330px); margin-top: 16px; }
.tile { aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--soft); display: grid; }
.tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tw { display: grid; place-items: center; padding: 8px; font: 400 0.95rem/1.1 var(--serif); color: #fff; background: var(--c, var(--sig)); text-align: center; }
.end.win.first .tile { animation: pop 0.5s ease-out both; animation-delay: calc(var(--k) * 70ms); }
@keyframes pop { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
.tally { display: flex; gap: 24px; margin-top: 14px; font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tally b { display: block; font-size: 1.4rem; font-weight: 600; color: var(--fg); }

/* ---- All saves ---- */
.find-wrap { position: relative; margin: 14px var(--gutter-r) 0 var(--gutter-l); }
.find-wrap .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.find { height: 48px; width: 100%; padding: 0 14px 0 42px; border-radius: 24px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg); outline: none; }
.find:focus { border-color: var(--sig); }
.tl .chips { padding: 10px var(--gutter-r) 0 var(--gutter-l); }
.tide { padding: 0 var(--gutter-r) 6px var(--gutter-l); }
.tide-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tide-row .txt { flex: 1; min-width: 0; min-height: 44px; text-align: left; display: flex; flex-direction: column; justify-content: center; }
.tide-row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tide-row .s { font-size: 0.8125rem; color: var(--later); }
.tide-row.faded .t { color: var(--muted); }
.post.compact .say { font-size: 1.2rem; }
.empty { padding: 24px var(--gutter-r) 24px var(--gutter-l); color: var(--muted); }
.btn.more { margin: 16px auto; }

/* ---- The + button ---- */
.fab {
  position: fixed; z-index: 8; right: calc(var(--gutter-r) + 4px); bottom: calc(var(--safe-b) + 20px);
  width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center;
  background: var(--gold); color: var(--on-gold); box-shadow: 0 8px 22px rgba(34, 18, 59, 0.28);
}
.fab .i { width: 26px; height: 26px; stroke-width: 2.2; }
.fab:active { transform: scale(0.96); }
@media (min-width: 680px) { .fab { right: calc(50% - 300px + 16px); } }

/* ================= Shared controls ================= */
.chips { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 40px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 500; color: var(--fg); background: var(--bg);
}
.chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); font-weight: 600; }
.chip .i { width: 14px; height: 14px; }
.chip .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.btn {
  min-height: 48px; padding: 0 18px; border-radius: 24px; background: var(--soft); color: var(--fg);
  font-size: 0.9375rem; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 0.875rem; }
.btn.primary { background: var(--sig); color: var(--on-sig); font-weight: 600; }
.btn.ghost { background: none; border: 1px solid var(--line-2); }
.btn.ghost-danger { background: none; color: var(--warn); }
.btn[disabled] { opacity: 0.45; }
.btn:active { filter: brightness(0.96); }
.st { font-size: 0.8125rem; color: var(--sig-ink); min-height: 18px; margin: 0; }
.st.err { color: var(--warn); }
.note { margin: 0; font-size: 0.8125rem; color: var(--muted); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* ================= Sheets ================= */
.sheet-wrap {
  /* Pinned to the visible screen on all four sides, so nothing can sit below the bottom edge. */
  position: fixed; inset: 0; z-index: 30; background: var(--scrim); overscroll-behavior: none;
  display: flex; align-items: flex-end; justify-content: center; padding-top: calc(var(--safe-t) + var(--fade) + 12px);
}
.sheet {
  width: 100%; max-width: 600px; max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg); border-radius: 22px 22px 0 0; outline: none;
}
.sheet.tall { height: 100%; }
.sheet > .grab { flex: none; margin: 8px auto 4px; }
/* The body scrolls, up and down only; its parts keep their size. */
.sheet-body {
  flex: 1 1 auto; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y;
  padding: 4px var(--gutter-r) calc(var(--safe-b) + 20px) var(--gutter-l); display: flex; flex-direction: column; gap: 14px;
}
.sheet-body > * { flex-shrink: 0; min-width: 0; max-width: 100%; }
/* The footer stays put under the body, above the home bar. */
.sheet-foot { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px var(--gutter-r) calc(max(var(--safe-b), 12px) + 10px) var(--gutter-l); background: var(--bg); border-top: 1px solid var(--line); }
.sheet:has(> .sheet-foot) .sheet-body { padding-bottom: 16px; }
.grab { width: 36px; height: 5px; border-radius: 3px; background: var(--line-2); align-self: center; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font: 400 1.85rem/1 var(--serif); }
.sheet .x, .reader-top .x { width: 44px; height: 44px; margin-right: -10px; display: grid; place-items: center; border-radius: 22px; color: var(--fg); }
.section { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.section h3 { margin: 0; font-size: 0.875rem; font-weight: 600; color: var(--fg); }
.field label { display: block; margin-bottom: 6px; font-size: 0.875rem; color: var(--muted); }
.field .hint { color: var(--faint); }
.field input, .field textarea { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg); outline: none; }
.field textarea { resize: vertical; font: 400 max(16px, 1rem)/1.45 var(--sans); }
.field input:focus, .field textarea:focus { border-color: var(--sig); }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--sig); }
.check small { display: block; color: var(--muted); font-size: 0.8125rem; }
.retag, .use-guess { align-self: flex-start; }
.danger { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.version { font: 500 0.75rem var(--mono); color: var(--faint); }
/* Settings: grouped rows; the rest folded away under short headings. */
.group { border: 1px solid var(--line-2); border-radius: 16px; padding: 4px 14px; display: flex; flex-direction: column; gap: 10px; }
details.group { padding: 0 14px; }
details.group[open] { padding-bottom: 14px; }
.group summary { list-style: none; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; cursor: pointer; }
.group summary::-webkit-details-marker { display: none; }
.group summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 0; transition: transform 0.2s; }
.group[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.group summary .sv { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 0.875rem; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.row + .row { border-top: 1px solid var(--line); }
.rk { font-weight: 600; }
.seg { display: flex; padding: 3px; border-radius: 999px; background: var(--soft); }
.seg button { min-height: 38px; padding: 0 14px; border-radius: 999px; font-size: 0.875rem; font-weight: 500; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--sig); color: var(--on-sig); }
.me-row { display: flex; align-items: center; gap: 8px; }
.sub { margin: 4px 0 0; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.sug-row { display: flex; flex-direction: column; gap: 6px; }
.sug-row .k { font-size: 0.8125rem; color: var(--muted); }
.sug-row .chips, .section .chips, .tag-chips { flex-wrap: wrap; overflow: visible; }
.why-not { display: flex; flex-direction: column; gap: 8px; }
.why-not .btn { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 16px; border-radius: 16px; text-align: left; }
.why-not .btn span { font-size: 0.8125rem; color: var(--muted); font-weight: 400; }
.diag { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--muted); font: 400 max(16px, 1rem)/1.4 var(--mono); resize: none; }

/* Add: paste first, then the same fields as Edit, with Save always in reach */
.cap { display: flex; flex-direction: column; gap: 8px; }
.cap textarea {
  width: 100%; min-height: 56px; max-height: 240px; resize: none; padding: 14px; border-radius: 16px; border: 1px solid var(--line-2);
  background: var(--panel); color: var(--fg); font: 400 max(16px, 1rem)/1.45 var(--sans); outline: none;
}
.cap textarea:focus { border-color: var(--sig); }
.cap-src { display: flex; gap: 8px; }
.cap-src .chip { min-height: 44px; padding: 0 14px; gap: 6px; }
.cap-src .chip .i { width: 18px; height: 18px; }
.field[hidden], .cap-tm[hidden], .cap-tagpick[hidden] { display: none; }
.field textarea[rows="2"] { min-height: 48px; }
.adding .field textarea { resize: none; }
.cap-tm { grid-template-columns: minmax(0, 1fr) 96px; }
.cap-tm.solo { grid-template-columns: minmax(0, 1fr); }
.cap-tm.solo [data-f="minutes"] { display: none; }
.cap-tagpick { margin-top: -6px; }
.tray { display: flex; gap: 8px; overflow-x: auto; }
.tray[hidden], .cap-pics[hidden] { display: none; }
.thumb { position: relative; flex: 0 0 64px; height: 64px; border-radius: 12px; background: var(--soft); display: grid; place-items: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .ext { width: auto; height: auto; background: none; color: var(--muted); }
.thumb button { position: absolute; top: 2px; right: 2px; width: 28px; height: 28px; border-radius: 14px; display: grid; place-items: center; background: rgba(23, 18, 15, 0.8); color: #fff; }
.thumb button .i { width: 14px; height: 14px; stroke-width: 2.2; }
.detect { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.detect:empty { display: none; }
.detect li { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--muted); min-width: 0; }
.detect li .i { width: 14px; height: 14px; color: var(--sig); flex: none; }
.detect .what { color: var(--fg); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detect .d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cap-foot .st:empty { display: none; }
.cap-foot .save { width: 100%; min-height: 52px; border-radius: 26px; font-size: 1rem; }
.cap-foot .save:disabled { background: var(--soft); color: var(--muted); border-color: transparent; }

/* The picture picker, in Add and Edit */
.lbl { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 8px; font-size: 0.875rem; font-weight: 500; color: var(--muted); }
.picks { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 2px; scrollbar-width: none; }
.picks::-webkit-scrollbar { display: none; }
.pk { flex: 0 0 104px; scroll-snap-align: start; position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--soft); border: 3px solid transparent; min-height: 44px; }
.pk img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pk[aria-pressed="true"] { border-color: var(--sig); }
.pk[aria-pressed="true"]::after {
  content: ""; position: absolute; right: 5px; top: 5px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--sig) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat;
}
.pk .badge { position: absolute; left: 5px; bottom: 5px; padding: 2px 6px; border-radius: 6px; background: rgba(23, 18, 15, 0.72); color: #fff; font-size: 0.6875rem; font-weight: 600; }
.pk.txt, .pk.wait { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; font-size: 0.8125rem; font-weight: 500; color: var(--muted); text-align: center; }
.pk.wait { border-style: dashed; border-color: var(--line-2); border-width: 1.5px; }
.pic-edit { display: flex; flex-direction: column; gap: 6px; }

/* ================= Reader ================= */
.reader { position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%); z-index: 22; background: var(--bg); }
.reader-inner { position: relative; height: 100%; max-width: 600px; margin: 0 auto; }
.segs { display: none; }
.reader-top {
  position: absolute; z-index: 3; top: calc(var(--safe-t) + var(--fade) + 8px); left: calc(var(--gutter-l) - 6px); right: calc(var(--gutter-r) - 6px);
  display: flex; align-items: center; gap: 6px; transition: opacity 0.6s ease;
}
.reader-top .x { margin: 0; background: color-mix(in srgb, var(--bg) 80%, transparent); }
.reader-top .where { font-size: 0.8125rem; color: var(--muted); }
.reader-top .left { margin-left: auto; font-size: 0.8125rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.story {
  height: 100%; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + var(--fade) + 64px) var(--gutter-r) calc(var(--safe-b) + 120px) var(--gutter-l);
  display: flex; flex-direction: column; gap: 16px; touch-action: pan-y;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.story.dragging { transition: none; }
.story h1 { margin: 0; font: 400 2.2rem/1.05 var(--serif); text-wrap: balance; overflow-wrap: anywhere; }
.story .summary { margin: 0; font-size: 1.0625rem; line-height: 1.55; color: var(--muted); }
.story .quote { margin: 0; font: 400 2rem/1.12 var(--serif); white-space: pre-line; overflow-wrap: anywhere; }
.story .quote.long { font-size: 1.5rem; line-height: 1.25; }
.story .cite { margin: -6px 0 0; font-size: 0.875rem; color: var(--sig-ink); }
.story .points { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.story .points li::marker { color: var(--sig); }
.story .label { display: block; margin-bottom: 4px; }
.extended p { margin: 0 0 10px; line-height: 1.6; }
.prose { font-size: 1.0625rem; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.media { border-radius: 16px; overflow: hidden; background: var(--soft); }
.media img, .media video { display: block; width: 100%; height: auto; }
.credit { margin: -8px 0 0; font-size: 0.75rem; color: var(--faint); }
.yt { position: relative; aspect-ratio: 16 / 9; border-radius: 16px; overflow: hidden; background: #000; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.doc { width: 100%; height: 60vh; border: 0; border-radius: 16px; background: #fff; }
.story audio { width: 100%; }
.file-tag { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--soft); }
.file-tag .ext { width: auto; height: auto; background: none; color: var(--sig-ink); }
.file-tag .name { font-size: 0.875rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; border-radius: 26px; background: var(--sig); color: var(--on-sig); font-weight: 600; }
.source .host { margin-left: auto; font-size: 0.8125rem; font-weight: 400; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-note { padding: 12px 14px; border-radius: 12px; background: var(--soft); }
.story .why-line { padding-top: 14px; border-top: 1px solid var(--line); font: 400 0.875rem/1.45 var(--sans); color: var(--muted); }
.story .why-line b { color: var(--sig-ink); font-weight: 600; margin-right: 6px; }
.story-replies p { margin: 6px 0 0; font: 400 1.15rem/1.3 var(--serif); }
.story-replies .when { display: block; font: 400 0.8125rem/1.3 var(--sans); color: var(--faint); }
.reader .stamp { display: none; }
.verdicts {
  position: absolute; z-index: 5; left: var(--gutter-l); right: var(--gutter-r); bottom: calc(var(--safe-b) + 16px);
  display: flex; gap: 6px; padding: 6px; border-radius: 30px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  border: 1px solid var(--line-2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  transition: opacity 0.6s ease;
}
.verdicts:empty { display: none; }
.reader.asleep .verdicts, .reader.asleep .reader-top { opacity: 0.55; }
.verdicts button { flex: 1; min-height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 500; color: var(--fg); }
.verdicts button:active { background: var(--soft); }
.verdicts button.primary { background: var(--sig); color: var(--on-sig); font-weight: 600; }
.story .end { padding-top: 30vh; }

/* Pull down and release to go back */
.pull-tip {
  position: fixed; z-index: 60; left: 50%; top: calc(var(--safe-t) + var(--fade) + 14px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 18px; white-space: nowrap;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--muted); font-size: 0.8125rem; font-weight: 500;
  opacity: 0; pointer-events: none; transition: color 0.12s, border-color 0.12s;
}
.pull-tip .i { width: 16px; height: 16px; }
.pull-tip.go { color: var(--sig-ink); border-color: var(--sig); }

/* ================= Toast and drop ================= */
.toast {
  position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 96px); /* above the + button, centred, measured from the real bottom edge */
  width: calc(100% - var(--gutter-l) - var(--gutter-r)); max-width: 440px;
  min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 16px;
  background: var(--toast-bg); color: var(--toast-fg); border-radius: 16px; font-size: 0.9375rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.reader ~ .toast, .toast.high { bottom: calc(var(--safe-b) + 92px); }
.toast button { min-height: 52px; padding: 0 16px; font-weight: 600; color: var(--toast-act); }
/* The update bar stays until Reload is tapped. It sits above the + button and any toast. */
.update-bar {
  position: fixed; z-index: 45; left: var(--gutter-l); right: var(--gutter-r); top: calc(var(--safe-t) + var(--fade) + 10px); max-width: 560px; margin: 0 auto;
  min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 16px;
  background: var(--sig); color: var(--on-sig); border-radius: 16px; font-size: 0.9375rem; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}
.update-bar button { min-height: 52px; padding: 0 18px; font-weight: 700; color: var(--on-sig); text-decoration: underline; text-underline-offset: 3px; }
.dropzone { position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%); z-index: 50; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 92%, transparent); border: 2px dashed var(--sig); font: 400 2.2rem var(--serif); color: var(--sig); }
.dropzone.on { display: grid; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .burst { display: none; }
}

/* Set aside until a date: in Add and Edit */
[data-f="aside"][hidden] { display: none; }
.aside-pick { display: flex; flex-direction: column; gap: 8px; }
.aside-pick .lbl { margin: 0; }
.chips.wrap { flex-wrap: wrap; overflow: visible; }
.date-chip { position: relative; display: inline-flex; align-items: center; }
.date-chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; padding: 0; font-size: 16px; cursor: pointer; }
.date-chip[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); font-weight: 600; }
.remind[hidden] { display: none; }
.tag.back { background: var(--gold); color: var(--on-gold); }

/* Keyboard up (iOS): a sheet sits in the visible part, above the keys, and scrolls inside */
.kb .sheet-wrap { top: var(--vv-top, 0); bottom: auto; height: var(--vv-h, 100%); padding-top: 8px; }
.kb .sheet-body { padding-bottom: 12px; }
.kb .sheet-foot { padding-bottom: 10px; }
.sheet .field > *, .aside-pick > * { min-width: 0; max-width: 100%; }

/* Today's calendar: pages that come and go with the day */
.post.event { padding-bottom: 16px; }
.av-cal { display: grid; place-items: center; background: var(--gold); color: var(--on-gold); box-shadow: none; }
.av-cal .i { width: 55%; height: 55%; }
.ev-title { margin: 2px 0 0; font: 400 1.45rem/1.2 var(--serif); color: var(--fg); }
.ev-place { display: flex; gap: 6px; align-items: flex-start; margin: 6px 0 0; color: var(--muted); font-size: 0.875rem; }
.ev-place .i { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.ev-notes { margin: 6px 0 0; color: var(--muted); font-size: 0.875rem; -webkit-user-select: text; user-select: text; }
.post.event.past .ev-title, .post.event.past .ev-place, .post.event.past .ev-notes { opacity: 0.5; }
.tag.now { background: var(--sig); color: var(--on-sig); }

/* School newsletter: the Monday and Friday ask, and the school's posts */
.ask { margin: 12px var(--gutter-r) 4px var(--gutter-l); padding: 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 10px; }
.ask-top { display: flex; gap: 12px; align-items: flex-start; }
.ask h2 { margin: 0; font: 400 1.35rem/1.2 var(--serif); }
.ask p { margin: 2px 0 0; color: var(--muted); font-size: 0.875rem; }
.ask textarea { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg); color: var(--fg); font: 400 max(16px, 1rem)/1.45 var(--sans); resize: none; outline: none; -webkit-user-select: text; user-select: text; }
.ask textarea:focus { border-color: var(--sig); }
.ask-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.ask .st:empty { display: none; }
.av-school { display: grid; place-items: center; background: #1F6F5C; color: #fff; font: 600 1.1rem var(--sans); box-shadow: none; flex: none; }
.ask .av-school { width: 40px; height: 40px; border-radius: 50%; }
.ask .av-ai { background: var(--sig-ink); font-size: .85rem; }
.school-head { margin: 2px 0 4px; font: 400 1.6rem/1.15 var(--serif); color: var(--fg); }
.coming ul { padding-left: 1.1em; }
.coming b { font-weight: 600; }

/* School posts: the photo with a line about Gunner over it, big enough to read at a glance */
.school-pic { margin-top: 12px; border-radius: 16px; aspect-ratio: 4 / 3; }
.school-pic .open { position: relative; display: block; width: 100%; height: 100%; padding: 0; }
.school-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.school-pic .overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 48px 16px 14px;
  background: linear-gradient(to top, rgba(14, 8, 28, 0.82), rgba(14, 8, 28, 0.45) 55%, transparent);
  color: #fff; text-align: left; font: 400 1.75rem/1.12 var(--serif); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); text-wrap: balance;
}
.school-pic + .credit { position: static; margin: 6px 0 0; }

/* Sheets scroll up and down only. Nothing inside may be wider than the sheet
   (iOS gives date fields a minimum width), and sideways drags only move the
   rows built to scroll sideways. */
.sheet .picks, .sheet .chips, .sheet .tray { touch-action: pan-x pan-y; }
.sheet .field, .sheet .two > * { min-width: 0; }
.field input, .field textarea { min-width: 0; max-width: 100%; }
.field input[type="date"], .field input[type="number"] { -webkit-appearance: none; appearance: none; display: block; text-align: left; }
.field input[type="date"]::-webkit-date-and-time-value { text-align: left; }
.sheet img, .sheet svg { max-width: 100%; }
.sheet .note, .sheet .st { overflow-wrap: anywhere; }
.note-pic { margin-top: 12px; border-radius: 16px; overflow: hidden; aspect-ratio: 16 / 10; }
.note-pic .open { display: block; width: 100%; height: 100%; padding: 0; }
.note-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.note-pic + .credit { margin: 6px 0 0; }
.card + .credit { margin: 6px 0 0; }

/* A sheet's parts keep their size; when they don't fit, the sheet scrolls (iOS would otherwise squeeze them). */

/* The Save bar runs edge to edge (it's meant to be wider than the sheet's padding) and sits above the home bar. */
/* This morning: weather, games, Jung, On this day, CPMAI */
.post.daily { padding-bottom: 16px; }
.av-day { display: grid; place-items: center; background: var(--sig-soft); color: var(--sig-ink); font: 600 0.9rem var(--sans); box-shadow: none; }
.av-day .i { width: 58%; height: 58%; }
.wx-ic { background: var(--gold); color: var(--on-gold); }
.wx-now { display: flex; align-items: center; gap: 12px; margin: 4px 0 2px; }
.wx-now .deg { font: 400 3rem/1 var(--serif); color: var(--fg); }
.wx-word { display: flex; flex-direction: column; font-weight: 600; }
.wx-word small { font-weight: 400; color: var(--muted); font-size: 0.875rem; }
.wx-line { margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }
.wx-pic { margin: 12px 0 0; }
.wx-pic img { width: 100%; border-radius: 14px; display: block; background: var(--soft); aspect-ratio: 6 / 5; object-fit: cover; }
.wx-pic figcaption { margin-top: 6px; font-size: 0.75rem; color: var(--faint); }
.team { color: #fff; font-size: 0.8rem; letter-spacing: 0.02em; }
.t-CAR .team { background: #CE1126; }
.t-WSH .team { background: #041E42; }
.score { margin: 2px 0 0; font: 400 1.6rem/1.15 var(--serif); }
.tag.won { background: #1F6F5C; color: #fff; }
.hl { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.hl .i { width: 16px; height: 16px; }
.jung-q { margin: 4px 0 0; font: 400 1.35rem/1.3 var(--serif); color: var(--fg); }
.otd-card { display: flex; gap: 12px; align-items: center; width: 100%; margin-top: 6px; padding: 10px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--panel); text-align: left; }
.otd-pic { flex: none; width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: var(--soft); }
.otd-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.otd-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.otd-t .ttl { font: 400 1.15rem/1.25 var(--serif); color: var(--fg); }
.otd-t .site { font-size: 0.8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cq { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.cq:first-child { border-top: 0; padding-top: 0; }
.cq-q { margin: 0 0 8px; }
.cq-opts { display: flex; flex-direction: column; gap: 6px; }
.cq-o { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg); min-height: 44px; }
.cq-o .l { flex: none; font-weight: 700; color: var(--muted); }
.cq-o.picked { border-color: var(--sig); background: var(--sig-soft); }
.cq-o.right { border-color: #1F6F5C; background: color-mix(in srgb, #1F6F5C 14%, var(--bg)); }
.cq-o.wrong { border-color: #B3261E; background: color-mix(in srgb, #B3261E 12%, var(--bg)); }
.cq-o:disabled { opacity: 1; }
.cq-why { margin: 8px 0 0; font-size: 0.9rem; color: var(--muted); }
.cq-why b { color: var(--fg); }

/* Song of the day, Apple Weather */
.song { display: flex; gap: 12px; align-items: center; margin-top: 6px; }
.song .art { width: 84px; height: 84px; border-radius: 12px; object-fit: cover; flex: none; background: var(--soft); }
.song-t { min-width: 0; }
.song-t .ttl { margin: 0; font: 400 1.4rem/1.2 var(--serif); }
.song-acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.song-acts .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.song-acts .i { width: 16px; height: 16px; }
.wx-next { color: var(--fg); font-weight: 500; }
.wx-attr { margin: 6px 0 0; font-size: 0.75rem; }
.wx-attr a { color: var(--faint); text-decoration: none; }
.post.daily .rail { align-self: start; }

/* Morning cards: shrunk weather, finished quiz, Jung buttons, live event */
.wx-mini { display: flex; align-items: center; gap: 10px; margin: 0 var(--gutter-r) 0 var(--gutter-l); padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }
.wx-mini > span:nth-child(2) { flex: 1; min-width: 0; }
.wx-ic-s { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--sig-soft); color: var(--sig-ink); font-weight: 600; font-size: 0.75rem; flex: none; }
.wx-ic-s .i { width: 16px; height: 16px; }
.day-acts { margin-top: 10px; }
.cq-score { font-weight: 600; }
.post.event.live { background: color-mix(in srgb, var(--sig) 7%, var(--bg)); }
.post.event.live .ev-title { color: var(--sig-ink); }
.set-h { margin: 14px 4px -2px; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.help-links { padding: 0 14px; gap: 0; }
.help-links .row { min-height: 52px; text-decoration: none; color: inherit; font-weight: 600; }
.help-links .row + .row { border-top: 1px solid var(--line); }
.help-links .sv { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 0.875rem; }
.wx-live iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; background: #000; }
/* Welcome steps */
.welcome .wel-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.welcome .wel-steps li { display: flex; gap: 12px; align-items: flex-start; }
.welcome .wel-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 600 0.8125rem var(--sans); border: 1.5px solid var(--line-2); color: var(--muted); background: var(--bg); }
.welcome li.now .wel-n { border-color: var(--sig); color: var(--sig-ink); }
.welcome li.done .wel-n { background: var(--sig); border-color: var(--sig); color: #fff; }
.welcome .wel-b { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.welcome .wel-t { margin: 3px 0 0; font-weight: 600; color: var(--fg); font-size: 1rem; }
.welcome li.done .wel-t { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-2); }
.welcome .wel-d { margin: 0; }
.welcome .wel-skip { align-self: flex-start; }
/* Today's calendar: one card, a row per event */
.sched-list { list-style: none; margin: 6px 0 0; padding: 0; }
.sched-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; }
.sched-row + .sched-row { border-top: 1px solid var(--line); }
.sched-t { flex: none; width: 92px; font: 600 0.875rem/1.5 var(--sans); color: var(--muted); font-variant-numeric: tabular-nums; }
.sched-w { flex: 1; min-width: 0; }
.sched-title { margin: 0; font: 400 1.15rem/1.3 var(--serif); color: var(--fg); }
.sched-loc { display: flex; gap: 6px; align-items: flex-start; margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }
.sched-loc .i { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.sched-cal { margin: 2px 0 0; color: var(--faint); font-size: 0.8125rem; }
.sched-notes { margin-top: 4px; font-size: 0.875rem; color: var(--muted); }
.sched-notes summary { cursor: pointer; color: var(--sig-ink); font-weight: 600; }
.sched-notes p { margin: 4px 0 0; -webkit-user-select: text; user-select: text; overflow-wrap: anywhere; }
.sched-go { flex: none; }
.sched-row.past .sched-title, .sched-row.past .sched-loc, .sched-row.past .sched-t { opacity: 0.5; }
.sched-row.live .sched-title { color: var(--sig-ink); }
.welcome .wel-ok { align-self: center; font-weight: 600; font-size: 0.875rem; color: var(--sig-ink); padding: 0 6px; }
table.usage { width: 100%; border-collapse: collapse; font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
table.usage th, table.usage td { text-align: right; padding: 5px 4px; border-bottom: 1px solid var(--line); }
table.usage th:first-child, table.usage td:first-child { text-align: left; }
table.usage th { color: var(--muted); font-weight: 600; }
/* Today's calendar, at a glance */
.agenda .ag-allday { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; }
.agenda .ag-allday .chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--soft); font-size: 0.8125rem; font-weight: 600; color: var(--fg); }
.ag-focus { position: relative; margin: 8px 0 2px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); }
.ag-focus.live { border-color: var(--sig); }
.ag-when { margin: 0; font-size: 0.8125rem; font-weight: 600; color: var(--sig-ink); }
.ag-title { margin: 2px 0 0; font: 400 1.25rem/1.25 var(--serif); color: var(--fg); padding-right: 64px; }
.ag-place { display: flex; gap: 6px; align-items: center; margin: 4px 0 0; color: var(--muted); font-size: 0.875rem; }
.ag-place .i { width: 15px; height: 15px; flex: none; }
.ag-go { position: absolute; top: 12px; right: 12px; }
.ag-list { list-style: none; margin: 6px 0 0; padding: 0; }
.ag-row { display: flex; align-items: center; gap: 8px; min-height: 30px; font-size: 0.9375rem; }
.ag-t { flex: none; width: 48px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; font-size: 0.8125rem; }
.ag-n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--fg); }
.cal-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--sig)); }
.ag-more { margin-top: 4px; }
.ag-more summary { cursor: pointer; font-size: 0.875rem; font-weight: 600; color: var(--sig-ink); min-height: 30px; display: flex; align-items: center; }
.ag-done .ag-n, .ag-done .ag-t { opacity: 0.55; }
.ag-tail { margin: 8px 0 0; font-size: 0.8125rem; color: var(--muted); }
/* Today's calendar: the day bar */
.daybar .db { margin-top: 8px; }
.daybar .db summary { list-style: none; cursor: pointer; display: block; padding: 2px 0 0; }
.daybar .db summary::-webkit-details-marker { display: none; }
.db-track { position: relative; display: block; height: 20px; border-radius: 7px; background: var(--soft); overflow: hidden; }
.db-blk { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--c, var(--sig)); box-shadow: 0 0 0 1px var(--bg); }
.db-blk.past { opacity: 0.35; }
.db-wrap { position: relative; display: block; padding: 5px 0; }
/* Now: a little bolder than the blocks and taller than the bar, so it reads as the day's progress marker. */
.db-now { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1.5px; border-radius: 2px; background: #D9485F; box-shadow: 0 0 0 1.5px var(--bg); z-index: 1; }
.db-ticks { position: relative; display: block; height: 18px; margin-top: -2px; }
.db-tick { position: absolute; top: 3px; transform: translateX(-50%); font-size: 0.6875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.daybar .db[open] .ag-list { margin-top: 2px; }
.ag-row.past .ag-n, .ag-row.past .ag-t { opacity: 0.55; }
.db-next { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line-2); }
.db-next.live { border-color: var(--sig); }
.db-next-t { flex: 1; min-width: 0; }
.db-next-n { margin: 2px 0 0; font: 400 1.15rem/1.25 var(--serif); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-frees { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.db-free { padding: 4px 10px; border-radius: 999px; background: #E6F4EE; color: #155E4B; font-size: 0.8125rem; font-weight: 600; }
:root[data-theme="dark"] .db-free { background: #173A30; color: #A9E5CF; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .db-free { background: #173A30; color: #A9E5CF; } }
.db-more { position: absolute; right: 0; top: 2px; color: var(--sig-ink); display: flex; transition: transform 0.2s; }
.daybar .db[open] .db-more { transform: rotate(180deg); }
