/* yt.css: the YouTube section. Uses the base.css tokens (newer ones with
   fallbacks). The interface is black, white and grays only; thumbnails and
   the video keep their own colour, and a thumbnail used as decoration
   (ambient glow, backdrop) is always grayscale. Reduced motion switches
   the movement off at the end of this file. */

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

html[data-page="yt"] {
  --p1: var(--panel, #070707);
  --p2: var(--panel-2, #0e0e0e);
  --l3: var(--line-3, #5a5a5a);
  --eo: var(--ease-out, cubic-bezier(.16, 1, .3, 1));
  --es: var(--ease-snap, cubic-bezier(.7, 0, .2, 1));
  --gl: var(--glow, 0 0 1px rgba(255, 255, 255, .55), 0 0 12px rgba(255, 255, 255, .22));
  --glb: var(--glow-box, 0 0 0 1px rgba(255, 255, 255, .08), 0 0 24px rgba(255, 255, 255, .06));
  scrollbar-width: thin;
  scrollbar-color: #333 #000;
}

/* thin, quiet scrollbars (for engines without scrollbar-color) */
[data-page="yt"] ::-webkit-scrollbar { width: 10px; height: 8px; }
[data-page="yt"] ::-webkit-scrollbar-track { background: #000; }
[data-page="yt"] ::-webkit-scrollbar-thumb { background: #2c2c2c; border: 3px solid #000; }
[data-page="yt"] ::-webkit-scrollbar-thumb:hover { background: #5a5a5a; }

/* corner brackets: eight 1px strokes in the element's own colour */
.thumb::after,
.short-thumb::after,
.w-br,
.reel-br,
.start-field::after,
.tile::after,
.ch-banner::before {
  background:
    linear-gradient(currentColor, currentColor) left top / var(--bs, 12px) 1px no-repeat,
    linear-gradient(currentColor, currentColor) left top / 1px var(--bs, 12px) no-repeat,
    linear-gradient(currentColor, currentColor) right top / var(--bs, 12px) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 1px var(--bs, 12px) no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / var(--bs, 12px) 1px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 1px var(--bs, 12px) no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / var(--bs, 12px) 1px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 1px var(--bs, 12px) no-repeat;
}

/* ---------- background layers ---------- */

/* the glyph rain falls only behind the build screen, faded in the middle */
html[data-page="yt"] #rain {
  opacity: 0;
  visibility: hidden;
  transition: opacity .8s var(--ease), visibility 0s .8s;
  -webkit-mask-image: radial-gradient(ellipse 58% 60% at 50% 40%, transparent 25%, #000 80%);
  mask-image: radial-gradient(ellipse 58% 60% at 50% 40%, transparent 25%, #000 80%);
}
html[data-page="yt"] .is-start #rain {
  opacity: .3;
  visibility: visible;
  transition: opacity .8s var(--ease);
}

/* a faint dot grid and a soft light from above */
.yt-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 42% at 50% -8%, rgba(255, 255, 255, .07), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .085) 1px, transparent 1.6px) 0 0 / 26px 26px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .55) 45%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 0, rgba(0, 0, 0, .55) 45%, transparent 92%);
}

/* one quick refresh band per route change */
.yt-sweep {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 70;
  height: 34vh;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, .025) 70%, rgba(255, 255, 255, .09) 98%, rgba(255, 255, 255, .35) 99.6%, transparent);
}
.yt-sweep.on { animation: yt-sweep .62s var(--es) both; }
@keyframes yt-sweep {
  from { opacity: 1; transform: translateY(-34vh); }
  75%  { opacity: 1; }
  to   { opacity: 0; transform: translateY(100vh); }
}

/* "ready": a CRT line opens into a soft wash */
.yt-flash {
  position: fixed;
  inset: 0;
  z-index: 85;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, .6), rgba(255, 255, 255, .12) 70%);
}
.yt-flash.on { animation: yt-flash .8s var(--eo) both; }
@keyframes yt-flash {
  0%   { opacity: 0; transform: scaleY(.004); }
  12%  { opacity: 1; transform: scaleY(.004); }
  30%  { opacity: .55; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1); }
}

/* ---------- top bar ---------- */

/* monochrome glass: colour thumbnails scrolling under it turn gray */
.yt-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr minmax(220px, 440px);
  align-items: center;
  gap: 22px;
  min-height: 64px;
  padding: 10px var(--gutter);
  background: rgba(0, 0, 0, .62);
  -webkit-backdrop-filter: blur(18px) grayscale(1) brightness(.55);
  backdrop-filter: blur(18px) grayscale(1) brightness(.55);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .yt-top { background: rgba(0, 0, 0, .95); }
}
/* hairline that brightens toward the middle, stronger once scrolled */
.yt-top::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .3) 30%, rgba(255, 255, 255, .3) 70%, rgba(255, 255, 255, .06));
  opacity: .45;
  transition: opacity .4s var(--ease);
}
.yt-top.is-scrolled::after { opacity: 1; }

.yt-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.yt-logo {
  display: inline-flex;
  color: var(--fg);
  transition: color .2s var(--ease), filter .3s var(--ease);
}
.yt-logo:hover,
.yt-logo:focus-visible { color: var(--hi); filter: drop-shadow(0 0 6px rgba(255, 255, 255, .7)); }
.yt-logo svg { width: 26px; height: 26px; overflow: visible; }
/* the mark draws itself once, then blinks now and then */
.yt-logo .hex { stroke-dasharray: 78; animation: yt-draw 1.4s var(--eo) .1s backwards; }
.yt-logo .eyes { transform-box: fill-box; transform-origin: center; animation: yt-eyes 7s var(--ease) 1.6s infinite; }
@keyframes yt-draw { from { stroke-dashoffset: 78; } }
@keyframes yt-eyes {
  0%, 93%, 100% { transform: none; }
  95%           { transform: scaleY(.15); }
  97%           { transform: none; }
}

.yt-path {
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  letter-spacing: .04em;
  white-space: nowrap;
  color: var(--dim);
}
.yt-path b { font-weight: 400; color: var(--hi); }
.yt-path::after { content: "_"; color: var(--hi); animation: yt-blink 1.05s steps(1) infinite; }

.yt-nav {
  position: relative;
  display: flex;
  gap: 2px;
  min-width: 0;
  padding: 4px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.yt-nav::-webkit-scrollbar { display: none; }
.yt-nav a {
  position: relative;
  padding: 8px 12px 9px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--dim);
  transition: color .2s var(--ease), background-color .2s var(--ease), text-shadow .2s var(--ease);
}
.yt-nav a:hover { color: var(--hi); background: rgba(255, 255, 255, .045); }
.yt-nav a:focus-visible { outline-offset: -1px; }
.yt-nav a[aria-current="page"] { color: var(--hi); text-shadow: var(--gl); }
.yt-nav-bar {
  position: absolute;
  bottom: 4px;
  left: 0;
  width: 0;
  height: 1px;
  pointer-events: none;
  opacity: 0;
  background: var(--hi);
  box-shadow: 0 0 4px rgba(255, 255, 255, .9), 0 0 12px rgba(255, 255, 255, .45);
  transition: transform .5s var(--eo), width .5s var(--eo), opacity .25s var(--ease);
}
.yt-nav-bar.on { opacity: 1; }

/* search as a terminal prompt */
.yt-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 42px;
  background: rgba(255, 255, 255, .025);
  border: 1px solid var(--line-2);
  transition: border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .3s var(--ease);
}
.yt-search:hover { border-color: var(--l3); }
.yt-search:focus-within {
  border-color: var(--hi);
  background: rgba(0, 0, 0, .7);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 0 30px rgba(255, 255, 255, .12);
}
.yt-prompt {
  flex: none;
  padding-left: 13px;
  font-size: 14px;
  color: var(--mute);
  transition: color .2s var(--ease), text-shadow .2s var(--ease);
}
.yt-search:focus-within .yt-prompt { color: var(--hi); text-shadow: var(--gl); }
.yt-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 10px 0 9px;
  font-size: 14px;
  color: var(--hi);
  background: transparent;
  border: 0;
  outline: none;
  caret-color: var(--hi);
  -webkit-appearance: none;
  appearance: none;
}
.yt-search input::placeholder { color: #7f7f7f; opacity: 1; }
.yt-search input::-webkit-search-cancel-button { display: none; }
.yt-kbd {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-right: 9px;
  font: 11px/1 var(--font);
  color: var(--dim);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  transition: opacity .2s var(--ease);
}
.yt-search:focus-within .yt-kbd,
.yt-search input:not(:placeholder-shown) ~ .yt-kbd { opacity: 0; }
.yt-search button {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 100%;
  color: var(--dim);
  background: none;
  border: 0;
  border-left: 1px solid var(--line-2);
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.yt-search button:hover { color: var(--hi); background: rgba(255, 255, 255, .06); }
.yt-search button:focus-visible { outline-offset: -2px; }
.yt-search svg { width: 18px; height: 18px; }
/* a one-line hint under the field while it has focus */
.yt-hint {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  background: rgba(0, 0, 0, .88);
  border: 1px solid var(--line-2);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s var(--ease), transform .3s var(--eo);
}
.yt-hint b { font-weight: 400; color: var(--hi); }
.yt-search:focus-within .yt-hint { opacity: 1; transform: none; }

/* a light runs along the bar's lower edge while requests are open */
.yt-load {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  z-index: 1;
  height: 1px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.yt-load.on { opacity: 1; }
.yt-load::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 28%;
  background: linear-gradient(90deg, transparent, var(--hi) 65%, transparent);
  transform: translateX(-100%);
}
.yt-load.on::before { animation: yt-load 1.15s var(--es) infinite; }
@keyframes yt-load { to { transform: translateX(360%); } }

/* the very first build: nothing to search or browse yet (a rebuild keeps them) */
body.is-first .yt-nav,
body.is-first .yt-search { visibility: hidden; }

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

.yt-view {
  position: relative;
  z-index: 2;
  max-width: 1480px;
  min-height: 70vh;
  margin: 0 auto;
  padding: 28px var(--gutter) 96px;
  outline: none;
  overflow-x: clip;
}
/* in-app route change: the old view dims out, the new one rises in */
.yt-view.is-out {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .14s var(--ease), transform .14s var(--ease);
}
.yt-view.is-in { animation: yt-view-in .5s var(--eo) backwards; }
@keyframes yt-view-in {
  from { opacity: 0; transform: translateY(12px); }
}

.yt-h1 {
  margin: 4px 0 22px;
  font-size: clamp(24px, 3.2vw, 38px);
  font-weight: 300;
  line-height: 1.15;
  color: var(--hi);
  text-shadow: var(--gl);
  overflow-wrap: anywhere;
}

/* section heading: "// title [n] ------- extra" */
.sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
  margin: 0 0 16px;
}
.yt-h {
  flex: none;
  margin: 0;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: .22em;
  white-space: nowrap;
  color: var(--fg);
}
.yt-h::before { content: "//"; margin-right: .8em; letter-spacing: 0; color: var(--mute); }
.sec-n {
  flex: none;
  padding: 0 6px;
  font-size: 11px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  border: 1px solid var(--line-2);
}
.sec-n:empty { display: none; }
.sec-rule {
  flex: 1;
  min-width: 16px;
  height: 1px;
  background: linear-gradient(90deg, var(--line-2), transparent 92%);
}

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag b { font-weight: 400; color: var(--fg); }
.tag.is-via { color: var(--fg); border-style: dashed; }
.feed-mix { flex-wrap: nowrap; min-width: 0; overflow: hidden; }
.feed-mix .tag { flex: none; }
.tags:empty { display: none; }
.tag {
  padding: 2px 8px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--dim);
  white-space: nowrap;
  border: 1px solid var(--line-2);
}

/* empty and error states: a small ascii mask */
.yt-empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 24px 0;
  font-size: 13px;
  color: var(--dim);
}
.yt-empty p { margin: 0; }
.yt-empty .ascii {
  margin: 0;
  font: 13px/1.2 var(--font);
  color: var(--l3);
  text-shadow: 0 0 10px rgba(255, 255, 255, .12);
}
.yt-empty.is-bad .ascii { color: var(--fg); animation: yt-flicker 4s steps(1) infinite; }
.yt-empty.is-bad p { color: var(--fg); }
@keyframes yt-flicker {
  0%, 46%, 50%, 100% { opacity: 1; }
  48% { opacity: .35; }
  49% { opacity: .8; }
}
.grid > .yt-empty,
.reel-stage > .yt-empty { grid-column: 1 / -1; }
.reel-stage > .yt-empty { align-items: center; padding: 20px; text-align: center; }

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

.pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 15px;
  font-size: 12px;
  letter-spacing: .05em;
  white-space: nowrap;
  color: var(--fg);
  background: rgba(0, 0, 0, .45);
  border: 1px solid var(--line-2);
  transition: color .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), box-shadow .3s var(--ease), transform .12s var(--ease);
}
.pill:hover { color: var(--hi); background: rgba(255, 255, 255, .05); border-color: var(--hi); box-shadow: 0 0 18px rgba(255, 255, 255, .1); }
.pill:active { transform: scale(.97); }
.pill:focus-visible { outline-offset: 2px; }
.pill .ico { flex: none; width: 15px; height: 15px; }
.pill.is-solid { color: var(--bg); background: var(--hi); border-color: var(--hi); }
.pill.is-solid:hover { color: var(--bg); background: var(--hi); box-shadow: 0 0 0 1px var(--hi), 0 0 26px rgba(255, 255, 255, .42); }
.pill[aria-pressed="true"] {
  color: var(--hi);
  background: rgba(255, 255, 255, .08);
  border-color: var(--hi);
  box-shadow: inset 0 0 14px rgba(255, 255, 255, .07);
}
.pill.is-danger:hover { color: var(--bg); background: var(--hi); }
.pill.is-pop .ico,
.rbtn.is-pop .rbtn-ico { animation: yt-pop .45s var(--eo); }
.pill.is-pop { animation: yt-ring .6s var(--eo); }
@keyframes yt-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.45) rotate(-8deg); }
  100% { transform: none; }
}
@keyframes yt-ring {
  from { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); }
  to   { box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
}
/* waiting for data (or not available): an outline, never a gray slab */
.pill:disabled,
.pill:disabled:hover {
  color: var(--mute);
  background: transparent;
  border: 1px dashed var(--line-2);
  box-shadow: none;
  transform: none;
  cursor: default;
}

.spin {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--dim);
}
.spin::before { content: "|"; width: 1ch; color: var(--hi); animation: yt-spin .48s steps(1) infinite; }
.spin::after { content: "_"; margin-left: -8px; animation: yt-blink 1.05s steps(1) infinite; }
@keyframes yt-spin {
  0%   { content: "|"; }
  25%  { content: "/"; }
  50%  { content: "-"; }
  75%  { content: "\\"; }
}
@keyframes yt-blink { 50% { opacity: 0; } }

.tail {
  display: grid;
  place-items: center;
  min-height: 90px;
  margin-top: 26px;
}
.tail-end {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin: 0;
  font-size: 11px;
  letter-spacing: .3em;
  color: var(--mute);
}
.tail-end::before,
.tail-end::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- video cards ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 34px 20px;
}
.grid.is-small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px 16px; }

.card { position: relative; transition: opacity .25s var(--ease), transform .25s var(--ease); }
.card.is-gone { opacity: 0; transform: scale(.96); animation: yt-gone .26s steps(4) both; }
/* removed: a few torn frames, then gone */
@keyframes yt-gone {
  0%   { opacity: 1; transform: none; clip-path: inset(0); }
  25%  { opacity: 1; transform: translateX(5px); clip-path: inset(20% 0 35% 0); }
  50%  { opacity: .8; transform: translateX(-4px); clip-path: inset(55% 0 10% 0); }
  75%  { opacity: .4; transform: translateX(3px) scaleY(.4); clip-path: inset(45% 0 45% 0); }
  100% { opacity: 0; transform: scaleY(.02); clip-path: inset(50% 0 50% 0); }
}

/* scroll-in reveal (added by JS, only when motion is allowed) */
.rv { opacity: 0; transform: translateY(18px); }
.rv.is-in {
  opacity: 1;
  transform: none;
  transition: opacity .5s var(--ease) calc(var(--d, 0) * 55ms), transform .75s var(--eo) calc(var(--d, 0) * 55ms);
}

.card-link { display: block; }
.card-link:focus-visible { outline: none; }

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--p2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06);
  transition: box-shadow .35s var(--ease);
}
/* scanlines over the picture on hover, with one bright band rolling down */
.thumb::before,
.short-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background:
    linear-gradient(to bottom, transparent, rgba(255, 255, 255, .16) 70%, rgba(255, 255, 255, .3) 96%, transparent) 0 -70% / 100% 38% no-repeat,
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .32) 0 1px, transparent 1px 3px);
  transition: opacity .25s var(--ease);
}
.card-link:hover .thumb::before,
.short:hover .short-thumb::before { animation: yt-thumb-scan 1.2s var(--es) .05s both; }
@keyframes yt-thumb-scan {
  from { background-position: 0 -70%, 0 0; }
  to   { background-position: 0 170%, 0 0; }
}
/* the shell's cursor already locks brackets onto the card */
html.has-cursor .card-link .thumb::after,
html.has-cursor .short .short-thumb::after { display: none; }
/* target-lock brackets */
.thumb::after,
.short-thumb::after {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: 3;
  pointer-events: none;
  color: var(--hi);
  opacity: 0;
  transform: scale(1.08);
  transition: opacity .2s var(--ease), transform .4s var(--eo);
}
.thumb img,
.short-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: brightness(.9);
  transition: opacity .5s var(--ease), filter .3s var(--ease), transform .6s var(--eo);
}
.thumb img.is-ok,
.short-thumb img.is-ok { opacity: var(--img-o, 1); }
img.is-broken { visibility: hidden; }
.thumb.is-broken,
.short-thumb.is-broken {
  background: repeating-linear-gradient(135deg, #0b0b0b 0 6px, #111 6px 12px);
}

.card-link:hover .thumb,
.card-link:focus-visible .thumb {
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .6), 0 14px 44px -14px rgba(255, 255, 255, .22);
}
.card-link:focus-visible .thumb { box-shadow: 0 0 0 1px var(--hi), 0 0 0 4px rgba(255, 255, 255, .2); }
.card-link:hover .thumb img,
.card-link:focus-visible .thumb img { filter: brightness(1.04); transform: scale(1.045); }
.card-link:hover .thumb::before,
.card-link:focus-visible .thumb::before,
.card-link:hover .thumb::after,
.card-link:focus-visible .thumb::after { opacity: 1; transform: none; }

/* "> play_" tag that slides up on hover */
.thumb-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 4;
  padding: 1px 7px;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--bg);
  background: var(--hi);
  box-shadow: 0 0 16px rgba(255, 255, 255, .45);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s var(--ease), transform .35s var(--eo);
}
.thumb-tag::after { content: "_"; }
/* the caret only blinks while its tag is shown, so long feeds don't run hundreds of idle animations */
.card-link:hover .thumb-tag::after,
.card-link:focus-visible .thumb-tag::after,
.short:hover .thumb-tag::after,
.short:focus-visible .thumb-tag::after { animation: yt-blink 1.05s steps(1) infinite; }
.card-link:hover .thumb-tag,
.card-link:focus-visible .thumb-tag,
.short:hover .thumb-tag,
.short:focus-visible .thumb-tag { opacity: 1; transform: none; }

.dur {
  position: absolute;
  right: 7px;
  bottom: 7px;
  z-index: 4;
  padding: 0 6px;
  font-size: 11px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--hi);
  background: rgba(0, 0, 0, .82);
  border: 1px solid rgba(255, 255, 255, .16);
}
/* watched: dimmed, with a full progress line */
.card.is-seen { --img-o: .38; }
.card.is-seen .dur { bottom: 10px; }
.seen {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 4;
  height: 2px;
  background: var(--hi);
  box-shadow: 0 0 8px rgba(255, 255, 255, .7);
}

.card-meta { display: flex; gap: 12px; margin-top: 12px; }
.card-text { flex: 1; min-width: 0; }
.card-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--fg);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color .2s var(--ease), text-shadow .2s var(--ease);
}
.card-link:hover .card-title,
.card-link:focus-visible .card-title { color: var(--hi); text-shadow: var(--gl); }
.card-sub {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.card-sub + .card-sub { margin-top: 1px; }

/* generated hex identicons */
.ava { display: block; flex: none; width: 34px; height: 34px; overflow: visible; }
.ava-hex { fill: #0a0a0a; stroke: #3c3c3c; stroke-width: 1; transition: stroke .2s var(--ease); }
.ava-a { fill: #e4e4e4; }
.ava-b { fill: #6c6c6c; }
.ava.is-blank .ava-hex { stroke-dasharray: 2 2; }
.card-link:hover .ava-hex { stroke: var(--hi); }
.ava.is-xs { width: 18px; height: 18px; }
.ava.is-md { width: 44px; height: 44px; }
.ava.is-xl { width: 112px; height: 112px; filter: drop-shadow(0 0 22px rgba(255, 255, 255, .14)); }
.ava.is-xl .ava-hex { fill: #050505; stroke: #8a8a8a; }

/* "not interested" */
.card-x {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--hi);
  background: rgba(0, 0, 0, .78);
  border: 1px solid rgba(255, 255, 255, .25);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .18s var(--ease), transform .25s var(--eo), background-color .15s var(--ease), color .15s var(--ease);
}
.card:hover .card-x,
.card-x:focus-visible { opacity: 1; transform: none; }
.card-x:hover { color: var(--bg); background: var(--hi); border-color: var(--hi); }
@media (hover: none) { .card-x { opacity: .8; transform: none; } }

/* compact numbered rows for "up next" */
.card.is-row .card-link {
  display: grid;
  grid-template-columns: 22px 168px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.card-n {
  padding-top: 1px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: #6a6a6a;
  transition: color .2s var(--ease), text-shadow .2s var(--ease);
}
.card-link:hover .card-n { color: var(--hi); text-shadow: var(--gl); }
.card.is-row .card-meta { margin-top: 0; }
.card.is-row .card-title { padding-right: 26px; font-size: 13px; }
.card.is-row .card-x { top: 0; right: 0; width: 24px; height: 24px; font-size: 13px; }
.card.is-row .thumb::after { inset: 5px; --bs: 8px; }
.card.is-row .thumb-tag { display: none; }

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

.is-ghost { pointer-events: none; }
.is-ghost .thumb,
.is-ghost .short-thumb,
.reel-stage.is-wait,
.ghost-line,
.ghost-ava,
.w-title:empty::before,
.w-channel:empty::before {
  background: linear-gradient(100deg, transparent 32%, rgba(255, 255, 255, .06) 50%, transparent 68%) 0 0 / 300% 100% no-repeat var(--p2);
  animation: yt-shimmer 1.7s var(--ease) infinite;
  animation-delay: calc(var(--i, 0) * 70ms);
}
@keyframes yt-shimmer {
  from { background-position: 100% 0; }
  to   { background-position: 0 0; }
}
.is-ghost .thumb::after,
.is-ghost .short-thumb::after { opacity: .5; transform: none; color: #3a3a3a; }
.ghost-line { width: 92%; height: 11px; margin-top: 3px; }
.ghost-line.is-short { width: 56%; height: 9px; margin-top: 10px; }
.ghost-line.is-title { width: min(360px, 70%); height: 26px; }
.ghost-ava {
  flex: none;
  width: 34px;
  height: 34px;
  clip-path: polygon(50% 4%, 90% 27%, 90% 73%, 50% 96%, 10% 73%, 10% 27%);
}
.ghost-ava.is-xl { width: 112px; height: 112px; }
.ghost-noise {
  position: absolute;
  right: 11px;
  bottom: 9px;
  left: 11px;
  z-index: 4;
  overflow: hidden;
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: .12em;
  color: #3e3e3e;
}
.ghost-noise::after { content: "_"; animation: yt-blink 1.05s steps(1) infinite; }
.short .ghost-line { margin-top: 10px; }

/* ---------- Shorts shelf ---------- */

.shelf { margin-bottom: 40px; }
.shelf-nav { display: flex; flex: none; gap: 6px; }
.shelf-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--fg);
  background: rgba(0, 0, 0, .5);
  border: 1px solid var(--line-2);
  transition: color .2s var(--ease), border-color .2s var(--ease), box-shadow .3s var(--ease), opacity .2s var(--ease);
}
.shelf-btn .ico { width: 16px; height: 16px; }
.shelf-btn:hover { color: var(--hi); border-color: var(--hi); box-shadow: 0 0 16px rgba(255, 255, 255, .14); }
.shelf-btn:disabled { opacity: .28; border-color: var(--line-2); box-shadow: none; cursor: default; }
@media (hover: none) { .shelf-nav { display: none; } }

.shelf-wrap { position: relative; }
.shelf-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(148px, 178px);
  gap: 14px;
  padding: 8px 0 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000 calc(100% - 56px), transparent);
}
.shelf-wrap.at-start .shelf-row {
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 56px), transparent);
}
.shelf-wrap.at-end .shelf-row {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000);
  mask-image: linear-gradient(90deg, transparent 0, #000 56px, #000);
}
.shelf-wrap.at-start.at-end .shelf-row { -webkit-mask-image: none; mask-image: none; }

.short {
  position: relative;
  display: block;
  scroll-snap-align: start;
  transition: transform .4s var(--eo);
}
.short:focus-visible { outline: none; }
.short-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: var(--p2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06);
  transition: box-shadow .35s var(--ease);
}
.short-n {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  padding: 0 5px;
  font-size: 10px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  color: var(--hi);
  background: rgba(0, 0, 0, .7);
  border: 1px solid rgba(255, 255, 255, .2);
}
/* scrim along the bottom of every tile, with the format and length */
.short-foot {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  min-height: 42%;
  padding: 0 8px 8px;
  font-size: 10px;
  line-height: 16px;
  letter-spacing: .12em;
  font-variant-numeric: tabular-nums;
  color: var(--dim);
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px),
    linear-gradient(to bottom, transparent, rgba(0, 0, 0, .78));
  transition: opacity .2s var(--ease);
}
.short-kind::before { content: "[ "; color: var(--line-3); }
.short-kind::after { content: " ]"; color: var(--line-3); }
.short-dur {
  padding: 0 5px;
  color: var(--hi);
  background: rgba(0, 0, 0, .7);
  border: 1px solid rgba(255, 255, 255, .16);
}
/* the "> play" tag takes the bottom-left corner on hover */
.short:hover .short-kind,
.short:focus-visible .short-kind { opacity: 0; }
.short:hover,
.short:focus-visible { transform: translateY(-4px); }
.short:hover .short-thumb,
.short:focus-visible .short-thumb { box-shadow: 0 0 0 1px rgba(255, 255, 255, .6), 0 18px 40px -16px rgba(255, 255, 255, .26); }
.short:focus-visible .short-thumb { box-shadow: 0 0 0 1px var(--hi), 0 0 0 4px rgba(255, 255, 255, .2); }
.short:hover .short-thumb img,
.short:focus-visible .short-thumb img { filter: brightness(1.04); transform: scale(1.05); }
.short:hover .short-thumb::before,
.short:focus-visible .short-thumb::before,
.short:hover .short-thumb::after,
.short:focus-visible .short-thumb::after { opacity: 1; transform: none; }
.short-title {
  display: -webkit-box;
  margin: 9px 0 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color .2s var(--ease), text-shadow .2s var(--ease);
}
.short:hover .short-title { color: var(--hi); text-shadow: var(--gl); }
.short-sub { margin: 3px 0 0; font-size: 12px; color: var(--dim); }

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

.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 40px;
}
.w-hud { position: relative; padding-top: 24px; }
.w-cap {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--dim);
  white-space: nowrap;
}
.w-cap b { font-weight: 400; letter-spacing: .08em; color: var(--fg); }
.w-time { margin-left: 14px; letter-spacing: .08em; font-variant-numeric: tabular-nums; color: var(--hi); }
/* playback line under the frame */
.w-prog,
.reel-play {
  position: relative;
  z-index: 1;
  height: 1px;
  background: rgba(255, 255, 255, .1);
  opacity: 0;
  transition: opacity .4s var(--ease);
}
.w-prog { margin-top: 5px; }
.w-prog.on,
.reel-play.on { opacity: 1; }
.w-prog i,
.reel-play i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--hi);
  box-shadow: 0 0 6px rgba(255, 255, 255, .9);
  transition: width .5s linear;
}
/* the video's thumbnail, gray and heavily blurred, glows around the frame */
.w-amb {
  position: absolute;
  inset: 24px 0 0;
  z-index: 0;
  pointer-events: none;
}
.w-amb img {
  position: absolute;
  top: -16%;
  left: -7%;
  width: 114%;
  height: 132%;
  object-fit: cover;
  opacity: 0;
  filter: grayscale(1) blur(64px) brightness(1.05) contrast(1.1);
  transition: opacity 1.4s var(--ease);
}
.w-amb img.is-ok { opacity: .62; }
.w-amb.is-broken { display: none; }
.w-screen {
  position: relative;
  z-index: 1;
  aspect-ratio: 16 / 9;
  background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14), 0 40px 90px -40px #000;
}
.w-screen iframe,
.reel-stage iframe {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
}
.w-br {
  position: absolute;
  top: 15px;
  right: -9px;
  bottom: -9px;
  left: -9px;
  z-index: 2;
  pointer-events: none;
  color: rgba(255, 255, 255, .8);
  --bs: 18px;
}
.w-title {
  position: relative;
  z-index: 1;
  min-height: 1.3em;
  margin: 20px 0 16px;
  font-size: clamp(18px, 1.9vw, 24px);
  font-weight: 400;
  line-height: 1.3;
  color: var(--hi);
  text-shadow: var(--gl);
  overflow-wrap: anywhere;
}
.w-title:empty::before { content: ""; display: block; width: 62%; height: 1.1em; }
.w-row {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.w-owner { display: flex; align-items: center; gap: 12px; min-width: 0; }
.w-ava { display: block; flex: none; }
.w-who { min-width: 0; }
.w-channel { display: block; font-size: 14px; color: var(--fg); transition: color .2s var(--ease), text-shadow .2s var(--ease); }
.w-channel:empty::before { content: ""; display: block; width: 140px; height: 12px; margin: 4px 0; }
a.w-channel[href]:hover { color: var(--hi); text-shadow: var(--gl); }
.w-subs { display: block; font-size: 12px; color: var(--dim); }
.w-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.w-stats { margin-top: 14px; }
.w-next { min-width: 0; }
.w-list { display: grid; gap: 14px; }

@media (max-width: 1000px) {
  .watch { grid-template-columns: 1fr; gap: 34px; }
}

/* ---------- Shorts reel ---------- */

.reel {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 22px;
  min-height: calc(100dvh - 160px);
}
/* the Short's own frame, gray and blurred, fills the room behind it */
.reel-amb {
  position: absolute;
  top: -28px;
  right: calc(var(--gutter) * -1);
  bottom: -96px;
  left: calc(var(--gutter) * -1);
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 46% 62% at 50% 52%, #000 35%, transparent 100%);
  mask-image: radial-gradient(ellipse 46% 62% at 50% 52%, #000 35%, transparent 100%);
}
.reel-amb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  filter: grayscale(1) blur(80px) brightness(.8) contrast(1.1);
  transform: scale(1.1);
  transition: opacity 1s var(--ease);
}
.reel-amb img.is-ok { opacity: .42; }
.reel-amb.is-broken { display: none; }
.reel-col,
.reel-side { position: relative; z-index: 1; }
/* the height left after the top bar, the reel's top line and the title +
   channel under the frame */
.reel-col { width: min(100%, calc((100dvh - 270px) * 9 / 16), 460px); }
.reel-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.reel-idx b { font-weight: 400; color: var(--hi); text-shadow: var(--gl); }
.reel-time { flex: 1; letter-spacing: .08em; color: var(--fg); }
.reel-play { margin-top: 5px; }
.reel-keys { display: inline-flex; align-items: center; gap: 4px; letter-spacing: .06em; }
.reel-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  font: 10px/1 var(--font);
  color: var(--fg);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
}
.reel-keys kbd + kbd { margin-right: 4px; }
.reel-prog { height: 1px; margin-bottom: 12px; background: var(--line-2); }
.reel-prog i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--hi);
  box-shadow: 0 0 6px rgba(255, 255, 255, .9);
  transition: width .45s var(--eo);
}
.reel-frame {
  position: relative;
  overflow: visible;
}
.reel-stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .16), 0 40px 100px -30px #000;
}
.reel-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .9;
}
.reel-br {
  position: absolute;
  inset: -9px;
  z-index: 2;
  pointer-events: none;
  color: rgba(255, 255, 255, .8);
  --bs: 18px;
}
.reel-stage.is-up { animation: yt-reel-up .5s var(--eo) both; }
.reel-stage.is-down { animation: yt-reel-down .5s var(--eo) both; }
.reel-stage.is-fade { animation: yt-reel-fade .5s var(--eo) both; }
@keyframes yt-reel-up {
  from { opacity: 0; transform: translateY(10%) scale(.96); filter: brightness(1.8); }
}
@keyframes yt-reel-down {
  from { opacity: 0; transform: translateY(-10%) scale(.96); filter: brightness(1.8); }
}
@keyframes yt-reel-fade {
  from { opacity: 0; transform: scale(.97); }
}
.reel-info { position: relative; z-index: 3; min-height: 64px; padding-top: 14px; }
.reel-title {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.4;
  color: var(--hi);
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.reel-by { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.reel-ava:empty { display: none; }
.reel-channel { font-size: 12px; color: var(--dim); transition: color .2s var(--ease); }
a.reel-channel[href]:hover { color: var(--hi); }
.reel-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 86px;
}
.rbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--fg);
  background: none;
  border: 0;
}
.rbtn:focus-visible { outline: none; }
.rbtn-ico {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--line-2);
  transition: color .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), box-shadow .3s var(--ease), transform .12s var(--ease);
}
.rbtn .ico { width: 20px; height: 20px; }
.rbtn-lbl {
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--fg);
  text-shadow: 0 0 3px #000, 0 0 8px #000;
  transition: color .2s var(--ease);
}
.rbtn:hover .rbtn-ico,
.rbtn:focus-visible .rbtn-ico { color: var(--hi); border-color: var(--hi); box-shadow: 0 0 20px rgba(255, 255, 255, .16); }
.rbtn:focus-visible .rbtn-ico { box-shadow: 0 0 0 3px rgba(255, 255, 255, .25); }
.rbtn:hover .rbtn-lbl { color: var(--hi); }
.rbtn:active .rbtn-ico { transform: scale(.94); }
.rbtn.is-cta .rbtn-ico,
.rbtn[aria-pressed="true"] .rbtn-ico { color: var(--bg); background: var(--hi); border-color: var(--hi); }
.rbtn.is-cta:hover .rbtn-ico,
.rbtn[aria-pressed="true"]:hover .rbtn-ico { box-shadow: 0 0 24px rgba(255, 255, 255, .45); }
.rbtn:disabled { cursor: default; }
.rbtn:disabled .rbtn-ico,
.rbtn:disabled:hover .rbtn-ico { color: var(--dim); background: rgba(0, 0, 0, .55); border: 1px dashed var(--l3); box-shadow: none; transform: none; }
.rbtn:disabled .rbtn-lbl { color: var(--dim); }

@media (max-width: 640px) {
  .reel { flex-direction: column; align-items: stretch; gap: 14px; min-height: 0; }
  .reel-col { width: 100%; }
  .reel-stage { aspect-ratio: auto; height: calc(100dvh - 330px); min-height: 320px; }
  .reel-info { min-height: 0; }
  .reel-side { flex-direction: row; justify-content: space-between; gap: 6px; padding-bottom: 0; }
  .rbtn-ico { width: 48px; height: 48px; }
  .reel-keys { display: none; }
}

/* ---------- build your feed ---------- */

.start { position: relative; max-width: 720px; margin: 7vh auto 0; padding-bottom: calc(128px + env(safe-area-inset-bottom)); }
.start-kicker {
  display: flex;
  gap: 14px;
  margin: 0 0 18px;
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--dim);
}
.start-step { padding: 0 6px; color: var(--fg); border: 1px solid var(--line-2); }
.start-step::after { content: "_"; animation: yt-blink 1.05s steps(1) infinite; }
.start-title {
  margin: 0 0 14px;
  font-size: clamp(34px, 6.4vw, 66px);
  font-weight: 200;
  line-height: 1.05;
  letter-spacing: -.01em;
  text-shadow: var(--gl), 0 0 42px rgba(255, 255, 255, .16);
}
.start-sub { margin: 0; font-size: 13px; color: var(--dim); }
.start-field {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 58px;
  margin: 28px 0 16px;
  padding-right: 8px;
  background: rgba(0, 0, 0, .7);
  border: 1px solid var(--line-2);
  transition: border-color .2s var(--ease), box-shadow .3s var(--ease);
}
.start-field:hover { border-color: var(--l3); }
.start-field:focus-within {
  border-color: var(--hi);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 0 44px rgba(255, 255, 255, .1);
}
.start-field::after {
  content: "";
  position: absolute;
  inset: -8px;
  pointer-events: none;
  color: var(--hi);
  opacity: 0;
  transform: scale(1.02);
  transition: opacity .25s var(--ease), transform .4s var(--eo);
}
.start-field:focus-within::after { opacity: .9; transform: none; }
.start-prompt { padding-left: 16px; font-size: 18px; color: var(--hi); text-shadow: var(--gl); }
.start-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 4px;
  font-size: 17px;
  color: var(--hi);
  background: transparent;
  border: 0;
  outline: none;
  caret-color: var(--hi);
}
.start-field input::placeholder { color: #7f7f7f; opacity: 1; }
.start-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 10px;
  font-size: 11px;
  letter-spacing: .24em;
  color: var(--dim);
}
.start-label::before { content: "//"; letter-spacing: 0; color: var(--mute); }

/* your picks: a panel that fills as you add topics */
.picks {
  position: relative;
  margin-top: 18px;
  padding: 14px 18px 18px;
  background: rgba(0, 0, 0, .72);
  border: 1px solid var(--line-2);
  box-shadow: var(--glb);
}
.picks-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.picks-head .start-label { margin: 0; }
.meter { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--dim); }
.meter-n { font-variant-numeric: tabular-nums; }
.picks-empty { margin: 0; font-size: 13px; color: #7f7f7f; }
.picks-empty::before { content: "> "; color: var(--mute); }
.picks .chips.is-mine { margin-bottom: 0; }
.picks + .build-log { margin-top: 18px; }

/* the main button sits in a bar at the bottom so it is always in reach;
   the glass is gray like the top bar */
.start-go {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 15;
  display: flex;
  justify-content: center;
  padding: 12px max(var(--gutter), env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  background: rgba(0, 0, 0, .8);
  -webkit-backdrop-filter: blur(12px) grayscale(1) brightness(.6);
  backdrop-filter: blur(12px) grayscale(1) brightness(.6);
  border-top: 1px solid var(--line-2);
}
.start-go::before {
  content: "";
  position: absolute;
  top: -1px;
  right: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
}
.start-go-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; max-width: 720px; }
.build-meter { font-size: 12px; letter-spacing: .1em; color: #6a6a6a; transition: color .3s var(--ease); }
.build-meter.is-full { color: var(--hi); text-shadow: var(--gl); }
.build-hint { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 12px; line-height: 1.5; color: var(--dim); }
.build-hint::before { content: "> "; color: #6a6a6a; }

.btn-go {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  height: 50px;
  padding: 0 22px 0 26px;
  overflow: hidden;
  font-size: 14px;
  letter-spacing: .1em;
  color: var(--bg);
  background: var(--hi);
  border: 1px solid var(--hi);
  transition: box-shadow .3s var(--ease), color .2s var(--ease), background-color .2s var(--ease), border-color .2s var(--ease), transform .12s var(--ease);
}
.btn-go .ico { width: 18px; height: 18px; transition: transform .3s var(--eo); }
/* a sheen passes over on hover */
.btn-go::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(0, 0, 0, .16) 50%, transparent 65%);
  transform: translateX(-100%);
}
.btn-go:hover { box-shadow: 0 0 0 1px var(--hi), 0 0 34px rgba(255, 255, 255, .4); }
.btn-go:hover::after { transform: translateX(100%); transition: transform .7s var(--ease); }
.btn-go:hover .ico { transform: translateX(4px); }
.btn-go:active { transform: scale(.98); }
.btn-go:focus-visible { outline: 1px solid var(--hi); outline-offset: 3px; }
.btn-go:disabled,
.btn-go:disabled:hover {
  color: var(--mute);
  background: transparent;
  border: 1px dashed var(--line-3, #5a5a5a);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}
.btn-go:disabled::after { display: none; }
.btn-go:disabled .ico { transform: none; }

/* while the first batch is built: a live outline with a spinner, then a
   solid "ready" for the beat before the feed opens */
.go-spin { display: none; width: 1ch; }
.go-spin::before { content: "|"; animation: yt-spin .48s steps(1) infinite; }
.btn-go.is-busy:disabled {
  color: var(--hi);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--l3);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, .05);
  cursor: progress;
}
.btn-go.is-busy::after {
  display: block;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
  animation: yt-go-sweep 1.3s var(--es) infinite;
}
@keyframes yt-go-sweep {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}
.btn-go.is-busy .go-spin { display: inline-block; }
.btn-go.is-busy .ico { display: none; }
.btn-go.is-ready:disabled {
  color: var(--bg);
  background: var(--hi);
  border: 1px solid var(--hi);
  box-shadow: 0 0 0 1px var(--hi), 0 0 38px rgba(255, 255, 255, .45);
  cursor: progress;
}

/* the picks hold still while the feed is built */
.start .start-field,
.start .picks,
.start .chips.is-ideas { transition: opacity .3s var(--ease), border-color .2s var(--ease), box-shadow .3s var(--ease); }
.start.is-building .start-field,
.start.is-building .chips.is-ideas { opacity: .35; pointer-events: none; }
.start.is-building .picks { pointer-events: none; }
.start.is-building .start-field::after { opacity: 0; }

.build-log {
  position: relative;
  margin-top: 30px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.8;
  color: var(--dim);
  white-space: pre;
  background: rgba(0, 0, 0, .78);
  border: 1px solid var(--line-2);
  box-shadow: var(--glb);
  scroll-margin: 96px 0 112px; /* clear of the top bar and the fixed build bar */
}
.build-log:empty { display: none; }
.log-row { animation: yt-log-in .35s var(--eo) backwards; }
@keyframes yt-log-in { from { opacity: 0; transform: translateX(-6px); } }
.log-bar { color: var(--hi); }
.log-spin { display: inline-block; width: 1ch; color: var(--hi); }
.log-n { animation: yt-fade .3s var(--ease) .4s backwards; }
@keyframes yt-fade { from { opacity: 0; } }
.log-row.is-head { color: var(--fg); }
.log-row.is-wait { color: var(--mute); }
.log-row.is-ok { color: var(--hi); text-shadow: var(--gl); }
.log-row.is-bad { color: var(--hi); }
.log-row.is-bad .log-bar { color: var(--dim); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--dim);
  background: rgba(0, 0, 0, .55);
  border: 1px solid var(--line-2);
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease), box-shadow .3s var(--ease), transform .12s var(--ease);
}
.chip-plus { color: var(--mute); transition: color .2s var(--ease); }
button.chip:hover,
button.chip:focus-visible,
a.chip:focus-visible,
a.chip:hover { color: var(--hi); background: rgba(255, 255, 255, .05); border-color: var(--hi); box-shadow: 0 0 16px rgba(255, 255, 255, .09); }
button.chip:hover .chip-plus,
button.chip:focus-visible .chip-plus { color: var(--hi); }
button.chip:active { transform: scale(.96); }
.chip.is-on { color: var(--bg); background: var(--hi); border-color: var(--hi); }
button.chip.is-on:hover,
button.chip.is-on:focus-visible { color: var(--bg); background: var(--hi); box-shadow: 0 0 22px rgba(255, 255, 255, .35); }
.chip.is-on a:hover { text-decoration: underline; }
.chip-x { margin-left: 2px; padding: 0 2px; color: inherit; background: none; border: 0; }
.chip:disabled { cursor: default; }
.chip-mark { opacity: .6; }
.chip.has-ava { padding-left: 7px; }
.chips.is-stagger .chip { animation: yt-chip-in .5s var(--eo) backwards; animation-delay: calc(var(--i, 0) * 24ms + 120ms); }
@keyframes yt-chip-in { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } }
.chip.is-new { animation: yt-chip-pop .55s var(--eo) backwards; }
@keyframes yt-chip-pop {
  from { transform: scale(.8); box-shadow: 0 0 0 0 rgba(255, 255, 255, .7); }
  60%  { box-shadow: 0 0 0 9px rgba(255, 255, 255, 0); }
}
.chips.is-mine { margin-bottom: 6px; }
.chips.is-subs { margin: -4px 0 34px; }

/* ---------- search ---------- */

.q-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin: 0 0 26px; }
.q-label { flex: 0 0 100%; margin: 0; font-size: 11px; letter-spacing: .24em; color: var(--dim); }
.q-head .yt-h1 { margin: 0; }
.q-count { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }

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

.ch-top { position: relative; margin: -4px 0 38px; }
.ch-banner {
  position: relative;
  height: clamp(120px, 16vw, 210px);
  overflow: hidden;
  background: var(--p1);
  box-shadow: 0 0 0 1px var(--line);
}
.ch-banner canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* shade toward the bottom so the name reads, plus a bracket frame */
.ch-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, transparent 30%, rgba(0, 0, 0, .85)),
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, .25) 0 1px, transparent 1px 3px);
}
.ch-banner::before {
  content: "";
  position: absolute;
  inset: 10px;
  z-index: 1;
  color: rgba(255, 255, 255, .55);
}
.ch-banner-id {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 1;
  padding: 0 6px;
  font-size: 10px;
  line-height: 18px;
  letter-spacing: .14em;
  color: var(--dim);
  background: rgba(0, 0, 0, .75);
}
.ch-head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 18px 22px;
  margin-top: -56px;
  padding: 0 22px;
}
.ch-who { flex: 1; min-width: 0; padding-bottom: 6px; }
.ch-who .yt-h1 { margin: 0 0 10px; }
.ch-head .pill { margin-bottom: 8px; }
.ch-head.is-wait .ch-who { padding-bottom: 14px; }

/* ---------- library ---------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 8px;
}
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 20px 16px;
  background: rgba(0, 0, 0, .6);
  border: 1px solid var(--line);
  box-shadow: var(--glb);
}
.tile::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  color: var(--l3);
  --bs: 10px;
}
.tile-n {
  font-size: clamp(30px, 4vw, 46px);
  font-weight: 200;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--hi);
  text-shadow: var(--gl), 0 0 30px rgba(255, 255, 255, .15);
}
.tile-k { font-size: 11px; letter-spacing: .22em; color: var(--dim); }

.lib { margin-top: 40px; }
.lib .sec-head .pill { flex: none; }
.lib-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; font-size: 13px; color: var(--dim); }
.lib-note p { margin: 0; }

.bars { display: grid; gap: 2px; max-width: 760px; font-size: 12px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 170px) max-content 44px 70px;
  justify-content: start;
  align-items: center;
  gap: 14px;
  padding: 3px 0;
}
.bar-k { overflow: hidden; color: var(--fg); white-space: nowrap; text-overflow: ellipsis; }
.bar-v { color: var(--hi); letter-spacing: .02em; white-space: pre; text-shadow: 0 0 8px rgba(255, 255, 255, .25); }
.bar-w { text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); }
.bar-t { font-size: 11px; letter-spacing: .14em; color: var(--dim); }

/* ---------- toast ---------- */

.yt-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 80;
  display: flex;
  gap: 10px;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  margin: 0;
  padding: 11px 16px 12px;
  overflow: hidden;
  font-size: 12px;
  color: var(--hi);
  background: rgba(6, 6, 6, .94);
  border: 1px solid var(--l3);
  box-shadow: 0 18px 50px -10px #000, 0 0 30px rgba(255, 255, 255, .07);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity .2s var(--ease), transform .35s var(--eo);
}
.yt-toast.on { opacity: 1; transform: translate(-50%, 0); }
.yt-toast-p { color: var(--dim); }
.yt-toast-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--hi);
  box-shadow: 0 0 6px rgba(255, 255, 255, .8);
  transform: scaleX(0);
  transform-origin: left;
}
.yt-toast-bar.run { animation: yt-drain 2.4s linear both; }
@keyframes yt-drain {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ---------- wide screens hide the path first ---------- */

@media (max-width: 1180px) {
  .yt-path { display: none; }
}

/* ---------- touch: every control is at least 40px to hit ---------- */

/* the visible boxes stay the size they are; padding with a matching
   negative margin, or a transparent ::after, makes the hit area bigger */
@media (pointer: coarse) {
  .yt-logo { margin: -7px; padding: 7px; }
  .yt-nav a { padding-top: 11px; padding-bottom: 12px; }
  .chip { min-height: 40px; }
  .chip.has-ava > a { display: inline-flex; align-items: center; align-self: stretch; margin: -1px 0; padding: 1px 0; }
  .chip-x {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    min-height: 40px;
    margin: -1px -12px -1px -8px;
  }
  .pill { height: 40px; }
  .card-x::after { content: ""; position: absolute; inset: -6px; }
  .card.is-row .card-x::after { inset: -8px; }
  .w-channel { margin: -9px 0; padding: 9px 0; }
  a.reel-channel { display: inline-block; margin: -11px 0; padding: 11px 0; }
  .yt-search { height: 42px; }
}

/* ---------- phones ---------- */

@media (max-width: 720px) {
  .yt-top {
    grid-template-columns: auto 1fr;
    grid-template-areas: "brand search" "nav nav";
    row-gap: 6px;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 0;
  }
  .yt-brand { grid-area: brand; }
  .yt-search { grid-area: search; height: 42px; }
  .yt-search input { font-size: 16px; } /* stops iOS zooming into the field */
  .yt-kbd,
  .yt-hint { display: none; }
  .yt-nav { grid-area: nav; margin: 0 -10px; padding: 0 0 2px; }
  .yt-nav-bar { bottom: 2px; }
  .yt-view { padding-top: 20px; }
  .grid { gap: 28px 14px; }
  .grid.is-small { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .shelf-row { grid-auto-columns: minmax(132px, 148px); gap: 12px; }
  .card.is-row .card-link { grid-template-columns: 18px 132px minmax(0, 1fr); gap: 10px; }
  .w-cap-r,
  .feed-mix { display: none; }
  .w-actions { width: 100%; }
  .w-actions .pill { flex: 1 1 auto; padding: 0 10px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px 14px 12px; }
  .bar-row { grid-template-columns: minmax(0, 92px) max-content 34px; gap: 10px; }
  .bar-t { display: none; }
  .ch-head { margin-top: -44px; padding: 0 12px; }
  .ch-head .pill { order: 1; align-self: flex-start; margin: 56px 0 0 auto; } /* clear of the banner edge */
  .ch-who { flex: 1 1 100%; order: 2; padding-bottom: 0; }
  .ava.is-xl,
  .ghost-ava.is-xl { width: 84px; height: 84px; }
  .start { margin-top: 3vh; }
  .start-field { height: 54px; }
  .start-go-in { gap: 12px; }
  .build-hint { font-size: 11px; }
  .btn-go { flex: none; height: 46px; padding: 0 16px 0 18px; gap: 10px; }
  .build-log { padding: 12px; font-size: 12px; }
  .yt-toast { bottom: 16px; }
}

/* ---------- effects tiers (html[data-fx], see fx.js) ---------- */

/* mid: lighter glass, smaller and softer ambient glows, plain reveals */
html[data-fx="mid"] .yt-top {
  -webkit-backdrop-filter: blur(8px) grayscale(1) brightness(.55);
  backdrop-filter: blur(8px) grayscale(1) brightness(.55);
}
html[data-fx="mid"] .start-go {
  -webkit-backdrop-filter: blur(6px) grayscale(1) brightness(.6);
  backdrop-filter: blur(6px) grayscale(1) brightness(.6);
}
html[data-fx="mid"] .w-amb img {
  top: -6%;
  left: -3%;
  width: 106%;
  height: 112%;
  filter: grayscale(1) blur(36px) brightness(1.05) contrast(1.1);
}
html[data-fx="mid"] .reel-amb img { filter: grayscale(1) blur(44px) brightness(.8) contrast(1.1); transform: none; }
html[data-fx="mid"] .rv { transform: none; }
html[data-fx="mid"] .rv.is-in { transition: opacity .35s var(--ease); }
html[data-fx="mid"] .chips.is-stagger .chip,
html[data-fx="low"] .chips.is-stagger .chip { filter: none !important; }

/* low: solid bars, no glows, no shimmer or sweeps, quick view changes */
html[data-fx="low"] .yt-top,
html[data-fx="low"] .start-go {
  background: rgba(3, 3, 3, .98);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
html[data-fx="low"] .w-amb,
html[data-fx="low"] .reel-amb,
html[data-fx="low"] .yt-sweep { display: none; }
html[data-fx="low"] .is-ghost .thumb,
html[data-fx="low"] .is-ghost .short-thumb,
html[data-fx="low"] .reel-stage.is-wait,
html[data-fx="low"] .ghost-line,
html[data-fx="low"] .ghost-ava,
html[data-fx="low"] .w-title:empty::before,
html[data-fx="low"] .w-channel:empty::before { animation: none; background-position: 50% 0; }
html[data-fx="low"] .yt-view.is-in { animation-duration: .22s; }
html[data-fx="low"] .card-link:hover .thumb::before,
html[data-fx="low"] .short:hover .short-thumb::before,
html[data-fx="low"] .btn-go.is-busy::after,
html[data-fx="low"] .yt-empty.is-bad .ascii { animation: none; }

/* ---------- reduced motion: everything holds still ---------- */

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; }
  .yt-sweep,
  .yt-flash { display: none; }
  .yt-view.is-in,
  .yt-view.is-out,
  .reel-stage,
  .chips .chip,
  .log-row,
  .log-n,
  .yt-logo .hex,
  .yt-logo .eyes,
  .yt-empty .ascii { animation: none; }
  .yt-view.is-out { opacity: 1; transform: none; }
  .card.is-gone { animation: none; }
  .is-ghost .thumb,
  .is-ghost .short-thumb,
  .reel-stage.is-wait,
  .ghost-line,
  .ghost-ava,
  .w-title:empty::before,
  .w-channel:empty::before { animation: none; background-position: 50% 0; }
  .thumb img,
  .short-thumb img { transition: none; }
  .card-link:hover .thumb img,
  .short:hover .short-thumb img { transform: none; }
  .card-link:hover .thumb::before,
  .short:hover .short-thumb::before { animation: none; }
  .short:hover,
  .short:focus-visible { transform: none; }
  .yt-load.on::before { width: 100%; animation: none; transform: none; opacity: .5; }
  .w-prog i,
  .reel-play i,
  .reel-prog i { transition: none; }
  .yt-toast-bar.run { animation: none; transform: none; opacity: .5; }
  .spin::before,
  .spin::after,
  .card-link:hover .thumb-tag::after,
  .card-link:focus-visible .thumb-tag::after,
  .short:hover .thumb-tag::after,
  .short:focus-visible .thumb-tag::after,
  .ghost-noise::after,
  .yt-path::after,
  .start-step::after,
  .go-spin::before,
  .btn-go.is-busy::after { animation: none; }
}
