:root {
  --bg: #f6f7f5; --card: #ffffff; --text: #1d2420; --muted: #66706b; --line: #dfe3e0;
  --accent: #1f6f5c; --accent-text: #ffffff; --danger: #b3261e; --owned: #e7f3ee;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121614; --card: #1c211f; --text: #e8ece9; --muted: #9aa49f; --line: #2c3330;
          --accent: #3fa58a; --accent-text: #0b1210; --danger: #f2817a; --owned: #1f3029; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
       background: var(--bg); color: var(--text); padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
header { position: sticky; top: 0; z-index: 2; display: flex; align-items: baseline; justify-content: space-between;
         padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 18px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 18px 0 6px; }
main { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 13px; } .err { color: var(--danger); }
input, select, textarea, button, .button {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; }
button, .button { width: auto; cursor: pointer; display: inline-block; text-align: center; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.danger { color: var(--danger); }
.big { padding: 14px 28px; font-size: 18px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 0; }
label input, label select, label textarea { margin-top: 4px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { border: 0; padding: 0; margin: 12px 0 0; display: flex; gap: 18px; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--text); margin: 0; }
.checks input { width: auto; margin: 0; }
.toolbar { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin: 12px 0; }
.card, .hit { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
              padding: 10px 12px; margin: 6px 0; cursor: pointer; }
.card .t { font-weight: 600; } .card .s { font-size: 13px; color: var(--muted); }
.hit.owned, .owned { background: var(--owned); }
.tabs { display: flex; gap: 6px; margin: 12px 0; }
.tab { flex: 1; } .tab.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.camwrap { position: relative; border-radius: 14px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; }
video { width: 100%; height: 100%; object-fit: cover; display: block; }
#frame { position: absolute; inset: 18% 12%; border: 2px solid rgba(255,255,255,.8); border-radius: 12px; pointer-events: none; }
.busy { display: flex; gap: 12px; align-items: center; }
.busy img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 6px; background: var(--card);
      border-top: 1px solid var(--line); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
nav button { flex: 1; border: 0; background: transparent; }
nav button.active { background: var(--accent); color: var(--accent-text); }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }
.card { display: flex; gap: 12px; align-items: center; }
.thumb { width: 48px; height: 48px; flex: none; object-fit: contain; border-radius: 6px; background: var(--line); }
.coverrow { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
#coverPrev { width: 96px; height: 96px; object-fit: contain; border-radius: 8px; background: var(--line); }

.center { text-align: center; }
.searchbar { margin: 12px 0; }
.ghost { border: 0; background: transparent; color: var(--accent); padding: 6px 0; font-weight: 600; }
.listhead { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.listhead h2 { margin: 0; font-size: 20px; }
.consoles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 8px 0 16px; }
.console { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 12px;
           text-align: center; cursor: pointer; transition: transform .1s; }
.console:active { transform: scale(.97); }
.cimg { height: 96px; display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.cimg img { max-width: 100%; max-height: 96px; object-fit: contain; }
.cimg span { font-weight: 700; color: var(--muted); }
.cname { font-weight: 700; }
.ccount { color: var(--muted); font-size: 14px; }
.covers { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; margin: 8px 0 16px; }
.cover { cursor: pointer; }
.cover img, .nocover { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px;
                       background: var(--line); box-shadow: 0 2px 6px rgba(0,0,0,.18); display: block; }
.nocover { display: flex; align-items: center; justify-content: center; text-align: center; padding: 8px;
           font-size: 13px; color: var(--muted); }
.ct { font-size: 13px; margin-top: 6px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2;
      -webkit-box-orient: vertical; overflow: hidden; }
.console, .cover { min-width: 0; }
.cimg img { width: auto; height: auto; max-width: 100%; max-height: 96px; border-radius: 8px; }
html, body { overflow-x: hidden; }
a { color: var(--accent); }
.cover img { aspect-ratio: 1 / 1; object-fit: contain; background: transparent; box-shadow: none; }
.cover img { filter: drop-shadow(0 2px 4px rgba(0,0,0,.35)); }
.nocover { aspect-ratio: 1 / 1; }
.covers { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); align-items: end; }
.cover img { aspect-ratio: auto; height: auto; }

.added { display: flex; gap: 14px; align-items: center; background: var(--owned); border-radius: 12px; padding: 12px; margin-top: 10px; }
.added img { width: 72px; height: 72px; object-fit: contain; }
.added .ok { color: var(--accent); font-weight: 700; }

.console.all { border-color: var(--accent); }
.allpad { width: 150px; max-width: 100%; height: 90px; color: var(--accent); }
.cp { font-size: 12px; color: var(--muted); }

/* Detailseite */
.grow { flex: 1; }
.dcover { display: flex; justify-content: center; margin: 12px 0 4px; }
.dcover img { width: min(72vw, 340px); max-height: 62vh; object-fit: contain; height: auto; border-radius: 8px;
              filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); }
.dcover .nocover { width: 240px; }
.dtitle { text-align: center; font-size: 22px; margin: 14px 0 2px; }
.dmeta { text-align: center; margin: 0 0 14px; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip { border-radius: 999px; padding: 8px 16px; color: var(--muted); }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.dinfo { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; background: var(--card);
         border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 16px 0; }
.dinfo dt { color: var(--muted); } .dinfo dd { margin: 0; overflow-wrap: anywhere; }
.dnotes { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; white-space: pre-wrap; }

/* Statistik */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 8px 0; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tv { font-size: 28px; font-weight: 700; line-height: 1.1; }
.tl { color: var(--muted); font-size: 13px; }
.bars { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.brow { display: grid; grid-template-columns: minmax(90px, 38%) 1fr; gap: 10px; align-items: center;
        padding: 5px 0; cursor: pointer; border-radius: 6px; }
.brow:hover .bar, .brow:focus .bar { filter: brightness(1.15); }
.blabel { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btrack { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bar { height: 16px; background: var(--accent); border-radius: 0 4px 4px 0; }
.bval { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.cols { display: flex; align-items: flex-end; gap: 2px; height: 170px; background: var(--card);
        border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px 8px; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.cbar { width: 70%; max-width: 40px; background: var(--accent); border-radius: 4px 4px 0 0; }
.col:hover .cbar, .col:focus .cbar { filter: brightness(1.15); }
.cval { font-size: 13px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.clabel { font-size: 12px; color: var(--muted); margin-top: 6px; border-top: 1px solid var(--line); width: 100%;
          text-align: center; padding-top: 4px; }
.stack { display: flex; gap: 2px; height: 22px; border-radius: 4px; overflow: hidden; }
.seg { min-width: 4px; }
.s1 { background: var(--accent); }
.s2 { background: color-mix(in srgb, var(--accent) 55%, var(--card)); }
.s3 { background: color-mix(in srgb, var(--accent) 25%, var(--card)); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 0 16px; font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 5; background: var(--text); color: var(--bg); font-size: 13px; padding: 5px 9px;
       border-radius: 6px; pointer-events: none; white-space: nowrap; }
nav button { padding-left: 4px; padding-right: 4px; }

/* Sammlungsfortschritt */
.prow { padding: 8px 0; cursor: pointer; border-bottom: 1px solid var(--line); }
.prow:last-child { border-bottom: 0; }
.phead { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.pnum { font-variant-numeric: tabular-nums; }
.ptrack { height: 10px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 14%, var(--card)); margin: 6px 0 4px; overflow: hidden; }
.pfill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.prow:hover .pfill, .prow:focus .pfill { filter: brightness(1.15); }
.linkbtn { border: 0; background: none; padding: 0 0 0 6px; color: var(--accent); font-size: 13px; }

/* Serienmodus */
.round { font-weight: 600; color: var(--accent); margin: 8px 0 0; min-height: 1em; }
#queue { margin-top: 6px; }
.job { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line);
       border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.job > img, .jimg { width: 52px; height: 52px; flex: none; border-radius: 6px; object-fit: cover; background: var(--line); }
.jimg { display: flex; align-items: center; justify-content: center; overflow: hidden; }
.jimg img { width: 100%; height: 100%; object-fit: contain; }
.jimg.q { font-size: 24px; font-weight: 700; color: var(--muted); }
.jt { flex: 1; min-width: 0; cursor: pointer; }
.jt .ok { color: var(--accent); font-weight: 700; }
.jx { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 6px 8px; }
.jopts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.jopts button { padding: 6px 10px; font-size: 14px; }
.jhead { margin: 12px 0 0; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent);
        border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
#frame.flash { background: rgba(255,255,255,.35); }

/* Cover-Auswahl */
#coverPrev { cursor: pointer; }
.picker { background: var(--card); border: 1px solid var(--accent); border-radius: 12px; padding: 12px; margin: 12px 0; }
.pickhead { display: flex; justify-content: space-between; align-items: center; }
.pickbar { display: flex; gap: 8px; margin: 8px 0 4px; }
.pickbar input { flex: 1; }
.pickgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin: 10px 0; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; min-width: 0; }
.pick img { width: 100%; height: 110px; object-fit: contain; }
.pick span { font-size: 12px; font-weight: 600; color: var(--accent); }
.pick small { font-size: 11px; color: var(--muted); width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dcover { cursor: pointer; }

/* Ansicht umschalten */
.vswitch { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; flex: none; }
.vbtn { border: 0; border-radius: 0; padding: 7px 10px; background: var(--card); color: var(--muted); line-height: 0; }
.vbtn svg { width: 18px; height: 18px; fill: currentColor; }
.vbtn.on { background: var(--accent); color: var(--accent-text); }
.cm { display: none; }
.covers.listview { display: block; }
.covers.listview .cover { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto auto;
  column-gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.covers.listview .cover > img, .covers.listview .nocover { grid-row: 1 / span 3; width: 56px; height: 56px;
  aspect-ratio: auto; object-fit: contain; filter: none; font-size: 0; }
.covers.listview .ct { margin: 0; font-size: 16px; -webkit-line-clamp: 2; }
.covers.listview .cp, .covers.listview .cm { display: block; font-size: 13px; color: var(--muted); }
.covers.listview .cm:empty { display: none; }
