/* Exedra design system: "Phosphor".
   A retro terminal OS: amber phosphor on a warm black CRT, pixel-font labels, box-drawn panels
   with hard offset shadows, bracketed controls, a menu bar, a directory-tree sidebar and a
   vim-style status line. A "paper" light theme reads like a dot-matrix printout.
   Colors and sizes come from style properties (/styles/{id}/vars.css); this file maps them onto
   design tokens. Feature stylesheets use the same tokens. */

/* `hidden` always wins: a class that sets `display` (e.g. .notice) must not reveal an element
   that scripts keep hidden until needed, like the empty passkey error box on the login page. */
[hidden] { display: none !important; }

/* ============================================================
   Fonts (self-hosted, SIL Open Font License: static/fonts/*-OFL.txt)
   ============================================================ */
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("../fonts/silkscreen-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("../fonts/silkscreen-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "VT323"; src: url("../fonts/vt323-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }

/* ============================================================
   Tokens
   ============================================================ */
:root {
  --background: var(--page-bg);
  --foreground: var(--text);
  --card: var(--surface);
  --muted: var(--surface-alt);
  --muted-foreground: var(--text-muted);
  --input: var(--border);
  --ring: var(--accent);
  --accent-fg: var(--page-bg);
  --accent-2: #e2531f;
  --accent-3: #9a4a06;
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-softer: color-mix(in srgb, var(--accent) 7%, transparent);
  --accent-dim: color-mix(in srgb, var(--accent) 45%, var(--background));
  --border-soft: color-mix(in srgb, var(--border) 65%, transparent);
  --line: var(--border);
  --hover: color-mix(in srgb, var(--accent) 10%, transparent);
  --active: color-mix(in srgb, var(--accent) 18%, transparent);
  --sidebar-bg: color-mix(in srgb, var(--card) 70%, var(--background));
  --input-bg: color-mix(in srgb, var(--background) 60%, var(--card));
  --destructive: #d23b2b;
  --destructive-foreground: #fff8ec;
  --danger: var(--destructive);
  --success: #4f8a1c;
  --warning: #b97a00;
  --unread: var(--accent);
  --code-bg: var(--input-bg);
  --quote-bg: color-mix(in srgb, var(--accent) 5%, var(--card));
  --glow: none;
  --glow-strong: none;
  --hard-shadow: 5px 5px 0 var(--accent-2);
  --hard-shadow-sm: 3px 3px 0 var(--accent-2);
  --radius-sm: 0px; --radius-md: 0px; --radius-lg: 0px; --radius-xl: 0px; --radius-2xl: 0px;
  --shadow-xs: none;
  --shadow: none;
  --shadow-md: 0 0 0 1px var(--line), 0 12px 30px -10px rgb(0 0 0 / .3);
  --shadow-lg: 0 18px 50px -12px rgb(0 0 0 / .45);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur-fast: 90ms;
  --dur: 160ms;
  --dur-slow: 280ms;
  --header-h: 44px;
  --status-h: 26px;
  --sidebar-w: 260px;
  --gap: 16px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "DejaVu Sans Mono", ui-monospace, monospace;
  --pixel: "Silkscreen", "JetBrains Mono", ui-monospace, monospace;
  --display: "VT323", "JetBrains Mono", ui-monospace, monospace;
  --scanlines: .12;
  color-scheme: light;
}

/* CRT (dark) palette: amber phosphor on warm black. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page-bg: #0d0a06; --surface: #15100a; --surface-alt: #1e170e; --border: #4a3519;
    --text: #f0d9ad; --text-muted: #a08458; --primary: #ffa31a; --primary-contrast: #0d0a06;
    --link: #ffb84d; --accent: #ffa31a; --accent-3: #f6d58a;
    --c-admin: #ff6b4a; --c-mod: #9fd36b; --c-supporter: #ffd166;
    --destructive: #ff5a4a; --destructive-foreground: #120a05; --success: #9fd36b; --warning: #ffc23d;
    --glow: 0 0 6px color-mix(in srgb, var(--accent) 55%, transparent);
    --glow-strong: 0 0 2px color-mix(in srgb, var(--accent) 80%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
    --shadow-md: 0 0 0 1px var(--line), 0 12px 30px -10px rgb(0 0 0 / .5);
    --shadow-lg: 0 18px 50px -12px rgb(0 0 0 / .7);
    --scanlines: .55;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --page-bg: #0d0a06; --surface: #15100a; --surface-alt: #1e170e; --border: #4a3519;
  --text: #f0d9ad; --text-muted: #a08458; --primary: #ffa31a; --primary-contrast: #0d0a06;
  --link: #ffb84d; --accent: #ffa31a; --accent-3: #f6d58a;
  --c-admin: #ff6b4a; --c-mod: #9fd36b; --c-supporter: #ffd166;
  --destructive: #ff5a4a; --destructive-foreground: #120a05; --success: #9fd36b; --warning: #ffc23d;
  --glow: 0 0 6px color-mix(in srgb, var(--accent) 55%, transparent);
  --glow-strong: 0 0 2px color-mix(in srgb, var(--accent) 80%, transparent), 0 0 14px color-mix(in srgb, var(--accent) 45%, transparent);
  --shadow-md: 0 0 0 1px var(--line), 0 12px 30px -10px rgb(0 0 0 / .5);
  --shadow-lg: 0 18px 50px -12px rgb(0 0 0 / .7);
  --scanlines: .55;
  color-scheme: dark;
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; border-color: var(--line); }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 24px); scroll-behavior: smooth; background: var(--background); }
body {
  margin: 0;
  font-family: var(--font-family, var(--mono));
  font-size: var(--font-size);
  line-height: 1.6;
  color: var(--foreground);
  background:
    radial-gradient(ellipse 120% 80% at 50% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%),
    var(--background);
  background-attachment: fixed;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-ligatures: none;
  caret-color: var(--accent);
}
/* CRT scanlines and vignette over everything (purely decorative, never intercepts input). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: var(--scanlines);
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 2px, rgb(0 0 0 / .22) 3px, transparent 4px);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  background: radial-gradient(ellipse 140% 110% at 50% 50%, transparent 62%, rgb(0 0 0 / .45) 100%);
  opacity: calc(var(--scanlines) * 1.4);
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 8px; font-weight: 700; letter-spacing: 0; }
h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2.1rem, 3vw + 1rem, 3rem); line-height: 1; color: var(--accent-3); text-shadow: var(--glow); text-transform: uppercase; letter-spacing: .02em; }
h2 { font-size: 1rem; }
h3 { font-size: .95rem; }
p { margin: 0 0 10px; }
hr { border: 0; border-top: 1px dashed var(--line); margin: 16px 0; }
code, kbd, pre { font-family: var(--mono); }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  font-family: var(--pixel); font-size: .62rem; color: var(--accent); background: transparent;
  border: 1px solid var(--accent-dim); line-height: 1; text-transform: uppercase;
}
::selection { background: var(--accent); color: var(--background); }
:focus-visible { outline: 1px dashed var(--accent); outline-offset: 3px; }
.icon { flex-shrink: 0; vertical-align: middle; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.inline-form { display: inline; }
.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; }
.skip-link { position: fixed; left: 16px; top: 8px; z-index: 10000; padding: 8px 14px; background: var(--accent); color: var(--background); font-family: var(--pixel); transform: translateY(-200%); }
.skip-link:focus { transform: none; }
.p-body:focus { outline: none; }
:where(h1, h2, h3, [id]) { scroll-margin-top: calc(var(--header-h) + 24px); }
button, summary, .button { touch-action: manipulation; }
button.linkish { background: none; border: 0; font: inherit; cursor: pointer; padding: 0; color: var(--link); text-decoration: underline dashed; text-underline-offset: 4px; }
* { scrollbar-width: thin; scrollbar-color: var(--accent-dim) transparent; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   Page transitions: a fast scan-in, like a CRT redraw
   ============================================================ */
/* Cross-document transitions are enabled only where they have proven stable: Chromium-based
   browsers (the base-select test below is a Chromium-only feature). WebKit (Safari, every iOS
   browser) crashed in testing when a cached page script and a page transition coincided, so
   it navigates without the effect. Firefox does not support them yet. */
@supports (appearance: base-select) { @view-transition { navigation: auto; } }
.sidebar { view-transition-name: sidebar; }
.topbar { view-transition-name: topbar; }
.statusline { view-transition-name: statusline; }
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: crt-scan 240ms steps(12, end) both; }
::view-transition-group(sidebar), ::view-transition-group(topbar), ::view-transition-group(statusline) { animation-duration: 0s; }
@keyframes crt-scan { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }

.nav-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 300; pointer-events: none;
  background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 13px);
  transform-origin: 0 50%; transform: scaleX(0); opacity: 0; box-shadow: var(--glow);
}
.nav-progress.is-loading { opacity: 1; animation: nav-progress 8s steps(40) forwards; }
@keyframes nav-progress { 0% { transform: scaleX(0); } 8% { transform: scaleX(.4); } 100% { transform: scaleX(.94); } }

/* ============================================================
   App shell: sidebar ("directory tree") + main column
   ============================================================ */
.sidebar {
  position: fixed; top: 0; bottom: var(--status-h); left: 0; z-index: 80; width: var(--sidebar-w);
  display: flex; flex-direction: column; gap: 4px; padding: 0 0 10px;
  background: var(--sidebar-bg); border-right: 1px solid var(--line);
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  transition: width var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: var(--header-h); padding: 0 8px 0 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.p-logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--pixel); font-weight: 700; font-size: .95rem; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); white-space: nowrap; min-width: 0; text-shadow: var(--glow); }
.p-logo:hover { color: var(--accent-3); }
.p-logo img { max-height: 28px; vertical-align: middle; }
.p-logo-text { overflow: hidden; text-overflow: ellipsis; }
.p-logo-mark {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px;
  background: var(--accent); color: var(--background); font-family: var(--pixel); font-size: .85rem; font-weight: 700; text-transform: uppercase;
  box-shadow: 2px 2px 0 var(--accent-2); text-shadow: none;
}
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 12px 8px 0; }
.side-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.side-links ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 10px; width: 100%; height: 30px; padding: 0 8px;
  color: var(--foreground); font: inherit; font-size: .86rem; background: none; border: 0; cursor: pointer; text-align: left; white-space: nowrap;
}
.side-link > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.side-link .icon { color: var(--muted-foreground); width: 15px; height: 15px; }
.side-link:hover { background: var(--hover); color: var(--accent); }
.side-link:hover .icon { color: var(--accent); }
.side-link.is-active { background: var(--accent); color: var(--background); font-weight: 700; }
.side-link.is-active .icon { color: var(--background); }
.side-link.is-active::after { content: "◄"; margin-left: auto; font-size: .7rem; }
.side-section { display: flex; flex-direction: column; gap: 2px; }
.side-heading { display: flex; align-items: center; gap: 8px; padding: 4px 8px 6px; font-family: var(--pixel); font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.side-heading::before { content: "~/"; color: var(--muted-foreground); }
.side-heading::after { content: ""; flex: 1; border-top: 1px dashed var(--line); }
.side-group { margin-top: 6px; }
.side-group:first-child { margin-top: 0; }
.side-group-title { display: block; padding: 2px 8px; font-size: .8rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-group-title::before { content: "▾ "; color: var(--accent); }
.side-group-title:hover { color: var(--accent); }
.side-group > ul > li > .side-space::before { content: "├─"; color: var(--accent-dim); margin-right: -4px; }
.side-group > ul > li:last-child > .side-space::before { content: "└─"; }
.side-space .space-glyph { display: none; }
.side-space.is-active::before { color: var(--background); }
.space-glyph {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px;
  font-family: var(--pixel); font-size: .72rem; font-weight: 700; text-transform: uppercase;
  color: var(--accent); background: transparent; border: 1px solid var(--accent-dim);
}
.sidebar-foot { display: flex; flex-direction: column; padding: 8px 8px 0; border-top: 1px dashed var(--line); }
.sidebar-scrim { display: none; }

.shell-main { margin-left: var(--sidebar-w); min-height: 100vh; min-height: 100dvh; min-width: 0; display: flex; flex-direction: column; padding-bottom: var(--status-h); transition: margin-left var(--dur-slow) var(--ease-out); }

/* Collapsed rail (desktop) */
.shell.is-rail { --sidebar-w: 52px; }
.is-rail .sidebar-head { padding: 0; justify-content: center; }
.is-rail .sidebar-head .p-logo { display: none; }
.is-rail .p-logo-text, .is-rail .side-link > span:last-child, .is-rail .side-heading, .is-rail .side-group-title, .is-rail .side-link.is-active::after { display: none; }
.is-rail .sidebar-nav { padding: 10px 6px 0; }
.is-rail .sidebar-foot { padding: 8px 6px 0; }
.is-rail .side-link { justify-content: center; padding: 0; }
.is-rail .side-group > ul > li > .side-space::before { content: none; }
.is-rail .side-space .space-glyph { display: inline-grid; }
.is-rail .side-space.is-active .space-glyph { color: var(--background); border-color: var(--background); }
.is-rail .sidebar-collapse .icon { transform: scaleX(-1); }

/* ============================================================
   Top bar (menu bar)
   ============================================================ */
.topbar { position: sticky; top: 0; z-index: 60; background: color-mix(in srgb, var(--card) 92%, transparent); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.topbar-inner { display: flex; align-items: center; gap: 10px; height: var(--header-h); padding: 0 12px 0 16px; }
.topbar .topbar-menu, .topbar .topbar-logo { display: none; }
.topbar-search { position: relative; flex: 1; max-width: 560px; min-width: 0; display: flex; align-items: center; }
.topbar-spacer { flex: 1; }
.topbar-search-icon { display: none; }
.topbar-search::before { content: "exedra:~$"; position: absolute; left: 10px; color: var(--accent); font-size: .82rem; pointer-events: none; text-shadow: var(--glow); }
.topbar-search-input {
  width: 100%; height: 30px; padding: 0 70px 0 92px; border: 1px solid var(--line); background: var(--input-bg); color: var(--foreground);
  font: inherit; font-size: .82rem; cursor: text; transition: border-color var(--dur);
}
.topbar-search-input::placeholder { color: var(--muted-foreground); }
.topbar-search-input:hover, .topbar-search-input:focus { outline: none; border-color: var(--accent); }
.topbar-search-input::-webkit-search-cancel-button { display: none; }
.topbar-search-kbd { position: absolute; right: 6px; pointer-events: none; }
.topbar-clock { font-family: var(--pixel); font-size: .68rem; color: var(--muted-foreground); letter-spacing: .06em; white-space: nowrap; padding: 0 6px; }
.p-nav-user { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0 0 0 auto; padding: 0; flex-shrink: 0; }
.p-nav-user > li > a:not(.button), .p-nav-user > li > .dropdown > summary > a, .p-nav-user > li > button, .icon-button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; min-width: 32px; padding: 0 7px;
  color: var(--muted-foreground); background: none; border: 1px solid transparent; font: inherit; cursor: pointer;
}
.p-nav-user > li > a:not(.button):hover, .p-nav-user > li > button:hover, .icon-button:hover { color: var(--accent); border-color: var(--accent-dim); }
.p-nav-user .nav-label { display: none; }
.account-menu-trigger { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 32px; height: 32px; padding: 0 4px; color: var(--muted-foreground); border: 1px solid transparent; }
.account-menu-trigger:hover, .dropdown[open] > summary .account-menu-trigger { color: var(--accent); border-color: var(--accent-dim); }
.create-trigger { margin-right: 6px; }
.kbd-hint { margin-left: auto; }
.badge-count {
  display: inline-grid; place-items: center; min-width: 16px; height: 16px; padding: 0 3px;
  background: var(--accent-2); color: #fff; font-family: var(--pixel); font-size: .58rem; line-height: 1; font-variant-numeric: tabular-nums;
  animation: blink 1s steps(1) 3;
}
.p-nav-user .badge-count { position: absolute; top: 0; right: -2px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme]) .theme-toggle .icon-moon { display: inline; }
}

/* ============================================================
   Main column, footer and status line
   ============================================================ */
.p-body, .p-footer-inner { width: 100%; max-width: calc(var(--max-width) + 48px); margin: 0 auto; padding: 0 24px; }
.p-body { flex: 1; min-width: 0; padding-top: 14px; padding-bottom: 56px; overflow-wrap: anywhere; }
.p-footer { color: var(--muted-foreground); font-size: .76rem; border-top: 1px dashed var(--line); }
.p-footer-inner { display: flex; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.p-footer a { color: var(--muted-foreground); }
.p-footer a:hover { color: var(--accent); }
.statusline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 85; height: var(--status-h); display: flex; align-items: stretch;
  background: var(--card); border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden;
}
.statusline > span { display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-right: 1px solid var(--line); }
.statusline .status-mode { background: var(--accent); color: var(--background); font-family: var(--pixel); font-size: .62rem; letter-spacing: .08em; border-right: 0; }
.statusline .status-mode.is-insert { background: var(--success); }
.statusline .status-path { color: var(--foreground); overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; display: inline-block; line-height: var(--status-h); }
.statusline .status-fill { flex: 1; border-right: 0; }
.statusline .status-right { border-right: 0; border-left: 1px solid var(--line); }
.statusline .status-ok::before { content: "●"; color: var(--success); text-shadow: 0 0 6px var(--success); }

/* ---------- Breadcrumbs & page headers ---------- */
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; list-style: none; padding: 0; margin: 0 0 14px; font-size: .78rem; color: var(--muted-foreground); }
.breadcrumbs li { display: inline-flex; align-items: center; gap: 2px; }
.breadcrumbs a { display: inline-flex; align-items: center; padding: 1px 4px; color: var(--muted-foreground); }
.breadcrumbs a:hover { color: var(--accent); background: var(--hover); }
.breadcrumbs li:first-child a::before { content: "~"; }
.breadcrumbs li:first-child .icon { display: none; }
.breadcrumbs li:last-child a { color: var(--accent); }
.breadcrumbs li:not(:last-child)::after { content: "/"; color: var(--accent-dim); }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px 24px; margin: 4px 0 22px; padding-bottom: 14px; border-bottom: 1px dashed var(--line); flex-wrap: wrap; }
.page-header > div:first-child { min-width: 0; flex: 1 1 360px; }
.page-header h1 { margin-bottom: 4px; }
.page-header h1::after { content: ""; display: inline-block; width: .45em; height: .8em; margin-left: .2em; vertical-align: baseline; background: var(--accent); animation: blink 1.1s steps(1) infinite; box-shadow: var(--glow); }
.page-header .description { color: var(--muted-foreground); margin: 6px 0 0; font-size: .9rem; max-width: 72ch; }
.page-header .description::before { content: "> "; color: var(--accent); }
.page-header-meta { color: var(--muted-foreground); font-size: .8rem; display: flex; gap: 4px 16px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.page-header-meta > span { display: inline-flex; align-items: center; gap: 6px; }

/* ============================================================
   Panels ("blocks")
   ============================================================ */
.block { position: relative; background: var(--card); color: var(--foreground); border: 1px solid var(--line); margin-bottom: 18px; }
.block-header {
  position: relative; display: flex; justify-content: flex-start; align-items: center; gap: 8px; margin: 0; padding: 7px 12px;
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 6%, var(--card));
  font-family: var(--pixel); font-weight: 400; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent);
}
.block-header::before { content: "■"; margin-right: 2px; font-family: var(--mono); font-size: .7rem; }
.block-header > :last-child:not(:first-child) { margin-left: auto; }
h1.block-header { font-size: .8rem; text-shadow: none; line-height: 1.4; }
.block-header a { color: inherit; }
.block-header a:hover { color: var(--accent-3); }
.block-header h2 { font-size: inherit; margin: 0; font-weight: inherit; }
.block-header--primary { font-size: .78rem; }
.block-header .description { font-family: var(--mono); letter-spacing: 0; text-transform: none; font-size: .78rem; color: var(--muted-foreground); }
.block-header .muted { font-family: var(--mono); letter-spacing: 0; }
.block-body { padding: 16px; }
.block-body--flush { padding: 0; }
.block-footer { padding: 10px 14px; border-top: 1px dashed var(--line); display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.block-row { padding: 12px 16px; border-bottom: 1px dashed var(--line); }
.block-row:last-child { border-bottom: 0; }
.block-row--alt { background: var(--accent-softer); }
/* Corner tick on the top-right of each panel */
.block::after { content: ""; position: absolute; top: -1px; right: -1px; width: 8px; height: 8px; border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); pointer-events: none; }

/* ============================================================
   Home: boot-screen hero, spaces
   ============================================================ */
.hero { position: relative; margin: 4px 0 26px; padding: 22px 24px; border: 1px solid var(--accent); background: var(--card); box-shadow: var(--hard-shadow); }
.hero-inner { position: relative; display: flex; gap: 24px; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; }
.hero h1 { font-size: clamp(2.6rem, 5vw + 1rem, 4.4rem); margin-bottom: 6px; }
.hero h1::after { content: ""; display: inline-block; width: .45em; height: .8em; margin-left: .15em; background: var(--accent); animation: blink 1.1s steps(1) infinite; box-shadow: var(--glow); }
.hero p { color: var(--muted-foreground); font-size: .92rem; max-width: 60ch; margin: 0; }
.hero p::before { content: "> "; color: var(--accent); }
.hero-version { font-family: var(--pixel); font-size: .66rem; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; margin-bottom: 10px; }
.hero-bar { display: flex; height: 8px; margin: 16px 0 0; max-width: 420px; }
.hero-bar span { flex: 1; }
.hero-bar span:nth-child(1) { background: #8f2f12; } .hero-bar span:nth-child(2) { background: var(--accent-2); } .hero-bar span:nth-child(3) { background: var(--accent); }
.hero-bar span:nth-child(4) { background: #f6d58a; } .hero-bar span:nth-child(5) { background: color-mix(in srgb, var(--accent) 12%, var(--card)); }
.hero-stats { display: flex; flex-direction: column; gap: 2px; margin: 0; min-width: 270px; font-size: .8rem; }
.hero-stats div { display: flex; align-items: baseline; gap: 8px; }
.hero-stats div::before { content: "[ OK ]"; color: var(--success); white-space: pre; }
.hero-stats dt { order: 1; color: var(--muted-foreground); text-transform: lowercase; flex: 1; overflow: hidden; white-space: nowrap; }
.hero-stats dt::after { content: " ........................"; color: var(--accent-dim); }
.hero-stats dd { order: 2; margin: 0; color: var(--accent-3); font-variant-numeric: tabular-nums; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.section-title { display: flex; align-items: center; gap: 12px; margin: 26px 0 12px; }
.section-title:first-child { margin-top: 0; }
.section-title h2 { font-family: var(--pixel); font-weight: 400; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0; white-space: nowrap; }
.section-title h2::before { content: "══ "; color: var(--accent-dim); }
.section-title h2 a { color: inherit; }
.section-title::after { content: ""; flex: 1; border-top: 1px solid var(--line); min-width: 20px; }
.section-title .description { color: var(--muted-foreground); font-size: .78rem; margin: 0; order: 3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }

.space-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.space-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px; min-width: 0;
  background: var(--card); border: 1px solid var(--line);
  transition: transform var(--dur-fast) steps(2), box-shadow var(--dur-fast) steps(2), border-color var(--dur-fast);
}
.space-card:hover { border-color: var(--accent); transform: translate(-3px, -3px); box-shadow: var(--hard-shadow); }
.space-card-head { display: flex; gap: 12px; align-items: flex-start; }
.space-card .space-glyph { width: 38px; height: 38px; font-size: 1rem; }
.space-card:hover .space-glyph { background: var(--accent); color: var(--background); border-color: var(--accent); }
.space-card-title { font-size: .95rem; line-height: 1.3; margin: 0; }
.space-card-title a::after { content: ""; position: absolute; inset: 0; }
.space-card-title a:hover { color: var(--accent); }
.space-card-title a::before { content: "./"; color: var(--accent); }
.space-card-desc { color: var(--muted-foreground); font-size: .8rem; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.space-card .unread-dot { position: absolute; top: 12px; right: 14px; }
.space-card-subs { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 4px 10px; margin: -2px 0 0; padding: 0; list-style: none; font-size: .76rem; }
.space-card-subs a { display: inline-flex; align-items: center; gap: 2px; color: var(--muted-foreground); }
.space-card-subs a:hover { color: var(--accent); }
.space-card-foot { display: flex; align-items: center; gap: 12px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); font-size: .74rem; color: var(--muted-foreground); min-width: 0; }
.space-card-foot .space-latest { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.space-latest-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; }
.space-latest-text a { color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.space-latest-text a:hover { color: var(--accent); }
.space-counts { display: flex; gap: 10px; flex-shrink: 0; font-variant-numeric: tabular-nums; color: var(--accent); }
.space-counts span { display: inline-flex; align-items: center; gap: 4px; }
.unread-dot { display: inline-block; font-family: var(--pixel); font-size: .6rem; color: var(--background); background: var(--accent); padding: 1px 5px; line-height: 1.4; animation: blink 1.4s steps(1) infinite; }
.unread-dot::before { content: "NEW"; }

/* Classic node rows (sub-forums, category pages) */
.node { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) 150px 250px; gap: 14px; align-items: center; padding: 11px 14px; border-bottom: 1px dashed var(--line); }
.node:hover { background: var(--hover); }
.node:last-child { border-bottom: 0; }
.node-icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--accent-dim); color: var(--accent); font-family: var(--pixel); font-size: .85rem; text-transform: uppercase; }
.node.is-unread .node-icon { background: var(--accent); color: var(--background); border-color: var(--accent); box-shadow: var(--glow); }
.node-title { font-weight: 700; font-size: .92rem; }
.node-title a::before { content: "./"; color: var(--accent); font-weight: 400; }
.node-description { color: var(--muted-foreground); font-size: .8rem; margin-top: 2px; }
.node-subforums { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .76rem; }
.node-subforums a { color: var(--muted-foreground); }
.node-subforums a::before { content: "└ "; color: var(--accent-dim); }
.node-subforums a:hover { color: var(--accent); }
.node-stats { display: flex; gap: 16px; font-size: .74rem; color: var(--muted-foreground); text-align: center; margin: 0; }
.node-stats dt { font-size: .68rem; text-transform: lowercase; }
.node-stats dd { margin: 0; color: var(--accent-3); font-size: .9rem; font-variant-numeric: tabular-nums; }
.node-last { display: flex; gap: 10px; align-items: center; font-size: .78rem; min-width: 0; }
.node-last-text { min-width: 0; color: var(--muted-foreground); display: flex; flex-direction: column; line-height: 1.4; }
.node-last-text a.title { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; color: var(--foreground); }

/* ============================================================
   Thread list (log lines)
   ============================================================ */
.thread {
  position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 14px; align-items: center;
  padding: 10px 14px 10px 22px; border-bottom: 1px dashed var(--line);
}
.thread::before { content: ">"; position: absolute; left: 8px; top: 50%; transform: translateY(-50%); color: var(--accent); opacity: 0; font-weight: 700; }
.thread:hover { background: var(--hover); }
.thread:hover::before { opacity: 1; animation: blink 1s steps(1) infinite; }
.thread:last-child { border-bottom: 0; }
.thread.is-sticky { background: var(--accent-softer); }
.thread.is-moderated { background: color-mix(in srgb, var(--warning) 8%, transparent); }
.thread.is-deleted { opacity: .6; }
.thread.is-unread::before { content: "●"; opacity: 1; animation: none; text-shadow: var(--glow); font-size: .7rem; }
.thread-title { font-size: .92rem; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.thread-title > a { color: var(--foreground); }
.thread-title > a:hover { color: var(--accent); }
.thread.is-unread .thread-title > a { font-weight: 700; color: var(--accent-3); }
.thread-meta { font-size: .74rem; color: var(--muted-foreground); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 2px; }
.thread-meta .username { font-weight: 400; color: var(--muted-foreground); }
.thread-pages { display: inline-flex; gap: 3px; }
.thread-pages a { padding: 0 4px; border: 1px solid var(--line); font-size: .68rem; line-height: 16px; }
.thread-pages a:hover { border-color: var(--accent); }
.thread-stats { display: flex; gap: 12px; margin: 0; font-size: .76rem; color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.thread-stats > div { display: inline-flex; align-items: center; gap: 4px; min-width: 44px; }
.thread-stats dt { display: inline-flex; }
.thread-stats dd { margin: 0; color: var(--accent-3); }
.thread-last { font-size: .74rem; display: flex; gap: 10px; align-items: center; justify-content: flex-end; text-align: right; color: var(--muted-foreground); min-width: 150px; }
.thread-last a { color: var(--foreground); }
.thread-last-text { display: flex; flex-direction: column; line-height: 1.4; }
.segmented { display: inline-flex; gap: 0; border: 1px solid var(--line); }
.segmented a, .segmented strong { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; font-size: .74rem; font-weight: 400; color: var(--muted-foreground); text-transform: lowercase; }
.segmented a + *, .segmented strong + * { border-left: 1px solid var(--line); }
.segmented a:hover { color: var(--accent); background: var(--hover); }
.segmented strong { background: var(--accent); color: var(--background); }
.segmented strong::before { content: "* "; }

/* ============================================================
   Labels, avatars, usernames
   ============================================================ */
.label {
  display: inline-flex; align-items: center; gap: 4px; padding: 0 5px; font-family: var(--pixel); font-size: .6rem; font-weight: 400;
  line-height: 1.7; letter-spacing: .06em; text-transform: uppercase; background: transparent; border: 1px solid currentColor; color: var(--accent);
  vertical-align: middle; white-space: nowrap;
}
.label .icon { display: none; }
.label--sticky { background: var(--accent); color: var(--background); border-color: var(--accent); }
.label--locked { color: var(--muted-foreground); }
.label--moderated { color: var(--warning); }
.label--deleted { color: var(--destructive); }
.label--prefix { background: var(--accent-2); color: #fff; border-color: var(--accent-2); }

.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0; overflow: hidden; user-select: none; vertical-align: middle;
  background: var(--input-bg) !important; color: var(--accent); border: 1px solid var(--accent-dim);
  font-family: var(--pixel); font-weight: 400; text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
:root[data-theme="dark"] .avatar img { filter: sepia(.45) saturate(1.15) contrast(1.05); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .avatar img { filter: sepia(.45) saturate(1.15) contrast(1.05); } }
.avatar--xs { width: 22px; height: 22px; font-size: 10px; }
.avatar--s { width: 32px; height: 32px; font-size: 12px; }
.avatar--m { width: 42px; height: 42px; font-size: 15px; }
.avatar--l { width: 84px; height: 84px; font-size: 30px; }
.avatar--xl { width: 120px; height: 120px; font-size: 44px; }
.username { font-weight: 700; }
.user-title { color: var(--muted-foreground); font-size: .74rem; }
.user-banner { display: inline-flex; padding: 0 5px; font-family: var(--pixel); font-size: .58rem; letter-spacing: .06em; text-transform: uppercase; border: 1px solid currentColor; line-height: 1.7; }
.banner-staff { color: var(--c-admin); }
.banner-supporter { color: var(--c-supporter); }

/* ============================================================
   Thread view
   ============================================================ */
.thread-layout { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 22px; align-items: start; }
.thread-rail { position: sticky; top: calc(var(--header-h) + 14px); display: flex; flex-direction: column; gap: 14px; }
.rail-card { position: relative; background: var(--card); border: 1px solid var(--line); padding: 12px; }
.rail-card h2 { font-family: var(--pixel); font-weight: 400; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.rail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.rail-stats div { display: flex; flex-direction: column; padding: 6px 8px; border: 1px dashed var(--line); }
.rail-stats dt { order: 2; font-size: .66rem; color: var(--muted-foreground); text-transform: lowercase; }
.rail-stats dd { margin: 0; font-family: var(--display); font-size: 1.8rem; line-height: 1; color: var(--accent-3); text-shadow: var(--glow); }
.rail-actions { display: flex; flex-direction: column; gap: 8px; }
.rail-actions .button, .rail-actions .watch-form, .rail-actions .watch-form .dropdown, .rail-actions .watch-form summary { width: 100%; }
.rail-jump { display: flex; gap: 8px; }
.rail-jump .button { flex: 1; }
.rail-progress { display: flex; height: 10px; margin-top: 12px; padding: 1px; border: 1px solid var(--accent-dim); }
.rail-progress span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px); transition: width 120ms steps(4); box-shadow: var(--glow); }
.rail-starter { display: flex; align-items: center; gap: 10px; }
.rail-starter > div { display: flex; flex-direction: column; min-width: 0; line-height: 1.4; font-size: .8rem; }
.rail-page { margin-top: 8px; font-size: .72rem; }
.thread-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.thread-labels:empty { display: none; }
.thread-header h1 { max-width: 34ch; }

.post-stream { position: relative; display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.message { position: relative; display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 0 14px; padding: 0 16px 10px 0; background: var(--card); border: 1px solid var(--line); }
.message-user { position: relative; display: flex; flex-direction: column; align-items: center; padding: 12px 0 0 12px; }
.message-user .avatar { width: 42px; height: 42px; font-size: 15px; }
.message-avatar { display: inline-flex; }
.message-user-stats, .message-user .user-banner, .message-user .user-title, .message-user-name { display: none; }
.message:target, .message.is-highlight { border-color: var(--accent); box-shadow: var(--hard-shadow-sm); }
.message.htmx-added, .message.is-new { animation: crt-scan 300ms steps(10, end); }
.message-main { min-width: 0; display: flex; flex-direction: column; }
.message-attribution {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 -16px 12px -14px; padding: 7px 16px 7px 14px; border-bottom: 1px dashed var(--line); font-size: .76rem; color: var(--muted-foreground);
}
.message-who { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; min-width: 0; }
.message-who .username { font-size: .86rem; }
.message-who .username::before { content: "@"; color: var(--accent-dim); font-weight: 400; }
.message-who .user-title:empty { display: none; }
.message-attribution a { color: var(--muted-foreground); }
.message-attribution a:hover { color: var(--accent); }
.message-attribution .username { color: var(--foreground); }
.message-attribution-end { display: inline-flex; align-items: center; gap: 8px; }
.post-number { font-variant-numeric: tabular-nums; color: var(--accent) !important; }
.message-body { flex: 1; font-size: .92rem; }
.message.is-first { border-color: var(--accent-dim); }
.message.is-first .message-body { font-size: .96rem; }
.message.is-unread .message-time::before { content: "NEW"; display: inline-block; margin-right: 8px; padding: 0 5px; background: var(--accent); color: var(--background); font-family: var(--pixel); font-size: .58rem; line-height: 1.7; animation: blink 1.4s steps(1) infinite; }
.message.is-moderated { background: color-mix(in srgb, var(--warning) 6%, var(--card)); }
.message.is-deleted .message-body { opacity: .5; }
.message-notice { padding: 6px 10px; border: 1px dashed var(--warning); color: var(--warning); font-size: .8rem; margin-bottom: 12px; }
.message-notice::before { content: "[!] "; }
.message-notice--deleted { border-color: var(--destructive); color: var(--destructive); }
.message-edited { font-size: .72rem; color: var(--muted-foreground); margin-top: 14px; }
.message-edited::before { content: "// "; color: var(--accent-dim); }
.message-signature { margin-top: 14px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: .8rem; color: var(--muted-foreground); max-height: 140px; overflow: hidden; }
.message-signature::before { content: "-- "; display: block; color: var(--accent-dim); }
.message-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.message-footer:not(:has(a, button, form, details, .reactions-bar)) { display: none; }
.message-actions { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: wrap; margin-left: auto; }
.message-actions a, .message-actions button {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 7px; font: inherit; font-size: .74rem; color: var(--muted-foreground);
  background: none; border: 1px solid transparent; cursor: pointer; text-transform: lowercase;
}
.message-actions a:hover, .message-actions button:hover { color: var(--accent); border-color: var(--accent-dim); }
.message-actions .icon { width: 13px; height: 13px; }
@media (hover: hover) and (min-width: 761px) {
  .message-actions .is-secondary { opacity: 0; }
  .message:hover .message-actions .is-secondary, .message:focus-within .message-actions .is-secondary { opacity: 1; }
}
.user-card {
  position: absolute; left: 12px; top: 60px; z-index: 20; width: 250px; padding: 12px; background: var(--card); border: 1px solid var(--accent);
  box-shadow: var(--hard-shadow-sm); visibility: hidden; opacity: 0; transition: opacity 0s, visibility 0s;
}
.message-user:hover .user-card, .message-user:focus-within .user-card { visibility: visible; opacity: 1; transition-delay: 300ms; }
.user-card-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.user-card-head > div { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.user-card dl { display: flex; flex-direction: column; gap: 1px; margin: 0; font-size: .74rem; }
.user-card dl div { display: flex; gap: 6px; }
.user-card dt { color: var(--muted-foreground); }
.user-card dt::after { content: " ........"; color: var(--accent-dim); }
.user-card dd { margin: 0 0 0 auto; color: var(--accent-3); }
details.message--ignored { display: block; border: 1px dashed var(--line); background: transparent; }
details.message--ignored > summary { padding: 10px 14px; color: var(--muted-foreground); cursor: pointer; font-size: .8rem; list-style: none; }
details.message--ignored > summary::before { content: "[+] "; color: var(--accent); }
details.message--ignored[open] > summary { border-bottom: 1px dashed var(--line); }
details.message--ignored > .message { border: 0; }

.reply-card { border-color: var(--accent); box-shadow: var(--hard-shadow); }
.reply-card .block-header { gap: 10px; justify-content: flex-start; }
.reply-card .block-header::before { content: "$"; }
.reply-card .block-header .avatar { display: none; }
.reply-hints { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); letter-spacing: 0; text-transform: none; font-size: .72rem; color: var(--muted-foreground); }
.fab-reply {
  position: fixed; right: 18px; bottom: calc(var(--status-h) + 16px); z-index: 55; display: none; align-items: center; gap: 8px; height: 40px; padding: 0 16px;
  background: var(--accent); color: var(--background); font-family: var(--pixel); font-size: .72rem; text-transform: uppercase; box-shadow: var(--hard-shadow-sm);
}
.fab-reply:hover { color: var(--background); transform: translate(-1px, -1px); box-shadow: var(--hard-shadow); }
.fab-reply.is-visible { display: inline-flex; }

/* ============================================================
   BBCode content
   ============================================================ */
.bbwrapper { line-height: 1.7; }
.bbwrapper > :first-child { margin-top: 0; }
.bbwrapper a, a.link { color: var(--link); text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; }
.bbwrapper a:hover, a.link:hover { background: var(--link); color: var(--background); text-decoration: none; }
.bbc-quote { margin: 12px 0; border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--quote-bg); }
.bbc-quote-title { padding: 6px 12px 0; font-size: .74rem; color: var(--accent); }
.bbc-quote-title::before { content: "> "; }
.bbc-quote-title a { color: inherit; }
.bbc-quote-body { padding: 4px 12px 10px; max-height: 420px; overflow: auto; }
.bbc-code-block { margin: 12px 0; border: 1px solid var(--line); overflow: hidden; }
.bbc-code-title { padding: 4px 10px; font-family: var(--pixel); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--line); color: var(--accent); background: var(--accent-softer); }
.bbc-code { margin: 0; padding: 10px 12px; background: var(--code-bg); overflow: auto; max-height: 480px; font-size: .8rem; line-height: 1.6; color: var(--success); }
.bbc-code code, .bbc-icode { font-family: var(--mono); }
.bbc-icode { background: var(--code-bg); border: 1px solid var(--line); padding: 0 4px; font-size: .88em; color: var(--accent-3); }
.bbc-spoiler { margin: 12px 0; border: 1px dashed var(--line); }
.bbc-spoiler summary { cursor: pointer; padding: 6px 10px; font-size: .8rem; color: var(--accent); list-style: none; }
.bbc-spoiler summary::-webkit-details-marker { display: none; }
.bbc-spoiler summary::before { content: "[+] "; }
.bbc-spoiler[open] summary::before { content: "[-] "; }
.bbc-spoiler[open] summary { border-bottom: 1px dashed var(--line); }
.bbc-spoiler-body { padding: 10px 12px; }
.bbc-ispoiler { background: var(--foreground); color: transparent; cursor: pointer; }
.bbc-ispoiler:hover, .bbc-ispoiler:focus { color: var(--foreground); background: var(--hover); }
.bbc-img { max-width: 100%; height: auto; vertical-align: middle; border: 1px solid var(--line); }
.bbc-media { position: relative; width: 100%; max-width: 680px; aspect-ratio: 16 / 9; margin: 12px 0; border: 1px solid var(--line); }
.bbc-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.bbc-media-spotify { aspect-ratio: auto; height: 152px; }
.bbc-table-wrap { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); }
.bbc-table { border-collapse: collapse; width: 100%; }
.bbc-table td, .bbc-table th { border: 1px dashed var(--line); padding: 6px 10px; text-align: left; }
.bbc-table th { color: var(--accent); font-weight: 400; }
.bbc-list { margin: 8px 0; padding-left: 24px; }
.bbc-list li::marker { color: var(--accent); }
.bbc-align-left { text-align: left; } .bbc-align-center { text-align: center; } .bbc-align-right { text-align: right; } .bbc-align-justify { text-align: justify; }
.bbc-indent-1 { margin-left: 24px; } .bbc-indent-2 { margin-left: 48px; } .bbc-indent-3 { margin-left: 72px; } .bbc-indent-4 { margin-left: 96px; } .bbc-indent-5 { margin-left: 120px; }
.bbc-size-1 { font-size: 0.7em; } .bbc-size-2 { font-size: 0.85em; } .bbc-size-3 { font-size: 1em; } .bbc-size-4 { font-size: 1.2em; } .bbc-size-5 { font-size: 1.5em; } .bbc-size-6 { font-size: 2em; } .bbc-size-7 { font-size: 2.6em; }
.bbc-heading { margin: 16px 0 8px; color: var(--accent-3); }
.bbc-hr { margin: 16px 0; border: 0; border-top: 1px dashed var(--accent-dim); }

/* ============================================================
   Buttons: [ bracketed ] keys that physically press
   ============================================================ */
.button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 32px; padding: 0 12px;
  border: 1px solid var(--accent-dim); background: var(--card); color: var(--foreground); font: inherit; font-size: .78rem;
  text-transform: lowercase; cursor: pointer; line-height: 1; text-decoration: none; white-space: nowrap; user-select: none;
  box-shadow: 2px 2px 0 var(--line);
  transition: background-color var(--dur-fast), color var(--dur-fast), border-color var(--dur-fast), transform 60ms, box-shadow 60ms;
}
.button::before { content: "["; color: var(--accent); }
.button::after { content: "]"; color: var(--accent); }
.button:hover { border-color: var(--accent); color: var(--accent); }
.button:active { transform: translate(2px, 2px); box-shadow: 0 0 0 var(--line); }
.button:focus-visible { outline: 1px dashed var(--accent); outline-offset: 3px; }
.button .icon { width: 14px; height: 14px; }
.button--primary { background: var(--accent); border-color: var(--accent); color: var(--background); font-weight: 700; box-shadow: 3px 3px 0 var(--accent-2); }
.button--primary::before, .button--primary::after { color: var(--background); }
.button--primary:hover { background: color-mix(in srgb, var(--accent) 80%, #fff); border-color: var(--accent); color: var(--background); box-shadow: 3px 3px 0 var(--accent-2), var(--glow); }
.button--primary:active { box-shadow: 0 0 0 var(--accent-2); }
.button--danger { background: transparent; border-color: var(--destructive); color: var(--destructive); }
.button--danger::before, .button--danger::after { color: var(--destructive); }
.button--danger:hover { background: var(--destructive); color: var(--destructive-foreground); border-color: var(--destructive); }
.button--danger:hover::before, .button--danger:hover::after { color: inherit; }
.button--ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted-foreground); }
.button--ghost::before, .button--ghost::after { content: none; }
.button--ghost:hover { border-color: var(--accent-dim); }
.button--secondary { background: var(--input-bg); }
.button--small { height: 28px; padding: 0 9px; font-size: .74rem; }
.button[disabled], .htmx-request .button[type=submit] { opacity: .5; pointer-events: none; }
.htmx-request .button[type=submit]::after { content: "…]"; animation: blink .6s steps(1) infinite; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
summary.button { list-style: none; }
summary.button::-webkit-details-marker { display: none; }

/* ============================================================
   Forms: prompts
   ============================================================ */
.form-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 6px 24px; padding: 14px 16px; border-bottom: 1px dashed var(--line); align-items: start; }
.form-row:last-child { border-bottom: 0; }
.form-row > label, .form-row > .form-label { font-size: .82rem; padding-top: 6px; color: var(--accent); }
.form-row > label::before, .form-row > .form-label::before { content: "> "; color: var(--accent-dim); }
.form-row .explain, .explain { color: var(--muted-foreground); font-size: .76rem; margin-top: 6px; }
.form-stack { display: flex; flex-direction: column; gap: 14px; }
.form-stack label { font-size: .8rem; display: block; margin-bottom: 6px; color: var(--accent); }
.form-stack label.checkbox { display: flex; color: var(--foreground); }
.input, select.input, textarea.input {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line); background: var(--input-bg);
  color: var(--foreground); font: inherit; font-size: .86rem; transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:hover { border-color: var(--accent-dim); }
select.input { padding-right: 30px; appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
select.input option { background: var(--card); color: var(--foreground); }
select.input[multiple] { height: auto; padding: 4px; background-image: none; }
.input::placeholder { color: color-mix(in srgb, var(--muted-foreground) 75%, transparent); }
.input:focus, .input:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--glow); }
textarea.input { height: auto; min-height: 120px; padding: 8px 10px; resize: vertical; line-height: 1.55; }
textarea.input--code { font-size: 13px; min-height: 520px; tab-size: 4; white-space: pre; }
input[type="file"].input { height: auto; padding: 6px; }
.input--short { max-width: 150px; }
.input--medium { max-width: 380px; }
.input--tiny { max-width: 90px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; margin: 5px 0; font-weight: 400 !important; font-size: .84rem; cursor: pointer; }
.checkbox input { margin-top: 3px; flex-shrink: 0; }
.field-error { color: var(--destructive); font-size: .76rem; margin-top: 6px; }
.field-error::before { content: "[ERR] "; }
.input.has-error { border-color: var(--destructive); }
.input.has-error:focus { box-shadow: 0 0 0 1px var(--destructive); }
.honeypot { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Auth pages: a login terminal */
.auth-shell { position: relative; max-width: 480px; margin: 24px auto 48px; }
.auth-shell--wide { max-width: 580px; }
.auth-intro { margin-bottom: 22px; text-align: center; }
.auth-intro h1 { margin: 10px 0; }
.auth-intro p { color: var(--muted-foreground); max-width: 46ch; margin: 0 auto; font-size: .86rem; }
.eyebrow { display: inline-block; font-family: var(--pixel); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.eyebrow::before { content: "■ "; } .eyebrow::after { content: " ■"; }
.auth-shell .block { border-color: var(--accent); box-shadow: var(--hard-shadow); }
.auth-shell .form-stack { gap: 18px; padding: 22px; }
.auth-shell .input { min-height: 40px; }
.auth-shell .block-footer { padding: 14px 22px; justify-content: space-between; }
.auth-shell .block-footer .button--primary { flex: 1; min-height: 38px; }
.auth-shell .small { margin-top: 8px; }
.auth-shell .explain { margin-top: 0; }
.mobile-staff-links { display: none; }

/* Launch checks */
.launch-summary { display: flex; align-items: center; gap: 24px; }
.launch-summary > div { min-width: 0; flex: 1; }
.launch-summary p:last-child { margin: 0; }
.launch-progress { display: block; width: 100%; height: 10px; accent-color: var(--accent); margin: 12px 0; border: 1px solid var(--accent-dim); background: transparent; }
.launch-progress::-webkit-progress-bar { background: transparent; }
.launch-progress::-webkit-progress-value { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px); }
.launch-progress::-moz-progress-bar { background: var(--accent); }
.launch-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.launch-check { display: flex; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); background: var(--card); }
.launch-check > div { min-width: 0; }
.launch-check h2 { font-size: .86rem; margin: 2px 0 6px; }
.launch-check p { font-size: .8rem; color: var(--muted-foreground); margin: 4px 0 0; }
.check-marker { flex-shrink: 0; display: grid; place-items: center; min-width: 30px; height: 22px; padding: 0 4px; border: 1px solid var(--warning); color: var(--warning); font-family: var(--pixel); font-size: .6rem; }
.launch-check--passed .check-marker { border-color: var(--success); color: var(--success); }

/* SCEditor */
.editor-wrap { margin-bottom: 12px; }
.editor-wrap .sceditor-container { width: 100% !important; border: 1px solid var(--line) !important; border-radius: 0 !important; background: var(--input-bg) !important; overflow: hidden; }
.editor-wrap .sceditor-container:focus-within { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent); }
.sceditor-container .sceditor-toolbar { background: var(--card) !important; border-bottom: 1px dashed var(--line) !important; border-radius: 0 !important; padding: 4px !important; }
.sceditor-container .sceditor-group { background: transparent !important; border: 0 !important; border-right: 1px dashed var(--line) !important; border-radius: 0 !important; margin: 2px 6px 2px 0 !important; padding: 0 6px 0 0 !important; }
.sceditor-container .sceditor-button { border-radius: 0 !important; }
.sceditor-container .sceditor-button:hover, .sceditor-container .sceditor-button.active { background: var(--active) !important; box-shadow: none !important; }
.sceditor-container textarea, .sceditor-container iframe { background: var(--input-bg) !important; color: var(--foreground) !important; }
.sceditor-dropdown { border: 1px solid var(--accent) !important; border-radius: 0 !important; box-shadow: var(--hard-shadow-sm) !important; background: var(--card) !important; color: var(--foreground) !important; }
.sceditor-container .sceditor-button svg { fill: var(--accent); }
.sceditor-container .sceditor-button.disabled svg { fill: var(--muted-foreground); opacity: .5; }
.preview-area:not(:empty) { margin-top: 12px; padding: 14px; border: 1px dashed var(--accent-dim); background: var(--card); }
.preview-area:not(:empty)::before { content: "PREVIEW"; display: block; margin-bottom: 8px; font-family: var(--pixel); font-size: .6rem; letter-spacing: .12em; color: var(--accent); }

/* ============================================================
   Notices, flashes, toasts: system messages
   ============================================================ */
.notice, .flash { position: relative; display: block; padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--card); font-size: .84rem; line-height: 1.55; }
.notice::before { content: "[i] "; color: var(--accent); }
.notice--warning { border-left-color: var(--warning); }
.notice--warning::before { content: "[!] "; color: var(--warning); }
.notice--error { border-left-color: var(--destructive); color: var(--destructive); }
.notice--error::before { content: "[ERR] "; }
.notice--error strong, .notice--error a { color: inherit; }
.notice--success, .flash { border-left-color: var(--success); }
.notice--success::before { content: "[ OK ] "; color: var(--success); white-space: pre; }
.flash { display: flex; align-items: center; gap: 8px; }
.flash .icon { display: none; }
.flash::before { content: "[ OK ]"; color: var(--success); white-space: pre; }
#toasts { position: fixed; bottom: calc(var(--status-h) + 14px); right: 16px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; z-index: 1000; max-width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--card); color: var(--foreground); border: 1px solid var(--destructive); box-shadow: 3px 3px 0 var(--destructive); font-size: .8rem; animation: crt-scan 200ms steps(6, end); }
.toast::before { content: "[ERR]"; color: var(--destructive); }
.toast--info { border-color: var(--accent); box-shadow: 3px 3px 0 var(--accent-2); }
.toast--info::before { content: "[ OK ]"; color: var(--success); white-space: pre; }
.toast.is-leaving { opacity: 0; transition: opacity 200ms steps(3); }

/* ============================================================
   Pagination
   ============================================================ */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; list-style: none; padding: 0; margin: 0; font-size: .8rem; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; height: 28px; padding: 0 6px; border: 1px solid var(--line); color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.pagination a:hover { color: var(--accent); border-color: var(--accent); }
.pagination .is-current { background: var(--accent); color: var(--background); border-color: var(--accent); font-weight: 700; }
.pagination .gap { border: 0; min-width: 0; }
.list-controls { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 12px 0; flex-wrap: wrap; }
.list-controls:empty { display: none; }

/* ============================================================
   Tables
   ============================================================ */
.data-table { width: 100%; border-collapse: collapse; font-size: .82rem; }
.data-table th, .data-table td { padding: 8px 12px; border-bottom: 1px dashed var(--line); text-align: left; vertical-align: middle; }
.data-table th { height: 34px; color: var(--accent); font-family: var(--pixel); font-weight: 400; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line); }
.data-table tbody tr:hover { background: var(--hover); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .actions { text-align: right; white-space: nowrap; }
.data-table .actions form { display: inline; }
.data-table td.empty { padding: 28px 12px; }
.table-wrap { overflow-x: auto; }

/* ============================================================
   Layouts
   ============================================================ */
.with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 22px; align-items: start; }
.with-sidebar > aside { display: flex; flex-direction: column; position: sticky; top: calc(var(--header-h) + 14px); }
.with-nav { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 26px; align-items: start; }
.with-nav > nav.block { border: 1px solid var(--line); position: sticky; top: calc(var(--header-h) + 14px); margin: 0; padding: 8px 0; }
.with-nav > nav.block::after { content: none; }
.side-nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.side-nav li a { position: relative; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; color: var(--foreground); font-size: .8rem; }
.side-nav li a:hover { background: var(--hover); color: var(--accent); }
.side-nav li a.is-active { background: var(--accent); color: var(--background); font-weight: 700; }
.side-nav li a.is-active::after { content: "◄"; margin-left: auto; font-size: .65rem; }
.side-nav-heading { padding: 12px 12px 4px; font-family: var(--pixel); font-size: .6rem; color: var(--accent); letter-spacing: .1em; text-transform: uppercase; }
.side-nav-heading:first-child { padding-top: 4px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.stat { position: relative; padding: 14px 16px; border: 1px solid var(--line); background: var(--card); }
.stat:hover { border-color: var(--accent); }
.stat-value { font-family: var(--display); font-size: 2.4rem; line-height: 1; color: var(--accent-3); text-shadow: var(--glow); font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted-foreground); font-size: .74rem; text-transform: lowercase; margin-top: 4px; }
.pairs { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .8rem; }
.pairs dt { color: var(--muted-foreground); }
.pairs dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--accent-3); }
.online-list { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: .82rem; }
.online-list a:not(:last-child)::after { content: ","; color: var(--muted-foreground); }

/* ============================================================
   Dropdowns: pop-up windows
   ============================================================ */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; background: var(--card); color: var(--foreground);
  border: 1px solid var(--accent); box-shadow: var(--hard-shadow-sm); z-index: 90; padding: 4px; animation: crt-scan 160ms steps(5, end);
}
.dropdown-menu--right { right: 0; left: auto; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 6px 8px; color: var(--foreground); background: none; border: 0; font: inherit; font-size: .82rem; cursor: pointer; }
.dropdown-menu a:hover, .dropdown-menu button:hover, .dropdown-menu a.is-active { background: var(--accent); color: var(--background); }
.dropdown-menu a:hover .icon, .dropdown-menu button:hover .icon { color: var(--background); }
.dropdown-menu .icon { color: var(--accent); width: 14px; height: 14px; }
.dropdown-label { display: flex; align-items: center; gap: 10px; padding: 6px 8px 8px; font-size: .84rem; }
.dropdown-label .muted { font-size: .74rem; }
.dropdown-sep { height: 0; margin: 4px 0; border-top: 1px dashed var(--line); }
.dropdown-menu form { margin: 0; }

/* ============================================================
   Tabs
   ============================================================ */
.tabs { display: flex; align-items: flex-end; gap: 0; margin-bottom: 16px; max-width: 100%; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs .tab { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; margin-bottom: -1px; font-size: .78rem; color: var(--muted-foreground); white-space: nowrap; border: 1px solid transparent; text-transform: lowercase; }
.tabs .tab:hover { color: var(--accent); }
.tabs .tab.is-active { color: var(--accent); border-color: var(--line); border-bottom-color: var(--background); background: var(--background); }
.tabs .tab.is-active::before { content: "* "; }

/* ============================================================
   Profile
   ============================================================ */
.profile-card { margin-bottom: 18px; }
.profile-cover {
  height: 96px; border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgb(0 0 0 / .18) 3px 4px), linear-gradient(90deg, #8f2f12, var(--accent-2) 25%, var(--accent) 50%, #f6d58a 75%, color-mix(in srgb, var(--accent) 10%, var(--card)));
  opacity: .85;
}
/* Only the avatar overlaps the cover; the name and details start below it, top-aligned with the
   avatar, so the name never sits on the bright cover and no gap opens beside a tall header. */
.profile-card .member-header { padding: 0 18px 18px; position: relative; align-items: flex-start; gap: 20px; }
.profile-card .member-header .avatar { background: var(--card) !important; border: 2px solid var(--accent); box-shadow: var(--hard-shadow-sm); }
.profile-card .member-header > .avatar { margin-top: -48px; flex: none; position: relative; }
.profile-card .member-header-main { padding-top: 14px; }
.profile-card .member-header h1 { margin: 0 0 2px; line-height: 1.1; }
.profile-card .member-stats { margin: 10px 0 8px; }
.profile-card .member-meta { margin-bottom: 0; }
@media (max-width: 640px) { .profile-card .member-header-main { padding-top: 0; } }

/* ============================================================
   Misc
   ============================================================ */
.perm-table td { white-space: nowrap; }
.perm-table td:first-child { white-space: normal; }
.perm-table label { display: inline-flex; gap: 4px; align-items: center; margin-right: 12px; font-weight: 400; }
.tree-indent { display: inline-block; width: calc(var(--depth, 0) * 22px); }
.qr-code { background: #fff; padding: 10px; border: 1px solid var(--line); width: 220px; height: 220px; }
.backup-codes { columns: 2; font-size: 1rem; list-style: none; padding: 0; color: var(--accent-3); }
.member-header { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted-foreground); font-size: .84rem; }
.empty::before { content: "// "; color: var(--accent-dim); }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 20px; text-align: center; color: var(--muted-foreground); font-size: .84rem; }
.empty-state .icon { width: 28px; height: 28px; color: var(--accent); }
.empty-state strong { color: var(--accent); font-family: var(--pixel); font-weight: 400; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 0 6px; border: 1px solid var(--line); font-size: .74rem; color: var(--muted-foreground); }
.forum-heading { display: flex; gap: 14px; align-items: flex-start; }
.space-glyph--lg { width: 50px; height: 50px; font-size: 1.3rem; border-color: var(--accent); box-shadow: var(--hard-shadow-sm); }

/* ============================================================
   Command palette & shortcut sheet: a terminal window
   ============================================================ */
.palette {
  width: min(660px, calc(100vw - 24px)); max-height: min(540px, calc(100dvh - 120px)); padding: 0; margin: 12vh auto auto;
  border: 1px solid var(--accent); background: var(--card); color: var(--foreground); box-shadow: var(--hard-shadow), var(--shadow-lg);
  overflow: hidden; display: none; flex-direction: column; font-family: var(--mono);
}
.palette[open] { display: flex; animation: crt-scan 200ms steps(8, end); }
.palette::backdrop { background: rgb(5 3 1 / .6); }
.palette::before { content: "EXEDRA — COMMAND"; display: block; padding: 4px 10px; background: var(--accent); color: var(--background); font-family: var(--pixel); font-size: .6rem; letter-spacing: .12em; }
.shortcuts-sheet::before { content: "EXEDRA — KEYMAP"; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px dashed var(--line); }
.palette-search .icon { display: none; }
.palette-search::before { content: "$"; color: var(--accent); font-weight: 700; text-shadow: var(--glow); }
.palette-input { flex: 1; height: 48px; border: 0; background: transparent; color: var(--accent-3); font: inherit; font-size: .95rem; outline: none; }
.palette-input::placeholder { color: var(--muted-foreground); }
.palette-mode { font-family: var(--pixel); font-size: .58rem; letter-spacing: .08em; padding: 2px 6px; border: 1px solid var(--accent); color: var(--accent); text-transform: uppercase; white-space: nowrap; }
.palette-list { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.palette-group { padding: 8px 8px 3px; font-family: var(--pixel); font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.palette-group::before { content: "── "; color: var(--accent-dim); }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 5px 8px; cursor: pointer; font-size: .86rem; color: var(--foreground); }
.palette-item .icon { width: 13px; height: 13px; color: var(--accent-dim); }
.palette-item-kind { margin-left: auto; font-size: .7rem; color: var(--muted-foreground); text-transform: lowercase; }
.palette-item mark { background: none; color: var(--accent); text-decoration: underline; }
.palette-item.is-active { background: var(--accent); color: var(--background); }
.palette-item.is-active .icon, .palette-item.is-active .palette-item-kind, .palette-item.is-active mark { color: var(--background); }
.palette-item.is-active .palette-item-kind::after { content: " ↵"; }
.palette-empty { padding: 24px 12px; text-align: center; color: var(--muted-foreground); font-size: .84rem; }
.palette-empty::before { content: "// "; color: var(--accent-dim); }
.palette-foot { display: flex; gap: 16px; align-items: center; padding: 6px 12px; border-top: 1px dashed var(--line); font-size: .7rem; color: var(--muted-foreground); }
.palette-foot span { display: inline-flex; align-items: center; gap: 5px; }
.shortcuts-sheet .palette-list { padding: 8px 16px 14px; }
.shortcuts-sheet .palette-search { display: none; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: .84rem; }
.shortcut-row:last-child { border-bottom: 0; }
.shortcut-row span:last-child { display: inline-flex; gap: 4px; }

/* Boot screen (first visit per browser session) */
.boot {
  position: fixed; inset: 0; z-index: 9990; display: grid; place-items: center; background: var(--background); color: var(--foreground);
  font-size: .82rem; transition: opacity 220ms steps(4);
}
.boot.is-done { opacity: 0; pointer-events: none; }
.boot-box { width: min(520px, calc(100vw - 32px)); border: 1px solid var(--accent); box-shadow: var(--hard-shadow); background: var(--card); }
.boot-title { padding: 18px 16px 6px; text-align: center; font-family: var(--display); font-size: 2.8rem; line-height: 1; color: var(--accent-3); text-shadow: var(--glow-strong); text-transform: uppercase; }
.boot-sub { text-align: center; font-family: var(--pixel); font-size: .6rem; letter-spacing: .14em; color: var(--accent); text-transform: uppercase; }
.boot-log { margin: 14px 16px 10px; min-height: 104px; white-space: pre; overflow: hidden; }
.boot-log .ok { color: var(--success); }
.boot-meter { margin: 0 16px 16px; height: 12px; padding: 1px; border: 1px solid var(--accent-dim); }
.boot-meter span { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px); transition: width 120ms steps(3); }
.boot-skip { text-align: center; margin-top: 12px; font-size: .7rem; color: var(--muted-foreground); animation: blink 1.2s steps(1) infinite; }

/* Theme switch reveal: suppress the page scan during the circular clip animation. */
.theme-transition::view-transition-old(root), .theme-transition::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
.theme-transition .sidebar, .theme-transition .topbar, .theme-transition .statusline { view-transition-name: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .thread-layout { grid-template-columns: minmax(0, 1fr); }
  .thread-rail { display: none; }
}
@media (max-width: 1023px) {
  .shell, .shell.is-rail { --sidebar-w: 270px; }
  .sidebar { transform: translateX(-102%); border-right: 1px solid var(--accent); }
  .is-rail .sidebar-head { padding: 0 8px 0 12px; justify-content: space-between; }
  .is-rail .sidebar-head .p-logo { display: inline-flex; }
  .is-rail .p-logo-text, .is-rail .side-link > span:last-child, .is-rail .side-heading, .is-rail .side-group-title { display: revert; }
  .is-rail .sidebar-nav { padding: 12px 8px 0; }
  .is-rail .side-link { justify-content: flex-start; padding: 0 8px; }
  .is-rail .side-group > ul > li > .side-space::before { content: "├─"; }
  .is-rail .side-group > ul > li:last-child > .side-space::before { content: "└─"; }
  .is-rail .side-space .space-glyph { display: none; }
  .shell.sidebar-open .sidebar { transform: none; box-shadow: var(--hard-shadow); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 75; background: rgb(5 3 1 / .6); opacity: 0; pointer-events: none; transition: opacity var(--dur) steps(3); }
  .shell.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .sidebar-collapse { display: none; }
  .shell-main { margin-left: 0; }
  .topbar .topbar-menu, .topbar .topbar-logo { display: inline-flex; }
  .topbar-inner { padding: 0 10px; gap: 6px; }
  .topbar-clock { display: none; }
  .p-body, .p-footer-inner { padding-left: 16px; padding-right: 16px; }
  .statusline .status-hint { display: none; }
}
@media (max-width: 900px) {
  .with-sidebar, .with-nav { grid-template-columns: minmax(0, 1fr); }
  .with-sidebar > aside { position: static; }
  .with-nav > nav.block { position: static; padding: 0; }
  .with-nav .side-nav { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; }
  .with-nav .side-nav-heading { display: none; }
  .with-nav .side-nav li { flex-shrink: 0; }
  .with-nav .side-nav li a { white-space: nowrap; min-height: 38px; }
  .with-nav .side-nav li a.is-active::after { content: none; }
  .node { grid-template-columns: 36px minmax(0, 1fr); padding: 11px 12px; }
  .node-stats, .node-last { display: none; }
  .thread { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px 10px 20px; }
  .thread-last { display: none; }
  .thread-stats > div:nth-child(2) { display: none; }
}
@media (max-width: 760px) {
  :root { --header-h: 48px; }
  .topbar-search::before { content: "$"; }
  .topbar-search-input { padding: 0 10px 0 24px; height: 32px; }
  .topbar-search-kbd, .create-label { display: none; }
  .create-trigger { padding: 0 8px !important; margin-right: 2px; }
  .create-trigger::before, .create-trigger::after { content: none; }
  .p-nav-user > li > a:not(.button), .p-nav-user > li > button, .account-menu-trigger { min-width: 34px; height: 34px; padding: 0 5px; }
  .topbar .p-nav-user .dropdown .dropdown-menu { position: fixed; top: calc(var(--header-h) + 4px); right: 8px; left: 8px; min-width: 0; max-width: none; width: auto; max-height: calc(100dvh - 100px); overflow-y: auto; overscroll-behavior: contain; }
  .block-header { flex-wrap: wrap; }
  .p-body, .p-footer-inner { padding-left: 10px; padding-right: 10px; }
  .p-body { padding-top: 10px; }
  .hero { padding: 18px 16px; box-shadow: var(--hard-shadow-sm); }
  .hero-stats { min-width: 0; width: 100%; }
  .message, .message.is-first { grid-template-columns: minmax(0, 1fr); padding: 0 12px 8px; }
  .message-user { position: absolute; top: 6px; left: 10px; padding: 0; }
  .message-user .avatar { width: 30px; height: 30px; font-size: 12px; }
  .message-user .user-card { display: none; }
  .message-attribution { margin: 0 -12px 10px; padding: 7px 12px 7px 50px; min-height: 42px; flex-wrap: nowrap; align-items: flex-start; }
  .message-who { gap: 0 6px; line-height: 1.35; }
  .message-who .user-title, .message-attribution .post-number { display: none; }
  .message-actions a span.action-label, .message-actions button span.action-label { display: none; }
  .message-actions a, .message-actions button { height: 34px; padding: 0 10px; }
  .post-stream { gap: 12px; }
  .fab-reply { right: 12px; }
  .palette { margin-top: 10px; max-height: calc(100dvh - 20px); }
  .statusline .status-path { display: none; }
}
@media (max-width: 650px) {
  .form-row { grid-template-columns: 1fr; padding: 12px; }
  .form-row > label, .form-row > .form-label { padding-top: 0; }
  .block-body { padding: 12px; }
  .input { font-size: 16px; min-height: 40px; }
  .auth-shell { margin-top: 12px; }
  .auth-shell .form-stack { padding: 16px; }
  .auth-shell .block-footer { padding: 12px 16px; }
  .launch-checks { grid-template-columns: minmax(0, 1fr); }
  .launch-summary { display: block; }
  .thread-stats { display: none; }
  .thread { grid-template-columns: 32px minmax(0, 1fr); }
  .space-card-foot { flex-wrap: wrap; }
  .section-title .description { display: none; }
}
@media (max-width: 420px) {
  .nav-staff-shortcut { display: none; }
  .mobile-staff-links { display: block; }
  .topbar .topbar-logo { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .boot { display: none; }
}

/* Terminal geometry everywhere, including feature stylesheets: no rounded corners. */
*, *::before, *::after { border-radius: 0 !important; }

/* Page transition fix: the default view-transition blend (plus-lighter) adds the old and new
   snapshots together, which flashes the page toward white. Composite them normally instead. */
::view-transition-old(root), ::view-transition-new(root) { mix-blend-mode: normal; }
::view-transition-image-pair(root) { isolation: auto; }

/* Themed dropdowns: browsers with customizable <select> (Chrome 135+) get a terminal-style
   picker; others keep the styled native control with themed option colours. */
select, select.input { color-scheme: inherit; }
@supports (appearance: base-select) {
  select.input:not([multiple]) { appearance: base-select; background-image: none; display: flex; align-items: center; }
  select.input:not([multiple])::picker-icon { content: "▾"; color: var(--accent); transition: rotate var(--dur-fast); }
  select.input:not([multiple]):open::picker-icon { rotate: 180deg; }
  select.input:not([multiple])::picker(select) {
    appearance: base-select; margin-top: 4px; padding: 4px; max-height: min(320px, 60vh);
    background: var(--card); color: var(--foreground); border: 1px solid var(--accent); box-shadow: var(--hard-shadow-sm);
  }
  select.input:not([multiple]) option { padding: 5px 8px; font: inherit; font-size: .84rem; background: transparent; color: var(--foreground); }
  select.input:not([multiple]) option::checkmark { content: ">"; color: var(--accent); }
  select.input:not([multiple]) option:hover, select.input:not([multiple]) option:focus-visible { background: var(--accent); color: var(--background); outline: none; }
  select.input:not([multiple]) option:hover::checkmark, select.input:not([multiple]) option:focus-visible::checkmark { color: var(--background); }
  select.input:not([multiple]) option:checked { color: var(--accent); }
  select.input:not([multiple]) option:checked:hover { color: var(--background); }
  select.input:not([multiple]) optgroup { font-family: var(--pixel); font-size: .6rem; letter-spacing: .1em; color: var(--accent); }
}
select.input[multiple] option:checked { background: var(--accent) linear-gradient(var(--accent), var(--accent)); color: var(--background); }

/* SCEditor pop-ups (font, size, colour, link, image, media): its theme hard-codes dark text on
   white; restyle every part for the site theme. */
div.sceditor-dropdown { padding: 8px !important; font-family: var(--mono) !important; font-size: .84rem !important; z-index: 4000; }
div.sceditor-dropdown, div.sceditor-dropdown a, div.sceditor-dropdown a:link, div.sceditor-dropdown label,
div.sceditor-dropdown div, .sceditor-font-option, .sceditor-fontsize-option, .sceditor-format a { color: var(--foreground) !important; }
div.sceditor-dropdown label { font-weight: 400 !important; color: var(--accent) !important; font-size: .78rem; }
.sceditor-font-option, .sceditor-fontsize-option, .sceditor-format a { padding: 5px 10px !important; }
div.sceditor-dropdown a:hover, .sceditor-font-option:hover, .sceditor-fontsize-option:hover, .sceditor-format a:hover { background: var(--accent) !important; color: var(--background) !important; text-decoration: none; }
div.sceditor-dropdown input, div.sceditor-dropdown textarea {
  width: 100%; background: var(--input-bg) !important; color: var(--foreground) !important; border: 1px solid var(--line) !important;
  border-radius: 0 !important; font-family: var(--mono) !important; font-size: .84rem; padding: 6px 8px !important; box-shadow: none !important;
}
div.sceditor-dropdown input:focus, div.sceditor-dropdown textarea:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 1px var(--accent) !important; }
div.sceditor-dropdown .button {
  background: var(--accent) !important; color: var(--background) !important; border: 1px solid var(--accent) !important; border-radius: 0 !important;
  font-family: var(--mono) !important; font-weight: 700; text-transform: lowercase; box-shadow: 2px 2px 0 var(--accent-2) !important; height: auto;
}
div.sceditor-dropdown .button::before, div.sceditor-dropdown .button::after { content: none; }
.sceditor-color-option { border: 2px solid var(--card) !important; }
.sceditor-color-option:hover { border-color: var(--accent) !important; }

/* ============================================================
   Cross-browser and touch devices (Safari/iOS, Chrome for Android/iOS, Firefox, Edge)
   ============================================================ */
/* iOS zooms the page when a focused field's text is under 16px: keep fields at 16px on touch screens. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]), select, textarea, .input, .palette-input, .topbar-search-input { font-size: 16px !important; }
  /* Comfortable touch targets (at least ~40px). */
  .side-link, .side-nav li a { height: 42px; }
  .dropdown-menu a, .dropdown-menu button { padding: 10px 10px; }
  .pagination a, .pagination span { min-width: 38px; height: 38px; }
  .button { min-height: 40px; }
  .button--small { min-height: 36px; }
  .message-actions a, .message-actions button { min-height: 38px; }
  .palette-item { padding: 10px 8px; }
  /* Fixed backgrounds repaint on every scroll on mobile browsers. */
  body { background-attachment: scroll; }
  /* On-screen keyboards and fixed bottom bars don't mix (iOS especially): hide the status line while typing. */
  .is-typing .statusline { display: none; }
  .is-typing .shell-main { padding-bottom: 0; }
}
/* Home indicator / rounded corners: keep the status line clear of them. */
.statusline { padding-bottom: env(safe-area-inset-bottom, 0px); height: calc(var(--status-h) + env(safe-area-inset-bottom, 0px)); }
/* Browsers without color-mix() (Safari < 16.2, older Android WebViews): keep surfaces and text readable. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root { --accent-soft: rgb(255 163 26 / .14); --accent-softer: rgb(255 163 26 / .07); --accent-dim: #7a5520; --hover: rgb(255 163 26 / .1); --active: rgb(255 163 26 / .18); --border-soft: var(--border); --sidebar-bg: var(--surface); --input-bg: var(--page-bg); --quote-bg: var(--surface-alt); }
  .topbar { background: var(--surface); }
  .block-header { background: var(--surface-alt); }
}
/* Prevent double-tap zoom delays and grey tap flashes on mobile WebKit. */
a, button, summary, label, .button { -webkit-tap-highlight-color: transparent; }

/* ============================================================
   Live updates: connection state, new replies, typing, presence
   ============================================================ */
[data-live-state].is-live::before { color: var(--success); }
.status-ok.is-offline::before { color: var(--warning); text-shadow: none; animation: blink 1.2s steps(1) infinite; }
.new-replies-pill {
  position: fixed; left: 50%; bottom: calc(var(--status-h) + 18px); transform: translateX(-50%); z-index: 70;
  padding: 7px 14px; background: var(--accent); color: var(--background) !important; font-family: var(--pixel); font-size: .68rem;
  letter-spacing: .06em; text-transform: uppercase; box-shadow: var(--hard-shadow-sm); animation: crt-scan 200ms steps(6, end);
}
.new-replies-pill:hover { background: color-mix(in srgb, var(--accent) 80%, #fff); }
.typing-indicator { margin: -6px 0 14px; padding-left: 4px; font-size: .78rem; color: var(--muted-foreground); }
.typing-indicator::before { content: "▌"; color: var(--accent); margin-right: 6px; animation: blink 1s steps(1) infinite; }
.rail-presence { margin-top: 8px; font-size: .74rem; color: var(--success); line-height: 1.4; }
.presence-inline { color: var(--success); }
.message.is-leaving, .shout.is-leaving { opacity: 0; transition: opacity 240ms steps(4); }

/* ============================================================
   Shoutbox: an IRC-style log with a prompt
   ============================================================ */
.shoutbox .block-header { justify-content: space-between; }
.shout-status { font-family: var(--mono); font-size: .66rem; letter-spacing: 0; text-transform: lowercase; color: var(--muted-foreground); }
.shout-status::before { content: "● "; color: var(--muted-foreground); }
.shout-status.is-live::before { color: var(--success); text-shadow: 0 0 6px var(--success); }
.shout-status.is-offline::before { color: var(--warning); }
.shout-log { list-style: none; margin: 0; padding: 8px 10px; max-height: 320px; overflow-y: auto; font-size: .8rem; line-height: 1.5; overscroll-behavior: contain; }
.shoutbox--full .shout-log { max-height: min(62vh, 640px); font-size: .86rem; }
.shout { position: relative; display: block; padding: 1px 22px 1px 0; overflow-wrap: anywhere; }
.shout:hover { background: var(--hover); }
.shout.is-new { animation: crt-scan 220ms steps(5, end); }
.shout-time { color: var(--muted-foreground); font-variant-numeric: tabular-nums; margin-right: 4px; }
.shout-time::before { content: "["; } .shout-time::after { content: "]"; }
.shout-nick { color: var(--accent-dim); }
.shout-nick .username { color: var(--accent); font-weight: 700; }
.shout-text a { color: var(--link); text-decoration: underline dotted; }
.shout-del-form { position: absolute; right: 0; top: 0; display: inline; }
.shout-del { width: 20px; height: 20px; padding: 0; background: none; border: 0; color: var(--muted-foreground); cursor: pointer; font: inherit; opacity: 0; }
.shout:hover .shout-del, .shout-del:focus-visible { opacity: 1; }
.shout-del:hover { color: var(--destructive); }
@media (hover: none) { .shout-del { opacity: .7; } }
.shout-empty { padding: 10px 12px; color: var(--muted-foreground); font-size: .78rem; }
.shout-form { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px dashed var(--line); }
.shout-prompt { color: var(--accent); font-weight: 700; text-shadow: var(--glow); }
.shout-input { flex: 1; min-width: 0; height: 30px; padding: 0 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--accent-3); font: inherit; font-size: .84rem; caret-color: var(--accent); }
.shout-input:focus { outline: none; border-bottom-color: var(--accent); }
.shout-login { padding: 8px 12px; border-top: 1px dashed var(--line); color: var(--muted-foreground); }

/* Donor wall */
.donor-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.donor { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); background: var(--card); }
.donor.is-active { border-color: var(--accent-dim); }
.donor.is-active .avatar { border-color: var(--accent); box-shadow: var(--glow); }
.donation-code { font-size: 1rem; letter-spacing: .08em; }

/* @mention suggestions */
.mention-menu {
  position: absolute; z-index: 5000; min-width: 200px; max-width: 320px; margin: 0; padding: 4px; list-style: none;
  background: var(--card); color: var(--foreground); border: 1px solid var(--accent); box-shadow: var(--hard-shadow-sm);
  font-size: .84rem; animation: crt-scan 140ms steps(4, end);
}
.mention-menu li { display: flex; align-items: center; gap: 8px; padding: 5px 8px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention-menu li.is-active { background: var(--accent); color: var(--background); }
.mention-avatar { display: inline-grid; place-items: center; flex-shrink: 0; width: 20px; height: 20px; overflow: hidden; border: 1px solid var(--accent-dim); font-family: var(--pixel); font-size: .6rem; text-transform: uppercase; }
.mention-avatar img { width: 100%; height: 100%; object-fit: cover; }
.mention-menu li.is-active .mention-avatar { border-color: var(--background); }

/* Trophies */
.trophy-list { list-style: none; margin: 0; padding: 0; }
.trophy-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-top: 1px solid var(--line); }
.trophy-list li:first-child { border-top: 0; }
.trophy-points { flex: none; min-width: 2.6em; padding: 2px 6px; text-align: center; font-family: var(--mono); font-weight: 600; color: var(--accent); border: 1px solid var(--accent-dim); }
.trophy-list li:not(.is-earned) .trophy-points { color: var(--muted-foreground); border-color: var(--line); }
.trophy-list--compact li { padding: 8px 12px; }
.trophy-list--compact li .trophy-points { color: var(--accent); border-color: var(--accent-dim); }

/* Composer actions: submit/preview on the left, the draft group on the right. */
.composer-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-top: 12px; }
.block-footer.composer-actions { margin-top: 0; }
.composer-buttons { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.draft-controls { display: flex; align-items: baseline; justify-content: flex-end; gap: 4px 14px; flex: 1 1 260px; min-width: 0;
  font-family: var(--mono); font-size: .78rem; color: var(--muted-foreground); }
.draft-status { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.draft-status.is-alert { white-space: normal; color: var(--warning); }
.draft-controls:has(.is-alert) { flex-wrap: wrap; }
.draft-actions { display: inline-flex; flex: none; gap: 12px; }
.draft-link { padding: 0; border: 0; background: none; font: inherit; color: var(--muted-foreground); text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.draft-link:hover, .draft-link:focus-visible { color: var(--accent); }
.draft-link::before, .draft-link::after { content: none; }
@media (max-width: 600px) {
  .draft-controls { flex-basis: 100%; justify-content: space-between; }
}

/* Live reaction summary updates */
.live-reactions:empty { display: none; }
.live-reactions.is-updated .reactions-summary { animation: reaction-flash 900ms ease-out; }
@keyframes reaction-flash { from { color: var(--accent); text-shadow: 0 0 8px var(--glow); } to { color: inherit; text-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .live-reactions.is-updated .reactions-summary { animation: none; } }

/* Media gallery */
.media-categories { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.media-categories .chip { padding: 3px 9px; font-size: .78rem; }
.media-categories .chip.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-softer); }
.media-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.media-tile a { position: relative; display: block; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); background: var(--muted); color: var(--foreground); }
.media-tile a:hover, .media-tile a:focus-visible { border-color: var(--accent); }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform var(--dur-fast, 120ms) ease-out; }
.media-tile a:hover img { transform: scale(1.03); }
.media-tile-placeholder { display: grid; place-items: center; align-content: center; gap: 4px; height: 100%; font-size: 2rem; color: var(--accent); }
.media-tile-placeholder small { font-family: var(--mono); font-size: .7rem; color: var(--muted-foreground); text-transform: lowercase; }
.media-tile-badge { position: absolute; top: 6px; left: 6px; padding: 0 5px; font-family: var(--mono); font-size: .66rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent-fg); background: var(--accent); }
.media-tile-caption { position: absolute; inset: auto 0 0 0; padding: 18px 8px 6px; display: grid; gap: 1px;
  background: linear-gradient(transparent, color-mix(in srgb, var(--background) 92%, transparent) 55%); }
.media-tile-title { font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-tile-meta { font-family: var(--mono); font-size: .68rem; color: var(--muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-more { display: flex; justify-content: center; margin: 18px 0; }
.media-album-list { list-style: none; margin: 0; padding: 10px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.media-album a { display: flex; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--line); color: inherit; }
.media-album a:hover, .media-album a:focus-visible { border-color: var(--accent); }
.media-album-cover { flex: none; width: 56px; height: 56px; display: grid; place-items: center; background: var(--muted); overflow: hidden; color: var(--accent); font-size: 1.4rem; }
.media-album-cover img { width: 100%; height: 100%; object-fit: cover; }
.media-album-text { display: grid; min-width: 0; }
.media-album-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-stage { position: relative; display: grid; place-items: center; padding: 0; background: #000; min-height: 200px; }
.media-stage-image, .media-stage-video, .media-stage-embed { display: block; width: 100%; }
.media-stage-image img { display: block; max-width: 100%; max-height: 78vh; width: auto; height: auto; margin: 0 auto; }
.media-stage-video { max-height: 78vh; background: #000; }
.media-stage-embed { padding: 0; }
/* Embeds fill the stage (posts cap them at 680px), staying 16:9 and within the screen height like videos. */
.media-stage-embed .bbc-media { max-width: min(100%, calc(78vh * 16 / 9)); margin: 0 auto; border: 0; }
.media-stage-embed .bbc-media-spotify { max-width: 100%; }
.media-pager { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; pointer-events: none; padding: 8px; }
.media-pager-link { pointer-events: auto; padding: 2px 8px; font-family: var(--mono); font-size: .76rem; color: var(--accent); background: color-mix(in srgb, #000 70%, transparent); border: 1px solid var(--accent-dim); }
.media-pager-link:hover, .media-pager-link:focus-visible { background: var(--accent); color: var(--accent-fg); }
.media-stage:has(video) .media-pager, .media-stage:has(.media-stage-embed) .media-pager { position: static; background: var(--card); }
.media-comment { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); }
.media-comment:first-child { border-top: 0; }
.media-comment.is-deleted { opacity: .6; }
.media-comment-main { min-width: 0; flex: 1; }
.media-comment-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin-bottom: 2px; }
.media-comment.is-new { animation: crt-scan 300ms steps(10, end); }
.media-comment-form { padding: 12px 14px; border-top: 1px solid var(--line); }
.media-comments .typing-indicator { margin: 4px 14px; }
.media-author { display: flex; gap: 10px; align-items: center; }
.media-drop { position: relative; display: grid; gap: 4px; justify-items: start; padding: 16px; border: 1px dashed var(--accent-dim); cursor: pointer; }
.media-drop.is-over, .media-drop:focus-within { border-color: var(--accent); background: var(--accent-softer); }
/* The whole box is the picker; the native control stays focusable for keyboards and readers. */
.media-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.media-drop:focus-within { outline: 2px solid var(--ring); outline-offset: 2px; }
.media-drop-text { display: inline-flex; gap: 6px; align-items: center; }
.media-queue { margin: 10px 0 0; padding-left: 20px; font-size: .82rem; display: grid; gap: 3px; }
.media-queue-name { overflow-wrap: anywhere; }
.media-queue-state { font-family: var(--mono); font-size: .72rem; color: var(--muted-foreground); }
.media-queue-state.is-ok { color: var(--success); }
.media-queue-state.is-error { color: var(--destructive); }
@media (max-width: 600px) {
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { .media-tile img { transition: none; } .media-tile a:hover img { transform: none; } }

/* Forms whose field needs the full width (editors) */
.form-row--stacked { grid-template-columns: minmax(0, 1fr); }

/* Resources */
.resource-list { list-style: none; margin: 0; padding: 0; }
.resource-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); }
.resource-row:first-child { border-top: 0; }
.resource-icon { display: grid; place-items: center; width: 42px; height: 42px; font-family: var(--pixel); font-size: 1rem;
  color: var(--accent-fg); background: hsl(var(--hue, 30) 70% 45%); border: 1px solid var(--accent-dim); }
.resource-icon--large { width: 64px; height: 64px; font-size: 1.5rem; flex: none; }
.resource-title { font-weight: 600; }
.resource-tagline { font-size: .84rem; color: var(--foreground); margin-top: 2px; }
.resource-meta { margin-top: 2px; }
.resource-stats { text-align: right; white-space: nowrap; }
.resource-heading { display: flex; gap: 14px; align-items: flex-start; }
.resource-categories { list-style: none; margin: 0; padding: 8px 14px; display: grid; gap: 4px; font-size: .84rem; }
.resource-categories a.is-active { color: var(--accent); font-weight: 600; }
.resource-categories a.is-active::before { content: "> "; }
.stars { display: inline-flex; gap: 1px; color: var(--line); font-size: .95em; letter-spacing: 0; vertical-align: baseline; }
.star.is-on { color: var(--accent); }
.star.is-half { background: linear-gradient(90deg, var(--accent) 50%, var(--line) 50%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.star-input { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; border: 0; padding: 0; margin: 0 0 8px; }
.star-input legend { float: left; margin-right: 10px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 1.6rem; line-height: 1; color: var(--line); cursor: pointer; }
.star-input input:checked ~ label, .star-input label:hover, .star-input label:hover ~ label { color: var(--accent); }
.star-input input:focus-visible + label { outline: 2px solid var(--ring); outline-offset: 2px; }
.resource-review-head { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 6px; }
.resource-review-delete { margin-left: auto; }
.resource-review-response { margin-top: 10px; padding: 8px 12px; border-left: 2px solid var(--accent-dim); background: var(--accent-softer); }
.resource-review-reply { margin-top: 8px; }
.resource-review-reply form { display: grid; gap: 6px; margin-top: 6px; justify-items: start; }
.resource-facts { padding: 12px 14px; }
.resource-file { max-width: 100%; }
.external-download { overflow-wrap: anywhere; text-transform: none; }
@media (max-width: 600px) {
  .resource-row { grid-template-columns: auto minmax(0, 1fr); }
  .resource-stats { grid-column: 2; text-align: left; }
  .resource-heading .resource-icon--large { width: 44px; height: 44px; font-size: 1.1rem; }
}

/* API keys */
.api-key-secret { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.api-key-secret code { font-size: .9rem; padding: 4px 8px; overflow-wrap: anywhere; user-select: all; }
.data-table tr.is-muted td { opacity: .55; }
.api-docs h2 { font-family: var(--pixel); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 18px 0 8px; }
.api-docs h2:first-child { margin-top: 0; }
.api-endpoints code { white-space: nowrap; }

/* Updates */
.label--warning { color: var(--warning); border-color: var(--warning); }
.text-error { color: var(--destructive); }
.update-status { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-bottom: 14px; color: var(--muted-foreground); }
.update-release { padding: 14px 16px; border-top: 1px solid var(--line); }
.update-release:first-of-type { border-top: 0; }
.update-release-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 8px; }
.update-release-head h2 { margin: 0; font-family: var(--display); font-size: 1.4rem; color: var(--accent); }
.update-section h3 { margin: 10px 0 4px; font-family: var(--pixel); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-foreground); }
.update-section ul { margin: 0; padding-left: 20px; }
.update-section li { margin: 2px 0; }
.update-section--added h3::before { content: "+ "; color: var(--success); }
.update-section--fixed h3::before { content: "✓ "; color: var(--accent); }
.update-section--changed h3::before { content: "~ "; color: var(--accent); }
.update-section--removed h3::before { content: "- "; color: var(--destructive); }
.update-section--security h3 { color: var(--warning); }
.update-section--security h3::before { content: "! "; }
.update-notes ul { margin: 4px 0 0; padding-left: 20px; }
.update-progress .update-step { font-family: var(--mono); color: var(--accent); margin-bottom: 8px; }
.update-progress .update-step::before { content: "> "; color: var(--accent-dim); }
.update-log { max-height: 320px; overflow: auto; margin: 0; padding: 10px; background: var(--background); border: 1px solid var(--line); font-size: .78rem; white-space: pre-wrap; }
.update-log:empty { display: none; }
.update-banner a { font-weight: 600; }
