/* ==========================================================================
   ayutube design system: Swiss editorial
   Pure black ground, grey rules, one pink accent. Everything is a rectangle.
   One grotesk (Schibsted Grotesk) set flush-left, big against small, with
   heavy top rules for structure. The only script is the wordmark.
   ========================================================================== */

/* 1. Tokens --------------------------------------------------------------- */

:root {
  color-scheme: dark;

  --ink: #000000;
  --slate: #121212;
  --slate-hi: #1d1d1d;
  --steel: #2e2e2e;
  --steel-hi: #5c5c5c;

  --paper: #f2f2f2;
  --fog: #a6a6a6;
  --dim: #8c8c8c;

  --pink: #fb2a5f;
  --pink-press: #ff4d76;
  --ok: #7dd3a8;
  --err: #ff8da1;

  --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto,
    "Noto Sans", "Noto Sans Devanagari", sans-serif;
  --script: "Sacramento", "Snell Roundhand", "Segoe Script", "Brush Script MT",
    cursive;

  --gutter: 16px;
  --rail-w: 236px;
  --tabbar-h: calc(60px + env(safe-area-inset-bottom, 0px));

  font-family: var(--sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 2. Reset ---------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ink);
  color: var(--paper);
  font: 400 16px/1.5 var(--sans);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  border-radius: 0;
}

button {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

input,
textarea {
  -webkit-appearance: none;
  appearance: none;
}

a {
  color: inherit;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
}

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

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

/* 3. App shell: top brand + bottom tabs on phones, side rail on desktop ---- */

.app {
  min-height: 100vh;
  min-height: 100dvh;
}

.rail {
  display: flex;
  align-items: center;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter) 14px;
  border-bottom: 1px solid var(--steel);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 36px;
  height: auto;
}

.brand-name {
  font-family: var(--script);
  font-size: 34px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.8;
  text-transform: none;
  padding-bottom: 4px;
}

.ay-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ink);
  border-top: 1px solid var(--steel);
}

.ay-tab {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  height: 60px;
  padding: 0 4px;
  border-top: 3px solid transparent;
  margin-top: -1px;
  color: var(--fog);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.ay-tab svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.ay-tab[aria-current="page"] {
  color: var(--paper);
  border-top-color: var(--pink);
}

.ay-tab[aria-current="page"] svg {
  stroke-width: 2.2;
}

.stage {
  padding: 0 var(--gutter) calc(var(--tabbar-h) + 28px);
}

.now-playing {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--tabbar-h);
  z-index: 39;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--gutter);
  background: var(--slate);
  border-top: 1px solid var(--steel);
}

.now-playing-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.now-playing-title small {
  display: block;
  color: var(--fog);
  font-size: 12px;
  font-weight: 500;
}

body.has-now-playing .stage {
  padding-bottom: calc(var(--tabbar-h) + 84px);
}

@media (min-width: 900px) {
  :root {
    --gutter: 40px;
  }

  .app {
    display: grid;
    grid-template-columns: var(--rail-w) minmax(0, 1fr);
  }

  .rail {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 30px 0 24px;
    border-bottom: 0;
    border-right: 1px solid var(--steel);
  }

  .brand {
    padding: 0 28px;
  }

  .brand-mark {
    width: 44px;
  }

  .brand-name {
    font-size: 40px;
  }

  .ay-tabs {
    position: static;
    display: flex;
    flex-direction: column;
    margin-top: 40px;
    padding: 0;
    border-top: 0;
  }

  .ay-tab {
    grid-auto-flow: column;
    justify-content: start;
    align-items: center;
    gap: 16px;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 14px 28px;
    border-top: 0;
    border-left: 3px solid transparent;
    font-size: 15px;
  }

  .ay-tab:hover {
    background: var(--slate);
    color: var(--paper);
  }

  .ay-tab[aria-current="page"] {
    border-left-color: var(--pink);
    background: var(--slate);
  }

  .stage {
    padding-bottom: 72px;
  }

  body.has-now-playing .stage {
    padding-bottom: 72px;
  }

  .now-playing {
    position: static;
    flex-direction: column;
    align-items: stretch;
    margin: auto 20px 0;
    padding: 14px;
    border: 1px solid var(--steel);
  }

  .now-playing-title {
    white-space: normal;
  }
}

/* 4. Search --------------------------------------------------------------- */

.search {
  position: relative;
  margin-top: 20px;
}

.search-field {
  display: flex;
  align-items: stretch;
  background: var(--slate);
  border: 1px solid var(--steel);
}

.search-field:focus-within {
  border-color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
}

.search-field svg {
  flex: none;
  align-self: center;
  width: 20px;
  height: 20px;
  margin-left: 14px;
  fill: none;
  stroke: var(--fog);
  stroke-width: 2;
  stroke-linecap: square;
}

.search-field input {
  flex: 1;
  min-width: 0;
  height: 52px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: none;
  font-size: 17px;
}

.search-field input::placeholder {
  color: var(--dim);
}

.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.search-field button {
  flex: none;
  padding: 0 22px;
  background: var(--pink);
  color: var(--ink);
  font-weight: 700;
}

.search-field button:hover:not(:disabled) {
  background: var(--pink-press);
}

.search-field button:disabled {
  opacity: 0.6;
}

@media (min-width: 900px) {
  .search {
    margin-top: 32px;
  }

  .search-field input {
    height: 56px;
    font-size: 18px;
  }
}

/* 5. Category strip ------------------------------------------------------- */

#ayutube-categories {
  margin-top: 18px;
}

.ay-category-list,
.ay-library-switch {
  display: flex;
  gap: 26px;
  overflow-x: auto;
  border-bottom: 1px solid var(--steel);
  scrollbar-width: none;
}

.ay-category-list::-webkit-scrollbar,
.ay-library-switch::-webkit-scrollbar {
  display: none;
}

.ay-chip {
  flex: none;
  padding: 12px 0 10px;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  color: var(--fog);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.ay-chip:hover {
  color: var(--paper);
}

.ay-chip[aria-pressed="true"] {
  color: var(--paper);
  border-bottom-color: var(--pink);
}

.ay-suggestion-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.ay-tag {
  padding: 8px 12px;
  border: 1px solid var(--steel);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
}

.ay-tag:hover {
  border-color: var(--steel-hi);
  background: var(--slate);
}

/* 6. Status and toast ----------------------------------------------------- */

.status {
  margin-top: 14px;
  color: var(--fog);
  font-size: 14px;
}

.status:empty {
  display: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 16px);
  z-index: 90;
  max-width: min(92vw, 440px);
  padding: 12px 18px;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

body.has-now-playing .toast {
  bottom: calc(var(--tabbar-h) + 76px);
}

@media (min-width: 900px) {
  .toast {
    bottom: 28px;
  }

  body.has-now-playing .toast {
    bottom: 28px;
  }
}

/* 7. Buttons, forms, panels (Library and Account) ------------------------- */

.ay-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--steel);
  background: transparent;
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
}

.ay-action:hover:not(:disabled) {
  border-color: var(--steel-hi);
  background: var(--slate);
}

.ay-action:disabled {
  opacity: 0.55;
}

.ay-action-primary {
  border-color: var(--pink);
  background: var(--pink);
  color: var(--ink);
}

.ay-action-primary:hover:not(:disabled) {
  border-color: var(--pink-press);
  background: var(--pink-press);
}

.ay-action-danger {
  color: var(--err);
}

.ay-action[aria-pressed="true"] {
  border-color: var(--paper);
}

.ay-view {
  padding-top: 28px;
}

.ay-view h1,
.page-title {
  font-size: clamp(44px, 9vw, 88px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.ay-subtitle {
  max-width: 56ch;
  margin-top: 12px;
  color: var(--fog);
}

.ay-section-heading,
.section-head h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.ay-section-heading {
  margin-top: 28px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 40px;
  padding-top: 12px;
  border-top: 3px solid var(--paper);
}

.section-head .ay-chip {
  padding: 0;
  margin: 0;
  border-bottom: 0;
  font-size: 14px;
}

.section-head .ay-chip:hover {
  color: var(--pink);
}

.ay-panel {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--steel);
  background: var(--slate);
}

.ay-panel-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.ay-panel-copy {
  margin-top: 6px;
  color: var(--fog);
  font-size: 15px;
}

.ay-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.ay-form {
  display: grid;
  gap: 16px;
  max-width: 440px;
  margin-top: 20px;
}

.ay-field {
  display: grid;
  gap: 8px;
  color: var(--fog);
  font-size: 14px;
  font-weight: 500;
}

.ay-field input,
.ay-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--steel);
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
}

.ay-field input:focus,
.ay-field textarea:focus {
  outline: 0;
  border-color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
}

.ay-notice {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--steel-hi);
  background: var(--slate);
  color: var(--paper);
  font-size: 14px;
}

.ay-notice-error {
  border-left-color: var(--err);
  color: var(--err);
}

.ay-notice-success {
  border-left-color: var(--ok);
  color: var(--ok);
}

.ay-empty {
  margin-top: 20px;
  padding: 28px 20px;
  border: 1px dashed var(--steel);
  color: var(--fog);
}

/* 8. Video cards, grids, skeletons --------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 30px 22px;
  margin-top: 22px;
}

.stack {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1560px) {
  .grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.vcard {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "media media"
    "body more";
  column-gap: 8px;
  row-gap: 12px;
  align-content: start;
  min-width: 0;
}

.vcard-media {
  grid-area: media;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--slate);
}

.vcard-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vcard-media:hover img {
  opacity: 0.92;
}

.vcard-duration {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: block;
  max-width: calc(100% - 10px);
  padding: 2px 5px;
  background: var(--ink);
  color: var(--paper);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

.vcard-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  height: 4px;
  background: rgba(242, 242, 242, 0.3);
}

.vcard-progress i {
  display: block;
  height: 100%;
  background: var(--pink);
}

.vcard-body {
  grid-area: body;
  min-width: 0;
}

.vcard-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

.vcard-titlebtn {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-align: left;
  font-weight: inherit;
}

.vcard-titlebtn:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.vcard-channel {
  margin-top: 6px;
  color: var(--fog);
  font-size: 14px;
  font-weight: 500;
}

.vcard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 14px;
  margin-top: 2px;
  color: var(--dim);
  font-size: 13px;
}

.vcard-more {
  grid-area: more;
  align-self: start;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-right: -10px;
  color: var(--fog);
}

.vcard-more:hover,
.vcard-more[aria-expanded="true"] {
  background: var(--slate);
  color: var(--paper);
}

.vcard-more svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* Lead: the one large moment on the page. */

.vcard--lead .vcard-title {
  font-size: clamp(30px, 8.4vw, 44px);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.vcard--lead .vcard-titlebtn {
  -webkit-line-clamp: 5;
}

.vcard--lead .vcard-channel {
  font-size: 16px;
}

@media (min-width: 900px) {
  .vcard--lead {
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) auto;
    grid-template-areas: "media body more";
    column-gap: 28px;
    align-items: end;
  }

  .vcard--lead .vcard-body {
    padding-bottom: 4px;
  }

  .vcard--lead .vcard-title {
    font-size: clamp(36px, 3.4vw, 54px);
  }
}

/* Compact: thumbnail beside text. Keep the action column narrow on phones so
   titles have room and rows stay aligned without pushing the menu off-screen. */

.vcard--compact {
  grid-template-columns: clamp(112px, 38vw, 168px) minmax(0, 1fr) 28px;
  grid-template-areas: "media body more";
  column-gap: 10px;
  align-items: start;
}

.vcard--compact .vcard-more {
  width: 28px;
  height: 32px;
  margin-right: 0;
}

.vcard--compact .vcard-title {
  font-size: 14px;
}

.vcard--compact .vcard-channel {
  margin-top: 4px;
  font-size: 13px;
}

.vcard--compact .vcard-meta {
  font-size: 12px;
}

@media (min-width: 640px) {
  .vcard--compact {
    grid-template-columns: 168px minmax(0, 1fr) 32px;
    column-gap: 12px;
  }

  .vcard--compact .vcard-more {
    width: 32px;
  }
}

/* Skeletons */

@keyframes ay-pulse {
  50% {
    opacity: 0.5;
  }
}

.vcard--skeleton {
  animation: ay-pulse 1.4s ease-in-out infinite;
}

.skel-line {
  display: block;
  width: 92%;
  height: 14px;
  margin-top: 8px;
  background: var(--slate);
}

.skel-short {
  width: 55%;
}

/* 9. Action menu ---------------------------------------------------------- */

.menu {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  min-width: 220px;
  max-width: min(86vw, 320px);
  max-height: min(70vh, 420px);
  overflow: auto;
  border: 1px solid var(--steel-hi);
  background: var(--slate);
}

.menu-item {
  display: block;
  width: 100%;
  padding: 13px 16px;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--slate-hi);
}

.menu-item:focus-visible {
  outline-offset: -2px;
}

.menu-rule {
  height: 1px;
  margin: 4px 0;
  background: var(--steel);
}

.menu-note {
  max-width: 260px;
  padding: 12px 16px;
  color: var(--fog);
  font-size: 14px;
}

/* 10. Search results ------------------------------------------------------ */

.results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-top: 26px;
}

.results-title {
  font-size: clamp(30px, 6vw, 56px);
  font-weight: 800;
  line-height: 0.96;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.results-count {
  margin-top: 8px;
  color: var(--fog);
  font-size: 14px;
}

.filter-row {
  display: flex;
  gap: 24px;
  margin-top: 18px;
  overflow-x: auto;
  border-bottom: 1px solid var(--steel);
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.results-head + .grid {
  margin-top: 24px;
}

.filter-row + .grid {
  margin-top: 24px;
}

/* 11. Preferences ---------------------------------------------------------- */

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--steel);
}

.pref-row:first-of-type {
  margin-top: 14px;
}

.pref-title {
  font-size: 16px;
  font-weight: 600;
}

.pref-copy {
  margin-top: 2px;
  color: var(--fog);
  font-size: 13px;
}

.ay-switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 28px;
  border: 1px solid var(--steel-hi);
  background: var(--ink);
}

.ay-switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--fog);
  transition: transform 0.15s ease;
}

.ay-switch[aria-checked="true"] {
  border-color: var(--pink);
  background: var(--pink);
}

.ay-switch[aria-checked="true"] .ay-switch-knob {
  background: var(--ink);
  transform: translateX(24px);
}

/* 12. Home feed ----------------------------------------------------------- */

.feed {
  padding-top: 26px;
}

.feed-lead {
  margin-bottom: 8px;
}

.grid--flush {
  margin-top: 40px;
}

.feed-section .grid,
.feed-section .hrow {
  margin-top: 20px;
}

.hrow {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(78vw, 300px);
  gap: 18px;
  padding-bottom: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--steel-hi) transparent;
}

.hrow > .vcard {
  scroll-snap-align: start;
}

@media (min-width: 900px) {
  .hrow {
    grid-auto-columns: 288px;
  }
}

.feed-more {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 36px;
}

.feed-note {
  color: var(--err);
  font-size: 14px;
}

.feed-sentinel {
  height: 1px;
}

/* 13. Watch page ---------------------------------------------------------- */

.watch {
  padding-top: 0;
}

/* Phones: the player is full width and stays pinned while the page scrolls. */
.watch-player {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 calc(var(--gutter) * -1);
  padding-top: env(safe-area-inset-top, 0px);
  background: #000;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px; /* the embed must never be smaller than 200px */
  background: #000;
}

.video-frame video,
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.player-message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--slate);
  color: var(--fog);
  font-size: 14px;
  text-align: center;
}

.watch-info {
  padding-top: 18px;
}

.watch-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.watch-title {
  font-size: clamp(24px, 5.4vw, 36px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
}

.watch-channel {
  margin-top: 10px;
  color: var(--fog);
  font-size: 20px;
  font-weight: 600;
}

.watch-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.watch-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--pink);
  font-weight: 600;
}

.watch-next {
  margin-top: 40px;
}

.watch-next-title {
  padding-top: 12px;
  border-top: 3px solid var(--paper);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.up-next {
  margin-top: 18px;
}

@media (min-width: 1100px) {
  .watch {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "player next"
      "info next";
    column-gap: 40px;
    align-items: start;
    padding-top: 32px;
  }

  .watch-player {
    grid-area: player;
    position: static;
    margin: 0;
    padding-top: 0;
  }

  .watch-info {
    grid-area: info;
  }

  .watch-next {
    grid-area: next;
    margin-top: 0;
  }
}

/* Notes */

.watch-notes {
  margin-top: 40px;
}

.note-form {
  display: grid;
  gap: 10px;
  max-width: 640px;
  margin-top: 18px;
}

.note-form textarea {
  width: 100%;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--steel);
  background: var(--ink);
  color: var(--paper);
  font-size: 16px;
  resize: vertical;
}

.note-form textarea:focus {
  outline: 0;
  border-color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
}

.note-form .ay-action {
  justify-self: start;
}

.note-list {
  max-width: 640px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.note-list li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 12px 0;
  border-top: 1px solid var(--steel);
}

.note-time {
  color: var(--pink);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.note-body {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.note-list .ay-chip {
  padding: 0;
  margin: 0;
  border-bottom: 0;
  font-size: 13px;
}

/* 14. Library -------------------------------------------------------------- */

.ay-library-switch {
  margin-top: 26px;
}

.inline-form {
  display: flex;
  gap: 8px;
  max-width: 520px;
  margin-top: 24px;
}

.inline-form input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--steel);
  background: var(--slate);
  color: var(--paper);
  font-size: 16px;
}

.inline-form input:focus {
  outline: 0;
  border-color: var(--pink);
  box-shadow: inset 0 0 0 1px var(--pink);
}

.inline-form .ay-action {
  height: 46px;
}

.lib-list {
  margin-top: 26px;
  border-top: 3px solid var(--paper);
}

.lib-list--plain {
  margin-top: 16px;
}

.lib-row {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--steel);
}

.lib-row--text {
  grid-template-columns: minmax(0, 1fr) auto;
}

.lib-row[data-favorite="true"] {
  padding-left: 14px;
  box-shadow: inset 3px 0 0 var(--pink);
}

.lib-thumb {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--slate);
}

.lib-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lib-body {
  min-width: 0;
}

.lib-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  text-align: left;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.lib-title:hover:not(.lib-title--static) {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.lib-title--big {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.lib-title--static {
  cursor: default;
}

.lib-channel {
  margin-top: 4px;
  color: var(--fog);
  font-size: 14px;
}

.lib-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  color: var(--fog);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.lib-progress-bar {
  flex: 1;
  max-width: 240px;
  height: 4px;
  background: rgba(242, 242, 242, 0.22);
}

.lib-progress-bar i {
  display: block;
  height: 100%;
  background: var(--pink);
}

.lib-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.lib-heading {
  margin-top: 24px;
  font-size: clamp(32px, 7vw, 64px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.lib-heading + .lib-progress {
  margin-top: 16px;
}

.lib-body-wrap > .ay-action:first-child {
  margin-top: 24px;
}

@media (max-width: 560px) {
  .lib-row {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 12px 14px;
  }

  .lib-row--text {
    grid-template-columns: minmax(0, 1fr);
  }

  .lib-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* 15. Search suggestions -------------------------------------------------- */

.suggest {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  border: 1px solid var(--steel-hi);
  border-top: 0;
  background: var(--slate);
}

.suggest-option {
  padding: 13px 16px;
  font-size: 16px;
  cursor: pointer;
}

.suggest-option[aria-selected="true"],
.suggest-option:hover {
  background: var(--slate-hi);
  box-shadow: inset 3px 0 0 var(--pink);
}

.suggest-clear {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border-top: 1px solid var(--steel);
  color: var(--fog);
  font-size: 13px;
  text-align: left;
}

.suggest-clear:hover {
  color: var(--paper);
}

/* 16. Channel page --------------------------------------------------------- */

.vcard-channel,
.lib-channel,
.watch-channel {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vcard-channel:hover,
.lib-channel:hover,
.watch-channel:hover {
  color: var(--paper);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.watch-channel:empty {
  display: none;
}

.channel {
  padding-top: 26px;
}

.channel-head {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 22px;
}

.channel-avatar {
  flex: none;
  width: 72px;
  height: 72px;
  object-fit: cover;
  background: var(--slate);
}

.channel-text {
  min-width: 0;
}

.channel-name {
  font-size: clamp(32px, 8vw, 64px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.045em;
  overflow-wrap: anywhere;
}

.channel-meta {
  margin-top: 10px;
  color: var(--fog);
  font-size: 14px;
}

.channel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.channel-body .grid {
  margin-top: 32px;
  padding-top: 0;
}

.channel-body > .grid:first-child {
  margin-top: 32px;
}

@media (min-width: 900px) {
  .channel-avatar {
    width: 96px;
    height: 96px;
  }
}

/* 17. Following, badges, tab dot ------------------------------------------ */

.chan-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.chan-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--steel);
  font-size: 15px;
  font-weight: 600;
}

.chan-chip:hover {
  border-color: var(--steel-hi);
  background: var(--slate);
}

.chan-chip[data-new="true"]::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--pink);
}

.vcard-badge {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  min-width: 18px;
  padding: 2px 5px;
  line-height: 1;
  background: var(--pink);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
}

.ay-tab {
  position: relative;
}

.tab-dot {
  position: absolute;
  top: 10px;
  left: calc(50% + 8px);
  width: 8px;
  height: 8px;
  background: var(--pink);
}

@media (min-width: 900px) {
  .tab-dot {
    top: 13px;
    left: 48px;
  }
}

/* 18. Loading line --------------------------------------------------------- */

.player-message.is-loading {
  display: grid;
  align-content: center;
  padding: 0;
  background: #000;
}

.load-line {
  position: relative;
  width: 100%;
  height: 3px;
  background: var(--steel);
}

.load-line i {
  position: absolute;
  inset: 0;
  background: var(--pink);
  transform: scaleX(0);
  transform-origin: left center;
}

/* 19. Exam countdown ------------------------------------------------------- */

.exam {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 36px;
  padding-top: 12px;
  border-top: 3px solid var(--paper);
}

.exam-days {
  font-size: clamp(56px, 13vw, 112px);
  font-weight: 800;
  line-height: 0.85;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
}

.exam-label {
  color: var(--fog);
  font-size: 16px;
  font-weight: 600;
}

/* 20. Welcome and interests ----------------------------------------------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  overflow-y: auto;
  background: #000;
  padding: calc(28px + env(safe-area-inset-top, 0px)) var(--gutter)
    calc(32px + env(safe-area-inset-bottom, 0px));
}

.overlay-inner {
  max-width: 520px;
  margin: 0 auto;
}

.overlay-inner--wide {
  max-width: 920px;
}

.overlay-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.welcome-form {
  margin-top: 36px;
}

.welcome-form .ay-section-heading,
.overlay-title {
  margin-top: 0;
  font-size: clamp(40px, 10vw, 72px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.welcome-form .ay-form {
  max-width: none;
  margin-top: 28px;
}

.welcome-incognito {
  width: 100%;
  margin-top: 28px;
}

.pick-count {
  margin-top: 14px;
  color: var(--fog);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.pick-group {
  margin-top: 30px;
  padding-top: 10px;
  border-top: 3px solid var(--paper);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

@media (min-width: 640px) {
  .pick-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.pick {
  min-height: 58px;
  padding: 10px 14px;
  border: 1px solid var(--steel);
  font-size: 16px;
  font-weight: 700;
  text-align: left;
}

.pick:hover:not(:disabled) {
  border-color: var(--steel-hi);
  background: var(--slate);
}

.pick[aria-pressed="true"],
.pick[aria-pressed="true"]:hover:not(:disabled) {
  border-color: var(--pink);
  background: var(--pink);
  color: var(--ink);
}

.pick:disabled {
  opacity: 0.35;
}

.overlay-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  margin-top: 28px;
  padding: 14px 0 4px;
  background: #000;
  border-top: 1px solid var(--steel);
}

.toast {
  z-index: 130;
}

/* 21. Clean controls ------------------------------------------------------- */

.clean-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 calc(var(--gutter) - 8px);
  background: #000;
  border-top: 1px solid var(--steel);
}

.clean-bar[hidden] {
  display: none;
}

.clean-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--paper);
  cursor: pointer;
}

.clean-btn:hover {
  background: var(--slate-hi);
}

.clean-btn svg {
  width: 22px;
  height: 22px;
}

.clean-time {
  flex: none;
  min-width: 38px;
  color: var(--fog);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.clean-range {
  --p: 0%;
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  margin: 0 4px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.clean-range:disabled {
  opacity: 0.4;
  cursor: default;
}

.clean-range::-webkit-slider-runnable-track {
  height: 3px;
  background: linear-gradient(to right, var(--pink) var(--p), var(--steel) var(--p));
}

.clean-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border: 0;
  border-radius: 0;
  background: var(--paper);
}

.clean-range::-moz-range-track {
  height: 3px;
  background: var(--steel);
}

.clean-range::-moz-range-progress {
  height: 3px;
  background: var(--pink);
}

.clean-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 0;
  background: var(--paper);
}

.clean-range:focus-visible,
.clean-btn:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: -2px;
}

.watch-player:fullscreen {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background: #000;
}

.watch-player:fullscreen .video-frame {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
}

.watch-player:-webkit-full-screen {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  background: #000;
}

.watch-player:-webkit-full-screen .video-frame {
  flex: 1 1 auto;
  aspect-ratio: auto;
  min-height: 0;
}

/* 22. Search tabs, playlists, channel cards ------------------------------- */

.results-tabs {
  margin-top: 18px;
}

.results-body {
  margin-top: 24px;
}

.results-body > .grid,
.results-body > .ccard-list {
  margin-top: 0;
}

.results-body .filter-row + .grid,
.results-body .filter-row {
  margin-top: 18px;
}

.results-strip + .results-strip {
  margin-top: 36px;
}

.results-strip .grid,
.results-strip .ccard-list {
  margin-top: 16px;
}

.results-strip .filter-row + .grid {
  margin-top: 20px;
}

.pcard-stack {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 4px 10px;
  background: #000;
  color: var(--paper);
  border-top: 1px solid var(--steel);
  border-left: 1px solid var(--steel);
  font-size: 12px;
  font-weight: 700;
}

.ccard-list {
  display: grid;
  gap: 1px;
  background: var(--steel);
  border: 1px solid var(--steel);
}

.ccard {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: #000;
}

.ccard-avatar {
  flex: none;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  background: var(--slate);
  cursor: pointer;
  overflow: hidden;
}

.ccard-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ccard-body {
  min-width: 0;
}

.ccard-name {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--paper);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.ccard-name:hover {
  text-decoration: underline;
}

.ccard-meta {
  margin-top: 4px;
  color: var(--fog);
  font-size: 13px;
}

.ccard-desc {
  margin-top: 6px;
  color: var(--fog);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.playlist-owner {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.playlist-progress {
  margin-top: 4px;
}

.playlist-list {
  margin-top: 28px;
}

.vcard.is-current {
  /* Keep the active row easy to find without the heavy full-card box. */
  outline: none;
  background: rgba(251, 42, 95, 0.055);
  box-shadow: inset 3px 0 0 var(--pink);
}

#playlist-pane .playlist-title {
  line-height: 1.02;
  letter-spacing: -0.04em;
  padding-block: 0.04em;
}

.channel-tabs {
  margin-top: 22px;
}

.channel-sort {
  display: flex;
  gap: 8px;
  margin-top: 22px;
}

.channel-sort + .feed-note {
  margin-top: 10px;
}

.channel-body > .feed-note:first-child {
  margin-top: 18px;
}

/* 23. Watch page actions ---------------------------------------------------- */

.watch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* Like, Save, Playlist and Share share one box. The heart is the largest. */
.watch-row--icons {
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  width: max-content;
  max-width: 100%;
  border: 1px solid var(--steel-hi);
}

.ay-icon {
  width: 56px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 0;
}

.ay-icon + .ay-icon {
  border-left: 1px solid var(--steel);
}

.ay-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ay-icon--like svg {
  width: 28px;
  height: 28px;
}

.ay-icon[aria-pressed="true"] svg {
  fill: currentColor;
}

.watch-row--controls .ay-action {
  min-height: 44px;
  border-color: var(--steel-hi);
}

.ay-speed {
  min-width: 48px;
  padding: 0 12px;
}

.ay-toggle::before {
  content: "";
  width: 10px;
  height: 10px;
  border: 1px solid var(--paper);
}

.ay-toggle[aria-pressed="true"]::before {
  background: var(--paper);
}

.ay-follow[aria-pressed="true"] {
  background: var(--paper);
  border-color: var(--paper);
  color: var(--ink);
}

.ay-follow[aria-pressed="true"]:hover:not(:disabled) {
  background: var(--paper);
  border-color: var(--paper);
}

