:root {
  --bg: #0a0a0b;
  --panel: #141414;
  --panel-2: #1e1c18;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.14);
  --ink: #f6ead2;
  --muted: #74706a;
  --muted-2: #4c4844;
  --accent: #e8b84b;
  --urgent: #e8703f;
  --good: #8fd6a8;
  --radius-md: 10px;
  --radius-lg: 16px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  /* how strongly the ambient glow is tinted — light themes turn this way down */
  --glow: 38%;
  --glow-2: 20%;
  /* the board's case is always dark metal, like a real departure board's housing —
   * a deliberate constant across every theme, not meant to invert for a light theme */
  --flap-case-1: #0e0d0b;
  --flap-case-2: #0a0908;
  /* typography hooks — the typographic themes swap these for serif / rounded / mono */
  --hero-font: ui-monospace, "SF Mono", Menlo, monospace;
  --display-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  --body-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

/* ============================================================
   THEMES — 32 palettes. Each is grouped by the render engine it
   drives (split-flap / analog / LED / LCD / nixie / typographic);
   the engine rules themselves live further down, keyed on the
   data-board / data-dial attributes that app.js sets.
   ============================================================ */

/* ---------- split-flap ---------- */
:root[data-theme="midnight"] {
  --bg: #060912; --panel: #0f1626; --panel-2: #16203a;
  --hairline: rgba(255, 255, 255, 0.08); --hairline-strong: rgba(255, 255, 255, 0.16);
  --ink: #eaf1ff; --muted: #7086ab; --muted-2: #4b5b7d;
  --accent: #6ea8ff; --urgent: #ff8a5b; --good: #7fe0b0;
}
:root[data-theme="sunset"] {
  --bg: #1a0f1c; --panel: #2a1728; --panel-2: #3a2036;
  --hairline: rgba(255, 200, 180, 0.1); --hairline-strong: rgba(255, 200, 180, 0.2);
  --ink: #fdeee3; --muted: #b8778a; --muted-2: #7a4a5c;
  --accent: #ff7a59; --urgent: #ff4d6d; --good: #ffd166;
}
:root[data-theme="ocean"] {
  --bg: #071620; --panel: #0c2230; --panel-2: #123043;
  --hairline: rgba(150, 220, 235, 0.1); --hairline-strong: rgba(150, 220, 235, 0.2);
  --ink: #e4f6fb; --muted: #6d9aac; --muted-2: #45697a;
  --accent: #3fc7d6; --urgent: #ff7a5c; --good: #6bd6a8;
}
:root[data-theme="forest"] {
  --bg: #0c1410; --panel: #142019; --panel-2: #1c2c22;
  --hairline: rgba(180, 220, 190, 0.1); --hairline-strong: rgba(180, 220, 190, 0.2);
  --ink: #e7f2e9; --muted: #7ea084; --muted-2: #4c6852;
  --accent: #8fbf6f; --urgent: #e0834a; --good: #6fbf8f;
}
:root[data-theme="lava"] {
  --bg: #140806; --panel: #22100b; --panel-2: #2e1610;
  --hairline: rgba(255, 150, 110, 0.1); --hairline-strong: rgba(255, 150, 110, 0.2);
  --ink: #ffe9dc; --muted: #a8664f; --muted-2: #6b3d30;
  --accent: #ff5a2e; --urgent: #ffb02e; --good: #ffcf8a;
  --flap-case-1: #1a0a06; --flap-case-2: #0e0503;
}
:root[data-theme="lavender"] {
  --bg: #100c1a; --panel: #191327; --panel-2: #241b36;
  --hairline: rgba(200, 180, 255, 0.1); --hairline-strong: rgba(200, 180, 255, 0.2);
  --ink: #f1eaff; --muted: #8f7fb3; --muted-2: #5c4f7a;
  --accent: #b28dff; --urgent: #ff7aa8; --good: #9be3c9;
}
:root[data-theme="rosegold"] {
  --bg: #1c1417; --panel: #2a1e22; --panel-2: #3a2a2e;
  --hairline: rgba(230, 190, 180, 0.12); --hairline-strong: rgba(230, 190, 180, 0.22);
  --ink: #f7e9e4; --muted: #b08d8a; --muted-2: #745a58;
  --accent: #d9a066; --urgent: #d9636b; --good: #a9c9a0;
}
:root[data-theme="cassette"] {
  --bg: #1a1410; --panel: #26201a; --panel-2: #332a22;
  --hairline: rgba(255, 220, 180, 0.1); --hairline-strong: rgba(255, 220, 180, 0.2);
  --ink: #f6ead8; --muted: #a68f75; --muted-2: #6e5c4a;
  --accent: #ff8f3d; --urgent: #e94e3c; --good: #d9c45c;
}
:root[data-theme="chalkboard"] {
  --bg: #16221c; --panel: #1e2f27; --panel-2: #263a31;
  --hairline: rgba(255, 255, 255, 0.09); --hairline-strong: rgba(255, 255, 255, 0.16);
  --ink: #f2f2ea; --muted: #8ba396; --muted-2: #5a7266;
  --accent: #f0d264; --urgent: #e8845c; --good: #a9d6b8;
}
:root[data-theme="paper"] {
  --bg: #f3efe6; --panel: #ffffff; --panel-2: #ece6d8;
  --hairline: rgba(30, 25, 15, 0.1); --hairline-strong: rgba(30, 25, 15, 0.18);
  --ink: #21201c; --muted: #7a7568; --muted-2: #a39d8c;
  --accent: #b5762c; --urgent: #c34e28; --good: #3c8a5c;
  --glow: 16%; --glow-2: 8%;
}

/* ---------- analog ---------- */
:root[data-theme="watch"] {
  --bg: #14161a; --panel: #1d2026; --panel-2: #262a32;
  --hairline: rgba(255, 255, 255, 0.08); --hairline-strong: rgba(255, 255, 255, 0.18);
  --ink: #f2f4f7; --muted: #7d838f; --muted-2: #4d525c;
  --accent: #9fb4d1; --urgent: #e8703f; --good: #8fd6a8;
}
:root[data-theme="grandfather"] {
  --bg: #1b120c; --panel: #2a1c12; --panel-2: #3a2818;
  --hairline: rgba(230, 190, 140, 0.14); --hairline-strong: rgba(230, 190, 140, 0.24);
  --ink: #f2e2c4; --muted: #a3876a; --muted-2: #6b543e;
  --accent: #c9973f; --urgent: #c2542e; --good: #7fa06a;
}
:root[data-theme="swiss"] {
  --bg: #e9e9e4; --panel: #ffffff; --panel-2: #f4f4f0;
  --hairline: rgba(0, 0, 0, 0.08); --hairline-strong: rgba(0, 0, 0, 0.16);
  --ink: #111111; --muted: #6f6f6b; --muted-2: #a8a8a3;
  --accent: #e2001a; --urgent: #e2001a; --good: #2b7a4b;
  --glow: 10%; --glow-2: 5%;
  --dial-face: #ffffff; --dial-ink: #111111; --dial-tick: #111111; --dial-second: #e2001a;
}
:root[data-theme="diver"] {
  --bg: #0b0e12; --panel: #13181f; --panel-2: #1a2028;
  --hairline: rgba(255, 255, 255, 0.08); --hairline-strong: rgba(255, 255, 255, 0.18);
  --ink: #e9f2ff; --muted: #6f7f92; --muted-2: #444f5e;
  --accent: #b8ff5c; --urgent: #ff5c5c; --good: #b8ff5c;
  --dial-face: #0a0d11; --dial-ink: #f2f5f8; --dial-tick: #3a4452; --dial-second: #ff5c5c;
}
:root[data-theme="pocket"] {
  --bg: #1c140d; --panel: #2a1f14; --panel-2: #3b2b1b;
  --hairline: rgba(240, 210, 150, 0.14); --hairline-strong: rgba(240, 210, 150, 0.26);
  --ink: #f3e6cc; --muted: #a58b62; --muted-2: #6c5a3e;
  --accent: #d4a24c; --urgent: #c8552f; --good: #8fa56c;
  --dial-face: #f1e4c8; --dial-ink: #2b1d10; --dial-tick: #7d6a4d; --dial-second: #b3452b;
}
:root[data-theme="bauhaus"] {
  --bg: #f2efe8; --panel: #ffffff; --panel-2: #eae6dd;
  --hairline: rgba(0, 0, 0, 0.1); --hairline-strong: rgba(0, 0, 0, 0.2);
  --ink: #111111; --muted: #6a6862; --muted-2: #a8a49b;
  --accent: #e63b2e; --urgent: #f2b705; --good: #2f6fd6;
  --glow: 12%; --glow-2: 8%;
  --dial-face: #ffffff; --dial-ink: #111111; --dial-tick: #111111; --dial-second: #e63b2e;
  --display-font: "Futura", "Avenir Next", "Century Gothic", -apple-system, sans-serif;
}

/* ---------- LED signs ---------- */
:root[data-theme="motorway"] {
  --bg: #05100a; --panel: #08170f; --panel-2: #0a1f13;
  --hairline: rgba(120, 255, 170, 0.12); --hairline-strong: rgba(120, 255, 170, 0.22);
  --ink: #baffce; --muted: #4f8a63; --muted-2: #326345;
  --accent: #ffc94d; --urgent: #ff6b4d; --good: #baffce;
  --flap-case-1: #0a2416; --flap-case-2: #071a10;
}
:root[data-theme="neon"] {
  --bg: #07070c; --panel: #0f0f1a; --panel-2: #171728;
  --hairline: rgba(120, 240, 255, 0.14); --hairline-strong: rgba(120, 240, 255, 0.28);
  --ink: #3ce6f0; --muted: #6e7a9a; --muted-2: #454f6e;
  --accent: #ff3fb0; --urgent: #ff3fb0; --good: #6bff9e;
  --flap-case-1: #0c0c16; --flap-case-2: #07070c;
}
:root[data-theme="stadium"] {
  --bg: #060606; --panel: #101010; --panel-2: #161616;
  --hairline: rgba(255, 255, 255, 0.08); --hairline-strong: rgba(255, 255, 255, 0.16);
  --ink: #ffd23f; --muted: #8a7a3a; --muted-2: #55491f;
  --accent: #ff3b3b; --urgent: #ff3b3b; --good: #57ff8a;
  --flap-case-1: #121212; --flap-case-2: #080808;
}
:root[data-theme="vapor"] {
  --bg: #12082a; --panel: #1c0f3d; --panel-2: #26154d;
  --hairline: rgba(255, 150, 240, 0.12); --hairline-strong: rgba(255, 150, 240, 0.24);
  --ink: #ff9ff3; --muted: #8f6fc0; --muted-2: #5c4685;
  --accent: #4ff0ff; --urgent: #ff5fa2; --good: #ffe66d;
  --flap-case-1: #1a0f36; --flap-case-2: #100826;
}
:root[data-theme="terminal"] {
  --bg: #020803; --panel: #06120a; --panel-2: #0a1a0f;
  --hairline: rgba(125, 255, 154, 0.12); --hairline-strong: rgba(125, 255, 154, 0.24);
  --ink: #7dff9a; --muted: #3f8a52; --muted-2: #275a35;
  --accent: #7dff9a; --urgent: #ff7b5c; --good: #7dff9a;
  --flap-case-1: #041008; --flap-case-2: #020803;
  --hero-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --body-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="amber"] {
  --bg: #0d0800; --panel: #160d00; --panel-2: #1f1300;
  --hairline: rgba(255, 176, 0, 0.12); --hairline-strong: rgba(255, 176, 0, 0.24);
  --ink: #ffb000; --muted: #8a6a2a; --muted-2: #5a4520;
  --accent: #ffb000; --urgent: #ff5e3a; --good: #ffd36a;
  --flap-case-1: #150d00; --flap-case-2: #0d0800;
  --hero-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- LCD ---------- */
:root[data-theme="lcd"] {
  --bg: #151614; --panel: #232523; --panel-2: #2e302d;
  --hairline: rgba(255, 255, 255, 0.08); --hairline-strong: rgba(255, 255, 255, 0.16);
  --ink: #e8e8e2; --muted: #8a8f82; --muted-2: #565a52;
  --accent: #9fc06a; --urgent: #e08a4a; --good: #9fc06a;
  --lcd-panel: #b9c6a3; --lcd-ink: #1c2b1f;
  --glow: 18%;
}
:root[data-theme="gameboy"] {
  --bg: #0f380f; --panel: #1a4a1a; --panel-2: #306230;
  --hairline: rgba(155, 188, 15, 0.16); --hairline-strong: rgba(155, 188, 15, 0.3);
  --ink: #9bbc0f; --muted: #6f9a2a; --muted-2: #4a7a20;
  --accent: #9bbc0f; --urgent: #c8d86a; --good: #9bbc0f;
  --lcd-panel: #9bbc0f; --lcd-ink: #0f380f;
  --hero-font: "Courier New", Courier, monospace;
  --display-font: "Courier New", Courier, monospace;
  --glow: 22%;
}

/* ---------- nixie ---------- */
:root[data-theme="nixie"] {
  --bg: #0c0907; --panel: #15100c; --panel-2: #1c1510;
  --hairline: rgba(255, 190, 130, 0.1); --hairline-strong: rgba(255, 190, 130, 0.2);
  --ink: #ffd9b0; --muted: #8a6a50; --muted-2: #55402e;
  --accent: #ff9a3c; --urgent: #ff5330; --good: #ffc36a;
}

/* ---------- typographic ---------- */
:root[data-theme="editorial"] {
  --bg: #f6f1e7; --panel: #ffffff; --panel-2: #efe8da;
  --hairline: rgba(30, 25, 15, 0.1); --hairline-strong: rgba(30, 25, 15, 0.18);
  --ink: #1d1a16; --muted: #7d7466; --muted-2: #b0a795;
  --accent: #b8412c; --urgent: #b8412c; --good: #3f7d5a;
  --glow: 10%; --glow-2: 6%;
  --hero-font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --display-font: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
}
:root[data-theme="gold"] {
  --bg: #090807; --panel: #12100d; --panel-2: #1b1813;
  --hairline: rgba(212, 175, 55, 0.12); --hairline-strong: rgba(212, 175, 55, 0.24);
  --ink: #f3e3b8; --muted: #8d7a52; --muted-2: #574b32;
  --accent: #d4af37; --urgent: #e0663a; --good: #b8c98a;
  --hero-font: "Didot", "Bodoni 72", "Playfair Display", "Times New Roman", serif;
  --display-font: "Didot", "Bodoni 72", "Playfair Display", "Times New Roman", serif;
}
:root[data-theme="mono"] {
  --bg: #000000; --panel: #0d0d0d; --panel-2: #161616;
  --hairline: rgba(255, 255, 255, 0.1); --hairline-strong: rgba(255, 255, 255, 0.2);
  --ink: #ffffff; --muted: #8a8a8a; --muted-2: #4a4a4a;
  --accent: #ffffff; --urgent: #ff4747; --good: #ffffff;
  --glow: 8%; --glow-2: 4%;
  --hero-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --display-font: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="arctic"] {
  --bg: #eef4f8; --panel: #ffffff; --panel-2: #e1ebf2;
  --hairline: rgba(20, 40, 60, 0.1); --hairline-strong: rgba(20, 40, 60, 0.18);
  --ink: #12202c; --muted: #6b8194; --muted-2: #a5b7c5;
  --accent: #2c8fd6; --urgent: #e2653a; --good: #2fa87a;
  --glow: 14%; --glow-2: 8%;
  --hero-font: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, sans-serif;
  --display-font: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="sakura"] {
  --bg: #fbeff2; --panel: #ffffff; --panel-2: #f6dfe5;
  --hairline: rgba(80, 20, 40, 0.1); --hairline-strong: rgba(80, 20, 40, 0.18);
  --ink: #3a1f2b; --muted: #a67a8b; --muted-2: #d1adb9;
  --accent: #e2568a; --urgent: #d94a3d; --good: #6fb28b;
  --glow: 16%; --glow-2: 10%;
  --hero-font: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, sans-serif;
  --display-font: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="space"] {
  --bg: #03040a; --panel: #0a0d1a; --panel-2: #11162a;
  --hairline: rgba(255, 255, 255, 0.08); --hairline-strong: rgba(255, 255, 255, 0.16);
  --ink: #ffffff; --muted: #6c78a0; --muted-2: #3e4766;
  --accent: #9cc4ff; --urgent: #ff7a5c; --good: #8ff0c8;
  --glow: 22%;
  --hero-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

/* ============================================================
   BASE
   ============================================================ */

* { box-sizing: border-box; }

/* Author `display` rules (e.g. `.foo { display: flex }`) always beat the browser's
 * default `[hidden] { display: none }` regardless of selector specificity, since
 * user-agent rules lose to author rules outright. Without this, toggling `.hidden`
 * on any element that also has its own `display` rule silently does nothing. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body-font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
  overflow: hidden;
  position: relative;
}

/* a living ambient glow behind every theme, tinted from that theme's own accent
 * color — this is what turns a flat palette swap into a place that feels alive.
 * Sits behind everything (z-index -1) and never intercepts clicks. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(55% 45% at 50% 32%, color-mix(in srgb, var(--accent) var(--glow), transparent), transparent 72%),
    radial-gradient(70% 55% at 85% 90%, color-mix(in srgb, var(--accent) var(--glow-2), transparent), transparent 75%),
    radial-gradient(70% 55% at 10% 95%, color-mix(in srgb, var(--good) 14%, transparent), transparent 75%);
  pointer-events: none;
}
/* a second full-screen layer for per-theme texture (scanlines, stars, a grid horizon).
 * Off by default; individual themes turn it on and pick a z-index: 0 sits behind the
 * clock, 6 sits over it (still under the corner buttons and the settings sheet). */
body::after {
  content: ""; display: none;
  position: fixed; inset: 0; z-index: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  body::before { animation: ambient-breathe 6s ease-in-out infinite; }
}
@keyframes ambient-breathe {
  0%, 100% { opacity: 0.75; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }

.section-title {
  margin: 0 0 10px 2px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
}

/* ---------- shared controls ---------- */

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: transparent; border: 1px solid var(--hairline-strong);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn:hover { color: var(--ink); border-color: var(--ink); }

/* the only two bits of chrome on the clock screen. Fixed to the viewport corners, and
   faded out entirely after a few idle seconds (body.chrome-hidden, set by app.js) so
   the screen is nothing but the clock — any tap brings them back. */
.corner-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 14px);
  right: calc(env(safe-area-inset-right) + 14px);
  z-index: 20;
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--hairline-strong);
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 1;
}
.corner-btn:active { transform: scale(0.94); }
.corner-btn:hover { color: var(--ink); border-color: var(--ink); }
.corner-btn-left { left: calc(env(safe-area-inset-left) + 14px); right: auto; }
body.chrome-hidden .corner-btn { opacity: 0; transform: translateY(-8px) scale(0.9); pointer-events: none; }
@media (prefers-reduced-motion: no-preference) {
  .corner-btn { transition: opacity 450ms var(--ease-out), transform 450ms var(--ease-out), border-color 150ms var(--ease-out), color 150ms var(--ease-out); }
}

.pill {
  background: transparent;
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
}
.pill:active { transform: scale(0.98); }
.pill:hover { border-color: var(--ink); }
.pill.on { border-color: var(--good); color: var(--good); }
.pill-small { width: auto; padding: 8px 15px; font-size: 13px; }
.pill + .pill { margin-top: 10px; }

.segmented {
  display: flex; gap: 3px; padding: 3px;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  border-radius: 12px;
}
.seg-btn {
  flex: 1; min-width: 0;
  background: transparent; border: none;
  color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 9px 6px; border-radius: 9px;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.seg-btn.on {
  background: var(--bg); color: var(--ink);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 0 0 1px var(--hairline-strong);
}
@media (prefers-reduced-motion: no-preference) {
  .seg-btn { transition: background 150ms var(--ease-out), color 150ms var(--ease-out); }
}

.pill:focus-visible,
.seg-btn:focus-visible,
input:focus-visible,
.icon-btn:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .pill, .icon-btn { transition: border-color 150ms var(--ease-out), color 150ms var(--ease-out), transform 100ms var(--ease-out); }
}

/* ============================================================
   THE CLOCK VIEW — the entire screen is the clock.
   ============================================================ */

.clock-view {
  position: fixed; inset: 0;
  z-index: 5;
  display: flex; flex-direction: column; align-items: center;
  padding: calc(env(safe-area-inset-top) + 20px) calc(env(safe-area-inset-right) + 20px) calc(env(safe-area-inset-bottom) + 20px) calc(env(safe-area-inset-left) + 20px);
}

/* ---------- the hero: this is the page ---------- */

.cv-center {
  flex: 1; min-height: 0; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  gap: clamp(10px, 2vh, 22px);
}
@media (prefers-reduced-motion: no-preference) {
  .cv-center { animation: hero-in 700ms var(--ease-out) both; }
  .cv-footer { animation: hero-in 700ms 120ms var(--ease-out) both; }
}
@keyframes hero-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.cv-eyebrow {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  font-size: clamp(13px, 1.8vw, 19px); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted);
  min-height: 1.2em;
}
.cv-eyebrow .live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .cv-eyebrow .live-dot { animation: live-pulse 2.4s ease-in-out infinite; }
}
@keyframes live-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.85); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); }
  50% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 6px transparent; }
}

.cv-class-label {
  font-family: var(--display-font);
  font-size: clamp(32px, min(7.6vw, 9.4vh), 96px);
  font-weight: 800; letter-spacing: -0.025em; line-height: 1.04;
  max-width: 94vw; overflow-wrap: anywhere;
  margin-top: -0.2em;
}

.cv-sub-label {
  font-size: clamp(14px, min(2.2vw, 2.6vh), 24px); font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--muted);
}

.digital-hero { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.6vh, 18px); }

/* ---------- footer: secondary clock, next class, the day strip ---------- */

.cv-footer {
  display: flex; flex-direction: column; align-items: center; gap: clamp(12px, 2vh, 18px);
  padding-top: clamp(12px, 2.4vh, 24px);
}
/* align-items: flex-end, not baseline — .flap-board's tiles are all absolutely-
 * positioned divs with no real inline content, so they have no natural text
 * baseline; the browser falls back to an unpredictable synthetic one, which put
 * the AM/PM suffix noticeably too high and off-balance with the digits below it. */
.cv-clock-row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: nowrap; }
.cv-clock-suffix {
  font-size: clamp(12px, min(1.8vw, 2.2vh), 20px);
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  padding-bottom: 0.2em;
  white-space: nowrap;
}

.cv-next-row {
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  padding: 8px 18px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  font-size: clamp(14px, min(1.9vw, 2.3vh), 21px);
  max-width: 92vw;
}
.cv-next-label { font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent); font-size: 0.7em; }
.cv-next-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50vw; }
.cv-next-time { color: var(--muted); }

.cv-day-label {
  font-size: clamp(11px, 1.4vw, 14px); font-weight: 600; letter-spacing: 0.04em;
  color: var(--muted);
}

/* ============================================================
   BOARD ENGINE 1 — the mechanical split-flap (the default)
   ============================================================ */

.flap-board {
  display: flex; gap: var(--flap-gap, 5px); perspective: 800px;
  background: linear-gradient(var(--flap-case-1), var(--flap-case-2));
  padding: clamp(6px, min(1vw, 1.4vh), 16px);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 18px 40px -18px rgba(0, 0, 0, 0.85);
}

/* sized off both vw and vh (whichever is tighter) so digits go genuinely large without
   ever overflowing in either portrait or landscape */
.flap-board--hero {
  --flap-w: calc(clamp(56px, min(17vw, 23vh), 250px) * var(--hero-scale, 1));
  --flap-h: calc(clamp(88px, min(26vw, 35vh), 360px) * var(--hero-scale, 1));
  --flap-fs: calc(clamp(58px, min(19vw, 26vh), 260px) * var(--hero-scale, 1));
  --flap-gap: clamp(6px, min(1.6vw, 2.2vh), 16px);
}
.flap-board--sub {
  --flap-w: clamp(20px, min(5vw, 6.6vh), 62px);
  --flap-h: clamp(30px, min(7.4vw, 10vh), 92px);
  --flap-fs: clamp(18px, min(5.4vw, 7.2vh), 66px);
  --flap-gap: clamp(3px, min(0.8vw, 1vh), 8px);
}

.flap {
  position: relative;
  width: var(--flap-w); height: var(--flap-h);
  background: var(--panel-2);
  border-radius: clamp(5px, 8%, 12px);
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(0, 0, 0, 0.7),
    0 8px 20px -8px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.flap.flap-colon { width: calc(var(--flap-w) * 0.4); background: transparent; box-shadow: none; }
.flap.flap-colon .flap-face { color: var(--muted-2); }

.flap:not(.flap-colon)::before {
  /* shading splitting the tile into an upper/lower leaf, like the physical hinge, with a
     brighter catch-light along the very top edge where a real flap would reflect light */
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.09) 0%, transparent 12%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05), transparent 50%, rgba(0, 0, 0, 0.3) 50%, rgba(0, 0, 0, 0.08));
  z-index: 1; pointer-events: none;
}
.flap:not(.flap-colon)::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(50% - 1px); height: 2px;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2; pointer-events: none;
}

.flap-face, .flap-leaf {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--hero-font);
  font-weight: 700;
  font-size: var(--flap-fs);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: no-preference) {
  .flap-face { transition: color 400ms var(--ease-out); }
}
.flap-leaf {
  background: var(--panel-2);
  transform-origin: bottom center;
  backface-visibility: hidden;
  z-index: 3;
}
@media (prefers-reduced-motion: no-preference) {
  .flap-leaf-flip { animation: flap-flip 340ms cubic-bezier(0.36, 0, 0.66, -0.15) forwards; }
}
@keyframes flap-flip {
  /* the leaf loses light as it rotates edge-on to the viewer, like a real card catching a shadow */
  0% { transform: rotateX(0deg); filter: brightness(1); }
  55% { filter: brightness(0.4); }
  100% { transform: rotateX(-100deg); opacity: 0; filter: brightness(0.3); }
}

/* a soft shadow that sweeps across the whole tile as its leaf swings past, cast the way a
   real hinged flap would darken the card underneath mid-flip */
.flap-shadow {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.55) 55%, transparent 100%);
  opacity: 0; z-index: 4; pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .flap-shadow-flip { animation: flap-shadow-sweep 340ms ease-out forwards; }
}
@keyframes flap-shadow-sweep {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* the countdown board turns warm when a class is about to end — a small, functional
   splash of color rather than decoration, like a departure board's "final call" */
.flap-board--urgent .flap-face { color: var(--urgent); }
.cv-sub-label.urgent { color: var(--urgent); }

/* ============================================================
   BOARD ENGINE 2 — LED sign: a lit dot-matrix panel, no moving parts
   ============================================================ */

:root[data-board="led"] .flap-board { border-radius: 4px; border-color: var(--hairline-strong); }
:root[data-board="led"] .flap { border-radius: 2px; background: color-mix(in srgb, var(--panel-2) 55%, black); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4); }
:root[data-board="led"] .flap.flap-colon { background: transparent; box-shadow: none; }
:root[data-board="led"] .flap-face {
  font-family: "Courier New", ui-monospace, monospace;
  letter-spacing: -0.05em;
  text-shadow: 0 0 10px currentColor, 0 0 26px color-mix(in srgb, currentColor 55%, transparent);
}
:root[data-board="led"] .flap.flap-colon .flap-face { color: var(--ink); opacity: 0.6; }
/* the dot-matrix mask — each digit reads as a grid of lit pixels */
:root[data-board="led"] .flap:not(.flap-colon)::before {
  background: radial-gradient(circle, transparent 58%, rgba(0, 0, 0, 0.62) 62%) 0 0 / 5px 5px;
  z-index: 5;
}
:root[data-board="led"] .flap:not(.flap-colon)::after { display: none; }

/* ============================================================
   BOARD ENGINE 3 — LCD: one flat panel, dark segments on a lit backing,
   with the ghost of unlit "8" segments behind each digit like a real LCD
   ============================================================ */

:root[data-board="lcd"] .flap-board {
  background: var(--lcd-panel);
  border-radius: 10px;
  border: clamp(5px, 0.9vw, 12px) solid var(--panel);
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.3), 0 18px 40px -18px rgba(0, 0, 0, 0.8), 0 0 0 1px var(--hairline-strong);
  gap: calc(var(--flap-gap) * 0.5);
}
:root[data-board="lcd"] .flap { background: transparent; box-shadow: none; border-radius: 0; }
:root[data-board="lcd"] .flap:not(.flap-colon)::before,
:root[data-board="lcd"] .flap:not(.flap-colon)::after { display: none; }
:root[data-board="lcd"] .flap-face {
  color: var(--lcd-ink);
  font-family: "Courier New", ui-monospace, monospace;
  font-weight: 700;
  transition: none;
}
:root[data-board="lcd"] .flap.flap-colon .flap-face { color: var(--lcd-ink); }
:root[data-board="lcd"] .flap:not(.flap-colon) .flap-face::before {
  content: "8"; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--lcd-ink); opacity: 0.09;
}
:root[data-board="lcd"] .flap-board--urgent .flap-face { color: var(--lcd-ink); }
@media (prefers-reduced-motion: no-preference) {
  :root[data-board="lcd"] .flap-board--urgent .flap-face { animation: lcd-blink 1s steps(1) infinite; }
}
@keyframes lcd-blink { 50% { opacity: 0.35; } }

/* ============================================================
   BOARD ENGINE 4 — nixie tubes: glass, a mesh anode, a glowing orange cathode
   ============================================================ */

:root[data-board="nixie"] .flap-board { background: transparent; border: none; box-shadow: none; padding: 0; }
:root[data-board="nixie"] .flap {
  border-radius: 45% 45% 10% 10% / 26% 26% 6% 6%;
  background: linear-gradient(180deg, rgba(255, 170, 100, 0.07), rgba(0, 0, 0, 0.55) 70%);
  border: 1px solid rgba(255, 190, 130, 0.18);
  box-shadow:
    inset 0 0 40px rgba(255, 120, 40, 0.16),
    inset 0 -12px 22px rgba(0, 0, 0, 0.65),
    inset 2px 0 6px rgba(255, 255, 255, 0.05),
    0 0 32px rgba(255, 120, 40, 0.12);
}
:root[data-board="nixie"] .flap.flap-colon { background: transparent; border: none; box-shadow: none; }
/* the anode mesh in front of the digit */
:root[data-board="nixie"] .flap:not(.flap-colon)::before {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 5px);
  z-index: 5;
}
/* the base the tube is socketed into */
:root[data-board="nixie"] .flap:not(.flap-colon)::after {
  top: auto; bottom: 0; height: 9%;
  background: linear-gradient(#2a2118, #0c0907);
  border-top: 1px solid rgba(255, 200, 150, 0.12);
}
:root[data-board="nixie"] .flap-face {
  color: var(--accent);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
  text-shadow:
    0 0 3px rgba(255, 240, 220, 0.5),
    0 0 10px var(--accent),
    0 0 26px var(--accent),
    0 0 60px color-mix(in srgb, var(--accent) 60%, transparent);
}
:root[data-board="nixie"] .flap.flap-colon .flap-face { color: var(--accent); opacity: 0.8; }
@media (prefers-reduced-motion: no-preference) {
  :root[data-board="nixie"] .flap-face { animation: nixie-hum 3.1s ease-in-out infinite; }
}
@keyframes nixie-hum {
  0%, 100% { filter: brightness(1); }
  47% { filter: brightness(1.08); }
  50% { filter: brightness(0.93); }
  53% { filter: brightness(1.04); }
}

/* ============================================================
   BOARD ENGINE 5 — bare typography: no tiles, no case, just the digits
   ============================================================ */

:root[data-board="ink"] .flap-board { background: transparent; border: none; box-shadow: none; padding: 0; gap: 0; }
:root[data-board="ink"] .flap { background: transparent; box-shadow: none; border-radius: 0; width: calc(var(--flap-w) * 0.92); }
:root[data-board="ink"] .flap.flap-colon { width: calc(var(--flap-w) * 0.42); }
:root[data-board="ink"] .flap:not(.flap-colon)::before,
:root[data-board="ink"] .flap:not(.flap-colon)::after { display: none; }
:root[data-board="ink"] .flap-face {
  font-family: var(--hero-font);
  font-weight: 800;
  letter-spacing: -0.04em;
}
:root[data-board="ink"] .flap.flap-colon .flap-face { color: var(--accent); }
:root[data-board="ink"] .flap-board--sub { opacity: 0.85; }

/* ============================================================
   PER-THEME SIGNATURES — what makes each one more than a recolor
   ============================================================ */

/* Neon Arcade: the glow flickers like a real tube; the digits carry their own halo */
:root[data-theme="neon"] body::before {
  background: radial-gradient(60% 50% at 50% 38%, color-mix(in srgb, var(--ink) 26%, transparent), transparent 70%),
              radial-gradient(70% 55% at 85% 90%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 75%);
}
:root[data-theme="neon"] .flap:not(.flap-colon)::before { display: none; }
:root[data-theme="neon"] .flap-face { text-shadow: 0 0 6px #fff8, 0 0 14px currentColor, 0 0 34px currentColor; }
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="neon"] body::before { animation: neon-flicker 2.6s ease-in-out infinite; }
}
@keyframes neon-flicker {
  0%, 19%, 21%, 100% { opacity: 1; transform: scale(1); }
  20% { opacity: 0.55; transform: scale(0.98); }
  55%, 57% { opacity: 0.8; }
  56% { opacity: 1; }
}

/* Sunset: the glow drifts slowly through the sky */
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="sunset"] body::before { animation: ambient-breathe 7s ease-in-out infinite, sunset-drift 16s ease-in-out infinite; }
}
@keyframes sunset-drift {
  0%, 100% { background-position: 50% 38%; }
  50% { background-position: 42% 50%; }
}

/* Ocean: a slower sway, like light through water */
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="ocean"] body::before { animation: ambient-breathe 9s ease-in-out infinite, ocean-sway 12s ease-in-out infinite; }
}
@keyframes ocean-sway {
  0%, 100% { transform: translateX(0) scale(1); }
  50% { transform: translateX(3%) scale(1.05); }
}

/* Forest: dappled light shifting through leaves */
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="forest"] body::before { animation: ambient-breathe 10s ease-in-out infinite; }
}

/* Lava: the heat comes from below, and it pulses faster */
:root[data-theme="lava"] body::before {
  background:
    radial-gradient(70% 45% at 50% 105%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%),
    radial-gradient(40% 30% at 20% 90%, color-mix(in srgb, var(--urgent) 25%, transparent), transparent 70%);
}
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="lava"] body::before { animation: ambient-breathe 3.6s ease-in-out infinite; }
}

/* Rose Gold: a shimmer sweeps the case every few seconds, like light on polished metal */
:root[data-theme="rosegold"] .flap-board { position: relative; overflow: hidden; }
:root[data-theme="rosegold"] .flap-board::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(115deg, transparent 40%, color-mix(in srgb, var(--accent) 35%, transparent) 50%, transparent 60%);
  background-size: 250% 100%;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="rosegold"] .flap-board::after { animation: shimmer-sweep 4.5s ease-in-out infinite; }
}
@keyframes shimmer-sweep {
  0%, 40% { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

/* Cassette: the three tape-deck stripes */
:root[data-theme="cassette"] body::after {
  display: block;
  background: linear-gradient(to bottom,
    transparent 0 74%, #ff8f3d 74% 78%, transparent 78% 80%,
    #e94e3c 80% 84%, transparent 84% 86%, #d9c45c 86% 90%, transparent 90%);
  opacity: 0.35;
}

/* Chalkboard: chalk dust on slate — a static grain, no shimmer */
:root[data-theme="chalkboard"] body::before {
  background:
    radial-gradient(60% 50% at 50% 38%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
  animation: none;
}

/* Terminal / Amber CRT: scanlines over everything, a soft vignette, a blinking cursor */
:root[data-theme="terminal"] body::after,
:root[data-theme="amber"] body::after {
  display: block; z-index: 6;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px),
    radial-gradient(90% 80% at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.55) 100%);
}
:root[data-theme="terminal"] .cv-class-label::after,
:root[data-theme="amber"] .cv-class-label::after {
  content: "_"; margin-left: 0.08em; color: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="terminal"] .cv-class-label::after,
  :root[data-theme="amber"] .cv-class-label::after { animation: cursor-blink 1s steps(1) infinite; }
}
@keyframes cursor-blink { 50% { opacity: 0; } }
:root[data-theme="terminal"] .cv-class-label,
:root[data-theme="amber"] .cv-class-label { text-shadow: 0 0 12px color-mix(in srgb, var(--accent) 50%, transparent); letter-spacing: -0.01em; }

/* Vaporwave: a perspective grid horizon behind the clock */
:root[data-theme="vapor"] body::after {
  display: block;
  background:
    linear-gradient(to bottom, transparent 45%, color-mix(in srgb, var(--urgent) 18%, transparent)),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--urgent) 28%, transparent) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--urgent) 28%, transparent) 0 1px, transparent 1px 44px);
  -webkit-mask-image: linear-gradient(to bottom, transparent 42%, #000 100%);
  mask-image: linear-gradient(to bottom, transparent 42%, #000 100%);
}
:root[data-theme="vapor"] .flap-face { text-shadow: 0 0 10px currentColor, 3px 0 0 color-mix(in srgb, var(--accent) 70%, transparent), -3px 0 0 color-mix(in srgb, var(--urgent) 70%, transparent); }

/* Scoreboard: a harder, brighter LED and a red-on-black case rail */
:root[data-theme="stadium"] .flap-board { border: 2px solid #2a2a2a; box-shadow: 0 0 0 4px #0c0c0c, 0 18px 40px -18px #000; }

/* Deep Space: a starfield behind the clock, twinkling */
:root[data-theme="space"] body::after {
  display: block;
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 70% 60%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 45% 80%, #cfe9ff 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 15%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 10% 70%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 60% 10%, #cfe9ff 50%, transparent 51%);
  background-size: 280px 280px, 340px 340px, 220px 220px, 400px 400px, 300px 300px, 260px 260px;
  opacity: 0.75;
}
@media (prefers-reduced-motion: no-preference) {
  :root[data-theme="space"] body::after { animation: twinkle 4s ease-in-out infinite; }
}
@keyframes twinkle { 50% { opacity: 0.45; } }

/* Gold Leaf: the type is actually gilded */
:root[data-theme="gold"] .flap-face,
:root[data-theme="gold"] .cv-class-label {
  background: linear-gradient(180deg, #fff3c4 0%, #e6c35c 38%, #a67c1e 62%, #f1d883 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
:root[data-theme="gold"] .flap-board--urgent .flap-face { background: none; color: var(--urgent); }
:root[data-theme="gold"] .cv-class-label { font-weight: 700; letter-spacing: 0.01em; }
:root[data-theme="gold"] .flap-face { font-weight: 500; }

/* Editorial: a serif with real weight, an italic eyebrow, a hairline rule */
:root[data-theme="editorial"] .cv-class-label { font-weight: 700; letter-spacing: -0.015em; }
:root[data-theme="editorial"] .cv-eyebrow { font-family: var(--display-font); font-style: italic; text-transform: none; letter-spacing: 0.02em; font-weight: 500; }
:root[data-theme="editorial"] .flap-face { font-weight: 700; letter-spacing: -0.02em; }

/* Mono: uppercase, tracked, brutally plain */
:root[data-theme="mono"] .cv-class-label { text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
:root[data-theme="mono"] .flap-face { font-weight: 700; }

/* Sakura: soft petal blooms in the corners */
:root[data-theme="sakura"] body::after {
  display: block;
  background:
    radial-gradient(12vmin 12vmin at 12% 20%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(9vmin 9vmin at 88% 30%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%),
    radial-gradient(14vmin 14vmin at 80% 85%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(8vmin 8vmin at 20% 88%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%);
}

/* Game Boy: four shades and nothing else — even the glow is that green */
:root[data-theme="gameboy"] body::before { background: radial-gradient(55% 45% at 50% 32%, rgba(155, 188, 15, 0.18), transparent 72%); }
:root[data-theme="gameboy"] .cv-class-label { text-transform: uppercase; letter-spacing: 0.04em; }

/* ============================================================
   ANALOG DIAL — six dial styles on one SVG face
   ============================================================ */

.analog-hero { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vh, 20px); }

.dial-wrap {
  position: relative;
  width: calc(min(66vmin, 62vh, 480px) * var(--hero-scale, 1));
  height: calc(min(66vmin, 62vh, 480px) * var(--hero-scale, 1));
}
.dial-svg { width: 100%; height: 100%; overflow: visible; }

.dial-face { fill: var(--dial-face, var(--panel-2)); stroke: var(--hairline-strong); stroke-width: 2; }
.dial-progress {
  fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round;
  /* percentage origin, not a pixel one — this element is scaled up by the SVG's
   * viewBox, so a fixed "150px" wouldn't land on its actual center */
  transform: rotate(-90deg); transform-origin: 50% 50%;
}
@media (prefers-reduced-motion: no-preference) {
  .dial-progress { transition: stroke-dashoffset 900ms linear; }
}

.dial-tick { stroke: var(--dial-tick, var(--muted)); stroke-width: 1.5; }
.dial-tick.major { stroke: var(--dial-ink, var(--ink)); stroke-width: 3; }
.dial-numeral { fill: var(--dial-ink, var(--ink)); font-size: 20px; font-weight: 700; text-anchor: middle; dominant-baseline: central; font-family: var(--display-font); }

/* rotation center comes from the SVG rotate(deg, cx, cy) attribute set in JS — a CSS
 * transform-origin here would conflict (it's measured in rendered CSS px, not the
 * SVG's 300x300 viewBox units) and throw the hands off to the wrong location */
.hand { stroke: var(--dial-ink, var(--ink)); stroke-linecap: round; }
.hand-hour { stroke-width: 7; }
.hand-minute { stroke-width: 5; }
.hand-second { stroke-width: 2; stroke: var(--dial-second, var(--accent)); }
.hand-second-tip { display: none; fill: var(--dial-second, var(--accent)); }
@media (prefers-reduced-motion: no-preference) {
  .hand-second, .hand-second-tip { transition: transform 150ms cubic-bezier(0.4, 2, 0.6, 1); }
}
.dial-hub { fill: var(--dial-second, var(--accent)); stroke: var(--dial-face, var(--panel-2)); stroke-width: 2; }

.analog-countdown-text { font-size: clamp(16px, 3vmin, 26px); font-weight: 700; color: var(--ink); text-align: center; }

/* --- Analog Watch: a brushed steel bezel --- */
:root[data-dial="watch"] .dial-wrap::before {
  content: ""; position: absolute; inset: -10px; border-radius: 50%;
  background: linear-gradient(155deg, #3a3f47, #14161a 60%);
  z-index: -1;
}

/* --- Grandfather Clock: a brass bezel and a swinging pendulum. The pendulum reserves
   its own height below the dial (via margin) so it never overlaps the text underneath --- */
.dial-pendulum { display: none; }
:root[data-dial="grandfather"] .dial-wrap::before {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  background: linear-gradient(155deg, #d9ac5c, #6b543e 65%);
  z-index: -1;
}
:root[data-dial="grandfather"] .dial-wrap { margin-bottom: clamp(40px, 9vh, 80px); }
:root[data-dial="grandfather"] .dial-pendulum {
  display: block;
  position: absolute; top: 100%; left: 50%; width: 4px; height: clamp(30px, 8vh, 70px);
  transform: translateX(-50%);
}
.pendulum-rod { width: 100%; height: 100%; background: var(--accent); transform-origin: top center; }
.pendulum-bob {
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  :root[data-dial="grandfather"] .pendulum-rod { animation: pendulum-swing 2s ease-in-out infinite; }
}
@keyframes pendulum-swing {
  0%, 100% { transform: rotate(-9deg); }
  50% { transform: rotate(9deg); }
}

/* --- Station Clock: the Swiss railway face — bars not numerals, blunt black hands,
   and the red lollipop second hand --- */
:root[data-dial="swiss"] .dial-face { stroke: none; }
:root[data-dial="swiss"] .dial-wrap::before {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  background: #1a1a1a; box-shadow: 0 14px 40px -16px rgba(0, 0, 0, 0.6);
  z-index: -1;
}
:root[data-dial="swiss"] .dial-tick { stroke-width: 3.5; }
:root[data-dial="swiss"] .dial-tick.major { stroke-width: 9; }
:root[data-dial="swiss"] .hand-hour { stroke-width: 11; stroke-linecap: butt; }
:root[data-dial="swiss"] .hand-minute { stroke-width: 9; stroke-linecap: butt; }
:root[data-dial="swiss"] .hand-second { stroke-width: 3.5; }
:root[data-dial="swiss"] .hand-second-tip { display: block; }
:root[data-dial="swiss"] .dial-hub { fill: #111; stroke: none; }
:root[data-dial="swiss"] .dial-progress { stroke-width: 4; }

/* --- Dive Watch: a rotating-style bezel with minute markers, lumed indices --- */
:root[data-dial="diver"] .dial-wrap::before {
  content: ""; position: absolute; inset: -18px; border-radius: 50%;
  background: repeating-conic-gradient(from -1.5deg, #e6e6e6 0 3deg, #0f1318 3deg 30deg);
  box-shadow: 0 0 0 3px #2a3038, inset 0 0 0 4px #0f1318, 0 14px 40px -14px #000;
  z-index: -1;
}
:root[data-dial="diver"] .dial-face { stroke: #2a3038; stroke-width: 3; }
:root[data-dial="diver"] .dial-tick { stroke-width: 2; }
:root[data-dial="diver"] .dial-tick.major { stroke: var(--accent); stroke-width: 7; filter: drop-shadow(0 0 4px var(--accent)); }
:root[data-dial="diver"] .dial-numeral { fill: var(--accent); filter: drop-shadow(0 0 5px var(--accent)); font-size: 26px; }
:root[data-dial="diver"] .hand-hour, :root[data-dial="diver"] .hand-minute { stroke: #f2f5f8; filter: drop-shadow(0 0 3px rgba(184, 255, 92, 0.5)); }
:root[data-dial="diver"] .hand-hour { stroke-width: 9; }
:root[data-dial="diver"] .hand-minute { stroke-width: 6; }
:root[data-dial="diver"] .dial-progress { stroke: var(--accent); }

/* --- Pocket Watch: cream enamel, roman numerals in a serif, a gold case and the bow on top --- */
:root[data-dial="pocket"] .dial-wrap { margin-top: 30px; }
:root[data-dial="pocket"] .dial-wrap::before {
  content: ""; position: absolute; inset: -13px; border-radius: 50%;
  background: linear-gradient(155deg, #f0d28a, #8a6a2a 60%, #d4a24c 100%);
  box-shadow: inset 0 0 0 3px #5c4520, 0 16px 40px -16px #000;
  z-index: -1;
}
:root[data-dial="pocket"] .dial-wrap::after {
  content: ""; position: absolute; top: -44px; left: 50%; width: 30px; height: 30px; margin-left: -15px;
  border-radius: 50%; border: 6px solid #c9a44f;
  box-shadow: 0 16px 0 -8px #c9a44f;
}
:root[data-dial="pocket"] .dial-face { stroke: #c9a44f; stroke-width: 3; }
:root[data-dial="pocket"] .dial-numeral { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: 22px; }
:root[data-dial="pocket"] .dial-tick { stroke-width: 1; }
:root[data-dial="pocket"] .dial-tick.major { stroke-width: 2; }
:root[data-dial="pocket"] .hand-hour { stroke-width: 5; }
:root[data-dial="pocket"] .hand-minute { stroke-width: 3.5; }
:root[data-dial="pocket"] .dial-progress { stroke: #b3452b; stroke-width: 4; }

/* --- Bauhaus: geometry only. A black ring, twelve bars, and the primary colors --- */
:root[data-dial="bauhaus"] .dial-face { stroke: #111; stroke-width: 7; }
:root[data-dial="bauhaus"] .dial-tick { display: none; }
:root[data-dial="bauhaus"] .dial-tick.major { display: block; stroke: #111; stroke-width: 5; stroke-linecap: butt; }
:root[data-dial="bauhaus"] .hand-hour { stroke: #111; stroke-width: 14; stroke-linecap: butt; }
:root[data-dial="bauhaus"] .hand-minute { stroke: #111; stroke-width: 9; stroke-linecap: butt; }
:root[data-dial="bauhaus"] .hand-second { stroke: #e63b2e; stroke-width: 3; }
:root[data-dial="bauhaus"] .dial-hub { fill: #e63b2e; stroke: none; }
:root[data-dial="bauhaus"] .dial-progress { stroke: #2f6fd6; stroke-width: 7; stroke-linecap: butt; }
:root[data-dial="bauhaus"] .analog-countdown-text { text-transform: uppercase; letter-spacing: 0.08em; }

/* ============================================================
   SETTINGS SHEET
   ============================================================ */

.settings-panel {
  position: fixed; inset: 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  z-index: 50;
  display: flex; justify-content: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
@media (prefers-reduced-motion: no-preference) {
  .settings-panel-inner { animation: panel-in 220ms var(--ease-out); }
}
@keyframes panel-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.settings-panel-inner {
  width: 100%; max-width: 580px;
  margin: calc(env(safe-area-inset-top) + 24px) 16px calc(env(safe-area-inset-bottom) + 24px);
  background: var(--panel);
  border: 1px solid var(--hairline-strong);
  border-radius: 22px;
  padding: 22px 22px 30px;
  height: fit-content;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
}

.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.panel-head h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }

.settings-group { margin-top: 28px; }
.settings-group .muted { margin: 10px 2px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.section-head .section-title { margin: 0 0 0 2px; }
.theme-name { font-size: 13px; font-weight: 600; color: var(--accent); }

#liveBannerBtn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- theme picker ---------- */

.theme-group-title { margin: 16px 0 8px 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.theme-group-title:first-child { margin-top: 0; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px 4px; }

.theme-swatch {
  background: transparent; border: none; padding: 6px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  border-radius: 12px; cursor: pointer;
  font-family: inherit;
}
.theme-swatch:active .swatch-disc { transform: scale(0.92); }
.theme-swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* each disc is a genuine miniature of its theme: the theme's own background with its
   own accent glow at the top-left, exactly like the real ambient background */
.swatch-disc {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, var(--sw-glow), var(--sw-bg) 72%);
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 6px 14px -6px rgba(0, 0, 0, 0.7);
}
.swatch-disc svg { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6)); }
.swatch-name { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; line-height: 1.15; }
.theme-swatch.active .swatch-disc {
  border-color: var(--sw-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw-accent) 35%, transparent), 0 6px 16px -6px rgba(0, 0, 0, 0.8);
}
.theme-swatch.active .swatch-name { color: var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  .swatch-disc { transition: transform 100ms var(--ease-out), box-shadow 150ms var(--ease-out), border-color 150ms var(--ease-out); }
  .theme-swatch[data-theme="neon"] .swatch-disc { animation: neon-flicker 2.6s ease-in-out infinite; }
  .theme-swatch[data-theme="rosegold"] .swatch-disc svg { animation: sparkle-twinkle 1.8s ease-in-out infinite; }
  .theme-swatch[data-theme="nixie"] .swatch-disc svg { animation: nixie-hum 3.1s ease-in-out infinite; filter: drop-shadow(0 0 4px #ff9a3c); }
}
@keyframes sparkle-twinkle {
  0%, 100% { opacity: 1; transform: scale(1) rotate(0deg); }
  50% { opacity: 0.6; transform: scale(0.85) rotate(8deg); }
}

/* ---------- period list ---------- */

.period-list {
  list-style: none; margin: 0 0 22px; padding: 0;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.period-list:last-child { margin-bottom: 0; }
.period-list li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 15px;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}
.period-list li:last-child { border-bottom: none; }
.period-list li.current { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.period-list li.current::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-right: 8px;
  transform: translateY(-1px);
}
.period-list .pname { display: flex; align-items: baseline; }
.period-list .ptime { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; flex-shrink: 0; margin-left: 12px; }
.pname-sub { color: var(--muted); font-size: 11px; margin-left: 6px; font-weight: 400; }

/* ---------- custom (dated) schedules ---------- */

.cs-list { margin-top: 12px; }
.cs-list .cs-empty { padding: 14px 15px; color: var(--muted); font-size: 13px; }
.cs-item { flex-direction: column; align-items: stretch; gap: 4px; }
.cs-item-head { display: flex; justify-content: space-between; align-items: baseline; width: 100%; }
.cs-item-name { font-weight: 600; }
.cs-item-date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cs-item-periods { color: var(--muted); font-size: 12px; }
.cs-item-delete { border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 0; align-self: flex-start; text-decoration: underline; }
.cs-item-delete:hover { color: var(--ink); }

.pill-ghost { border-color: var(--hairline); color: var(--muted); }
.pill-ghost:hover { color: var(--ink); }

.cs-add-form { margin-top: 14px; padding: 14px; border: 1px solid var(--hairline); border-radius: var(--radius-lg); background: var(--panel-2); }
.cs-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; font-size: 13px; }
.cs-field span { color: var(--muted); }
.cs-field input { padding: 9px 11px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 14px; }
.cs-period-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cs-period-row { display: flex; gap: 6px; align-items: center; }
.cs-period-row input[type="text"] { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 13px; }
.cs-period-row input[type="time"] { width: 110px; padding: 8px 10px; border: 1px solid var(--hairline); border-radius: 8px; background: var(--panel); color: var(--ink); font-size: 13px; }
.cs-period-row-remove { border: none; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }
.cs-period-row-remove:hover { color: var(--ink); }
.cs-form-actions { display: flex; gap: 10px; margin-top: 4px; }
.cs-form-error { color: #d33; }

/* ---------- my classes ---------- */

.classes-card {
  margin-top: 28px;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
}
.classes-card .muted { margin: 6px 0 0; }

.class-inputs {
  display: flex; flex-direction: column;
  margin-top: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--hairline);
}
.class-row {
  padding: 4px 4px 6px 14px;
  border-bottom: 1px solid var(--hairline);
}
.class-row:last-child { border-bottom: none; }
.class-row-main { display: flex; align-items: center; gap: 10px; }
.class-row-sub { display: flex; align-items: center; gap: 6px; padding-left: 102px; }
.class-row label { width: 92px; flex-shrink: 0; font-size: 13px; color: var(--muted); }
.class-row input {
  flex: 1; min-width: 0;
  background: transparent; border: none;
  padding: 11px 10px; color: var(--ink); font-size: 15px;
  font-family: inherit;
}
.class-row-sub input { padding: 5px 10px; font-size: 12px; color: var(--muted); }
.class-row-sub input:focus { color: var(--ink); }
.class-row-sub .room-input { flex: 0 0 76px; }
.class-row input:focus { outline: none; }
.class-row:focus-within { outline: 1px solid var(--accent); outline-offset: -1px; }
.class-row input::placeholder { color: var(--muted-2); }
@media (max-width: 480px) {
  .class-row-sub { padding-left: 0; }
}

.save-chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 12px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--good);
  color: var(--good);
  font-size: 12px; font-weight: 700;
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
}
.save-chip.show { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: no-preference) {
  .save-chip { transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out); }
}

/* ---------- planner ---------- */

.plan-card {
  margin-top: 12px;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.plan-text { color: var(--ink); font-size: 14px; line-height: 1.6; }
.plan-text h4 {
  margin: 14px 0 6px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent);
}
.plan-text h4:first-child { margin-top: 0; }
.plan-text p, .plan-text ul { margin: 6px 0; }
.plan-text ul { padding-left: 18px; }
.plan-text li { margin: 4px 0; }
.plan-text li::marker { color: var(--muted); }
.plan-text a { color: var(--accent); text-decoration: none; }
.plan-text a:hover { text-decoration: underline; }
.plan-text hr { border: none; border-top: 1px solid var(--hairline); margin: 12px 0; }
.plan-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.plan-updated { font-size: 11px; }

#plannerPanel .section-title { margin-top: 24px; }
.assignment-list { margin-top: 10px; }
.assignment-list li { flex-direction: column; align-items: stretch; gap: 2px; }
.assignment-title { font-size: 14px; color: var(--ink); }
.assignment-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }
.assignment-meta a { color: var(--accent); text-decoration: none; }
.assignment-meta a:hover { text-decoration: underline; }
.assignment-empty { padding: 14px 15px; font-size: 13px; color: var(--muted); }

/* ---------- setup note ---------- */

.setup-note {
  margin-top: 24px;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 13px; line-height: 1.55; color: var(--muted);
}
.setup-note strong { color: var(--ink); }

/* ---------- upload schedule ---------- */

.upload-label {
  display: flex; align-items: center; justify-content: center;
  margin-top: 12px; text-align: center; cursor: pointer;
}
.upload-status { min-height: 16px; margin-top: 6px; }

/* ============================================================
   MORE: toggles, timeline, milliseconds, class detail, custom theme
   ============================================================ */

/* burn-in drift: app.js nudges these a few px every minute when the option is on */
.clock-view { transform: translate(var(--dx, 0px), var(--dy, 0px)); }
@media (prefers-reduced-motion: no-preference) {
  .clock-view { transition: transform 3s ease-in-out; }
}

/* ---------- toggle rows ---------- */

.pref-list {
  display: flex; flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 10px;
}
.pref-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}
.pref-row:last-child { border-bottom: none; }
.pref-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pref-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.pref-hint { font-size: 12px; color: var(--muted); line-height: 1.4; }
.switch { position: relative; flex-shrink: 0; width: 46px; height: 28px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i {
  position: absolute; inset: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  pointer-events: none;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .switch i { transition: background 180ms var(--ease-out); }
  .switch i::after { transition: transform 200ms var(--ease-out); }
}
#testSoundBtn { margin-top: 12px; }

/* ---------- the room / note line under the class name ---------- */

.cv-detail {
  font-size: clamp(14px, min(2vw, 2.4vh), 22px); font-weight: 600;
  color: var(--muted);
  max-width: 88vw; overflow-wrap: anywhere;
  margin-top: -0.4em;
}
.cv-class-label { cursor: pointer; }

/* ---------- milliseconds ---------- */

.cv-board-row { display: flex; align-items: flex-end; gap: clamp(6px, 1vw, 12px); }
/* an invisible twin of the ms readout on the left keeps the board itself centered */
.cv-board-row:has(.cv-ms:not([hidden]))::before {
  content: ""; min-width: 2.4em;
  font-size: clamp(18px, min(4.6vw, 6vh), 64px);
}
.cv-ms {
  font-family: var(--hero-font);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: clamp(18px, min(4.6vw, 6vh), 64px);
  color: var(--muted);
  line-height: 1;
  padding-bottom: clamp(10px, min(1.6vw, 2.2vh), 26px);
  min-width: 2.4em;
  text-align: left;
}
.flap-board--urgent + .cv-ms { color: var(--urgent); }
.analog-countdown-row { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.cv-ms--analog { font-size: clamp(12px, 2vmin, 18px); padding-bottom: 0; min-width: 2.6em; }
:root[data-board="lcd"] .cv-ms { color: var(--ink); }

/* ---------- day timeline ---------- */

.day-timeline-wrap { width: min(86vw, 640px); display: flex; flex-direction: column; align-items: center; gap: 9px; }
.day-timeline {
  position: relative; width: 100%; height: 18px;
}
.day-seg {
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--ink) 11%, transparent);
  border-radius: 5px;
  font-size: 10px; font-weight: 700; color: var(--muted);
  overflow: hidden;
}
.day-seg.past { background: color-mix(in srgb, var(--ink) 28%, transparent); color: color-mix(in srgb, var(--ink) 70%, var(--bg)); }
.day-seg.current { background: var(--accent); color: var(--bg); box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 50%, transparent); }
.day-now {
  position: absolute; top: -5px; bottom: -5px; width: 2px;
  background: var(--ink);
  border-radius: 2px;
  transform: translateX(-1px);
  pointer-events: none;
}
.day-now::before {
  content: ""; position: absolute; top: -3px; left: -3px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink);
}
.day-stats { font-size: clamp(11px, 1.4vw, 14px); font-weight: 600; color: var(--muted); letter-spacing: 0.02em; text-align: center; }
@media (prefers-reduced-motion: no-preference) {
  .day-now { transition: left 1s linear; }
}

/* ---------- display modes ---------- */

body.focus-mode .cv-footer,
body.focus-mode .cv-detail { display: none !important; }
body.big-mode { --hero-scale: 1.18; }
body.night-dim .clock-view { filter: brightness(0.55); }
@media (prefers-reduced-motion: no-preference) {
  .clock-view { transition: transform 3s ease-in-out, filter 1.5s ease-in-out; }
}

/* blink in the last minute */
@media (prefers-reduced-motion: no-preference) {
  .flap-board--blink .flap-face, .analog-countdown-text.blink { animation: last-minute-blink 1s steps(1) infinite; }
}
@keyframes last-minute-blink { 50% { opacity: 0.25; } }

/* the 5-minute-warning screen flash */
.flash {
  position: fixed; inset: 0; z-index: 40; pointer-events: none;
  background: var(--accent); opacity: 0;
}
.flash.go { animation: screen-flash 900ms ease-out; }
@keyframes screen-flash {
  0% { opacity: 0; } 8% { opacity: 0.85; } 30% { opacity: 0; } 40% { opacity: 0.6; } 100% { opacity: 0; }
}

/* ---------- theme extras ---------- */

.surprise-btn { margin-bottom: 14px; }
.custom-theme { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 12px; }
.color-field, .select-field {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--muted);
}
.color-field input[type="color"] {
  width: 100%; height: 44px; padding: 0; border: 1px solid var(--hairline-strong); border-radius: 10px;
  background: var(--panel-2); cursor: pointer;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 4px; }
.color-field input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }
.select-field { grid-column: 1 / -1; }
.select-field select {
  height: 44px; padding: 0 12px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--hairline-strong); border-radius: 10px;
  font: inherit; font-size: 14px;
}
