/* Cryptic Hub — base: tokens, the themes and type.
   Every colour is a token; a theme only redefines tokens, so no component
   knows which theme it is in. data-tone ("light" or "dark") is set beside
   data-theme for the few rules that differ by brightness.

   Indigo is the default: light pages and white cards beside a deep indigo
   side rail, with a violet accent. Glacier is light with blue; Meadow is warm
   light with a forest-green rail; Ocean is a soft slate dark with teal; Frost
   is the winter night. styles/surface.css, loaded after the screens, holds
   the shared surface rules and the motion. */

:root {
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r-xs: 6px; --r-sm: 8px; --r: 10px; --r-lg: 12px; --r-xl: 14px; --r-full: 999px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.77, 0, .175, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);
  --rail: 76px;
  --focus: 0 0 0 3px var(--ring);
}

/* What every light theme shares. */
:root, [data-tone="light"] {
  --accent-text: #fff;
  --mine-text: #fff;
  --theirs-text: var(--text);
  --danger: #d13b4c;
  --danger-soft: rgba(209, 59, 76, .09);
  --success: #15905a;
  --success-soft: rgba(21, 144, 90, .10);
  --warning: #b7791f;
  --info: #2563eb;
  --online: #16a34a;
  --shadow-sm: 0 1px 2px rgba(20, 24, 40, .06);
  --shadow: 0 4px 14px rgba(20, 24, 40, .07), 0 1px 3px rgba(20, 24, 40, .05);
  --shadow-lg: 0 18px 44px rgba(20, 24, 40, .14), 0 4px 12px rgba(20, 24, 40, .06);
  --code-bg: #141627;
  --code-text: #e7e8f2;
  /* Colour for things that aren't the accent: each kind of card and action. */
  --hue-blue: #2563eb; --hue-blue-bg: #e8f0fe;
  --hue-purple: #7c3aed; --hue-purple-bg: #f1ebff;
  --hue-orange: #d97706; --hue-orange-bg: #fff3e0;
  --hue-green: #16a34a; --hue-green-bg: #e6f6ec;
  --hue-teal: #0d9488; --hue-teal-bg: #e0f4f1;
  --hue-pink: #db2777; --hue-pink-bg: #fde8f1;
  --hue-sky: #0284c7; --hue-sky-bg: #e0f2fe;
  --hue-slate: #64748b; --hue-slate-bg: #eef1f5;
  color-scheme: light;
}

/* What every dark theme shares. */
[data-tone="dark"] {
  --accent-text: #fff;
  --mine-text: #fff;
  --theirs-text: var(--text);
  --danger: #f47c7c;
  --danger-soft: rgba(244, 124, 124, .13);
  --success: #3ccf91;
  --success-soft: rgba(60, 207, 145, .13);
  --warning: #f5bf4f;
  --info: #6cb4ff;
  --online: #3ccf91;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .28);
  --shadow: 0 4px 14px rgba(0, 0, 0, .3), 0 1px 3px rgba(0, 0, 0, .22);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, .45), 0 4px 12px rgba(0, 0, 0, .26);
  --hue-blue: #7ab0ff; --hue-blue-bg: rgba(76, 141, 255, .16);
  --hue-purple: #b69cff; --hue-purple-bg: rgba(155, 123, 255, .16);
  --hue-orange: #f5b950; --hue-orange-bg: rgba(245, 166, 35, .16);
  --hue-green: #5ad69a; --hue-green-bg: rgba(52, 199, 123, .16);
  --hue-teal: #4fd1c5; --hue-teal-bg: rgba(45, 212, 191, .14);
  --hue-pink: #f38bb8; --hue-pink-bg: rgba(236, 72, 153, .15);
  --hue-sky: #6cc4f5; --hue-sky-bg: rgba(56, 189, 248, .15);
  --hue-slate: #9aa7ba; --hue-slate-bg: rgba(154, 167, 186, .14);
  color-scheme: dark;
}

/* Indigo — the default. */
:root, [data-theme="indigo"] {
  --bg: #f6f6fb;
  --surface: #ffffff;
  --surface-2: #f3f3f9;
  --surface-3: #e8e8f2;
  --hover: rgba(30, 27, 75, .045);
  --press: rgba(30, 27, 75, .08);
  --border: rgba(30, 27, 75, .09);
  --border-strong: rgba(30, 27, 75, .16);
  --text: #16152b;
  --text-2: #4c4b66;
  --text-3: #83829c;
  --accent: #5b4cf0;
  --accent-2: #4b3cd6;
  --accent-soft: rgba(91, 76, 240, .09);
  --mine: #5b4cf0;
  --theirs: #efeff6;
  --overlay: rgba(22, 21, 43, .42);
  --ring: rgba(91, 76, 240, .28);
  --hero-1: #e4e0ff;
  --hero-2: #f8f7ff;
  --rail-bg: #2b2177; --rail-brd: transparent; --rail-fg: rgba(255, 255, 255, .66); --rail-fg-on: #fff;
  --rail-hover: rgba(255, 255, 255, .09); --rail-on: rgba(255, 255, 255, .15); --rail-icon-on: #fff; --rail-bar: #b3a8ff;
}

/* Glacier — light and clean, blue. */
[data-theme="glacier"] {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f1f4f8;
  --surface-3: #e6ebf2;
  --hover: rgba(16, 30, 54, .04);
  --press: rgba(16, 30, 54, .08);
  --border: rgba(16, 30, 54, .09);
  --border-strong: rgba(16, 30, 54, .16);
  --text: #111b2b;
  --text-2: #4a586c;
  --text-3: #7f8ca0;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, .08);
  --mine: #2563eb;
  --theirs: #eef2f8;
  --overlay: rgba(14, 26, 43, .40);
  --ring: rgba(37, 99, 235, .25);
  --hero-1: #dbe8fb;
  --hero-2: #f4f8fd;
  --rail-bg: #ffffff; --rail-brd: var(--border); --rail-fg: #66748a; --rail-fg-on: #111b2b;
  --rail-hover: rgba(16, 30, 54, .05); --rail-on: rgba(37, 99, 235, .09); --rail-icon-on: #2563eb; --rail-bar: #2563eb;
}

/* Meadow — warm light, forest green. */
[data-theme="meadow"] {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --surface-3: #e9e6df;
  --hover: rgba(40, 35, 20, .045);
  --press: rgba(40, 35, 20, .08);
  --border: rgba(40, 35, 20, .10);
  --border-strong: rgba(40, 35, 20, .17);
  --text: #1d1c18;
  --text-2: #55524a;
  --text-3: #88847a;
  --accent: #2f7d57;
  --accent-2: #256647;
  --accent-soft: rgba(47, 125, 87, .10);
  --mine: #2f7d57;
  --theirs: #f0eee8;
  --overlay: rgba(29, 28, 24, .40);
  --ring: rgba(47, 125, 87, .26);
  --hero-1: #dfeee3;
  --hero-2: #faf8f3;
  --rail-bg: #1f3a2c; --rail-brd: transparent; --rail-fg: rgba(255, 255, 255, .66); --rail-fg-on: #fff;
  --rail-hover: rgba(255, 255, 255, .08); --rail-on: rgba(255, 255, 255, .14); --rail-icon-on: #fff; --rail-bar: #9fe0b9;
}

/* Ocean — a soft slate dark (not black), teal. */
[data-theme="ocean"] {
  --bg: #1b2230;
  --surface: #222b3b;
  --surface-2: #283244;
  --surface-3: #313c50;
  --hover: rgba(190, 210, 235, .06);
  --press: rgba(190, 210, 235, .10);
  --border: rgba(190, 210, 235, .11);
  --border-strong: rgba(190, 210, 235, .20);
  --text: #eef2f7;
  --text-2: #aab5c5;
  --text-3: #7f8a9b;
  --accent: #2bb3a8;
  --accent-2: #4fd1c5;
  --accent-soft: rgba(43, 179, 168, .16);
  --accent-text: #04201d;
  --mine: #1f8f86;
  --theirs: var(--surface-2);
  --overlay: rgba(8, 12, 20, .60);
  --ring: rgba(43, 179, 168, .38);
  --code-bg: #141a25;
  --code-text: #e2eaf3;
  --hero-1: #21404a;
  --hero-2: #1f2838;
  --rail-bg: #171d29; --rail-brd: var(--border); --rail-fg: #8c97a8; --rail-fg-on: #eef2f7;
  --rail-hover: rgba(190, 210, 235, .06); --rail-on: rgba(43, 179, 168, .16); --rail-icon-on: #4fd1c5; --rail-bar: #2bb3a8;
}

/* Holly — winter and Christmas: a pine-green night, warm snow-white text, a
   cranberry accent and gold. Brings string lights, a Christmas scene and a
   countdown to Christmas with it (see home.js). */
[data-theme="holly"] {
  --bg: #0f1d18;
  --surface: #162a22;
  --surface-2: #1c3229;
  --surface-3: #243d33;
  --hover: rgba(220, 240, 225, .05);
  --press: rgba(220, 240, 225, .09);
  --border: rgba(200, 230, 215, .11);
  --border-strong: rgba(200, 230, 215, .20);
  --text: #f4efe4;
  --text-2: #bac4b9;
  --text-3: #8e9c91;
  --accent: #d9434f;
  --accent-2: #f2868f;
  --accent-soft: rgba(217, 67, 79, .16);
  --accent-text: #fff;
  --gold: #e8c26a;
  --mine: #b8323f;
  --theirs: var(--surface-2);
  --overlay: rgba(5, 12, 9, .62);
  --ring: rgba(217, 67, 79, .4);
  --code-bg: #0b1612;
  --code-text: #ede8dc;
  --hero-1: #3b1a20;
  --hero-2: #13251e;
  --rail-bg: #0b1612; --rail-brd: var(--border); --rail-fg: #8e9c91; --rail-fg-on: #f4efe4;
  --rail-hover: rgba(220, 240, 225, .06); --rail-on: rgba(232, 194, 106, .14); --rail-icon-on: #e8c26a; --rail-bar: #e8c26a;
}
/* Small text links read better in the lighter cranberry. */
[data-theme="holly"] a { color: var(--accent-2); }
[data-theme="holly"] .winter-badge { color: #f6dc9c; background: rgba(232, 194, 106, .14); border-color: rgba(232, 194, 106, .32); }
[data-theme="holly"] .winter-card .hc-count b { color: var(--gold); }

/* Frost — the winter night. */
[data-theme="frost"] {
  --bg: #0a1220;
  --surface: #101a2c;
  --surface-2: #152137;
  --surface-3: #1c2a43;
  --hover: rgba(150, 185, 235, .06);
  --press: rgba(150, 185, 235, .10);
  --border: rgba(140, 170, 215, .13);
  --border-strong: rgba(140, 170, 215, .24);
  --text: #e8eef8;
  --text-2: #a4b3c9;
  --text-3: #6f8099;
  --accent: #4c9dff;
  --accent-2: #7db8ff;
  --accent-soft: rgba(76, 157, 255, .14);
  --mine: #2f7de0;
  --theirs: var(--surface-2);
  --overlay: rgba(4, 8, 16, .66);
  --ring: rgba(76, 157, 255, .38);
  --code-bg: #070d18;
  --code-text: #e2eaf6;
  --hero-1: #0f2340;
  --hero-2: #0b1628;
  --rail-bg: var(--surface); --rail-brd: var(--border); --rail-fg: #6f8099; --rail-fg-on: #e8eef8;
  --rail-hover: rgba(150, 185, 235, .06); --rail-on: rgba(76, 157, 255, .14); --rail-icon-on: #4c9dff; --rail-bar: #4c9dff;
}


/* Galaxy: the default. Deep space navy, violet and blue, made for the Galaxy
   scene behind it (app/lib/cosmos.js); with the scene on, backdrop.css turns
   the panels to violet-tinted glass. */
[data-theme="cosmic"] {
  --font-display: "Sora", var(--font);
  --bg: #02040a;
  --surface: #0f0f2a;
  --surface-2: #161639;
  --surface-3: #1f1f4b;
  --hover: rgba(190, 175, 255, .07);
  --press: rgba(190, 175, 255, .12);
  --border: rgba(190, 175, 255, .13);
  --border-strong: rgba(190, 175, 255, .24);
  --text: #f1f0ff;
  --text-2: #c2bfe6;
  --text-3: #8f8bbd;
  --accent: #8b7bff;
  --accent-2: #b3a6ff;
  --accent-soft: rgba(139, 123, 255, .18);
  --accent-text: #fff;
  --mine: #6c55f5;
  --theirs: var(--surface-2);
  --overlay: rgba(3, 3, 14, .66);
  --ring: rgba(139, 123, 255, .45);
  --code-bg: #070818;
  --code-text: #e6e8ff;
  --hero-1: #2a1f6e;
  --hero-2: #0d0f2a;
  --rail-bg: #0a0a20; --rail-brd: var(--border); --rail-fg: #8f8bbd; --rail-fg-on: #fff;
  --rail-hover: rgba(190, 175, 255, .08); --rail-on: rgba(139, 123, 255, .22); --rail-icon-on: #c9beff; --rail-bar: #8b7bff;
  --grad: linear-gradient(100deg, #7c5cff 0%, #4f7cff 55%, #38bdf8 100%);
}

/* The old glass tokens, kept so every screen's stylesheet still resolves —
   now they're plain surfaces. */
:root, [data-theme] {
  --glass: var(--surface);
  --glass-2: var(--surface);
  --glass-3: var(--surface);
  --glass-strong: var(--surface);
  --glass-brd: var(--border);
  --glass-blur: 0px;
  --edge: none;
  --inner: 0 0 0 0 transparent;
  --glare: transparent;
  --glow: 0 0 0 0 transparent;
  --sheen: none;
  --mesh-1: transparent; --mesh-2: transparent; --mesh-3: transparent; --mesh-4: transparent;
  --grain-o: 0;
}

.glass { background: var(--surface); }
.glass-soft { background: var(--surface-2); }
.sheen { position: relative; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes shimmerText { 0% { background-position: -140% 0; } 100% { background-position: 240% 0; } }

.grad-text { color: var(--text); }
/* The diamond logo, drawn by CSS so every ◆ in the markup becomes it. */
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; border-radius: 9px; background: #0d0c28 url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2064%2064%22%3E%3Cdefs%3E%3ClinearGradient%20id%3D%22g%22%20x1%3D%228%22%20y1%3D%226%22%20x2%3D%2256%22%20y2%3D%2258%22%20gradientUnits%3D%22userSpaceOnUse%22%3E%3Cstop%20offset%3D%220%22%20stop-color%3D%22%23e2dbff%22%2F%3E%3Cstop%20offset%3D%22.4%22%20stop-color%3D%22%239b86ff%22%2F%3E%3Cstop%20offset%3D%22.75%22%20stop-color%3D%22%235b7cff%22%2F%3E%3Cstop%20offset%3D%221%22%20stop-color%3D%22%234cc9ff%22%2F%3E%3C%2FlinearGradient%3E%3C%2Fdefs%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22url%28%23g%29%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M32%206%20L58%2032%20L32%2058%20L6%2032%20Z%22%20stroke-width%3D%224%22%2F%3E%3Cpath%20d%3D%22M32%2017%20L47%2032%20L32%2047%20L17%2032%20Z%22%20stroke-width%3D%222.6%22%2F%3E%3Cpath%20d%3D%22M32%206V17M58%2032H47M32%2058V47M6%2032H17%22%20stroke-width%3D%221.8%22%20opacity%3D%22.7%22%2F%3E%3C%2Fg%3E%3Ccircle%20cx%3D%2232%22%20cy%3D%2232%22%20r%3D%224.6%22%20fill%3D%22%23d9d0ff%22%2F%3E%3C%2Fsvg%3E") center / 74% no-repeat; color: transparent !important; font-size: 0 !important; display: grid; place-items: center; box-shadow: 0 0 0 1px rgba(160, 145, 255, .28), 0 4px 18px rgba(124, 92, 255, .35); line-height: 1; overflow: hidden; }
.wordmark { font-family: var(--font); font-size: 17px; letter-spacing: -.02em; white-space: nowrap; font-weight: 650; }

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, video { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
::selection { background: var(--accent-soft); }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Scrollbars that don't shout */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---- Type ------------------------------------------------------------------- */
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
.h1 { font-family: var(--font); font-size: 28px; font-weight: 650; letter-spacing: -.025em; line-height: 1.2; }
.h2 { font-family: var(--font); font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.h3 { font-size: 15px; font-weight: 600; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.mono { font-family: var(--font-mono); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.center { display: grid; place-items: center; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.divider { height: 1px; background: var(--border); margin: 8px 0; border: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Phones zoom the page into any text box under 16px and stay zoomed; keep
   every field at 16px on touch screens so tapping one never shifts the page. */
@media (hover: none) and (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
}
html, body { overflow-x: clip; }

/* Font and corner choices (Settings, Appearance) */
html[data-font="sora"] { --font: "Sora", ui-sans-serif, system-ui, sans-serif; }
html[data-font="system"] { --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
html[data-font="serif"] { --font: ui-serif, Georgia, "Times New Roman", serif; }
html[data-font="mono"] { --font: var(--font-mono); }
html[data-corners="sharp"] { --r-xs: 2px; --r-sm: 3px; --r: 4px; --r-lg: 5px; --r-xl: 6px; }
html[data-corners="round"] { --r-xs: 9px; --r-sm: 12px; --r: 15px; --r-lg: 18px; --r-xl: 22px; }
