/* iPhone eerst: kaart over het hele scherm, glazen sheet onderin; vanaf 900px een zijbalk links. */
:root {
  --land: #f6f3ee;
  --surface: #ffffff; --surface-2: #f2f2f7; --glass: rgb(250 250 252 / .82); --sep: rgb(60 60 67 / .16);
  --fg: #1c1c1e; --muted: #6e6e73;
  --accent: #ffc21a; --accent-ink: #2a1d00; --accent-text: #946400;
  --fresh: #34c759; --fresh-t: #1f8a3c; --stale: #ff9500; --stale-t: #c45200; --old: #ff3b30; --old-t: #d70015;
  --locked: #aeaeb2; --wacht: #007aff; --blue: #007aff;
  --shadow: 0 10px 34px rgb(0 0 0 / .14), 0 1px 3px rgb(0 0 0 / .08);
  --hair: .5px solid var(--sep);
  --f-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --f-round: ui-rounded, "SF Pro Rounded", -apple-system, system-ui, sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --land: #1e2023;
    --surface: #1c1c1e; --surface-2: #2c2c2e; --glass: rgb(30 30 32 / .8); --sep: rgb(84 84 88 / .55);
    --fg: #f2f2f7; --muted: #98989f;
    --accent: #ffc83d; --accent-ink: #261a00; --accent-text: #ffd35c;
    --fresh: #30d158; --fresh-t: #30d158; --stale: #ff9f0a; --stale-t: #ff9f0a; --old: #ff453a; --old-t: #ff6961;
    --locked: #636366; --wacht: #0a84ff; --blue: #0a84ff;
    --shadow: 0 10px 34px rgb(0 0 0 / .5), 0 1px 3px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --land: #1e2023;
  --surface: #1c1c1e; --surface-2: #2c2c2e; --glass: rgb(30 30 32 / .8); --sep: rgb(84 84 88 / .55);
  --fg: #f2f2f7; --muted: #98989f;
  --accent: #ffc83d; --accent-ink: #261a00; --accent-text: #ffd35c;
  --fresh: #30d158; --fresh-t: #30d158; --stale: #ff9f0a; --stale-t: #ff9f0a; --old: #ff453a; --old-t: #ff6961;
  --locked: #636366; --wacht: #0a84ff; --blue: #0a84ff;
  --shadow: 0 10px 34px rgb(0 0 0 / .5), 0 1px 3px rgb(0 0 0 / .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--land); color: var(--fg); font: 15px/1.4 var(--f-ui); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
#map { position: fixed; inset: 0; }

.glass { background: var(--glass); backdrop-filter: blur(22px) saturate(1.6); -webkit-backdrop-filter: blur(22px) saturate(1.6); box-shadow: var(--shadow); }

#hud { position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 16px; display: flex; gap: 10px; align-items: center; padding: 8px 14px 8px 8px; border-radius: 999px; z-index: 3; }
.hud-ring { width: 36px; height: 36px; }
.hud-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--sep); stroke-width: 4; }
.ring-fg { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1); }
.hud-pct { font: 800 17px/1 var(--f-round); }
.hud-sub { font-size: 12px; color: var(--muted); }

.mapbtn { position: fixed; top: calc(env(safe-area-inset-top) + 12px); right: 16px; width: 44px; height: 44px; border-radius: 12px; border: 0; display: grid; place-items: center; color: var(--blue); z-index: 3; }
.mapbtn svg { width: 20px; height: 20px; }

#sheet { position: fixed; left: 0; right: 0; bottom: 0; height: calc(100dvh - env(safe-area-inset-top) - 64px); border-radius: 18px 18px 0 0; z-index: 4; display: flex; flex-direction: column; transform: translateY(var(--sy, 50%)); transition: transform .35s cubic-bezier(.2,.8,.2,1); touch-action: none; }
#sheet.dragging { transition: none; }
.grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--sep); margin: 8px auto 4px; flex: none; }
#tabs { display: flex; gap: 4px; margin: 4px 16px 8px; padding: 3px; background: var(--surface-2); border-radius: 10px; flex: none; }
#tabs button { flex: 1; border: 0; background: none; padding: 7px 0; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
#tabs button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }
#body { flex: 1; overflow-y: auto; padding: 0 16px calc(env(safe-area-inset-bottom) + 24px); touch-action: pan-y; overscroll-behavior: contain; }

@media (min-width: 900px) {
  #sheet { left: 16px; right: auto; top: 16px; bottom: 16px; width: 380px; height: auto; border-radius: 18px; transform: none !important; }
  .grabber { display: none; }
  #hud { left: 412px; }
}

h2 { font: 800 22px/1.2 var(--f-round); margin: 12px 0 4px; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.search { width: 100%; border: 0; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 2px 0 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chip { border: var(--hair); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 13px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--surface); border-color: transparent; }

.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: var(--hair); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.dot.fresh { background: var(--fresh); } .dot.stale { background: var(--stale); } .dot.old { background: var(--old); }
.dot.locked { background: transparent; border: 2px dashed var(--locked); } .dot.wacht { background: var(--wacht); }
.row-main { flex: 1; min-width: 0; }
.row-title { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { display: block; font-size: 13px; color: var(--muted); }
.price { font: 800 17px/1 var(--f-round); white-space: nowrap; }
.price small { font: 500 11px var(--f-ui); color: var(--muted); display: block; text-align: right; margin-top: 2px; }

.back { border: 0; background: none; color: var(--blue); padding: 8px 0; font-weight: 600; }
.card { background: var(--surface); border-radius: var(--r); padding: 14px; margin: 10px 0; border: var(--hair); }
.big-price { font: 800 40px/1 var(--f-round); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.badge.fresh { background: color-mix(in srgb, var(--fresh) 18%, transparent); color: var(--fresh-t); }
.badge.stale { background: color-mix(in srgb, var(--stale) 18%, transparent); color: var(--stale-t); }
.badge.old { background: color-mix(in srgb, var(--old) 18%, transparent); color: var(--old-t); }
.badge.wacht { background: color-mix(in srgb, var(--wacht) 16%, transparent); color: var(--wacht); }
.badge.locked { background: var(--surface-2); color: var(--muted); }

.btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn { flex: 1; border: 0; border-radius: 12px; padding: 12px 14px; font-weight: 700; background: var(--surface-2); min-width: 120px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.good { background: var(--fresh); color: #fff; }
.btn.bad { background: var(--old); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }

.form label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.form input, .form select { width: 100%; border: var(--hair); background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.form .check { display: flex; gap: 8px; align-items: center; color: var(--fg); font-size: 14px; }
.form .check input { width: auto; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { flex: 1; border: var(--hair); background: var(--surface); border-radius: 10px; padding: 8px 4px; font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 10px 0 10px 18px; border-left: 2px solid var(--sep); position: relative; margin-left: 5px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--fresh); }
.timeline li.wacht::before { background: var(--wacht); }
.timeline li.weerlegd::before { background: var(--old); }
.timeline li.check::before { background: var(--muted); }
.timeline .t-what { font-weight: 600; }
.timeline .t-meta { font-size: 13px; color: var(--muted); }
.timeline a { color: var(--blue); }

.spark { width: 100%; height: 80px; display: block; }

.ring-big { display: flex; gap: 16px; align-items: center; }
.ring-big svg { width: 110px; height: 110px; transform: rotate(-90deg); flex: none; }
.ring-big .ring-bg, .ring-big .ring-fg { stroke-width: 9; }
.ring-big .pct { font: 800 34px/1 var(--f-round); }
.bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.bar.fresh > span { background: var(--fresh); }
.milestones { display: flex; gap: 6px; margin-top: 10px; }
.milestones span { flex: 1; text-align: center; font-size: 12px; padding: 4px 0; border-radius: 8px; background: var(--surface-2); color: var(--muted); }
.milestones span.done { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

.rank { font: 800 15px var(--f-round); width: 26px; text-align: center; color: var(--muted); }
.me { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 10px; }

#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 66px); transform: translate(-50%, -20px); opacity: 0; background: var(--fg); color: var(--surface); padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; z-index: 10; transition: .3s; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast .pts { color: var(--accent); margin-left: 6px; }

.maplibregl-ctrl-attrib { font-size: 10px; }
.empty { text-align: center; padding: 30px 0; color: var(--muted); }
