@font-face { font-family: 'Rajdhani'; font-weight: 500; font-display: swap; src: url(/fonts/rajdhani/rajdhani-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 700; font-display: swap; src: url(/fonts/rajdhani/rajdhani-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'STM'; font-weight: 400; font-display: swap; src: url(/fonts/stm/share-tech-mono-latin-400-normal.woff2) format('woff2'); }

:root {
  --bg: #05060a;
  --panel: rgba(9, 11, 20, .92);
  --line: rgba(0, 240, 255, .28);
  --cyan: #00f0ff;
  --mag: #ff2bd6;
  --amber: #ffb000;
  --acid: #b6ff00;
  --red: #ff3355;
  --txt: #d8e6ff;
  --dim: #7d8bb3;
  --ui: 'Rajdhani', 'Arial Narrow', system-ui, sans-serif;
  --mono: 'STM', ui-monospace, Menlo, monospace;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1.1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grit: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font-family: var(--ui); overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
.ico { width: 22px; height: 22px; display: block; filter: drop-shadow(0 0 4px currentColor); }

#map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { background: rgba(5,6,10,.7) !important; font-family: var(--mono); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--dim) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-ctrl-bottom-right { bottom: calc(76px + var(--safe-b)); }

.scanlines { position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.06) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; animation: flicker 6s infinite steps(1); }
.vignette { position: fixed; inset: 0; pointer-events: none; z-index: 4;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,.65) 100%),
              linear-gradient(to bottom, rgba(255,43,214,.06), transparent 30%, transparent 70%, rgba(0,240,255,.06)); }
/* film grain over everything (map + UI), jittered so it crawls like film */
.grain { position: fixed; inset: -60px; pointer-events: none; z-index: 6; background-image: var(--noise); background-size: 180px 180px;
  opacity: .11; mix-blend-mode: screen; animation: grain .9s steps(9) infinite; }
@keyframes grain {
  0% { transform: translate(0,0) } 11% { transform: translate(-22px,14px) } 22% { transform: translate(17px,-31px) } 33% { transform: translate(-38px,-9px) }
  44% { transform: translate(29px,23px) } 55% { transform: translate(-11px,37px) } 66% { transform: translate(41px,-18px) } 77% { transform: translate(-27px,-40px) }
  88% { transform: translate(8px,30px) } 100% { transform: translate(0,0) } }
@media (prefers-reduced-motion: reduce) { .grain, .scanlines { animation: none; } }
@keyframes flicker { 0%,100% { opacity: 1 } 47% { opacity: .85 } 48% { opacity: 1 } 82% { opacity: .9 } }

/* ---------- top HUD ---------- */
.hud-top { position: fixed; z-index: 10; top: calc(10px + var(--safe-t)); left: 12px; right: 12px;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; align-items: center;
  padding: 8px 10px 8px 14px; background: var(--panel); border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  backdrop-filter: blur(6px); }
.hud-top .icon-btn { grid-row: 1 / 3; grid-column: 2; }
.logo { position: relative; font-weight: 700; font-size: 24px; letter-spacing: .12em; line-height: 1; color: #fff;
  text-shadow: 0 0 6px var(--cyan), 0 0 18px rgba(0,240,255,.6); }
.logo span { color: var(--mag); text-shadow: 0 0 8px var(--mag); }
.logo::before, .logo::after { content: attr(data-text); position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.logo::before { color: var(--mag); transform: translate(2px, 0); clip-path: inset(0 0 60% 0); animation: glitch 3.2s infinite steps(1); opacity: .8; }
.logo::after { color: var(--cyan); transform: translate(-2px, 0); clip-path: inset(55% 0 0 0); animation: glitch 2.7s infinite reverse steps(1); opacity: .8; }
@keyframes glitch { 0%, 88%, 100% { transform: none; opacity: 0 } 89% { transform: translate(3px,-1px); opacity: .9 } 91% { transform: translate(-3px,1px); opacity: .9 } 93% { transform: translate(1px,0); opacity: .9 } }
.sub { font-family: var(--mono); font-size: 11px; letter-spacing: .2em; color: var(--dim); margin-top: 4px; }
.sub #count { color: var(--cyan); margin-left: 8px; }
.blink { color: var(--red); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2 } }

.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; background: rgba(0,240,255,.06);
  border: 1px solid var(--line); color: var(--cyan); clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); }
.icon-btn:active { background: rgba(0,240,255,.2); }
.icon-btn.big { width: 50px; height: 50px; background: var(--panel); }
.side-btns { position: fixed; z-index: 10; right: 12px; bottom: calc(150px + var(--safe-b)); display: grid; gap: 10px; }

/* ---------- filter rail ---------- */
.filters { position: fixed; z-index: 10; left: 0; right: 0; bottom: calc(10px + var(--safe-b)); display: flex; gap: 8px;
  overflow-x: auto; padding: 4px 12px; scrollbar-width: none; padding-right: 150px; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 62px; padding: 8px 8px 6px;
  background: var(--panel); border: 1px solid rgba(125,139,179,.3); color: var(--dim); font-weight: 700; font-size: 11px; letter-spacing: .1em;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%); transition: color .15s, border-color .15s, box-shadow .15s; }
.chip .ico { width: 24px; height: 24px; filter: none; }
.chip.on { color: var(--c, var(--cyan)); border-color: var(--c, var(--cyan)); box-shadow: inset 0 -3px 0 var(--c, var(--cyan)), 0 0 14px -4px var(--c, var(--cyan)); }
.chip.on .ico { filter: drop-shadow(0 0 5px currentColor); }

/* ---------- FAB ---------- */
.fab { position: fixed; z-index: 11; right: 12px; bottom: calc(82px + var(--safe-b)); display: flex; align-items: center; gap: 8px;
  padding: 0 20px; height: 56px; border: 0; background: var(--mag); color: #08000a; font-weight: 700; font-size: 18px; letter-spacing: .14em;
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  box-shadow: 0 0 24px var(--mag); animation: fabpulse 2.4s infinite; }
.fab .ico { filter: none; width: 24px; height: 24px; }
@keyframes fabpulse { 50% { filter: brightness(1.25) } }

/* ---------- sheet ---------- */
.sheet { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; max-height: 66vh; display: flex; flex-direction: column;
  background: var(--grit), linear-gradient(180deg, rgba(14,10,26,.97), rgba(5,6,10,.98)); background-size: 140px 140px, auto; border-top: 1px solid var(--mag);
  box-shadow: 0 -10px 40px rgba(255,43,214,.25); padding-bottom: var(--safe-b);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2,.9,.3,1); }
.sheet.open { transform: none; }
@media (min-width: 760px) {
  .sheet { left: auto; right: 16px; top: 100px; bottom: 16px; width: 420px; max-height: none; border: 1px solid var(--mag);
    transform: translateX(120%); }
  .sheet.open { transform: none; }
  .fab { bottom: 24px; } .filters { bottom: 16px; padding-right: 190px; } .side-btns { bottom: 100px; }
}
.sheet-grip { width: 48px; height: 4px; background: var(--dim); opacity: .5; margin: 8px auto 0; border-radius: 2px; }
.sheet-close { position: absolute; top: 10px; right: 12px; z-index: 2; }
.sheet-body { overflow-y: auto; padding: 8px 18px 22px; -webkit-overflow-scrolling: touch; }

.tag { font-family: var(--mono); font-size: 11px; letter-spacing: .22em; color: var(--mag); }
.tag b { color: var(--cyan); font-weight: 400; }
h2 { margin: 6px 52px 4px 0; font-size: 26px; line-height: 1.05; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: .03em; }
.meta { font-family: var(--mono); font-size: 12px; color: var(--dim); }
.desc { font-size: 16px; line-height: 1.35; color: var(--txt); margin: 12px 0; }

.score { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; }
.score .num { font-family: var(--mono); font-size: 44px; line-height: 1; color: var(--sc); text-shadow: 0 0 12px var(--sc); }
.score .num small { font-size: 16px; color: var(--dim); text-shadow: none; }
.bars { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; flex: 1; }
.bars i { height: 18px; background: rgba(125,139,179,.15); transform: skewX(-18deg); }
.bars i.on { background: var(--sc); box-shadow: 0 0 8px var(--sc); }
.score-label { font-family: var(--mono); font-size: 11px; letter-spacing: .15em; color: var(--dim); }

.mats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.mat { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid rgba(0,240,255,.35); color: var(--cyan); font-weight: 700; font-size: 13px; letter-spacing: .06em; }
.mat .ico { width: 18px; height: 18px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.cell { padding: 8px 10px; background: rgba(0,240,255,.04); border-left: 2px solid var(--line); }
.cell .k { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; color: var(--dim); }
.cell .v { font-size: 15px; font-weight: 700; margin-top: 2px; }

.warn { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; margin: 12px 0; border: 1px solid var(--amber); color: var(--amber);
  background: repeating-linear-gradient(-45deg, rgba(255,176,0,.08) 0 10px, transparent 10px 20px); font-weight: 700; }
.warn .ico { flex: 0 0 auto; }
.note { font-size: 13px; color: var(--dim); line-height: 1.35; margin: 10px 0; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1px solid var(--cyan);
  background: rgba(0,240,255,.07); color: var(--cyan); font-weight: 700; font-size: 15px; letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px)); }
.btn:active { background: rgba(0,240,255,.22); }
.btn.primary { background: var(--mag); border-color: var(--mag); color: #0a0010; box-shadow: 0 0 18px rgba(255,43,214,.5); }
.btn.full { grid-column: 1 / -1; }
.btn.ghost { border-color: rgba(125,139,179,.5); color: var(--dim); background: transparent; }
.btn .ico { width: 20px; height: 20px; }
.btn[disabled] { opacity: .4; }

.photos { display: flex; gap: 8px; overflow-x: auto; margin: 12px -18px; padding: 0 18px; scroll-snap-type: x mandatory; }
.photos img { flex: 0 0 auto; height: 220px; max-width: 86%; object-fit: cover; scroll-snap-align: start; border: 1px solid var(--line); }

/* ---------- report form ---------- */
.step { margin: 16px 0; }
.step-h { font-family: var(--mono); font-size: 12px; letter-spacing: .2em; color: var(--mag); margin-bottom: 8px; }
.shots { display: flex; gap: 8px; flex-wrap: wrap; }
.shot { width: 86px; height: 86px; object-fit: cover; border: 1px solid var(--cyan); }
.add-shot { width: 86px; height: 86px; display: grid; place-items: center; border: 1px dashed var(--cyan); color: var(--cyan); background: rgba(0,240,255,.05); position: relative; }
.add-shot input { position: absolute; inset: 0; opacity: 0; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.pick { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; background: rgba(0,240,255,.04);
  border: 1px solid rgba(125,139,179,.3); color: var(--dim); font-weight: 700; font-size: 12px; letter-spacing: .06em; text-align: center; }
.pick .ico { width: 28px; height: 28px; filter: none; }
.pick.on { color: var(--acid); border-color: var(--acid); box-shadow: 0 0 12px -3px var(--acid); }
.pick.on .ico { filter: drop-shadow(0 0 5px currentColor); }
.pick.haz.on { color: var(--amber); border-color: var(--amber); }
textarea { width: 100%; min-height: 72px; padding: 10px; background: rgba(0,0,0,.4); border: 1px solid var(--line); color: var(--txt); font: 15px var(--ui); resize: vertical; }
textarea:focus { outline: 1px solid var(--cyan); }
.loc { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 12px; color: var(--acid); }
.loc.none { color: var(--amber); }

/* ---------- crosshair pick mode ---------- */
.crosshair { position: fixed; z-index: 12; left: 50%; top: 50%; width: 70px; height: 70px; margin: -35px 0 0 -35px; pointer-events: none;
  border: 1px solid var(--acid); border-radius: 50%; box-shadow: 0 0 18px var(--acid); }
.crosshair::before, .crosshair::after { content: ''; position: absolute; background: var(--acid); }
.crosshair::before { left: 50%; top: -14px; bottom: -14px; width: 1px; }
.crosshair::after { top: 50%; left: -14px; right: -14px; height: 1px; }
.pick-bar { position: fixed; z-index: 21; left: 12px; right: 12px; bottom: calc(16px + var(--safe-b)); display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 10px 10px 14px; background: var(--panel); border: 1px solid var(--acid); font-weight: 700; }

/* ---------- misc ---------- */
.toast { position: fixed; z-index: 30; left: 50%; top: calc(136px + var(--safe-t)); transform: translate(-50%, -20px); opacity: 0; pointer-events: none;
  padding: 10px 16px; background: var(--panel); border: 1px solid var(--acid); color: var(--acid); font-family: var(--mono); font-size: 13px; letter-spacing: .08em;
  transition: all .25s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { border-color: var(--red); color: var(--red); }

.code ol { padding-left: 0; list-style: none; counter-reset: c; }
.code li { counter-increment: c; position: relative; padding: 10px 0 10px 46px; border-bottom: 1px solid rgba(125,139,179,.15); font-size: 16px; line-height: 1.3; }
.code li::before { content: '0' counter(c); position: absolute; left: 0; top: 8px; font-family: var(--mono); font-size: 22px; color: var(--mag); text-shadow: 0 0 8px var(--mag); }
.code li b { color: #fff; }
.legend { display: grid; gap: 6px; margin: 12px 0; font-size: 14px; }
.legend span { display: inline-block; width: 12px; height: 12px; margin-right: 8px; transform: rotate(45deg); vertical-align: -1px; }
a { color: var(--cyan); }

/* ---------- top filter bar ---------- */
.topbar { position: fixed; z-index: 11; top: calc(84px + var(--safe-t)); left: 12px; right: 12px; display: flex; gap: 8px; pointer-events: none; }
.dd { position: relative; pointer-events: auto; }
.pill { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; background-color: var(--panel); border: 1px solid rgba(125,139,179,.4);
  color: var(--dim); font-weight: 700; font-size: 13px; letter-spacing: .12em; white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px)); backdrop-filter: blur(6px); }
.pill.on, .pill[aria-expanded="true"] { color: var(--cyan); border-color: var(--cyan); box-shadow: inset 0 -2px 0 var(--cyan); }
.dd-panel { position: absolute; top: 42px; left: 0; min-width: 210px; display: grid; gap: 4px; padding: 6px;
  background-color: rgba(9,11,20,.97); border: 1px solid var(--cyan); box-shadow: 0 0 22px -6px var(--cyan); }
.dd-panel[hidden] { display: none; }
.dd-opt { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; background: transparent; border: 1px solid transparent;
  color: var(--dim); font-weight: 700; font-size: 14px; letter-spacing: .08em; text-align: left; }
.dd-opt .ico { width: 22px; height: 22px; filter: none; }
.dd-opt.on { color: var(--cyan); border-color: rgba(0,240,255,.4); background: rgba(0,240,255,.07); }
.dd-opt.on .ico { filter: drop-shadow(0 0 5px currentColor); }
.dd-opt.reset { justify-content: center; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; border-top: 1px solid rgba(125,139,179,.2); }
@media (min-width: 760px) { .topbar { right: auto; } }

/* grit on the panels themselves (last, so the background shorthands above don't reset it; .sheet layers its own) */
.hud-top, .chip, .btn, .pill, .dd-panel, .icon-btn.big, .pick-bar, .fab { background-image: var(--grit); background-size: 140px 140px; }
