:root {
  --bg: #0b0b0f; --bg2: #15151c; --bg3: #1f1f29; --line: #2a2a36;
  --fg: #f2f2f5; --muted: #9a9aa8; --accent: #e50914;
  --ok: #34c759; --warn: #ffb020; --radius: 10px; --gutter: 16px;
  --card-w: 124px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
body { padding-bottom: 48px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Kopfzeile mit Suche */
#topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top) + 10px) var(--gutter) 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
#brand { font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
#brand .logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); display: inline-block; clip-path: polygon(30% 20%, 30% 80%, 80% 50%); flex: none; }
#searchform { flex: 1; min-width: 0; }
#searchbox { width: 100%; padding: 10px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg2); color: var(--fg); font-size: 15px; outline: none; }
#searchbox:focus { border-color: var(--fg); }
button.icon { background: var(--bg3); border: 0; width: 38px; height: 38px; border-radius: 50%; font-size: 16px; flex: none; }
@media (max-width: 560px) { #brand-text { display: none; } }

main { padding: 0 0 20px; }
.section-title { font-size: 20px; font-weight: 800; margin: 20px var(--gutter) 10px; }
.subtle { color: var(--muted); font-size: 13px; margin: 0 var(--gutter) 12px; }

/* Anbieter-Kacheln */
.providers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 0 var(--gutter); }
.provider { background: var(--bg2); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; border: 1px solid var(--line); transition: transform .12s; }
.provider:active { transform: scale(.97); }
.provider img { width: 60px; height: 60px; border-radius: 14px; object-fit: cover; background: #fff; }
.provider span { font-size: 13px; font-weight: 600; text-align: center; }
.providers.small { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.providers.small .provider img { width: 40px; height: 40px; border-radius: 10px; }
.providers.small .provider span { font-size: 12px; font-weight: 500; }
details.more { margin: 14px var(--gutter) 0; }
details.more summary { color: var(--muted); cursor: pointer; padding: 8px 0; }

/* Anbieter-Kopf */
.hero { display: flex; align-items: center; gap: 14px; padding: 12px var(--gutter) 6px; }
.hero img { width: 52px; height: 52px; border-radius: 12px; background: #fff; }
.hero h1 { margin: 0; font-size: 22px; }
.hero .back { color: var(--muted); font-size: 13px; }

/* Tabs Filme/Serien */
.tabs { display: flex; gap: 6px; padding: 12px var(--gutter) 8px; position: sticky; top: 59px; margin-top: 4px; z-index: 15; background: var(--bg); }
.tabs button { flex: 1; background: var(--bg3); border: 0; padding: 11px; border-radius: 999px; font-weight: 700; }
.tabs button.active { background: var(--fg); color: var(--bg); }
.chips { display: flex; gap: 6px; padding: 2px var(--gutter) 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { white-space: nowrap; background: transparent; border: 1px solid #33333f; color: var(--muted); padding: 6px 12px; border-radius: 999px; font-size: 13px; }
.chips button.active { border-color: var(--fg); color: var(--fg); }

/* Slider-Reihen */
.row { margin: 16px 0 4px; position: relative; }
.row-head { display: flex; align-items: center; gap: 8px; margin: 0 var(--gutter) 8px; }
.row-head a.title { font-size: 16px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; }
.row-head a.title::after { content: "›"; color: var(--muted); font-size: 20px; line-height: 1; }
.row-head a.title:hover, .row-head a.title:active { color: var(--accent); }
.row-head a.title:hover::after { color: var(--accent); }
.row-head small { color: var(--muted); font-size: 12px; }
.row-head .arrows { margin-left: auto; display: flex; gap: 6px; }
.arrow { background: var(--bg3); border: 1px solid var(--line); width: 32px; height: 32px; border-radius: 50%; font-size: 16px; display: flex; align-items: center; justify-content: center; }
.arrow:disabled { opacity: .3; cursor: default; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 2px var(--gutter) 8px; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); scrollbar-width: none; scroll-behavior: smooth; }
.strip::-webkit-scrollbar { display: none; }
.card { flex: 0 0 var(--card-w); scroll-snap-align: start; position: relative; display: block; }
.card .poster { width: var(--card-w); aspect-ratio: 2/3; border-radius: 8px; background: var(--bg3); object-fit: cover; display: block; }
.card .t { font-size: 12px; margin-top: 6px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .y { font-size: 11px; color: var(--muted); }
.card .rank { position: absolute; left: -2px; bottom: 44px; font-size: 44px; font-weight: 900; line-height: 1; color: var(--bg); -webkit-text-stroke: 2px var(--fg); text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.badge { position: absolute; top: 6px; right: 6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #000; }
.badge.s5, .badge.s4 { background: var(--ok); }
.badge.s2, .badge.s3 { background: var(--warn); }
.skeleton .poster { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: .45 } 50% { opacity: 1 } }
.empty-note { color: var(--muted); font-size: 13px; margin: 0 var(--gutter); }

/* Listenseite */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr)); gap: 12px; padding: 10px var(--gutter); }
.grid .card { flex: none; }
.grid .card .poster { width: 100%; }
.center { display: flex; justify-content: center; padding: 16px var(--gutter); }
.btn { border: 0; border-radius: 8px; padding: 12px 18px; font-weight: 700; background: var(--bg3); text-align: center; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.wide { flex: 1; }
.btn:disabled { opacity: .5; cursor: default; }

/* Modal / Detail */
#modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.72); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg2); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 18px 18px 0 0; position: relative; padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
@media (min-width: 700px) { #modal { align-items: center; } .sheet { border-radius: 18px; } }
.sheet .backdrop { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: var(--bg3); display: block; border-radius: 18px 18px 0 0; }
.sheet .close { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); border: 0; border-radius: 50%; width: 34px; height: 34px; font-size: 18px; }
.sheet .body { padding: 14px var(--gutter); }
.sheet h2 { margin: 0 0 4px; font-size: 20px; }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 10px; display: flex; flex-wrap: wrap; gap: 6px 10px; }
.status { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status.s5, .status.s4 { background: var(--ok); color: #000; }
.status.s2, .status.s3 { background: var(--warn); color: #000; }
.status.s1 { background: var(--bg3); color: var(--muted); }
.overview { font-size: 14px; line-height: 1.5; color: #d8d8e0; }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.providers-inline { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.providers-inline img { width: 30px; height: 30px; border-radius: 7px; }

/* Anfrage-Dialog (Staffeln) */
.seasons { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.season { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); font-size: 14px; }
.season:first-child { border-top: 0; background: var(--bg3); font-weight: 700; }
.season input { width: 18px; height: 18px; accent-color: var(--accent); }
.season .st { margin-left: auto; font-size: 12px; }
.season.done { color: var(--muted); }

/* Login / Konto */
.login { max-width: 400px; margin: 40px auto; background: var(--bg2); padding: 22px var(--gutter); border-radius: 14px; border: 1px solid var(--line); }
.login h2 { margin: 0 0 6px; }
.login p { color: var(--muted); font-size: 13px; margin: 0 0 12px; line-height: 1.45; }
.login label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.login input { width: 100%; padding: 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); font-size: 16px; }
.login .btn { width: 100%; margin-top: 16px; }
.login .err { color: #ff6b6b; font-size: 13px; margin-top: 10px; }
.login .switch { background: transparent; border: 0; color: var(--muted); text-decoration: underline; margin-top: 12px; width: 100%; }
.warnbox { background: #2a1d00; color: #ffd27a; border: 1px solid #5a4000; border-radius: 8px; padding: 10px 12px; font-size: 12px; margin-bottom: 12px; line-height: 1.4; }

#toast { position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 600; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.5); max-width: 90vw; text-align: center; }

/* Unterabschnitte im Detail-Dialog (Sammlung, Ähnliche Titel) */
.sub { margin-top: 18px; }
.sub h3 { font-size: 15px; font-weight: 800; margin: 0 0 8px; }
.strip.inset { padding-left: 0; padding-right: 0; margin: 0 calc(-1 * var(--gutter)); padding-left: var(--gutter); padding-right: var(--gutter); scroll-padding-inline: var(--gutter); }
.sheet .card { flex-basis: 104px; }
.sheet .card .poster { width: 104px; }
.card.current .poster { outline: 2px solid var(--accent); outline-offset: -2px; }

.sheet .err { color: #ff6b6b; font-size: 13px; margin-top: 10px; line-height: 1.4; }
.sheet .err:empty { display: none; }
