/* ==========================================================================
   YeahTV — Metro (Windows 8.1 / Xbox 360) inspired
   Everything is sized in rem; the root size scales with the viewport so the
   layout looks the same at 720p, 1080p and 4K (1rem = 16px @ 1280x720).
   ========================================================================== */

:root {
  --accent: #e51400;
  --accent-hi: #ff3a26;
  --accent-lo: #8f0c00;
  --bg: #0a0a0a;
  --bg-2: #151515;
  --tile: #1f1f1f;
  --line: rgba(255, 255, 255, .12);
  --text: #fff;
  --dim: rgba(255, 255, 255, .64);
  --faint: rgba(255, 255, 255, .4);

  --ease: cubic-bezier(.1, .9, .2, 1);       /* the Windows 8 "enter" curve */
  --ease-in: cubic-bezier(.7, 0, 1, .5);

  --sx: 4.5rem;          /* horizontal TV-safe area */
  --bar: 5.25rem;        /* top bar height */
  --gap: .9rem;

  --font: "Segoe UI", "Segoe UI Web (West European)", Selawik, "Open Sans", system-ui, sans-serif;
  --marker: "Permanent Marker", "Segoe Print", cursive;
}

html {
  font-size: max(10px, min(1.25vw, 2.2222vh));
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.4;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.kbd { cursor: none; } /* not .key: that's the search keyboard's class */
body.booting { overflow: hidden; }

button {
  font: inherit; color: inherit; background: none; border: 0;
  padding: 0; margin: 0; cursor: pointer; text-align: inherit;
}
img { display: block; }
:focus { outline: none; }
::selection { background: var(--accent); color: #fff; }
::-webkit-scrollbar { width: .5rem; height: .5rem; }
::-webkit-scrollbar-thumb { background: #333; }
::-webkit-scrollbar-track { background: transparent; }

.ic { display: inline-block; width: 1.35rem; height: 1.35rem; flex: none; }
.ic-slot { display: contents; } /* swappable icon holder; mustn't add its own line box */
.ic svg {
  display: block; width: 100%; height: 100%;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Wordmark ---------- */

.wordmark {
  position: relative;
  display: inline-block;
  font-family: var(--marker);
  font-weight: 400;
  line-height: 1.1;
  white-space: nowrap;
  letter-spacing: .01em;
}
.wordmark .y {
  background: linear-gradient(180deg, #fff 35%, #b4b4b4 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark .tv {
  background: linear-gradient(180deg, #ff4b36 25%, #b30f00 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.wordmark.flat .y { background: none; color: #fff; }
.wordmark.flat .tv { background: none; color: var(--accent); }

/* light sweep across the letters */
.sheen::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  color: transparent;
  pointer-events: none;
  background: linear-gradient(105deg,
    transparent 0%, transparent 43%,
    rgba(255, 255, 255, .85) 48%, #fff 50%, rgba(255, 255, 255, .85) 52%,
    transparent 57%, transparent 100%);
  background-size: 300% 100%;
  background-position: 150% 0;
  background-repeat: no-repeat;
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 0 .25em rgba(255, 255, 255, .55));
}

@keyframes sheen {
  0%   { background-position: 150% 0; }
  55%, 100% { background-position: -50% 0; }
}

/* ---------- Splash ---------- */

#splash {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: #000;
  transition: opacity .55s ease .1s, visibility 0s linear .7s;
}
#splash .wordmark { font-size: 9.5rem; opacity: 0; transform: scale(.94); }
#splash.ready .wordmark { animation: markIn .9s var(--ease) forwards; }
#splash.ready .wordmark::after { animation: splashSheen 3.6s cubic-bezier(.45, 0, .25, 1) .35s infinite; }
#splash.out { opacity: 0; visibility: hidden; }
#splash.out .wordmark { animation: markOut .6s var(--ease-in) forwards; }

/* one ~1.2s sweep, then the mark rests until the next */
@keyframes splashSheen {
  0%   { background-position: 150% 0; }
  33%, 100% { background-position: -50% 0; }
}
@keyframes markIn { to { opacity: 1; transform: none; } }
@keyframes markOut { from { opacity: 1; transform: none; } to { opacity: 0; transform: scale(1.12); } }

/* ---------- Windows 8 progress ring ---------- */

.ring { position: relative; width: 3.6rem; height: 3.6rem; }
.ring i { position: absolute; inset: 0; opacity: 0; animation: orbit 5.2s infinite; }
.ring i::after {
  content: ""; position: absolute; left: 50%; top: 0;
  width: .42rem; height: .42rem; margin-left: -.21rem;
  border-radius: 50%; background: #fff;
}
.ring i:nth-child(2) { animation-delay: .24s; }
.ring i:nth-child(3) { animation-delay: .48s; }
.ring i:nth-child(4) { animation-delay: .72s; }
.ring i:nth-child(5) { animation-delay: .96s; }
@keyframes orbit {
  0%   { transform: rotate(225deg); opacity: 1; animation-timing-function: ease-out; }
  7%   { transform: rotate(345deg); animation-timing-function: linear; }
  30%  { transform: rotate(455deg); animation-timing-function: ease-in-out; }
  39%  { transform: rotate(690deg); animation-timing-function: linear; }
  70%  { transform: rotate(815deg); opacity: 1; animation-timing-function: ease-out; }
  75%  { transform: rotate(945deg); animation-timing-function: ease-out; }
  76%  { transform: rotate(945deg); opacity: 0; }
  100% { transform: rotate(945deg); opacity: 0; }
}

.loading { min-height: 100vh; display: grid; place-items: center; }
.loading.small { min-height: 12rem; }
.loading.small .ring { transform: scale(.75); }

/* ---------- Top bar & pivots ---------- */

#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: var(--bar);
  display: flex; align-items: center; gap: 2.6rem;
  padding: 0 var(--sx);
  background: linear-gradient(180deg, rgba(0, 0, 0, .8), rgba(0, 0, 0, 0)) transparent;
  transition: background-color .35s ease;
}
#topbar.solid { background-color: rgba(10, 10, 10, .97); }
body.watching #topbar { display: none; }

.logo { font-size: 2.3rem; padding: 0 .55rem; margin-left: -.55rem; transition: transform .3s var(--ease); }
.logo:focus { outline: .15rem solid #fff; }
.logo:focus .wordmark::after { animation: sheen 1.4s ease-in-out; }

.pivots { display: flex; gap: .3rem; min-width: 0; }
.pivot {
  position: relative;
  padding: .1rem .75rem .4rem;
  font-size: 1.55rem; font-weight: 300; letter-spacing: .01em;
  color: var(--faint); white-space: nowrap;
  transition: color .2s, background-color .12s;
}
.pivot:hover { color: var(--dim); }
.pivot.active { color: #fff; }
.pivot.active::after {
  content: ""; position: absolute; left: .75rem; right: .75rem; bottom: .1rem;
  height: .18rem; background: var(--accent);
}
.pivot:focus { background: var(--accent); color: #fff; }
.pivot:focus::after { background: #fff; }

.clock { margin-left: auto; font-size: 1.6rem; font-weight: 300; letter-spacing: .02em; white-space: nowrap; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: .7rem;
  height: 3.2rem; padding: 0 1.55rem;
  font-size: 1.12rem; font-weight: 600; white-space: nowrap;
  background: rgba(255, 255, 255, .14);
  border: .15rem solid transparent;
  transition: transform .3s var(--ease), background-color .12s, color .12s, border-color .12s;
}
.btn-primary { background: #fff; color: #000; }
.btn:focus { background: var(--accent); color: #fff; border-color: #fff; transform: scale(1.05); }
.btn-sm { height: 2.7rem; padding: 0 1.1rem; font-size: 1rem; gap: .55rem; }
.btn-sm .ic { width: 1.2rem; height: 1.2rem; }
.btn.on { box-shadow: inset 0 -.2rem 0 var(--accent); }
.btn.on:focus { box-shadow: inset 0 -.2rem 0 #fff; }
.btn:disabled { opacity: .35; cursor: default; }

.backbtn {
  width: 3.1rem; height: 3.1rem; flex: none;
  display: grid; place-items: center;
  border: .15rem solid #fff; border-radius: 50%;
  transition: background-color .12s, border-color .12s, transform .3s var(--ease);
}
.backbtn .ic { width: 1.4rem; height: 1.4rem; }
.backbtn:hover { background: rgba(255, 255, 255, .15); }
.backbtn:focus { background: var(--accent); border-color: var(--accent); transform: scale(1.08); box-shadow: 0 0 0 .15rem #fff; }

/* press feedback (pointer tilt + key press) */
.pressing { transition-duration: .08s !important; }
.tile.pressing, .tile.pressing:focus, .ep.pressing, .btn.pressing {
  transform: perspective(60rem) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(.965);
}

/* ---------- Pages & transitions ---------- */

#view { min-height: 100vh; }
.page { min-height: 100vh; }
.page-pad { padding-top: calc(var(--bar) + 1rem); padding-bottom: 4rem; }
.page-title {
  margin: 0 0 1rem; padding: 0 var(--sx);
  font-size: 4.2rem; font-weight: 300; letter-spacing: -.01em; line-height: 1.1;
}

.page.leave-slide { animation: leaveSlide .16s var(--ease-in) forwards; }
.page.leave-turn  { animation: leaveTurn .24s var(--ease-in) forwards; }
.page.enter-turn  { animation: enterTurn .6s var(--ease) both; transform-origin: 0 50%; }

@keyframes leaveSlide { to { opacity: 0; transform: translateX(calc(var(--dir, 1) * -3rem)); } }
@keyframes leaveTurn  { to { opacity: 0; transform: perspective(160rem) rotateY(72deg); } }
@keyframes enterTurn  { from { opacity: 0; transform: perspective(160rem) rotateY(60deg); } }

/* staggered Metro content entrance */
@keyframes enterIn { from { opacity: 0; transform: translateX(calc(var(--dir, 1) * 6rem)); } }
.enter { animation: enterIn .7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.row.enter { animation: none; }
.row.enter .row-title { animation: enterIn .7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.row.enter .tile { animation: enterIn .7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 70ms + var(--j, 0) * 35ms); }
.results .tile { animation: enterIn .6s var(--ease) backwards; animation-delay: calc(var(--j, 0) * 30ms); }
body.booting .enter,
body.booting .row.enter .row-title,
body.booting .row.enter .tile,
body.booting .results .tile { animation-play-state: paused; }

/* ---------- Hero ---------- */

.hero { position: relative; height: 84vh; min-height: 32rem; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; background: #000; }
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 22%;
  opacity: 0; transition: opacity 1.1s ease;
  animation: kenburns 16s ease-out both;
}
.hero-img.on { opacity: 1; }
@keyframes kenburns { from { transform: scale(1.08); } to { transform: scale(1); } }
.hero-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(10, 10, 10, .94) 0%, rgba(10, 10, 10, .68) 30%, rgba(10, 10, 10, 0) 66%),
    linear-gradient(0deg, var(--bg) 0%, rgba(10, 10, 10, .6) 18%, rgba(10, 10, 10, 0) 42%),
    linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, 0) 22%);
}
.hero-content {
  position: absolute; left: var(--sx); bottom: 14rem;
  width: 44rem; max-width: calc(100% - 2 * var(--sx));
}
.hero-kicker {
  display: flex; align-items: center; gap: .7rem;
  font-size: .95rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
  color: #fff;
}
.hero-kicker::before { content: ""; width: .8rem; height: .8rem; background: var(--accent); }
.hero-titlebox { min-height: 4rem; margin: .7rem 0 1rem; display: flex; align-items: flex-end; }
.hero-title {
  margin: 0; padding-bottom: .06em; /* room for descenders under the clamp */
  font-size: 4.6rem; font-weight: 300; line-height: 1.1; letter-spacing: -.015em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  text-shadow: 0 .2rem 1.2rem rgba(0, 0, 0, .5);
}
.hero-logo {
  max-width: 30rem; max-height: 10.5rem; width: auto; height: auto;
  object-fit: contain; object-position: left bottom;
  filter: drop-shadow(0 .2rem .9rem rgba(0, 0, 0, .55));
  animation: fadeIn .5s ease both;
}
@keyframes fadeIn { from { opacity: 0; } }
.hero-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.3rem; font-size: 1.1rem; color: var(--dim); }
.hero-meta .rate { color: #fff; font-weight: 600; }
.hero-overview {
  margin: .9rem 0 1.8rem; max-width: 40rem;
  font-size: 1.2rem; line-height: 1.5; color: rgba(255, 255, 255, .86);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; gap: 1rem; }
.hero-content.swap-out { animation: heroOut .2s var(--ease-in) forwards; }
.hero-content.swap-in  { animation: enterIn .7s var(--ease) both; }
@keyframes heroOut { to { opacity: 0; transform: translateX(-2.5rem); } }

.hero-dots { position: absolute; right: var(--sx); bottom: 14.8rem; display: flex; gap: .45rem; }
.hero-dot { width: 2.4rem; height: 1.6rem; display: flex; align-items: center; }
.hero-dot::before {
  content: ""; width: 100%; height: .22rem; background: rgba(255, 255, 255, .32);
  transition: background-color .2s, height .2s var(--ease);
}
.hero-dot.on::before { background: #fff; }
.hero-dot:focus::before { background: var(--accent); height: .55rem; }

/* wide screens are only ~45rem tall (less once the root size bottoms out): tighten the hero so it clears the top bar */
@media (min-aspect-ratio: 7/5), (max-height: 449px) {
  .hero-content { bottom: 12.5rem; }
  .hero-titlebox { margin: .4rem 0 .7rem; }
  .hero-logo { max-width: 26rem; max-height: 7rem; }
  .hero-title { font-size: 3.2rem; }
  .hero-overview { margin: .6rem 0 1.3rem; -webkit-line-clamp: 2; }
  .hero-dots { bottom: 13.3rem; }
}
@media (max-height: 449px) {
  .hero-kicker, .hero-overview { display: none; }
  .hero-meta { margin-bottom: 1.3rem; }
}

/* ---------- Rows & tiles ---------- */

.rows { position: relative; z-index: 2; margin-top: -11rem; padding-bottom: 5rem; }
.rows.plain { margin-top: 0; padding-top: calc(var(--bar) + 1rem); }
.row { margin-bottom: .6rem; }
.row-title {
  margin: 0 0 -.5rem; padding: 0 var(--sx);
  font-size: 1.7rem; font-weight: 300; letter-spacing: .01em; line-height: 1.3;
}
.row-viewport { position: relative; }

.scroller-x {
  display: flex; gap: var(--gap);
  overflow-x: auto; overflow-y: hidden;
  padding: 1.3rem 0 1.7rem var(--sx);
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.scroller-x::-webkit-scrollbar { display: none; }
.scroller-x::after { content: ""; flex: 0 0 calc(var(--sx) - var(--gap)); }

.tile {
  position: relative; flex: 0 0 auto; display: block;
  background: var(--tile);
  outline: .22rem solid transparent; outline-offset: .2rem;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), outline-color .12s;
}
.tile-wide { width: 19.5rem; aspect-ratio: 16 / 9; }
.tile-poster { width: 11.6rem; aspect-ratio: 2 / 3; }
.tile-art { position: absolute; inset: 0; overflow: hidden; background: var(--tile); }
.tile-art img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s ease; }
.tile-art img.ok { opacity: 1; }
.tile-label {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 2.4rem .9rem .7rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, .88));
  font-size: 1.02rem; font-weight: 600; line-height: 1.2; text-align: left;
}
.tile-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-sub { display: block; margin-top: .2rem; font-size: .82rem; font-weight: 400; color: var(--dim); }
.tile-poster .tile-label { opacity: 0; transform: translateY(.8rem); transition: opacity .2s, transform .35s var(--ease); }
.tile-poster:focus .tile-label, .tile-poster:hover .tile-label { opacity: 1; transform: none; }

.tile:focus { transform: scale(1.07); outline-color: #fff; z-index: 3; box-shadow: 0 1.2rem 2.6rem rgba(0, 0, 0, .65); }

/* Metro colour tile when there is no artwork */
.tile.noimg .tile-art { background: linear-gradient(135deg, var(--accent), var(--accent-lo)); }
.tile.noimg .tile-label { background: none; top: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.tile.noimg.tile-poster .tile-label, .tile.noimg.tile-rank .tile-label { opacity: 1; transform: none; }

/* top 10 */
.tile-rank { min-width: 17.8rem; height: 17.4rem; background: none; display: flex; align-items: flex-end; outline: 0; }
.rank-num {
  flex: none; position: relative; z-index: 0;
  margin-right: -2.1rem;
  font-size: 13rem; font-weight: 700; line-height: .78; letter-spacing: -.09em;
  color: var(--bg); -webkit-text-stroke: .16rem rgba(255, 255, 255, .7);
  transition: -webkit-text-stroke-color .2s;
}
.tile-rank .tile-art {
  position: relative; inset: auto; z-index: 1; flex: none;
  width: 11.6rem; height: 17.4rem; margin-left: auto;
  outline: .22rem solid transparent; outline-offset: .2rem;
  transition: outline-color .12s;
}
.tile-rank:focus { transform: scale(1.05); box-shadow: none; }
.tile-rank:focus .tile-art { outline-color: #fff; box-shadow: 0 1.2rem 2.6rem rgba(0, 0, 0, .65); }
.tile-rank:focus .rank-num { -webkit-text-stroke-color: var(--accent-hi); }
.tile-rank .tile-label { opacity: 0; transition: opacity .2s; }
.tile-rank:focus .tile-label, .tile-rank:hover .tile-label { opacity: 1; }

/* mouse-only row arrows */
.row-arrow {
  position: absolute; top: 1.3rem; bottom: 1.7rem; z-index: 4;
  width: max(calc(var(--sx) - .8rem), 3rem);
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .6);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, background-color .15s;
}
.row-arrow .ic { width: 2rem; height: 2rem; }
.row-arrow.l { left: 0; }
.row-arrow.r { right: 0; }
body.mouse .row-viewport:hover .row-arrow { opacity: 1; pointer-events: auto; }
body.mouse .row-viewport:hover .row-arrow.off { opacity: 0; pointer-events: none; }
.row-arrow:hover { background: var(--accent); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(11.6rem, 1fr));
  gap: 1.4rem var(--gap); padding: 1.3rem var(--sx) 1.7rem;
}
.grid .tile-poster { width: auto; }
.grid.removing .tile::after {
  content: "remove"; position: absolute; inset: 0; z-index: 2;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .55); color: rgba(255, 255, 255, .85);
  font-size: .95rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
}
.grid.removing .tile:focus::after { background: rgba(229, 20, 0, .75); color: #fff; }
.grid.removing .tile-label { z-index: 3; }

.empty { margin: .8rem 0 1.6rem; padding: 0 var(--sx); font-size: 1.3rem; font-weight: 300; color: var(--dim); }
.stuff-head { display: flex; align-items: center; gap: .2rem; margin-bottom: .1rem; }
.stuff-head .row-title { margin: 0; padding-right: 1rem; }
.stuff-actions { padding: 1rem var(--sx); }

.error {
  min-height: 100vh; padding: 0 var(--sx);
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.error h1 { margin: 0; font-size: 4rem; font-weight: 300; }
.error p { margin: .8rem 0 2rem; font-size: 1.3rem; color: var(--dim); max-width: 40rem; }

/* ---------- Search ---------- */

.search {
  display: grid; grid-template-columns: 26rem 1fr; gap: 3.2rem;
  padding: calc(var(--bar) + 1rem) var(--sx) 5rem;
}
.search-left { position: sticky; top: calc(var(--bar) + 1rem); align-self: start; }
.search-left .page-title { padding: 0; }
.search-box {
  display: flex; align-items: center; gap: .8rem;
  height: 3.6rem; padding: 0 1rem;
  background: #fff; color: #000;
  border: .18rem solid #fff;
  transition: border-color .12s, box-shadow .12s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 .15rem #fff; }
.search-box .ic { width: 1.5rem; height: 1.5rem; }
.search-box input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none;
  font: inherit; font-size: 1.35rem; color: #000;
}
.search-box input::placeholder { color: #777; }
.search-box input::-webkit-search-cancel-button { display: none; }

.osk { display: grid; grid-template-columns: repeat(6, 1fr); gap: .35rem; margin-top: 1rem; }
/* scoped to the keyboard: .key is too generic to style globally */
.osk .key {
  height: 3.3rem; display: grid; place-items: center;
  font-size: 1.35rem; font-weight: 400; text-transform: lowercase;
  background: rgba(255, 255, 255, .1);
  transition: background-color .1s, transform .25s var(--ease);
}
.osk .key:hover { background: rgba(255, 255, 255, .18); }
.osk .key:focus { background: var(--accent); transform: scale(1.07); z-index: 1; box-shadow: 0 0 0 .14rem #fff; }
.osk .key.wide { grid-column: span 2; font-size: 1rem; gap: .4rem; display: flex; justify-content: center; align-items: center; }
.osk .key .ic { width: 1.4rem; height: 1.4rem; }
.osk .key.pressing { transform: perspective(60rem) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(.965); }

.search-right { min-width: 0; }
.search-status { margin: .4rem 0 1.4rem; font-size: 1.7rem; font-weight: 300; min-height: 2.4rem; overflow-wrap: anywhere; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr)); gap: 1.4rem var(--gap); transition: opacity .2s; }
.results.busy { opacity: .45; transition-delay: .25s; }
.results.again .tile { animation: fadeIn .25s ease backwards; }
.results .tile-wide { width: auto; }
.results .empty { margin: .8rem 0 0; padding: 0; grid-column: 1 / -1; overflow-wrap: anywhere; }
.results > .btn { grid-column: 1 / -1; justify-self: start; }

/* ---------- Watch ---------- */

.page-watch {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  min-height: 0; background: #000;
}
.page-watch > .loading, .page-watch > .error { min-height: 0; flex: 1; }
.watch-bar {
  flex: none; height: 5.2rem;
  display: flex; align-items: center; gap: 1.4rem;
  padding: 0 1.8rem;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.watch-titles { flex: 1; min-width: 0; }
.watch-title {
  margin: 0; font-size: 1.65rem; font-weight: 300; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.watch-sub { font-size: .98rem; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-actions { display: flex; gap: .55rem; flex: none; }
.watch-mark { font-size: 1.7rem; flex: none; opacity: .9; }
/* narrow bar (portrait, or the 10px rem floor): the title needs the wordmark's room */
@media (max-aspect-ratio: 1/1), (max-width: 720px) { .watch-mark { display: none; } }

.watch-body { flex: 1; min-height: 0; display: flex; }
.player-wrap { position: relative; flex: 1; min-width: 0; background: #000; }
/* no panel beside or below (movies, collapsed): fill the space in portrait too */
.watch-body.solo .player-wrap, .watch-body.collapsed .player-wrap { flex: 1; aspect-ratio: auto; }
.player-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.player-wrap::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 0 .25rem var(--accent);
  opacity: 0; transition: opacity .15s;
}
.player-wrap:focus::after { opacity: 1; }
.player-hint {
  position: absolute; left: 50%; bottom: 2.2rem; z-index: 3;
  transform: translate(-50%, .6rem);
  padding: .7rem 1.3rem;
  background: rgba(0, 0, 0, .85); border-left: .3rem solid var(--accent);
  font-size: 1.05rem; white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .4s var(--ease);
}
.player-wrap:focus .player-hint { opacity: 1; transform: translate(-50%, 0); }
.player-wrap:focus .player-hint.gone { opacity: 0; transition-duration: .6s; }
body.mouse .player-hint { display: none; }

.ep-panel {
  flex: none; width: 31rem; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--bg-2); border-left: 1px solid var(--line);
  transition: margin-right .5s var(--ease), opacity .3s ease;
}
.watch-body.collapsed .ep-panel { margin-right: -31rem; opacity: 0; }
.ep-heading {
  padding: 1.3rem 1.6rem 0;
  font-size: .85rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--dim);
}
.season-pivot {
  flex: none; display: flex; gap: .4rem;
  overflow-x: auto; overflow-y: hidden;
  padding: .5rem 1.6rem .6rem 1.1rem;
  scrollbar-width: none;
}
.season-pivot::-webkit-scrollbar { display: none; }
.season-tab {
  flex: none; padding: .1rem .55rem .25rem;
  font-size: 1.55rem; font-weight: 300; white-space: nowrap; color: var(--faint);
  transition: color .2s, background-color .12s;
}
.season-tab:hover { color: var(--dim); }
.season-tab.sel { color: #fff; }
.season-tab:focus { background: var(--accent); color: #fff; }

.ep-list {
  position: relative; flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: .5rem 1.1rem 2rem;
  scrollbar-width: thin;
}
.ep {
  position: relative; width: 100%;
  display: flex; gap: 1rem; align-items: flex-start;
  padding: .65rem; margin-bottom: .3rem;
  transition: background-color .12s, transform .3s var(--ease);
}
.ep:hover { background: rgba(255, 255, 255, .06); }
.ep:focus { background: var(--accent); transform: scale(1.02); }
.ep.playing { background: rgba(255, 255, 255, .09); box-shadow: inset .3rem 0 0 var(--accent); }
.ep.playing:focus { background: var(--accent); box-shadow: inset .3rem 0 0 #fff; }
/* dim the content, not the button, so the focus fill stays solid */
.ep.future > * { opacity: .55; }
.ep.future:focus > * { opacity: 1; }
.ep-thumb { position: relative; flex: none; width: 10.4rem; aspect-ratio: 16 / 9; background: #262626; overflow: hidden; }
/* positioned so the still paints over the .ep-n placeholder */
.ep-thumb img { position: relative; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.ep-thumb img.ok { opacity: 1; }
.ep-thumb .ep-n {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 2rem; font-weight: 300; color: var(--faint);
}
.ep-info { min-width: 0; flex: 1; }
.ep-num { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.ep-badge { display: none; margin-left: .5rem; color: var(--accent-hi); }
.ep.playing .ep-badge { display: inline; }
.ep:focus .ep-badge { color: #fff; }
.ep-name {
  margin-top: .1rem; font-size: 1.08rem; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep-desc {
  margin-top: .25rem; font-size: .84rem; line-height: 1.4; color: var(--dim);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep:focus .ep-num, .ep:focus .ep-desc { color: rgba(255, 255, 255, .88); }
.ep-list .empty { padding: 0 .5rem; }

/* ---------- Toast (Windows 8 style, slides in from the right) ---------- */

/* below the top bar / watch bar so it never hides the button that raised it */
#toast {
  position: fixed; top: calc(var(--bar) + .6rem); right: 0; z-index: 90;
  min-width: 22rem; max-width: min(34rem, 100vw - 2rem);
  padding: 1rem 2.2rem 1.1rem 1.6rem;
  background: var(--accent);
  box-shadow: 0 .6rem 2rem rgba(0, 0, 0, .5);
  transform: translateX(calc(100% + 3rem));
  transition: transform .5s var(--ease);
  pointer-events: none;
}
body.watching #toast { top: 6rem; }
#toast.show { transform: none; }
#toast.bump { animation: toastBump .35s var(--ease); }
@keyframes toastBump { from { transform: translateX(1.2rem); } }
#toast strong { display: block; font-size: 1.1rem; font-weight: 600; overflow-wrap: anywhere; }
#toast span { display: block; font-size: .95rem; opacity: .9; margin-top: .1rem; overflow-wrap: anywhere; }

/* ---------- Small / portrait screens ---------- */

@media (max-aspect-ratio: 1/1) {
  html { font-size: max(9px, min(2.4vw, 1.6vh)); }
  :root { --sx: 1.6rem; --bar: 4.2rem; }
  #topbar { gap: 1.2rem; }
  .logo { font-size: 1.9rem; }
  .pivots { overflow-x: auto; scrollbar-width: none; }
  .pivot { font-size: 1.35rem; padding: .1rem .5rem .4rem; }
  .clock { display: none; }
  .hero { height: 72vh; }
  .hero-content { bottom: 12rem; }
  .hero-title { font-size: 3.4rem; }
  .hero-dots { display: none; }
  .search { grid-template-columns: 1fr; }
  .search-left { position: static; }
  .watch-body { flex-direction: column; }
  .player-wrap { flex: none; aspect-ratio: 16 / 9; }
  .ep-panel { width: auto; flex: 1; border-left: 0; }
  .watch-body.collapsed .ep-panel { margin-right: 0; display: none; }
  .watch-actions .btn span:not(.ic) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  /* infinite loops at .01ms just strobe; the progress ring becomes still dots that pulse */
  .ring i { animation: none !important; opacity: 1; }
  .ring i:nth-child(2) { transform: rotate(72deg); }
  .ring i:nth-child(3) { transform: rotate(144deg); }
  .ring i:nth-child(4) { transform: rotate(216deg); }
  .ring i:nth-child(5) { transform: rotate(288deg); }
  .ring i::after { animation: ringPulse 1.1s ease-in-out infinite alternate !important; }
  @keyframes ringPulse { from { opacity: .25; } }
}
