/* EsuZone — design system
   Warm "paper" look: the palette follows upscpath.com (cream paper, sage accent, terracotta, amber) and the
   page sits in a desktop-style window like the Photo Sorter (title bar with lights, serif-italic titles,
   stat strips with small uppercase labels). The chart colours stay the validated reference palette
   (series 1–3 are the all-pairs colour-blind-safe trio used for Productive / Essential / Waste). */

/* Inter, the web font upscpath.com loads (variable: weight 100–900, optical size 14–32), self-hosted because the
   CSP only allows fonts from this site. SIL Open Font License, see /static/fonts/Inter-LICENSE.txt. The latin-ext
   file (₹ and accented letters) is only downloaded when a page uses one of those characters. */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #ece5db;            /* behind the window */
  --window: #fbf8f3;        /* the window / page paper */
  --surface: #fffdfa;       /* cards */
  --surface-2: #f4eee5;
  --surface-3: #e9e1d5;
  --band: #efe7dc;
  --border: #e6ddd0;
  --border-strong: #d3c6b5;
  --text: #1f1a16;
  --text-2: #4a3f35;
  --text-3: #6f6255;
  --grid: #ebe3d8;
  --axis: #cdbfae;
  --accent: #3c5d4d;
  --accent-hover: #2c4438;
  --accent-soft: rgba(60, 93, 77, 0.10);
  --on-accent: #ffffff;
  --terra: #874623;
  --amber: #d97706;
  --amber-icon: #bf6306;   /* amber for meaningful icons (stars, high-yield): 3.2:1+ on every light surface */
  --focus: 0 0 0 3px rgba(60, 93, 77, 0.30);

  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;
  --productive: var(--s3);
  --essential: var(--s1);
  --waste: var(--s2);
  --sleep: #bdb3a6;

  --good: #3d7c4a; --warning: #d99a0b; --serious: #c8693a; --critical: #b23a2f;
  --good-text: #30663c; --critical-text: #a3352b;
  --partner: #7c3aed; --partner-text: #5b21b6;   /* P levels from a linked UPSC-AI account */

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(40, 34, 24, 0.04);
  --shadow-pop: 0 18px 50px -12px rgba(40, 34, 24, 0.35), 0 4px 14px -6px rgba(40, 34, 24, 0.18);
  --shadow-window: 0 30px 80px -24px rgba(40, 34, 24, 0.28), 0 10px 30px -12px rgba(40, 34, 24, 0.18);
  --sidebar: 236px;
  --player-h: 0px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0b0a09; --window: #141311; --surface: #1c1a18; --surface-2: #252320; --surface-3: #302d29; --band: #211f1c;
    --border: rgba(243, 238, 231, 0.10); --border-strong: rgba(243, 238, 231, 0.20);
    --text: #f3eee7; --text-2: #d2cbc2; --text-3: #a39c92;
    --grid: #2a2825; --axis: #3d3934;
    --accent: #7da390; --accent-hover: #8fb09f; --accent-soft: rgba(125, 163, 144, 0.16); --on-accent: #12110f;
    --terra: #e0946c; --amber: #e6b460; --amber-icon: #e6b460;
    --focus: 0 0 0 3px rgba(125, 163, 144, 0.40);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --sleep: #4a4641;
    --good: #6fae78; --critical: #c9483b; --good-text: #93c299; --critical-text: #ec8f80;
    --partner: #a78bfa; --partner-text: #c4b5fd;
    --shadow: none; --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.6);
    --shadow-window: 0 30px 80px -24px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(243, 238, 231, 0.04);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0a09; --window: #141311; --surface: #1c1a18; --surface-2: #252320; --surface-3: #302d29; --band: #211f1c;
  --border: rgba(243, 238, 231, 0.10); --border-strong: rgba(243, 238, 231, 0.20);
  --text: #f3eee7; --text-2: #d2cbc2; --text-3: #a39c92;
  --grid: #2a2825; --axis: #3d3934;
  --accent: #7da390; --accent-hover: #8fb09f; --accent-soft: rgba(125, 163, 144, 0.16); --on-accent: #12110f;
  --terra: #e0946c; --amber: #e6b460; --amber-icon: #e6b460;
  --focus: 0 0 0 3px rgba(125, 163, 144, 0.40);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --sleep: #4a4641;
  --good: #6fae78; --critical: #c9483b; --good-text: #93c299; --critical-text: #ec8f80;
  --partner: #a78bfa; --partner-text: #c4b5fd;
  --shadow: none; --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-window: 0 30px 80px -24px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(243, 238, 231, 0.04);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 1.6rem; letter-spacing: -0.025em; }
h2 { font-size: 1.12rem; letter-spacing: -0.02em; }
h3 { font-size: 1rem; }
/* The Photo Sorter's accent: one word of a heading in an italic book serif. */
h1 em, h2 em, .brand em, .serif-em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; font-size: 1.1em; padding: 0 0.03em; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
::selection { background: color-mix(in srgb, var(--amber) 28%, transparent); }
.eyebrow { font-size: 0.74rem; font-weight: 650; letter-spacing: 0.08em; text-transform: uppercase; color: var(--terra); }
img, svg { display: block; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
h2 .ic, h3 .ic { width: 19px; height: 19px; color: var(--text-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 0.86rem; }
.tiny { font-size: 0.78rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hidden { display: none !important; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.shrink { min-width: 0; max-width: 100%; }
.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.split { display: grid; gap: 20px; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
.split.split-7-3 { grid-template-columns: minmax(0, 7fr) minmax(0, 3fr); }
.split.split-3-2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
@media (max-width: 1100px) { .split, .split.split-7-3, .split.split-3-2 { grid-template-columns: 1fr; } }

/* ── App shell: top navigation ───────────────────────────────────────── */
.shell { min-height: 100vh; }
.appbar {
  position: sticky; top: 0; z-index: 45; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--window) 88%, transparent); backdrop-filter: saturate(140%) blur(14px);
}
.appbar-inner {
  max-width: 1600px; margin: 0 auto; display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 0 var(--gutter); min-height: 62px;
}
:root { --gutter: clamp(14px, 2.6vw, 30px); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 1.12rem; letter-spacing: -0.02em; color: var(--text); text-decoration: none !important; white-space: nowrap; }
.brand em { color: var(--terra); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--window);
  background: var(--text); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}
.brand-mark svg { width: 18px; height: 18px; }
.topnav { display: flex; align-items: center; gap: 2px; flex: 1 1 0; min-width: 0; overflow-x: auto; scrollbar-width: none; scroll-behavior: smooth; }
.topnav::-webkit-scrollbar { display: none; }
.topnav > :first-child { margin-left: auto; }
.topnav > :last-child { margin-right: auto; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 999px;
  color: var(--text-2); font-weight: 560; font-size: 0.95rem; letter-spacing: -0.005em; white-space: nowrap; text-decoration: none !important;
  transition: background 0.15s, color 0.15s; flex: none;
}
.nav-link svg { width: 17px; height: 17px; flex: none; stroke-width: 2.1; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--text); color: var(--window); font-weight: 620; }
.nav-link .nav-badge { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; font-size: 0.66rem; padding: 0 4px; }
.nav-link:has(.nav-badge:not([hidden])) { padding-right: 22px; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--critical); color: #fff; font-size: 0.72rem; font-weight: 700; display: grid; place-items: center; }
.appbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn.nav-toggle { display: none; }
.user-btn { display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; }
.user-btn:hover { background: var(--surface-2); }
.user-btn .uname { font-weight: 600; font-size: 0.88rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 650; font-family: var(--serif); font-style: italic; font-size: 1.05rem; flex: none; }
.timer-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 17px; font-weight: 700;
  font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--good) 16%, var(--surface)); color: var(--good-text);
  border: 1px solid color-mix(in srgb, var(--good) 40%, transparent); text-decoration: none !important; white-space: nowrap;
}
.timer-chip svg { width: 16px; height: 16px; }

.main { min-width: 0; padding: 24px var(--gutter) calc(44px + var(--player-h)); }
.main:focus, #view:focus { outline: none; box-shadow: none; }
.input.w-num { max-width: 140px; }

/* The page sits in a desktop-style window (as in the Photo Sorter): title bar with three lights, the page name and the date. */
.window {
  max-width: 1480px; margin: 0 auto; background: var(--window); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-window);
}
.titlebar {
  height: 40px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px; border-radius: 15px 15px 0 0;
  border-bottom: 1px solid var(--border); background: linear-gradient(color-mix(in srgb, var(--window) 60%, var(--surface)), var(--surface-2));
  user-select: none;
}
.lights { display: flex; gap: 7px; }
.lights i { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.08); }
.lights i:nth-child(1) { background: #ee9d93; } .lights i:nth-child(2) { background: #f1cd7d; } .lights i:nth-child(3) { background: #9fd08f; }
.wintitle { font-size: 0.8rem; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.windate { justify-self: end; font-size: 0.76rem; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.window-body { padding: 26px clamp(16px, 2.4vw, 32px) 34px; min-width: 0; }
/* Pages with their own full-bleed look (Top Secret) drop the window. */
.shell.bare .window { max-width: none; background: none; border: 0; border-radius: 0; box-shadow: none; }
.shell.bare .titlebar { display: none; }
.shell.bare .window-body { padding: 0; }

.page { max-width: 1400px; margin: 0 auto; animation: page-in 0.25s ease; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px 28px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(1.9rem, 3.2vw, 2.4rem); letter-spacing: -0.01em; line-height: 1.1; }
.page-head p { margin-top: 6px; max-width: 70ch; }

/* Laptops: text-only links keep the bar to a single row. */
@media (min-width: 1320px) and (max-width: 1599px) {
  .topnav .nav-link svg { display: none; }
  .topnav .nav-link { padding: 0 12px; }
}
/* Tablets (iPad, Galaxy Tab) and small laptops: navigation gets its own scrollable row. */
@media (max-width: 1319px) {
  .topnav {
    order: 3; flex: 1 0 100%; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter) 9px;
    mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter), #000 calc(100% - var(--gutter)), transparent 100%);
  }
}
/* Phones: a menu button opens the navigation as a grid of large tap targets. */
@media (max-width: 699px) {
  .icon-btn.nav-toggle { display: inline-grid; }
  .user-btn .uname { display: none; }
  .user-btn { padding: 3px; }
  .topnav { display: none; mask-image: none; }
  .appbar.open .topnav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px var(--gutter) 16px; max-height: calc(100vh - 70px); overflow-y: auto;
  }
  .appbar.open .topnav > * { margin: 0; }
  .appbar.open .nav-link { height: 48px; background: var(--surface-2); border-radius: 13px; color: var(--text); }
  .appbar.open .nav-link[aria-current="page"] { background: var(--text); color: var(--window); }
  .brand .brand-text { font-size: 1.04rem; }
  .main { padding-top: 16px; }
  :root .secret { margin-top: -16px; }   /* beats the later .secret margin shorthand */
  h1 { font-size: 1.35rem; }
  .page-head h1 { font-size: 1.85rem; }
  /* Phones: no window frame, the page paper fills the screen. */
  body { background: var(--window); }
  .window { background: none; border: 0; border-radius: 0; box-shadow: none; }
  .titlebar { display: none; }
  .window-body { padding: 0; }
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px 0; flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head h2 { font-size: 1.06rem; }
.card-body { padding: 14px 18px 18px; }
.card-sub { color: var(--text-2); font-size: 0.86rem; margin-top: 2px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 -4px; }
.divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ── Stat tiles: one joined strip, cells split by hairlines (Photo Sorter's stats bar) ─ */
.tiles {
  display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.tiles:empty { display: none; }
.tiles-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr)); }
.tile { padding: 13px 20px 14px; min-width: 0; box-shadow: 1px 0 0 var(--border), 0 1px 0 var(--border); }
.tile-label { font-size: 0.7rem; color: var(--text-3); display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 650; }
.tile-value { font-size: 1.6rem; font-weight: 620; margin-top: 3px; letter-spacing: -0.015em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 0.8rem; color: var(--text-3); margin-top: 3px; }
.key { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.key-line { width: 14px; height: 3px; border-radius: 2px; flex: none; display: inline-block; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 560; cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.05s;
  text-decoration: none !important; box-shadow: 0 1px 0 rgba(40, 34, 24, 0.03);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
/* Primary = ink, like the Photo Sorter (cream on near-black; flips to near-black on cream in dark mode). */
.btn-primary { background: var(--text); border-color: var(--text); color: var(--window); font-weight: 600; }
.btn-primary:hover { background: color-mix(in srgb, var(--text) 84%, var(--window)); border-color: color-mix(in srgb, var(--text) 84%, var(--window)); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { color: var(--critical-text); }
.btn-danger:hover { background: color-mix(in srgb, var(--critical) 12%, transparent); border-color: var(--critical); }
.btn-solid-danger { background: var(--critical); border-color: var(--critical); color: #fff; }
.btn-solid-danger:hover { background: color-mix(in srgb, var(--critical) 85%, #000); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 13px; font-size: 0.86rem; }
.btn-lg { height: 48px; padding: 0 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 999px; border: 0; background: transparent; color: var(--text-2);
  display: inline-grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn.danger:hover { color: var(--critical-text); background: color-mix(in srgb, var(--critical) 12%, transparent); }
.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }

/* ── Forms ────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 0.84rem; font-weight: 600; color: var(--text-2); }
.hint { font-size: 0.8rem; color: var(--text-3); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 16px; transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
.input[type="time"], .input[type="date"] { font-variant-numeric: tabular-nums; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.input-group { display: flex; gap: 6px; }
.input-group .input { flex: 1; }
/* Type-or-pick field (components/combo.js); its list shares the look of .link-results */
.combo { position: relative; flex: 1; min-width: 0; scroll-margin-top: 110px; }
.combo-value { display: none; }
.combo .input { padding-right: 42px; text-overflow: ellipsis; }
.combo .input[aria-invalid="true"] { border-color: var(--critical); }
.combo-toggle { position: absolute; top: 0; right: 0; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--text-2); cursor: pointer; }
.combo-toggle svg { width: 18px; height: 18px; }
.combo .combo-list { max-height: min(220px, 30vh); overscroll-behavior: contain; }
.combo-group { padding: 8px 10px 4px; font-size: 0.76rem; font-weight: 650; color: var(--text-3); }
.combo-opt[aria-selected="true"] { font-weight: 650; color: var(--accent); }
/* Time you can type or pick (components/timefield.js): the real time input sits invisibly over the clock icon */
.time-field { position: relative; display: block; min-width: 0; }
.input-group > .time-field { flex: 1; }
.time-field > .input { padding-right: 42px; font-variant-numeric: tabular-nums; }
.time-field > .input[aria-invalid="true"] { border-color: var(--critical); }
.time-field > svg { position: absolute; top: 12px; right: 12px; width: 18px; height: 18px; color: var(--text-2); pointer-events: none; }
.time-native { position: absolute; top: 0; right: 0; width: 42px; min-width: 0; height: 42px; margin: 0; padding: 0; border: 0; font-size: 16px; opacity: 0; cursor: pointer; }
.time-native::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; cursor: pointer; }
.time-error { display: block; width: 0; min-width: 100%; margin-top: 4px; font-size: 0.8rem; color: var(--critical-text); }   /* wraps inside the field, never widens it */
/* A tap on Save finishes the time, changing this text and the button's label: the button must not move away from the tap */
[data-span-hint] { min-height: 3em; }
@media (max-width: 560px) { .form-actions { flex-direction: column; align-items: stretch; } }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-error { color: var(--critical-text); font-size: 0.86rem; min-height: 1.2em; }

/* Switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; }
.switch input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--surface-3); position: relative; cursor: pointer; flex: none; transition: background 0.15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(16px); }

/* Segmented control & tabs */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-weight: 560; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; }
.segmented button svg { width: 16px; height: 16px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); font-weight: 620; box-shadow: 0 1px 2px rgba(40, 34, 24, 0.12), 0 0 0 1px var(--border); }
/* Tabs: a row of pills over a hairline; the open one sits on a warm band (upscpath's feature tabs). */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; height: 36px; padding: 0 15px; border: 0; border-radius: 999px; background: none; color: var(--text-2); font-weight: 560; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; flex: none; }
.tabs button svg { width: 16px; height: 16px; }
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button[aria-selected="true"] { color: var(--text); background: var(--band); font-weight: 640; box-shadow: inset 0 0 0 1px var(--border); }
.tabs button[aria-selected="true"] svg { color: var(--terra); }
.tabs-sub { margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs-sub button { height: 32px; padding: 0 12px; font-size: 0.9rem; }
.tabs-sub button svg { width: 15px; height: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 13px; max-width: 100%; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 550; font-size: 0.88rem; line-height: 1.35; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip .x { margin-right: -4px; opacity: 0.6; }
.chip .x:hover { opacity: 1; }

/* Pills / badges */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 12px; font-size: 0.78rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill-good { background: color-mix(in srgb, var(--good) 15%, transparent); color: var(--good-text); }
.pill-warn { background: color-mix(in srgb, var(--warning) 22%, transparent); color: var(--text); }
.pill-serious { background: color-mix(in srgb, var(--serious) 20%, transparent); color: var(--text); }
.pill-bad { background: color-mix(in srgb, var(--critical) 15%, transparent); color: var(--critical-text); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* Progress */
.bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bar.good > span { background: var(--good); }

/* 24-hour timeline bar */
.timeline-24h { margin: 0; }
.timeline-24h .tl-label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.timeline-24h .tl-bar { display: flex; height: 28px; border-radius: 6px; overflow: hidden; background: var(--surface-3); position: relative; cursor: default; }
.timeline-24h .tl-bar .tl-seg { height: 100%; min-width: 0; position: relative; transition: opacity 0.15s; }
.timeline-24h .tl-bar .tl-seg:hover { opacity: 0.85; }
.timeline-24h .tl-bar .tl-seg.productive { background: var(--productive); }
.timeline-24h .tl-bar .tl-seg.essential  { background: var(--essential); }
.timeline-24h .tl-bar .tl-seg.waste      { background: var(--waste); }
.timeline-24h .tl-bar .tl-seg.sleep      { background: var(--sleep); }
.timeline-24h .tl-bar .tl-seg.unlogged   { background: transparent; }
.timeline-24h .tl-ticks { display: flex; justify-content: space-between; margin-top: 2px; }
.timeline-24h .tl-ticks span { font-size: 0.65rem; color: var(--text-3); width: calc(100%/12); text-align: center; }
.timeline-24h .tl-legend { display: flex; gap: 14px; margin-top: 6px; flex-wrap: wrap; }
.timeline-24h .tl-legend .tl-litem { display: flex; align-items: center; gap: 5px; font-size: 0.78rem; color: var(--text-2); }
.timeline-24h .tl-legend .tl-lbox { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.timeline-24h .tl-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 9px; font-size: 0.75rem; white-space: nowrap; pointer-events: none; box-shadow: var(--shadow); z-index: 10; display: none; }
.timeline-24h .tl-seg:hover .tl-tip { display: block; }

/* ── Tables ───────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-weight: 650; color: var(--text-3); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--surface); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--surface-2); }
.table .cell-bar { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.table .cell-bar .bar { flex: 1; height: 6px; }
.scroll-y { max-height: 420px; overflow-y: auto; }

/* ── Lists / entries ──────────────────────────────────────────────────── */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.entry { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: start; }
.entry:last-child { border-bottom: 0; }
.entry-stripe { width: 4px; border-radius: 2px; align-self: stretch; }
.entry-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entry-meta { color: var(--text-2); font-size: 0.86rem; margin-top: 2px; overflow-wrap: anywhere; }
.entry-note { color: var(--text-3); font-size: 0.84rem; margin-top: 3px; overflow-wrap: anywhere; }
.entry-side { display: flex; align-items: center; gap: 2px; }
.entry-value { font-weight: 650; font-variant-numeric: tabular-nums; margin-right: 6px; white-space: nowrap; }

.running { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; }
.running-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.running-item:last-child { border-bottom: 0; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 50%, transparent); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 45%, transparent); } 70% { box-shadow: 0 0 0 9px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.empty { text-align: center; padding: 28px 16px; color: var(--text-2); }
.empty svg { width: 34px; height: 34px; margin: 0 auto 10px; color: var(--text-3); }
.empty h3 { color: var(--text); margin-bottom: 4px; }

.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.loading-block { height: 160px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.refreshing { opacity: 0.55; transition: opacity 0.2s; pointer-events: none; }

/* ── Date navigator ───────────────────────────────────────────────────── */
.datenav { display: flex; align-items: center; gap: 6px; }
.datenav .input { width: auto; min-width: 150px; }
.datenav-label { font-weight: 650; min-width: 140px; text-align: center; }

/* ── Toasts / dialogs ─────────────────────────────────────────────────── */
.toasts { position: fixed; z-index: 100; right: 16px; bottom: calc(16px + var(--player-h)); display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--window); box-shadow: var(--shadow-pop); animation: toast-in 0.2s ease; font-weight: 500; }
/* Toasts are ink on cream in light mode and cream on ink in dark mode, so their icon colours flip too. */
:root { --toast-info: #e6b460; --toast-ok: #8fc79a; --toast-err: #f2998b; }
:root[data-theme="dark"] { --toast-info: #9a5b07; --toast-ok: #30663c; --toast-err: #a3352b; }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) { --toast-info: #9a5b07; --toast-ok: #30663c; --toast-err: #a3352b; } }
.toast svg { width: 19px; height: 19px; flex: none; margin-top: 1px; color: var(--toast-info); }
.toast.error svg { color: var(--toast-err); }
.toast.success svg { color: var(--toast-ok); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
dialog.modal { border: 1px solid var(--border); padding: 0; border-radius: 16px; background: var(--window); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--shadow-window); }
dialog.modal.wide { width: min(900px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(31, 26, 22, 0.42); backdrop-filter: blur(3px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1;
  background: linear-gradient(color-mix(in srgb, var(--window) 60%, var(--surface)), var(--surface-2)); }
.modal-body { padding: 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 18px 18px; flex-wrap: wrap; }

/* ── Charts ───────────────────────────────────────────────────────────── */
.chart { position: relative; width: 100%; min-width: 0; }
.chart svg { width: 100%; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .tick-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .band-label { fill: var(--text-3); font-size: 10.5px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.84rem; color: var(--text-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.tooltip {
  position: absolute; z-index: 5; pointer-events: none; min-width: 120px; max-width: 260px; padding: 9px 11px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); font-size: 0.84rem; line-height: 1.4;
}
.tooltip .tt-title { color: var(--text-2); font-size: 0.78rem; margin-bottom: 4px; }
.tooltip .tt-row { display: flex; align-items: center; gap: 8px; }
.tooltip .tt-row b { font-variant-numeric: tabular-nums; }
.tooltip .tt-row span.lbl { color: var(--text-2); }
.chart-card-tools { display: flex; gap: 6px; }
.heatmap-scroll { overflow-x: auto; padding-bottom: 4px; }
.heat-legend { display: flex; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--text-3); }
.heat-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

/* ── Calendar ─────────────────────────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 7px; }
.cal-head { font-size: 0.76rem; font-weight: 700; color: var(--text-3); text-align: center; padding: 4px 0; text-transform: uppercase; letter-spacing: 0.05em; }
.cal-cell {
  position: relative; min-height: 118px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface);
  padding: 8px 9px; display: flex; flex-direction: column; gap: 4px; min-width: 0; cursor: pointer; text-align: left; overflow: hidden;
  color: var(--text); transition: transform 0.12s ease, box-shadow 0.15s ease;
}
.cal-cell:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -8px rgba(40, 34, 24, 0.35); }
.cal-cell[aria-selected="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.cal-cell.today .cal-date { background: var(--surface); color: var(--text); box-shadow: 0 0 0 2px var(--accent); }
.cal-cell.future { opacity: 0.6; }
.cal-cell.pad { visibility: hidden; }
.cal-date { font-weight: 800; font-size: 0.9rem; width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; margin: -2px 0 0 -3px; flex: none; }
.cal-line { font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 5px; min-width: 0; opacity: 0.92; }
.cal-line .dot { width: 7px; height: 7px; }
.cal-chip {
  font-size: 0.72rem; font-weight: 650; padding: 2px 6px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: color-mix(in srgb, currentColor 15%, transparent); min-width: 0;
}
.cal-hours { font-size: 0.86rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.cal-more { font-size: 0.7rem; opacity: 0.75; }
.cal-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 0.74rem; font-weight: 750; }
.cal-flag svg { width: 13px; height: 13px; }

/* Study level (overview & study views, year grid). Same black / red / blue / green / yellow meaning as always,
   in earthier shades that sit on the paper palette; every text colour keeps 4.5:1 or more. */
.cal-lv0 { background: #1f1a16; color: #ffffff; border-color: #1f1a16; }
.cal-lv1 { background: #b8372d; color: #ffffff; border-color: #b8372d; }
.cal-lv2 { background: #2f62b5; color: #ffffff; border-color: #2f62b5; }
.cal-lv3 { background: #5aa66a; color: #06260f; border-color: #5aa66a; }
.cal-lv4 { background: #e8b23f; color: #1c1300; border-color: #e8b23f; }
:root[data-theme="dark"] .cal-lv0 { border-color: rgba(243, 238, 231, 0.22); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .cal-lv0 { border-color: rgba(243, 238, 231, 0.22); } }

/* Social activities (cell = the day's biggest activity; chips = each activity) */
.so-WentOutside, .so-Travelling, .so-Test { background: #e8b23f; color: #1c1300; border-color: #e8b23f; }
.so-Turf { background: #b8372d; color: #ffffff; border-color: #b8372d; }
.so-Office { background: #bf4f7e; color: #ffffff; border-color: #bf4f7e; }
.so-Coaching { background: #5aa66a; color: #06260f; border-color: #5aa66a; }
.so-Entertainment { background: #6f52c2; color: #ffffff; border-color: #6f52c2; }
.so-Meet { background: #62afd9; color: #082f49; border-color: #62afd9; }
.so-Guest { background: #45b3a2; color: #042f2e; border-color: #45b3a2; }
.cal-chip[class*="so-"] { border: 1px solid rgba(255, 255, 255, 0.6); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }
.cal-chip-t { display: flex; align-items: flex-start; gap: 6px; white-space: normal; line-height: 1.3; }
.cal-chip-t .ct { min-width: 0; overflow: hidden; overflow-wrap: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-chip-t .ch-h { flex: none; margin-left: auto; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Media & calls / habit states */
.md-great { background: #e8b23f; color: #1c1300; border-color: #e8b23f; }
.md-over { background: #1f1a16; color: #ffffff; border-color: #1f1a16; }
.md-high { background: #b8372d; color: #ffffff; border-color: #b8372d; }
.md-mid { background: #62afd9; color: #082f49; border-color: #62afd9; }
.md-low { background: #5aa66a; color: #06260f; border-color: #5aa66a; }


.legend-row { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 0.82rem; color: var(--text-2); align-items: center; }
.legend-row .sw { width: 15px; height: 15px; border-radius: 5px; border: 1px solid var(--border); display: inline-block; vertical-align: -3px; margin-right: 6px; }
@media (max-width: 700px) {
  .cal { gap: 4px; }
  .cal-cell { min-height: 60px; padding: 5px; border-radius: 10px; gap: 2px; }
  .cal-line:not(.keep), .cal-more, .cal-chip:not(.keep) { display: none; }
  .cal-hours { font-size: 0.68rem; }
  .cal-flag { font-size: 0.62rem; }
  .cal-date { width: 22px; height: 22px; font-size: 0.78rem; }
  .cal-head { font-size: 0.66rem; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .cal-cell { min-height: 96px; }
  .cal-chip-t { flex-wrap: wrap; row-gap: 0; }   /* narrow cells: the time drops under the chapter name */
}

/* Day details panel */
.day-hero { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; margin-bottom: 12px; }
.day-hero .big { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fact { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; min-width: 0; }
:where(.fact) { background: var(--surface-2); }   /* zero specificity so colour classes (so-*, md-*) win */
.fact .fi { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 1.05rem; flex: none; background: var(--surface); }
.fact .fl { font-size: 0.74rem; color: var(--text-3); }
.fact .fv { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.subj { padding: 10px 0; border-bottom: 1px solid var(--border); }
.subj:last-child { border-bottom: 0; }
/* The day card spans the page under the calendar, so its contents spread into columns. */
.day-card { scroll-margin-top: 84px; }
.day-card .facts { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.subj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 28px; }
.subj-grid .subj:last-child { border-bottom: 1px solid var(--border); }
.facts-wide { margin-top: 4px; }
.subj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; }
.subj .bar { margin: 6px 0 8px; height: 6px; }
.chapter { display: flex; justify-content: space-between; gap: 10px; font-size: 0.86rem; padding: 3px 0; color: var(--text-2); }
.chapter b { color: var(--text); font-weight: 600; }

.yeargrid { display: grid; grid-template-columns: 42px repeat(31, minmax(10px, 1fr)); gap: 3px; min-width: 560px; }
.yeargrid .yg-label { font-size: 0.75rem; color: var(--text-3); align-self: center; }
.yeargrid .yg-cell { aspect-ratio: 1; border-radius: 3px; border: 0; }
.yeargrid .yg-cell.future { background: var(--surface-3); }
.yeargrid .yg-head { font-size: 0.66rem; color: var(--text-3); text-align: center; }
.yeargrid .yg-cell:hover { outline: 2px solid var(--text-2); outline-offset: 1px; }

/* ── Targets ──────────────────────────────────────────────────────────── */
.target-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 16px; cursor: pointer; transition: border-color 0.15s; text-align: left; width: 100%; color: inherit; }
.target-card:hover { border-color: var(--border-strong); }
.target-subject { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); font-weight: 600; }
.target-subject svg { width: 14px; height: 14px; }
.target-note { color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 6px 9px; margin-top: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.target-note-full { white-space: pre-line; background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 10px; padding: 10px 14px; }
.target-note-full p { margin-top: 4px; }
.ring { position: relative; width: 72px; height: 72px; flex: none; }
.ring svg { width: 72px; height: 72px; transform: rotate(-90deg); }
.ring .ring-track { stroke: var(--surface-3); }
.ring .ring-val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.ring.done .ring-val { stroke: var(--good); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 0.92rem; }

/* ── Markdown (AI answers) ────────────────────────────────────────────── */
.md { line-height: 1.6; overflow-wrap: anywhere; }
.md h1, .md h2, .md h3, .md h4 { margin: 1.1em 0 0.45em; }
.md h2 { font-size: 1.12rem; }
.md h3 { font-size: 1rem; }
.md p { margin: 0.55em 0; }
.md ul, .md ol { margin: 0.4em 0; padding-left: 1.4em; }
.md li { margin: 0.2em 0; }
.md code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }
.md blockquote { margin: 0.6em 0; padding: 4px 12px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1em 0; }
.md .table-wrap { margin: 0.6em 0; border: 1px solid var(--border); }
details.disclosure { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
details.disclosure + details.disclosure { margin-top: 10px; }
details.disclosure > summary { list-style: none; cursor: pointer; padding: 13px 16px; display: flex; align-items: center; gap: 10px; font-weight: 600; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .chev { margin-left: auto; transition: transform 0.15s; color: var(--text-3); }
details.disclosure[open] > summary .chev { transform: rotate(90deg); }
details.disclosure > .disclosure-body { padding: 0 16px 16px; }

/* ── Player ───────────────────────────────────────────────────────────── */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: 72px; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; gap: 16px; padding: 0 18px;
  background: color-mix(in srgb, var(--window) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border);
}
.player[hidden] { display: none; }
.player-track { display: flex; align-items: center; gap: 12px; min-width: 0; }
.player-art { width: 44px; height: 44px; border-radius: 10px; background: linear-gradient(135deg, #874623, #d97706); display: grid; place-items: center; color: #fff; flex: none; }
.player-art svg { width: 20px; height: 20px; }
.player-art.playing svg { animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-2px); } }
.player-title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-sub { font-size: 0.78rem; color: var(--text-3); }
.player-center { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.player-controls { display: flex; align-items: center; gap: 6px; }
.play-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--text); color: var(--bg); display: grid; place-items: center; cursor: pointer; }
.play-btn svg { width: 18px; height: 18px; }
.play-btn:hover { transform: scale(1.05); }
.player-progress { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 0.74rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.player-progress input { flex: 1; }
.player-right { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.player-right input[type="range"] { width: 90px; }
input[type="range"] { accent-color: var(--accent); height: 4px; cursor: pointer; }
.player-mini-toggle, .player-close-mini { display: none; }
.music-chip { color: var(--accent); }
.music-chip svg { animation: bob 1.2s ease-in-out infinite; }
@media (max-width: 900px) {
  .player-close-mini { display: inline-grid; }
  .player-right .player-close { display: none; }
  .player { left: 0; height: 64px; grid-template-columns: minmax(0, 1fr) auto; padding: 0 10px; gap: 8px; }
  .player-center .player-progress, .player-right .vol, .player-right input[type="range"] { display: none; }
  .player-center { order: 2; }
  .player-right { display: none; }
  .player.expanded { height: auto; grid-template-columns: 1fr; padding: 12px 14px 14px; }
  .player.expanded .player-right { display: flex; justify-content: center; }
  .player.expanded .player-center .player-progress { display: flex; }
  .player-mini-toggle { display: inline-grid; }
  .player:not(.expanded) .opt { display: none; }
  .player.expanded .player-track { order: 0; }
  .player-art { width: 38px; height: 38px; }
}
.song-list { max-height: min(60vh, 520px); overflow-y: auto; margin: 0 -6px; }
.song-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; min-width: 0; }
.song-row:hover { background: var(--surface-2); }
.song-row.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.song-row .ellipsis { flex: 1; }

/* ── Login ────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); padding: 30px 26px; }
.login-card .brand { padding: 0 0 18px; font-size: 1.15rem; }

/* Sign-in as a small landing page in the upscpath.com manner: paper, a big tight headline with one serif word,
   a lede, a ruled feature list, and an ink footer. */
.landing { min-height: 100vh; display: flex; flex-direction: column; background: var(--window); }
.land-wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 max(20px, env(safe-area-inset-left, 0px)); }
.land-bar { border-bottom: 1px solid var(--border); }
.land-bar .land-wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.land-bar .tagline { font-size: 0.86rem; color: var(--text-3); }
.land-hero { flex: 1; padding-block: clamp(36px, 7vw, 88px) clamp(36px, 6vw, 72px); }
.land-hero .land-wrap {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); grid-template-areas: "copy card" "feats card";
  grid-template-rows: auto 1fr; gap: 28px clamp(28px, 5vw, 64px); align-items: start;
}
.land-copy { grid-area: copy; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.land-hero .feats { grid-area: feats; }
.land-hero .land-card { grid-area: card; }
.land-copy h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.06; letter-spacing: -0.035em; font-weight: 700; text-wrap: balance; }
.land-copy h1 em { color: var(--terra); }
.lede { color: var(--text-2); font-size: clamp(1.02rem, 1.6vw, 1.18rem); line-height: 1.5; max-width: 36em; text-wrap: pretty; }
.feats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 28px; margin: 0; }
.feats div { border-top: 1px solid var(--border-strong); padding: 12px 0 14px; min-width: 0; }
.feats dt { font-weight: 650; display: flex; align-items: center; gap: 7px; }
.feats dt svg { width: 16px; height: 16px; color: var(--accent); }
.feats dd { margin: 3px 0 0; color: var(--text-2); font-size: 0.9rem; line-height: 1.45; }
.land-card { position: relative; width: 100%; padding: 28px 26px 26px; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-window); }
.land-card h2 { font-size: 1.5rem; letter-spacing: -0.025em; }
.land-foot { background: #1f1a16; color: #d8cabb; }
.land-foot .land-wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; padding-block: 22px; font-size: 0.84rem; }
.land-foot .brand { color: #faf6f1; font-size: 1rem; }
.land-foot .brand em { color: #e6b460; }
.land-foot .brand-mark { background: #faf6f1; color: #1f1a16; width: 26px; height: 26px; border-radius: 7px; }
.land-foot .brand-mark svg { width: 15px; height: 15px; }
.land-foot span { color: #a89888; }
@media (max-width: 900px) {
  .land-hero .land-wrap { grid-template-columns: 1fr; grid-template-areas: "copy" "card" "feats"; grid-template-rows: auto; }
  .land-card { max-width: 460px; }
  .feats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .land-bar .tagline { display: none; }
  .feats { grid-template-columns: 1fr; }
}

/* ── Top Secret ───────────────────────────────────────────────────────── */
.secret {
  /* Bleeds under the page padding so the pink reaches the app bar and the music bar. */
  position: relative; min-height: calc(100vh - 62px); margin: -24px calc(-1 * var(--gutter)) calc(-44px - var(--player-h)); padding: 34px var(--gutter) calc(60px + 44px + var(--player-h));
  overflow: hidden; color: #3b0a24;
  background: radial-gradient(1200px 600px at 10% -10%, #ffd1e8 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 10%, #e9d5ff 0%, transparent 55%),
              linear-gradient(160deg, #fff1f7 0%, #fce7f3 45%, #f5e8ff 100%);
}
:root[data-theme="dark"] .secret { color: #ffe4f1;
  background: radial-gradient(1000px 600px at 10% -10%, #6b0f3a 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 10%, #3b1a6b 0%, transparent 55%), linear-gradient(160deg, #1a0710, #12061e); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .secret { color: #ffe4f1;
  background: radial-gradient(1000px 600px at 10% -10%, #6b0f3a 0%, transparent 60%),
              radial-gradient(900px 600px at 110% 10%, #3b1a6b 0%, transparent 55%), linear-gradient(160deg, #1a0710, #12061e); } }
@media (max-width: 699px) { .secret { margin-top: -16px; } }
.secret-inner { position: relative; z-index: 2; max-width: 760px; margin: 0 auto; text-align: center; }
.secret .float-layer { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.secret .float-layer span { position: absolute; bottom: -40px; animation: drift linear infinite; opacity: 0.55; }
@keyframes drift { 0% { transform: translateY(0) translateX(0) rotate(0); } 50% { transform: translateY(-55vh) translateX(18px) rotate(12deg); } 100% { transform: translateY(-115vh) translateX(-12px) rotate(-8deg); opacity: 0; } }
.trail { position: fixed; pointer-events: none; z-index: 130; font-size: 16px; animation: trail 1s ease-out forwards; }
@keyframes trail { to { transform: translateY(-38px) scale(0.4); opacity: 0; } }
.preview-banner { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 20px; font-size: 0.82rem; font-weight: 650;
  background: rgba(255, 255, 255, 0.7); color: #6b21a8; border: 1px dashed #a855f7; margin-bottom: 18px; }
.secret .eyebrow { letter-spacing: 0.28em; text-transform: uppercase; font-size: 0.78rem; font-weight: 800; color: #db2777; }
.secret h1.title { font-size: clamp(1.9rem, 5vw, 3.1rem); line-height: 1.12; margin: 10px 0 18px; font-weight: 850; }
.shimmer { background: linear-gradient(90deg, #e11d48, #db2777, #a855f7, #e11d48); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer-text 6s linear infinite; }
@keyframes shimmer-text { to { background-position: 300% 0; } }
.letters .word { display: inline-block; white-space: nowrap; }
.letters .ch { display: inline-block; opacity: 0; transform: translateY(18px) rotate(-6deg) scale(0.8); animation: letter-in 0.55s cubic-bezier(.2,.9,.3,1.3) forwards; white-space: pre; }
/* Animated letters are their own layers, so the parent's clipped gradient can't paint through them:
   each letter carries the gradient instead, offset by its index so the colours flow across the word. */
.shimmer .letters .ch { background: linear-gradient(90deg, #e11d48, #db2777, #a855f7, #e11d48); background-size: 1600% 100%;
  background-position: calc(var(--i, 0) * 6%) 0; -webkit-background-clip: text; background-clip: text; color: transparent; }
.shimmer .letters .ch.emo { background: none; color: #db2777; }
@keyframes letter-in { to { opacity: 1; transform: none; } }
.glass { background: rgba(255, 255, 255, 0.62); border: 1px solid rgba(255, 255, 255, 0.85); border-radius: 22px; backdrop-filter: blur(10px); box-shadow: 0 18px 50px rgba(219, 39, 119, 0.15); }
:root[data-theme="dark"] .glass { background: rgba(40, 10, 30, 0.55); border-color: rgba(255, 255, 255, 0.12); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .glass { background: rgba(40, 10, 30, 0.55); border-color: rgba(255, 255, 255, 0.12); } }
.poem { white-space: pre-line; font-size: clamp(1rem, 2.4vw, 1.14rem); line-height: 1.95; padding: 26px 22px; font-style: italic; }
.poem .reveal { opacity: 0; filter: blur(6px); animation: blur-in 0.9s ease forwards; display: block; }
@keyframes blur-in { to { opacity: 1; filter: none; } }
.typed::after { content: "▍"; margin-left: 2px; animation: caret 0.8s steps(1) infinite; color: #db2777; }
.typed.done::after { content: ""; }
@keyframes caret { 50% { opacity: 0; } }
.love-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 26px; }
.btn-yes {
  min-width: 230px; height: 56px; padding: 0 28px; border: 0; border-radius: 30px; color: #fff; font-size: 1.12rem; font-weight: 800; cursor: pointer;
  background: linear-gradient(135deg, #f43f5e, #db2777 55%, #a855f7); box-shadow: 0 10px 30px rgba(219, 39, 119, 0.45);
  animation: heartbeat 1.6s ease-in-out infinite; transition: transform 0.25s;
}
.btn-yes:hover { filter: brightness(1.08); }
@keyframes heartbeat { 0%, 100% { box-shadow: 0 10px 30px rgba(219, 39, 119, 0.45); } 50% { box-shadow: 0 10px 46px rgba(219, 39, 119, 0.75), 0 0 0 10px rgba(244, 63, 94, 0.12); } }
.btn-no { min-width: 140px; height: 48px; padding: 0 22px; border-radius: 26px; border: 2px solid rgba(219, 39, 119, 0.35); background: rgba(255, 255, 255, 0.85); color: #9d174d; font-weight: 700; cursor: pointer; transition: transform 0.2s; }
/* "Please say yes" zone: YES in the middle, No beside it until it's approached, then it hops within the zone. */
.dodge-zone { position: relative; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; align-content: center; gap: 14px;
  width: min(100%, 640px); min-height: 230px; margin: 14px auto 0; }
.btn-no.runaway { position: absolute; z-index: 5; margin: 0; transition: left 0.28s cubic-bezier(.3,1.4,.5,1), top 0.28s cubic-bezier(.3,1.4,.5,1), transform 0.2s; }
.closing { margin-top: 16px; padding: 18px 20px; line-height: 1.85; font-weight: 600; opacity: 0; transform: translateY(8px); transition: opacity 1s ease, transform 1s ease; }
.closing.shown { opacity: 1; transform: none; }
.dodge-hint { min-height: 1.5em; font-weight: 650; color: #be185d; }
.dodge-hint.pop { animation: fade-up 0.4s ease; }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.envelope { position: relative; width: min(320px, 80vw); height: 210px; margin: 26px auto 10px; cursor: pointer; perspective: 900px; border: 0; background: none; padding: 0; display: block; }
.envelope .env-body { position: absolute; inset: 0; border-radius: 14px; background: linear-gradient(160deg, #fb7185, #db2777); box-shadow: 0 20px 50px rgba(219, 39, 119, 0.4); }
.envelope .env-flap { position: absolute; left: 0; right: 0; top: 0; height: 120px; transform-origin: top; background: linear-gradient(180deg, #f472b6, #e11d48);
  clip-path: polygon(0 0, 100% 0, 50% 100%); border-radius: 14px 14px 0 0; transition: transform 0.7s ease; z-index: 3; }
.envelope .env-letter { position: absolute; left: 16px; right: 16px; top: 18px; bottom: 14px; border-radius: 10px; background: #fff7fb; z-index: 2;
  display: grid; place-items: end center; padding-bottom: 26px; color: #9d174d; font-weight: 800; transition: transform 0.8s 0.35s ease; }
.envelope .env-seal { position: absolute; left: 50%; top: 92px; transform: translate(-50%, -50%); z-index: 4; font-size: 34px; transition: opacity 0.3s; animation: seal 1.4s ease-in-out infinite; }
@keyframes seal { 50% { transform: translate(-50%, -50%) scale(1.15); } }
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .env-seal { opacity: 0; }
.envelope.open .env-letter { transform: translateY(-95px); }
.meter { height: 16px; border-radius: 10px; background: rgba(219, 39, 119, 0.15); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; border-radius: 10px; background: linear-gradient(90deg, #fb7185, #db2777, #a855f7); transition: width 2.4s cubic-bezier(.2,.8,.2,1); }
.flip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
@media (max-width: 560px) { .flip-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } .flip .flip-back { font-size: 0.86rem; } }
.flip { perspective: 900px; height: 130px; cursor: pointer; border: 0; background: none; padding: 0; color: inherit; font: inherit; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform 0.7s; transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; display: grid; place-items: center; padding: 14px; border-radius: 18px; font-weight: 700; }
.flip-front { background: linear-gradient(135deg, #fb7185, #c026d3); color: #fff; font-size: 1.6rem; }
.flip-back { background: #fff7fb; color: #9d174d; transform: rotateY(180deg); font-size: 0.95rem; line-height: 1.45; border: 1px solid #fbcfe8; }
.promise { display: flex; align-items: center; gap: 10px; padding: 10px 14px; text-align: left; opacity: 0; animation: fade-up 0.6s ease forwards; }
.hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 70; }
.hearts span { position: absolute; bottom: -30px; font-size: 22px; animation: float-up 4.5s linear forwards; }
@keyframes float-up { to { transform: translateY(-110vh) rotate(25deg); opacity: 0; } }
.burst { position: fixed; pointer-events: none; z-index: 135; font-size: 22px; animation: burst 1.3s cubic-bezier(.1,.8,.3,1) forwards; }
@keyframes burst { to { transform: translate(var(--dx), var(--dy)) scale(0.6) rotate(var(--rot)); opacity: 0; } }

/* ── Today hero, goal ring, quick start ───────────────────────────────── */
.hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; padding: 22px 24px;
  border-radius: 16px; border: 1px solid var(--border); margin-bottom: 20px; box-shadow: var(--shadow);
  background: radial-gradient(520px 200px at 100% 0%, color-mix(in srgb, var(--amber) 11%, transparent), transparent 70%),
              radial-gradient(420px 200px at 0% 100%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--surface);
}
.hero h1 { font-size: clamp(1.45rem, 2.8vw, 1.95rem); letter-spacing: -0.03em; margin-top: 2px; }
.hero h1 em { color: var(--terra); }
.hero [data-sub] { color: var(--terra); }
.goal-ring { position: relative; width: 96px; height: 96px; flex: none; }
.goal-ring svg { width: 96px; height: 96px; transform: rotate(-90deg); }
.goal-ring .gr-track { stroke: var(--surface-3); }
.goal-ring .gr-val { stroke: var(--productive); stroke-linecap: round; transition: stroke-dashoffset 0.8s ease; }
.goal-ring.done .gr-val { stroke: var(--amber-icon); }
.goal-ring .gr-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.goal-ring .gr-label b { font-size: 1.15rem; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.quick-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--window); font-weight: 560; font-size: 0.86rem; cursor: pointer; max-width: 100%; }
.quick-chip:hover { border-color: var(--accent); color: var(--accent); }
.quick-chip .dot { width: 8px; height: 8px; }
.quick-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) { .hero { grid-template-columns: 1fr; text-align: left; } }

/* ── Focus timer ──────────────────────────────────────────────────────── */
.focus-dial { position: relative; width: 210px; height: 210px; margin: 6px auto 14px; }
.focus-dial svg { width: 210px; height: 210px; transform: rotate(-90deg); }
.focus-dial .fd-time { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ── Song picker (dropdown) ───────────────────────────────────────────── */
.picker-btn { display: flex; align-items: center; gap: 10px; width: 100%; height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: left; font-weight: 650; color: var(--text); }
.picker-btn:hover { border-color: var(--accent); }
.picker-btn .ellipsis { flex: 1; }
.picker-pop {
  position: fixed; z-index: 110; width: min(440px, calc(100vw - 24px)); max-height: min(70vh, 520px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; animation: pop-in 0.16s ease;
}
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(0.98); } }
.picker-pop .picker-top { padding: 10px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.picker-pop .picker-list { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.picker-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; cursor: pointer; min-width: 0; }
.picker-item:hover, .picker-item.active { background: var(--surface-2); }
.picker-item.current { color: var(--accent); font-weight: 650; background: var(--accent-soft); }
.picker-item .ellipsis { flex: 1; }
.star { border: 0; background: none; cursor: pointer; color: var(--text-3); width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.star:hover { background: var(--surface-3); }
.star.on { color: var(--amber-icon); }
.star svg { width: 17px; height: 17px; }
.star.on svg { fill: currentColor; }
.now-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 22px; align-items: center; padding: 22px; border-radius: 16px;
  background: radial-gradient(500px 240px at 0% 0%, color-mix(in srgb, var(--amber) 14%, transparent), transparent 70%), radial-gradient(500px 240px at 100% 100%, color-mix(in srgb, var(--terra) 10%, transparent), transparent 70%), var(--surface);
  border: 1px solid var(--border); }
.now-art { width: 132px; height: 132px; border-radius: 24px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #3c5d4d, #874623 55%, #d97706); box-shadow: 0 18px 40px -12px rgba(135, 70, 35, 0.55); transition: border-radius 0.4s; }
.now-art svg { width: 48px; height: 48px; }
.now-art.playing { animation: spin-slow 9s linear infinite; border-radius: 50%; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.now-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.now-controls .play-btn { width: 54px; height: 54px; }
@media (max-width: 600px) { .now-card { grid-template-columns: 1fr; justify-items: center; text-align: center; } .now-art { width: 104px; height: 104px; } .now-controls { justify-content: center; } }

/* Celebration */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 120; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 9px; height: 15px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0.2; } }
.celebrate-card { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 121; text-align: center; padding: 26px 34px; animation: pop 0.45s ease; width: min(420px, calc(100vw - 32px)); }
@keyframes pop { from { transform: translate(-50%, -50%) scale(0.7); opacity: 0; } }

/* ── Syllabus: levels ─────────────────────────────────────────────────
   Levels are ordinal, so they use one sage ramp (the accent), light → dark: CIELAB L* 81 / 69 / 55 / 37 / 22,
   monotone with visible steps, and the light end clears the surface. Dark mode has its own steps,
   lightest = highest level (L* 29 / 42 / 55 / 69 / 82). */
:root { --lv0: var(--surface-3); --lv1: #b7cfc1; --lv2: #8db29d; --lv3: #5f8d76; --lv4: #3c5d4d; --lv5: #243a30; }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) { --lv1: #2f4a3d; --lv2: #436a57; --lv3: #5f8d76; --lv4: #8db29d; --lv5: #b9d2c4; }
}
:root[data-theme="dark"] { --lv1: #2f4a3d; --lv2: #436a57; --lv3: #5f8d76; --lv4: #8db29d; --lv5: #b9d2c4; }
.pips { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.pips i { width: 7px; height: 13px; border-radius: 2px; background: var(--lv0); }
.pips i.lv1 { background: var(--lv1); } .pips i.lv2 { background: var(--lv2); } .pips i.lv3 { background: var(--lv3); }
.pips i.lv4 { background: var(--lv4); } .pips i.lv5 { background: var(--lv5); }
.lv-num { font-size: 0.78rem; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--text-2); min-width: 24px; }
.lvbar { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; min-width: 60px; }
.lvbar > span { min-width: 3px; }
.lvbar.sm { height: 6px; width: 96px; flex: none; }
.lvbar .lv0, .lv-legend .lv0 { background: var(--lv0); } .lvbar .lv1, .lv-legend .lv1 { background: var(--lv1); }
.lvbar .lv2, .lv-legend .lv2 { background: var(--lv2); } .lvbar .lv3, .lv-legend .lv3 { background: var(--lv3); }
.lvbar .lv4, .lv-legend .lv4 { background: var(--lv4); } .lvbar .lv5, .lv-legend .lv5 { background: var(--lv5); }
.lv-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 0.78rem; color: var(--text-2); }
.lv-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lv-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tooltip.float { position: fixed; z-index: 140; }
.toast-act { margin-left: auto; border: 0; background: none; color: inherit; font-weight: 750; text-decoration: underline; cursor: pointer; padding: 0 2px; flex: none; }
.ic.ic-inline { display: inline-block; vertical-align: -3px; width: 15px; height: 15px; }
.hy-badge { display: inline-flex; color: var(--amber-icon); flex: none; }
.hy-badge svg { width: 14px; height: 14px; fill: currentColor; }

/* Explorer */
.explorer { background: radial-gradient(700px 200px at 100% 0%, var(--accent-soft), transparent 70%), var(--surface); }
.explorer-head { display: flex; gap: 12px; align-items: flex-start; }
.explorer-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--on-accent); flex: none; background: var(--accent); }
.explorer-mark svg { width: 20px; height: 20px; }
.explorer-form { display: flex; gap: 8px; }
.explorer-form .input { flex: 1; }
@media (max-width: 560px) { .explorer-form { flex-direction: column; } }
.match-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.match-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--border); }
.match-row:last-child { border-bottom: 0; }
.match-main { flex: 1; min-width: 0; text-align: left; background: none; border: 0; cursor: pointer; padding: 6px 0; color: inherit; font: inherit; display: flex; align-items: center; gap: 10px; }
.match-main:hover .match-name { color: var(--accent); }
.match-name { font-weight: 600; }
.match-path { font-size: 0.78rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fit { display: flex; gap: 10px; padding: 12px 14px; background: var(--accent-soft); border-radius: 12px; }
.fit svg { color: var(--accent); flex: none; margin-top: 2px; }
.q-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.q-text { white-space: pre-line; font-weight: 560; }
.mcq-opts { display: grid; gap: 6px; }
.mcq-opt { text-align: left; display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; color: inherit; font: inherit; }
.mcq-opt:hover:not([disabled]) { background: var(--surface-2); }
.mcq-opt[disabled] { cursor: default; }
.mcq-opt b { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 0.78rem; }
.mcq-opt.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, var(--surface)); }
.mcq-opt.wrong { border-color: var(--critical); background: color-mix(in srgb, var(--critical) 10%, var(--surface)); }
.mcq-verdict { display: flex; gap: 8px; align-items: flex-start; font-size: 0.88rem; }
.mcq-verdict svg { flex: none; margin-top: 2px; }
.mcq-verdict.right svg { color: var(--good-text); } .mcq-verdict.wrong svg { color: var(--critical-text); }

/* Syllabus browser */
.scope-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-row .input { max-width: 280px; height: 38px; }
.paper-card { overflow: hidden; }
.paper-head { display: flex; justify-content: space-between; gap: 14px; padding: 16px 18px 12px; flex-wrap: wrap; align-items: flex-start; }
.paper-stats { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 170px; }
.paper-stats .lvbar { width: 170px; }
@media (max-width: 560px) { .paper-stats { align-items: flex-start; } }
.paper-body { padding: 0 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.paper-body details.disclosure + details.disclosure { margin-top: 0; }
details.sec > summary { flex-wrap: wrap; row-gap: 4px; }
.sec-stats { display: inline-flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 0.84rem; font-weight: 500; }
.official { margin: 0; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 10px; font-size: 0.86rem; color: var(--text-2); }
.official b { color: var(--text); }
.topic-list { display: flex; flex-direction: column; }
.topic { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); scroll-margin-top: 90px; }
.topic:last-child { border-bottom: 0; }
.topic-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; background: none; border: 0; padding: 4px 0; text-align: left; cursor: pointer; color: inherit; font: inherit; }
.topic-main:hover .topic-name { color: var(--accent); }
.topic-lv { display: inline-flex; align-items: center; gap: 6px; flex: none; width: 72px; }
.topic-text { min-width: 0; display: flex; flex-direction: column; }
.topic-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.topic-kw { font-size: 0.8rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topic-side { display: flex; align-items: center; gap: 6px; flex: none; }
.topic.flash { animation: topic-flash 1.8s ease; }
@keyframes topic-flash { 0%, 45% { background: var(--accent-soft); } }
@media (max-width: 640px) {
  .topic { flex-wrap: wrap; row-gap: 2px; }
  .topic-side { width: 100%; justify-content: flex-end; }
}

/* Topic dialog */
.item-hero { display: flex; gap: 16px 24px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); }
.item-level { display: flex; align-items: center; gap: 14px; }
.item-level .pips i { width: 10px; height: 20px; border-radius: 3px; }
.item-level .big { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.item-counts { display: flex; gap: 18px; flex-wrap: wrap; margin-left: auto; }
.item-counts div { display: flex; flex-direction: column; }
.item-counts b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.item-counts span { font-size: 0.76rem; color: var(--text-3); }
.pass-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pass-form .input { width: auto; }
.hist-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.hist-row:last-child { border-bottom: 0; }
.hist-row .lv-num { min-width: 28px; }

/* Daily-log linker */
.linker .link-search { position: relative; }
.link-results { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-pop); max-height: 300px; overflow-y: auto; padding: 4px; }
.link-opt { display: flex; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 0; background: none; cursor: pointer; color: inherit; font: inherit; }
.link-opt:hover, .link-opt.active { background: var(--surface-2); }
.link-opt .grow { display: flex; flex-direction: column; }
.tk { font-size: 0.68rem; font-weight: 750; padding: 2px 6px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); flex: none; letter-spacing: 0.02em; }
.link-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.link-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 10px; border-radius: 15px; background: var(--accent-soft); color: var(--text); font-size: 0.84rem; font-weight: 600; max-width: 100%; }
.link-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-chip svg { width: 14px; height: 14px; color: var(--accent); flex: none; }
.link-chip .lv-num { min-width: 0; }
.link-chip .icon-btn { width: 24px; height: 24px; }
.link-chip .icon-btn svg { width: 14px; height: 14px; color: var(--text-2); }
.entry-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.entry-links .link-chip { height: 24px; font-size: 0.76rem; padding: 0 9px; }
.linker [data-link-suggest] .chip > span:not(.tk) { min-width: 0; }

/* Tracker & important topics */
.tracker-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.tracker-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
.goal-box { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 0.86rem; display: flex; flex-direction: column; gap: 4px; }
.mini-list { display: flex; flex-direction: column; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.mini-row:last-child { border-bottom: 0; }
.mini-row .grow { display: flex; flex-direction: column; min-width: 0; }
.mini-row .ellipsis { display: block; }
.imp-item .topic-name { flex-wrap: wrap; }
.imp-meta { font-size: 0.8rem; color: var(--text-3); }

/* Covered keywords (struck, with the level that covered them) and the level guide */
.kw-done { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--text-3); }
/* A small fixed raise (not `super`) keeps it inside single-line, overflow-hidden keyword rows (.topic-kw). */
.kw-lv { display: inline-block; margin-left: 2px; font-size: 0.62rem; font-weight: 800; line-height: 1; color: var(--accent); text-decoration: none; vertical-align: 0.3em; }
.topic-done { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--text-3); }
.level-guide { font-size: 0.76rem; color: var(--text-3); line-height: 1.5; max-width: 120ch; }
.level-guide b { color: var(--text-2); font-weight: 650; }

/* Tracker sub-views: Overview · All topics · Official syllabus · From your log */
.tview-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
@media (max-width: 560px) {
  .tview-bar .segmented { display: flex; width: 100%; }
  .tview-bar .segmented button { flex: 1 1 auto; justify-content: center; padding: 0 8px; }
  .tv-long { display: none; }
}
.log-mark { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.log-mark svg { width: 26px; height: 26px; }
/* All topics */
.trow .topic-side { flex-wrap: wrap; justify-content: flex-end; }
.trow-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.tgroup > summary { font-weight: 700; }
.more-row { padding-top: 10px; text-align: center; }
/* Official syllabus */
.off-exam { scroll-margin-top: 84px; }
.off-stage { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.off-stage + .off-stage { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 6px; }
.off-paper { display: flex; flex-direction: column; gap: 8px; padding-left: 14px; border-left: 2px solid var(--border); min-width: 0; }
.off-paper h4 { font-size: 0.95rem; }
.off-secs { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.off-secs details.disclosure + details.disclosure { margin-top: 0; }
.otopics { display: flex; flex-direction: column; }
.otopic { padding: 7px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.otopic:last-child { border-bottom: 0; }
.otopic-main { display: flex; align-items: center; gap: 10px; width: 100%; padding: 2px 0; border: 0; background: none; text-align: left; cursor: pointer; color: inherit; font: inherit; font-weight: 600; }
.otopic-main:hover .otopic-name { color: var(--accent); }
.otopic-name { min-width: 0; overflow-wrap: anywhere; }
.otopic-kw { padding-left: 82px; font-size: 0.8rem; color: var(--text-2); line-height: 1.55; overflow-wrap: anywhere; }
.phase-table td:first-child { min-width: 180px; }
@media (max-width: 560px) {
  .off-paper { padding-left: 10px; }
  .otopic-kw { padding-left: 0; margin-top: 2px; }
}
/* From your log */
.log-q { max-width: 240px; height: 38px; }
.log-list { display: flex; flex-direction: column; }
.log-topic { padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.log-topic:last-child { border-bottom: 0; }
.log-top { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.log-text { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; }
.log-name { font-weight: 600; overflow-wrap: anywhere; }
.log-side { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; margin-left: auto; }
.log-more > summary { width: fit-content; margin: 4px 0 0 82px; cursor: pointer; color: var(--text-2); font-weight: 600; }
.log-more > .log-entries { padding-left: 82px; }
.log-entries { display: flex; flex-direction: column; padding-top: 4px; }
.log-entry { display: flex; gap: 10px; padding: 3px 0; color: var(--text-2); min-width: 0; }
.log-entry .grow { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .log-more > summary { margin-left: 0; }
  .log-more > .log-entries { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
@media print { .sidebar, .topbar, .player, .toasts { display: none !important; } .shell { display: block; } }

/* ── Syllabus › Manual entry ──────────────────────────────────────────── */
.manual-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.manual-bar .select { width: auto; height: 34px; font-size: 0.9rem; }
.manual-row .topic-main { flex: 1 1 200px; }
.manual-row .select.manual-lv { width: auto; min-width: 150px; height: 34px; font-size: 0.9rem; flex: none; }
.manual-row.changed { background: var(--accent-soft); border-radius: 8px; padding-left: 8px; padding-right: 8px; }
.manual-foot { position: sticky; bottom: var(--player-h); z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 0 4px; background: var(--surface); border-top: 1px solid var(--border); }

/* ── Log › Trips: sessions logged during a trip ───────────────────────── */
.trip-sessions { display: flex; flex-direction: column; }
.trip-session { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.trip-session:last-child { border-bottom: 0; }
.trip-session .grow { min-width: 0; overflow-wrap: anywhere; }

/* P levels: sessions a topic has had on a linked UPSC-AI account (components/partner.js) */
.pbadge { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 11px; font-size: 0.75rem; font-weight: 700;
  background: color-mix(in srgb, var(--partner) 16%, transparent); color: var(--partner-text); white-space: nowrap; flex: none; }
.link-app { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.link-app p { margin: 0; }
.link-code { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.link-code code { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); font-size: 0.9rem; word-break: break-all; user-select: all; }
