/* spacedreamer's universe — one style for every page.
   pixel for the sky (Press Start 2P), Inter for reading, one palette: "horizon" (violet #9556EB → blue #1500FF).
   load: <link rel="stylesheet" href="/universe/universe.css">  — spec: docs/style.md */
@import url("fonts/fonts.css");

:root {
  color-scheme: dark;

  /* palette: horizon */
  --violet: #9556EB;
  --blue: #1500FF;
  --horizon: linear-gradient(90deg, var(--violet), var(--blue));              /* fills */
  --horizon-text: linear-gradient(90deg, #b48ef2 10%, #6a5cff 70%, #3d2bff); /* text: pure #1500FF is too dark to read */

  --void: #04030c;          /* page */
  --card: #0a0819;          /* raised surface */
  --accent: #17132e;        /* hover / secondary fill */
  --border: #211c3c;
  --text: #e8e4fb;
  --muted: #837ca8;
  --glow: #a98af7;          /* readable violet: links, cursor, live dots */
  --signal: #8f86ff;        /* readable blue: focus ring */
  --star: 180 160 255;      /* rgb triplet for the sky */
  --danger: #ff8fa3;

  /* shadcn names, so components read like shadcn */
  --background: var(--void);
  --foreground: var(--text);
  --primary: var(--horizon);
  --primary-foreground: #ffffff;
  --ring: var(--signal);
  --radius: 10px;

  /* type */
  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Press Start 2P is drawn on an 8px grid: keep sizes at multiples of 4 (crisp on 2x screens) */
  --px-xs: 12px; --px-sm: 16px; --px-md: 24px; --px-lg: 32px; --px-xl: 48px;

  --space: 8px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--background);
  color: var(--foreground);
  font: 400 16px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
body > main { flex: 1; }
a { color: var(--glow); text-decoration: none; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--violet); color: #fff; }

/* ---- pixel type ---- */
.u-pixel { font-family: var(--font-pixel); font-weight: 400; line-height: 1.5; letter-spacing: 0; -webkit-font-smoothing: none; }
.u-title { font: 400 clamp(var(--px-md), 7vw, var(--px-xl))/1.15 var(--font-pixel); margin: 0; -webkit-font-smoothing: none; }
.u-title.horizon, .u-horizon-text { display: inline-block; background: var(--horizon-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.u-h2 { font: 400 var(--px-sm)/1.5 var(--font-pixel); margin: 0 0 16px; -webkit-font-smoothing: none; }
.u-label { font: 400 var(--px-xs)/2 var(--font-pixel); color: var(--muted); margin: 0 0 8px; -webkit-font-smoothing: none; }
.u-cursor { color: var(--glow); -webkit-text-fill-color: var(--glow); animation: u-blink 1.2s steps(1) infinite; }
@keyframes u-blink { 50% { opacity: 0; } }
.u-lead { font-size: 18px; color: var(--text); margin: 16px 0 0; max-width: 40ch; }
.u-muted { color: var(--muted); }
.u-mono { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* ---- pixel nav: "> " marks the hovered link ---- */
.u-nav { display: flex; flex-wrap: wrap; gap: 8px 24px; font: 400 var(--px-xs)/2 var(--font-pixel); -webkit-font-smoothing: none; }
.u-nav a { color: var(--text); }
.u-nav a:hover, .u-nav a:focus-visible { color: var(--glow); }
.u-nav a:hover::before, .u-nav a:focus-visible::before { content: "> "; }

/* ---- sky: <canvas class="u-sky" data-moon></canvas> + sky.js ---- */
.u-sky { position: fixed; inset: 0 auto auto 0; width: 100%; z-index: -1; image-rendering: pixelated; pointer-events: none; }
.u-veil { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(140% 110% at 0% 100%, rgb(4 3 12 / .92) 0%, rgb(4 3 12 / .65) 40%, rgb(4 3 12 / 0) 75%); }

/* ---- layout ---- */
.u-page { width: min(100% - 48px, 960px); margin-inline: auto; padding-block: 64px 32px; }
.u-hero { min-height: 70dvh; display: flex; flex-direction: column; justify-content: flex-end; gap: 32px; padding: 48px max(24px, 6vw) 32px; }
/* one screen, text anchored bottom-left over the sky (spdrm.ru, error pages) */
.u-screen { display: flex; flex-direction: column; justify-content: flex-end; gap: 32px; max-width: 1040px;
  padding: max(48px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 8px max(24px, 6vw, env(safe-area-inset-left)); }
.u-text { margin: 0; max-width: 46ch; color: var(--muted); }
.u-text + .u-text { margin-top: 8px; }
.u-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.u-stack > * + * { margin-top: 16px; }

/* ---- components (shadcn anatomy) ---- */
.u-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.u-card > :first-child { margin-top: 0; } .u-card > :last-child { margin-bottom: 0; }
.u-card.signal { border-left: 3px solid var(--glow); }

.u-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border: 1px solid transparent; border-radius: calc(var(--radius) - 2px); cursor: pointer;
  font: 500 14px/1 var(--font-sans); color: var(--primary-foreground); background: var(--primary);
  transition: filter .15s var(--ease), background-color .15s var(--ease), transform .1s; }
.u-btn:hover { filter: brightness(1.15); color: var(--primary-foreground); }
.u-btn:active { transform: translateY(1px); }
.u-btn.secondary { background: var(--accent); color: var(--text); }
.u-btn.outline { background: transparent; border-color: var(--border); color: var(--text); }
.u-btn.outline:hover, .u-btn.ghost:hover { background: var(--accent); filter: none; }
.u-btn.ghost { background: transparent; color: var(--muted); }
.u-btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.u-btn:disabled { opacity: .5; cursor: not-allowed; }

.u-field { display: block; }
.u-field > span { display: block; font: 500 13px/1.4 var(--font-sans); margin-bottom: 6px; }
.u-input { width: 100%; height: 38px; padding: 0 12px; background: transparent; color: var(--text);
  border: 1px solid var(--border); border-radius: calc(var(--radius) - 2px); font: 400 14px var(--font-sans); }
.u-input::placeholder { color: var(--muted); }
.u-input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgb(143 134 255 / .3); }

.u-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  border: 1px solid var(--border); font: 500 12px/1 var(--font-sans); color: var(--text); }
.u-badge.live { background: var(--primary); border-color: transparent; color: #fff; }
.u-badge.quiet { color: var(--muted); }

.u-status { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.u-status li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--border); }
.u-status li:first-child { border-top: 0; }
.u-status .on { color: var(--glow); } .u-status .off { color: var(--muted); }

.u-switch { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--accent); position: relative; cursor: pointer; transition: background .15s; }
.u-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .15s var(--ease); }
.u-switch:checked { background: var(--primary); }
.u-switch:checked::after { transform: translateX(16px); }

.u-hr { height: 1px; border: 0; background: var(--border); margin: 32px 0; }

/* ---- signature: the last line of every page ---- */
.u-universe { margin: 0; padding: 32px max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, 6vw, env(safe-area-inset-left)); text-align: left;
  font: 400 11px/1.6 var(--font-mono); letter-spacing: .04em; color: var(--muted); }
.u-universe a { color: inherit; }
.u-universe a:hover { color: var(--glow); }

@media (prefers-reduced-motion: reduce) {
  .u-cursor { animation: none; }
  * { transition: none !important; }
}
