/* EsuZone — design system
   Light/dark tokens; the chart colours are the validated reference palette (series 1–3 are the
   all-pairs colour-blind-safe trio used for Productive / Essential / Waste). */

:root {
  color-scheme: light;
  --bg: #f3f3f0;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --surface-3: #e9e8e3;
  --border: rgba(11, 11, 11, 0.10);
  --border-strong: rgba(11, 11, 11, 0.18);
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --accent: #2a78d6;
  --accent-hover: #256abf;
  --accent-soft: rgba(42, 120, 214, 0.10);
  --on-accent: #ffffff;
  --focus: 0 0 0 3px rgba(42, 120, 214, 0.35);

  --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: #b5b3aa;

  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-text: #006300; --critical-text: #b42d2d;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.18);
  --sidebar: 236px;
  --player-h: 0px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --surface-3: #2e2e2b;
    --border: rgba(255, 255, 255, 0.10); --border-strong: rgba(255, 255, 255, 0.18);
    --text: #ffffff; --text-2: #c3c2b7; --text-3: #9a988f;
    --grid: #2c2c2a; --axis: #383835;
    --accent: #3987e5; --accent-hover: #5598e7; --accent-soft: rgba(57, 135, 229, 0.16);
    --focus: 0 0 0 3px rgba(57, 135, 229, 0.45);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
    --sleep: #4a4945;
    --good-text: #0ca30c; --critical-text: #e66767;
    --shadow: none; --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d; --surface: #1a1a19; --surface-2: #232321; --surface-3: #2e2e2b;
  --border: rgba(255, 255, 255, 0.10); --border-strong: rgba(255, 255, 255, 0.18);
  --text: #ffffff; --text-2: #c3c2b7; --text-3: #9a988f;
  --grid: #2c2c2a; --axis: #383835;
  --accent: #3987e5; --accent-hover: #5598e7; --accent-soft: rgba(57, 135, 229, 0.16);
  --focus: 0 0 0 3px rgba(57, 135, 229, 0.45);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  --sleep: #4a4945;
  --good-text: #0ca30c; --critical-text: #e66767;
  --shadow: none; --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.6);
}

/* ── 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.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
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(--surface) 86%, transparent); backdrop-filter: saturate(160%) 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: 750; font-size: 1.02rem; color: var(--text); text-decoration: none !important; white-space: nowrap; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--s1), var(--s7)); box-shadow: 0 4px 14px color-mix(in srgb, var(--s1) 35%, transparent);
}
.brand-mark svg { width: 19px; height: 19px; }
.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: 8px; height: 40px; padding: 0 12px; border-radius: 11px;
  color: var(--text); font-weight: 750; font-size: 1rem; letter-spacing: -0.005em; white-space: nowrap; text-decoration: none !important;
  transition: background 0.15s, color 0.15s; flex: none;
}
.nav-link svg { width: 19px; height: 19px; flex: none; stroke-width: 2.3; }
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent); }
.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: 4px 10px 4px 4px; border-radius: 22px; border: 1px solid var(--border); 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: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--s3), var(--s1)); color: #fff; display: grid; place-items: center; font-weight: 700; 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 { outline: none; }
.input.w-num { max-width: 140px; }
.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; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin-top: 4px; }

/* 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; }
  .appbar.open .nav-link[aria-current="page"] { background: var(--accent); color: #fff; }
  .brand .brand-text { font-size: 0.98rem; }
  .main { padding-top: 16px; }
  :root .secret { margin-top: -16px; }   /* beats the later .secret margin shorthand */
  h1 { font-size: 1.3rem; }
}

/* ── 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-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 ───────────────────────────────────────────────────────── */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr)); }
.tiles-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; box-shadow: var(--shadow); }
.tile-label { font-size: 0.82rem; color: var(--text-2); display: flex; align-items: center; gap: 7px; }
.tile-value { font-size: 1.55rem; font-weight: 650; margin-top: 4px; letter-spacing: -0.02em; line-height: 1.15; }
.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 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 600; cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s, transform 0.05s;
  text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary: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: #b42d2d; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 0.86rem; border-radius: 8px; }
.btn-lg { height: 46px; padding: 0 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; 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; }
.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: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; 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); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; height: 44px; padding: 0 14px; border: 0; background: none; color: var(--text-2); font-weight: 600; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tabs button svg { width: 17px; height: 17px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 550; font-size: 0.88rem; 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); }

/* ── 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: 600; color: var(--text-2); font-size: 0.8rem; padding: 9px 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 rgba(12, 163, 12, 0.5); animation: pulse 1.8s infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.45); } 70% { box-shadow: 0 0 0 9px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }

.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 14px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); animation: toast-in 0.2s ease; font-weight: 500; }
.toast svg { width: 19px; height: 19px; flex: none; margin-top: 1px; }
.toast.error svg { color: #ff8a8a; }
.toast.success svg { color: #5fd35f; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
dialog.modal { border: 0; padding: 0; border-radius: 18px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: var(--shadow-pop); }
dialog.modal.wide { width: min(900px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.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 8px 20px rgba(0, 0, 0, 0.16); }
.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) */
.cal-lv0 { background: #121212; color: #ffffff; border-color: #121212; }
.cal-lv1 { background: #dc2626; color: #ffffff; border-color: #dc2626; }
.cal-lv2 { background: #2563eb; color: #ffffff; border-color: #2563eb; }
.cal-lv3 { background: #22c55e; color: #052e16; border-color: #22c55e; }
.cal-lv4 { background: #fbbf24; color: #1c1300; border-color: #fbbf24; }
:root[data-theme="dark"] .cal-lv0 { border-color: rgba(255, 255, 255, 0.22); }
@media (prefers-color-scheme: dark) { :root:where(:not([data-theme="light"])) .cal-lv0 { border-color: rgba(255, 255, 255, 0.22); } }

/* Social activities (cell = the day's biggest activity; chips = each activity) */
.so-WentOutside, .so-Travelling, .so-Test { background: #fbbf24; color: #1c1300; border-color: #fbbf24; }
.so-Turf { background: #dc2626; color: #ffffff; border-color: #dc2626; }
.so-Office { background: #ec4899; color: #ffffff; border-color: #ec4899; }
.so-Coaching { background: #22c55e; color: #052e16; border-color: #22c55e; }
.so-Entertainment { background: #8b5cf6; color: #ffffff; border-color: #8b5cf6; }
.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: #fbbf24; color: #1c1300; border-color: #fbbf24; }
.md-over { background: #121212; color: #ffffff; border-color: #121212; }
.md-high { background: #dc2626; color: #ffffff; border-color: #dc2626; }
.md-mid { background: #38bdf8; color: #082f49; border-color: #38bdf8; }
.md-low { background: #22c55e; color: #052e16; border-color: #22c55e; }
.hb-clean { background: #22c55e; color: #052e16; border-color: #22c55e; }
.hb-once { background: #f97316; color: #ffffff; border-color: #f97316; }
.hb-many { background: #991b1b; color: #ffffff; border-color: #991b1b; }

.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(--surface) 94%, 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, var(--s1), var(--s7)); 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 { display: none; }
@media (max-width: 900px) {
  .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; }

/* ── 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: 20px; align-items: center; padding: 20px 22px;
  border-radius: 20px; border: 1px solid var(--border); margin-bottom: 18px;
  background: radial-gradient(600px 220px at 100% 0%, color-mix(in srgb, var(--s7) 18%, transparent), transparent 70%),
              radial-gradient(500px 220px at 0% 100%, color-mix(in srgb, var(--s3) 18%, transparent), transparent 70%), var(--surface);
}
.hero h1 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
.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: #f59e0b; }
.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 12px; border-radius: 17px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; 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: #f59e0b; }
.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: 20px;
  background: radial-gradient(500px 240px at 0% 0%, color-mix(in srgb, var(--s7) 22%, transparent), transparent 70%), radial-gradient(500px 240px at 100% 100%, color-mix(in srgb, var(--s1) 20%, transparent), transparent 70%), var(--surface);
  border: 1px solid var(--border); }
.now-art { width: 132px; height: 132px; border-radius: 26px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--s1), var(--s7) 60%, var(--s5)); box-shadow: 0 16px 40px color-mix(in srgb, var(--s7) 40%, transparent); 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; } }

@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; } }
