/* NoRepTV ---------------------------------------------------------------- */

:root {
  --bg: #0e0e10;
  --surface: #18181b;
  --surface-2: #232328;
  --hover: #2c2c32;
  --line: #2e2e35;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #8b8b93;              /* secondary text: >= 4.5:1 on --bg, --surface and --surface-2 */
  --accent: #e5262a;              /* fills and buttons (white text on it) */
  --accent-hover: #f23b3f;
  --accent-soft: rgba(229, 38, 42, 0.14);
  --accent-text: #ff6b6e;         /* red used as text (links, pressed states): >= 4.5:1 on surfaces */
  --toast-action: #c81e22;        /* red text on the toast, whose background is --text */
  --star: #e0a40b;                /* founding-member / featured star: >= 3:1 on surfaces */
  --danger-text: #fca5a5;
  --ok-text: #86efac;
  --focus: #60a5fa;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", var(--font);
  /* Charts (validated with the dataviz palette checker against --surface / --bg) */
  --chart-1: #3987e5;            /* single-series line / bar color */
  --chart-wash: rgba(57, 135, 229, 0.12);
  --chart-grid: #2a2a30;
  --chart-axis: #3a3a42;
  --chart-ink-muted: #8b8b93;
  --heat-0: #222227;             /* zero cells */
  --heat-1: #184f95;             /* low  → high (dark mode climbs toward light) */
  --heat-2: #256abf;
  --heat-3: #3987e5;
  --heat-4: #86b6ef;
  --heat-5: #cde2fb;
  --good: #22c55e;
  --warn: #f5a524;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --surface: #f4f4f5;
    --surface-2: #ebebee;
    --hover: #e1e1e5;
    --line: #e4e4e7;
    --text: #0f0f10;
    --text-2: #55555e;
    --text-3: #63636b;
    --accent: #d71f23;
    --accent-hover: #bb1a1e;
    --accent-soft: rgba(215, 31, 35, 0.1);
    --accent-text: #c41c20;
    --toast-action: #ff6b6e;
    --star: #a16207;
    --danger-text: #b91c1c;
    --ok-text: #15803d;
    --focus: #2563eb;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    --chart-1: #2a78d6;
    --chart-wash: rgba(42, 120, 214, 0.10);
    --chart-grid: #e7e7ea;
    --chart-axis: #c9c9cf;
    --chart-ink-muted: #63636b;
    --heat-0: #f0f0f2;
    --heat-1: #86b6ef;           /* low → high (light mode darkens) */
    --heat-2: #5598e7;
    --heat-3: #2a78d6;
    --heat-4: #1c5cab;
    --heat-5: #104281;
    --good: #15803d;
    --warn: #b45309;
    color-scheme: light;
  }
}

/* User badges ------------------------------------------------------------- */

.ubadge {
  display: inline-flex; align-items: center; gap: 3px; vertical-align: middle;
  height: 18px; margin-left: 4px; padding: 0 6px 0 4px; border-radius: 999px;
  font: 700 10.5px/1 var(--font); letter-spacing: 0.02em; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
}
.ubadge svg { width: 12px; height: 12px; flex: none; }
.ubadge.creator, .ubadge.founding { padding: 0; background: none; }
.ubadge.creator svg { width: 15px; height: 15px; }
.ubadge.founding { color: var(--star); }
.ubadge.founding svg { width: 15px; height: 15px; }
.ubadge.level-beginner svg { color: #22a06b; }
.ubadge.level-intermediate svg { color: var(--chart-1); }
.ubadge.level-rx { background: #c81e22; color: #fff; }
.ubadge.level-competitor { background: linear-gradient(135deg, #f7d26a, #d99a06); color: #2b1d00; }
.ubadge.streak { background: rgba(249, 115, 22, 0.14); }
.ubadge.streak svg { color: #f97316; }
.ubadge.streak-30 { background: rgba(239, 68, 68, 0.15); }
.ubadge.streak-30 svg { color: #ef4444; }
.ubadge.streak-100 { background: rgba(168, 85, 247, 0.16); }
.ubadge.streak-100 svg { color: #a855f7; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img, video, canvas { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.muted { color: var(--text-2); }
.small { font-size: 13px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link { color: var(--accent-text); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.link:hover { text-decoration: underline; }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 8px; left: 8px; z-index: 200; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; }

/* Header ----------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; flex: none; }
.brand-mark { width: 28px; height: 28px; }
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-size: 27px; line-height: 1;
  text-transform: uppercase; letter-spacing: 0.01em;
}
.wordmark span { color: var(--accent); }

.search { flex: 1; display: flex; max-width: 620px; margin: 0 auto; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 16px;
  background: var(--bg); border: 1px solid var(--line); border-right: 0;
  border-radius: 999px 0 0 999px; outline: none;
}
.search input:focus { border-color: var(--focus); }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search button {
  width: 60px; height: 40px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 0 999px 999px 0;
}
.search button:hover { background: var(--surface-2); }

.actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--accent-text); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--danger-text); }
.btn-danger:hover { background: var(--accent-soft); }
.btn-lg { height: 46px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
}
.icon-btn:hover { background: var(--surface-2); }

/* Subscribe: red when you're not subscribed, quiet once you are */
.btn-sub { background: var(--accent); color: #fff; }
.btn-sub:hover { background: var(--accent-hover); }
.btn-sub .icon { display: none; }
.btn-sub[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.btn-sub[aria-pressed="true"]:hover { background: var(--hover); }
.btn-sub[aria-pressed="true"] .icon { display: block; }

.btn[aria-pressed="true"] .icon-thumbs-up, .btn[aria-pressed="true"] .icon-thumbs-down { fill: currentColor; }
.btn[data-loop][aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }

.speed { padding: 0 6px 0 14px; }
.speed select {
  appearance: none; -webkit-appearance: none; background: transparent; border: 0;
  height: 100%; padding: 0 10px 0 0; cursor: pointer; font-weight: 600; outline: none; /* .speed:focus-within draws the ring */
}
.speed option { background: var(--surface); color: var(--text); }
/* Controls whose real input is inside (the speed select, a hidden file input) show the focus
   ring on the whole pill when the keyboard reaches them. */
.speed:has(select:focus-visible), .field label.btn:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
@supports not selector(:has(*)) {
  .speed:focus-within, .field label.btn:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
}

/* Account menu ----------------------------------------------------------- */

.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; border-radius: 50%; padding: 3px; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  width: 260px; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 10px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }

.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); }
.menu-pop form { margin: 0; }

.avatar {
  display: inline-grid; place-items: center; flex: none;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: linear-gradient(140deg, hsl(var(--hue) 62% 50%), hsl(calc(var(--hue) + 30) 60% 36%));
  color: #fff; font-weight: 700; font-size: calc(var(--size) * 0.42); line-height: 1;
  user-select: none;
}

/* Layout ----------------------------------------------------------------- */

.page { max-width: 1680px; margin: 0 auto; padding: 24px 24px 72px; }
.narrow-wrap { max-width: 1040px; margin: 0 auto; }
.page-title {
  font-family: var(--font-display); font-weight: 700; font-size: 34px; line-height: 1.1;
  text-transform: uppercase; letter-spacing: 0.01em; margin-bottom: 20px;
}
.section-title { font-size: 20px; font-weight: 700; margin: 4px 0 18px; }
.small-title { font-size: 17px; margin-top: 8px; }

.chips { display: flex; gap: 10px; margin: -4px -4px 18px; padding: 4px; overflow-x: auto; } /* padding: room for focus rings */
.chip {
  padding: 7px 14px; border-radius: 9px; background: var(--surface-2);
  font-size: 14px; font-weight: 600; white-space: nowrap;
}
.chip:hover { background: var(--hover); }
.chip[aria-current="page"] { background: var(--text); color: var(--bg); }

/* Video cards ------------------------------------------------------------ */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 36px 18px; }

.thumb {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: var(--surface-2);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.card:hover .thumb img, .row-card:hover .thumb img { transform: scale(1.035); }
.thumb-fallback {
  width: 100%; height: 100%; display: grid; place-items: center; color: rgba(255, 255, 255, 0.85);
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.04) 0 14px, transparent 14px 28px),
    linear-gradient(135deg, hsl(var(--hue) 50% 30%), hsl(calc(var(--hue) + 50) 55% 13%));
}
.thumb-fallback .icon { fill: currentColor; }
.badge {
  position: absolute; right: 8px; bottom: 8px;
  padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.82); color: #fff;
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.card-body { display: flex; gap: 12px; margin-top: 12px; }
.card-avatar { flex: none; }
.card-text { min-width: 0; }
.card-title {
  font-size: 16px; font-weight: 600; line-height: 1.35; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: anywhere;
}
.card-channel, .card-meta { display: block; font-size: 14px; color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.card-channel:hover { color: var(--text); }

.row-card { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
.row-card .thumb { border-radius: 8px; }
.row-card .card-title { font-size: 14px; }
.row-card .card-channel, .row-card .card-meta { font-size: 12.5px; }

.empty { max-width: 460px; margin: 64px auto; text-align: center; display: grid; justify-items: center; gap: 10px; }
.empty h2, .empty h1.error-message { font-size: 22px; font-weight: 700; line-height: 1.3; }
.empty p { color: var(--text-2); margin-bottom: 8px; }
.empty-icon {
  width: 76px; height: 76px; display: grid; place-items: center; margin-bottom: 6px;
  border-radius: 50%; background: var(--surface-2); color: var(--text-2);
}
.error-code { font-family: var(--font-display); font-size: 88px; font-weight: 800; line-height: 1; color: var(--accent); }

/* Watch page ------------------------------------------------------------- */

.watch-page {
  max-width: 1760px; margin: 0 auto; padding: 24px 24px 72px;
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px; align-items: start;
}
.player {
  position: relative; aspect-ratio: 16 / 9; max-height: 76vh; width: 100%;
  background: #000; border-radius: var(--radius); overflow: hidden;
}
.player video { width: 100%; height: 100%; object-fit: contain; background: #000; }

.watch-title { font-size: 21px; font-weight: 700; line-height: 1.3; margin: 14px 0 10px; overflow-wrap: anywhere; }
.watch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.channel-chip { display: flex; align-items: center; gap: 12px; min-width: 0; }
.channel-chip-text { display: flex; flex-direction: column; min-width: 0; margin-right: 10px; }
.channel-chip-text .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.desc-box { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.desc-meta { font-weight: 700; margin-bottom: 4px; }
.desc-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.desc-box.clamped .desc-text { max-height: 4.35em; overflow: hidden; }
.desc-more { margin-top: 4px; padding: 0; border: 0; background: none; font-weight: 700; cursor: pointer; }

.shortcut-hint { margin-top: 12px; font-size: 12.5px; color: var(--text-3); }
kbd {
  display: inline-block; min-width: 20px; padding: 0 5px; border-radius: 5px; text-align: center;
  border: 1px solid var(--line); background: var(--surface); font: 600 11px/18px var(--font); color: var(--text-2);
}

.comments { margin-top: 26px; }
.comments h2 { font-size: 19px; margin-bottom: 18px; }
.signin-prompt { padding: 14px 16px; border-radius: var(--radius); background: var(--surface); margin-bottom: 24px; }
.comment-form { display: flex; gap: 14px; margin-bottom: 28px; }
.comment-form-main { flex: 1; min-width: 0; }
.comment-form textarea {
  display: block; width: 100%; min-height: 30px; max-height: 320px; resize: none;
  padding: 4px 0 6px; border: 0; border-bottom: 1px solid var(--line); background: transparent; outline: none;
}
.comment-form textarea:focus { border-bottom: 2px solid var(--text); padding-bottom: 5px; }
.comment-form .form-actions { display: none; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.comment-form.active .form-actions { display: flex; }


.up-next h2 { font-size: 16px; margin-bottom: 12px; }

/* Channel ---------------------------------------------------------------- */

.channel-banner {
  height: clamp(110px, 16vw, 200px); border-radius: 16px;
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,0.05) 0 18px, transparent 18px 36px),
    radial-gradient(circle at 88% 15%, color-mix(in srgb, var(--accent) 55%, transparent), transparent 60%),
    linear-gradient(120deg, #1d1d22, #0b0b0d 75%);
}
.channel-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 24px;
  padding: 24px 0 28px; margin-bottom: 26px; border-bottom: 1px solid var(--line);
}
.channel-head-text { flex: 1; min-width: 220px; }
.channel-head h1 { font-family: var(--font-display); font-size: 40px; font-weight: 700; line-height: 1.05; margin-bottom: 6px; overflow-wrap: anywhere; }
.channel-bio { margin-top: 8px; max-width: 70ch; white-space: pre-wrap; color: var(--text-2); }
.channel-head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.channel-strip { display: flex; gap: 22px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 22px; }
.channel-strip a { display: grid; justify-items: center; align-content: start; gap: 6px; width: 104px; flex: none; font-size: 13px; text-align: center; }
.channel-strip .strip-name { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.channel-strip a:hover .strip-name { color: var(--accent); }
.channel-strip .strip-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; min-height: 18px; }
.channel-strip .strip-badges .ubadge { margin-left: 0; }

/* Forms ------------------------------------------------------------------ */

.stack { display: grid; gap: 18px; }
.field label, .field .label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input:not([type="range"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]), .field textarea, .field select {
  display: block; width: 100%; padding: 11px 13px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.field input[type="file"] { font-size: 14px; }
.field .muted.small { margin-top: 6px; }
.counter { margin-top: 4px; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.counter.over { color: var(--danger-text); }
.form-error { padding: 10px 13px; border-radius: 10px; background: var(--accent-soft); color: var(--danger-text); font-weight: 500; }
.form-ok { padding: 10px 13px; border-radius: 10px; background: color-mix(in srgb, var(--ok-text) 14%, transparent); color: var(--ok-text); font-weight: 600; }

.auth-card {
  max-width: 420px; margin: 40px auto; padding: 32px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
}
.auth-card.wide { max-width: 560px; }
.auth-card .page-title { margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 22px; }
.auth-card .field input:not([type="range"]):not([type="file"]):not([type="checkbox"]):not([type="radio"]), .auth-card .field textarea { background: var(--bg); }
.auth-switch { margin-top: 20px; text-align: center; }
.settings-who { display: flex; align-items: center; gap: 14px; margin: 14px 0 22px; }
.settings-who > div { min-width: 0; overflow-wrap: anywhere; }

/* Upload ----------------------------------------------------------------- */

.dropzone {
  display: grid; justify-items: center; gap: 8px; padding: 72px 24px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 18px; background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .btn { margin-top: 10px; }
.dz-title { font-size: 18px; font-weight: 700; }

.upload-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.upload-fields { display: grid; gap: 22px; }
.upload-side { display: grid; gap: 18px; position: sticky; top: 84px; }
.preview-card { border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.preview-card video { width: 100%; aspect-ratio: 16 / 9; background: #000; }
.preview-card .thumb { border-radius: 0; }
.preview-meta { display: grid; gap: 4px; padding: 12px 14px 14px; }
.preview-meta .link { justify-self: start; margin-top: 4px; font-size: 14px; }
.thumb-canvas { width: 100%; aspect-ratio: 16 / 9; border-radius: 10px; background: var(--surface-2); margin: 8px 0 10px; }
.thumb-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.thumb-controls input { flex: 1; accent-color: var(--accent); }
.thumb-controls span { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.field label.btn { display: inline-flex; margin: 0; font-size: 14px; }

.publish { display: grid; gap: 10px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }
.publish-actions { display: flex; justify-content: flex-end; gap: 10px; }

.danger-zone {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 40px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 14px;
}

/* Header extras ---------------------------------------------------------- */

.icon-btn[aria-current="page"] { background: var(--surface-2); color: var(--accent); }
.menu-who { min-width: 0; }
.menu-who strong { display: block; }
.menu-handle { display: flex; flex-wrap: wrap; align-items: center; color: var(--text-2); font-size: 13px; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-pending > span { display: grid; line-height: 1.3; }
.menu-pending small { color: var(--text-2); font-size: 12px; }

.chip { display: inline-flex; align-items: center; gap: 6px; }

/* Visibility labels ------------------------------------------------------ */

.vis-pill {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 2px 9px 2px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.5;
  background: var(--surface-2); color: var(--text);
}
.vis-pill .icon { flex: none; }
.vis-private { background: color-mix(in srgb, var(--text-3) 24%, transparent); }
.vis-unlisted { background: color-mix(in srgb, var(--chart-1) 20%, transparent); }
.vis-scheduled { background: color-mix(in srgb, var(--warn) 20%, transparent); }
.vis-public { background: color-mix(in srgb, var(--good) 18%, transparent); }
.card-status { margin-top: 6px; }
.card-hidden .thumb img, .card-hidden .thumb-fallback { opacity: 0.7; }
.watch-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.current-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }

/* Featured row ----------------------------------------------------------- */

.featured { margin-bottom: 32px; }
.featured-title { display: flex; align-items: center; gap: 8px; }
.featured-title .icon { color: var(--star); fill: currentColor; }
.featured-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.card-featured .thumb { border-radius: 14px; box-shadow: 0 0 0 1px var(--line); }
.card-featured .card-title { font-size: 18px; }

/* Channel ---------------------------------------------------------------- */

.channel-handle { display: flex; flex-wrap: wrap; align-items: center; color: var(--text-2); margin-bottom: 4px; }
.channel-note { margin: -8px 0 18px; }

/* Watch page: channel chip, reactions, manage bar ------------------------ */

.name-line { display: flex; flex-wrap: wrap; align-items: center; min-width: 0; row-gap: 2px; }
.name-line .name { min-width: 0; max-width: 100%; }
.name-line .ubadge { flex: none; }

.react-group { display: inline-flex; border-radius: 999px; background: var(--surface-2); }
.react-group .react-btn { background: transparent; border-radius: 0; position: relative; }
.react-group .react-btn:first-child { border-radius: 999px 0 0 999px; padding-right: 14px; }
.react-group .react-btn:last-child { border-radius: 0 999px 999px 0; padding-left: 14px; }
.react-group .react-btn:first-child::after {
  content: ""; position: absolute; right: 0; top: 9px; bottom: 9px; width: 1px;
  background: color-mix(in srgb, var(--text-3) 45%, transparent);
}
.react-group .react-btn:hover { background: var(--hover); }
.react-btn[aria-pressed="true"] { color: var(--accent-text); }
.react-group[aria-busy="true"] .react-btn { opacity: 0.7; cursor: progress; }
.react-btn span[data-like-count], .react-btn span[data-dislike-count] { font-variant-numeric: tabular-nums; }

.manage-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding: 10px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}

/* Comments --------------------------------------------------------------- */

.comment { display: flex; gap: 14px; margin-bottom: 20px; border-radius: 12px; }
.comment.reply { gap: 10px; margin: 14px 0 0; }
.comment-avatar { flex: none; }
.comment-main { flex: 1; min-width: 0; }
.pinned-by { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
.comment-head .ubadge { margin-left: -4px; }
.comment-author { font-weight: 700; }
.comment-time { color: var(--text-2); }
.comment-time:hover { color: var(--text); text-decoration: underline; }
.creator-tag { padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 600; }
.comment-body { margin: 3px 0 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-left: -8px; }
.comment-btn {
  display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 4px 9px;
  border: 0; border-radius: 999px; background: none; color: var(--text-2);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.comment-btn:hover { background: var(--surface-2); color: var(--text); }
.comment-btn[aria-pressed="true"] { color: var(--accent-text); }
.comment-btn[aria-pressed="true"] .icon-heart, .comment-btn[aria-pressed="true"] .icon-pin { fill: currentColor; }
.comment-btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.comment-del:hover { background: var(--accent-soft); color: var(--danger-text); }
.heart-badge {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 4px 0 8px; padding: 2px 9px 2px 2px;
  border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600;
}
.heart-glyph { color: var(--accent); font-size: 13px; line-height: 1; }
.replies-toggle {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; margin: 4px 0 0 -8px; padding: 4px 12px 4px 8px;
  border: 0; border-radius: 999px; background: none; color: var(--text); font-size: 13.5px; font-weight: 700; cursor: pointer;
}
.replies-toggle:hover { background: var(--surface-2); }
.replies-toggle .icon { transition: transform 0.15s; }
.replies-toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.reply-form { gap: 10px; margin: 10px 0 6px; }
.comments-empty { margin: 0 0 20px; }
.comment.flash { animation: comment-flash 2.2s ease-out; }
@keyframes comment-flash {
  0%, 35% { background: var(--accent-soft); box-shadow: 0 0 0 8px var(--accent-soft); }
  100% { background: transparent; box-shadow: 0 0 0 8px transparent; }
}

/* Dialog (shared delete confirmation) ------------------------------------ */

.dialog {
  width: min(460px, calc(100vw - 32px)); padding: 0;
  border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog[open] { animation: dialog-in 0.16s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.dialog-body { display: grid; gap: 12px; padding: 24px; margin: 0; }
.dialog-icon {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%;
  background: var(--accent-soft); color: var(--danger-text);
}
.dialog-title { font-size: 19px; line-height: 1.3; overflow-wrap: anywhere; }
.dialog-text { display: grid; gap: 8px; color: var(--text-2); font-size: 14.5px; }
.dialog-text strong { color: var(--text); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.btn-danger-fill { background: #c81e22; color: #fff; }
.btn-danger-fill:hover { background: #a8181c; }

/* Forms: selects, checkboxes, choice chips, scheduling ------------------- */

fieldset.field { margin: 0; padding: 0; border: 0; min-width: 0; }
legend.label { padding: 0; }
.select-wrap { position: relative; }
.field .select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer; }
.select-wrap .icon { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-2); }
.field select option { background: var(--surface); color: var(--text); }
[data-vis-help] { margin-top: 6px; }

.field label.check-row, .check-row {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 7px 0;
  font-size: 14.5px; font-weight: 500; cursor: pointer;
}
.check-row input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.check-row > span { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.schedule-row { margin-top: 10px; padding-top: 4px; border-top: 1px solid var(--line); }
.schedule-when { margin-top: 4px; padding: 12px 14px; border-radius: 10px; background: var(--surface); }
.schedule-when label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }

.chip-help { margin: -2px 0 10px; }
.choice-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-chips .choice-chip { position: relative; display: inline-flex; margin: 0; font-weight: 600; cursor: pointer; }
.choice-chip input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.choice-chip-face {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
  font-size: 14px; transition: border-color 0.15s, background-color 0.15s;
}
.choice-chip:hover .choice-chip-face { border-color: var(--text-3); }
.choice-chip input:checked + .choice-chip-face { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice-chip input:checked + .choice-chip-face::before { content: "✓"; font-weight: 800; color: var(--accent); }
.choice-chip input:focus-visible + .choice-chip-face { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice-chip-face .ubadge { margin-left: 0; }
.choice-chip-none .choice-chip-face { color: var(--text-2); font-weight: 500; }
.signup-extras { display: grid; gap: 18px; padding: 16px; border-radius: 14px; background: var(--surface-2); }

/* Settings + creator application ----------------------------------------- */

.settings-section { display: grid; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }
.settings-section:first-of-type { padding-top: 0; border-top: 0; }
.settings-heading { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }
.settings-callout {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 26px; padding: 16px;
  border-radius: 14px; background: var(--surface-2);
}
.settings-callout > div { flex: 1; min-width: 180px; }
.callout-icon, .apply-icon {
  display: grid; place-items: center; flex: none; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
}
.callout-icon { width: 40px; height: 40px; }
.apply-icon { width: 56px; height: 56px; margin-bottom: 14px; }
.apply-perks { display: grid; gap: 10px; margin: 0 0 22px; padding: 0; list-style: none; }
.apply-perks li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.apply-perks .icon { flex: none; color: var(--accent); }
.apply-declined {
  display: grid; gap: 6px; margin-bottom: 20px; padding: 14px 16px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  background: color-mix(in srgb, var(--warn) 10%, transparent);
}
.apply-declined p { white-space: pre-wrap; overflow-wrap: anywhere; }
.apply-declined p.apply-status { white-space: normal; }
.apply-status { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font-size: 14px; color: var(--text-2); }
.apply-status strong { color: var(--text); }
.apply-status-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.apply-status-dot.is-pending { background: var(--accent); }
.apply-status-dot.is-declined { background: var(--warn); }
.apply-summary { display: grid; gap: 12px; margin: 22px 0; }
.apply-summary div { padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.apply-summary dt { margin-bottom: 4px; font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.apply-summary dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.apply-tip { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.apply-tip .icon { flex: none; margin-top: 2px; }

/* Leaderboard ------------------------------------------------------------ */

.lb { max-width: 1320px; margin: 0 auto; }
.lb-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.lb-head .page-title { margin-bottom: 2px; }
.lb-trophy {
  width: 56px; height: 56px; display: grid; place-items: center; flex: none; border-radius: 16px;
  background: linear-gradient(135deg, #f7d26a, #d99a06); color: #2b1d00;
}
.lb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 18px; align-items: start; }
.lb-panel { min-width: 0; padding: 18px 16px 8px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.lb-panel-head { margin-bottom: 8px; padding: 0 4px; }
.lb-panel-head h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; }
.lb-list { margin: 0; padding: 0; list-style: none; }
.lb-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-top: 1px solid var(--line); }
.lb-item:first-child { border-top: 0; }
.lb-rank { width: 26px; flex: none; text-align: center; font: 800 20px/1 var(--font-display); color: var(--text-3); font-variant-numeric: tabular-nums; }
.lb-rank.lb-podium { color: var(--text); }
.lb-lead { flex: none; }
.lb-thumb { width: 96px; }
.lb-thumb .thumb { border-radius: 8px; }
.lb-thumb .badge { right: 4px; bottom: 4px; padding: 1px 4px; font-size: 10.5px; }
.lb-text { flex: 1; min-width: 0; display: grid; gap: 1px; }
.lb-name { display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; min-width: 0; font-weight: 700; }
.lb-name a { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-text > .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name .ubadge { flex: none; }
.lb-title {
  font-size: 14px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lb-title:hover, .lb-name a:hover { color: var(--accent); }
.lb-stat { flex: none; display: grid; justify-items: end; text-align: right; font-variant-numeric: tabular-nums; }
.lb-stat strong { font-size: 15px; }
.lb-empty { padding: 16px 4px 22px; font-size: 14px; }

/* Error + "coming soon" pages -------------------------------------------- */

.empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.soon-title { font-size: 24px; line-height: 1.25; overflow-wrap: anywhere; }
.soon-by { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; }
.soon-by a { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }

/* Toast ------------------------------------------------------------------ */

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100; transform: translateX(-50%);
  display: flex; align-items: center; gap: 16px; max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow);
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  animation: toast-in 0.2s ease-out;
}
.toast button { padding: 0; border: 0; background: none; color: var(--toast-action); font-weight: 800; cursor: pointer; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Responsive ------------------------------------------------------------- */

@media (max-width: 1100px) {
  .watch-page { grid-template-columns: minmax(0, 1fr); }
  .up-next { border-top: 1px solid var(--line); padding-top: 20px; }
}

@media (max-width: 860px) {
  .upload-grid { grid-template-columns: minmax(0, 1fr); }
  .upload-side { position: static; order: -1; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 12px 10px; row-gap: 8px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .actions { margin-left: auto; }
  .hide-sm { display: none; }
  .wordmark { font-size: 24px; }
  .page { padding: 16px 16px 56px; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .watch-page { padding: 0 0 56px; gap: 16px; }
  .player { border-radius: 0; max-height: none; }
  .watch-info, .up-next { padding: 0 16px; }
  .watch-title { font-size: 18px; }
  .watch-bar { align-items: flex-start; }
  .channel-chip { width: 100%; }
  .channel-chip .btn { margin-left: auto; }
  .row-card { grid-template-columns: 150px minmax(0, 1fr); }
  .channel-head { gap: 16px; }
  .channel-head .avatar { --size: 72px !important; }
  .channel-head h1 { font-size: 32px; }
  .auth-card { margin: 16px auto; padding: 24px 20px; }
  .page-title { font-size: 28px; }
}

@media (max-width: 480px) {
  .hide-xs { display: none !important; }
  .topbar { column-gap: 10px; }
  .actions { gap: 2px; }
  .upload-btn { width: 40px; padding: 0; }
  .lb-thumb { width: 72px; }
  .lb-item {
    display: grid; grid-template-columns: 20px auto minmax(0, 1fr); column-gap: 10px; row-gap: 2px;
    grid-template-areas: "rank lead text" "rank lead stat";
  }
  .lb-rank { grid-area: rank; width: 20px; align-self: center; }
  .lb-lead { grid-area: lead; align-self: center; }
  .lb-text { grid-area: text; }
  .lb-stat { grid-area: stat; display: flex; align-items: baseline; gap: 5px; justify-items: start; text-align: left; }
  .lb-stat strong { font-size: 14px; }
  .lb-lead .avatar { --size: 34px !important; }
  .lb-head { gap: 12px; }
  .lb-trophy { width: 44px; height: 44px; border-radius: 12px; }
  .dialog-body { padding: 20px 18px; }
  .dialog-actions .btn { flex: 1 1 auto; }
  .auth-card { padding: 20px 16px; }
  .signup-extras { padding: 14px 12px; }
  .react-group .react-btn { padding-left: 12px; padding-right: 12px; }
  .manage-bar .btn { flex: 1 1 auto; }
}

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

/* Site footer ------------------------------------------------------------ */

.site-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
  max-width: 1680px; margin: 0 auto; padding: 22px 24px 36px;
  border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--text-2); }
.site-footer a:hover { color: var(--text); text-decoration: underline; }
@media (max-width: 720px) { .site-footer { padding: 18px 16px 28px; } }
