/*
 * Filmzwilling – Abyss design, no build step.
 *
 * The visual language (palette, frosted glass, pill tabs, spotlight banner, card treatment,
 * player OSD, easing curves) is adapted from "Abyss for Jellyfin" by Om Gupta,
 * https://github.com/AumGupta/abyss-jellyfin, MIT License (see ABYSS-LICENSE.txt next to this
 * file). The Jellyfin-specific selectors were rewritten for this app's own markup.
 */

:root {
  /* Abyss theme variables (R, G, B so that opacity variants work). */
  --abyss-accent: 245, 245, 247;
  --abyss-radius: 12px;
  --abyss-glass-tint: 42, 42, 42;
  --abyss-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --abyss-ease-snappy: cubic-bezier(0.4, 0, 0.2, 1);
  --abyss-backdrop-blur: 23px;
  --abyss-glass-blur: 15px;
  --abyss-pink: 249, 38, 114;

  --bg: #000;
  --text: rgb(var(--abyss-accent));
  --muted: rgba(var(--abyss-accent), 0.6);
  --faint: rgba(var(--abyss-accent), 0.38);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(245, 245, 247, 0.2);
  --glass: rgba(var(--abyss-glass-tint), 0.42);
  --glass-strong: rgba(var(--abyss-glass-tint), 0.72);
  --chip: rgba(40, 40, 40, 0.75);
  --danger: rgb(var(--abyss-pink));
  --low: #ff9f43;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.35);
  --header-h: 76px;
  color-scheme: dark;
  scrollbar-color: rgba(var(--abyss-accent), 0.5) #0000;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--text); text-underline-offset: 3px; text-decoration-color: rgba(var(--abyss-accent), 0.4); }
a:hover { text-decoration-color: currentColor; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5rem; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; font-weight: 500; }
::selection { background: rgba(var(--abyss-accent), 0.25); color: rgb(var(--abyss-accent)); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track-piece, ::-webkit-scrollbar-corner { background: #0000; }
::-webkit-scrollbar-thumb { background: rgba(var(--abyss-accent), 0.35); border-radius: var(--abyss-radius); border: 2px solid #0000; background-clip: padding-box; }
:focus-visible { outline: 2px solid rgba(var(--abyss-accent), 0.85); outline-offset: 3px; }
code, kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8em;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05em 0.4em;
}
kbd.pad { font-family: inherit; font-weight: 700; border-radius: 50px; min-width: 1.6em; text-align: center; display: none; }
body.pad-mode kbd.pad { display: inline-block; }
body.pad-mode .action kbd:not(.pad) { display: none; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.i { width: 1.25em; height: 1.25em; fill: currentColor; flex-shrink: 0; vertical-align: middle; }

/* Frosted glass surfaces */
.glass, .glass-panel, .glass-pill {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--abyss-glass-blur)) saturate(1.2);
  backdrop-filter: blur(var(--abyss-glass-blur)) saturate(1.2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.glass-panel { border-radius: 24px; padding: 1.2rem 1.4rem; }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .glass-panel, .glass-pill { background: rgba(30, 30, 30, 0.92); }
}

/* Ambient background: the current film, blurred far out (as in Abyss library pages). */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 80% at 50% 0%, #1b1d22 0%, #000 70%); }
.ambient img {
  width: 100%; height: 100%; object-fit: cover; opacity: 0;
  filter: blur(60px) saturate(1.3) brightness(0.45);
  transform: scale(1.25);
  transition: opacity 1.2s var(--abyss-ease);
}
.ambient img.loaded { opacity: 1; }
.ambient::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0, 0, 0, 0.25), rgba(0, 0, 0, 0.75)); }

/* --- header: brand left, pill tab bar centred (Abyss section tabs) --- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 1rem; padding: 0.9rem 1.6rem; min-height: var(--header-h);
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  transition: background 0.37s var(--abyss-ease), box-shadow 0.37s var(--abyss-ease);
}
.topbar.scrolled {
  background: rgba(var(--abyss-glass-tint), 0.55);
  -webkit-backdrop-filter: blur(var(--abyss-backdrop-blur)) saturate(1.2); backdrop-filter: blur(var(--abyss-backdrop-blur)) saturate(1.2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06), 0 10px 30px rgba(0, 0, 0, 0.3);
}
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--text); text-decoration: none; font-weight: 600; font-size: 1.1rem; letter-spacing: -0.01em; justify-self: start; opacity: 0.9; }
.brand .i { width: 1.6em; height: 1.6em; padding: 0.3em; border-radius: 50%; background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); }
.tabs {
  display: flex; gap: 2px; padding: 4px; border-radius: 50px;
  background: rgba(var(--abyss-glass-tint), 0.55);
  -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  color: rgba(var(--abyss-accent), 0.6); text-decoration: none; white-space: nowrap;
  padding: 0.5rem 1.25rem; border-radius: 50px; font-weight: 500; font-size: 1.02rem;
  transition: background 0.37s var(--abyss-ease), color 0.37s var(--abyss-ease);
}
.tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.tab.active { background: rgb(var(--abyss-accent)); color: #121212; }
.topbar-right { justify-self: end; display: flex; gap: 0.5rem; }
.pad-indicator { animation: fade-up 0.5s var(--abyss-ease) both; }

.main { flex: 1; width: 100%; max-width: 1480px; margin: 0 auto; padding: 0.5rem 2.2rem 3rem; animation: fade-up 0.7s var(--abyss-ease) both 0.05s; }
.footer { padding: 1.4rem 1.6rem 2rem; font-size: 0.8rem; color: var(--faint); text-align: center; }
.footer p { margin: 0.2rem 0; }
.footer a { color: var(--muted); }
.page-head, .toolbar { display: flex; align-items: center; gap: 0.8rem 1.2rem; flex-wrap: wrap; margin: 0.5rem 0 1rem; }
.page-head { justify-content: space-between; }
.toolbar-title { font-size: 1.6rem; margin: 0; }
.head-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.toolbar .head-actions { margin: 0 0 0 auto; }
.section-title { margin-top: 3rem; }
.meta-line { margin: -0.4rem 0 1rem; font-size: 0.9rem; }
.notice {
  background: var(--glass); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur));
  border: 1px solid var(--line); padding: 0.85rem 1.1rem; border-radius: var(--abyss-radius);
}
.notice.subtle { color: var(--muted); }

/* --- controls --- */
button, .button {
  font: inherit; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  border-radius: var(--abyss-radius); padding: 0.6rem 1.15rem; font-weight: 600;
  background: rgba(var(--abyss-accent), 0.95); color: #121212; border: 1px solid transparent;
  transition: background-color 0.37s var(--abyss-ease), color 0.37s var(--abyss-ease), transform 0.37s var(--abyss-ease), box-shadow 0.37s var(--abyss-ease), border-color 0.37s var(--abyss-ease);
}
button:hover, .button:hover { background: #fff; box-shadow: 0 0 20px rgba(255, 255, 255, 0.2); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
button.secondary, .button.secondary, .icon-btn {
  background: rgba(40, 40, 40, 0.8); color: var(--text); border-color: var(--line);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
button.secondary:hover, .button.secondary:hover, .icon-btn:hover, .icon-btn[aria-expanded="true"] { background: rgb(var(--abyss-accent)); color: #121212; }
.icon-btn { padding: 0.55rem 0.9rem; font-weight: 500; }
.icon-btn .i { width: 1.3em; height: 1.3em; }
button.small, a.small { font-size: 0.85rem; padding: 0.35rem 0.7rem; }
input, select {
  font: inherit; color: var(--text);
  background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.5rem 0.7rem; transition: border-color 0.37s var(--abyss-ease), background 0.37s var(--abyss-ease);
}
input:focus, select:focus { border-color: rgba(var(--abyss-accent), 0.6); background: rgba(0, 0, 0, 0.55); outline: none; }
select option { background: #1c1c1e; }
input[type="checkbox"] { accent-color: rgb(var(--abyss-accent)); width: 1.05rem; height: 1.05rem; }
.check { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0.2rem 0.9rem 0.2rem 0; cursor: pointer; border-radius: 8px; }
.check img { width: 22px; height: 22px; border-radius: 6px; }
fieldset { border: 1px solid var(--line); border-radius: var(--abyss-radius); }
legend { color: var(--muted); padding: 0 0.4rem; font-size: 0.9rem; }

/* Abyss spotlight buttons */
.btn-play {
  font-size: 1.1rem; padding: 0.7rem 1.6rem 0.7rem 1.25rem; border-radius: var(--abyss-radius);
  background: rgba(255, 255, 255, 0.95); color: #111;
}
.btn-play .i { width: 1.5em; height: 1.5em; }
.btn-play:hover { transform: scale(1.03); }
.btn-play.unavailable { background: rgba(255, 255, 255, 0.18); color: var(--muted); }
.btn-round {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.92); border: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); text-decoration: none; padding: 0;
  transition: background-color 0.5s var(--abyss-ease), color 0.5s var(--abyss-ease), transform 0.5s var(--abyss-ease);
}
.btn-round:hover { background: #fff; color: #111; transform: scale(1.05); }
.btn-round .i { width: 26px; height: 26px; }

/* Meta pills (spotlight) */
.meta-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.meta-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--chip); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 8px;
  padding: 4px 12px; font-size: 0.82rem; font-weight: 600; color: rgba(255, 255, 255, 0.85); white-space: nowrap;
}
.meta-pill .i { width: 15px; height: 15px; opacity: 0.85; }
.chips { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-block; background: rgba(255, 255, 255, 0.1); border: 1px solid var(--line); border-radius: 50px;
  padding: 0.22rem 0.8rem; font-size: 0.82rem; margin: 0.1rem 0.2rem 0.1rem 0;
}
.chip-abandoned { border-color: rgba(255, 159, 67, 0.7); color: #ffc58f; }
.chip-unclear { border-color: rgba(255, 255, 255, 0.35); }
.chip-thumbs { border-color: rgba(var(--abyss-pink), 0.6); color: #ff9ec2; }

/* --- spotlight (rate page and recommendations hero) --- */
.spotlight { position: relative; }
.spot-backdrop { position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.spot-backdrop img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 20%; display: block; opacity: 0;
  transition: opacity 1.2s var(--abyss-ease);
  -webkit-mask-image: linear-gradient(to bottom, black 45%, transparent 100%), linear-gradient(to right, transparent 0%, black 22%, black 75%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to bottom, black 45%, transparent 100%), linear-gradient(to right, transparent 0%, black 22%, black 75%, transparent 100%);
  mask-composite: intersect;
}
.spot-backdrop img.loaded { opacity: 1; }
.spot-backdrop.from-poster img { filter: blur(28px) saturate(1.25) brightness(0.7); transform: scale(1.15); }
.spot-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to right, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.1) 55%, rgba(0, 0, 0, 0) 100%); }
.spot-content { position: relative; z-index: 2; }
.spot-title {
  font-size: clamp(2rem, 4vw, 3.4rem); font-weight: 700; letter-spacing: -0.03em; line-height: 1.02;
  margin-bottom: 10px; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
}
.film-original { color: var(--muted); margin: 0 0 12px; font-size: 1rem; min-height: 1.2em; }
.spot-plot {
  font-size: 1rem; font-weight: 500; color: rgba(255, 255, 255, 0.7); line-height: 1.45;
  max-width: 560px; margin: 0 0 22px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.spot-plot:empty { display: none; }
.spot-buttons { display: flex; align-items: center; gap: 12px; }
.spot-content > * { animation: fade-up 0.8s var(--abyss-ease) both; }
.spot-content > :nth-child(2) { animation-delay: 0.08s; }
.spot-content > :nth-child(3) { animation-delay: 0.16s; }
.spot-content > :nth-child(4) { animation-delay: 0.24s; }
.spot-content > :nth-child(5) { animation-delay: 0.32s; }
.spot-content > :nth-child(6) { animation-delay: 0.4s; }

/* --- rating page --- */
.main-rate { max-width: none; padding: 0; }
.rate {
  min-height: calc(100vh - var(--header-h)); margin-top: calc(-1 * var(--header-h)); padding: calc(var(--header-h) + 1rem) 4.3vw 1.5rem;
  display: flex; flex-direction: column;
}
.rate .spot-backdrop { bottom: 30%; }
.progress { position: relative; z-index: 3; align-self: flex-start; padding: 0.45rem 0.9rem 0.55rem; border-radius: 50px; min-width: min(360px, 100%); }
.progress-text { margin: 0 0 0.3rem; color: rgba(255, 255, 255, 0.8); font-size: 0.85rem; font-weight: 500; }
.progress-bar { height: 3px; background: rgba(255, 255, 255, 0.2); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: rgba(255, 255, 255, 0.85); border-radius: 2px; transition: width 0.6s var(--abyss-ease); }
.spot-body { position: relative; z-index: 2; flex: 1; display: flex; align-items: flex-end; padding: 3vh 0 2.5vh; }
.card { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 2.5rem; }
.card .spot-content { max-width: 760px; }
.poster-wrap {
  width: clamp(150px, 17vw, 260px); aspect-ratio: 2 / 3; border-radius: var(--abyss-radius); overflow: hidden;
  background: rgba(255, 255, 255, 0.06); box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: fade-up 0.8s var(--abyss-ease) both 0.15s;
}
.poster { width: 100%; height: 100%; object-fit: cover; display: block; }
.rate-dock { position: relative; z-index: 3; border-radius: 24px; padding: 15px; }
.score-buttons { display: grid; grid-template-columns: repeat(11, 1fr); gap: 9px; }
.score {
  height: 56px; min-width: 0; padding: 0; font-size: 1.4rem; font-weight: 600; border-radius: var(--abyss-radius);
  background: rgba(255, 255, 255, 0.08); color: var(--text); border-color: rgba(255, 255, 255, 0.08);
}
@media (hover: hover) { .score:hover { background: rgb(var(--abyss-accent)); color: #121212; } }
.score:focus-visible { background: rgb(var(--abyss-accent)); color: #121212; }
.score.low { border-color: rgba(255, 159, 67, 0.75); box-shadow: inset 0 0 0 1px rgba(255, 159, 67, 0.75); }
.score.pressed { animation: pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.action-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 9px; }
.action { height: 56px; padding-top: 0; padding-bottom: 0; background: rgba(255, 255, 255, 0.05); color: var(--text); border-color: rgba(255, 255, 255, 0.06); font-weight: 500; }
.action:hover { background: rgba(255, 255, 255, 0.9); color: #111; }
.action kbd { opacity: 0.65; background: rgba(0, 0, 0, 0.25); }
.retry { color: #ffc58f; cursor: pointer; margin: 0.6rem 0 0; }
.help { margin-top: 0.6rem; color: var(--muted); font-size: 0.88rem; }
.help summary { cursor: pointer; width: fit-content; border-radius: 6px; }
.help p { margin: 0.4rem 0; }
.empty { text-align: center; padding: 3rem 2rem; margin: auto; max-width: 560px; }

/* --- recommendations: hero + Abyss library grid --- */
.hero {
  min-height: min(68vh, 640px); margin: calc(-1 * var(--header-h) - 0.5rem) -2.2rem 1rem; padding: calc(var(--header-h) + 3rem) 4.3vw 3.5rem;
  display: flex; align-items: flex-end; border-radius: 0 0 28px 28px; overflow: hidden;
}
.hero .spot-content { max-width: 720px; }
.hero .match-big { display: inline-flex; align-items: baseline; gap: 0.5rem; margin: 0 0 10px; }
.hero .match-big strong { font-size: 2.6rem; font-weight: 700; letter-spacing: -0.03em; }
.hero .match-big span { color: var(--muted); font-size: 0.95rem; }
.hero .reason { color: var(--muted); margin: -12px 0 18px; font-size: 0.92rem; }
.carousel-dots {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; align-items: center;
  padding: 8px 6px; border-radius: 50px; background: rgba(42, 42, 42, 0.42);
  -webkit-backdrop-filter: blur(15px); backdrop-filter: blur(15px); border: 0.5px solid rgba(87, 87, 87, 0.1);
}
.dot { border: 0; padding: 0; margin: 0 5px; width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); opacity: 0.55; min-height: 0; }
.dot:hover { background: #fff; box-shadow: none; }
.dot.active { width: 20px; border-radius: 4px; opacity: 1; }
.filters { margin: 0 0 1.8rem; padding: 1.4rem 1.6rem 1.2rem; animation: fade-up 0.5s var(--abyss-ease) both; }
.filter-section + .filter-section { margin-top: 1.3rem; }
.filter-section h3 { font-size: 0.95rem; font-weight: 500; color: var(--muted); margin: 0 0 0.6rem; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-row + .chip-row, .more-providers + .chip-row { margin-top: 8px; }
.chip-toggle { position: relative; display: inline-flex; cursor: pointer; }
.chip-toggle input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-face {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0.5rem 1.1rem; border-radius: 50px;
  background: rgba(255, 255, 255, 0.07); border: 1px solid var(--line); color: rgba(var(--abyss-accent), 0.85);
  font-weight: 500; white-space: nowrap; user-select: none;
  transition: background 0.37s var(--abyss-ease), color 0.37s var(--abyss-ease), transform 0.37s var(--abyss-ease), box-shadow 0.37s var(--abyss-ease);
}
.chip-face img { width: 24px; height: 24px; border-radius: 6px; margin-left: -0.45rem; }
.chip-toggle:hover .chip-face, summary.chip-face:hover { background: rgba(255, 255, 255, 0.14); color: var(--text); }
.chip-toggle input:checked + .chip-face { background: rgb(var(--abyss-accent)); color: #121212; border-color: transparent; }
.chip-toggle input:checked + .chip-face::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: #121212; margin-left: -0.2rem; }
.chip-toggle:has(img) input:checked + .chip-face::before { display: none; }
.chip-toggle input:focus-visible + .chip-face { outline: 3px solid rgb(var(--abyss-accent)); outline-offset: 3px; box-shadow: 0 0 24px rgba(255, 255, 255, 0.25); transform: scale(1.05); }
body.pad-mode .chip-toggle input:focus-visible { outline: none; box-shadow: none; }
.filters:has(#providers-any:checked) input[name="providers"] + .chip-face { opacity: 0.45; }
.more-providers { margin-top: 8px; }
.more-providers summary { list-style: none; cursor: pointer; width: fit-content; margin-bottom: 8px; }
.more-providers summary::-webkit-details-marker { display: none; }
.more-providers summary::after { content: "▾"; opacity: 0.6; }
.more-providers[open] summary::after { content: "▴"; }
.stepper-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.stepper { background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 18px; padding: 0.6rem 0.7rem 0.7rem; }
.stepper-label { display: block; font-size: 0.82rem; color: var(--muted); margin: 0 0 0.4rem 0.3rem; }
.stepper-row { display: grid; grid-template-columns: 48px 1fr 48px; gap: 6px; align-items: center; }
.step-btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: var(--text); border-color: rgba(255, 255, 255, 0.12); }
.step-btn:hover, .step-btn:focus-visible { background: rgb(var(--abyss-accent)); color: #121212; }
.step-btn .i { width: 24px; height: 24px; }
.stepper input { width: 100%; min-width: 0; height: 48px; text-align: center; font-size: 1.15rem; font-weight: 600; border-radius: 14px; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input::placeholder { color: var(--faint); font-weight: 400; }
.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: 50px; background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 255, 255, 0.06); }
.segmented .chip-face { background: transparent; border-color: transparent; }
.segmented .chip-toggle input:checked + .chip-face::before { display: none; }
.filter-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.filter-actions button { min-height: 48px; padding: 0.6rem 1.4rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 1.8rem 1.4rem; }
.tile { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; outline: none; animation: fade-up 0.6s var(--abyss-ease) both; cursor: pointer; }
.tile-art {
  position: relative; aspect-ratio: 2 / 3; border-radius: var(--abyss-radius); overflow: hidden; background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 3px rgba(200, 200, 200, 0.35) inset, 0 10px 30px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0);
  transition: transform 0.37s var(--abyss-ease), border-color 0.25s var(--abyss-ease), border-radius 0.37s var(--abyss-ease), box-shadow 0.37s var(--abyss-ease);
}
.tile-poster { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile:hover .tile-art { border-color: var(--line-strong); }
.tile:focus-visible .tile-art, .tile.pad-focus .tile-art { transform: scale(1.06); border: 0.25em solid rgb(var(--abyss-accent)); border-radius: 20px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6); }
.tile-match {
  position: absolute; top: 8px; left: 8px; display: inline-flex; align-items: baseline; gap: 4px;
  background: rgba(20, 20, 20, 0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 8px; padding: 2px 9px; font-weight: 700; font-size: 1rem;
}
.tile-match small { font-weight: 500; font-size: 0.7rem; color: var(--muted); }
.offers { position: absolute; left: 8px; bottom: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.offers img { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.offer-name { font-size: 0.7rem; background: rgba(20, 20, 20, 0.75); border: 1px solid var(--line); border-radius: 6px; padding: 0.1rem 0.35rem; }
.tile-title { font-size: 1.05rem; font-weight: 500; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-meta { margin: -0.4rem 0 0; font-size: 0.88rem; color: var(--muted); }
.tile-reason { margin: 0; font-size: 0.8rem; color: var(--faint); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* --- film sheet (dialog) --- */
.sheet-layer { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 2rem; background: rgba(0, 0, 0, 0.55); animation: fade-in 0.3s var(--abyss-ease) both; }
.sheet {
  position: relative; width: min(920px, 100%); max-height: calc(100vh - 4rem); overflow: auto; border-radius: 28px;
  background: rgba(var(--abyss-glass-tint), 0.62); -webkit-backdrop-filter: blur(var(--abyss-backdrop-blur)) saturate(1.2); backdrop-filter: blur(var(--abyss-backdrop-blur)) saturate(1.2);
  border: 1px solid var(--line-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  animation: sheet-in 0.5s var(--abyss-ease) both;
}
.sheet .spotlight { min-height: 300px; padding: 2.2rem 2.2rem 1.6rem; display: flex; align-items: flex-end; }
.sheet .spot-title { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.sheet-close { position: absolute; top: 14px; right: 14px; z-index: 5; width: 42px; height: 42px; }
.sheet-body { padding: 0 2.2rem 2rem; }
.sheet-body h3 { font-size: 0.95rem; color: var(--muted); font-weight: 500; margin: 1.1rem 0 0.6rem; }
.sheet-rate { display: grid; grid-template-columns: repeat(11, 1fr); gap: 6px; }
.sheet-rate button { min-height: 46px; padding: 0; background: rgba(255, 255, 255, 0.08); color: var(--text); border-color: rgba(255, 255, 255, 0.08); font-size: 1.1rem; }
.sheet-rate button:hover, .sheet-rate button:focus-visible { background: #fff; color: #111; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.2rem; }

/* --- trailer player (YouTube IFrame API, own Abyss OSD) --- */
.player { position: fixed; inset: 0; z-index: 80; background: #000; color: #fff; animation: fade-in 0.35s var(--abyss-ease) both; overflow: hidden; }
.player-bg { position: absolute; inset: 0; background-size: cover; background-position: center; filter: blur(40px) brightness(0.35) saturate(1.2); transform: scale(1.2); }
.player-stage { position: absolute; inset: 0; display: grid; place-items: center; }
.player-frame { position: relative; width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; }
.player-frame iframe, .player-frame > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-shield { position: absolute; inset: 0; z-index: 2; cursor: pointer; display: grid; place-items: center; transition: background 0.4s var(--abyss-ease), backdrop-filter 0.4s var(--abyss-ease); }
.player.paused .player-shield, .player.loading .player-shield, .player.ended .player-shield {
  background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.player-center { display: none; width: 92px; height: 92px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.25); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); align-items: center; justify-content: center; transition: transform 0.4s var(--abyss-ease), background 0.4s var(--abyss-ease); }
.player-center .i { width: 52px; height: 52px; }
.player.paused .player-center, .player.ended .player-center { display: inline-flex; }
.player-shield:hover .player-center { transform: scale(1.06); background: rgba(255, 255, 255, 0.95); color: #111; }
.player-spinner { display: none; width: 54px; height: 54px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.2); border-top-color: #fff; animation: spin 0.9s linear infinite; }
.player.loading .player-spinner { display: block; }
.player-message { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; text-align: center; padding: 2rem; font-size: 1.1rem; color: var(--muted); }

.player-top, .player-osd { position: absolute; left: 24px; right: 24px; z-index: 4; transition: opacity 0.45s var(--abyss-ease), transform 0.45s var(--abyss-ease); }
.player-top { top: 20px; display: flex; align-items: center; gap: 12px; }
.player-title {
  font-size: 1.1rem; font-weight: 500; padding: 6px 14px; border-radius: 12px;
  background: rgba(var(--abyss-glass-tint), 0.45); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50vw;
}
.player-title small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.trailer-tabs { margin-left: auto; display: flex; gap: 2px; padding: 4px; border-radius: 50px; background: rgba(var(--abyss-glass-tint), 0.55); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur)); max-width: 46vw; overflow-x: auto; scrollbar-width: none; }
.trailer-tabs button { padding: 0.35rem 0.95rem; border-radius: 50px; background: transparent; color: rgba(255, 255, 255, 0.65); font-weight: 500; font-size: 0.88rem; white-space: nowrap; border: 0; }
.trailer-tabs button:hover { background: rgba(255, 255, 255, 0.12); color: #fff; box-shadow: none; }
.trailer-tabs button.active { background: rgb(var(--abyss-accent)); color: #121212; }
.player-osd {
  bottom: 24px; padding: 12px 16px 10px; border-radius: 24px;
  background: rgba(var(--abyss-glass-tint), 0.62); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.08); box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
}
.osd-seek { display: flex; align-items: center; gap: 14px; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.osd-seek span { opacity: 0.75; min-width: 3.2em; }
.osd-seek span:last-child { text-align: right; }
.osd-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.osd-row .spacer { flex: 1; }
.osd-btn { width: 42px; height: 42px; padding: 0; border-radius: var(--abyss-radius); background: transparent; color: #fff; border: 0; }
.osd-btn:hover, .osd-btn:focus-visible { background: rgba(0, 0, 0, 0.4); box-shadow: none; }
.osd-btn.primary { width: 48px; height: 48px; }
.osd-btn .i { width: 26px; height: 26px; }
.osd-btn.primary .i { width: 32px; height: 32px; }
.osd-label { font-size: 0.8rem; color: rgba(255, 255, 255, 0.6); margin-left: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.range { -webkit-appearance: none; appearance: none; flex: 1; height: 18px; background: transparent; padding: 0; border: 0; cursor: pointer; --pct: 0%; --buf: 0%; }
.range:focus { background: transparent; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, rgb(var(--abyss-accent)) var(--pct), rgba(255, 255, 255, 0.35) var(--pct), rgba(255, 255, 255, 0.35) var(--buf), hsl(0deg 0% 30%) var(--buf)); }
.range::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, rgb(var(--abyss-accent)) var(--pct), rgba(255, 255, 255, 0.35) var(--pct), rgba(255, 255, 255, 0.35) var(--buf), hsl(0deg 0% 30%) var(--buf)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #fff; margin-top: -5px; box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.25); transition: box-shadow 0.3s var(--abyss-ease); }
.range::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: #fff; }
.range:hover::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.2); }
.osd-volume { flex: 0 0 110px; }
.player.idle { cursor: none; }
.player.idle .player-top { opacity: 0; transform: translateY(-12px); pointer-events: none; }
.player.idle .player-osd { opacity: 0; transform: translateY(12px); pointer-events: none; }
.player-toast { position: absolute; top: 30%; left: 50%; z-index: 5; transform: translate(-50%, -50%); padding: 10px 18px; border-radius: 50px; background: rgba(var(--abyss-glass-tint), 0.7); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-weight: 600; pointer-events: none; opacity: 0; transition: opacity 0.3s var(--abyss-ease); }
.player-toast.visible { opacity: 1; }

/* --- controller help and focus --- */
body.pad-mode :focus-visible, body.pad-mode .pad-focus:not(.tile) { outline: 3px solid rgb(var(--abyss-accent)); outline-offset: 3px; box-shadow: 0 0 24px rgba(255, 255, 255, 0.25); }
body.pad-mode .score:focus-visible, body.pad-mode .score.pad-focus { background: rgb(var(--abyss-accent)); color: #121212; transform: scale(1.08); }
body.pad-mode .tile:focus-visible { outline: none; box-shadow: none; }
.pad-help { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(0, 0, 0, 0.5); animation: fade-in 0.3s var(--abyss-ease) both; }
.pad-help .glass-panel { width: min(620px, calc(100vw - 2rem)); animation: sheet-in 0.5s var(--abyss-ease) both; background: rgba(var(--abyss-glass-tint), 0.7); }
.pad-help h2 { display: flex; align-items: center; gap: 0.6rem; }
.pad-help dl { display: grid; grid-template-columns: auto 1fr; gap: 0.45rem 1rem; margin: 1rem 0 0.5rem; }
.pad-help dt { text-align: right; }
.pad-help dt kbd { display: inline-block; font-family: inherit; font-weight: 700; border-radius: 50px; padding: 0.1em 0.6em; }
.pad-help dd { margin: 0; color: var(--muted); }
.pad-help-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.pad-learn { margin: 1rem 0 0; padding: 0.8rem 1rem; border-radius: var(--abyss-radius); background: rgba(var(--abyss-accent), 0.08); border: 1px solid var(--line-strong); }
.pad-learn strong { font-size: 1.1rem; }

/* --- tables and lists (ratings, twins, matching, settings) --- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 1rem; border-radius: 20px; overflow: hidden; background: var(--glass); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur)); border: 1px solid var(--line); }
.table th, .table td { text-align: left; padding: 0.65rem 0.8rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.3s var(--abyss-ease); }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
.table th { color: var(--muted); font-weight: 500; font-size: 0.85rem; background: rgba(0, 0, 0, 0.2); }
.table .chip { font-size: 0.78rem; }
.thumb { width: 42px; height: 63px; object-fit: cover; border-radius: 8px; background: rgba(255, 255, 255, 0.06); display: block; }
.search input { width: min(100%, 420px); border-radius: 50px; padding-left: 1rem; }
.unmatched { list-style: none; padding: 0; }
.unmatched-item { background: var(--glass); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur)); border: 1px solid var(--line); border-radius: 20px; padding: 1rem 1.2rem; margin-bottom: 0.8rem; }
.unmatched-search { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.6rem; }
.unmatched-search input { flex: 1; min-width: 200px; }
.results { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.result { display: flex; align-items: center; gap: 0.7rem; padding: 0.35rem 0; }
.result img { width: 34px; height: 51px; object-fit: cover; border-radius: 6px; }
.result span { flex: 1; }
.empty-row { color: var(--muted); padding: 1rem 0; }
.settings, .twins, .ratings, .matching { max-width: 1100px; margin: 0 auto; }

/* --- toast --- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 100; transform: translateX(-50%) translateY(160%);
  background: rgba(var(--abyss-glass-tint), 0.8); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur));
  border: 1px solid var(--line-strong); border-radius: 50px; padding: 0.65rem 1.3rem; box-shadow: var(--shadow); font-weight: 500;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: transform 0.45s var(--abyss-ease), opacity 0.3s var(--abyss-ease), visibility 0s linear 0.45s;
}
.toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; transition-delay: 0s; }
.toast[data-kind="error"] { border-color: rgba(var(--abyss-pink), 0.7); }

/* --- animations --- */
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 70% { transform: scale(0.96); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
.grid .tile:nth-child(n+2) { animation-delay: 0.03s; }
.grid .tile:nth-child(n+5) { animation-delay: 0.08s; }
.grid .tile:nth-child(n+9) { animation-delay: 0.13s; }
.grid .tile:nth-child(n+13) { animation-delay: 0.18s; }

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

/* --- responsive --- */
@media (max-width: 1100px) {
  .topbar { grid-template-columns: auto 1fr; }
  .tabs { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .topbar-right { grid-column: 2; grid-row: 1; }
  :root { --header-h: 118px; }
}
@media (max-width: 640px) {
  :root { --header-h: 104px; }
  .topbar { padding: 0.6rem 0.7rem; gap: 0.5rem; }
  .tab { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
  .main { padding: 0.5rem 0.8rem 2rem; }
  .main-rate { padding: 0; }
  .rate { padding: calc(var(--header-h) + 0.4rem) 0.8rem 0.8rem; }
  /* Compact card so that the score buttons stay visible without scrolling. */
  .card { grid-template-columns: 1fr 96px; gap: 0.9rem; align-items: start; }
  .poster-wrap { width: 96px; order: 0; }
  .spot-title { font-size: 1.45rem; }
  .spot-plot { -webkit-line-clamp: 3; font-size: 0.9rem; margin-bottom: 12px; }
  .film-original { margin-bottom: 6px; font-size: 0.85rem; }
  .meta-pill { font-size: 0.72rem; padding: 3px 8px; }
  .chip { font-size: 0.75rem; }
  .btn-play { font-size: 0.95rem; padding: 0.5rem 1rem 0.5rem 0.8rem; }
  .btn-round { width: 40px; height: 40px; }
  .spot-body { padding: 1rem 0; }
  .rate-dock { padding: 10px; border-radius: 20px; }
  .score-buttons { grid-template-columns: repeat(6, 1fr); gap: 6px; }
  .score, .action { height: 50px; }
  .action { font-size: 0.85rem; padding: 0.4rem; }
  .action kbd { display: none; }
  .hero { margin: calc(-1 * var(--header-h) - 0.5rem) -0.8rem 1rem; min-height: 60vh; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1.2rem 0.9rem; }
  .toolbar .head-actions { margin: 0; }
  .icon-btn span { display: none; }
  .sheet-layer { padding: 0.5rem; }
  .sheet .spotlight, .sheet-body { padding-left: 1.1rem; padding-right: 1.1rem; }
  .sheet-rate { grid-template-columns: repeat(6, 1fr); }
  .player-top, .player-osd { left: 10px; right: 10px; }
  .player-osd { bottom: 10px; }
  .osd-volume, .osd-label { display: none; }
  .trailer-tabs { max-width: 60vw; }
}
.row-actions { white-space: nowrap; text-align: right !important; }
.row-actions button { height: 38px; padding: 0 0.85rem; font-size: 0.85rem; vertical-align: middle; margin-left: 6px; }
.row-actions button .i { width: 1.1em; height: 1.1em; }
body.player-open, body:has(.sheet-layer) { overflow: hidden; }
body.player-open .toast { bottom: 8.5rem; }

/* --- twins --- */
.twin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 1rem; }
.twin-card {
  display: flex; flex-direction: column; gap: 0.6rem; padding: 1.1rem 1.2rem; border-radius: 22px; color: var(--text); text-decoration: none;
  background: var(--glass); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur));
  border: 1px solid var(--line); animation: fade-up 0.6s var(--abyss-ease) both;
  transition: transform 0.37s var(--abyss-ease), border-color 0.37s var(--abyss-ease), background 0.37s var(--abyss-ease);
}
.twin-card:hover { border-color: var(--line-strong); background: rgba(var(--abyss-glass-tint), 0.6); }
.twin-card:focus-visible, .twin-card.pad-focus { outline: 3px solid rgb(var(--abyss-accent)); outline-offset: 3px; transform: scale(1.02); }
.twin-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.8rem; }
.twin-head strong { display: block; font-size: 1.1rem; font-weight: 600; }
.twin-head .muted { font-size: 0.85rem; }
.twin-rank { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: rgb(var(--abyss-accent)); color: #121212; }
.twin-sim { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.twin-overlap { margin: 0; color: var(--muted); font-size: 0.9rem; }
.twin-card .chips { margin: 0; }
.twin-open { margin-top: auto; display: inline-flex; align-items: center; gap: 0.3rem; font-weight: 500; color: var(--muted); font-size: 0.9rem; }
.twin-card:hover .twin-open, .twin-card:focus-visible .twin-open { color: var(--text); }
.twin-page { max-width: 1480px; }
.twin-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 1.4rem; align-items: center; margin: 0.5rem 0 1.4rem; }
.twin-hero .spot-title { font-size: clamp(1.8rem, 3vw, 2.6rem); margin-bottom: 12px; }
.twin-hero .meta-pills { margin: 0; }
.histogram { display: grid; grid-template-columns: repeat(11, 18px); gap: 5px; align-items: end; height: 110px; }
.histogram .bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.histogram .bar span { display: block; width: 100%; min-height: 2px; border-radius: 5px 5px 2px 2px; background: linear-gradient(to top, rgba(var(--abyss-accent), 0.35), rgba(var(--abyss-accent), 0.95)); }
.histogram small { font-size: 0.7rem; color: var(--muted); }
.twin-toolbar { gap: 10px 14px; }
.tile-yours { position: absolute; top: 8px; right: 8px; background: rgb(var(--abyss-accent)); color: #121212; border-radius: 8px; padding: 2px 8px; font-weight: 700; font-size: 0.85rem; }
.load-more { display: flex; justify-content: center; margin: 2rem 0 0; }
.load-more button { min-height: 52px; padding: 0 2rem; }
@media (max-width: 760px) {
  .twin-hero { grid-template-columns: auto 1fr; }
  .histogram { grid-column: 1 / -1; grid-template-columns: repeat(11, 1fr); }
  .twin-grid { grid-template-columns: 1fr; }
}

/* --- data science (full screen, only linked from the settings) --- */
.pad-only { display: none; }
body.pad-mode .pad-only { display: inline; }
body.pad-mode .mouse-only { display: none; }
body[data-page="datascience"] .topbar, body[data-page="datascience"] .footer { display: none; }
body[data-page="datascience"] .main { max-width: none; padding: 0; animation: none; }
body.ds-locked { overflow: hidden; }
.ds { position: relative; min-height: 100vh; }
.ds::before { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(90% 70% at 50% 45%, #10141c 0%, #05060a 55%, #000 100%); }
.ds-canvas, .ds-overlay { position: fixed; inset: 0; display: none; }
.ds-3d .ds-canvas, .ds-3d .ds-overlay { display: block; }
.ds-canvas { cursor: grab; touch-action: none; }
.ds-canvas:active { cursor: grabbing; }
.ds-overlay { pointer-events: none; }
.ds-bar {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: 1rem 1.6rem; background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
}
.ds-back { justify-self: start; min-height: 48px; }
.ds-views {
  display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 50px;
  background: rgba(var(--abyss-glass-tint), 0.55); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.ds-views kbd.pad { margin: 0 0.4rem; }
.ds-view { min-height: 44px; padding: 0.5rem 1.35rem; border-radius: 50px; background: transparent; color: rgba(var(--abyss-accent), 0.65); font-weight: 500; border: 0; }
.ds-view:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); box-shadow: none; }
.ds-view[aria-selected="true"] { background: rgb(var(--abyss-accent)); color: #121212; }
.ds-bar-right { justify-self: end; display: flex; gap: 0.5rem; }
.ds-bar-right .icon-btn { min-height: 48px; }
.ds-bar-right .icon-btn[aria-pressed="false"] { opacity: 0.6; }
.ds-info, .ds-legend, .ds-side, .ds-hint { position: fixed; z-index: 10; display: none; }
.ds-3d .ds-info, .ds-3d .ds-legend, .ds-3d .ds-side, .ds-3d .ds-hint { display: block; }
.ds-info { left: 1.6rem; bottom: 4.2rem; width: min(400px, calc(100vw - 3.2rem)); animation: fade-up 0.6s var(--abyss-ease) both; }
.ds-kicker { margin: 0 0 0.3rem; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ds-title { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.4rem; }
.ds-text { margin: 0; font-size: 0.92rem; }
.ds-detail dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0.6rem 0 0; }
.ds-detail dt { color: var(--muted); font-size: 0.9rem; }
.ds-detail dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.ds-action { margin: 0.9rem 0 0; display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9rem; }
.ds-side { top: 5.4rem; left: 1.6rem; right: 1.6rem; display: none; pointer-events: none; }
.ds-3d .ds-side { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.ds-side > * { pointer-events: auto; }
.ds-groups, .ds-genres { display: inline-flex; align-items: center; gap: 2px; padding: 4px; border-radius: 50px; }
.ds-groups kbd.pad, .ds-genres kbd.pad { margin: 0 0.35rem; }
.ds-group { min-height: 42px; padding: 0.4rem 1rem; border-radius: 50px; background: transparent; color: rgba(var(--abyss-accent), 0.7); border: 0; font-weight: 500; }
.ds-group small { color: var(--faint); font-weight: 500; }
.ds-group:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); box-shadow: none; }
.ds-group[aria-checked="true"] { background: rgba(255, 255, 255, 0.92); color: #121212; }
.ds-group[aria-checked="true"] small { color: rgba(0, 0, 0, 0.5); }
.ds-genres span { min-width: 9.5rem; text-align: center; font-weight: 600; }
.ds-genre-step { width: 42px; height: 42px; padding: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.1); color: var(--text); border: 0; }
.ds-genre-step .i { width: 22px; height: 22px; }
.ds-legend { right: 1.6rem; bottom: 4.2rem; padding: 0.9rem 1.1rem; }
.ds-legend ul, .ds-keys { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; font-size: 0.88rem; color: rgba(var(--abyss-accent), 0.85); }
.ds-legend li, .ds-keys li { display: flex; align-items: center; gap: 0.6rem; }
.ds-dot { display: inline-block; width: var(--s); height: var(--s); border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); flex-shrink: 0; margin: 0 calc((16px - var(--s)) / 2); }
.ds-ramp { display: inline-block; width: 44px; height: 10px; border-radius: 5px; background: var(--g); flex-shrink: 0; margin-right: -28px; }
.ds-legend .ds-ramp { margin-right: 0; }
.ds-hint { left: 50%; bottom: 1.2rem; transform: translateX(-50%); margin: 0; color: var(--faint); font-size: 0.85rem; white-space: nowrap; }
.ds-hint kbd { font-family: inherit; font-weight: 700; border-radius: 50px; padding: 0.05em 0.5em; }
.ds-stats { position: relative; z-index: 5; max-width: 1480px; margin: 0 auto; padding: 0.5rem 2.2rem 3rem; animation: fade-up 0.6s var(--abyss-ease) both; }
.ds-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.ds-tiles .ds-tile { background: var(--glass); -webkit-backdrop-filter: blur(var(--abyss-glass-blur)); backdrop-filter: blur(var(--abyss-glass-blur)); border: 1px solid var(--line); border-radius: 20px; padding: 1rem 1.2rem; }
.ds-tile { display: flex; flex-direction: column; gap: 0.15rem; }
.ds-tile-label { color: var(--muted); font-size: 0.85rem; }
.ds-tile strong { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ds-tile .muted { font-size: 0.82rem; }
.ds-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ds-card { outline: none; transition: transform 0.37s var(--abyss-ease), box-shadow 0.37s var(--abyss-ease), border-color 0.37s var(--abyss-ease); }
.ds-card h2 { font-size: 1.2rem; margin-bottom: 0.25rem; }
.ds-sub { margin: 0 0 0.6rem; font-size: 0.86rem; }
.ds-keys { grid-auto-flow: column; justify-content: start; gap: 1.2rem; margin-bottom: 0.4rem; }
.ds-card:focus-visible, .ds-card.pad-focus { border-color: rgba(var(--abyss-accent), 0.7); }
.ds-card.inspecting { border-color: rgb(var(--abyss-accent)); box-shadow: 0 0 0 2px rgba(var(--abyss-accent), 0.4), var(--shadow); }
.ds-card[data-inspect]::after { content: "A: Werte durchgehen · ←/→"; display: none; margin-top: 0.4rem; font-size: 0.8rem; color: var(--faint); }
body.pad-mode .ds-card[data-inspect]:focus::after { display: block; }
body.pad-mode .ds-card.inspecting::after { content: "←/→ Werte · B fertig"; }
.ds-chart { width: 100%; height: auto; display: block; overflow: visible; }
.ds-chart text { fill: rgba(var(--abyss-accent), 0.6); font-size: 12px; font-family: inherit; }
.ds-chart .ax-title { fill: rgba(var(--abyss-accent), 0.45); font-size: 11px; }
.ds-chart .ax-label { fill: rgba(var(--abyss-accent), 0.75); }
.ds-chart .val { fill: rgba(var(--abyss-accent), 0.85); font-size: 11.5px; font-weight: 600; }
.ds-chart .grid { stroke: rgba(255, 255, 255, 0.07); }
.ds-chart .base { stroke: rgba(255, 255, 255, 0.25); }
.ds-chart .ref { stroke: rgba(var(--abyss-accent), 0.6); stroke-dasharray: 3 3; }
.ds-chart .mark { transition: opacity 0.2s, stroke 0.2s; cursor: default; }
.ds-chart:hover .mark:not(:hover):not(.active), .ds-card.inspecting .mark:not(.active) { opacity: 0.45; }
.ds-chart .mark.active, .ds-chart .mark:hover { stroke: #fff; stroke-width: 2; opacity: 1; }
.ds-eval { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; padding-top: 0.6rem; }
.ds-tooltip {
  position: fixed; z-index: 70; pointer-events: none; max-width: 320px; padding: 0.5rem 0.85rem; border-radius: 12px; font-size: 0.86rem; font-weight: 500;
  background: rgba(var(--abyss-glass-tint), 0.9); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
@media (max-width: 1000px) {
  .ds-grid { grid-template-columns: 1fr; }
  .ds-bar { grid-template-columns: auto 1fr; }
  .ds-views { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .ds-side { top: 9rem; }
  .ds-legend { display: none !important; }
}
@media (max-width: 640px) {
  .ds-bar { padding: 0.6rem 0.7rem; }
  .ds-view { padding: 0.4rem 0.8rem; font-size: 0.9rem; }
  .ds-bar-right .icon-btn span, .ds-back span { display: none; }
  .ds-info { left: 0.7rem; right: 0.7rem; bottom: 0.7rem; width: auto; padding: 0.8rem 1rem; }
  .ds-title { font-size: 1.4rem; }
  .ds-hint { display: none !important; }
  .ds-stats { padding: 0.5rem 0.8rem 2rem; }
  .ds-side { left: 0.7rem; right: 0.7rem; }
}

/* --- settings (Abyss glass cards, chips and steppers instead of form controls) --- */
.settings { max-width: 1100px; }
.save-state { margin-left: auto; color: var(--faint); font-size: 0.88rem; padding: 0.35rem 0.9rem; border-radius: 50px; border: 1px solid transparent; transition: color 0.37s var(--abyss-ease), border-color 0.37s var(--abyss-ease); }
.save-state[data-kind="ok"] { color: var(--text); border-color: var(--line); }
.save-state[data-kind="ok"]::before { content: "✓ "; }
.save-state[data-kind="error"] { color: #ff9ec2; border-color: rgba(var(--abyss-pink), 0.6); }
.settings-form { display: grid; gap: 14px; margin-top: 14px; }
.settings-card h2 { font-size: 1.2rem; margin-bottom: 0.2rem; }
.settings-card > p.muted { margin: 0 0 0.9rem; font-size: 0.92rem; }
.queue-stepper { max-width: 360px; }
/* Excluded genres: a checked chip means "hide", so it is struck through in pink instead of white. */
.chips-exclude .chip-toggle input:checked + .chip-face { background: rgba(var(--abyss-pink), 0.22); color: #ffc2d8; border-color: rgba(var(--abyss-pink), 0.7); text-decoration: line-through; }
.chips-exclude .chip-toggle input:checked + .chip-face::before { background: rgb(var(--abyss-pink)); }
.settings-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.settings-split .settings-card { display: flex; flex-direction: column; }
.settings-split .big-action { margin-top: auto; align-self: flex-start; }
.big-action { min-height: 52px; padding: 0.7rem 1.5rem; font-size: 1.02rem; }
.eval-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0.6rem 0 1rem; }
.eval-tiles > p { grid-column: 1 / -1; margin: 0; }
.eval-tile { display: flex; flex-direction: column; background: rgba(0, 0, 0, 0.22); border: 1px solid var(--line); border-radius: 16px; padding: 0.7rem 0.9rem; }
.eval-tile strong { font-size: 2rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.eval-tile .muted { font-size: 0.82rem; }
.ds-entry {
  position: relative; display: grid; grid-template-columns: minmax(180px, 320px) 1fr auto; align-items: center; gap: 1.6rem;
  padding: 1rem 1.6rem 1rem 1rem; text-decoration: none; color: var(--text); overflow: hidden;
  background: radial-gradient(120% 140% at 0% 50%, rgba(51, 140, 237, 0.22), rgba(var(--abyss-glass-tint), 0.42) 60%);
  transition: transform 0.37s var(--abyss-ease), border-color 0.37s var(--abyss-ease), box-shadow 0.37s var(--abyss-ease);
}
.ds-entry:hover, .ds-entry:focus-visible, .ds-entry.pad-focus { transform: scale(1.01); border-color: rgba(var(--abyss-accent), 0.6); box-shadow: 0 0 40px rgba(51, 140, 237, 0.25), var(--shadow); }
.ds-entry-art { width: 100%; height: auto; display: block; border-radius: 16px; background: rgba(0, 0, 0, 0.35); }
.ds-entry-art circle { fill: rgba(245, 245, 247, 0.35); animation: twinkle 4s ease-in-out infinite; }
.ds-entry-art .c1 { fill: #338ced; }
.ds-entry-art .c2 { fill: rgba(138, 143, 152, 0.7); }
.ds-entry-art .c3 { fill: rgba(0, 168, 136, 0.8); }
.ds-entry-art .you { fill: #fff; filter: drop-shadow(0 0 6px #fff); animation: none; }
.ds-entry-text { display: flex; flex-direction: column; gap: 0.25rem; }
.ds-entry-kicker { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: #9dc8f7; }
.ds-entry-text strong { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; }
.ds-entry-text .muted { max-width: 520px; }
.ds-entry-go { width: 56px; height: 56px; }
.ds-entry:hover .ds-entry-go, .ds-entry:focus-visible .ds-entry-go, .ds-entry.pad-focus .ds-entry-go { background: #fff; color: #111; }
body.pad-mode .ds-entry.pad-focus { outline: 3px solid rgb(var(--abyss-accent)); outline-offset: 3px; }
@keyframes twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (max-width: 800px) {
  .settings-split { grid-template-columns: 1fr; }
  .ds-entry { grid-template-columns: 1fr; padding: 1rem; gap: 0.8rem; }
  .ds-entry-go { display: none; }
}

/* Login (only in server mode) */
.login-form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.login-form input { width: 100%; }
.login-error { color: #ff8a80; margin: 0; }
/* --- phones and touch (layout only; controller focus styles above stay untouched) --- */
.tabs { position: relative; }
.grid > p { grid-column: 1 / -1; }
.segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented .chip-face { white-space: nowrap; }
@media (pointer: coarse) {
  /* Comfortable touch targets (at least 44px) where the desktop size is smaller. */
  .tab { min-height: 44px; display: inline-flex; align-items: center; }
  .help summary { padding: 0.6rem 0; }
  .row-actions button, button.small, a.small { min-height: 44px; }
  .dot { position: relative; }
  .dot::after { content: ""; position: absolute; inset: -14px -6px; }
  .sheet-close { width: 48px; height: 48px; }
  .osd-btn { width: 48px; height: 48px; }
  .range { height: 32px; }
  .range::-webkit-slider-thumb { width: 20px; height: 20px; margin-top: -8px; }
  .range::-moz-range-thumb { width: 20px; height: 20px; }
}
@media (max-width: 640px) {
  /* Header: respect notches, fade the tab strip where more tabs are hidden. */
  .topbar { padding-top: max(0.6rem, env(safe-area-inset-top)); padding-left: max(0.7rem, env(safe-area-inset-left)); padding-right: max(0.7rem, env(safe-area-inset-right)); }
  .tabs { width: 100%; justify-self: stretch; scroll-behavior: smooth; overscroll-behavior-x: contain; }
  .tabs.more-right { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
  .tabs.more-left { -webkit-mask-image: linear-gradient(to left, #000 82%, transparent); mask-image: linear-gradient(to left, #000 82%, transparent); }
  .tabs.more-left.more-right { -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent); }
  .main { padding-left: max(0.8rem, env(safe-area-inset-left)); padding-right: max(0.8rem, env(safe-area-inset-right)); }
  .footer { padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
  .toast { bottom: max(1rem, env(safe-area-inset-bottom)); max-width: calc(100vw - 1.6rem); text-align: center; }
  h1 { font-size: 1.7rem; }

  /* Film sheet becomes a bottom sheet with an opaque surface. */
  .sheet-layer { padding: 0; place-items: end stretch; }
  .sheet {
    width: 100%; max-height: 92dvh; border-radius: 24px 24px 0 0; border-bottom: 0;
    background: rgba(28, 28, 30, 0.94); padding-bottom: env(safe-area-inset-bottom);
    animation-name: sheet-up;
  }
  .sheet .spotlight { min-height: 220px; padding-top: 3.6rem; }
  .sheet-actions > * { flex: 1 1 auto; min-height: 48px; }

  /* Filter panels: keep "Zurücksetzen" and "Fertig" reachable at the bottom of the screen. */
  .filters { padding: 1rem 0.9rem 0; border-radius: 20px; }
  .filter-actions {
    position: sticky; bottom: 0; z-index: 2; margin: 1rem -0.9rem 0; padding: 0.8rem 0.9rem max(0.8rem, env(safe-area-inset-bottom));
    background: rgba(28, 28, 30, 0.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-radius: 0 0 20px 20px;
  }
  .filter-actions button { flex: 1; }
  .stepper-grid { grid-template-columns: 1fr; }

  /* "Meine Bewertungen": table rows become compact cards. */
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table, .table tbody { display: block; }
  .table tr {
    display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "thumb title note" "thumb year note" "act act act";
    gap: 0.15rem 0.8rem; align-items: center; padding: 0.75rem 0.85rem; border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .table tr:last-child { border-bottom: 0; }
  .table td { padding: 0; border: 0; }
  .table td:nth-child(1) { grid-area: thumb; align-self: start; }
  .table td:nth-child(2) { grid-area: title; overflow-wrap: anywhere; }
  .table td:nth-child(3) { grid-area: year; color: var(--muted); font-size: 0.88rem; }
  .table td:nth-child(4) { grid-area: note; }
  .table td:nth-child(4) select { min-height: 44px; min-width: 4.2rem; font-size: 1.05rem; }
  .table td.row-actions { grid-area: act; display: flex; gap: 8px; margin-top: 0.5rem; text-align: left !important; }
  .row-actions button { flex: 1; margin: 0; }
  .row-actions .icon-btn span { display: inline; }
  .thumb { width: 48px; height: 72px; }
  .search input { width: 100%; min-height: 46px; }
  .unmatched-search input { min-width: 0; min-height: 46px; }

  /* Twins */
  .twin-card { padding: 1rem; }
  .twin-hero { padding: 1rem; gap: 0.9rem; }
  .twin-hero .btn-round { align-self: start; }
  .twin-toolbar .segmented { flex: 1 1 100%; }

  /* Data science */
  .ds-bar { padding-top: max(0.6rem, env(safe-area-inset-top)); }
  .ds:not(.ds-3d) .ds-bar { background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92) 70%, rgba(0, 0, 0, 0)); }
  .ds-views { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .ds-side { top: calc(8.4rem + env(safe-area-inset-top)); }
  .ds-groups { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .ds-groups::-webkit-scrollbar, .ds-views::-webkit-scrollbar { display: none; }
  .ds-group { white-space: nowrap; padding: 0.4rem 0.8rem; }
  .ds-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .ds-tiles .ds-tile { padding: 0.8rem 0.9rem; border-radius: 16px; }
  .ds-tiles .ds-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .ds-tile strong { font-size: 1.7rem; }
  .ds-card { padding: 1rem; }
  .ds-info { bottom: max(0.7rem, env(safe-area-inset-bottom)); max-height: 38vh; overflow: auto; }

  /* Trailer player: title and source tabs stack in portrait. */
  .player-top { top: max(10px, env(safe-area-inset-top)); flex-wrap: wrap; }
  .player-title { max-width: calc(100vw - 80px); }
  .trailer-tabs { margin-left: 0; max-width: 100%; order: 3; }
  .player-osd { bottom: max(10px, env(safe-area-inset-bottom)); }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
