/* =========================================================
   PileKeeper - Oberflaeche
   Farbwelt: dunkler Raum, Bernstein fuer aktive Slots,
   Jade fuer abgeschlossen, Rose fuer beerdigt.
   ========================================================= */

:root {
  --bg:        #16131F;
  --surface:   #1F1B2B;
  --surface-2: #282237;
  --line:      #382F4C;
  --line-soft: #2C2539;
  --text:      #EDE9F5;
  --muted:     #A79FBC;
  --amber:     #E8A33D;
  --amber-dim: #7A5520;
  --jade:      #5FBF9C;
  --rose:      #C56B84;
  --blue:      #7B9CE8;
  --danger:    #D9544D;

  --font-display: ui-sans-serif, "Segoe UI Semibold", system-ui, -apple-system, sans-serif;
  --font-body:    ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  --r-sm: 6px;
  --r-md: 12px;
  --r-lg: 18px;
  --gap:  1rem;
  --wrap: 1180px;
  --shadow: 0 12px 32px rgba(0,0,0,.35);
}

[data-theme="light"] {
  --bg:        #F4F2F8;
  --surface:   #FFFFFF;
  --surface-2: #EFECF6;
  --line:      #DAD4E6;
  --line-soft: #E6E2EF;
  --text:      #1C1826;
  --muted:     #5F5872;
  --amber-dim: #F3DCB4;
  --shadow: 0 10px 26px rgba(28,24,38,.10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  padding-bottom: 4rem;
}

/* Ambientes Licht im Hintergrund - ruhig, nicht animiert */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(232,163,61,.10), transparent 60%),
    radial-gradient(760px 380px at 92% 4%, rgba(123,156,232,.09), transparent 62%);
  z-index: 0;
}

.wrap { position: relative; z-index: 1; max-width: var(--wrap); margin: 0 auto; padding: 0 1.1rem; }

.skip {
  position: absolute; left: -999px; top: 0; z-index: 50;
  background: var(--amber); color: #1A1206; padding: .6rem 1rem; border-radius: 0 0 var(--r-sm) 0;
}
.skip:focus { left: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Kopfzeile ---------- */

.topbar {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
  max-width: var(--wrap); margin: 0 auto; padding: 1rem 1.1rem 1.1rem;
}

.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); }

/* Markenzeichen: drei Slots, einer belegt */
.brand-mark {
  width: 26px; height: 18px; border-radius: 3px; flex: none;
  background:
    linear-gradient(var(--amber), var(--amber)) left center / 6px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) center center / 6px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) right center / 6px 100% no-repeat;
}

.brand-name { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: 1.12rem; }

.nav { display: flex; gap: .25rem; flex-wrap: wrap; margin-right: auto; }
.nav a {
  color: var(--muted); text-decoration: none; padding: .42rem .7rem; border-radius: var(--r-sm);
  font-size: .93rem;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.is-active { color: var(--text); background: var(--surface); box-shadow: inset 0 -2px 0 var(--amber); }

.topbar-right { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.usermenu { display: flex; flex-direction: column; line-height: 1.25; }
.usermenu-name { color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 600; }
.link-quiet { color: var(--muted); font-size: .82rem; }
a { color: var(--blue); }
a:hover { color: var(--text); }

/* ---------- Warnbanner ---------- */

.banner {
  position: relative; z-index: 1;
  max-width: var(--wrap); margin: 0 auto 1.2rem; padding: 1rem 1.1rem;
  border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface);
}
.banner strong { display: block; font-family: var(--font-display); font-size: 1.05rem; margin-bottom: .3rem; }
.banner p { margin: 0 0 .6rem; color: var(--muted); }
.banner-reasons { margin: 0 0 .8rem; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; }
.banner-critical { border-color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.banner-critical strong { color: var(--danger); }
.banner-warning { border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber); }
.banner-warning strong { color: var(--amber); }

/* ---------- Hero und Abschnitte ---------- */

.hero { padding: 1.6rem 0 1.2rem; }
.hero-tight { padding: 1rem 0 .8rem; }
.hero h1, .card-prose h1 { font-family: var(--font-display); font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.025em; margin: .1rem 0 .35rem; }
.lead { color: var(--muted); margin: 0; max-width: 62ch; }

.eyebrow {
  margin: 0; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--amber); font-weight: 700;
}

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .9rem; }
.section-head h2 { font-family: var(--font-display); font-size: 1.12rem; margin: 0; letter-spacing: -.01em; }
.section-note { margin: 0; color: var(--muted); font-size: .86rem; }

.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-lg);
  padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.card-flush { padding: 1.25rem 0 0; }
.card-flush .section-head, .card-flush .inline-form { padding: 0 1.25rem; }
.card-center { text-align: center; }
.card-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.card-prose { max-width: 760px; }
.card-prose h2 { font-family: var(--font-display); font-size: 1.05rem; margin: 1.4rem 0 .4rem; }
.card-prose p, .card-prose li { color: var(--muted); }
.card-prose ul { padding-left: 1.1rem; }

/* ---------- Slot-Leiste: das Kernstueck ---------- */

.slots { margin-bottom: 1.5rem; }
.slot-rail { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }

.slot {
  display: flex; align-items: center; gap: .75rem; position: relative;
  padding: .85rem .9rem; border-radius: var(--r-md); text-decoration: none; color: var(--text);
  min-height: 84px;
}
.slot-no {
  position: absolute; top: .5rem; right: .7rem;
  font-family: var(--font-mono); font-size: .72rem; color: var(--muted); opacity: .7;
}
.slot-body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.slot-body b { font-size: .96rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-body small { color: var(--muted); font-size: .8rem; }

.slot-filled {
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--amber);
}
.slot-filled:hover { border-color: var(--amber-dim); }

.slot-free {
  border: 1px dashed var(--line); background: transparent;
}
.slot-free .slot-body b { color: var(--muted); font-weight: 600; }
.slot-free:hover { border-color: var(--amber); }

/* ---------- Kennzahlen ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.kpi { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: .85rem .95rem; }
.kpi-label { display: block; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kpi-value { display: block; font-family: var(--font-display); font-size: 1.5rem; font-variant-numeric: tabular-nums; margin-top: .2rem; }

/* ---------- Cover ---------- */

.cover { display: block; object-fit: cover; border-radius: var(--r-sm); background: var(--surface-2); flex: none; }
.cover-xs { width: 34px; height: 46px; }
.cover-sm { width: 44px; height: 60px; }
.cover-md { width: 100%; aspect-ratio: 3 / 4; }
.cover-lg { width: 100%; max-width: 260px; aspect-ratio: 3 / 4; }
.cover-empty {
  display: grid; place-items: center; color: var(--muted);
  font-family: var(--font-display); font-weight: 700; letter-spacing: .04em;
  border: 1px dashed var(--line);
}

/* ---------- Kachelraster ---------- */

.tile-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .9rem; }
.tile a { text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: .4rem; }
.tile-title { font-size: .9rem; font-weight: 600; line-height: 1.3; }
.tile-meta { font-size: .78rem; color: var(--muted); }
.tile a:hover .cover { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- Tabellen ---------- */

.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .65rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table thead th { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.table tbody tr:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .mono { font-family: var(--font-mono); font-size: .82rem; }
.row-off { opacity: .55; }

.cell-title a { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--text); }
.cell-title span { display: flex; flex-direction: column; }
.cell-title small { color: var(--muted); font-weight: 400; font-size: .78rem; }
.cell-actions { text-align: right; white-space: nowrap; }

.bar { display: block; height: 8px; border-radius: 4px; background: var(--surface-2); position: relative; min-width: 60px; }
.bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w, 0%); border-radius: 4px; background: var(--amber); }

/* ---------- Pillen und Chips ---------- */

.pill {
  display: inline-block; padding: .18rem .5rem; border-radius: 999px;
  font-size: .74rem; letter-spacing: .02em; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line-soft); white-space: nowrap;
}
.pill-on { color: var(--jade); border-color: rgba(95,191,156,.35); }
.pill-off { color: var(--muted); }
.pill-medium { text-transform: capitalize; }
.pill-status-spielend { color: var(--amber); border-color: var(--amber-dim); }
.pill-status-durchgespielt { color: var(--jade); border-color: rgba(95,191,156,.35); }
.pill-status-abgebrochen { color: var(--rose); border-color: rgba(197,107,132,.35); }
.pill-drawer-play { color: var(--amber); border-color: var(--amber-dim); }
.pill-drawer-museum { color: var(--blue); border-color: rgba(123,156,232,.35); }
.pill-drawer-buried { color: var(--rose); border-color: rgba(197,107,132,.35); }
.pill-vis-oeffentlich { color: var(--blue); border-color: rgba(123,156,232,.35); }
.pill-src-offiziell { color: var(--jade); border-color: rgba(95,191,156,.35); }
.pill-src-inoffiziell { color: var(--amber); border-color: var(--amber-dim); }
.pill-src-manuell { color: var(--muted); }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; }
.chip { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: 999px; padding: .35rem .8rem; font-size: .86rem; }
.chip b { font-variant-numeric: tabular-nums; }

/* ---------- Bewertung ---------- */

.score { display: inline-flex; align-items: baseline; gap: .1rem; font-variant-numeric: tabular-nums; }
.score b { font-family: var(--font-display); font-size: 1rem; }
.score i { font-style: normal; font-size: .74rem; color: var(--muted); }
.score-hoch b { color: var(--jade); }
.score-mittel b { color: var(--amber); }
.score-niedrig b { color: var(--rose); }
.score-none { color: var(--muted); }

.detail-scores { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1rem 0; }
.scorecard {
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: .6rem .85rem; min-width: 120px; display: flex; flex-direction: column; gap: .1rem;
}
.scorecard-label { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.scorecard-num { font-family: var(--font-display); font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.scorecard small { color: var(--muted); font-size: .76rem; }

.score-preview {
  display: flex; align-items: baseline; gap: .6rem; margin-top: 1rem; padding: .8rem 1rem;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md);
}
.score-preview b { font-family: var(--font-display); font-size: 1.7rem; font-variant-numeric: tabular-nums; color: var(--amber); }
.score-preview small { color: var(--muted); }

.weight-chip {
  display: inline-block; margin-left: .4rem; padding: 0 .38rem; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line-soft);
  font-size: .68rem; color: var(--muted); font-variant-numeric: tabular-nums;
}

/* ---------- Detailansicht ---------- */

.detail { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 1.6rem; margin-bottom: 1.4rem; }
.detail-cover { position: sticky; top: 1rem; align-self: start; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 1.2rem 0; font-size: .92rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.verdict { background: var(--surface-2); border-left: 3px solid var(--amber); border-radius: var(--r-sm); padding: .9rem 1rem; margin: 1.2rem 0; }
.verdict p { margin: .25rem 0; font-size: .92rem; }
.detail-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.4rem; }

/* ---------- Formulare ---------- */

.form { display: block; }
.fs { border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: 1rem 1.1rem 1.2rem; margin: 0 0 1.1rem; background: var(--surface); }
.fs legend { font-family: var(--font-display); font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); padding: 0 .45rem; }
.fs-note { color: var(--muted); font-size: .86rem; margin: 0 0 .9rem; }
.fs-danger { border-color: rgba(217,84,77,.4); background: rgba(217,84,77,.06); border-radius: var(--r-md); padding: 1rem 1.1rem; }
.fs-danger legend { color: var(--danger); }
.disclaimer-text { font-size: .9rem; color: var(--text); margin: 0 0 .8rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem 1.1rem; }
.grid-factors { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.field { margin: 0; display: flex; flex-direction: column; gap: .32rem; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: .84rem; font-weight: 600; color: var(--text); }
.field-hint { font-size: .78rem; color: var(--muted); }
.field-check label { display: flex; align-items: flex-start; gap: .5rem; font-weight: 500; font-size: .9rem; }

input[type="text"], input[type="password"], input[type="email"], input[type="number"],
input[type="date"], input[type="search"], input:not([type]), select, textarea {
  width: 100%; padding: .58rem .7rem; font: inherit; font-size: .92rem;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
textarea { resize: vertical; min-height: 70px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--amber); width: 1.05rem; height: 1.05rem; margin-top: .18rem; flex: none; }

.form-stack { display: flex; flex-direction: column; gap: .95rem; text-align: left; }
.form-stack hr { border: 0; border-top: 1px solid var(--line-soft); margin: .4rem 0; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1rem; }
.inline-form { display: inline-flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0; }

.filterbar {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md);
  padding: .8rem .9rem; margin-bottom: 1.2rem;
}
.filterbar input, .filterbar select { width: auto; min-width: 140px; flex: 1 1 140px; }

.checkgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: .55rem .9rem; }
.checkitem { display: flex; align-items: flex-start; gap: .55rem; font-size: .88rem; }
.checkitem span { display: flex; flex-direction: column; }
.checkitem small { color: var(--muted); font-size: .78rem; }

.preset-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.preset {
  display: flex; flex-direction: column; gap: .2rem; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-md); padding: .8rem .9rem; background: var(--surface-2);
}
.preset input { position: absolute; opacity: 0; }
.preset b { font-size: .95rem; }
.preset small { color: var(--muted); font-size: .8rem; }
.preset.is-active { border-color: var(--amber); box-shadow: inset 0 -2px 0 var(--amber); }

.switch { display: inline-flex; align-items: center; gap: .5rem; font-size: .88rem; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .55rem 1rem; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--muted); color: var(--text); }
.btn-primary { background: var(--amber); border-color: var(--amber); color: #1A1206; }
.btn-primary:hover { filter: brightness(1.08); color: #1A1206; }
.btn-danger { border-color: rgba(217,84,77,.5); color: var(--danger); background: transparent; }
.btn-danger:hover { background: rgba(217,84,77,.12); border-color: var(--danger); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-sm { padding: .34rem .7rem; font-size: .82rem; }
.btn-block { width: 100%; }

/* ---------- Meldungen ---------- */

.flash { border-radius: var(--r-md); padding: .75rem 1rem; margin-bottom: 1rem; font-size: .92rem; border: 1px solid var(--line); background: var(--surface); }
.flash-ok  { border-color: rgba(95,191,156,.45); color: var(--jade); }
.flash-err { border-color: rgba(217,84,77,.5); color: var(--danger); }
.flash-warn{ border-color: var(--amber-dim); color: var(--amber); }

.hint { color: var(--muted); font-size: .86rem; margin: .8rem 0 0; }
.hint-warn { color: var(--amber); }

.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.empty b { color: var(--text); }
.empty p { margin: .35rem 0; }

/* ---------- Entscheidungsliste ---------- */

.card-decide { border-color: var(--amber-dim); }
.decide-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.decide-list li { display: flex; align-items: center; gap: .75rem; padding: .6rem; background: var(--surface-2); border-radius: var(--r-md); }
.decide-body { display: flex; flex-direction: column; min-width: 0; margin-right: auto; }
.decide-body small { color: var(--muted); font-size: .8rem; }

/* ---------- Import und Quellen ---------- */

.source-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.source-head h2 { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 .35rem; }
.source-badges { display: flex; gap: .4rem; margin: 0; flex-wrap: wrap; }
.source-notice { color: var(--muted); font-size: .88rem; margin: .8rem 0; }
.ack { margin: .8rem 0; }
.ack p { font-size: .88rem; margin: 0 0 .6rem; }
.setup { margin-top: .8rem; }
.setup summary { cursor: pointer; font-size: .88rem; color: var(--blue); }
.setup-body {
  white-space: pre-wrap; font-family: var(--font-mono); font-size: .82rem; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-sm); padding: .8rem; margin-top: .6rem;
}

/* ---------- Admin ---------- */

.admin-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.admin-card {
  display: flex; flex-direction: column; gap: .2rem; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: .9rem 1rem;
}
.admin-card:hover { border-color: var(--amber); }
.admin-card small { color: var(--muted); font-size: .82rem; }

.detect-level { font-family: var(--font-display); font-size: 1.05rem; margin: 0 0 .6rem; }
.detect-private { color: var(--jade); }
.detect-public  { color: var(--danger); }
.detect-unknown { color: var(--amber); }
.detect-reasons { margin: 0 0 .6rem; padding-left: 1.1rem; color: var(--muted); font-size: .87rem; }
.codename { color: var(--muted); font-size: .8em; font-weight: 400; }

/* ---------- Kommentare ---------- */

.comment-form { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1.2rem; }
.comment-form-row { display: flex; gap: .55rem; align-items: center; flex-wrap: wrap; }
.comment-form-row label { font-size: .84rem; color: var(--muted); }
.comment-form-row select { width: auto; min-width: 150px; }

.comments { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .9rem; }
.comment { background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md); padding: .8rem .9rem; }
.comment-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; font-size: .78rem; color: var(--muted); }
.comment-edited { font-style: italic; }
.comment-edit { display: flex; flex-direction: column; gap: .5rem; }

/* ---------- Scanner ---------- */

.scan { display: flex; flex-direction: column; gap: 1.1rem; }
.scan-stage {
  position: relative; border-radius: var(--r-lg); overflow: hidden;
  background: #000; border: 1px solid var(--line); aspect-ratio: 4 / 3; max-height: 60vh;
}
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute; inset: 22% 12%; border-radius: var(--r-md);
  border: 2px solid var(--amber); box-shadow: 0 0 0 100vmax rgba(0,0,0,.45);
}
.scan-status {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: .6rem .9rem;
  background: rgba(0,0,0,.65); color: var(--text); font-size: .86rem; text-align: center;
}
.scan-controls { display: flex; gap: .6rem; flex-wrap: wrap; }
.scan-manual summary { cursor: pointer; color: var(--blue); font-size: .9rem; }
.scan-manual-body { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-top: .6rem; }
.scan-manual-body label { font-size: .84rem; color: var(--muted); width: 100%; }
.scan-manual-body input { flex: 1 1 200px; width: auto; }
.scan-defaults { margin: 0; }

.scan-confirm {
  border: 1px solid var(--amber); border-radius: var(--r-lg); padding: 1.1rem;
  background: var(--surface); box-shadow: var(--shadow);
}
.scan-confirm-head h2 { font-family: var(--font-display); font-size: 1.3rem; margin: .2rem 0 .3rem; }
.scan-code { color: var(--muted); font-family: var(--font-mono); font-size: .82rem; margin: 0 0 .8rem; }
.scan-confirm-cover img { max-width: 120px; border-radius: var(--r-sm); }
.scan-confirm-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

.scan-log h2 { font-family: var(--font-display); font-size: 1rem; display: flex; align-items: center; gap: .5rem; }
.scan-count {
  background: var(--amber); color: #1A1206; border-radius: 999px; padding: .05rem .55rem;
  font-size: .8rem; font-variant-numeric: tabular-nums;
}
.scan-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.scan-list li {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem;
  background: var(--surface-2); border-radius: var(--r-sm); font-size: .88rem;
}
.scan-list .ok { color: var(--jade); }
.scan-list .skip { position: static; color: var(--muted); background: none; padding: 0; }

/* ---------- Titelsuche ---------- */

.lookup-results { grid-column: 1 / -1; display: flex; flex-direction: column; gap: .35rem; }
.lookup-item {
  display: flex; align-items: center; gap: .65rem; width: 100%; text-align: left;
  padding: .5rem .65rem; border-radius: var(--r-sm); border: 1px solid var(--line-soft);
  background: var(--surface-2); color: var(--text); cursor: pointer; font: inherit; font-size: .88rem;
}
.lookup-item:hover { border-color: var(--amber); }
.lookup-item small { color: var(--muted); margin-left: auto; font-size: .76rem; }

/* ---------- Installer ---------- */

.install .wrap { padding-top: 3rem; }
.steps-done { color: var(--muted); font-size: .9rem; padding-left: 1.2rem; }

/* ---------- Fuss ---------- */

.foot {
  position: relative; z-index: 1;
  max-width: var(--wrap); margin: 2.5rem auto 0; padding: 1.2rem 1.1rem;
  border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  color: var(--muted); font-size: .82rem;
}
.foot-links { display: flex; gap: 1rem; flex-wrap: wrap; }
.foot-links a { color: var(--muted); }
.foot-links a:hover { color: var(--text); }
.dot { opacity: .5; margin: 0 .2rem; }

/* ---------- Mobil ---------- */

@media (max-width: 760px) {
  .topbar { gap: .7rem; padding-bottom: .8rem; }
  .nav { order: 3; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .2rem; }
  .nav a { white-space: nowrap; }
  .topbar-right { margin-left: auto; }
  .detail { grid-template-columns: 1fr; }
  .detail-cover { position: static; max-width: 180px; }
  .facts { grid-template-columns: 1fr; gap: .1rem; }
  .facts dt { margin-top: .5rem; font-size: .8rem; }
  .table { font-size: .86rem; }
  .table th, .table td { padding: .55rem .6rem; }
  .card { padding: 1rem; border-radius: var(--r-md); }
  .card-flush .section-head { padding: 0 1rem; }
  .scan-stage { aspect-ratio: 3 / 4; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Scanner: Diagnose ---------- */

.scan-diag summary { cursor: pointer; color: var(--blue); font-size: .9rem; }
.scan-diag-body {
  white-space: pre-wrap; font-family: var(--font-mono); font-size: .8rem; color: var(--muted);
  background: var(--bg); border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  padding: .8rem; margin-top: .6rem;
}

/* ---------- Scanner: Bestaetigung auf dem Handy ----------
   Auf kleinen Bildschirmen erscheint die Bestaetigung als feste Leiste am
   unteren Rand. Vorher konnte sie unterhalb des sichtbaren Bereichs landen -
   dann sah es aus, als waere nichts passiert. */

@media (max-width: 760px) {
  .scan-confirm {
    position: fixed;
    left: .6rem; right: .6rem; bottom: .6rem;
    z-index: 40;
    max-height: 72vh; overflow-y: auto;
    padding-bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 40px rgba(0,0,0,.55);
  }
  .scan.has-confirm .scan-log,
  .scan.has-confirm .scan-diag { padding-bottom: 40vh; }
  .scan-confirm-actions .btn { flex: 1 1 auto; }
}

/* ---------- Scanner: Zoom ---------- */

.scan-zoom { gap: .4rem; }
.scan-zoom input[type="range"] { width: 100%; accent-color: var(--amber); }

/* ---------- Import: Formular je Quelle ---------- */

.source-form { margin-top: 1rem; max-width: 560px; }
.source-form input { font-family: var(--font-mono); font-size: .88rem; }

/* ---------- Scanner: dauerhafte Meldungszeile ----------
   Wichtige Meldungen standen frueher nur im Videobild und wurden dort von der
   laufenden Anzeige sofort ueberschrieben. Hier bleiben sie lesbar stehen. */

.scan-message {
  margin: 0;
  padding: .7rem .9rem;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: .9rem;
  line-height: 1.45;
}
.scan-message-ok   { border-color: rgba(95,191,156,.45); color: var(--jade); }
.scan-message-err  { border-color: rgba(217,84,77,.5);  color: var(--danger); }
.scan-message-info { border-color: var(--line); color: var(--text); }

/* ---------- Sammlung: Mehrfachauswahl ---------- */

.cell-check { width: 2.4rem; text-align: center; }
.table-select tbody tr.is-selected { background: rgba(232,163,61,.10); }
.table-select tbody tr.is-selected th[scope="row"] { box-shadow: inset 3px 0 0 var(--amber); }

.bulkbar {
  position: sticky; top: .5rem; z-index: 20;
  background: var(--surface); border: 1px solid var(--amber); border-radius: var(--r-lg);
  padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.bulkbar-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.bulkbar-head b { font-family: var(--font-display); font-size: 1rem; }
.bulkbar-note { margin: .3rem 0 .9rem; color: var(--muted); font-size: .84rem; }
.bulkbar-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .8rem 1rem; }
.bulkbar-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }

button.link-quiet {
  background: none; border: 0; padding: 0; font: inherit; font-size: .82rem;
  color: var(--muted); cursor: pointer; text-decoration: underline;
}
button.link-quiet:hover { color: var(--text); }

.cell-actions a, .cell-actions button { margin-left: .6rem; }

.copybox { margin-top: 1rem; }

@media (max-width: 760px) {
  .bulkbar { position: static; }
  .bulkbar-fields { grid-template-columns: 1fr; }
}

/* ---------- Scanner: Trefferauswahl ---------- */

.confirm-choices { margin: .8rem 0; }
.choice {
  display: flex; align-items: center; gap: .7rem; width: 100%; text-align: left;
  padding: .55rem .7rem; margin-bottom: .35rem;
  border: 1px solid var(--line-soft); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer;
}
.choice:hover, .choice.is-active { border-color: var(--amber); }
.choice-body { display: flex; flex-direction: column; min-width: 0; }
.choice-body b { font-weight: 600; }
.choice-body small { color: var(--muted); font-size: .76rem; }
.choice-badge {
  margin-left: auto; font-size: .7rem; color: var(--muted);
  border: 1px solid var(--line-soft); border-radius: 999px; padding: .1rem .45rem; white-space: nowrap;
}

/* ---------- Admin: Verbindungstest ---------- */

.igdb-test {
  margin: .9rem 0; padding: .8rem .9rem;
  background: var(--surface-2); border: 1px solid var(--line-soft); border-radius: var(--r-md);
}
.igdb-test .hint { margin-top: .6rem; }

/* ---------- Startseite: Abgleich ---------- */

.syncbar-row { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }
.syncbar-item { display: flex; flex-direction: column; gap: .35rem; margin: 0; }
.syncbar-item small { color: var(--muted); font-size: .78rem; }
.syncbar-settings { margin-left: auto; align-self: center; }

@media (max-width: 760px) {
  .syncbar-row { flex-direction: column; }
  .syncbar-item { width: 100%; }
  .syncbar-item .btn { width: 100%; }
  .syncbar-settings { margin-left: 0; }
}
