/* QQplay — hand-written stylesheet, no framework.
 *
 *  1. tokens (dark default, light theme)
 *  2. base
 *  3. shell: topbar, sidebar, main, footer
 *  4. primitives: buttons, inputs, chips, badges, avatars, panels
 *  5. library: hero, grids, media cards, filters, pager
 *  6. watch page
 *  7. comments
 *  8. upload, studio, edit, playlists, subtitles, manage
 *  9. auth, errors, toasts, dropdowns, utilities
 * 10. status page, API browser
 */

/* ------------------------------------------------------------------ 1 */

:root {
  color-scheme: dark;

  --bg: #05070c;
  --bg-2: #070a11;
  --surface: #0b1019;
  --surface-2: #101724;
  --surface-3: #162033;
  --glass: rgba(9, 13, 21, 0.72);
  --line: rgba(148, 163, 184, 0.12);
  --line-2: rgba(148, 163, 184, 0.22);
  --text: #e8eef6;
  --text-2: #c2ccda;
  --muted: #8794a8;
  --faint: #5a677b;

  --brand-1: #2ee6a6;
  --brand-2: #22d3ee;
  --brand-3: #7c6cff;
  --accent: #22d3ee;
  --accent-ink: #02131a;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --accent-ring: rgba(34, 211, 238, 0.5);
  --grad: linear-gradient(120deg, #2ee6a6 0%, #22d3ee 45%, #7c6cff 100%);
  --grad-btn: linear-gradient(120deg, #2ee6a6 0%, #22d3ee 100%);
  --grad-soft: linear-gradient(120deg, rgba(46, 230, 166, 0.14), rgba(34, 211, 238, 0.1) 45%, rgba(124, 108, 255, 0.16));

  --danger: #ff5c7a;
  --danger-soft: rgba(255, 92, 122, 0.12);
  --warning: #ffb547;
  --warning-soft: rgba(255, 181, 71, 0.13);
  --success: #2ee6a6;
  --success-soft: rgba(46, 230, 166, 0.12);
  --info: #22d3ee;
  --violet-soft: rgba(124, 108, 255, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow: 0 12px 32px -14px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 28px 70px -24px rgba(0, 0, 0, 0.8);
  --glow: 0 0 0 1px rgba(34, 211, 238, 0.35), 0 10px 34px -10px rgba(34, 211, 238, 0.45);

  --grid-line: rgba(148, 163, 184, 0.06);
  --aurora-a: rgba(46, 230, 166, 0.13);
  --aurora-b: rgba(124, 108, 255, 0.14);
  --thumb-bg: #0e1522;
  --scrim: rgba(2, 4, 9, 0.66);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --pill: 999px;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --topbar-h: 64px;
  --sidebar-w: 248px;
  --rail-w: 84px;
  --content-max: 1680px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 140ms;
  --slow: 260ms;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f7fb;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e7ecf4;
  --glass: rgba(255, 255, 255, 0.78);
  --line: rgba(15, 23, 42, 0.09);
  --line-2: rgba(15, 23, 42, 0.16);
  --text: #0a1120;
  --text-2: #334155;
  --muted: #5a6a81;
  --faint: #94a3b8;

  --brand-1: #0ea472;
  --brand-2: #0891b2;
  --brand-3: #5b4cf0;
  --accent: #0891b2;
  --accent-ink: #03161d;
  --accent-soft: rgba(8, 145, 178, 0.1);
  --accent-ring: rgba(8, 145, 178, 0.45);
  --grad: linear-gradient(120deg, #10b981 0%, #06b6d4 45%, #6d5bf5 100%);
  --grad-btn: linear-gradient(120deg, #34d399 0%, #22d3ee 100%);
  --grad-soft: linear-gradient(120deg, rgba(16, 185, 129, 0.1), rgba(6, 182, 212, 0.08) 45%, rgba(109, 91, 245, 0.1));

  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.09);
  --warning: #b45309;
  --warning-soft: rgba(217, 119, 6, 0.12);
  --success: #059669;
  --success-soft: rgba(5, 150, 105, 0.1);
  --info: #0891b2;
  --violet-soft: rgba(91, 76, 240, 0.1);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
  --shadow: 0 12px 30px -16px rgba(15, 23, 42, 0.25);
  --shadow-lg: 0 30px 70px -28px rgba(15, 23, 42, 0.35);
  --glow: 0 0 0 1px rgba(8, 145, 178, 0.35), 0 10px 30px -12px rgba(8, 145, 178, 0.35);

  --grid-line: rgba(15, 23, 42, 0.05);
  --aurora-a: rgba(16, 185, 129, 0.1);
  --aurora-b: rgba(109, 91, 245, 0.1);
  --thumb-bg: #e4e9f2;
  --scrim: rgba(15, 23, 42, 0.38);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f5f7fb;
    --bg-2: #ffffff;
    --surface: #ffffff;
    --surface-2: #f1f4f9;
    --surface-3: #e7ecf4;
    --glass: rgba(255, 255, 255, 0.78);
    --line: rgba(15, 23, 42, 0.09);
    --line-2: rgba(15, 23, 42, 0.16);
    --text: #0a1120;
    --text-2: #334155;
    --muted: #5a6a81;
    --faint: #94a3b8;
    --accent: #0891b2;
    --accent-soft: rgba(8, 145, 178, 0.1);
    --thumb-bg: #e4e9f2;
    --scrim: rgba(15, 23, 42, 0.38);
    --grid-line: rgba(15, 23, 42, 0.05);
  }
}

/* ------------------------------------------------------------------ 2 */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }

html,
body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--font-sans);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Two soft aurora glows behind everything; fixed so they never scroll. */
body::before {
  content: "";
  position: fixed;
  inset: -20vh -10vw auto -10vw;
  height: 70vh;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(40% 60% at 12% 18%, var(--aurora-a), transparent 70%),
    radial-gradient(38% 55% at 88% 6%, var(--aurora-b), transparent 70%);
  filter: blur(8px);
}

[hidden] { display: none !important; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

img,
svg,
video { display: block; max-width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0;
  color: var(--text);
}

p { margin: 0; }

::selection { background: rgba(34, 211, 238, 0.32); color: var(--text); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

.icon {
  display: inline-block;
  vertical-align: -0.2em;
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 16px; height: 16px; }
.icon-xs { width: 14px; height: 14px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-spin { animation: spin 1s linear infinite; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.skip-link:focus { top: 12px; color: var(--accent-ink); }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; letter-spacing: -0.01em; }
.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-1);
  box-shadow: 0 0 0 0 rgba(46, 230, 166, 0.6);
  animation: pulse 2.2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 230, 166, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(46, 230, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 230, 166, 0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ 3 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px 0 14px;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--grad);
  opacity: 0.35;
  pointer-events: none;
}

.topbar-start { display: flex; align-items: center; gap: 8px; min-width: 0; }

.brand { display: inline-flex; align-items: center; padding: 6px 4px; border-radius: var(--radius-sm); }
.brand img { height: 32px; width: auto; }
.brand .logo-light { display: none; }
:root[data-theme="light"] .brand .logo-dark { display: none; }
:root[data-theme="light"] .brand .logo-light { display: block; }

.search {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}
.search-box {
  position: relative;
  width: 100%;
  max-width: 620px;
}
.search-box .icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.search-box input {
  width: 100%;
  height: 42px;
  padding: 0 64px 0 44px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.search-box input::placeholder { color: var(--faint); }
.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  outline: none;
}
.search-box kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  background: var(--surface-2);
  color: var(--muted);
  font: 500 11.5px/1 var(--font-mono);
}

.topbar-end { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--pill);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--fast), color var(--fast), border-color var(--fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.icon-btn .icon-moon { display: none; }
:root[data-theme="light"] .icon-btn .icon-sun { display: none; }
:root[data-theme="light"] .icon-btn .icon-moon { display: block; }

.search-toggle { display: none; }

.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  padding: 14px 12px 20px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2), transparent 70%);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-section { display: flex; flex-direction: column; gap: 2px; }
.nav-section + .nav-section { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.nav-title { padding: 4px 12px 6px; font: 500 11px/1.2 var(--font-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--fast), color var(--fast);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--text); }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--grad);
}
.nav-link.active .icon { color: var(--accent); }
.nav-link .nav-count {
  margin-left: auto;
  font: 500 11.5px/1 var(--font-mono);
  color: var(--muted);
  background: var(--surface-3);
  border-radius: var(--pill);
  padding: 4px 7px;
}
.nav-dot { width: 8px; height: 8px; border-radius: 3px; background: var(--grad); flex: none; margin: 0 6px; }

.sidebar-foot {
  margin-top: auto;
  padding: 14px 12px 0;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sidebar-foot a:hover { color: var(--accent); }
.status-line { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11.5px; }

/* Collapsed desktop sidebar: an icon rail. */
:root[data-sidebar="collapsed"] .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
:root[data-sidebar="collapsed"] .sidebar { padding-inline: 8px; }
:root[data-sidebar="collapsed"] .nav-link { flex-direction: column; justify-content: center; gap: 4px; height: 62px; padding: 0 2px; font-size: 10px; letter-spacing: -0.015em; }
:root[data-sidebar="collapsed"] .nav-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
:root[data-sidebar="collapsed"] .nav-title,
:root[data-sidebar="collapsed"] .sidebar-foot,
:root[data-sidebar="collapsed"] .nav-section.categories { display: none; }
:root[data-sidebar="collapsed"] .nav-link.active::before { left: -10px; }

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 44;
  background: rgba(2, 4, 8, 0.6);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--slow) var(--ease);
}

.main {
  min-width: 0;
  padding: 28px clamp(16px, 3vw, 40px) 64px;
  display: flex;
  flex-direction: column;
}
.main > .content { width: 100%; max-width: var(--content-max); margin: 0 auto; flex: 1; animation: rise 320ms var(--ease) both; }

.site-footer {
  width: 100%;
  max-width: var(--content-max);
  margin: 56px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
  color: var(--faint);
  font-size: 12.5px;
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--accent); }

@media (max-width: 1279px) {
  .shell { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  .sidebar { padding-inline: 8px; }
  .nav-link { flex-direction: column; justify-content: center; gap: 4px; height: 62px; padding: 0 2px; font-size: 10px; letter-spacing: -0.015em; }
  .nav-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .nav-title, .sidebar-foot, .nav-section.categories { display: none; }
  .nav-link.active::before { left: -10px; }

  body.drawer-open .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 45;
    width: var(--sidebar-w);
    height: 100vh;
    padding: 14px 12px 20px;
    background: var(--bg-2);
    box-shadow: var(--shadow-lg);
  }
  body.drawer-open .sidebar .nav-link { flex-direction: row; justify-content: flex-start; gap: 14px; height: 42px; padding: 0 12px; font-size: 14.5px; }
  body.drawer-open .sidebar .nav-title,
  body.drawer-open .sidebar .sidebar-foot { display: flex; }
  body.drawer-open .sidebar .nav-section.categories { display: flex; }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  .drawer-head { display: flex; }
}

.drawer-head { display: none; align-items: center; justify-content: space-between; padding: 0 2px 10px; }
body:not(.drawer-open) .drawer-head { display: none; }

@media (max-width: 899px) {
  :root { --topbar-h: 58px; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 45;
    width: min(86vw, var(--sidebar-w));
    height: 100vh;
    transform: translateX(-104%);
    transition: transform var(--slow) var(--ease);
    background: var(--bg-2);
    padding: 14px 12px 20px;
  }
  body.drawer-open .sidebar { transform: none; width: min(86vw, var(--sidebar-w)); }
  .sidebar .nav-link { flex-direction: row; justify-content: flex-start; gap: 14px; height: 44px; padding: 0 12px; font-size: 15px; }
  .sidebar .nav-title, .sidebar .sidebar-foot, .sidebar .nav-section.categories { display: flex; }
  .nav-link.active::before { left: -12px; }

  .topbar { gap: 6px; padding: 0 8px; }
  .brand img { height: 28px; }
  .search { position: absolute; left: 0; right: 0; top: 0; height: var(--topbar-h); padding: 8px 10px; background: var(--bg-2); display: none; align-items: center; gap: 6px; z-index: 2; }
  body.search-open .search { display: flex; }
  .search-toggle { display: inline-grid; }
  .search-box kbd { display: none; }
  .topbar-end .btn-upload span { display: none; }
  .topbar-end .btn-upload { padding: 0; width: 40px; justify-content: center; }
  .topbar-end .hide-sm { display: none; }
  .main { padding-top: 20px; }
}

.search-close { display: none; }
@media (max-width: 899px) { body.search-open .search-close { display: inline-grid; } }

/* ------------------------------------------------------------------ 4 */

.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  --btn-border: var(--line-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: var(--pill);
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 14px/1 var(--font-sans);
  letter-spacing: -0.005em;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform var(--fast), box-shadow var(--fast), background var(--fast), border-color var(--fast), color var(--fast), filter var(--fast);
}
.btn:hover { color: var(--btn-fg); border-color: var(--line-2); background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  --btn-fg: var(--accent-ink);
  border: 0;
  background: var(--grad-btn);
  box-shadow: 0 8px 24px -10px rgba(34, 211, 238, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover {
  color: var(--accent-ink);
  background: var(--grad-btn);
  filter: brightness(1.06) saturate(1.05);
  box-shadow: 0 12px 30px -10px rgba(34, 211, 238, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-ghost { --btn-bg: transparent; --btn-border: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line); }

.btn-outline { --btn-bg: transparent; }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-border: rgba(255, 92, 122, 0.3); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-square { width: 40px; padding: 0; }
.btn-sm.btn-square { width: 32px; }
.btn.is-on { background: var(--accent-soft); border-color: var(--accent-ring); color: var(--accent); }

.btn-group { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}
.link-btn:hover { color: var(--accent); }
.link-btn.danger { color: var(--danger); }
.text-link { color: var(--accent); }
.text-link .icon { vertical-align: -0.15em; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* inputs */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-label .hint { font-weight: 400; color: var(--faint); font-family: var(--font-mono); font-size: 11.5px; }
.field-help { font-size: 12.5px; color: var(--muted); }
.field-error { font-size: 12.5px; color: var(--danger); }

.input,
.select,
.textarea,
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="search"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field input[type="datetime-local"],
.field input[type="time"],
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.textarea, .field textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder, .field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus,
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.select, .field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.input-mono { font-family: var(--font-mono) !important; font-size: 13.5px !important; }
.input-sm { min-height: 34px !important; padding: 6px 10px !important; font-size: 13.5px !important; }
.select.input-sm, .field select.input-sm { padding-right: 32px !important; }

input[type="file"] { font: inherit; color: var(--muted); max-width: 100%; }
.field input::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; border-radius: 6px; padding: 4px; }
.field input::-webkit-calendar-picker-indicator:hover { opacity: 1; background: var(--surface-3); }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--pill);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font: 600 13px var(--font-sans);
  cursor: pointer;
}

.check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }

.form-grid { display: grid; gap: 18px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* segmented control (radio group) */
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: var(--pill); background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--pill);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line-2); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background var(--fast), border-color var(--fast), color var(--fast);
}
.chip:hover { border-color: var(--line-2); background: var(--surface-2); color: var(--text); }
.chip.active { color: var(--text); border-color: transparent; background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad) border-box; border: 1px solid transparent; }
.chip.active .icon { color: var(--accent); }
.chip .count { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }

/* badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--pill);
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge .icon { width: 12px; height: 12px; }
.badge-ready, .badge-success { background: var(--success-soft); color: var(--success); }
.badge-processing, .badge-info { background: var(--accent-soft); color: var(--accent); }
.badge-processing .icon { animation: spin 1.2s linear infinite; }
.badge-pending, .badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-failed, .badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-public { background: var(--success-soft); color: var(--success); }
.badge-unlisted { background: var(--violet-soft); color: var(--brand-3); }
.badge-private { background: var(--surface-3); color: var(--muted); }
.badge-role { background: var(--violet-soft); color: var(--brand-3); }

/* avatars */
.avatar {
  --size: 36px;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--av-a, #2ee6a6), var(--av-b, #7c6cff));
  color: #05070c;
  font: 700 calc(var(--size) * 0.38)/1 var(--font-display);
  letter-spacing: -0.02em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  user-select: none;
}
.avatar-xs { --size: 24px; }
.avatar-sm { --size: 30px; }
.avatar-md { --size: 36px; }
.avatar-lg { --size: 48px; }
.avatar-xl { --size: 88px; box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--line-2); }

/* panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { font-size: 16px; display: inline-flex; align-items: center; gap: 10px; }
.panel-head p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.panel-title-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.panel-title-icon .icon { width: 17px; height: 17px; }
.panel-danger { border-color: rgba(255, 92, 122, 0.28); background: linear-gradient(180deg, var(--danger-soft), transparent 60%), var(--surface); }
.panel-flush { padding: 0; overflow: hidden; }
.panel-flush .panel-head { padding: 18px 22px 0; }

.count-pill {
  font: 600 11.5px/1 var(--font-mono);
  padding: 4px 8px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--accent);
}

hr.divider { border: 0; border-top: 1px solid var(--line); margin: 22px 0; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.stat {
  position: relative;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}
.stat::after {
  content: "";
  position: absolute;
  inset: auto -30% -60% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--grad);
  opacity: 0.07;
  filter: blur(6px);
}
.stat-label { display: flex; align-items: center; gap: 8px; font: 500 11.5px/1.2 var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-label .icon { width: 15px; height: 15px; color: var(--accent); }
.stat-value { margin-top: 10px; font: 600 26px/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; color: var(--muted); font-weight: 500; letter-spacing: 0; margin-left: 4px; }
.stat-note { margin-top: 6px; font-size: 12px; color: var(--faint); }
.stat-warn .stat-value { color: var(--warning); }
.stat-bad .stat-value { color: var(--danger); }

/* tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.table th {
  text-align: left;
  padding: 10px 14px;
  font: 500 11px/1.2 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { transition: background var(--fast); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .reason { color: var(--muted); font-family: var(--font-mono); font-size: 12px; max-width: 420px; }

.row-media { display: flex; align-items: center; gap: 14px; min-width: 260px; }
.row-thumb { position: relative; width: 112px; aspect-ratio: 16 / 9; border-radius: var(--radius-xs); overflow: hidden; background: var(--thumb-bg); flex: none; }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-thumb .thumb-fallback .icon { width: 22px; height: 22px; }
.row-thumb .thumb-duration { right: 4px; bottom: 4px; font-size: 10.5px; padding: 2px 5px; }
.row-title { font-weight: 600; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); }
.tab .count-pill { background: var(--surface-3); color: var(--muted); }
.tab.active .count-pill { background: var(--accent-soft); color: var(--accent); }

/* page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.035em; margin-top: 8px; }
.page-head .lede { margin-top: 8px; }
.lede { color: var(--muted); font-size: 15.5px; max-width: 70ch; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.back-link:hover { color: var(--accent); }

/* empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 56px 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius-lg);
  background: radial-gradient(60% 80% at 50% 0%, var(--accent-soft), transparent 70%);
}
.empty-state .empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--accent);
  box-shadow: var(--glow);
}
.empty-state .empty-icon .icon { width: 28px; height: 28px; }
.empty-state h3 { font-size: 18px; }
.empty-state p { color: var(--muted); max-width: 46ch; }
.empty-state.compact { padding: 32px 20px; }

/* ------------------------------------------------------------------ 5 */

.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding: clamp(28px, 4vw, 48px);
  margin-bottom: 34px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background:
    radial-gradient(60% 90% at 0% 0%, rgba(46, 230, 166, 0.14), transparent 60%),
    radial-gradient(50% 90% at 100% 100%, rgba(124, 108, 255, 0.18), transparent 60%),
    var(--surface);
  isolation: isolate;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(80% 90% at 70% 40%, #000 30%, transparent 75%);
  mask-image: radial-gradient(80% 90% at 70% 40%, #000 30%, transparent 75%);
}
.hero h1 { font-size: clamp(30px, 4.2vw, 52px); line-height: 1.04; letter-spacing: -0.045em; margin: 16px 0 14px; font-weight: 700; }
.hero .lede { font-size: 16.5px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.hero-stats .stat { background: var(--glass); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.hero-stats .stat-value { font-size: clamp(24px, 2.6vw, 32px); }
.terminal {
  margin-top: 22px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  font: 12.5px/1.4 var(--font-mono);
  color: var(--text-2);
  max-width: 100%;
  overflow: hidden;
}
:root[data-theme="light"] .terminal { background: rgba(15, 23, 42, 0.04); }
.terminal b { color: var(--brand-1); font-weight: 500; }
.terminal .caret { width: 7px; height: 15px; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
}

.section { margin-top: 34px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 19px; display: inline-flex; align-items: center; gap: 10px; }
.section-head h2 .icon { color: var(--accent); }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.toolbar .chips { flex: 1; min-width: 0; }
.toolbar .sort { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.toolbar .sort .select { min-height: 34px; height: 34px; padding: 0 34px 0 12px; border-radius: var(--pill); font-size: 13.5px; width: auto; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px 18px;
}
.grid-tight { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px 16px; }

.media-card { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--thumb-bg);
  box-shadow: 0 0 0 1px var(--line);
  isolation: isolate;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease), filter var(--slow); }
.thumb-document img { object-position: top; background: #fff; }
.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.55));
  opacity: 0.8;
}
.media-card:hover .thumb { box-shadow: var(--glow); }
.media-card:hover .thumb img { transform: scale(1.045); }
.thumb-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  background:
    radial-gradient(60% 80% at 30% 20%, rgba(34, 211, 238, 0.12), transparent 70%),
    radial-gradient(60% 80% at 80% 90%, rgba(124, 108, 255, 0.14), transparent 70%),
    var(--thumb-bg);
}
.thumb-fallback .icon { width: 38px; height: 38px; stroke-width: 1.5; color: var(--muted); }
.thumb-fallback-label { position: absolute; bottom: 12px; left: 0; right: 0; text-align: center; font: 500 10.5px var(--font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }

.thumb-badge {
  position: absolute;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(3, 6, 12, 0.78);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #f1f5f9;
  font: 600 11.5px/1.2 var(--font-mono);
  letter-spacing: 0.02em;
}
.thumb-badge .icon { width: 12px; height: 12px; }
.thumb-duration { right: 8px; bottom: 8px; }
.thumb-kind { left: 8px; bottom: 8px; }
.thumb-res { right: 8px; top: 8px; background: rgba(3, 6, 12, 0.6); color: #a5f3fc; font-size: 10px; }
.thumb-state { left: 8px; top: 8px; }
.thumb-play {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  width: 52px;
  height: 52px;
  margin: -26px 0 0 -26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(3, 6, 12, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity var(--fast), transform var(--slow) var(--ease);
}
.thumb-play .icon { width: 22px; height: 22px; fill: currentColor; stroke-width: 0; margin-left: 3px; }
.media-card:hover .thumb-play { opacity: 1; transform: none; }
.thumb-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 1; background: rgba(255, 255, 255, 0.18); }
.thumb-progress span { display: block; height: 100%; background: var(--grad); }

.media-card-body { display: flex; gap: 12px; min-width: 0; }
.media-card-text { min-width: 0; flex: 1; }
.media-title {
  font: 600 15px/1.38 var(--font-sans);
  letter-spacing: -0.01em;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.media-title a:hover { color: var(--text); }
.media-card:hover .media-title a { color: var(--accent); }
.media-meta { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.media-meta a:hover { color: var(--text); }
.meta-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.meta-sep { color: var(--faint); }
.meta-row .mono { font-size: 12px; }

/* compact list cards (up next, playlist panel) */
.list-card { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 12px; padding: 6px; margin: 0 -6px; border-radius: var(--radius); transition: background var(--fast); }
.list-card:hover { background: var(--surface-2); }
.list-card .thumb { border-radius: var(--radius-sm); }
.list-card .media-title { font-size: 14px; -webkit-line-clamp: 2; }
.list-card .media-meta { font-size: 12.5px; margin-top: 3px; }
.list-card.current { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-ring); }
.list-index { font: 500 12px var(--font-mono); color: var(--faint); align-self: center; width: 18px; text-align: center; }
.list-card.with-index { grid-template-columns: 18px 128px minmax(0, 1fr); align-items: center; }

/* pager */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 40px; flex-wrap: wrap; }
.pager-info { font: 500 13px var(--font-mono); color: var(--muted); padding: 0 8px; }

/* ------------------------------------------------------------------ 6 */

.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "player side"
    "info   side"
    "talk   side";
  gap: 0 28px;
  align-items: start;
}
.watch-player { grid-area: player; }
.watch-info { grid-area: info; min-width: 0; }
.watch-talk { grid-area: talk; min-width: 0; }
.watch-side { grid-area: side; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

body.is-theater .watch {
  grid-template-areas:
    "player player"
    "info   side"
    "talk   side";
}
body.is-theater .watch-player .player { max-height: calc(100vh - var(--topbar-h) - 120px); }
body.is-theater .watch-side { margin-top: 22px; }

@media (max-width: 1100px) {
  .watch {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "player" "info" "side" "talk";
  }
  body.is-theater .watch { grid-template-areas: "player" "info" "side" "talk"; }
  .watch-side { margin-top: 26px; }
}

.watch-player .player,
.stage {
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
}
.watch-player .player { aspect-ratio: 16 / 9; }
.watch-player .player > video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.stage-image { display: grid; place-items: center; background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--surface) 0% 50%) 50% / 24px 24px; }
.stage-image img { max-height: 78vh; width: auto; max-width: 100%; object-fit: contain; }
.stage-doc { aspect-ratio: auto; height: min(80vh, 900px); }
.stage-doc iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.stage-missing {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  background:
    radial-gradient(50% 70% at 50% 40%, rgba(34, 211, 238, 0.1), transparent 70%),
    var(--surface-2);
}
.stage-missing .stack { display: grid; gap: 10px; justify-items: center; max-width: 440px; }
.stage-missing h2 { font-size: 20px; color: var(--text); }

.processing-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin-top: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--accent-ring);
  background: linear-gradient(90deg, var(--accent-soft), transparent);
  font-size: 14px;
}
.processing-banner.failed { border-color: rgba(255, 92, 122, 0.35); background: linear-gradient(90deg, var(--danger-soft), transparent); }
.processing-banner .grow { flex: 1; min-width: 0; }
.processing-banner .mono { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.scanline { height: 3px; border-radius: 3px; margin-top: 8px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: scan 1.6s ease-in-out infinite; }
@keyframes scan { 0% { background-position: -40% 0; } 100% { background-position: 140% 0; } }

.watch-title { font-size: clamp(20px, 2.1vw, 25px); letter-spacing: -0.025em; margin: 18px 0 12px; overflow-wrap: anywhere; }

.watch-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.creator { display: flex; align-items: center; gap: 12px; min-width: 0; }
.creator-name { font-weight: 650; display: block; line-height: 1.3; }
.creator-sub { color: var(--muted); font-size: 12.5px; }
.watch-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.description {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.description-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-weight: 600; font-size: 13.5px; }
.description-meta .mono { font-weight: 500; font-size: 12.5px; color: var(--text-2); }
.prose { color: var(--text-2); font-size: 14.5px; line-height: 1.65; overflow-wrap: anywhere; }
.prose p { margin: 0 0 10px; }
.prose p:last-child { margin-bottom: 0; }
.description .prose { margin-top: 10px; }
.description.clamp .prose { max-height: 5.2em; overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent); mask-image: linear-gradient(180deg, #000 55%, transparent); }
.description.clamp .description-extra { display: none; }
.chapters-block { margin-top: 18px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.chapters-block .chapter-list { margin-top: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.description-toggle { margin-top: 8px; font-weight: 600; font-size: 13px; color: var(--text); background: none; border: 0; padding: 0; cursor: pointer; }
.description-toggle:hover { color: var(--accent); }

.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-top: 14px; }
.spec { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.spec dt { font: 500 10.5px/1.2 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.spec dd { margin: 5px 0 0; font: 500 13.5px/1.2 var(--font-mono); color: var(--text); overflow-wrap: anywhere; }

.chapter-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.chapter-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.chapter-list button:hover { background: var(--surface); color: var(--text); }
.chapter-list .ts { font: 500 12.5px var(--font-mono); color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 3px 7px; min-width: 56px; text-align: center; }

.share-box { display: grid; gap: 12px; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--font-mono); font-size: 12.5px; }
.embed-code { width: 100%; min-height: 86px; font: 12px/1.5 var(--font-mono); }

.side-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.side-card-head { padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--grad-soft); }
.side-card-head h2 { font-size: 15px; }
.side-card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.side-card-body { padding: 10px 12px; max-height: 420px; overflow-y: auto; display: grid; gap: 4px; }
.side-title { font-size: 15px; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.up-next { display: grid; gap: 6px; }

/* ------------------------------------------------------------------ 7 */

.comments-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 18px; }
.comments-head h2 { font-size: 18px; display: inline-flex; align-items: center; gap: 10px; }

.composer { display: flex; gap: 14px; margin-bottom: 26px; }
.composer form { flex: 1; min-width: 0; display: grid; gap: 10px; }
.composer textarea { min-height: 52px; }
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.composer-foot .check { font-size: 13px; color: var(--muted); }
.composer-foot .check .mono { color: var(--accent); }

.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 22px; }
.comment { display: flex; gap: 14px; }
.comment:target .comment-body { box-shadow: 0 0 0 1px var(--accent-ring); background: var(--accent-soft); }
.comment-body { flex: 1; min-width: 0; padding: 2px 10px 6px; margin: -2px -10px 0; border-radius: var(--radius-sm); transition: background var(--slow); }
.comment-head { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; font-size: 13.5px; }
.comment-author { font-weight: 650; }
.comment-author.is-owner { padding: 1px 8px; border-radius: var(--pill); background: var(--surface-3); }
.comment-time { color: var(--faint); font-size: 12.5px; }
.comment-text { margin-top: 4px; color: var(--text-2); font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.ts-link, .ts-chip {
  font: 500 12.5px var(--font-mono);
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 1px 6px;
}
.ts-link:hover, .ts-chip:hover { color: var(--accent-ink); background: var(--accent); }
.ts-chip { border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.comment-actions { display: flex; gap: 14px; margin-top: 6px; font-size: 12.5px; font-weight: 600; }
.comment-actions form { display: inline; }
.comment-actions .link-btn, .comment-actions summary { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.replies { list-style: none; margin: 14px 0 0; padding: 0 0 0 4px; display: grid; gap: 16px; border-left: 2px solid var(--line); padding-left: 16px; }
.reply-form { margin-top: 10px; display: grid; gap: 8px; }
details.reply > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
details.reply[open] { flex-basis: 100%; order: 10; }
.comment-actions { flex-wrap: wrap; align-items: center; }
details.reply > summary::-webkit-details-marker { display: none; }
details.reply > summary:hover { color: var(--accent); }

/* ------------------------------------------------------------------ 8 */

.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }

.dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 300px;
  padding: 40px 24px;
  border-radius: var(--radius-xl);
  border: 1.5px dashed var(--line-2);
  background:
    radial-gradient(60% 70% at 50% 0%, var(--accent-soft), transparent 70%),
    var(--surface);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--fast), box-shadow var(--slow), transform var(--slow) var(--ease);
}
.dropzone::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent);
  mask-image: radial-gradient(70% 70% at 50% 50%, #000, transparent);
  pointer-events: none;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); box-shadow: var(--glow); }
.dropzone.over { transform: scale(1.01); }
.dropzone-icon { position: relative; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: var(--grad); color: var(--accent-ink); box-shadow: 0 16px 40px -14px rgba(34, 211, 238, 0.7); }
.dropzone-icon .icon { width: 32px; height: 32px; }
.dropzone strong { position: relative; font: 650 19px var(--font-display); letter-spacing: -0.02em; }
.dropzone .muted { position: relative; font-size: 14px; }
.dropzone .formats { position: relative; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.file-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--line-2); background: var(--surface-2); }
.file-card .file-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.file-card .grow { min-width: 0; flex: 1; }
.file-card .name { font-weight: 600; overflow-wrap: anywhere; }
.file-card .meta { font: 12px var(--font-mono); color: var(--muted); margin-top: 2px; }

.progress-panel { display: grid; gap: 14px; }
.progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.progress-pct { font: 600 34px/1 var(--font-display); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.progress-label { font-size: 14px; color: var(--text-2); }
.progress { position: relative; height: 10px; border-radius: var(--pill); background: var(--surface-3); overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--grad); transition: width 220ms var(--ease); box-shadow: 0 0 18px rgba(34, 211, 238, 0.55); }
.progress-bar::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent); background-size: 200px 100%; animation: shimmer 1.4s linear infinite; }
.progress.done .progress-bar::after, .progress.error .progress-bar::after { display: none; }
.progress.error .progress-bar { background: var(--danger); box-shadow: none; }
.telemetry { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.telemetry div { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.telemetry dt { font: 500 10.5px/1.2 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.telemetry dd { margin: 6px 0 0; font: 600 14.5px/1.2 var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .telemetry { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.upload-status { font-size: 13.5px; color: var(--muted); min-height: 1.4em; }
.upload-status.error { color: var(--danger); }
.upload-status.ok { color: var(--success); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.steps li { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; color: var(--text-2); }
.steps li::before { counter-increment: step; content: counter(step); display: grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 8px; background: var(--surface-3); font: 600 12px var(--font-mono); color: var(--accent); }

.resume-note { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--radius); background: var(--warning-soft); color: var(--text); font-size: 13.5px; border: 1px solid rgba(255, 181, 71, 0.3); }
.resume-note .icon { color: var(--warning); }

/* playlists */
.playlist-card { position: relative; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.playlist-cover { position: relative; }
.playlist-cover::before,
.playlist-cover::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  top: -6px;
  height: 12px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-bottom: 0;
  z-index: -1;
}
.playlist-cover::after { left: 20px; right: 20px; top: -11px; opacity: 0.55; }
.playlist-cover .thumb { box-shadow: 0 0 0 1px var(--line-2); }
.playlist-count {
  position: absolute;
  z-index: 2;
  right: 0;
  top: 0;
  bottom: 0;
  width: 38%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: rgba(3, 6, 12, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.playlist-count strong { font: 600 22px/1 var(--font-display); }
.playlist-count span { font: 500 10.5px var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.8; }
.playlist-hero { display: grid; grid-template-columns: minmax(0, 420px) minmax(0, 1fr); gap: 28px; align-items: end; padding: 24px; border-radius: var(--radius-xl); border: 1px solid var(--line); background: var(--grad-soft), var(--surface); margin-bottom: 26px; }
.playlist-hero h1 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -0.035em; margin: 10px 0; overflow-wrap: anywhere; }
@media (max-width: 860px) { .playlist-hero { grid-template-columns: 1fr; } }
.track-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.track { display: grid; grid-template-columns: 32px 160px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 8px; border-radius: var(--radius); transition: background var(--fast); }
.track:hover { background: var(--surface-2); }
.track-num { font: 500 13px var(--font-mono); color: var(--faint); text-align: center; }
.track .thumb { border-radius: var(--radius-sm); }
.track-actions { display: flex; gap: 6px; align-items: center; }
@media (max-width: 640px) {
  .track { grid-template-columns: 24px 110px minmax(0, 1fr); }
  .track-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .list-card { grid-template-columns: 140px minmax(0, 1fr); }
}

/* subtitles editor */
.cue-table td { vertical-align: top; }
.cue-table .col-num { width: 44px; color: var(--faint); font: 500 12.5px var(--font-mono); padding-top: 22px; }
.cue-table .col-time { width: 132px; }
.cue-table .col-tools { width: 48px; text-align: right; }
.cue-table input, .cue-table textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
.cue-table input { font-family: var(--font-mono); font-size: 13px; }
.cue-table input:focus, .cue-table textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cue-table tr.cue-active td { background: var(--accent-soft); }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding: 12px 16px; border-radius: var(--radius); background: var(--glass); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border: 1px solid var(--line-2); box-shadow: var(--shadow); }

/* chapter editor */
.chapter-rows { display: grid; gap: 8px; }
.chapter-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 40px; gap: 8px; align-items: center; }

/* manage */
.user-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; }
.inline-form .select { min-height: 32px; height: 32px; padding: 0 30px 0 10px; font-size: 13px; width: auto; border-radius: var(--pill); }
.health-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--surface); font: 500 12px var(--font-mono); color: var(--text-2); }
.health-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.health-chip.bad .dot { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* channel */
.channel-banner {
  position: relative;
  height: clamp(120px, 18vw, 200px);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(50% 120% at 10% 0%, rgba(46, 230, 166, 0.45), transparent 60%),
    radial-gradient(50% 120% at 90% 100%, rgba(124, 108, 255, 0.55), transparent 60%),
    linear-gradient(120deg, #06121a, #0b1022);
  border: 1px solid var(--line);
}
.channel-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
}
.channel-head { display: flex; align-items: flex-start; gap: 20px; margin: 16px 0 26px 28px; position: relative; flex-wrap: wrap; }
.channel-head > .avatar { margin-top: -60px; }
.channel-head > .grow { padding-top: 4px; }
.channel-head h1 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.035em; }
.channel-head .meta-row { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
@media (max-width: 640px) { .channel-head { margin-left: 12px; } }

/* ------------------------------------------------------------------ 9 */

.auth-page {
  min-height: calc(100vh - var(--topbar-h) - 140px);
  display: grid;
  place-items: center;
  padding: 12px 0;
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  padding: 34px 32px 30px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 3px;
  background: var(--grad);
}
.auth-card::after {
  content: "";
  position: absolute;
  inset: -40% -40% auto auto;
  width: 280px;
  height: 280px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.12), transparent 65%);
  pointer-events: none;
}
.auth-mark { width: 48px; height: 48px; margin-bottom: 18px; border-radius: 14px; box-shadow: 0 12px 30px -10px rgba(34, 211, 238, 0.6); }
.auth-card h1 { font-size: 26px; letter-spacing: -0.035em; }
.auth-card .lede { font-size: 14.5px; margin: 8px 0 22px; }
.auth-card form { display: grid; gap: 16px; }
.auth-card .field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.auth-card .field-check { flex-direction: row; align-items: center; gap: 10px; }
.auth-card .field-check label { font-weight: 500; color: var(--muted); }
.auth-card .field-check input { width: 17px; height: 17px; accent-color: var(--accent); }
.auth-card ul.errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 12.5px; }
.auth-card .alert { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13.5px; }
.auth-card .alert-info { background: var(--accent-soft); color: var(--text-2); }
.auth-card p a, .auth-links a { color: var(--accent); }
.auth-links { margin-top: 18px; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.auth-card h2 { font-size: 16px; margin-top: 20px; }
.auth-card .field-help { margin-top: -2px; }
.auth-card .field-help ul { margin: 4px 0 0; padding-left: 18px; }
.auth-wide { max-width: 640px; }
.auth-card table { width: 100%; border-collapse: collapse; font-size: 14px; }
.auth-card td, .auth-card th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }

.error-page { display: grid; place-items: center; text-align: center; min-height: 60vh; }
.error-code { font: 700 clamp(84px, 16vw, 150px)/0.9 var(--font-display); letter-spacing: -0.06em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 18px 40px rgba(34, 211, 238, 0.25)); }
.error-page h1 { font-size: 24px; margin: 18px 0 10px; }
.error-page p { color: var(--muted); max-width: 48ch; margin: 0 auto; }
.error-page .btn-group { justify-content: center; margin-top: 24px; }

/* toasts */
.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); list-style: none; margin: 0; padding: 0; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--radius);
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  animation: toast-in 320ms var(--ease) both;
}
.toast.leaving { animation: toast-out 240ms var(--ease) both; }
.toast .toast-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); flex: none; }
.toast .toast-icon .icon { width: 15px; height: 15px; }
.toast.success .toast-icon { background: var(--success-soft); color: var(--success); }
.toast.error .toast-icon { background: var(--danger-soft); color: var(--danger); }
.toast.warning .toast-icon { background: var(--warning-soft); color: var(--warning); }
.toast .toast-text { flex: 1; padding-top: 3px; }
.toast .toast-close { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 3px; border-radius: 6px; }
.toast .toast-close:hover { color: var(--text); background: var(--surface-3); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* dropdowns built on <details> */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute;
  z-index: 50;
  right: 0;
  top: calc(100% + 8px);
  min-width: 240px;
  padding: 6px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-lg);
  animation: rise 160ms var(--ease) both;
}
.dropdown-menu.left { right: auto; left: 0; }
.dropdown-menu.up { top: auto; bottom: calc(100% + 8px); }
.menu-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-head strong { display: block; font-size: 14px; }
.menu-head .menu-email { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-item .icon { width: 18px; height: 18px; color: var(--muted); }
.menu-item:hover .icon { color: var(--accent); }
.menu-item.danger, .menu-item.danger .icon { color: var(--danger); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 0; }
.menu-label { padding: 6px 10px 4px; font: 500 10.5px var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.menu-form { padding: 6px; display: grid; gap: 8px; }
.menu-scroll { max-height: 240px; overflow-y: auto; }
.menu-item .check-mark { margin-left: auto; color: var(--success); }

.user-chip { display: inline-flex; align-items: center; gap: 0; padding: 3px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--surface); }
.user-chip:hover { border-color: var(--line-2); }

/* misc utilities */
.stack { display: grid; gap: 16px; }
.stack-sm { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 36px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.hidden { display: none !important; }
.kbd-hint { display: inline-flex; gap: 4px; align-items: center; color: var(--faint); font-size: 12px; }

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

@media print {
  .topbar, .sidebar, .site-footer, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
}

/* language switcher (footer and account menu) */
.lang-switch { display: inline-flex; align-items: center; margin: 0; }
.lang-label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; }
.lang-switch .select {
  width: auto;
  min-height: 28px;
  height: 28px;
  padding: 0 28px 0 10px;
  border-radius: var(--pill);
  font-size: 12.5px;
  background-color: var(--surface);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%;
}
.lang-switch-menu { display: flex; padding: 6px 10px; }
.lang-switch-menu .lang-label { width: 100%; gap: 12px; color: var(--text-2); font-size: 14px; }
.lang-switch-menu .lang-label .icon { width: 18px; height: 18px; color: var(--muted); }
.lang-switch-menu .select { margin-left: auto; }

/* ------------------------------------------------------------------ live */

.live-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff3b5c;
  box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.55);
  animation: live-pulse 1.8s infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(255, 59, 92, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 92, 0); }
}

.live-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 11px;
  border-radius: var(--pill);
  background: var(--surface-3);
  color: var(--muted);
  font: 700 11px/1 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}
.live-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.live-status-live { background: rgba(255, 59, 92, 0.16); color: #ff6b85; }
.live-status-live::before { background: #ff3b5c; animation: live-pulse 1.8s infinite; }
.live-status-interrupted { background: var(--warning-soft); color: var(--warning); }
.live-status-scheduled { background: var(--accent-soft); color: var(--accent); }

.live-meta-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.live-viewers, .live-elapsed { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13.5px; }
.live-viewers[hidden], .live-elapsed[hidden] { display: none; }
.live-elapsed { font: 500 12.5px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.live-meta-row .watch-title { margin: 0; }

/* the viewer page: stage and chat side by side */
.live-watch { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 0 26px; align-items: start; }
.live-side { position: sticky; top: calc(var(--topbar-h) + 18px); min-width: 0; }
@media (max-width: 1100px) {
  .live-watch { grid-template-columns: minmax(0, 1fr); }
  .live-side { position: static; margin-top: 24px; }
}

.live-stage { position: relative; }
.live-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--line);
}
.live-screen[hidden] { display: none; }
.live-screen-waiting,
.live-screen-ended {
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(60% 80% at 50% 30%, rgba(255, 59, 92, 0.14), transparent 70%),
    radial-gradient(50% 70% at 85% 95%, rgba(124, 108, 255, 0.16), transparent 70%),
    var(--surface-2);
}
.live-screen-ended {
  background:
    radial-gradient(50% 70% at 50% 35%, rgba(34, 211, 238, 0.12), transparent 70%),
    var(--surface-2);
}
.live-screen-inner { display: grid; gap: 12px; justify-items: center; max-width: 480px; }
.live-screen-inner h2 { font-size: clamp(18px, 2vw, 22px); letter-spacing: -0.02em; }
.live-screen-inner p { color: var(--muted); font-size: 14px; }
.live-screen-inner p[hidden], .live-screen-inner .btn[hidden] { display: none; }
.live-screen-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: rgba(255, 59, 92, 0.14);
  color: #ff6b85;
  box-shadow: 0 0 0 1px rgba(255, 59, 92, 0.25), 0 18px 40px -18px rgba(255, 59, 92, 0.6);
}
.live-screen-icon .icon { width: 28px; height: 28px; }
.live-screen-ended .live-screen-icon { background: var(--accent-soft); color: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring); }
.live-screen-inner .live-countdown {
  font: 600 clamp(20px, 2.6vw, 30px)/1.2 var(--font-display);
  letter-spacing: -0.02em;
  color: var(--text) !important;
  font-variant-numeric: tabular-nums;
}
.live-player, .live-player .player { width: 100%; height: 100%; }
.live-player .player > video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.live-interrupted {
  position: absolute;
  left: 50%;
  /* Below the player's own top-left prompts (e.g. "tap to unmute"). */
  top: 64px;
  z-index: 6;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 32px);
  padding: 9px 14px;
  border-radius: var(--pill);
  border: 1px solid rgba(255, 181, 71, 0.4);
  background: rgba(5, 7, 12, 0.84);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  /* Always over video, so always light text, whatever the theme. */
  color: #e8eef6;
  font-size: 13.5px;
}
.live-interrupted strong { color: #fff; }
.live-interrupted[hidden] { display: none; }
.live-interrupted .icon { color: var(--warning); flex: none; }
.live-noscript { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

/* chat */
.live-chat { display: flex; flex-direction: column; height: min(74vh, 700px); padding: 0; overflow: hidden; }
.live-chat .panel-head { margin: 0; padding: 16px 18px 12px; border-bottom: 1px solid var(--line); }
.chat-list {
  flex: 1;
  margin: 0;
  padding: 10px 8px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-list:empty { display: none; }
.chat-msg { position: relative; display: flex; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); animation: rise 0.2s var(--ease); }
.chat-msg:hover { background: var(--surface-2); }
.chat-msg.is-host { background: linear-gradient(90deg, rgba(255, 59, 92, 0.09), transparent 75%); }
.chat-face { flex: none; padding-top: 1px; }
.chat-main { flex: 1; min-width: 0; }
.chat-meta { display: flex; align-items: baseline; gap: 7px; font-size: 12.5px; }
.chat-author { color: var(--text); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-msg.is-mine .chat-author { color: var(--accent); }
.chat-host { flex: none; padding: 3px 6px; border-radius: 5px; background: rgba(255, 59, 92, 0.16); color: #ff6b85; font: 700 9.5px/1 var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; }
.chat-time { flex: none; margin-left: auto; color: var(--faint); font: 500 11px/1 var(--font-mono); }
.chat-body { margin: 3px 0 0; color: var(--text-2); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-hide {
  position: absolute;
  right: 6px;
  top: 6px;
  display: none;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-3);
  color: var(--muted);
  cursor: pointer;
}
.chat-msg:hover .chat-hide, .chat-msg:focus-within .chat-hide { display: grid; }
.chat-hide:hover { color: var(--danger); border-color: rgba(255, 92, 122, 0.45); }
@media (hover: none) { .chat-hide { display: grid; } }
.chat-empty { flex: 1; display: grid; place-items: center; align-content: center; gap: 8px; padding: 28px; text-align: center; color: var(--muted); font-size: 13.5px; }
.chat-empty .icon { width: 26px; height: 26px; color: var(--faint); }
.chat-empty[hidden] { display: none; }
.chat-form { display: grid; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-form[hidden] { display: none; }
.chat-form .textarea { min-height: 46px; max-height: 120px; resize: none; padding: 10px 12px; font-size: 14px; }
.chat-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chat-left { color: var(--faint); font: 500 11.5px/1 var(--font-mono); }
.chat-left.is-low { color: var(--warning); }
.chat-form.is-busy { opacity: 0.7; pointer-events: none; }
.chat-note { margin: 0; padding: 14px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; text-align: center; }
.chat-note[hidden] { display: none; }
.chat-note a { color: var(--accent); font-weight: 600; }

/* cards */
.thumb-live {
  background:
    radial-gradient(70% 90% at 25% 15%, rgba(255, 59, 92, 0.3), transparent 60%),
    radial-gradient(60% 80% at 85% 95%, rgba(124, 108, 255, 0.32), transparent 60%),
    var(--thumb-bg);
}
.live-thumb-art { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.86); }
.live-thumb-art .icon { width: 44px; height: 44px; stroke-width: 1.5; }
.live-card-ended .live-thumb-art { color: rgba(255, 255, 255, 0.5); }
.live-flag { left: 8px; top: 8px; gap: 6px; background: #ff2e55; color: #fff; font: 800 10.5px/1.2 var(--font-sans); letter-spacing: 0.1em; text-transform: uppercase; }
.live-flag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: blink 1.4s steps(1) infinite; }
.live-flag-soon { left: 8px; top: 8px; color: #a5f3fc; }

/* studio and control room */
.encoder-state { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.encoder-state::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.encoder-state.is-on { color: var(--success); }
.encoder-state.is-on::before { background: var(--success); animation: pulse 2.2s infinite; }
.ingest-key { display: flex; gap: 8px; }
.ingest-key .input { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12.5px; }
.ingest-tips { margin-top: 4px; font-size: 13px; color: var(--muted); }
.ingest-tips code { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-2); }
.notice {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 181, 71, 0.3);
  background: var(--warning-soft);
  color: var(--text);
  font-size: 13.5px;
}
.notice .icon { flex: none; color: var(--warning); margin-top: 1px; }
.notice[hidden] { display: none; }
.control-stage .live-screen { border-radius: var(--radius); }
.control-stage .spec-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.toggle-row { display: grid; gap: 10px; }
.nav-live { width: 8px; height: 8px; margin-left: auto; border-radius: 50%; background: #ff3b5c; animation: live-pulse 1.8s infinite; }
:root[data-sidebar="collapsed"] .nav-live { position: absolute; top: 12px; right: calc(50% - 18px); margin: 0; }

/* the control room's sources and streaming from the browser */
button.tab { border: 0; background: none; font: inherit; cursor: pointer; }
.source-tabs { margin: 4px 0 18px; }
.cast { display: grid; gap: 14px; }
.cast-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(60% 80% at 50% 30%, rgba(34, 211, 238, 0.1), transparent 70%),
    #05070c;
  box-shadow: 0 0 0 1px var(--line);
}
.cast-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cast-video[hidden] { display: none; }
.cast-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  color: #8794a8;
  font-size: 13.5px;
}
.cast-placeholder[hidden] { display: none; }
.cast-placeholder .icon { width: 30px; height: 30px; color: #5a677b; }
.cast-badge {
  position: absolute;
  left: 12px;
  top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px;
  border-radius: var(--pill);
  background: #ff2e55;
  color: #fff;
  font: 800 10.5px/1.2 var(--font-sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.cast-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.4s steps(1) infinite; }
.cast-badge[hidden] { display: none; }
.cast-meter { position: absolute; left: 12px; right: 12px; bottom: 12px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.cast-meter[hidden] { display: none; }
.cast-meter i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--grad-btn); transition: width 80ms linear; }
.cast-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cast-actions .btn[hidden] { display: none; }
.cast-status { min-height: 1.4em; margin: 0; color: var(--muted); font: 500 12.5px/1.4 var(--font-mono); }
.cast-status.is-live { color: var(--success); }
.cast-status.is-warning { color: var(--warning); }
.cast-status.is-error { color: var(--danger); }
.segmented label[hidden] { display: none; }

/* ------------------------------------------------------ confirm dialog */

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-xl);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: dialog-in 220ms var(--ease) both;
}
.confirm-dialog::backdrop {
  background: var(--scrim);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: scrim-in 220ms var(--ease) both;
}
.confirm-box {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 16px;
  padding: 26px 24px 20px;
  margin: 0;
}
.confirm-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--grad);
}
.confirm-dialog.is-danger .confirm-box::before { background: linear-gradient(90deg, var(--danger), #ff9a6b); }
.confirm-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}
.confirm-icon .icon { width: 22px; height: 22px; }
.confirm-dialog.is-danger .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.confirm-copy { min-width: 0; padding-top: 2px; }
.confirm-title { margin: 0; font: 600 18px/1.35 var(--font-display); letter-spacing: -0.012em; color: var(--text); overflow-wrap: anywhere; }
.confirm-text { margin: 8px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.confirm-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.btn-danger-solid {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-border: transparent;
  box-shadow: 0 10px 26px -12px rgba(255, 92, 122, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-danger-solid:hover { color: #fff; background: var(--danger); border-color: transparent; filter: brightness(1.08); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 560px) {
  .confirm-dialog { margin: auto auto 12px; width: calc(100vw - 24px); border-radius: var(--radius-lg); }
  .confirm-box { padding: 24px 18px 18px; }
  .confirm-actions { flex-direction: column-reverse; }
  .confirm-actions .btn { width: 100%; height: 46px; }
}

/* ---------------------------------------------- date and time picker */

.dtp { position: relative; }
.dtp-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 40px 0 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--faint);
  font: inherit;
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.dtp-trigger:hover { border-color: var(--accent-ring); }
.dtp-trigger:focus-visible, .dtp.is-open .dtp-trigger { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.dtp.has-value .dtp-trigger { color: var(--text); }
.dtp-trigger-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.dtp-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dtp-chevron { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); display: grid; pointer-events: none; transition: transform var(--fast); }
.dtp.is-open .dtp-chevron { transform: translateY(-50%) rotate(180deg); }
.dtp.has-value .dtp-chevron { display: none; }
.dtp-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.dtp-clear:hover { background: var(--surface-3); color: var(--text); }

.dtp-panel {
  position: fixed;
  z-index: 70;
  width: 320px;
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in 160ms var(--ease) both;
}
.dtp-scrim { position: fixed; inset: 0; z-index: 69; background: var(--scrim); animation: scrim-in 200ms var(--ease) both; }
.dtp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.dtp-month { flex: 1; text-align: center; font: 600 15px/1.2 var(--font-display); letter-spacing: -0.01em; color: var(--text); }
.dtp-nav {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
}
.dtp-nav:hover { background: var(--surface-3); color: var(--text); }
.dtp-weekdays, .dtp-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dtp-weekdays { margin-bottom: 4px; }
.dtp-weekdays span { text-align: center; font: 600 11px/24px var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.dtp-grid { display: grid; gap: 2px; }
.dtp-day {
  position: relative;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text);
  font: 500 14px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--fast), color var(--fast);
}
@media (hover: hover) { .dtp-day:hover { background: var(--surface-3); } }
.dtp-day:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent); }
.dtp-day.is-outside { color: var(--faint); }
.dtp-day.is-today { color: var(--accent); font-weight: 700; }
.dtp-day.is-today::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: currentColor;
}
.dtp-day.is-selected, .dtp-day.is-selected:hover {
  background: var(--grad-btn);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 8px 20px -10px rgba(34, 211, 238, 0.8);
}
.dtp-day:disabled { color: var(--faint); opacity: 0.45; cursor: not-allowed; background: none; }

.dtp-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.dtp-time-label { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.dtp-time-label .icon { color: var(--accent); }
.dtp-time-inputs { display: inline-flex; align-items: center; gap: 6px; }
.dtp-time select {
  appearance: none;
  -webkit-appearance: none;
  height: 36px;
  min-width: 56px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: 600 15px/1 var(--font-mono);
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}
.dtp-time select:hover { border-color: var(--accent-ring); }
.dtp-time select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dtp-colon { color: var(--muted); font: 700 16px/1 var(--font-mono); }
.dtp-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.dtp-spacer { flex: 1; }

.dtp-panel.is-sheet {
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: auto;
  padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  border-bottom: 0;
  animation: sheet-in 220ms var(--ease) both;
}
.dtp-panel.is-sheet .dtp-day { height: 44px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* ------------------------------------------------------------------ 10 */

/* status page: /health/ready/ in a browser, standalone like the 500 page */
.status-page {
  width: 100%;
  max-width: 880px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 32px) 32px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.status-page > main { flex: 1; align-content: start; gap: 18px; animation: rise 320ms var(--ease) both; }
.status-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.status-hero,
.status-check { --tone: var(--success); --tone-soft: var(--success-soft); }
.status-hero.is-warn,
.status-check.is-warn { --tone: var(--warning); --tone-soft: var(--warning-soft); }
.status-hero.is-down,
.status-check.is-down { --tone: var(--danger); --tone-soft: var(--danger-soft); }

.status-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: clamp(22px, 4vw, 34px);
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-2);
  background: linear-gradient(135deg, var(--tone-soft), transparent 70%), var(--surface);
  box-shadow: var(--shadow);
}
.status-hero h1 { font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -0.035em; margin-top: 8px; }
.status-hero .lede { margin-top: 6px; }
.status-orb {
  flex: none;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  color: var(--tone);
  background: var(--tone-soft);
  box-shadow: 0 0 0 9px var(--tone-soft), 0 12px 40px -8px var(--tone);
}
.status-orb .icon { width: 32px; height: 32px; }

.status-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); box-shadow: 0 0 10px var(--tone); }
.status-hero.is-ok .status-dot { animation: pulse 2.2s infinite; }

.status-checks { list-style: none; margin: 0; padding: 0; }
.status-check { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-top: 1px solid var(--line); }
.status-check:first-child { border-top: 0; }
.status-check h2 { font-size: 15.5px; }
.status-check p { margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.status-check code { display: inline-block; margin-top: 8px; padding: 3px 8px; border-radius: var(--radius-xs); background: var(--tone-soft); color: var(--tone); font-size: 12px; }
.status-check-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text-2); }
.status-check-icon .icon { width: 19px; height: 19px; }
.status-check.is-down .status-check-icon { color: var(--danger); }
.status-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--pill);
  background: var(--tone-soft);
  color: var(--tone);
  font: 600 12px/1 var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-meta { display: flex; align-items: center; gap: 8px; padding: 0 4px; color: var(--faint); font: 12.5px/1.5 var(--font-mono); }
.status-meta .icon { flex: none; }

.status-probes { display: grid; gap: 10px; margin: 0; }
.status-probes > div { padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); }
.status-probes dt { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--text); }
.status-probes dd { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }

.status-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; }
.status-foot nav { display: flex; gap: 16px; }

@media (max-width: 600px) {
  .status-hero { flex-direction: column; align-items: flex-start; gap: 18px; }
  .status-orb { width: 56px; height: 56px; }
  .status-orb .icon { width: 26px; height: 26px; }
  .status-check { flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; padding: 16px 18px; }
  .status-check .grow { flex-basis: calc(100% - 58px); }
  .status-check .status-pill { margin-left: 58px; }
}

/* API browser: /api/v1/ in a browser (apps/core/api_browser.py) */
.api-method {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-xs);
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 12px/1 var(--font-mono);
  letter-spacing: 0.06em;
}
.api-method-sm { height: 20px; padding: 0 7px; font-size: 10.5px; }

.api-crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font: 500 12.5px/1.4 var(--font-mono); }
.api-crumbs .eyebrow { color: var(--accent); }
.api-crumbs .icon-xs { color: var(--faint); }
.api-crumbs [aria-current] { color: var(--text-2); overflow-wrap: anywhere; }

.api-request {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 7px 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.api-url { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; scrollbar-width: none; color: var(--text); font-size: 13.5px; }
.api-url::-webkit-scrollbar { display: none; }
.api-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px 18px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: 13px; }
.api-allow,
.api-auth { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.api-auth .icon { color: var(--faint); }
.api-notice { margin-top: 18px; }
.api-notice p { margin-top: 2px; color: var(--text-2); }

.api-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.api-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast);
}
.api-card:hover { color: inherit; border-color: var(--accent-ring); box-shadow: var(--glow); transform: translateY(-1px); }
.api-card-text { flex: 1; min-width: 0; display: grid; gap: 4px; }
.api-card-text strong { font: 600 16px/1.3 var(--font-display); letter-spacing: -0.01em; }
.api-card-desc { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.api-card-text code { margin-top: 6px; color: var(--accent); font-size: 12px; }
.api-card-go { flex: none; margin-top: 6px; color: var(--faint); transition: transform var(--fast), color var(--fast); }
.api-card:hover .api-card-go { color: var(--accent); transform: translateX(2px); }

.api-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.api-columns .panel + .panel { margin-top: 0; }
.api-endpoints { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.api-endpoint-line { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.api-endpoint-line a { color: var(--accent); }
.api-endpoints p { margin-top: 4px; color: var(--muted); font-size: 13.5px; }
.api-snippet { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(0, 0, 0, 0.35); }
:root[data-theme="light"] .api-snippet { background: rgba(15, 23, 42, 0.04); }
.api-snippet code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; color: var(--text-2); font-size: 12.5px; }
.api-notes { display: grid; gap: 6px; margin: 14px 0 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }

.api-pager { margin-top: 26px; }

.api-response { overflow: hidden; }
.api-response-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; border-bottom: 1px solid var(--line); }
.api-response-head h2 { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; }
.api-response-head .mono { margin-right: auto; font-size: 12px; }
.json-view {
  margin: 0;
  padding: 18px 20px;
  max-height: 72vh;
  overflow: auto;
  background: var(--bg-2);
  color: var(--muted);
  font: 13px/1.65 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
.json-view .j-key { color: var(--text); }
.json-view .j-str { color: var(--brand-1); }
.json-view a.j-str { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-ring); text-underline-offset: 3px; }
.json-view a.j-str:hover { text-decoration-color: currentColor; }
.json-view .j-num { color: var(--warning); }
.json-view .j-bool { color: var(--brand-3); }
.json-view .j-null { color: var(--faint); font-style: italic; }

@media (max-width: 600px) {
  .api-request { gap: 8px; }
  .json-view { padding: 14px; font-size: 12px; }
}
