/* ==========================================================================
   Cinephile — liquid glass
   Surfaces are panes of glass over what is on screen: they blur and brighten what is
   behind them, catch light on their rims, and the lens of a control flows to where it is
   pressed. Everything sits on the ambient colours of the title on screen (.ambient).
   ========================================================================== */

:root {
  --bg: #07070b;
  --text: #f5f5f7;
  --text-2: rgba(245, 245, 247, 0.72);
  --text-3: rgba(245, 245, 247, 0.5);
  --accent: #8ea2ff;
  --star: #ffd25e;
  --danger: #ff6b6b;

  --glass-fill: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.05) 55%, rgba(255, 255, 255, 0.08));
  --glass-fill-strong: linear-gradient(135deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.1) 60%, rgba(255, 255, 255, 0.14));
  --glass-blur: blur(24px) saturate(185%) brightness(1.08);
  --glass-edge: rgba(255, 255, 255, 0.16);
  --glass-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 1px rgba(255, 255, 255, 0.08),
    inset 0 0 22px rgba(255, 255, 255, 0.05),
    0 12px 32px rgba(0, 0, 0, 0.32);

  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --gutter: clamp(16px, 4vw, 56px);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.85); outline-offset: 3px; }
.view:focus { outline: none; }

/* --- The material ------------------------------------------------------------------------ */

.glass {
  position: relative;
  isolation: isolate;
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--glass-shadow);
}
/* The rim catches the light at the top left and, fainter, at the bottom right */
.glass::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 32%, rgba(255, 255, 255, 0) 64%, rgba(255, 255, 255, 0.3));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}
/* A sheen across the upper half, as on a curved pane */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 70% at 30% -10%, rgba(255, 255, 255, 0.16), transparent 60%);
  pointer-events: none;
  z-index: -1;
}

.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.icon.fill { fill: currentColor; stroke: none; }

/* --- Ambient background ------------------------------------------------------------------ */

.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); }
.ambient-layer {
  position: absolute;
  inset: -12%;
  background-size: cover;
  background-position: center 30%;
  filter: blur(70px) saturate(1.7) brightness(0.6);
  transform: scale(1.15);
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.ambient-layer.on { opacity: 1; }
.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, transparent 0%, rgba(7, 7, 11, 0.35) 55%, rgba(7, 7, 11, 0.85) 100%),
    linear-gradient(180deg, rgba(7, 7, 11, 0) 40%, rgba(7, 7, 11, 0.7) 100%);
}

/* --- Top bar and tab bar ----------------------------------------------------------------- */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--gutter);
  pointer-events: none;
  transition: transform 0.4s var(--ease), opacity 0.3s;
}
.topbar > * { pointer-events: auto; }
/* Once the page moves under it, the bar gets a shade of its own */
.topbar::before { content: ""; position: absolute; inset: 0 0 -30px; z-index: -1; background: linear-gradient(180deg, rgba(7, 7, 11, 0.78), rgba(7, 7, 11, 0)); opacity: 0; transition: opacity 0.35s; pointer-events: none; }
.topbar.scrolled::before { opacity: 1; }
.topbar.hide { transform: translateY(-120%); opacity: 0; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; }
.brand-mark svg { width: 26px; height: 26px; }
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4); }

.tabbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 999px;
}
.tab {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.25s, transform 0.35s var(--spring);
}
.tab .icon { width: 17px; height: 17px; }
.tab:hover { color: var(--text); }
.tab:active { transform: scale(0.94); }
.tab.active { color: #111; }
.tab-icon { padding: 0 11px; }
.tab-sep { width: 1px; height: 20px; margin: 0 6px; background: rgba(255, 255, 255, 0.18); }
/* The lens: a drop of brighter glass that flows to the active tab */
.tab-lens {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 0;
  height: 40px;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #e9ebf3);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 6px rgba(0, 0, 0, 0.08), 0 6px 18px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transition: transform 0.55s var(--spring), width 0.55s var(--spring), opacity 0.25s;
}
.tab-lens.on { opacity: 1; }

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

.view { min-height: 100vh; }
.page { padding: 104px var(--gutter) 40px; animation: page-in 0.6s var(--ease); }
.page-wide { padding-top: 0; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.section-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 600; color: var(--text-2); transition: color 0.2s, gap 0.3s var(--spring); }
.section-link:hover { color: var(--text); gap: 8px; }
.section-link .icon { width: 16px; height: 16px; }
.page-title { margin: 0; font-size: clamp(34px, 5vw, 56px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.muted { color: var(--text-2); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 50px;
  padding: 0 26px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 16px;
  white-space: nowrap;
  transition: transform 0.35s var(--spring), background 0.2s, box-shadow 0.25s;
}
.btn:active { transform: scale(0.95); }
.btn .icon { width: 19px; height: 19px; }
.btn-primary {
  color: #0b0b0f;
  background: linear-gradient(180deg, #ffffff, #e7e9f1);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 8px rgba(0, 0, 0, 0.08), 0 10px 28px rgba(0, 0, 0, 0.35);
}
.btn-primary:hover { transform: translateY(-1px) scale(1.02); }
.btn-glass { color: var(--text); }
.btn-glass:hover { background: var(--glass-fill-strong); }
.btn-small { height: 40px; padding: 0 18px; font-size: 14px; }
.btn-round { width: 50px; padding: 0; }
.btn-round.btn-small { width: 40px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.pill-group { display: inline-flex; align-items: center; height: 50px; border-radius: 999px; padding: 0 4px; }
.pill-group > button, .pill-group > a { display: grid; place-items: center; width: 46px; height: 42px; border-radius: 999px; color: var(--text); transition: background 0.2s, transform 0.35s var(--spring); }
.pill-group > button:hover, .pill-group > a:hover { background: rgba(255, 255, 255, 0.12); }
.pill-group > button:active, .pill-group > a:active { transform: scale(0.9); }
.pill-group > .sep { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.2); }

/* --- Hero --------------------------------------------------------------------------------- */

.hero {
  position: relative;
  min-height: min(88vh, 860px);
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 48px;
  padding: 120px var(--gutter) 64px;
}
.hero-copy { max-width: 620px; animation: hero-in 0.8s var(--ease); }
.hero-kicker { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 14px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.hero-title { margin: 18px 0 14px; font-size: clamp(38px, 6vw, 76px); font-weight: 800; letter-spacing: -0.045em; line-height: 0.98; text-shadow: 0 6px 40px rgba(0, 0, 0, 0.45); }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; color: var(--text-2); font-size: 14px; font-weight: 600; }
.meta > span { display: inline-flex; align-items: center; gap: 6px; }
.meta .icon { width: 16px; height: 16px; }
.meta .star { color: var(--star); }
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 7px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; border: 1px solid rgba(255, 255, 255, 0.3); color: var(--text); }
.hero-plot { margin: 18px 0 30px; max-width: 560px; font-size: 17px; line-height: 1.55; color: rgba(245, 245, 247, 0.86); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.hero-art { justify-self: center; position: relative; width: min(100%, 360px); animation: hero-art-in 0.9s var(--ease); }
.hero-art .frame { padding: 10px; border-radius: 30px; transform: perspective(1200px) rotateY(-9deg) rotateX(3deg); transition: transform 0.8s var(--ease); }
.hero-art:hover .frame { transform: perspective(1200px) rotateY(-3deg) rotateX(1deg); }
.hero-art img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
@keyframes hero-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes hero-art-in { from { opacity: 0; transform: translateY(24px) scale(0.96); } to { opacity: 1; transform: none; } }

.hero-dots { position: absolute; right: var(--gutter); bottom: 40px; display: flex; gap: 6px; padding: 8px 10px; border-radius: 999px; }
.hero-dots button { width: 7px; height: 7px; border-radius: 999px; background: rgba(255, 255, 255, 0.35); transition: width 0.5s var(--spring), background 0.3s; }
.hero-dots button.on { width: 26px; background: #fff; }

/* --- Rows and cards ----------------------------------------------------------------------- */

.row { position: relative; }
.row-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(140px, 15vw, 196px);
  gap: 18px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  margin: -12px calc(var(--gutter) * -1);
  padding: 12px var(--gutter) 18px;
  scroll-padding: var(--gutter);
}
.row-track::-webkit-scrollbar { display: none; }
.row-arrow {
  position: absolute;
  top: calc(50% - 40px);
  z-index: 5;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.25s, transform 0.35s var(--spring);
}
.row-arrow.prev { left: calc(var(--gutter) * -0.5); }
.row-arrow.next { right: calc(var(--gutter) * -0.5); }
.row:hover .row-arrow:not([disabled]) { opacity: 1; }
.row-arrow:active { transform: scale(0.9); }
.row-arrow[disabled] { opacity: 0 !important; pointer-events: none; }

.card { display: block; scroll-snap-align: start; min-width: 0; }
.card-art {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.5s var(--spring), box-shadow 0.4s;
}
.card-art img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease), opacity 0.4s; }
.card-art img.loading { opacity: 0; }
.card-art::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25); background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), transparent 35%); pointer-events: none; }
.card:hover .card-art { transform: translateY(-6px) scale(1.03); box-shadow: 0 22px 44px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.14); }
.card:hover .card-art img { transform: scale(1.05); }
.card-play {
  position: absolute;
  left: 50%; top: 50%;
  display: grid;
  place-items: center;
  width: 54px; height: 54px;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.7);
  transition: opacity 0.3s, transform 0.45s var(--spring);
}
.card:hover .card-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.card-rating { position: absolute; top: 10px; left: 10px; z-index: 2; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.card-rating .icon { width: 12px; height: 12px; color: var(--star); }
.card-progress { position: absolute; left: 10px; right: 10px; bottom: 10px; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.card-progress > span { display: block; height: 100%; background: #fff; border-radius: inherit; }
.card-title { margin: 12px 2px 2px; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { margin: 0 2px; font-size: 12.5px; color: var(--text-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-note { margin: 3px 2px 0; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-note b { color: #9be7a8; font-weight: 700; }
.card-remove { position: absolute; top: 9px; right: 9px; z-index: 3; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; opacity: 0; transform: scale(0.8); transition: opacity 0.2s, transform 0.3s var(--spring); }
.card-remove .icon { width: 15px; height: 15px; }
.card:hover .card-remove, .card-remove:focus-visible { opacity: 1; transform: none; }
@media (hover: none) { .card-remove { opacity: 1; transform: none; } }
.section-sub { margin: 3px 0 0; font-size: 13.5px; color: var(--text-3); }
.section-title .count { font-size: 15px; font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 15vw, 190px), 1fr)); gap: 30px 20px; }

/* Genres */
.genres { grid-auto-columns: clamp(150px, 15vw, 190px); }
.genre-tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 112px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  overflow: hidden;
  scroll-snap-align: start;
  transition: transform 0.5s var(--spring);
}
.genre-tile:hover { transform: translateY(-4px) scale(1.03); }
.genre-tile .glyph { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--tint); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 16px color-mix(in srgb, var(--tint) 45%, transparent); color: #fff; }
.genre-tile .glyph .icon { width: 19px; height: 19px; }
.genre-tile strong { font-size: 15px; font-weight: 700; }
.genre-tile::after { background: radial-gradient(90% 90% at 100% 100%, color-mix(in srgb, var(--tint) 40%, transparent), transparent 70%), radial-gradient(120% 70% at 30% -10%, rgba(255, 255, 255, 0.16), transparent 60%); }

/* Placeholders while a list loads */
.skeleton { border-radius: var(--radius-md); background: linear-gradient(100deg, rgba(255, 255, 255, 0.05) 30%, rgba(255, 255, 255, 0.11) 50%, rgba(255, 255, 255, 0.05) 70%); background-size: 300% 100%; animation: shimmer 1.6s linear infinite; }
.skeleton.poster { aspect-ratio: 2 / 3; }
.skeleton.line { height: 12px; margin-top: 12px; border-radius: 6px; width: 70%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

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

.browse-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 28px; }
.segmented { display: inline-flex; position: relative; padding: 4px; border-radius: 999px; }
.segmented button { position: relative; z-index: 2; height: 38px; padding: 0 18px; border-radius: 999px; font-size: 14px; font-weight: 650; color: var(--text-2); transition: color 0.25s; }
.segmented button.on { color: #0b0b0f; }
.segmented .seg-lens { position: absolute; z-index: 1; top: 4px; left: 0; height: 38px; border-radius: 999px; background: linear-gradient(180deg, #fff, #e7e9f1); box-shadow: inset 0 1px 0 #fff, 0 4px 14px rgba(0, 0, 0, 0.25); transition: transform 0.55s var(--spring), width 0.55s var(--spring); }

.filter-dock {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border-radius: 999px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  animation: dock-in 0.7s var(--spring);
}
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 30px) scale(0.95); } to { opacity: 1; transform: translateX(-50%); } }
.filter-dock .dock-label { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--text-2); }
.select {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  transition: background 0.2s;
}
.select:hover { background: rgba(255, 255, 255, 0.14); }
.select select { appearance: none; -webkit-appearance: none; height: 100%; padding: 0 36px 0 16px; border: 0; background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; }
.select select:focus { outline: none; }
.select select option { background: #1b1c24; color: var(--text); }
.select .icon { position: absolute; right: 12px; width: 15px; height: 15px; pointer-events: none; color: var(--text-2); }
.to-top { position: fixed; right: var(--gutter); bottom: 28px; z-index: 40; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; opacity: 0; transform: translateY(16px); transition: opacity 0.3s, transform 0.45s var(--spring); }
.to-top.on { opacity: 1; transform: none; }

.empty { display: grid; justify-items: center; gap: 10px; padding: 70px 20px; text-align: center; color: var(--text-2); }
.empty .icon { width: 34px; height: 34px; color: var(--text-3); }
.empty h3 { margin: 6px 0 0; color: var(--text); font-size: 20px; }
.empty p { margin: 0; max-width: 420px; }

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

.title-hero {
  display: grid;
  grid-template-columns: minmax(220px, 330px) minmax(0, 1fr) minmax(220px, 300px);
  gap: 44px;
  align-items: start;
  padding: 120px var(--gutter) 10px;
}
.title-poster { padding: 9px; border-radius: 30px; animation: hero-art-in 0.8s var(--ease); }
.title-poster img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 22px; }
.title-main { min-width: 0; animation: hero-in 0.7s var(--ease); }
.title-name { margin: 6px 0 14px; font-size: clamp(34px, 5vw, 64px); font-weight: 800; letter-spacing: -0.04em; line-height: 1.02; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; height: 30px; padding: 0 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text); }
.title-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 26px 0; }
.title-plot { margin: 0; max-width: 680px; font-size: 16.5px; line-height: 1.65; color: rgba(245, 245, 247, 0.86); }
.cast { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.person { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 5px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.person .avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 13px; font-weight: 800; color: #fff; background: var(--tint, #5b6bd8); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.facts { padding: 6px 20px; border-radius: var(--radius-md); animation: hero-in 0.9s var(--ease); }
.fact { display: flex; justify-content: space-between; gap: 12px; padding: 13px 0; font-size: 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
.fact:last-child { border-bottom: 0; }
.fact span { color: var(--text-3); }
.fact strong { font-weight: 650; text-align: right; }

.episodes-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.episodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.episode {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 16px;
  padding: 10px;
  border-radius: var(--radius-md);
  text-align: left;
  transition: transform 0.45s var(--spring), background 0.2s;
}
.episode:hover { transform: translateY(-3px); background: var(--glass-fill-strong); }
.episode.unaired { opacity: 0.55; pointer-events: none; }
.episode-still { position: relative; aspect-ratio: 16 / 9; border-radius: 13px; overflow: hidden; background: rgba(255, 255, 255, 0.07); }
.episode-still img { width: 100%; height: 100%; object-fit: cover; }
.episode-still .card-progress { left: 8px; right: 8px; bottom: 8px; height: 3px; }
.episode-still .play-dot { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; background: rgba(0, 0, 0, 0.25); transition: opacity 0.25s; }
.episode:hover .play-dot { opacity: 1; }
.episode-body { min-width: 0; padding: 2px 4px 2px 0; }
.episode-num { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: 0.04em; text-transform: uppercase; }
.episode-name { margin: 3px 0 4px; font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.episode-plot { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.episode-meta { margin-top: 6px; font-size: 12px; color: var(--text-3); font-weight: 600; display: flex; gap: 10px; }
.episode .watched { color: #9be7a8; }

/* IMDb ratings grid: seasons across, episodes down. The panel hugs the grid; a long show
   scrolls inside it, with the season and episode labels pinned. */
.ratings-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.ratings-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rating-swatch { width: 11px; height: 11px; border-radius: 4px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35); }
.ratings-panel { width: fit-content; max-width: 100%; padding: 6px; border-radius: var(--radius-lg); }
.ratings-scroll { max-height: min(640px, 70vh); overflow: auto; border-radius: 22px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent; }
.ratings-table {
  --label-bg: rgba(16, 16, 22, 0.94);
  display: grid;
  grid-template-columns: 46px repeat(var(--seasons), minmax(50px, 66px));
  gap: 6px;
  width: max-content;
  padding: 0 10px 10px 0;
}
.ratings-label {
  position: sticky;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--label-bg);
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 700;
}
/* The shadows cover the gap next to a pinned label, so cells scrolling past do not show */
.ratings-label.season { top: 0; height: 38px; box-shadow: 0 6px 0 var(--label-bg); transition: color 0.25s; }
.ratings-label.season.shown { color: var(--text); }
.ratings-label.episode { left: 0; box-shadow: 6px 0 0 var(--label-bg); }
.ratings-label.corner { top: 0; left: 0; z-index: 2; box-shadow: 6px 0 0 var(--label-bg), 0 6px 0 var(--label-bg), 6px 6px 0 var(--label-bg); }
.rating-cell {
  display: grid;
  place-items: center;
  height: 34px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 2px rgba(0, 0, 0, 0.18);
  transition: transform 0.35s var(--spring), box-shadow 0.2s;
}
a.rating-cell:hover, a.rating-cell:focus-visible { outline: none; transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 8px 18px rgba(0, 0, 0, 0.4); position: relative; z-index: 0; }
/* Seen to the end, and the episode the Play button resumes */
.rating-cell.seen { opacity: 0.55; }
.rating-cell.next { box-shadow: 0 0 0 2px rgba(16, 16, 22, 0.94), 0 0 0 4px #fff; }
.r9 { background: #1f7a45; color: #fff; }
.r8 { background: #34b56a; color: #08140c; }
.r7 { background: #f2c94c; color: #1a1405; }
.r6 { background: #ee8a2a; color: #1a0e04; }
.r5 { background: #d6483f; color: #fff; }
.r4 { background: #7d3e96; color: #fff; }
.rating-cell.unrated { background: rgba(255, 255, 255, 0.08); color: var(--text-3); }
.rating-cell.unaired { border: 1px dashed rgba(255, 255, 255, 0.2); box-shadow: none; }

/* --- Sign in and account ------------------------------------------------------------------ */

.auth { display: grid; place-items: center; min-height: 100vh; padding: 110px 16px 60px; }
.auth-card { width: min(100%, 420px); padding: 34px 30px 30px; border-radius: 32px; animation: hero-art-in 0.7s var(--ease); }
.auth-card h1 { margin: 0 0 6px; font-size: 28px; letter-spacing: -0.03em; }
.auth-card .segmented { display: flex; margin: 22px 0 18px; }
.auth-card .segmented button { flex: 1; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.input {
  height: 50px;
  padding: 0 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25);
  font-size: 15px;
  transition: border-color 0.2s, background 0.2s;
}
.input:focus { outline: none; border-color: rgba(255, 255, 255, 0.45); background: rgba(255, 255, 255, 0.1); }
.form-error { min-height: 20px; margin: 4px 0 10px; color: var(--danger); font-size: 13.5px; font-weight: 600; }
.auth-card .btn { width: 100%; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; margin-top: 28px; }
.panel { padding: 24px; border-radius: var(--radius-lg); }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.profile { display: flex; align-items: center; gap: 16px; }
.profile .avatar { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; font-size: 26px; font-weight: 800; background: linear-gradient(135deg, #7d8cff, #c86bff); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), inset 0 -10px 20px rgba(0, 0, 0, 0.15); transition: background 0.3s; }
.profile-panel { max-width: 640px; }
.account-head { margin: 42px 0 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-head h2 { margin: 0; }
.panel .muted { margin: 0 0 14px; font-size: 14px; }
.panel .small-note { margin: 12px 0 0; font-size: 12.5px; color: var(--text-3); }
.stat-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; height: 120px; }
.stat-bar { position: relative; min-width: 0; }
.stat-bar span { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0.55)); }
.stat-bar.none span { background: rgba(255, 255, 255, 0.12); }
.stat-axis { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.panel .stat-facts { margin: 14px 0 0; }
.taste-bars { display: grid; gap: 9px; }
.taste-bar { display: grid; grid-template-columns: minmax(70px, 120px) minmax(0, 1fr) 40px; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600; }
.taste-bar .track { height: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.taste-bar .track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #fff); }
.taste-bar .pct { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.mini-head { margin: 18px 0 9px; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.split { display: flex; height: 10px; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, 0.1); }
.split .movies { background: #fff; }
.split .shows { background: var(--accent); }
.split-legend { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.spinner.small { width: 28px; height: 28px; border-width: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); cursor: pointer; }
.switch-row:first-of-type { border-top: 0; padding-top: 0; }
.switch-row strong { display: block; font-size: 14.5px; }
.switch-row small { display: block; margin-top: 2px; font-size: 13px; color: var(--text-3); }
input.switch { position: relative; flex: none; width: 50px; height: 30px; margin: 0; border-radius: 30px; background: rgba(255, 255, 255, 0.18); -webkit-appearance: none; appearance: none; cursor: pointer; transition: background 0.25s; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); transition: transform 0.35s var(--spring); }
input.switch:checked { background: #34c759; }
input.switch:checked::after { transform: translateX(20px); }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 11px; padding: 4px 0; }
.avatar-picker button { width: 34px; height: 34px; border-radius: 50%; background: var(--c); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); transition: transform 0.3s var(--spring); }
.avatar-picker button:hover { transform: scale(1.1); }
.avatar-picker button.on { outline: 2px solid #fff; outline-offset: 3px; }
.check-row { display: flex; align-items: center; gap: 10px; margin: 2px 0 6px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check-row input { width: 17px; height: 17px; margin: 0; accent-color: #fff; }
.btn-danger { color: #ffd0d0; background: rgba(255, 107, 107, 0.2); border: 1px solid rgba(255, 107, 107, 0.4); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.3); }
.danger-panel h2 { color: #ffb4b4; }

/* --- Search ------------------------------------------------------------------------------- */

.search-sheet { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: center; padding: 12vh 16px 16px; }
.search-backdrop { position: absolute; inset: 0; background: rgba(5, 5, 8, 0.45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fade-in 0.25s; }
.search-panel { position: relative; width: min(100%, 680px); max-height: 72vh; display: flex; flex-direction: column; border-radius: 30px; overflow: hidden; animation: sheet-in 0.5s var(--spring); }
@keyframes sheet-in { from { opacity: 0; transform: translateY(-14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.search-field { display: flex; align-items: center; gap: 12px; height: 66px; padding: 0 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.1); }
.search-field .icon { width: 22px; height: 22px; color: var(--text-2); }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; font-size: 20px; font-weight: 500; }
.search-field input:focus { outline: none; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field kbd { padding: 3px 8px; border-radius: 7px; font: 600 11px var(--font); color: var(--text-3); border: 1px solid rgba(255, 255, 255, 0.18); }
.search-results { overflow-y: auto; padding: 8px; }
.search-results:empty { display: none; }
.suggest { display: flex; align-items: center; gap: 14px; width: 100%; padding: 8px 12px; border-radius: 16px; text-align: left; transition: background 0.15s; }
.suggest:hover, .suggest.on { background: rgba(255, 255, 255, 0.1); }
.suggest img, .suggest .ph { width: 40px; height: 60px; flex: none; border-radius: 8px; object-fit: cover; background: rgba(255, 255, 255, 0.08); }
.suggest strong { display: block; font-size: 15px; }
.suggest small { color: var(--text-3); font-size: 13px; }
.suggest-all { justify-content: center; height: 46px; font-weight: 650; color: var(--text-2); }

/* --- Toasts ------------------------------------------------------------------------------- */

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 120; display: grid; gap: 10px; transform: translateX(-50%); pointer-events: none; }
.toast { padding: 13px 20px; border-radius: 999px; font-size: 14px; font-weight: 600; animation: toast-in 0.5s var(--spring); white-space: nowrap; }
.toast.out { animation: toast-out 0.3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.95); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* --- Footer ------------------------------------------------------------------------------- */

.footer { padding: 70px var(--gutter) 40px; }
.footer-inner { display: grid; grid-template-columns: 1fr auto; gap: 22px; padding-top: 28px; border-top: 1px solid rgba(255, 255, 255, 0.08); color: var(--text-3); font-size: 13px; }
.footer-brand p { margin: 6px 0 0; max-width: 420px; }
.footer-brand .brand-name { color: var(--text); font-size: 17px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.footer-links a:hover { color: var(--text); }
.footer-copy { margin: 0; grid-column: 1 / -1; }
body.watching .footer, body.watching .topbar { display: none; }

/* --- Player ------------------------------------------------------------------------------- */

.player { position: fixed; inset: 0; z-index: 70; background: #000; overflow: hidden; }
.player video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.player.idle { cursor: none; }
.player-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px var(--gutter) 60px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent);
  transition: opacity 0.4s;
}
.player-heading { min-width: 0; }
.player-heading strong { display: block; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-heading small { color: var(--text-2); font-size: 13.5px; font-weight: 600; }
.player-bottom { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px var(--gutter) 22px; background: linear-gradient(0deg, rgba(0, 0, 0, 0.7), transparent); transition: opacity 0.4s, transform 0.5s var(--ease); }
.player.idle .player-top, .player.idle .player-bottom { opacity: 0; }
.controls { display: flex; align-items: center; gap: 6px; margin-top: 12px; padding: 7px 10px; border-radius: 999px; }
.controls .grow { flex: 1; }
.ctl { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; transition: background 0.2s, transform 0.35s var(--spring); }
.ctl:hover { background: rgba(255, 255, 255, 0.14); }
.ctl:active { transform: scale(0.88); }
.ctl .icon { width: 22px; height: 22px; }
.ctl.big .icon { width: 26px; height: 26px; }
.ctl-text { width: auto; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 700; gap: 6px; display: inline-flex; }
.time { padding: 0 10px; font-size: 13.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }
.volume { display: flex; align-items: center; }
.volume input { width: 0; opacity: 0; transition: width 0.4s var(--spring), opacity 0.3s; accent-color: #fff; }
.volume:hover input, .volume input:focus { width: 90px; opacity: 1; margin-right: 6px; }

.seek { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.seek-rail { position: relative; width: 100%; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.22); overflow: hidden; transition: height 0.25s var(--spring); }
.seek:hover .seek-rail { height: 8px; }
.seek-buffer, .seek-played { position: absolute; top: 0; left: 0; bottom: 0; border-radius: inherit; }
.seek-buffer { background: rgba(255, 255, 255, 0.35); }
.seek-played { background: #fff; }
.seek-thumb { position: absolute; top: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); transform: translateY(-50%) scale(0); transition: transform 0.3s var(--spring); }
.seek:hover .seek-thumb, .seek.dragging .seek-thumb { transform: translateY(-50%) scale(1); }
.seek-tip { position: absolute; bottom: 26px; display: grid; justify-items: center; gap: 6px; padding: 5px; border-radius: 14px; font-size: 12.5px; font-weight: 700; transform: translateX(-50%); opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.seek.previewing .seek-tip { opacity: 1; }
.seek-time { padding: 0 6px 1px; font-variant-numeric: tabular-nums; }
.seek-frame { position: relative; width: 184px; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: rgba(0, 0, 0, 0.55); }
.seek-frame img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.15s; }
.seek-frame.has-image img { opacity: 1; }
.seek-frame.loading img { opacity: 0.55; }

.player-center { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.status { display: grid; justify-items: center; gap: 16px; padding: 26px 34px; border-radius: 28px; text-align: center; pointer-events: auto; max-width: min(90vw, 440px); animation: hero-art-in 0.5s var(--ease); }
.status p { margin: 0; color: var(--text-2); font-weight: 600; }
.status h3 { margin: 0; font-size: 20px; }
.status .row-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.spinner { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.18); border-top-color: #fff; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.big-play { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; pointer-events: auto; transition: transform 0.4s var(--spring); }
.big-play:hover { transform: scale(1.06); }
.big-play .icon { width: 34px; height: 34px; margin-left: 4px; }

/* A title not made in English: its English audio or dub, offered once */
.dub-offer { position: absolute; left: var(--gutter); bottom: 120px; z-index: 3; max-width: min(360px, calc(100% - 2 * var(--gutter))); padding: 14px 16px; border-radius: 22px; animation: sheet-in 0.4s var(--spring); }
.dub-offer[hidden] { display: none; }
.dub-offer p { margin: 0 0 10px; font-weight: 600; font-size: 14.5px; }
.dub-offer .row-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.dub-offer .btn .icon { width: 17px; height: 17px; margin-right: 6px; }
.player.mini .dub-offer { display: none; }
.popover { position: absolute; right: var(--gutter); bottom: 110px; min-width: 220px; padding: 8px; border-radius: 22px; animation: sheet-in 0.4s var(--spring); }
.popover h4 { margin: 6px 12px 8px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; }
.popover button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 42px; padding: 7px 14px; border-radius: 13px; font-weight: 600; font-size: 14px; text-align: left; }
.popover button small { display: block; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.popover button:hover { background: rgba(255, 255, 255, 0.1); }
.popover button .icon { width: 16px; height: 16px; }
.side-panel { position: absolute; top: 16px; right: 16px; bottom: 16px; width: min(400px, calc(100vw - 32px)); display: flex; flex-direction: column; border-radius: 28px; overflow: hidden; animation: panel-in 0.5s var(--spring); }
@keyframes panel-in { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
.side-panel header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 14px 10px 20px; }
.side-panel header h3 { margin: 0; font-size: 17px; }
.side-panel .list { overflow-y: auto; padding: 0 10px 12px; display: grid; gap: 6px; }
.side-panel .episode { grid-template-columns: 120px minmax(0, 1fr); background: transparent; border: 0; box-shadow: none; }
.side-panel .episode::before, .side-panel .episode::after { display: none; }
.side-panel .episode.current { background: rgba(255, 255, 255, 0.12); }

.player-top .grow { flex: 1; }
.ratings-side { width: min(560px, calc(100vw - 32px)); }
.ratings-body { display: grid; gap: 14px; align-content: start; min-height: 0; overflow: auto; padding: 0 16px 16px; }
.ratings-side .ratings-scroll { max-height: none; overflow: visible; }
.ctl.on { background: #fff; color: #0b0b0f; }
.ctl.on:hover { background: #e9ebf3; }

/* Subtitles: the line sits over the picture, above the controls (lower once they step aside) */
.subtitle-line { position: absolute; left: 50%; bottom: 132px; z-index: 1; width: max-content; max-width: 86%; transform: translateX(-50%); text-align: center; pointer-events: none; transition: bottom 0.4s var(--ease); }
.subtitle-line span { display: inline; padding: 0.08em 0.45em; border-radius: 0.3em; background: rgba(0, 0, 0, 0.62); color: #fff; font-weight: 600; line-height: 1.42; white-space: pre-line; -webkit-box-decoration-break: clone; box-decoration-break: clone; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }
.player.idle .subtitle-line { bottom: 48px; }
.popover-subs { display: flex; flex-direction: column; width: min(320px, calc(100vw - 32px)); max-height: min(560px, calc(100% - 210px)); }
.sub-langs { min-height: 0; overflow-y: auto; }
.sub-timing { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px; }
.sub-timing > span:first-child { flex: 1; font-size: 13px; font-weight: 600; color: var(--text-2); }
.popover .sub-timing button { width: auto; min-height: 32px; height: 32px; padding: 0 11px; justify-content: center; border-radius: 10px; background: rgba(255, 255, 255, 0.09); }
.popover .sub-timing .sub-auto.on { background: #fff; color: #0b0b0f; }
.sub-delay { min-width: 56px; text-align: center; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-note { margin: 4px 14px 8px; font-size: 12.5px; color: var(--text-3); }
.sub-note.matched { color: #9be7a8; }

/* Thumbs, in the player and on a title's page */
.rate-group > button.on { background: #fff; color: #0b0b0f; }
.rate-group > button.on:hover { background: #e9ebf3; }
.player-top .rate-group { height: 46px; }
.player-top .rate-group > button { width: 40px; height: 38px; }
.player-top .rate-group .icon { width: 19px; height: 19px; }

/* Report a problem */
.report-sheet { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; padding: 16px; }
.report-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade-in 0.25s; }
.report-card { position: relative; width: min(100%, 460px); max-height: calc(100% - 20px); overflow-y: auto; padding: 18px 22px 22px; border-radius: 28px; animation: sheet-in 0.45s var(--spring); }
.report-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-card h3 { margin: 0; font-size: 19px; }
.report-card > p { margin: 4px 0 14px; }
.report-kinds { display: grid; gap: 7px; margin-bottom: 12px; }
.report-kind { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.2s; }
.report-kind:hover { background: rgba(255, 255, 255, 0.1); }
.report-kind:has(input:checked) { background: rgba(255, 255, 255, 0.18); }
.report-kind input { accent-color: #fff; width: 17px; height: 17px; margin: 0; }
.report-card textarea.input { width: 100%; height: auto; min-height: 84px; padding: 12px 16px; resize: vertical; font: inherit; }
.report-card .row-btns { display: flex; justify-content: flex-end; gap: 10px; }

/* What the server writes into a page before the app draws it (see site_seo.js) */
.seo-page { color: var(--text-2); }
.seo-page h1 { margin: 6px 0 14px; color: var(--text); font-size: clamp(28px, 4vw, 44px); letter-spacing: -0.03em; line-height: 1.1; }
.seo-page h2 { margin: 28px 0 10px; color: var(--text); font-size: 20px; }
.seo-page nav { font-size: 13px; color: var(--text-3); }
.seo-page img { width: 200px; height: auto; margin: 6px 0 14px; border-radius: 18px; }
.seo-page p { max-width: 720px; }
.seo-page ul, .seo-page ol { columns: 3 220px; column-gap: 28px; padding-left: 20px; line-height: 1.9; }
.seo-page a { color: var(--text); }

/* A movie's page: the player at the top, its details underneath */
.title-stage { padding: 34px var(--gutter) 0; }
.player.inline {
  position: relative;
  inset: auto;
  z-index: 1;
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 28px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12);
  animation: hero-art-in 0.7s var(--ease);
}
.player.inline:fullscreen { border-radius: 0; box-shadow: none; }
.player.inline [data-el="back"], .player.inline .player-heading { display: none; }
.player.inline .player-top { padding-top: 16px; }
.player.inline .player-bottom { padding: 50px 22px 18px; }
/* The menus and the report form get the whole screen, not just the picture's */
.player.inline .report-sheet { position: fixed; z-index: 95; }

/* The mini player: a video that goes on in a corner while the viewer looks around */
.mini-bar { display: none; }
.player.mini {
  inset: auto;
  right: 22px;
  bottom: 22px;
  z-index: 85;
  width: min(380px, calc(100vw - 32px));
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 22px;
  cursor: pointer;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.16);
  animation: mini-in 0.5s var(--spring);
}
@keyframes mini-in { from { opacity: 0; transform: translateY(24px) scale(0.92); } to { opacity: 1; transform: none; } }
.player.mini .player-top, .player.mini .player-bottom, .player.mini .popover, .player.mini .side-panel, .player.mini .report-sheet { display: none; }
.player.mini .mini-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 2px; padding: 30px 8px 8px 14px; background: linear-gradient(0deg, rgba(0, 0, 0, 0.8), transparent); opacity: 0; transition: opacity 0.25s; }
.player.mini:hover .mini-bar, .player.mini .mini-bar:focus-within { opacity: 1; }
.mini-heading { flex: 1; min-width: 0; }
.mini-heading strong { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-heading small { display: block; font-size: 12px; color: var(--text-2); font-weight: 600; }
.mini-bar .ctl { width: 36px; height: 36px; }
.mini-bar .ctl .icon { width: 18px; height: 18px; }
.player.mini .status { padding: 14px; border-radius: 50%; }
.player.mini .status > :not(.spinner) { display: none; }
.player.mini .spinner { width: 32px; height: 32px; }
.player.mini .big-play { width: 54px; height: 54px; }
.player.mini .big-play .icon { width: 22px; height: 22px; }
.player.mini .subtitle-line { bottom: 14px; }
@media (hover: none) { .player.mini .mini-bar { opacity: 1; } }

/* --- Narrow screens: the tab bar floats at the bottom ------------------------------------- */

@media (max-width: 1240px) {
  .title-hero { grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 36px; }
  .facts { grid-column: 2; max-width: 520px; }
}

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 110px; min-height: 0; }
  .hero-art { order: -1; width: min(62vw, 280px); }
  .hero-art .frame { transform: none; }
  .hero-dots { position: static; justify-self: center; }
  .title-hero { grid-template-columns: minmax(150px, 220px) minmax(0, 1fr); gap: 26px; }
  .facts { grid-column: 1 / -1; max-width: none; }
}

@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; }
  .tabbar {
    position: fixed;
    left: 50%;
    bottom: max(14px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    padding: 6px;
  }
  .tab { flex-direction: column; justify-content: center; gap: 2px; height: 52px; padding: 0 10px; font-size: 10.5px; white-space: nowrap; }
  .tab .icon { width: 21px; height: 21px; }
  .tab-icon { padding: 0 12px; }
  .tab-icon span { display: none; }
  .tab-sep { display: none; }
  .tab-lens { top: 6px; height: 52px; }
  .page { padding-top: 84px; padding-bottom: 110px; }
  .hero { padding-top: 84px; gap: 26px; text-align: center; }
  .hero-copy { justify-self: center; }
  .hero .meta, .hero-actions { justify-content: center; }
  .hero-plot { margin-left: auto; margin-right: auto; }
  .title-hero { grid-template-columns: 1fr; padding-top: 84px; }
  .title-poster { width: min(64vw, 260px); justify-self: center; }
  .title-main { text-align: center; }
  .title-main .meta, .title-main .chips, .title-actions, .cast { justify-content: center; }
  .episode { grid-template-columns: 128px minmax(0, 1fr); gap: 12px; }
  .filter-dock { bottom: 92px; }
  .filter-dock .dock-label { display: none; }
  .select select { padding: 0 30px 0 13px; font-size: 13px; }
  .to-top { bottom: 150px; right: 16px; }
  .row-arrow { display: none; }
  .footer { padding-bottom: 120px; }
  .footer-inner { grid-template-columns: 1fr; }
  .controls { flex-wrap: wrap; justify-content: center; }
  .player-top .rate-group { display: none; }
  /* A movie's player spans the screen; its controls fit one row, and its menus open as a
     sheet at the bottom of the screen */
  .title-stage { padding: 24px 0 0; }
  .player.inline { width: 100%; border-radius: 0; }
  .player.inline .player-top { padding: 10px 12px 30px; }
  .player.inline .player-top .ctl { width: 38px; height: 38px; }
  .player.inline .player-bottom { padding: 30px 8px 8px; }
  .player.inline .controls { flex-wrap: nowrap; gap: 0; margin-top: 4px; padding: 3px 6px; }
  .player.inline .controls .grow { display: block; }
  .player.inline .ctl { width: 36px; height: 36px; }
  .player.inline .ctl .icon { width: 19px; height: 19px; }
  .player.inline [data-el="back10"], .player.inline [data-el="fwd10"], .player.inline .volume, .player.inline [data-el="pip"], .player.inline [data-el="download"] { display: none; }
  .player.inline .time { padding: 0 6px; font-size: 12px; }
  .player.inline .seek-frame { width: 120px; }
  .player.inline .subtitle-line { bottom: 62px; }
  .player.inline.idle .subtitle-line { bottom: 12px; }
  .player.inline .status { padding: 16px 20px; gap: 10px; transform: scale(0.85); }
  .player.inline .popover, .player.inline .side-panel { position: fixed; left: 10px; right: 10px; top: auto; bottom: 10px; z-index: 95; width: auto; max-height: 70vh; }
  .player.inline .popover-subs { max-height: 70vh; }
  .player.mini { right: 12px; bottom: calc(max(14px, env(safe-area-inset-bottom)) + 80px); width: min(300px, calc(100vw - 24px)); }
  .subtitle-line { bottom: 176px; }
  .seek-frame { width: 140px; }
  .controls .grow { display: none; }
  .volume input { display: none; }
  .search-sheet { padding-top: 16px; }
}

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