/* ------------------------------------------------------------------ */
/* tokens                                                              */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: dark;
  --bg: #0f0f0f;
  --bg-elevated: #181818;
  --surface: #212121;
  --surface-hover: #313131;
  --chip: #272727;
  --chip-hover: #3f3f3f;
  --border: #303030;
  --text: #f1f1f1;
  --text-dim: #aaaaaa;
  --text-faint: #717171;
  /*
   * Green, and a dark label colour to sit on it.
   *
   * A vivid green is bright enough that white text on it falls under 3:1 — the
   * usual instinct of "brand colour, white label" fails here. Dark text on the
   * same green measures 7.6:1, so the vivid version is kept and the label is
   * flipped instead of dulling the colour to make white work.
   */
  --accent: #00c853;
  --accent-hover: #2ee06f;
  --on-accent: #06210f;

  /*
   * Red keeps its own job. With green as the brand, red no longer says
   * "NexTube" — it is free to mean only what it means everywhere else, which is
   * that something is about to be destroyed or has broken a rule.
   */
  --danger: #ff3b30;
  --danger-soft: rgba(255, 59, 48, .14);

  --blue: #3ea6ff;
  --scrim: rgba(0, 0, 0, .6);
  --header-h: 56px;
  --rail-w: 240px;
  --rail-mini-w: 72px;
  --radius: 12px;
  --shadow: 0 4px 32px rgba(0, 0, 0, .5);
  --font: "Noto Sans Thai", "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI",
          "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  /*
   * The dark theme's green reads at 2.2:1 against white, which is not legible
   * as text. Light mode takes it down to a shade that measures 3.5:1 and keeps
   * white as its label colour, where that direction does work.
   */
  --accent: #0f9d58;
  --accent-hover: #0c8249;
  --on-accent: #ffffff;
  --danger: #c5221f;
  --danger-soft: rgba(197, 34, 31, .12);
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --surface: #f2f2f2;
  --surface-hover: #e5e5e5;
  --chip: #f2f2f2;
  --chip-hover: #d9d9d9;
  --border: #e5e5e5;
  --text: #0f0f0f;
  --text-dim: #606060;
  --text-faint: #909090;
  --scrim: rgba(0, 0, 0, .45);
  --shadow: 0 4px 32px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #5a5a5a; border: 3px solid var(--bg); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #7a7a7a; }
::-webkit-scrollbar-track { background: transparent; }

.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }
.icon-sm { width: 18px; height: 18px; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

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

/* ------------------------------------------------------------------ */
/* buttons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; background: var(--chip); color: var(--text);
  padding: 0 16px; height: 36px; border-radius: 18px;
  font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .12s ease;
}
.btn:hover { background: var(--chip-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: var(--text); opacity: .88; }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--blue); }
.btn-outline:hover { background: rgba(62, 166, 255, .12); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-icon {
  width: 40px; height: 40px; padding: 0; border-radius: 50%;
  background: transparent; display: inline-flex; align-items: center; justify-content: center;
  border: none; cursor: pointer; color: var(--text);
}
.btn-icon:hover { background: var(--surface-hover); }
.btn-pill-group { display: inline-flex; background: var(--chip); border-radius: 18px; overflow: hidden; }
.btn-pill-group .btn { background: transparent; border-radius: 0; }
.btn-pill-group .divider { width: 1px; background: var(--border); margin: 8px 0; }

.field {
  width: 100%; height: 44px; padding: 0 14px;
  background: transparent; border: 1px solid var(--border); border-radius: 8px;
  outline: none;
}
.field:focus { border-color: var(--blue); }
textarea.field { height: auto; padding: 12px 14px; resize: vertical; min-height: 92px; line-height: 1.5; }
select.field { appearance: none; background: var(--bg); }
.form-row { display: grid; gap: 6px; margin-bottom: 16px; }
.form-row label { color: var(--text-dim); font-size: 13px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ------------------------------------------------------------------ */
/* header                                                              */
/* ------------------------------------------------------------------ */

.header {
  position: fixed; inset: 0 0 auto 0; height: var(--header-h); z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 0 16px;
  background: var(--bg);
}
.header-start, .header-end { display: flex; align-items: center; gap: 4px; }
.header-start { flex: none; }
.header-end { flex: none; margin-inline-start: auto; }
.header-mid { flex: 1; display: flex; justify-content: center; gap: 8px; min-width: 0; }

.brand { display: flex; align-items: center; gap: 4px; margin-inline-start: 8px; }
.brand svg { height: 20px; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -1px; }
.brand-tld { font-size: 10px; vertical-align: super; color: var(--text-dim); }

.search-form {
  display: flex; align-items: center; flex: 1; max-width: 560px; position: relative;
}
.search-box {
  display: flex; flex: 1; align-items: center;
  border: 1px solid var(--border); border-radius: 20px 0 0 20px;
  background: rgba(0, 0, 0, .18); padding-inline-start: 16px; height: 40px;
}
:root[data-theme="light"] .search-box { background: #fff; }
.search-box:focus-within { border-color: var(--blue); }
.search-box input { flex: 1; background: none; border: none; outline: none; height: 100%; min-width: 0; }
.search-submit {
  width: 64px; height: 40px; border: 1px solid var(--border); border-inline-start: none;
  border-radius: 0 20px 20px 0; background: var(--chip); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.search-submit:hover { background: var(--chip-hover); }
[dir="rtl"] .search-box { border-radius: 0 20px 20px 0; }
[dir="rtl"] .search-submit { border-radius: 20px 0 0 20px; }

/* Phones collapse the search field to a single button; desktops never do. */
.search-toggle { display: none; }

.suggest {
  position: absolute; top: 46px; inset-inline-start: 0; width: 100%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow); padding: 8px 0; z-index: 70;
  max-height: 420px; overflow-y: auto;
}
.suggest-item {
  display: flex; align-items: center; gap: 12px; padding: 6px 16px; cursor: pointer;
}
.suggest-item:hover, .suggest-item.active { background: var(--surface-hover); }
.suggest-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar { border-radius: 50%; object-fit: cover; background: var(--surface); flex: none; }
.avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent); font-weight: 600; border-radius: 50%; flex: none;
  text-transform: uppercase;
}

.badge-count {
  position: absolute; top: 2px; inset-inline-end: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 8px; background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* ------------------------------------------------------------------ */
/* rail / sidebar                                                      */
/* ------------------------------------------------------------------ */

.rail {
  position: fixed; top: var(--header-h); bottom: 0; inset-inline-start: 0;
  width: var(--rail-w); overflow-y: auto; overflow-x: hidden;
  padding: 12px; z-index: 50; background: var(--bg);
  scrollbar-width: thin;
}
.rail::-webkit-scrollbar { width: 8px; }
.rail:not(:hover)::-webkit-scrollbar-thumb { background: transparent; }

.rail-item {
  display: flex; align-items: center; gap: 24px;
  height: 40px; padding: 0 12px; border-radius: 10px; cursor: pointer;
}
.rail-item:hover { background: var(--surface-hover); }
.rail-item.active { background: var(--surface); font-weight: 500; }
.rail-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-section { border-top: 1px solid var(--border); margin: 12px 0; padding-top: 12px; }
.rail-title { padding: 6px 12px; font-size: 16px; font-weight: 600; }
.rail-foot { padding: 16px 12px; color: var(--text-faint); font-size: 12px; line-height: 1.6; }

body.rail-mini .rail { width: var(--rail-mini-w); padding: 0; }
body.rail-mini .rail-item {
  flex-direction: column; gap: 6px; height: 74px; justify-content: center;
  font-size: 10px; border-radius: 10px; margin: 0 4px;
}
body.rail-mini .rail-item span { max-width: 64px; text-align: center; }
body.rail-mini .rail-section, body.rail-mini .rail-title, body.rail-mini .rail-foot { display: none; }

.scrim {
  position: fixed; inset: 0; background: var(--scrim); z-index: 45; display: none;
}
body.drawer-open .scrim { display: block; }

/* ------------------------------------------------------------------ */
/* layout                                                              */
/* ------------------------------------------------------------------ */

.app-main {
  margin-top: var(--header-h);
  margin-inline-start: var(--rail-w);
  padding: 24px;
  min-height: calc(100vh - var(--header-h));
}
body.rail-mini .app-main { margin-inline-start: var(--rail-mini-w); }

/*
 * The watch page gives the whole width to the video.
 *
 * YouTube's watch page carries no rail at all — its content starts 16px from
 * the edge at every width I measured. The hamburger still opens the rail as an
 * overlay, so nothing becomes unreachable.
 */
body.rail-hidden .rail { transform: translateX(-100%); }
[dir="rtl"] body.rail-hidden .rail { transform: translateX(100%); }
body.rail-hidden.drawer-open .rail { transform: none; }
body.rail-hidden .app-main { margin-inline-start: 0; padding: 16px; }

.page-title { font-size: 24px; font-weight: 700; margin: 0 0 20px; }
.section-title { font-size: 20px; font-weight: 600; margin: 28px 0 14px; }

.chips {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px;
  margin: -6px 0 18px; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 32px; padding: 0 12px; border-radius: 8px;
  background: var(--chip); border: none; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--chip-hover); }
.chip.active { background: var(--text); color: var(--bg); }

/*
 * A fixed number of cards per row rather than auto-fill, so the density is the
 * same every time instead of drifting with the window. The counts step down at
 * the breakpoints below; four videos per row is the desktop default.
 */
.grid, .shelf {
  --cols: 4;
  --gap: 16px;
}
.grid-shorts, .shelf-shorts { --cols: 7; }

.grid {
  display: grid; gap: var(--gap);
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
}

/**
 * A shelf is one row that scrolls sideways, so a narrow window simply shows
 * fewer cards instead of spilling into a ragged second row. Each card is an
 * exact fraction of the row, so the count above is what you actually see.
 */
.shelf {
  display: grid; grid-auto-flow: column; gap: var(--gap);
  grid-auto-columns: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  overflow-x: auto; overscroll-behavior-x: contain;
  padding-bottom: 8px; scrollbar-width: thin;
}
.shelf::-webkit-scrollbar { height: 8px; }
.shelf:not(:hover)::-webkit-scrollbar-thumb { background: transparent; }

@media (min-width: 2400px) {
  .grid, .shelf { --cols: 5; }
  .grid-shorts, .shelf-shorts { --cols: 9; }
}
@media (max-width: 1699px) {
  .grid, .shelf { --cols: 3; }
  .grid-shorts, .shelf-shorts { --cols: 6; }
}
@media (max-width: 1349px) {
  .grid, .shelf { --cols: 2; }
  .grid-shorts, .shelf-shorts { --cols: 5; }
}
@media (max-width: 900px) {
  .grid-shorts, .shelf-shorts { --cols: 4; }
}

/* ------------------------------------------------------------------ */
/* video card                                                          */
/* ------------------------------------------------------------------ */

.card { display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.thumb-wrap {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius);
  overflow: hidden; background: var(--surface);
}
.thumb-wrap img, .thumb-wrap video { width: 100%; height: 100%; object-fit: cover; }
.thumb-wrap video { position: absolute; inset: 0; opacity: 0; transition: opacity .2s; }
.card:hover .thumb-wrap video.ready { opacity: 1; }
.thumb-time {
  position: absolute; bottom: 6px; inset-inline-end: 6px;
  background: rgba(0, 0, 0, .8); color: #fff; font-size: 12px; font-weight: 500;
  padding: 1px 4px; border-radius: 4px;
}
.thumb-live {
  position: absolute; bottom: 6px; inset-inline-end: 6px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 5px; border-radius: 4px; letter-spacing: .4px;
}
.thumb-progress {
  position: absolute; bottom: 0; inset-inline-start: 0; height: 4px;
  background: rgba(255, 255, 255, .3); width: 100%;
}
.thumb-progress i { display: block; height: 100%; background: var(--accent); }

.card-body { display: flex; gap: 12px; }
.card-meta { min-width: 0; flex: 1; }
.card-title {
  font-size: 15px; font-weight: 500; line-height: 1.35; margin: 0 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { color: var(--text-dim); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px; }
.card-sub a:hover { color: var(--text); }
.dot::before { content: "•"; margin: 0 4px; }

/*
 * Shorts thumbnails are cropped to 2:3 rather than the clip's full 9:16.
 * A true 9:16 card is so tall it dominates the page; cropping keeps the row a
 * sensible height, which is what a Shorts shelf does everywhere else.
 */
.card-shorts .thumb-wrap { aspect-ratio: 2 / 3; }
.card-shorts .card-title { -webkit-line-clamp: 2; font-size: 14px; }
.card-shorts .card-meta { padding-top: 8px; }

.card-row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; cursor: pointer; }
.card-row .thumb-wrap { border-radius: 8px; }
.card-row .card-title { font-size: 15px; line-height: 1.4; }
.card-row .card-sub { font-size: 13px; }
/*
 * The thumbnail takes whatever the text column does not, so it tracks the
 * sidebar width exactly — 100% here is the sidebar, not the page.
 */
.watch-side .card-row { grid-template-columns: calc(100% - var(--upnext-text)) 1fr; }

.card-wide { display: grid; grid-template-columns: 360px 1fr; gap: 16px; cursor: pointer; margin-bottom: 20px; }
.card-wide .card-title { font-size: 18px; -webkit-line-clamp: 2; }
.card-wide .card-desc {
  color: var(--text-dim); font-size: 12px; margin-top: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.empty-state {
  display: grid; place-items: center; gap: 12px; padding: 64px 16px; text-align: center;
  color: var(--text-dim);
}
.empty-state .icon { width: 48px; height: 48px; opacity: .5; }

.skeleton { background: var(--surface); border-radius: var(--radius); animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }

/* ------------------------------------------------------------------ */
/* watch page                                                          */
/* ------------------------------------------------------------------ */

.watch {
  display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start;
  justify-content: flex-start;
  /*
   * Centred, but only because the block is capped to exactly what it contains.
   * Centring a block that is allowed to be wider than its content is what put
   * the player in the middle of the page with a gap beside it; capping first
   * and centring second gives the even outside margins YouTube has.
   */
  margin-inline: auto;
  /*
   * Space kept free below the player, which is what decides how wide it may be.
   *
   * Measured from YouTube rather than guessed: its cap is
   * calc((100vh - 56px - 12px - 48px) * (1/0.5625)) — a 56px masthead, 12px
   * above the player and 48px below it, 116px in total. The 190px that used to
   * be here was an attempt to keep the title and buttons on screen, and it cost
   * the player about 130px of width on a short window for no good reason: the
   * page scrolls, so the title does not have to fit above the fold.
   */
  --player-reserve: 60px;
  /*
   * Height follows width through the 16:9 ratio, so capping the height means
   * capping the width. The cap lands on the whole column, not just the player,
   * so the title, buttons and comments stay flush with the video's left edge.
   */
  --player-max: calc((100vh - var(--header-h) - var(--player-reserve)) * 16 / 9);

  /*
   * Sidebar width, taken from YouTube rather than derived.
   *
   * The earlier version grew the sidebar with the window so that exactly four
   * clips always stood beside the player. Measuring YouTube showed it does the
   * opposite: its sidebar is a fixed width per breakpoint and every extra pixel
   * of window goes to the video. On one 16:9 video at 900px tall its sidebar
   * stayed at 338px from 1200px wide all the way to 1920px while the player
   * grew from 853px to 1394px.
   *
   * These three steps are its wide-card layout, measured at 1366, 1600/1920 and
   * 2560. Feeding them back through "player takes the rest, capped by height"
   * reproduces YouTube's own player width to within about ten pixels at every
   * size. The cost is that the number of clips beside the player is no longer
   * fixed — it runs about four to five depending on the window, which is
   * exactly how YouTube behaves.
   */
  --upnext-gap: 8px;
  /* 197px of text beside the thumbnail, plus the 12px between them. */
  --upnext-text: 209px;
  --side-w: 367px;

  max-width: calc(var(--player-max) + var(--side-w) + 24px);
}

/* YouTube's wide-card sidebar steps, measured. */
@media (min-width: 1500px) { .watch { --side-w: 557px; } }
@media (min-width: 2200px) { .watch { --side-w: 696px; } }
/*
 * Grows into whatever the sidebar does not use, up to the height-derived cap.
 *
 * The basis has to be 0 rather than --player-max. Wrapping is decided from the
 * flex basis before anything is allowed to shrink, so a basis equal to the cap
 * pushed the sidebar onto its own line on any screen narrower than the cap plus
 * the sidebar — the player ended up full width with the up-next list stranded
 * underneath it. From 0 the line always fits and the player simply takes the
 * space that is left.
 */
.watch-main { flex: 1 1 0; max-width: var(--player-max); min-width: 0; }
.watch-side { flex: 0 0 var(--side-w); min-width: 0; }

.watch.theater { max-width: none; --player-reserve: 40px; margin-inline: auto; }
.watch.theater .watch-main { flex-basis: 100%; max-width: var(--player-max); }

.player-shell {
  position: relative; background: #000; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 16 / 9; width: 100%;
}
.watch.theater .player-shell { border-radius: 0; }
.player-shell video {
  width: 100%; height: 100%; display: block; background: #000;
  object-fit: contain;   /* letterbox anything that is not 16:9 rather than crop it */
}

.player-overlay { position: absolute; inset: 0; cursor: pointer; }
.player-center {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.player-center .pulse {
  width: 64px; height: 64px; border-radius: 50%; background: rgba(0, 0, 0, .6);
  display: grid; place-items: center; opacity: 0; transform: scale(.6);
}
.player-center .pulse.show { animation: pulse-out .5s ease-out; }
@keyframes pulse-out {
  0% { opacity: 1; transform: scale(.7); }
  100% { opacity: 0; transform: scale(1.4); }
}

.player-controls {
  position: absolute; inset-inline: 0; bottom: 0; padding: 0 12px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  opacity: 0; transition: opacity .2s; color: #fff;
}
.player-shell:hover .player-controls,
.player-shell.paused .player-controls,
.player-shell.controls-on .player-controls { opacity: 1; }

.scrub { height: 16px; display: flex; align-items: center; cursor: pointer; }
.scrub-track { position: relative; height: 4px; width: 100%; background: rgba(255, 255, 255, .3); border-radius: 2px; }
.scrub:hover .scrub-track { height: 6px; }
.scrub-buffer { position: absolute; inset-block: 0; inset-inline-start: 0; background: rgba(255, 255, 255, .45); }
.scrub-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--accent); }
.scrub-knob {
  position: absolute; top: 50%; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%) scale(0); transition: transform .1s;
}
.scrub:hover .scrub-knob { transform: translate(-50%, -50%) scale(1); }
.scrub-tip {
  position: absolute; bottom: 18px; transform: translateX(-50%);
  background: rgba(0, 0, 0, .85); padding: 2px 6px; border-radius: 4px; font-size: 12px;
  pointer-events: none; opacity: 0;
}
.scrub:hover .scrub-tip { opacity: 1; }

.player-bar { display: flex; align-items: center; gap: 4px; height: 40px; }
.player-bar .btn-icon { color: #fff; width: 38px; height: 38px; }
.player-bar .btn-icon:hover { background: rgba(255, 255, 255, .12); }
.player-time { font-size: 13px; padding: 0 8px; font-variant-numeric: tabular-nums; }
.player-spacer { flex: 1; }
.volume { display: flex; align-items: center; }
.volume input {
  width: 0; opacity: 0; transition: width .15s, opacity .15s; accent-color: #fff; cursor: pointer;
}
.volume:hover input, .volume input:focus { width: 72px; opacity: 1; margin-inline-start: 6px; }

.player-menu {
  position: absolute; bottom: 56px; inset-inline-end: 12px; min-width: 180px;
  background: rgba(28, 28, 28, .96); border-radius: 12px; padding: 8px 0; color: #fff;
  box-shadow: var(--shadow);
}
.player-menu button {
  display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 16px;
  background: none; border: none; cursor: pointer; text-align: start;
}
.player-menu button:hover { background: rgba(255, 255, 255, .12); }
.player-menu button.on { color: var(--blue); }

.video-title { font-size: 20px; font-weight: 700; margin: 14px 0 12px; line-height: 1.3; }
.video-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.channel-row { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 240px; }
.channel-row .names { min-width: 0; }
.channel-row .name { font-weight: 600; display: flex; align-items: center; gap: 4px; }
.channel-row .subs { color: var(--text-dim); font-size: 12px; }

.desc-box {
  background: var(--surface); border-radius: var(--radius); padding: 12px; margin-top: 12px;
  cursor: pointer; font-size: 14px; white-space: pre-wrap; word-break: break-word;
}
.desc-box.collapsed { max-height: 68px; overflow: hidden; position: relative; }
.desc-box.collapsed::after {
  content: attr(data-more); position: absolute; bottom: 4px; inset-inline-end: 12px;
  background: var(--surface); padding-inline-start: 24px; font-weight: 600;
}
.desc-stats { font-weight: 600; margin-bottom: 8px; }

.comments-head { display: flex; align-items: center; gap: 24px; margin: 24px 0 18px; }
.comment { display: flex; gap: 16px; margin-bottom: 18px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 2px; }
.comment-head .author { font-weight: 600; }
.comment-head .author.creator { background: var(--surface); padding: 1px 6px; border-radius: 10px; }
.comment-head time { color: var(--text-dim); }
.comment-text { white-space: pre-wrap; word-break: break-word; }
.comment-actions { display: flex; align-items: center; gap: 4px; margin-top: 4px; color: var(--text-dim); }
.comment-actions .btn-icon { width: 32px; height: 32px; }
.comment-replies { margin-top: 10px; }
.comment-editor { display: flex; gap: 16px; margin-bottom: 26px; }
.comment-input {
  flex: 1; background: none; border: none; border-bottom: 1px solid var(--border);
  padding: 6px 0; outline: none; resize: none; min-height: 28px;
}
.comment-input:focus { border-bottom-color: var(--text); }
.comment-editor-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.pill-flag {
  font-size: 11px; background: var(--surface); padding: 2px 8px; border-radius: 10px;
  color: var(--text-dim);
}

/* ------------------------------------------------------------------ */
/* shorts                                                              */
/* ------------------------------------------------------------------ */

.shorts-viewport {
  height: calc(100vh - var(--header-h) - 16px);
  overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.shorts-viewport::-webkit-scrollbar { display: none; }
.shorts-item {
  scroll-snap-align: center; height: 100%; display: flex; gap: 16px; align-items: flex-end;
  flex: none; width: 100%; justify-content: center;
}
.shorts-stage {
  position: relative; height: 100%; aspect-ratio: 9 / 16; max-width: 100%;
  background: #000; border-radius: 12px; overflow: hidden;
}
.shorts-stage video { width: 100%; height: 100%; object-fit: cover; }
.shorts-info {
  position: absolute; inset-inline: 0; bottom: 0; padding: 16px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .8)); color: #fff;
}
.shorts-info .title { font-weight: 600; margin-bottom: 8px; }
.shorts-side { display: flex; flex-direction: column; gap: 16px; padding-bottom: 24px; }
.shorts-side .stack { display: grid; justify-items: center; gap: 4px; font-size: 12px; }
.shorts-side .round {
  width: 48px; height: 48px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; cursor: pointer; border: none;
}
.shorts-side .round:hover { background: var(--surface-hover); }

/* ------------------------------------------------------------------ */
/* channel                                                             */
/* ------------------------------------------------------------------ */

.banner { width: 100%; aspect-ratio: 6 / 1; border-radius: var(--radius); object-fit: cover; background: var(--surface); }
.channel-head { display: flex; gap: 24px; align-items: center; padding: 20px 0; flex-wrap: wrap; }
.channel-head h1 { font-size: 24px; margin: 0 0 6px; }
.channel-head .meta { color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab {
  padding: 12px 2px; background: none; border: none; cursor: pointer;
  color: var(--text-dim); font-weight: 500; border-bottom: 2px solid transparent;
}
.tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ------------------------------------------------------------------ */
/* modals & toast                                                      */
/* ------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed; inset: 0; background: var(--scrim); z-index: 100;
  display: grid; place-items: center; padding: 20px;
}
.modal {
  background: var(--bg-elevated); border-radius: var(--radius); box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: 90vh; overflow-y: auto; border: 1px solid var(--border);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--border);
}

.menu {
  position: fixed; z-index: 110; min-width: 220px; padding: 8px 0;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
}
.menu button, .menu a {
  display: flex; width: 100%; align-items: center; gap: 16px; padding: 10px 16px;
  background: none; border: none; cursor: pointer; text-align: start;
}
.menu button:hover, .menu a:hover { background: var(--surface-hover); }
.menu .sep { height: 1px; background: var(--border); margin: 8px 0; }
.menu .head { padding: 8px 16px; color: var(--text-dim); font-size: 12px; }

.toast {
  position: fixed; bottom: 24px; inset-inline-start: 24px; z-index: 200;
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 8px;
  box-shadow: var(--shadow); animation: toast-in .2s ease-out;
}
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

.notif-panel { max-height: 70vh; overflow-y: auto; width: 380px; }
.notif-item { display: flex; gap: 12px; padding: 12px 16px; cursor: pointer; align-items: center; }
.notif-item:hover { background: var(--surface-hover); }
.notif-item.unread { background: rgba(62, 166, 255, .08); }
.notif-item .text { flex: 1; min-width: 0; font-size: 13px; }
.notif-item img.thumb { width: 72px; aspect-ratio: 16/9; object-fit: cover; border-radius: 4px; }

.upload-drop {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 48px 20px; text-align: center; display: grid; gap: 16px; place-items: center;
  cursor: pointer;
}
.upload-drop.over { border-color: var(--blue); background: rgba(62, 166, 255, .06); }
.progress { height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); transition: width .15s; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.stat b { display: block; font-size: 24px; }
.stat span { color: var(--text-dim); font-size: 13px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: start; padding: 12px 8px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-dim); font-weight: 500; font-size: 13px; }

.lang-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.lang-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: none; cursor: pointer;
}
.lang-option:hover { background: var(--surface-hover); }
.lang-option.active { border-color: var(--blue); color: var(--blue); }

.banner-note {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 18px;
  background: var(--surface); border-radius: var(--radius); font-size: 13px;
}

/* ------------------------------------------------------------------ */
/* mobile                                                              */
/* ------------------------------------------------------------------ */

.mobile-tabbar { display: none; }

@media (max-width: 1100px) {
  .watch-main, .watch-side { flex: 1 1 100%; }
  .card-wide { grid-template-columns: 240px 1fr; }
}

@media (max-width: 900px) {
  .rail, body.rail-mini .rail { transform: translateX(-100%); transition: transform .2s ease; width: var(--rail-w); padding: 12px; }
  body.rail-mini .rail-item { flex-direction: row; gap: 24px; height: 40px; justify-content: flex-start; font-size: 14px; margin: 0; }
  body.rail-mini .rail-item span { max-width: none; text-align: start; }
  body.rail-mini .rail-section, body.rail-mini .rail-title, body.rail-mini .rail-foot { display: block; }
  [dir="rtl"] .rail { transform: translateX(100%); }
  body.drawer-open .rail { transform: none; }
  .app-main, body.rail-mini .app-main { margin-inline-start: 0; }
  .brand-name { font-size: 18px; }
}

@media (max-width: 680px) {
  .app-main { padding: 12px; padding-bottom: 72px; }
  .header { padding: 0 8px; }
  .header.searching .header-start, .header.searching .header-end { display: none; }
  .search-toggle { display: inline-flex; }
  .header:not(.searching) .search-form { display: none; }
  .header.searching .search-toggle { display: none; }
  .header:not(.searching) .header-mid { justify-content: flex-end; }
  .hide-sm { display: none; }
  .grid, .shelf { --cols: 1; row-gap: 24px; }
  .grid-shorts { --cols: 2; }
  .shelf-shorts { --cols: 3; }
  .card-wide, .card-row { grid-template-columns: 160px 1fr; }
  .card-wide .card-title { font-size: 15px; }
  .card-wide .card-desc { display: none; }
  .video-title { font-size: 17px; }
  .mobile-tabbar {
    display: flex; position: fixed; inset: auto 0 0 0; height: 56px; z-index: 60;
    background: var(--bg); border-top: 1px solid var(--border);
  }
  .mobile-tabbar a {
    flex: 1; display: grid; place-items: center; gap: 2px; font-size: 10px; color: var(--text-dim);
  }
  .mobile-tabbar a.active { color: var(--text); }
  .shorts-viewport { height: calc(100vh - var(--header-h) - 72px); }
  .shorts-item { padding: 0; }
  .notif-panel { width: min(94vw, 380px); }
}


/* ------------------------------------------------------------------ */
/* quality                                                             */
/* ------------------------------------------------------------------ */

.hd-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  padding: 1px 4px; border-radius: 3px; margin-inline-start: 2px;
  background: rgba(255, 255, 255, .25); color: #fff;
}

.menu .menu-detail { margin-inline-start: auto; color: var(--text-dim); font-size: 13px; }
.menu button > span:first-of-type { flex: none; }

.processing-note {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
  color: var(--text-dim); margin-top: 10px;
}
.processing-note .progress { flex: 1; max-width: 240px; }

/* ------------------------------------------------------------------ */
/* advertising                                                         */
/* ------------------------------------------------------------------ */

/*
 * The pre-roll sits on top of the player rather than replacing it, so the
 * content underneath keeps whatever it has buffered and comes straight back.
 */
.ad-layer { position: absolute; inset: 0; z-index: 6; background: #000; }
.ad-video { width: 100%; height: 100%; display: block; object-fit: contain; cursor: pointer; }

/* While an ad runs the content's own controls must not be reachable. */
.player-shell.ad-playing .player-controls,
.player-shell.ad-playing .player-center { display: none; }

/*
 * The scrim carries the whole overlay's legibility.
 *
 * A short, hard gradient leaves the badge sitting on whatever colour happens to
 * be under it; this one starts higher and eases, so text stays readable over a
 * bright frame without the picture looking like it has a black bar across it.
 */
.ad-overlay {
  position: absolute; inset: auto 0 0 0;
  padding: 48px 16px 18px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, .78) 0%,
    rgba(0, 0, 0, .45) 45%,
    transparent 100%
  );
  pointer-events: none;                 /* only the controls inside take clicks */
}
.ad-overlay-row { display: flex; align-items: center; gap: 12px; }
.ad-overlay-row > * { pointer-events: auto; }
.ad-spacer { flex: 1; pointer-events: none; }

/* ---- the advertiser's card ---- */

.ad-card {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
}
.ad-card-main { display: flex; align-items: center; gap: 10px; min-width: 0; }

/*
 * Amber, not red. Red reads as an error or a record light; amber is what every
 * player has trained people to read as "this is an ad", and it ties the badge
 * to the progress bar underneath.
 */
.ad-chip {
  flex: none;
  background: #ffc800; color: #111;
  font-size: 12px; font-weight: 700; letter-spacing: .2px;
  padding: 4px 8px; border-radius: 4px;
  line-height: 1.2;
}

.ad-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: rgba(255, 255, 255, .88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  min-width: 0;
}
.ad-index { color: rgba(255, 255, 255, .62); }
.ad-index::after { content: '·'; margin-inline-start: 8px; color: rgba(255, 255, 255, .4); }
.ad-countdown { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---- call to action ---- */

.ad-cta {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; color: #0f0f0f; border: 0;
  border-radius: 999px; padding: 8px 16px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
  transition: transform .12s ease, box-shadow .12s ease;
  max-width: 260px; min-width: 0;
}
.ad-cta-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-cta .icon { flex: none; opacity: .55; }
.ad-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.ad-cta:active { transform: none; }

/* ---- skip ---- */

.ad-skip {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(20, 20, 20, .72);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff; border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px; padding: 9px 18px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
  animation: ad-skip-in .22s ease both;
}
.ad-skip .icon { opacity: .8; }
.ad-skip:hover {
  background: rgba(0, 0, 0, .88);
  border-color: rgba(255, 255, 255, .7);
  transform: translateY(-1px);
}
.ad-skip:active { transform: none; }

@keyframes ad-skip-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ad-skip { animation: none; }
  .ad-cta, .ad-skip { transition: none; }
}

/* ---- progress ---- */

/*
 * Pinned to the very bottom of the player, outside the scrim's padding, so it
 * reads as the ad's own timeline rather than as part of the caption row.
 */
.ad-progress {
  position: absolute; inset: auto 0 0 0;
  height: 3px; background: rgba(255, 255, 255, .22);
  z-index: 7;
}
.ad-progress-fill {
  display: block; height: 100%; width: 0;
  background: #ffc800;
  transition: width .25s linear;
}

@media (max-width: 680px) {
  .ad-overlay { padding: 36px 12px 14px; }
  .ad-overlay-row { gap: 8px; }
  .ad-cta { max-width: 150px; padding: 7px 12px; font-size: 13px; }
  .ad-skip { padding: 8px 13px; font-size: 13px; }
  .ad-skip-text { display: none; }         /* the arrow alone is understood */
  .ad-meta { font-size: 12px; }
  /*
   * On a phone the row cannot hold all four things without clipping one of
   * them, and half a word is worse than none. The counters go and the advertiser
   * stays: the amber bar along the bottom already says how much is left, but
   * nothing else says whose ad this is.
   */
  .ad-index, .ad-countdown { display: none; }
}

/* ---- display slots ---- */

.ad-slot { margin-bottom: 16px; min-height: 90px; }
.ad-slot-label {
  font-size: 12px; color: var(--text-dim); margin-bottom: 4px; letter-spacing: .3px;
}
.ad-slot-watchSide { min-height: 250px; }

@media (max-width: 680px) {
  .ad-cta { max-width: 150px; }
  .ad-skip { padding: 8px 12px; font-size: 13px; }
  .ad-label { font-size: 12px; }
}

/* ------------------------------------------------------------------ */
/* upload page                                                         */
/* ------------------------------------------------------------------ */

/*
 * One column, centred. The heading, the processing notice and the drop zone
 * are all the same width so they read as a single panel rather than three
 * things that happen to be stacked.
 */
.upload-page { max-width: 900px; margin-inline: auto; }
.upload-page .page-title { text-align: center; }

/*
 * The processing notice reads as one centred line.
 *
 * Centring only the text would leave it sitting off to the right of the clock,
 * because the icon still occupies the start of the row. Centring the row puts
 * the icon and the words in the middle together, which is what looks centred.
 */
.upload-page .banner-note { justify-content: center; text-align: center; }

/* ------------------------------------------------------------------ */
/* placeholders                                                        */
/* ------------------------------------------------------------------ */

/*
 * A card whose picture has not arrived shows a shimmer rather than a hole.
 *
 * The frame is already the right shape — `.thumb-wrap` carries the aspect
 * ratio — so nothing moves when the image lands. That is the whole point: a
 * feed that reserves no space jumps under the reader's thumb every time a
 * thumbnail arrives, and on an endless feed that never stops happening.
 */
.thumb-wrap::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(
    100deg,
    var(--surface) 30%,
    color-mix(in srgb, var(--surface) 70%, var(--text) 8%) 50%,
    var(--surface) 70%
  );
  background-size: 200% 100%;
  animation: thumb-shimmer 1.4s ease-in-out infinite;
}

/* Once the picture is there the animation stops — it would otherwise keep a
 * compositor busy for every card still on the page. */
.thumb-wrap.has-image::before { content: none; }

.thumb-wrap img {
  position: relative;          /* above the shimmer */
  opacity: 0;
  transition: opacity .25s ease;
}
.thumb-wrap img.loaded { opacity: 1; }

@keyframes thumb-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .thumb-wrap::before { animation: none; }
  .thumb-wrap img { transition: none; }
}

/*
 * Top-left of the frame, opposite the duration, so it reads before the title
 * and never covers it.
 */
/*
 * A band across the frame, not a corner chip.
 *
 * This is the one state where the thumbnail is lying: the picture looks like
 * a video anyone can press play on, and it is not one yet. A mark small enough
 * to miss at a glance is the wrong size for saying so.
 */
.thumb-held {
  position: absolute; inset-inline: 0; top: 0;
  background: rgba(255, 200, 0, .94); color: #111;
  font-size: 12px; font-weight: 700; letter-spacing: .2px;
  text-align: center; padding: 5px 8px;
  z-index: 2;
}

/*
 * The calendar date, kept out of the way.
 *
 * It belongs to the expanded description, the same place YouTube keeps it: the
 * line everybody reads should say how long ago, not what day.
 */
.desc-date { color: var(--text-dim); font-size: 13px; margin-bottom: 10px; }
.desc-box.collapsed .desc-date { display: none; }

/*
 * A note laid over the top of the picture.
 *
 * Above the video, below the controls, and out of the way of the centre where
 * the play button is. It dims while the video is running rather than
 * disappearing, so it can still be read by somebody who only notices the
 * silence a minute in.
 */
.player-note {
  position: absolute; top: 12px; inset-inline: 12px;
  z-index: 4;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 13px; border-radius: 10px;
  background: rgba(0, 0, 0, .74);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff; font-size: 13px; line-height: 1.45;
  pointer-events: none;
  transition: opacity .3s ease;
}
.player-note .icon { flex: none; color: #ffc800; }
.player-shell:not(.paused) .player-note { opacity: .45; }
.player-shell:hover .player-note { opacity: 1; }

/* An ad covers the picture entirely; nothing of ours belongs on top of it. */
.player-shell.ad-playing .player-note { display: none; }

@media (max-width: 680px) {
  .player-note { top: 8px; inset-inline: 8px; padding: 7px 10px; font-size: 12px; }
}

/* ------------------------------------------------------------------ */
/* studio                                                             */
/* ------------------------------------------------------------------ */

.studio { display: flex; gap: 28px; align-items: flex-start; }

.studio-rail {
  flex: 0 0 216px;
  position: sticky; top: calc(var(--header-h) + 24px);
  display: grid; gap: 2px;
}

.studio-channel {
  display: flex; gap: 12px; align-items: center;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.studio-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
}

.studio-link {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-size: 14px;
}
.studio-link:hover { background: var(--surface-hover); }
.studio-link.active { background: var(--surface); font-weight: 600; }
.studio-link.active .icon { color: var(--accent); }

.studio-body { flex: 1; min-width: 0; }
.studio-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 20px;
}

.studio-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px; margin-bottom: 18px;
}
.studio-card h2 { font-size: 15px; margin: 0 0 14px; }
.studio-card .stat-grid { margin: 0; }

/*
 * The one row on the dashboard that is a job rather than a number. Coloured so
 * it reads as something to deal with, not as another statistic.
 */
.studio-alert {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.studio-alert:hover { background: var(--surface-hover); }
.studio-alert b { font-size: 17px; min-width: 28px; }
.studio-alert .icon { transform: scaleX(-1); opacity: .5; }

@media (max-width: 900px) {
  /* The rail becomes a row of chips above the content. */
  .studio { display: block; }
  .studio-rail {
    position: static; display: flex; gap: 8px;
    overflow-x: auto; padding-bottom: 12px; margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }
  .studio-channel { display: none; }
  .studio-link { flex: none; padding: 8px 14px; background: var(--chip); border-radius: 18px; }
}

/*
 * Channel standing, above every studio page.
 *
 * The colour is the whole point: a reviewer picked yellow or orange precisely
 * because those mean different things, and the uploader is the person that
 * distinction was drawn for. Tinted background rather than a solid fill — this
 * is a standing notice that may sit there for weeks, and a block of saturated
 * colour at the top of every page stops being read after the second day.
 */
.studio-standing {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  border: 1px solid var(--standing);
  background: color-mix(in srgb, var(--standing) 12%, transparent);
}
.studio-standing-dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--standing);
}
.studio-standing.is-warning    { --standing: #ffc800; }
.studio-standing.is-restricted { --standing: #ff8a00; }
.studio-standing.is-suspended  { --standing: var(--danger); }

/* The reason a video was removed, under its title in the studio table. */
.studio-reason {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border-inline-start: 3px solid var(--danger);
  background: var(--danger-soft);
  line-height: 1.6;
  white-space: normal;
  max-width: 640px;
}

/*
 * Removing a video for a rule it broke is not the affirmative action on the
 * row, and it should not wear the colour that means "publish this".
 */
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }

/*
 * A policy document, rather than a page of prose.
 *
 * A wall of paragraphs is technically the same text and nobody reads to the
 * end of it. Numbered sections in their own cards, with a contents list that
 * stays on screen, means somebody who came for one clause — usually "what
 * happens to my video" — can go straight to it instead of scanning.
 */
.legal-doc { max-width: 1040px; }

.legal-head {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  margin-bottom: 18px;
}
.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-dim);
}

.legal-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.legal-toc {
  position: sticky;
  top: 80px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.legal-toc-title {
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 10px;
}
.legal-toc ol { margin: 0; padding: 0; list-style: none; }
.legal-toc li { margin-bottom: 8px; line-height: 1.5; }
.legal-toc a { color: var(--text-dim); font-size: 14px; }
.legal-toc a:hover { color: var(--accent); }

.legal-card {
  padding: 22px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  /* So an anchor jump does not tuck the heading under the fixed header. */
  scroll-margin-top: 80px;
}
.legal-card p:last-child, .legal-card ul:last-child { margin-bottom: 0; }

/* On a phone the contents belongs above the text, not beside it. */
@media (max-width: 900px) {
  .legal-body { grid-template-columns: 1fr; }
  .legal-toc { position: static; }
}

/*
 * Impressions per day, as bars.
 *
 * Flexed rather than positioned so a month and a quarter both fill the width
 * without arithmetic, and so a day with nothing still occupies its slot — a
 * quiet week that silently collapses into the days either side of it is a
 * chart that lies about when something happened.
 */
.ad-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 140px;
  padding: 8px 0;
}
.ad-bar {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  opacity: .75;
  transition: opacity .12s;
}
.ad-bar:hover { opacity: 1; }
