@font-face { font-family: "Atkinson"; font-weight: 400; font-display: swap;
  src: url("vendor/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson"; font-weight: 700; font-display: swap;
  src: url("vendor/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }

:root {
  --paper: #f6f2e9; --card: #fffdf8; --ink: #121212; --soft: #3d3a35; --line: #d9d2c3;
  --new: #c2410c; --new-ink: #ffffff; --bpn: #ffffff;
  --go: #15803d; --go-ink: #ffffff; --near: #fde68a; --near-ink: #3f2d00;
  --warn: #fee2b3; --warn-ink: #5a2e00; --map: #d8d3c7;
}
:root[data-theme="dark"] {
  --paper: #121110; --card: #1c1b19; --ink: #f4f1ea; --soft: #c9c3b8; --line: #34312c;
  --new: #f97316; --new-ink: #121110; --bpn: #f4f1ea;
  --go: #22a356; --go-ink: #ffffff; --near: #6b4f00; --near-ink: #fff3c4;
  --warn: #5a3a0d; --warn-ink: #ffe2b8; --map: #2a2825;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); }
body { font: 400 15px/1.35 "Atkinson", "Helvetica Neue", sans-serif; display: flex; flex-direction: column;
  height: 100dvh; }
button { font: inherit; color: inherit; cursor: pointer; }
b { font-weight: 700; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px; flex: 0 0 auto; }
.eyebrow { font-size: 12px; color: var(--soft); display: flex; align-items: center; gap: 10px; }
.prog { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; color: var(--ink); }
.prog i { width: 12px; height: 6px; border-radius: 3px; background: var(--line); }
.prog i.on { background: var(--go); }
.prog b { margin-left: 4px; font-size: 12px; white-space: nowrap; }
h1 { margin: 0; font-size: 19px; line-height: 1.15; }
.top-btns { display: flex; gap: 6px; }
.round { width: 40px; height: 40px; border-radius: 20px; border: 1.5px solid var(--line); background: var(--card);
  display: grid; place-items: center; }
.round svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#sound .off, #sound[aria-pressed="false"] .on { display: none; }
#sound[aria-pressed="false"] .off { display: block; }
:root[data-theme="dark"] #theme .moon, :root:not([data-theme="dark"]) #theme .sun { display: none; }
#full .collapse, .map-full #full .expand { display: none; }
.map-full #full .collapse { display: block; }
.map-full #full { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.map-full #panel { display: none; }
.map-full #map { margin: 0 12px calc(12px + env(safe-area-inset-bottom)); }
.mini { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 1000; padding: 9px 16px; border-radius: 22px; background: var(--ink); color: var(--paper);
  font-weight: 700; font-size: 15px; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.mini.here { background: var(--go); color: var(--go-ink); }
.mini[hidden] { display: none; }

#map { flex: 1 1 auto; min-height: 140px; margin: 0 12px; border-radius: 14px; background: var(--map);
  border: 1.5px solid var(--line); overflow: hidden; }

#panel { flex: 0 0 auto; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }

.target { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.t-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.t-name { font-size: 16px; font-weight: 700; line-height: 1.2; }
.t-desc { font-size: 13px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-change { font-weight: 700; font-size: 14px; padding: 7px 12px; border-radius: 9px; background: var(--ink); color: var(--paper); }

.badge { flex: 0 0 auto; min-width: 36px; height: 36px; padding: 0 6px; border-radius: 18px; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; }
.badge.new { background: var(--new); color: var(--new-ink); }
.badge.bpn { background: var(--bpn); color: #121212; border: 2px solid #121212; }

.guide { display: flex; align-items: center; gap: 12px; }
.guide[hidden] { display: none; }
.dial { flex: 0 0 auto; width: 72px; height: 72px; border-radius: 36px; background: var(--card);
  border: 1.5px solid var(--line); display: grid; place-items: center; }
#dial { position: relative; --heat: var(--line); --pulse: 1400ms; border-color: var(--heat); border-width: 2.5px; }
#dial .ring { position: absolute; inset: -2px; border-radius: 50%; border: 2.5px solid var(--heat); opacity: 0; pointer-events: none; }
#dial.live .ring { animation: ping var(--pulse) ease-out infinite; }
#dial.live .ring.r2 { animation-delay: calc(var(--pulse) / 2); }
@keyframes ping { from { transform: scale(1); opacity: .7; } to { transform: scale(1.45); opacity: 0; } }
.heatword { margin-left: 4px; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; color: #fff; background: var(--heat, transparent); }
.heatword:empty { display: none; }
#arrow { position: relative; width: 48px; height: 48px; fill: var(--ink); transition: transform .3s ease-out; }
.reading { flex: 1; min-width: 0; }
.dist { display: flex; align-items: baseline; gap: 6px; }
#dist { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.unit { font-size: 15px; color: var(--soft); }
.dir { font-size: 15px; font-weight: 700; margin-top: 2px; }
.dir small { display: block; font-size: 12px; font-weight: 400; color: var(--soft); }

.status { padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1.5px solid var(--line);
  font-size: 15px; line-height: 1.3; }
.status.near { background: var(--near); color: var(--near-ink); border-color: transparent; font-weight: 700; }
.status.warn { background: var(--warn); color: var(--warn-ink); border-color: transparent; }

.howto { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 5px; }
.howto li { counter-increment: s; position: relative; padding: 1px 0 0 30px; min-height: 22px; font-size: 14px; }
.howto li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 11px;
  background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.howto[hidden] { display: none; }
.howto li.legend { counter-increment: none; padding-left: 0; min-height: 0; color: var(--soft); font-size: 13px; }
.howto li.legend::before { display: none; }

.tape { padding: 7px 12px; border-radius: 10px; background: var(--card); border: 1.5px dashed var(--line); font-size: 13px; }
.tape b { font-weight: 700; color: var(--soft); }

.actions { display: flex; gap: 8px; }
.btn { flex: 1; min-height: 46px; border-radius: 12px; border: 1.5px solid var(--ink); background: var(--card);
  font-size: 15px; font-weight: 700; }
.btn.primary { background: var(--ink); color: var(--paper); font-size: 16px; }
.btn[hidden] { display: none; }
.foot { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--soft); }
.foot a { color: var(--ink); font-weight: 700; }

/* At the stake: the whole panel turns green so it reads from arm's length. */
#panel.here { background: var(--go); color: var(--go-ink); border-radius: 16px 16px 0 0; }
#panel.here .status { background: transparent; border-color: rgba(255,255,255,.6); color: var(--go-ink);
  font-size: 19px; font-weight: 700; text-align: center; padding: 8px; }
#panel.here .dial, #panel.here .target, #panel.here .tape { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.45); }
#panel.here #arrow { fill: var(--go-ink); }
#panel.here .unit, #panel.here .t-desc, #panel.here .dir small, #panel.here .foot, #panel.here .tape b { color: rgba(255,255,255,.85); }
#panel.here .foot a { color: var(--go-ink); }
#panel.here .t-change { background: var(--go-ink); color: var(--go); }
#panel.here .btn { border-color: var(--go-ink); background: transparent; color: var(--go-ink); }

/* Map markers */
.pt { position: absolute; transform: translate(-50%, -50%); min-width: 26px; height: 26px; padding: 0 6px; border-radius: 13px;
  display: grid; place-items: center; white-space: nowrap; font: 700 12px/1 "Atkinson", sans-serif;
  background: #fff; color: #121212; border: 2.5px solid #121212; box-shadow: 0 1px 3px rgba(0,0,0,.35); }
.pt.new { background: #c2410c; color: #fff; border-color: #fff; }
.pt.done { background: #15803d; color: #fff; border-color: #fff; }
.pt.sel { outline: 4px solid #facc15; outline-offset: 1px; }
.me-wrap { position: absolute; left: 0; top: 0; }
.me-wrap .me-beam { z-index: 0; position: absolute; left: -70px; top: -70px; width: 140px; height: 140px; display: none; transform-origin: 50% 50%; pointer-events: none; }
.me { position: absolute; z-index: 1; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 11px; background: #2563eb; border: 4px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,.35); }
.leaflet-tooltip { font: 700 14px "Atkinson", sans-serif; }

/* Point picker */
.sheet { position: fixed; inset: 0; z-index: 2000; background: var(--paper); display: flex; flex-direction: column;
  animation: rise .22s ease-out; }
.sheet[hidden] { display: none; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + env(safe-area-inset-top)) 16px 8px; }
.sheet-head h2 { margin: 0; font-size: 20px; }
.sheet-body { overflow-y: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
.sheet-body h3 { font-size: 15px; margin: 14px 0 8px; }
.sheet-body h3 small { font-weight: 400; color: var(--soft); font-size: 13px; }
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; text-align: left; padding: 8px 12px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.row[aria-current="true"] { border-color: var(--ink); border-width: 2px; }
.row .t-text { flex: 1; }
.row .row-dist { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Arrival card and confetti */
.win { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 20px;
  background: rgba(10, 30, 15, .55); animation: fade .2s ease-out; }
.win[hidden] { display: none; }
.win-card { width: min(340px, 100%); background: var(--card); color: var(--ink); border-radius: 20px; padding: 22px 20px 16px;
  text-align: center; display: grid; gap: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.35); animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.win-check { width: 72px; height: 72px; margin: 0 auto; }
.win-check circle { fill: var(--go); }
.win-check path { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 48; stroke-dashoffset: 48; animation: draw .45s .15s ease-out forwards; }
.win h2 { margin: 4px 0 0; font-size: 22px; }
.win p { margin: 0 0 6px; color: var(--soft); font-size: 15px; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--soft); min-height: 40px; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 3100; pointer-events: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.row .done-tag { display: block; font-size: 12px; color: var(--go); font-weight: 700; text-align: right; }
.row .undo { display: block; margin-top: 2px; font-size: 12px; color: var(--soft); text-decoration: underline; text-align: right; }

/* AR camera view */
.ar-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.ar-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.ar { position: fixed; inset: 0; z-index: 2500; background: #000; overflow: hidden; }
.ar[hidden] { display: none; }
#ar-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#ar-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#ar-svg .ring.sel { fill: rgba(34, 197, 94, .30); stroke: #22c55e; stroke-width: 4; }
#ar-svg .ring.other { fill: rgba(255, 255, 255, .12); stroke: rgba(255, 255, 255, .85); stroke-width: 2; }
#ar-svg .ring.done { fill: rgba(34, 197, 94, .12); stroke: #22c55e; stroke-width: 2; stroke-dasharray: 6 5; }
#ar-svg .pin { stroke: #22c55e; stroke-width: 3; }
#ar-svg .eye { fill: #4ade80; stroke: #fff; stroke-width: 2.5; }
#ar-svg .tag text { font: 700 14px "Atkinson", sans-serif; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.6); stroke-width: 3px; }
#ar-svg .tag.sel rect { fill: #15803d; }
#ar-svg .tag.sel text { font-size: 16px; stroke: none; }
.ar-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.4); }
.ar-hint { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 14px; right: 70px; color: #fff; font-weight: 700;
  font-size: 15px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.ar-edge { position: absolute; top: 45%; left: 0; right: 0; text-align: center; color: #fff; font-weight: 700; font-size: 18px; }
.ar-edge:not(:empty) { margin: 0 auto; width: max-content; padding: 10px 16px; border-radius: 22px; background: rgba(0,0,0,.6); }
.ar-bar { position: absolute; left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); padding: 12px 14px; border-radius: 14px;
  background: rgba(0,0,0,.65); color: #fff; font-weight: 700; font-size: 16px; text-align: center; }
.ar-bar.near { background: rgba(253, 230, 138, .95); color: #3f2d00; }
.ar-bar.warn { background: rgba(254, 226, 179, .95); color: #5a2e00; }
.ar-bar.here { background: #15803d; }

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