:root {
  --bg: #12151d; --panel: #1b1f2a; --panel2: #242a38; --text: #eef1f7; --muted: #8d96aa;
  --accent: #ffcb05; --accent2: #3d7dca; --good: #4cc38a; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
/* App-shell: kop boven, tabs onder, alleen de inhoud scrolt. Zo staan de tabs altijd in beeld,
   ook als de browserbalk in- of uitklapt. */
html, body { height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
body > .top, body > .tabs { flex: none; }
.top { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--panel); border-bottom: 1px solid #2c3343; }
.top h1 { margin: 0; font-size: 1.25rem; letter-spacing: .3px; }
.game-pill { width: auto; max-width: 45vw; flex: none; background: var(--accent); color: #222; font-weight: 700; font-size: .75rem; padding: 4px 10px; border-radius: 99px; }
main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  width: 100%; padding: 16px max(16px, calc((100% - 1068px) / 2)); }
.view { display: none; } .view.active { display: block; }
.muted { color: var(--muted); }
input, select, button { font: inherit; color: var(--text); }
input, select { background: var(--panel2); border: 1px solid #333b4e; border-radius: 10px; padding: 10px 12px; }
button { background: var(--accent2); border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 600; cursor: pointer; }
button.secondary { background: var(--panel2); border: 1px solid #333b4e; }
button:disabled { opacity: .5; }
.search { display: flex; gap: 8px; } .search input { flex: 1; min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; } .toolbar input { flex: 1; min-width: 160px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 8px; cursor: pointer; position: relative;
  border: 1px solid transparent; transition: border-color .15s; }
.card:hover { border-color: #3a4357; }
.card img { width: 100%; aspect-ratio: 63/88; object-fit: cover; border-radius: 8px; background: var(--panel2); display: block; }
.card .name { font-weight: 600; font-size: .9rem; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: .75rem; color: var(--muted); }
.card .price { font-size: .85rem; color: var(--accent); font-weight: 700; }
.badge { position: absolute; top: 12px; right: 12px; background: var(--good); color: #062; font-weight: 800;
  font-size: .8rem; border-radius: 99px; padding: 2px 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--panel); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 1.3rem; } .stat span { font-size: .75rem; color: var(--muted); }
.tabs { position: relative; display: flex; background: var(--panel); border-top: 1px solid #2c3343;
  padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabs button { flex: 1; background: none; border-radius: 0; padding: 10px 0 8px; font-size: 1.2rem; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tabs button span { font-size: .7rem; } .tabs button.active { color: var(--accent); }
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 760px; width: calc(100% - 24px); }
dialog::backdrop { background: rgba(0,0,0,.65); }
.dlg { background: var(--panel); border-radius: 18px; padding: 16px; position: relative; max-height: 90vh; overflow: auto; }
.close { position: absolute; top: 8px; right: 8px; background: var(--panel2); width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 1.3rem; }
.detail { display: grid; grid-template-columns: minmax(0, 260px) 1fr; gap: 16px; }
.detail img { width: 100%; border-radius: 12px; }
@media (max-width: 560px) { .detail { grid-template-columns: 1fr; } .detail img { max-width: 260px; margin: 0 auto; display: block; } }
.detail h2 { margin: 0 0 4px; }
.prices { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .9rem; }
.prices td { padding: 6px 4px; border-bottom: 1px solid #2c3343; } .prices td:last-child { text-align: right; font-weight: 700; }
.variant-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #2c3343; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 36px; height: 36px; padding: 0; font-size: 1.2rem; }
.stepper output { min-width: 24px; text-align: center; font-weight: 700; }
.filebtn { display: inline-block; background: var(--panel2); border: 1px solid #333b4e; border-radius: 10px; padding: 10px 14px; font-weight: 600; cursor: pointer; margin-top: 8px; }
a { color: var(--accent2); }
h2 { font-size: 1.1rem; }
/* sets */
.era { margin: 20px 0 28px; }
.era-title { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #2c3343; padding-bottom: 8px; }
.era-title img { height: 28px; max-width: 90px; object-fit: contain; }
.era-title small { margin-left: auto; font-weight: 500; font-size: .8rem; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.set-tile { background: var(--panel); border: 1px solid #2c3343; border-radius: var(--radius); padding: 10px; text-align: left;
  display: flex; flex-direction: column; gap: 6px; font-weight: 400; }
.set-tile.empty { opacity: .6; }
.set-logo { height: 56px; display: flex; align-items: center; justify-content: center; font-weight: 700; text-align: center; font-size: .85rem; }
.set-logo img { max-height: 56px; max-width: 100%; object-fit: contain; }
.set-name { font-size: .8rem; display: flex; align-items: center; gap: 6px; min-height: 2.2em; }
.set-name .sym { height: 16px; width: 16px; object-fit: contain; flex: none; }
.set-count { font-size: .8rem; color: var(--muted); } .set-count b { color: var(--text); }
.bar { height: 6px; background: var(--panel2); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--good); }
.bar.big { height: 10px; margin: 8px 0 6px; max-width: 420px; }
.set-head { display: flex; gap: 16px; align-items: center; margin: 14px 0; flex-wrap: wrap; }
.set-head h2 { margin: 0; }
.set-head-logo { max-height: 70px; max-width: 180px; object-fit: contain; }
/* ontbrekende kaarten: drie weergaven (instelbaar in de setweergave) */
.card.owned { border: 2px solid color-mix(in srgb, var(--good) 55%, transparent); }
.miss-tag { display: none; }
/* 1. vervaagd + rode band */
body[data-miss="ribbon"] .card.missing img { opacity: .38; }
body[data-miss="ribbon"] .card.missing .name { color: var(--muted); }
body[data-miss="ribbon"] .card.missing .miss-tag { display: block; position: absolute; left: 8px; right: 8px; top: 38%;
  background: rgba(198, 40, 40, .92); color: #fff; text-align: center; font-weight: 900; font-size: .85rem; letter-spacing: 2px;
  padding: 5px 0; border-radius: 4px; text-transform: uppercase; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
/* 2. rode rand */
body[data-miss="border"] .card.missing { border: 3px solid #e53935; background: color-mix(in srgb, #e53935 12%, var(--panel)); }
body[data-miss="border"] .card.missing .miss-tag { display: block; position: absolute; top: 12px; right: 12px; background: #e53935; color: #fff;
  font-weight: 800; font-size: .7rem; border-radius: 99px; padding: 2px 8px; text-transform: uppercase; }
/* 3. grijs */
body[data-miss="gray"] .card.missing img { filter: grayscale(1); opacity: .45; }
body[data-miss="gray"] .card.missing .name { color: var(--muted); }
.tabs button span { white-space: nowrap; }
.prices td + td { text-align: right; font-weight: 700; }
.prices tr.muted td { font-weight: 500; font-size: .75rem; }
.warn { background: #3a2f12; border: 1px solid #6b5418; border-radius: 10px; padding: 8px 10px; font-size: .85rem; }
/* scannen */
.scan-wrap { position: relative; width: 100%; max-width: 480px; margin: 0 auto; aspect-ratio: 3/4; background: #000; border-radius: var(--radius); overflow: hidden; }
.scan-wrap video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; left: 50%; top: 50%; width: 72%; aspect-ratio: 63/88; transform: translate(-50%, -50%);
  border: 3px solid var(--accent); border-radius: 12px; box-shadow: 0 0 0 999px rgba(0,0,0,.45); display: flex; align-items: flex-end; justify-content: center; }
.scan-frame span { font-size: .75rem; background: rgba(0,0,0,.6); padding: 3px 8px; border-radius: 99px; margin-bottom: -28px; white-space: nowrap; }
.scan-actions { justify-content: center; margin-top: 16px; } .scan-actions button { min-width: 130px; }
#scan-manual { max-width: 480px; margin: 0 auto; }
.score { position: absolute; top: 12px; left: 12px; background: var(--accent); color: #222; font-weight: 800; font-size: .7rem; border-radius: 99px; padding: 2px 7px; }
/* era-banners */
.era-chips { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 10px; scrollbar-width: none; position: sticky; top: -16px; z-index: 4; background: var(--bg); }
.era-chip { flex: none; background: var(--panel); border: 1px solid var(--era); color: var(--text); font-size: .75rem; padding: 6px 10px; border-radius: 99px; font-weight: 600; }
.era { margin: 14px 0; border-radius: 18px; background: color-mix(in srgb, var(--era) 10%, var(--bg)); border: 1px solid color-mix(in srgb, var(--era) 35%, transparent); overflow: hidden; scroll-margin-top: 50px; }
.era-banner { position: relative; width: 100%; min-height: 96px; display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 0;
  background-size: cover; background-position: center; text-align: left; color: #fff; }
.era-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.55), rgba(0,0,0,.15)); pointer-events: none; }
.era-logo { position: relative; height: 54px; max-width: 110px; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
.era-text { position: relative; flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.era-name { font-size: 1.15rem; font-weight: 800; text-shadow: 0 1px 3px rgba(0,0,0,.7); }
.era-sub { font-size: .78rem; opacity: .9; }
.era-text .bar { max-width: 260px; background: rgba(255,255,255,.25); }
.era-chev { position: relative; font-size: 1.3rem; transition: transform .2s; }
.era.open .era-chev { transform: rotate(180deg); }
.era .set-grid { padding: 0 12px; margin: 0; }
.era.open .set-grid { padding: 12px; }
.era .set-tile { border-color: color-mix(in srgb, var(--era) 30%, #2c3343); }
.era .bar span { background: var(--good); }
/* kast */
.billy { background: linear-gradient(#f3efe7, #e7e1d6); border: 10px solid #ece6db; border-radius: 6px; padding: 0 8px; max-width: 520px; margin: 12px auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.45), inset 0 0 0 1px #d6cfc2; }
.plank { display: flex; align-items: flex-end; gap: 3px; min-height: 150px; padding: 10px 4px 0; border-bottom: 12px solid #ddd5c7; overflow-x: auto; }
.plank:last-child { border-bottom-width: 14px; }
.plank-empty { color: #a69f92; font-size: .75rem; margin: auto; }
.spine { flex: none; width: 34px; height: 136px; padding: 6px 0; border-radius: 4px 4px 2px 2px; border: 1px solid rgba(0,0,0,.35);
  box-shadow: inset -4px 0 6px rgba(0,0,0,.25), inset 3px 0 4px rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-weight: 700; }
.spine span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-height: 120px; }
.spine.sel { outline: 3px solid var(--accent); outline-offset: 1px; transform: translateY(-6px); }
.spine.glow { animation: glow 1s ease-in-out infinite alternate; transform: translateY(-6px); }
@keyframes glow { from { box-shadow: 0 0 0 3px var(--accent), 0 0 10px var(--accent); } to { box-shadow: 0 0 0 3px #fff, 0 0 22px var(--accent); } }
#shelf-hint { font-size: .85rem; }
label.inline { display: inline-flex; align-items: center; gap: 6px; margin: 6px 12px 6px 0; }
#shelf-count { width: 64px; }
.binder-card { background: var(--panel); border-radius: var(--radius); padding: 14px; border-left: 6px solid var(--bc); margin-top: 12px; }
.binder-head { display: flex; gap: 10px; align-items: center; } .binder-head input { flex: 1; font-weight: 700; font-size: 1.05rem; }
.binder-card h3 { font-size: .95rem; margin: 16px 0 6px; }
.binder-sets { padding-left: 20px; margin: 0 0 8px; } .binder-sets li { padding: 6px 0; border-bottom: 1px solid #2c3343; display: flex; align-items: center; gap: 8px; }
.binder-sets .linkish { flex: 1; }
.linkish { background: none; padding: 0; color: var(--text); font-weight: 600; text-align: left; }
.row-btns { display: flex; gap: 4px; } .mini { width: 30px; height: 30px; padding: 0; background: var(--panel2); font-size: .85rem; }
.setpick { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; } .setpick button { text-align: left; font-weight: 500; }
#bp-addset { width: 100%; margin-top: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 2px solid #444b5c; display: inline-block; }
.swatch.on { outline: 3px solid var(--accent); outline-offset: 2px; } .swatch.big { width: 36px; height: 36px; flex: none; }
.swatch.custom { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; overflow: hidden; cursor: pointer; }
.swatch.custom input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.danger { background: #8e2020; margin-top: 14px; }
.loc-chip { display: inline-block; margin: 8px 0 4px; background: var(--panel2); border: 1px solid var(--bc, #333b4e); border-left: 6px solid var(--bc, #333b4e); font-size: .85rem; font-weight: 600; text-align: left; }
.tabs button { font-size: 1.1rem; } .tabs button span { font-size: .62rem; }
.set-complete { margin: 10px 0 0; } .set-complete button { font-size: .85rem; }
#mark-status .linkish { color: var(--accent); text-decoration: underline; }
select.game-pill { border: 0; appearance: none; -webkit-appearance: none; padding: 6px 28px 6px 12px; cursor: pointer;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23222'/%3E%3C/svg%3E") no-repeat right 10px center; }
body[data-game="lorcana"] { --accent: #d4af37; }
body[data-game="riftbound"] { --accent: #c89b3c; }
.batch-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 10px 12px; margin: 6px 0; }
body[data-game="mythos"] { --accent: #ff8f00; }
#cam-controls { margin-top: 10px; } #cam-controls input[type=range] { width: 140px; }
.scan-wrap { cursor: crosshair; }
.focus-dot { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border: 2px solid var(--accent); border-radius: 50%; pointer-events: none; animation: fdot .7s ease-out forwards; }
@keyframes fdot { from { transform: scale(1.4); opacity: 1; } to { transform: scale(.8); opacity: 0; } }
.swatch-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; } .swatch-row > .muted { width: 92px; flex: none; font-size: .75rem; }
.swatch-row .swatch { width: 28px; height: 28px; }
.binder-title { flex: 1; font-size: 1.05rem; }
.binder-sets li .muted { margin-left: auto; }
/* 15 mappen per plank: vaste vakken, mappen schalen mee met de schermbreedte */
.billy { max-width: 640px; }
.plank { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 2px; overflow: visible; align-items: end; }
.plank .spine { width: 100%; min-width: 0; padding: 6px 0; }
.plank .spine span { font-size: clamp(.5rem, 2.4vw, .72rem); }
.plank-empty { grid-column: 1 / -1; text-align: center; align-self: center; }
body[data-game="onepiece"] { --accent: #e53935; }
/* thema-pagina's */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { background: var(--panel); border: 1px solid #333b4e; font-weight: 500; font-size: .8rem; padding: 6px 10px; border-radius: 99px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--accent); color: #222; border-color: var(--accent); font-weight: 700; }
.chip .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); }
.binder-page { display: grid; grid-template-columns: repeat(var(--cols, 4), 1fr); gap: 6px; background: #1a1d26; border: 2px solid #2c3343; border-radius: 12px; padding: 10px; max-width: 560px; margin: 12px auto; }
.slot { position: relative; aspect-ratio: 63/88; background: #232838; border: 2px dashed #3a4357; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot.picking { outline: 3px solid var(--accent); }
.slot-empty { color: #5c6680; font-size: 1.6rem; }
.slot .lock { position: absolute; bottom: 4px; right: 4px; width: 28px; height: 28px; padding: 0; border-radius: 50%; background: rgba(0,0,0,.6); font-size: .8rem; }
.slot.missing img { opacity: .38; }
.slot.missing .miss-tag { display: block; position: absolute; left: 4px; right: 4px; top: 40%; background: rgba(198,40,40,.92); color: #fff; text-align: center; font-weight: 900; font-size: .65rem; letter-spacing: 1px; padding: 3px 0; border-radius: 3px; text-transform: uppercase; }
#pg-name { flex: 1; min-width: 180px; }
.saved-page { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 12px; padding: 8px; margin: 8px 0; }
.mini-page { display: grid; grid-template-columns: repeat(var(--cols, 4), 16px); gap: 2px; flex: none; }
.mini-page img, .mini-page span { width: 16px; height: 22px; object-fit: cover; border-radius: 2px; background: #2c3343; display: block; }
.saved-info { flex: 1; min-width: 0; }
.tabs button span { font-size: .58rem; }
.acc-form { display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
.acc-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.acc-danger { margin-top: 14px; } .acc-danger summary { cursor: pointer; color: #ef9a9a; }
.code { font-family: ui-monospace, monospace; font-size: 1.1rem; letter-spacing: 2px; color: var(--accent); user-select: all; }
