/* espressostream — site stylesheet (design system + pages).
   Neutral dark/light themes with one espresso/amber accent. Theme: follows the system unless
   <html data-theme="light|dark"> is set (site.js, remembered in localStorage). No inline styles (strict CSP). */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light;
  /* colours: light */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f0f0ed;
  --surface-3: #e7e7e3;
  --border: #deded9;
  --border-strong: #c9c9c3;
  --text: #18181b;
  --text-2: #3f3f46;
  --muted: #5f5f68;          /* 5.9:1 on --bg */
  --accent: #9a5200;         /* links/text: 5.6:1 on --surface */
  --accent-hover: #7d4200;
  --accent-bg: #b86a12;      /* filled buttons (with --on-accent) */
  --accent-bg-hover: #9a5200;
  --on-accent: #ffffff;
  --accent-soft: #fbefdf;
  --accent-line: #f0d2a8;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --danger-line: #f5c2bd;
  --success: #1f7a3a;
  --success-bg: #e8f5ec;
  --success-line: #bfe3c9;
  --info-bg: #eef1f6;
  --info-line: #d3dae6;
  --live: #d92d20;
  --mark-bg: #fde7c2;
  --term-bg: #16161a;        /* card previews look like a terminal in both themes */
  --term-fg: #d6d6dc;
  --term-dim: #8a8a94;
  --focus: #b86a12;
  --shadow-1: 0 1px 2px rgb(16 16 20 / .06), 0 1px 1px rgb(16 16 20 / .04);
  --shadow-2: 0 4px 16px rgb(16 16 20 / .08), 0 1px 3px rgb(16 16 20 / .06);
  --shadow-3: 0 12px 32px rgb(16 16 20 / .16), 0 2px 6px rgb(16 16 20 / .08);

  /* type */
  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;
  --fs-xs: .75rem;   /* 12 */
  --fs-sm: .8125rem; /* 13 */
  --fs-md: .9375rem; /* 15 */
  --fs-base: 1rem;   /* 16 */
  --fs-lg: 1.125rem; /* 18 */
  --fs-xl: 1.375rem; /* 22 */
  --fs-2xl: 1.75rem; /* 28 */
  --fs-3xl: 2.25rem; /* 36 */

  /* spacing (4 px grid) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;
  --sp-8: 32px; --sp-10: 40px; --sp-12: 48px; --sp-16: 64px;

  /* radii */
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-pill: 999px;

  --header-h: 56px;
  --container: 1200px;
  --gutter: 16px;
}

/* dark: the system preference unless the visitor picked light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0e10;
    --surface: #161619;
    --surface-2: #1d1d21;
    --surface-3: #26262b;
    --border: #2a2a30;
    --border-strong: #3a3a41;
    --text: #ececef;
    --text-2: #c9c9cf;
    --muted: #9d9da7;        /* 7.4:1 on --bg */
    --accent: #f0ae55;       /* 9.6:1 on --bg */
    --accent-hover: #f7c77f;
    --accent-bg: #e89b3a;
    --accent-bg-hover: #f2ae55;
    --on-accent: #1a1206;
    --accent-soft: #2a1f12;
    --accent-line: #5a3f1c;
    --danger: #ff8a7d;
    --danger-bg: #2c1513;
    --danger-line: #5c2a24;
    --success: #7fd497;
    --success-bg: #12241a;
    --success-line: #24492f;
    --info-bg: #171c24;
    --info-line: #2a3342;
    --live: #ff5a4c;
    --mark-bg: #5a3f1c;
    --term-bg: #0b0b0d;
    --focus: #f0ae55;
    --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
    --shadow-2: 0 4px 16px rgb(0 0 0 / .35), 0 1px 3px rgb(0 0 0 / .3);
    --shadow-3: 0 12px 32px rgb(0 0 0 / .55), 0 2px 6px rgb(0 0 0 / .4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e10;
  --surface: #161619;
  --surface-2: #1d1d21;
  --surface-3: #26262b;
  --border: #2a2a30;
  --border-strong: #3a3a41;
  --text: #ececef;
  --text-2: #c9c9cf;
  --muted: #9d9da7;
  --accent: #f0ae55;
  --accent-hover: #f7c77f;
  --accent-bg: #e89b3a;
  --accent-bg-hover: #f2ae55;
  --on-accent: #1a1206;
  --accent-soft: #2a1f12;
  --accent-line: #5a3f1c;
  --danger: #ff8a7d;
  --danger-bg: #2c1513;
  --danger-line: #5c2a24;
  --success: #7fd497;
  --success-bg: #12241a;
  --success-line: #24492f;
  --info-bg: #171c24;
  --info-line: #2a3342;
  --live: #ff5a4c;
  --mark-bg: #5a3f1c;
  --term-bg: #0b0b0d;
  --focus: #f0ae55;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 4px 16px rgb(0 0 0 / .35), 0 1px 3px rgb(0 0 0 / .3);
  --shadow-3: 0 12px 32px rgb(0 0 0 / .55), 0 2px 6px rgb(0 0 0 / .4);
}

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 8px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: var(--fs-base)/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: 100%; max-width: var(--container); margin: 0 auto; padding: var(--sp-6) var(--gutter) var(--sp-12); }
@media (min-width: 768px) { :root { --gutter: 24px; } main { padding-top: var(--sp-8); } }
@media (min-width: 1280px) { :root { --gutter: 32px; } }

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-base); }
@media (min-width: 768px) { h1 { font-size: var(--fs-3xl); letter-spacing: -.02em; } }
p { margin: 0 0 var(--sp-3); }
a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: .05em .35em; overflow-wrap: anywhere; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 .4em; text-align: center;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px;
  background: var(--surface); font-size: var(--fs-xs); line-height: 1.6;
}
mark { background: var(--mark-bg); color: inherit; border-radius: 2px; padding: 0 1px; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-6) 0; }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent-bg) 35%, transparent); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.skip-link { position: absolute; left: var(--sp-2); top: var(--sp-2); transform: translateY(-200%); z-index: 100; padding: var(--sp-2) var(--sp-3); background: var(--surface); border-radius: var(--r-sm); box-shadow: var(--shadow-2); }
.skip-link:focus { transform: none; }

/* ---------- 3. Utilities ---------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.hint { color: var(--muted); font-size: var(--fs-sm); margin: 0; }
.stack { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack > * { margin-top: 0; margin-bottom: 0; }
.narrow { max-width: 30rem; }
.secret { word-break: break-all; user-select: all; }
.sep { color: var(--border-strong); margin: 0 .35em; }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-lg { width: 20px; height: 20px; }

/* ---------- 4. Header / nav / footer ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--container); margin: 0 auto; height: var(--header-h);
  padding: 0 var(--gutter); display: flex; align-items: center; gap: var(--sp-3);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: -.01em; flex: none; }
.brand:hover { color: var(--text); }
.brand-mark { width: 28px; height: 28px; }
.brand-name { font-size: var(--fs-lg); }
@media (max-width: 459px) { .brand-name { display: none; } }
.header-search { flex: 1; max-width: 420px; margin-left: var(--sp-4); position: relative; display: none; }
@media (min-width: 720px) { .header-search { display: block; } .search-link { display: none !important; } }
.header-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.header-search input {
  width: 100%; height: 36px; padding: 0 var(--sp-3) 0 34px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md);
}
.header-search input::placeholder { color: var(--muted); }
.header-search input:focus { outline: none; border-color: var(--accent-bg); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bg) 25%, transparent); }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-1); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  background: transparent; color: var(--text-2); border: 1px solid transparent; border-radius: var(--r-md);
  cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle .t-sun, .theme-toggle .t-moon, .theme-toggle .t-auto { display: none; }
.theme-toggle[data-mode="light"] .t-sun, .theme-toggle[data-mode="dark"] .t-moon,
.theme-toggle:not([data-mode="light"]):not([data-mode="dark"]) .t-auto { display: block; }

/* user menu (a <details> dropdown: works without JS; site.js closes it on outside click / Esc) */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-trigger { display: inline-flex; align-items: center; gap: var(--sp-2); height: 36px; padding: 0 var(--sp-2) 0 4px; border-radius: var(--r-md); color: var(--text); }
.menu-trigger:hover, .menu[open] > .menu-trigger { background: var(--surface-2); }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
  font-weight: 700; font-size: var(--fs-sm); text-transform: uppercase;
}
.menu-trigger .menu-name { max-width: 10rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-md); }
@media (max-width: 459px) { .menu-trigger .menu-name { display: none; } }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); padding: var(--sp-1); margin: 0; list-style: none;
}
.menu-panel a, .menu-panel button {
  display: flex; width: 100%; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3);
  color: var(--text); text-decoration: none; border-radius: var(--r-sm);
  background: none; border: 0; text-align: left; cursor: pointer; font-size: var(--fs-md);
}
.menu-panel a:hover, .menu-panel button:hover { background: var(--surface-2); }
.menu-panel .menu-label { padding: var(--sp-2) var(--sp-3) var(--sp-1); color: var(--muted); font-size: var(--fs-xs); }
.menu-panel hr { margin: var(--sp-1) 0; }
.menu-panel form { margin: 0; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-sm); }
.footer-inner {
  max-width: var(--container); margin: 0 auto; padding: var(--sp-6) var(--gutter);
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-6); align-items: center; justify-content: space-between;
}
.footer-inner .brand-mark { width: 20px; height: 20px; }
.footer-brand { display: inline-flex; align-items: center; gap: var(--sp-2); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--sp-4); }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* ---------- 5. Buttons ---------- */
.btn, .form button, .inline-form button:not(.link-button) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: 40px; padding: 0 var(--sp-4);
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-weight: 550; font-size: var(--fs-md); line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer; box-shadow: var(--shadow-1);
  transition: background-color .12s, border-color .12s, color .12s;
}
.btn:hover, .form button:hover, .inline-form button:not(.link-button):hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-primary, .form button.btn-primary, .form button[type="submit"]:not(.btn-danger):not(.btn-secondary) {
  background: var(--accent-bg); color: var(--on-accent); border-color: transparent;
}
.btn-primary:hover, .form button.btn-primary:hover, .form button[type="submit"]:not(.btn-danger):not(.btn-secondary):hover {
  background: var(--accent-bg-hover); color: var(--on-accent); border-color: transparent;
}
.btn-danger, .form button.btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
:root[data-theme="dark"] .btn-danger { color: #1a0906; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-danger { color: #1a0906; } }
.btn-danger:hover, .form button.btn-danger:hover { background: color-mix(in srgb, var(--danger) 85%, var(--text)); color: #fff; border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-sm, .inline-form button:not(.link-button) { min-height: 32px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.inline-form { display: inline; margin: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* ---------- 6. Forms ---------- */
.form { display: grid; gap: var(--sp-4); max-width: 30rem; margin: 0; }
.form label, .field { display: grid; gap: 6px; font-weight: 550; font-size: var(--fs-md); }
.form label > .hint { font-weight: 400; }
.form label:has(input[type=checkbox]) { display: flex; gap: var(--sp-2); align-items: center; font-weight: 400; }
.form button { justify-self: start; }
:where(input:not([type=checkbox], [type=radio], [type=hidden]), select, textarea) {
  width: 100%; min-height: 40px; padding: var(--sp-2) var(--sp-3);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  font-weight: 400; font-size: var(--fs-base);
}
textarea { min-height: 80px; resize: vertical; line-height: 1.45; }
select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-bg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-bg) 25%, transparent); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent-bg); margin: 0; }
.code-field, .embed-code { font-family: var(--font-mono); font-size: var(--fs-sm); background: var(--surface-2); }

/* ---------- 7. Cards, badges, alerts, tables ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-5); box-shadow: var(--shadow-1);
}
.card > :last-child { margin-bottom: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card + .card { margin-top: var(--sp-4); }
.panel-grid { display: grid; gap: var(--sp-4); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px;
  border-radius: var(--r-pill); border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; line-height: 1; white-space: nowrap; vertical-align: 2px;
  text-transform: lowercase;
}
.badge-private { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.badge-unlisted { background: var(--info-bg); border-color: var(--info-line); color: var(--text-2); }
.badge-public { background: var(--success-bg); border-color: var(--success-line); color: var(--success); }
.badge-live { background: var(--live); border-color: transparent; color: #fff; text-transform: uppercase; letter-spacing: .04em; }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.alert, .error, .notice {
  display: flex; gap: var(--sp-3); align-items: flex-start; padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--info-line); background: var(--info-bg); border-radius: var(--r-md); color: var(--text);
  margin: 0 0 var(--sp-4); font-size: var(--fs-md);
}
.alert > :last-child { margin-bottom: 0; }
.alert-error, .error { border-color: var(--danger-line); background: var(--danger-bg); color: var(--danger); }
.alert-success, .notice { border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.alert-warn { border-color: var(--accent-line); background: var(--accent-soft); }
.alert-stack { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
.alert-stack > * { margin: 0; min-width: 0; }

.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.table { border-collapse: collapse; width: 100%; font-size: var(--fs-md); }
.table th, .table td { text-align: left; padding: 10px var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table thead th { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot th, .table tfoot td { border-top: 1px solid var(--border); border-bottom: 0; font-weight: 600; background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.actions-cell { text-align: right; }

.empty, .empty-state {
  color: var(--muted); text-align: center; padding: var(--sp-10) var(--sp-4);
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface);
}
.empty-state .icon { width: 32px; height: 32px; margin: 0 auto var(--sp-3); color: var(--muted); }
.empty-state h2 { color: var(--text); margin-bottom: var(--sp-2); font-size: var(--fs-lg); }
.empty-state p:last-child { margin-bottom: 0; }

.pager { display: flex; justify-content: space-between; gap: var(--sp-3); margin: var(--sp-8) 0 0; }
.pager .spacer { flex: 1; }

/* ---------- 8. Page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--sp-3) var(--sp-6); margin-bottom: var(--sp-6); }
.page-head p { margin: var(--sp-2) 0 0; color: var(--muted); }
.page-head .eyebrow { margin: 0 0 var(--sp-1); color: var(--accent); font-size: var(--fs-sm); font-weight: 600; letter-spacing: .02em; }
.section { margin-top: var(--sp-10); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.section-head h2 { font-size: var(--fs-xl); }

/* home hero */
.hero { padding: var(--sp-4) 0 var(--sp-6); }
.hero h1 { max-width: 20ch; }
.hero p { max-width: 54ch; color: var(--text-2); font-size: var(--fs-lg); margin: var(--sp-3) 0 var(--sp-5); }
.hero .cmd {
  display: inline-flex; align-items: center; gap: var(--sp-3); max-width: 100%;
  padding: var(--sp-2) var(--sp-2) var(--sp-2) var(--sp-4); border-radius: var(--r-md);
  background: var(--term-bg); color: var(--term-fg); font-family: var(--font-mono); font-size: var(--fs-md);
  border: 1px solid var(--border);
}
.hero .cmd code { background: none; border: 0; padding: 0; color: inherit; overflow-x: auto; white-space: nowrap; }
.hero .cmd .prompt { color: var(--accent-bg); }
.hero .cmd .icon-btn { color: var(--term-dim); width: 32px; height: 32px; }
.hero .cmd .icon-btn:hover { background: rgb(255 255 255 / .08); color: var(--term-fg); }

/* ---------- 9. Recording cards ---------- */
.card-grid { display: grid; gap: var(--sp-4); grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
@media (min-width: 640px) { .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); } }
@media (min-width: 1600px) { :root { --container: 1440px; } .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rec-card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.rec-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.rec-card:focus-within { border-color: var(--accent-bg); }
.rec-preview {
  position: relative; margin: 0; height: 132px; overflow: hidden;
  padding: var(--sp-3) var(--sp-4); background: var(--term-bg); color: var(--term-fg);
  font: 11.5px/1.45 var(--font-mono); white-space: pre; border-bottom: 1px solid var(--border);
}
.rec-preview::after { content: ""; position: absolute; inset: auto 0 0 0; height: 36px; background: linear-gradient(transparent, var(--term-bg)); }
.rec-preview.is-empty { display: grid; place-items: center; color: var(--term-dim); }
.rec-preview .dur {
  position: absolute; right: var(--sp-2); bottom: var(--sp-2); z-index: 1;
  padding: 1px 6px; border-radius: 4px; background: rgb(0 0 0 / .72); color: #fff;
  font: 600 var(--fs-xs)/1.5 var(--font-ui); font-variant-numeric: tabular-nums;
}
.rec-body { padding: var(--sp-3) var(--sp-4) var(--sp-4); display: grid; gap: 6px; min-width: 0; }
.rec-title { font-weight: 600; font-size: var(--fs-base); line-height: 1.35; color: var(--text); text-decoration: none; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rec-title::after { content: ""; position: absolute; inset: 0; } /* whole card is the link */
.rec-title:hover { color: var(--text); }
.rec-title:focus-visible { outline: none; }
.rec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; color: var(--muted); font-size: var(--fs-sm); margin: 0; min-width: 0; }
.rec-meta > * + *::before { content: "·"; margin: 0 .45em; color: var(--border-strong); }
.rec-meta .badge::before { display: none; }
.rec-meta a { position: relative; z-index: 1; color: var(--text-2); text-decoration: none; font-weight: 550; }
.rec-meta a:hover { color: var(--accent); text-decoration: underline; }
.rec-meta .badge { margin-left: .45em; }
.rec-meta > .badge::before { content: none; }

/* search results (list) */
.result-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }
.result {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: var(--sp-4); display: grid; gap: var(--sp-2); box-shadow: var(--shadow-1);
}
.result:hover { border-color: var(--border-strong); }
.snippet {
  margin: var(--sp-1) 0 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text-2); font: var(--fs-sm)/1.5 var(--font-mono);
  white-space: pre-line; overflow-wrap: anywhere;
}
.search-form { display: flex; gap: var(--sp-2); margin: 0 0 var(--sp-6); max-width: 44rem; }
.search-form input { flex: 1; min-width: 0; min-height: 44px; }
.search-form .btn { min-height: 44px; }
.result-count { color: var(--muted); font-size: var(--fs-sm); margin: 0 0 var(--sp-3); }

/* ---------- 10. Auth pages ---------- */
.auth { max-width: 400px; margin: var(--sp-6) auto 0; }
@media (min-width: 768px) { .auth { margin-top: var(--sp-12); } }
.auth .brand-mark { width: 40px; height: 40px; margin: 0 auto var(--sp-4); }
.auth h1 { text-align: center; font-size: var(--fs-2xl); margin-bottom: var(--sp-2); }
.auth .sub { text-align: center; color: var(--muted); margin-bottom: var(--sp-6); }
.auth .card { padding: var(--sp-6); }
.auth .form { max-width: none; }
.auth .form button { justify-self: stretch; }
.auth .after { text-align: center; color: var(--muted); font-size: var(--fs-md); margin-top: var(--sp-5); }

/* ---------- 11. Settings / admin ---------- */
.settings-grid { display: grid; gap: var(--sp-6); grid-template-columns: minmax(0, 1fr); }
.settings-section { display: grid; gap: var(--sp-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .settings-section { grid-template-columns: 260px minmax(0, 1fr); gap: var(--sp-8); padding-top: var(--sp-6); border-top: 1px solid var(--border); }
  .settings-section:first-child { border-top: 0; padding-top: 0; }
}
.settings-section > header h2 { margin-bottom: var(--sp-2); }
.settings-section > header p { color: var(--muted); font-size: var(--fs-md); margin: 0; }
/* New token: full-width wrapping box, Copy below it on phones and beside it from 640px. */
.token-box { display: flex; flex-direction: column; gap: var(--sp-2); align-items: stretch; min-width: 0; }
.token-box code { display: block; padding: var(--sp-2) var(--sp-3); font-size: var(--fs-sm); line-height: 1.5; white-space: pre-wrap; word-break: break-all; overflow-wrap: anywhere; }
.token-box .btn { align-self: flex-start; }
@media (min-width: 640px) {
  .token-box { flex-direction: row; align-items: center; }
  .token-box code { flex: 1; }
  .token-box .btn { align-self: center; }
}
.stat-grid { display: grid; gap: var(--sp-3); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: var(--sp-6); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-4); }
.stat dt { color: var(--muted); font-size: var(--fs-sm); }
.stat dd { margin: var(--sp-1) 0 0; font-size: var(--fs-xl); font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---------- 11b. Downloads (/dl/) ---------- */
.dl-link { width: auto; min-width: 36px; gap: var(--sp-2); grid-auto-flow: column; padding: 0 var(--sp-2); }
.dl-link-text { display: none; font-size: var(--fs-sm); font-weight: 600; }
@media (min-width: 900px) { .dl-link-text { display: inline; } }
.hero .hero-dl { margin: var(--sp-4) 0 0; }
.h-code { font-size: .85em; padding: 0 .25em; }
.dl-page { display: grid; gap: var(--sp-8); max-width: 820px; }
.dl-section { display: grid; gap: var(--sp-3); }
.dl-section h2 { margin: 0; }
.dl-cmd { display: grid; gap: var(--sp-2); }
.dl-cmd-label { margin: 0; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.cmd-box {
  display: flex; flex-direction: column; gap: var(--sp-2); align-items: stretch;
  padding: var(--sp-2); border-radius: var(--r-md); background: var(--term-bg); border: 1px solid var(--border);
}
.cmd-box code {
  background: none; border: 0; color: var(--term-fg); padding: var(--sp-1) var(--sp-2);
  font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; user-select: all;
}
.cmd-box .btn { align-self: flex-end; }
@media (min-width: 640px) {
  .cmd-box { flex-direction: row; align-items: center; }
  .cmd-box code { flex: 1; min-width: 0; }
  .cmd-box .btn { align-self: center; }
}
.dl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .dl-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dl-item { display: grid; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); min-width: 0; }
.dl-item-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.dl-platform { font-weight: 600; display: inline-flex; align-items: center; gap: var(--sp-2); }
.dl-file { margin: 0; font-size: var(--fs-sm); color: var(--text-2); overflow-wrap: anywhere; }
.dl-sum { margin: 0; font-size: var(--fs-xs); display: grid; gap: var(--sp-1); }
.dl-sum code { font-size: var(--fs-xs); }

/* ---------- 12. Recording page ---------- */
.rec-page { display: grid; gap: var(--sp-6); }
.rec-head { display: grid; gap: var(--sp-3); }
.rec-head h1 { font-size: var(--fs-xl); }
@media (min-width: 768px) { .rec-head h1 { font-size: var(--fs-2xl); } }
.rec-byline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3); color: var(--muted); font-size: var(--fs-md); }
.rec-byline .user { display: inline-flex; align-items: center; gap: var(--sp-2); color: var(--text); font-weight: 600; text-decoration: none; }
.rec-byline .user:hover { color: var(--accent); }
.rec-byline .avatar { width: 24px; height: 24px; font-size: var(--fs-xs); }
.player-frame { min-width: 0; container-type: inline-size; }
/* The page reserves the player's height (no layout shift before or after it loads) and the player (`fill`)
   fits the terminal into it. Mirrors the player's own sizing: font = min(15px, width / (cols × 0.6),
   (80vh − 59px) / (rows × 1.17)), rounded down to .25px; + 16px padding + 43px controls. */
.player-frame espresso-player {
  --font: min(15px, (100cqw - 16px) / (var(--cols, 80) * .6), (80vh - 59px) / (var(--rows, 24) * 1.17));
  --font: round(down, min(15px, (100cqw - 16px) / (var(--cols, 80) * .6), (80vh - 59px) / (var(--rows, 24) * 1.17)), .25px);
  --player-h: calc(var(--font) * var(--rows, 24) * 1.17 + 59px);
}
.player-frame espresso-player:not(:defined) {
  display: block; height: var(--player-h);
  background: var(--term-bg); border-radius: 10px; box-shadow: 0 0 0 1px var(--border);
}
.player-frame espresso-player[fill] > .esp-player { height: var(--player-h); }
.h-small { font-size: var(--fs-sm); font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 var(--sp-3); }
.rec-byline .sep { margin: 0; }
.embed-code { font-family: var(--font-mono); font-size: var(--fs-sm); }
.rec-toolbar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.rec-toolbar .spacer { flex: 1; }
.rec-details { display: grid; gap: var(--sp-6); }
@media (min-width: 1024px) { .rec-details { grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-8); align-items: start; } }
/* one column: details first, so the chapters list (filled after the player loads) only pushes what is below it */
@media (max-width: 1023px) { .rec-details > aside { order: -1; } }
.rec-details > .stack:empty { display: none; }
.rec-description { max-width: 72ch; }
.description { white-space: pre-line; overflow-wrap: anywhere; color: var(--text-2); margin: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-2) var(--sp-4); margin: 0; font-size: var(--fs-md); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chapters button {
  display: flex; gap: var(--sp-3); width: 100%; align-items: baseline; padding: 6px var(--sp-2);
  background: none; border: 0; border-radius: var(--r-sm); text-align: left; cursor: pointer; color: var(--text);
}
.chapters button:hover { background: var(--surface-2); }
.chapters [aria-current="true"] button { background: var(--accent-soft); }
.chapters .t { font-family: var(--font-mono); font-size: var(--fs-sm); color: var(--accent); font-variant-numeric: tabular-nums; flex: none; min-width: 3.5em; }
.chapters .l { overflow-wrap: anywhere; }
.chapters .x { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.chapters .x.fail { color: var(--danger); }
.owner-panel { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.owner-panel + .owner-panel { margin-top: var(--sp-3); }
.owner-panel > summary {
  display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); cursor: pointer; list-style: none; font-weight: 600;
}
.owner-panel > summary::-webkit-details-marker { display: none; }
.owner-panel > summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.owner-panel[open] > summary::after { transform: rotate(-135deg); }
.owner-panel > summary .hint { font-weight: 400; }
.owner-panel > .panel-body { padding: 0 var(--sp-4) var(--sp-4); }
.rec-edit form, .owner-panel form { display: grid; gap: var(--sp-4); max-width: 36rem; }
.rec-edit label { display: grid; gap: 6px; font-weight: 550; font-size: var(--fs-md); }
.rec-edit label:has(input[type=checkbox]) { display: flex; gap: var(--sp-2); align-items: center; font-weight: 400; }
.rec-edit button { justify-self: start; }
.rec-edit output { color: var(--muted); font-size: var(--fs-sm); }
.keys { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); color: var(--muted); font-size: var(--fs-sm); margin: 0; padding: 0; list-style: none; }
.keys li { display: inline-flex; gap: 6px; align-items: center; }
@media (hover: none) and (max-width: 767px) { .keys-card { display: none; } }
.copy-row { display: flex; gap: var(--sp-2); }
.copy-row input, .copy-row textarea { flex: 1; min-width: 0; }
.danger-zone { border-color: var(--danger-line); }
.toast {
  position: fixed; left: 50%; bottom: var(--sp-6); transform: translateX(-50%) translateY(20px); z-index: 50;
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill); background: var(--text); color: var(--bg);
  font-size: var(--fs-md); font-weight: 550; box-shadow: var(--shadow-3); opacity: 0; pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* live page */
.live-note { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }

/* error page */
.error-page { text-align: center; max-width: 34rem; margin: var(--sp-10) auto; }
.error-page .code { font: 700 4.5rem/1 var(--font-mono); color: var(--accent); letter-spacing: -.04em; margin-bottom: var(--sp-4); }
.error-page h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); }
.error-page p { color: var(--muted); }
.error-page .btn-row { justify-content: center; margin-top: var(--sp-6); }

/* delete confirm */
.confirm { max-width: 34rem; margin: var(--sp-6) auto 0; }
.confirm .card { border-color: var(--danger-line); }
.confirm h1 { font-size: var(--fs-2xl); margin-bottom: var(--sp-3); }

/* ---------- 13. Embed (/e/<id>): chrome-light ---------- */
body.embed { display: block; min-height: 0; background: transparent; }
body.embed espresso-player { display: block; }
.embed-credit {
  display: flex; align-items: center; gap: 6px; margin: 0; padding: 6px 10px;
  font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; overflow: hidden;
}
.embed-credit a { color: var(--text-2); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.embed-credit a:hover { color: var(--accent); }
.embed-credit .brand-mark { width: 14px; height: 14px; flex: none; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
