:root {
  --bg: #111216;
  --bg-2: #1b1d23;
  --bg-3: #262932;
  --fg: #eceef2;
  --muted: #9aa0ad;
  --accent: #f5b942;
  --accent-fg: #1a1406;
  --danger: #ff7a7a;
  --radius: 10px;
  --card-w: 150px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; padding: 16px clamp(16px, 3vw, 40px) 40px; max-width: 1600px; width: 100%; margin: 0 auto; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .3em 0 .4em; }
h2 { font-size: 1.2rem; margin: 0 0 .5em; }
h2 small { font-weight: normal; color: var(--muted); font-size: .8rem; margin-left: .5em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
kbd { background: var(--bg-3); border-radius: 4px; padding: 0 5px; font-size: .8em; }

/* ------------------------------------------------------------ Kopfzeile */
.topbar {
  display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap;
  padding: 10px clamp(16px, 3vw, 40px);
  background: var(--bg-2); border-bottom: 1px solid var(--bg-3);
  position: sticky; top: 0; z-index: 10;
}
.logo { font-weight: 700; font-size: 1.15rem; color: var(--fg); }
.topbar nav { display: flex; gap: 4px 16px; flex-wrap: wrap; flex: 1; }
.topbar nav a { color: var(--fg); opacity: .85; }
.round-switch select { margin-left: 6px; }
button.link { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font: inherit; }

footer { text-align: center; padding: 20px 16px 30px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--bg-3); }
footer a { color: var(--muted); }

/* ------------------------------------------------------------ Formulare */
input, select, button { font: inherit; color: inherit; }
input, select {
  background: var(--bg-3); border: 1px solid #3a3e49; border-radius: 8px; padding: 7px 10px; max-width: 100%;
}
.button, button.button {
  display: inline-block; background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 8px;
  padding: 8px 14px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.button:hover { filter: brightness(1.08); text-decoration: none; }
label { display: block; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin-right: 12px; }
form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.auth { max-width: 380px; margin: 8vh auto; background: var(--bg-2); padding: 28px; border-radius: 14px; }
.auth label { margin: 12px 0; }
.auth input:not([type=checkbox]) { width: 100%; margin-top: 4px; }
.error { color: var(--danger); }

.hint { background: var(--bg-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; }
.hint.strong { background: #2a2416; }
.hint .button { margin-left: 8px; }

/* ------------------------------------------------------------ Filter */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters label { display: inline-flex; gap: 6px; align-items: center; }
.seg { display: inline-flex; background: var(--bg-2); border-radius: 999px; padding: 3px; }
.seg a, .toggle { padding: 5px 14px; border-radius: 999px; color: var(--fg); }
.toggle { background: var(--bg-2); border: 1px solid var(--bg-3); }
.seg a.on, .toggle.on { background: var(--accent); color: var(--accent-fg); text-decoration: none; }

/* ------------------------------------------------------------ Reihen */
.row { margin: 22px 0 8px; }
.strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: var(--card-w); gap: 12px;
  overflow-x: auto; padding-bottom: 10px; scroll-snap-type: x proximity;
}
.strip::-webkit-scrollbar { height: 8px; }
.strip::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 4px; }
.card { scroll-snap-align: start; display: flex; flex-direction: column; }
.poster {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: var(--radius); display: block;
  background: var(--bg-3);
}
.poster.placeholder { display: grid; place-items: center; padding: 10px; text-align: center; color: var(--muted); font-size: .9rem; }
.card-body { padding: 6px 2px 0; display: flex; flex-direction: column; gap: 2px; }
.card-title { color: var(--fg); font-weight: 600; font-size: .9rem; line-height: 1.25; }
.meta { color: var(--muted); font-size: .8rem; }
.imdb { color: var(--accent); }
.reason { font-size: .75rem; color: #b9c2d6; font-style: italic; }

.rate { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.rate button {
  background: var(--bg-2); border: 1px solid transparent; border-radius: 6px; cursor: pointer;
  padding: 2px 5px; font-size: .95rem; line-height: 1.3; opacity: .65;
}
.rate button:hover { opacity: 1; border-color: var(--bg-3); }
.rate button.active { opacity: 1; background: #3b3220; border-color: var(--accent); }

/* ------------------------------------------------------------ Bewerten */
.discover-card {
  display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: 24px;
  background: var(--bg-2); border-radius: 14px; padding: 20px; max-width: 900px;
}
.discover-info h2 { font-size: 1.5rem; margin: 0; }
.genres { display: flex; flex-wrap: wrap; gap: 6px; }
.genres span { background: var(--bg-3); border-radius: 999px; padding: 1px 10px; font-size: .8rem; }
.overview { color: #cfd3dc; max-width: 65ch; }
.big-rate { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0 10px; }
.big-rate button {
  background: var(--bg-3); border: 1px solid #3a3e49; border-radius: 12px; padding: 12px 4px; cursor: pointer;
  font-size: 1.8rem; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.big-rate button small { font-size: .8rem; color: var(--muted); }
.big-rate button:hover { border-color: var(--accent); }
.small-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.small-actions button {
  background: none; border: 1px solid var(--bg-3); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--muted);
}
.small-actions button:hover { color: var(--fg); border-color: #4a4f5c; }
.small-actions .skip { margin-left: auto; color: var(--fg); }

/* ------------------------------------------------------------ Listen, Suche */
.search { width: 100%; max-width: 560px; font-size: 1.1rem; padding: 10px 14px; margin-bottom: 16px; }
.list { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.list-item { display: grid; grid-template-columns: 70px 1fr; gap: 12px; background: var(--bg-2); padding: 10px; border-radius: var(--radius); }
.list-item .poster { border-radius: 6px; }
.list-item .card-title { display: block; }
/* Titel höchstens zwei Zeilen, Originaltitel eine – Bewertungsknöpfe immer unten, in einer Zeile auf gleicher Höhe */
.list-body { display: flex; flex-direction: column; min-width: 0; }
.list-body .card-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.5em;
}
.list-body .other-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-body .rate { margin-top: auto; padding-top: 6px; }

/* ------------------------------------------------------------ Detail */
.detail {
  display: grid; grid-template-columns: minmax(160px, 300px) 1fr; gap: 28px; position: relative;
  padding: 24px; border-radius: 14px; overflow: hidden; isolation: isolate;
}
.detail::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--bg) 30%, rgba(17, 18, 22, .75)), var(--backdrop, none) center / cover;
}
.people { color: #cfd3dc; font-size: .9rem; }
.offers { display: flex; flex-wrap: wrap; gap: 8px; }
.offer { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-2); border: 1px solid var(--bg-3); border-radius: 8px; padding: 4px 10px 4px 4px; font-size: .85rem; }
.offer img { width: 28px; height: 28px; border-radius: 6px; }
.offer.mine { border-color: var(--accent); }
.offer.paid { opacity: .75; }

/* ------------------------------------------------------------ Einstellungen */
.panel { background: var(--bg-2); border-radius: 14px; padding: 18px 20px; margin: 16px 0; max-width: 1000px; }
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; margin-bottom: 14px; }
.provider { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; cursor: pointer; font-size: .85rem; }
.provider:hover { background: var(--bg-3); }
.provider img { width: 26px; height: 26px; border-radius: 6px; }
.provider:has(input:checked) { background: #3b3220; }
.copy { width: 100%; font-family: ui-monospace, monospace; margin-bottom: 12px; }
.legal { max-width: 75ch; }

/* ------------------------------------------------------------ Handy */
@media (max-width: 700px) {
  :root { --card-w: 120px; }
  .topbar nav { order: 3; flex-basis: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .discover-card, .detail { grid-template-columns: 1fr; padding: 14px; }
  .discover-card .poster, .detail .poster { max-width: 220px; margin: 0 auto; }
  .list { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------ Kontext */
.context { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.traits { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; align-items: center; max-width: 420px; font-size: .85rem; }
.bar { height: 6px; border-radius: 3px; background: var(--bg-3); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.button.danger { background: var(--danger); color: #2a0808; }
details summary { cursor: pointer; color: var(--muted); }

/* ------------------------------------------------------------ Raster */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }
.grid-item { position: relative; cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.grid-item input[type=checkbox] { position: absolute; opacity: 0; pointer-events: none; }
.grid-item .poster { transition: transform .1s, outline-color .1s; outline: 3px solid transparent; outline-offset: -3px; }
.grid-item:hover .poster { transform: scale(1.02); }
.grid-item:has(input:checked) .poster { outline-color: var(--accent); filter: brightness(1.05); }
.grid-item:has(input:checked)::after {
  content: "✓"; position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-weight: 700;
}
.grid-item:has(input:focus-visible) .poster { outline-color: var(--fg); }
.grid-title { font-size: .8rem; color: var(--muted); line-height: 1.2; }
.grid-actions {
  position: sticky; bottom: 0; padding: 12px 0; margin-top: 12px; display: flex; gap: 12px; align-items: center;
  background: linear-gradient(transparent, var(--bg) 30%);
}
@media (max-width: 700px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 8px; } }

/* ------------------------------------------------------------ Einrichtung */
.stepper {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 18px; padding: 10px;
  background: var(--bg-2); border: 1px solid var(--bg-3); border-radius: 14px;
}
.step {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px;
  color: var(--fg); font-weight: 600; background: var(--bg-3);
}
.step:hover { text-decoration: none; filter: brightness(1.15); }
.step .num {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bg); font-size: .8rem;
}
.step.done .num { background: #3f8f4f; color: #fff; }
.step.current { background: var(--accent); color: var(--accent-fg); }
.step.current .num { background: var(--accent-fg); color: var(--accent); }
.step.finish { margin-left: auto; background: none; color: var(--accent); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; }
.setup h1 { font-size: 1.8rem; }
.setup-actions { display: flex; gap: 14px; align-items: center; margin: 22px 0; }
.button.big { font-size: 1.1rem; padding: 12px 22px; }
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-width: 900px; }
.logo-choice {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; cursor: pointer;
  background: var(--bg-2); border: 2px solid var(--bg-3); border-radius: 14px; text-align: center; font-size: .9rem;
}
.logo-choice input { position: absolute; opacity: 0; pointer-events: none; }
.logo-choice img { width: 56px; height: 56px; border-radius: 12px; }
.logo-choice:has(input:checked) { border-color: var(--accent); background: #3b3220; }
.logo-choice:has(input:focus-visible) { outline: 2px solid var(--fg); }
.chips { display: flex; flex-wrap: wrap; gap: 10px; max-width: 900px; }
.chip {
  border: 2px solid var(--bg-3); background: var(--bg-2); color: var(--fg); border-radius: 999px;
  padding: 10px 18px; font-size: 1rem; cursor: pointer;
}
.chip.pref1 { border-color: var(--accent); background: #3b3220; }
.chip.pref-1 { border-color: #6b3a3a; background: #2a1a1a; color: var(--muted); text-decoration: line-through; }
.seg.big a { padding: 9px 18px; font-weight: 600; }
details.more { display: inline; }
details.more summary { display: inline; color: var(--accent); cursor: pointer; list-style: none; margin-left: 4px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { display: none; }

/* ------------------------------------------------------------ Bewertungsknöpfe in zwei Zeilen, Toast, Legende */
.rate { flex-direction: column; gap: 3px; }
.rate-row { display: flex; gap: 2px; }
.rate-row button { flex: 1; }
.rate-row.extra button { font-size: .85rem; }
#toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--bg-3); color: var(--fg); border: 1px solid #3a3e49; border-radius: 999px;
  padding: 10px 18px; box-shadow: 0 6px 24px rgba(0, 0, 0, .5); transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px); text-align: center; z-index: 50;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.ask { pointer-events: auto; border-radius: 14px; width: max-content; }
#toast .toast-buttons { display: flex; justify-content: center; gap: 8px; margin-top: 8px; }
#toast button {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--accent); white-space: nowrap;
  background: transparent; color: var(--fg); cursor: pointer; font: inherit;
}
#toast button:hover { background: #3b3220; }
.legend {
  display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: center; font-size: .85rem; color: var(--muted);
  background: var(--bg-2); border-radius: 10px; padding: 8px 12px; margin: 0 0 6px;
}
.legend .link { margin-left: auto; font-size: 1rem; }
.legend[hidden] { display: none; }

/* ------------------------------------------------------------ Filter (eingeklappt) */
.filter-panel { margin-bottom: 12px; }
.filter-panel summary { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; cursor: pointer; }
.filter-panel summary::-webkit-details-marker { display: none; }
.button-ghost { border: 1px solid var(--bg-3); background: var(--bg-2); border-radius: 999px; padding: 6px 14px; font-weight: 600; }
.filter-panel[open] .button-ghost { border-color: var(--accent); }
.active-filter { background: #3b3220; border: 1px solid var(--accent); border-radius: 999px; padding: 3px 10px; font-size: .85rem; }
.reset { font-size: .85rem; }
.filter-form {
  display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 10px; padding: 14px;
  background: var(--bg-2); border-radius: 12px;
}
.filter-form fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.filter-form legend { color: var(--muted); font-size: .8rem; margin-bottom: 4px; padding: 0; }
.filter-form .seg label { padding: 5px 14px; border-radius: 999px; cursor: pointer; }
.filter-form .seg label.on { background: var(--accent); color: var(--accent-fg); }
.filter-form .seg input { position: absolute; opacity: 0; pointer-events: none; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; margin-bottom: 12px; }
.filter-bar .filter-panel { margin-bottom: 0; flex: 1; min-width: 0; }
.kind-switch { font-size: 1.05rem; }
.kind-switch a { padding: 8px 22px; }

/* ------------------------------------------------------------ Profile */
.profile-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-list li { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.button-ghost.small { padding: 5px 12px; font-size: .85rem; cursor: pointer; color: var(--fg); }
.danger-link { color: var(--danger); }
a.offer { color: var(--fg); }
a.offer:hover { text-decoration: none; border-color: var(--accent); background: var(--bg-3); }
.offer .ext { color: var(--accent); margin-left: 2px; }
.admin-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.admin-form input[type=number] { width: 110px; margin-left: 8px; }
