/* Skate Athens — VHS / camcorder-viewfinder skin.
   Mobile-first: full-bleed dark map, top HUD, a bottom sheet that toggles
   between the route planner (Plan) and the results (Result). No border-radius
   anywhere — hard rectangular tape look; pins/dots are the only circles. */

:root {
  --bg:      #060709;
  --cyan:    #34f5ff;  --cyan-b: #7df9ff;  --cyan-c: #bdfaff;
  --pale:    #eafdff;  --body:   #dffcff;
  --lime:    #c6ff4a;  --lime-b: #d6ff7a;
  --mag:     #ff2e9a;  --mag-soft:#ff8ec6;
  --amber:   #ffb14d;  --flat:   #5d7b83;
  --cap:     rgba(223,252,255,.45);
  --fine:    rgba(223,252,255,.30);
  --hair:    rgba(52,245,255,.18);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--bg); color: var(--body);
  font-family: 'Space Mono', monospace; -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; user-select: none; overscroll-behavior: none;
}
input, textarea { user-select: text; -webkit-user-select: text; }

/* ── Full-bleed map ─────────────────────────────────────────── */
#map {
  position: fixed; inset: 0; z-index: 0;
  background: radial-gradient(130% 80% at 72% 16%, #0d1519 0%, #070a0d 52%, #050608 100%);
}
.leaflet-container { background: transparent; font: inherit; outline: none; }
/* Tint the dark tiles toward a teal "night camcorder" cast. */
.leaflet-tile { filter: sepia(.5) hue-rotate(135deg) saturate(1.3) brightness(.72) contrast(1.08); }
.leaflet-div-icon { background: transparent; border: none; }
.leaflet-control-zoom { display: none; }
.leaflet-control-attribution {
  background: rgba(6,8,11,.55); color: rgba(223,252,255,.45);
  border: none; padding: 2px 6px; font-size: 9px; letter-spacing: .3px;
}
.leaflet-control-attribution a { color: var(--cyan); }

/* ── VHS overlays (decorative, never capture pointer) ───────── */
.fx { position: fixed; inset: 0; pointer-events: none; }
#fx-vignette { z-index: 14; background: radial-gradient(125% 95% at 50% 38%, transparent 52%, rgba(0,0,0,.6) 100%); }
#fx-scan {
  z-index: 15;
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.26) 3px, rgba(0,0,0,0) 4px);
}
#fx-grain { z-index: 16; opacity: .10; mix-blend-mode: overlay; animation: vhsflick .28s steps(2) infinite; }
#fx-grain svg { display: block; width: 100%; height: 100%; }
#fx-track {
  z-index: 17; bottom: auto; height: 64px;
  background: linear-gradient(rgba(189,250,255,0), rgba(189,250,255,.06), rgba(189,250,255,0));
  animation: track 7.5s linear infinite;
}
@keyframes vhsflick { 0%{opacity:.07} 50%{opacity:.12} 100%{opacity:.08} }
@keyframes track    { 0%{transform:translateY(-140%)} 100%{transform:translateY(960%)} }
body.no-fx .fx { display: none !important; }

/* ── Top HUD ─────────────────────────────────────────────────── */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; pointer-events: none;
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: calc(13px + env(safe-area-inset-top)) 15px 13px;
  background: linear-gradient(rgba(6,8,11,.85), rgba(6,8,11,0));
}
.wm-line {
  font-family: 'Bungee', sans-serif; font-size: 21px; line-height: .92; color: var(--pale);
  text-shadow: -2px 0 rgba(255,46,154,.9), 2px 0 rgba(52,245,255,.9);
}
.wm-sub { font-size: 8px; font-weight: 700; letter-spacing: 2px; color: rgba(52,245,255,.7); margin-top: 4px; }
.hud-r { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; font-size: 9px; font-weight: 700; }
.rec { display: flex; align-items: center; gap: 5px; color: var(--mag); letter-spacing: 1px; }
.rec-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mag); box-shadow: 0 0 8px var(--mag); animation: recblink 1.4s steps(1) infinite; }
.clock { color: rgba(223,252,255,.85); letter-spacing: 1px; }
.sp { color: rgba(223,252,255,.45); letter-spacing: 1px; }
.fx-toggle {
  pointer-events: auto; margin-top: 2px; cursor: pointer;
  background: rgba(52,245,255,.08); border: 1px solid rgba(52,245,255,.3); color: var(--cyan-c);
  font-family: 'Space Mono', monospace; font-size: 9px; font-weight: 700; letter-spacing: 1px; padding: 3px 7px;
}
@keyframes recblink { 0%,55%{opacity:1} 56%,100%{opacity:.12} }

/* ── Bottom sheet ────────────────────────────────────────────── */
#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; flex-direction: column; max-height: calc(100dvh - 64px);
  background: linear-gradient(rgba(10,15,19,.94), rgba(7,10,13,.98));
  border-top: 2px solid rgba(52,245,255,.4); box-shadow: 0 -14px 44px rgba(0,0,0,.65);
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  transition: transform .38s cubic-bezier(.2,.8,.2,1);
}
body.peek #sheet { transform: translateY(calc(100% - 54px)); }
.grab { flex: none; display: flex; justify-content: center; padding: 9px 0 5px; cursor: pointer; }
.grab-bar { width: 44px; height: 4px; background: rgba(52,245,255,.55); box-shadow: 0 0 8px rgba(52,245,255,.5); }

.sheet-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 2px 16px calc(20px + env(safe-area-inset-bottom));
}
.sheet-body::-webkit-scrollbar { width: 6px; }
.sheet-body::-webkit-scrollbar-thumb { background: rgba(52,245,255,.25); }
#resultView { display: none; }
body.result #planView { display: none; }
body.result #resultView { display: block; }

/* Desktop: cap the sheet to a centred phone column. */
@media (min-width: 760px) {
  #sheet { left: 50%; right: auto; width: 420px; margin-left: -210px; max-height: calc(100dvh - 110px); }
}

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.sheet-title { font-family: 'Bungee', sans-serif; font-size: 13px; letter-spacing: 1px; color: var(--pale); }
.sheet-note { font-size: 8px; letter-spacing: 1px; color: rgba(223,252,255,.4); }

/* A/B endpoint fields */
.field { display: flex; align-items: center; gap: 11px; padding: 11px 13px; margin-bottom: 8px; }
.field.start { border: 1px solid rgba(198,255,74,.3); background: rgba(198,255,74,.05); }
.field.dest  { border: 1px solid rgba(255,46,154,.3); background: rgba(255,46,154,.05); margin-bottom: 11px; }
.field-dot { width: 11px; height: 11px; border-radius: 50%; flex: none; }
.field.start .field-dot { background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.field.dest  .field-dot { background: var(--mag);  box-shadow: 0 0 10px var(--mag); }
.field-main { flex: 1; min-width: 0; }
.field-cap { font-size: 8px; letter-spacing: 2px; color: var(--cap); }
.field-val { font-size: 13px; font-weight: 700; color: var(--pale); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-ab { font-family: 'Bungee', sans-serif; font-size: 14px; }
.field.start .field-ab { color: rgba(198,255,74,.6); }
.field.dest  .field-ab { color: rgba(255,46,154,.6); }

/* Search */
.search { display: flex; gap: 7px; margin-bottom: 11px; }
.search input {
  flex: 1; min-width: 0; background: rgba(52,245,255,.04); border: 1px solid rgba(52,245,255,.22);
  color: var(--pale); font-family: 'Space Mono', monospace; font-size: 12px; letter-spacing: .5px; padding: 9px 11px;
}
.search input::placeholder { color: rgba(223,252,255,.35); letter-spacing: 1px; }
.search input:focus { outline: none; border-color: var(--cyan); }

/* Action buttons */
.actions { display: flex; gap: 7px; margin-bottom: 16px; }
.act {
  flex: 1; padding: 9px 0; cursor: pointer; background: rgba(52,245,255,.06); border: 1px solid rgba(52,245,255,.22);
  color: var(--cyan-c); font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.act:active { transform: translateY(1px); }
.act.mag  { background: rgba(255,46,154,.06); border-color: rgba(255,46,154,.22); color: var(--mag-soft); }
.act.lime { background: rgba(198,255,74,.06); border-color: rgba(198,255,74,.22); color: var(--lime-b); }
.act.on   { background: var(--mag); border-color: var(--mag); color: #11050b; }

/* Divider */
.divider { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.divider span { font-family: 'Bungee', sans-serif; font-size: 12px; letter-spacing: 1px; color: var(--pale); }
.divider i { flex: 1; height: 1px; background: var(--hair); }

/* Sliders */
.slider { margin-bottom: 14px; }
.slider .row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.slider .row label { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--cyan-c); }
.slider .row .v { font-size: 9px; letter-spacing: 1px; color: var(--lime); }
.slider .ends { display: flex; justify-content: space-between; font-size: 7px; letter-spacing: 1px; color: rgba(223,252,255,.4); margin-top: 5px; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; outline: none; cursor: pointer;
  margin: 0; border-radius: 0; background: rgba(255,255,255,.08); touch-action: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 22px; border-radius: 0;
  background: #070a0d; border: 2px solid var(--cyan); box-shadow: 0 0 10px rgba(52,245,255,.9); cursor: pointer;
}
input[type=range]::-moz-range-thumb {
  width: 14px; height: 22px; border-radius: 0; background: #070a0d; border: 2px solid var(--cyan);
  box-shadow: 0 0 10px rgba(52,245,255,.9); cursor: pointer;
}

/* Find button */
.find {
  width: 100%; padding: 15px 0; cursor: pointer; border: none;
  background: linear-gradient(90deg, #34f5ff, #7df9ff); color: #04161a;
  font-family: 'Bungee', sans-serif; font-size: 15px; letter-spacing: 1px; box-shadow: 0 0 22px rgba(52,245,255,.5);
}
.find:disabled { opacity: .4; cursor: default; box-shadow: none; }
.find:active:not(:disabled) { transform: translateY(1px); }

/* ── Result view ─────────────────────────────────────────────── */
.new-btn {
  padding: 7px 12px; cursor: pointer; background: rgba(52,245,255,.08); border: 1px solid rgba(52,245,255,.3);
  color: var(--cyan-c); font-family: 'Space Mono', monospace; font-size: 10px; font-weight: 700; letter-spacing: 1px;
}
.picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.picker:empty { display: none; }
.rchip {
  flex: 1 1 auto; min-width: 96px; text-align: left; cursor: pointer;
  background: rgba(52,245,255,.04); border: 1px solid rgba(52,245,255,.18); color: var(--body); padding: 6px 8px;
}
.rchip b { display: block; font-size: 11px; font-weight: 700; color: var(--cyan-c); }
.rchip span { font-size: 9px; color: var(--cap); font-variant-numeric: tabular-nums; }
.rchip.on { border-color: var(--cyan); background: rgba(52,245,255,.1); }

.hero {
  display: flex; align-items: flex-end; gap: 14px; padding: 13px 14px; margin-bottom: 9px;
  border: 1px solid rgba(52,245,255,.25); background: linear-gradient(120deg, rgba(52,245,255,.08), rgba(255,46,154,.04));
}
.h-main { flex: 1; }
.h-cap { font-size: 8px; letter-spacing: 2px; color: rgba(223,252,255,.5); }
.h-big { font-family: 'Bungee', sans-serif; font-size: 34px; line-height: 1; color: var(--pale); font-variant-numeric: tabular-nums; }
.h-big small { font-size: 14px; color: var(--cyan); }
.h-r { text-align: right; }
.h-score { font-family: 'Bungee', sans-serif; font-size: 26px; line-height: 1; color: var(--lime); text-shadow: 0 0 12px rgba(198,255,74,.5); font-variant-numeric: tabular-nums; }
.h-score small { font-size: 11px; color: rgba(223,252,255,.4); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 14px; }
.cell { border: 1px solid rgba(52,245,255,.14); background: rgba(52,245,255,.03); padding: 8px 9px; }
.c-cap { font-size: 7px; letter-spacing: 1px; color: var(--cap); }
.c-val { font-family: 'Bungee', sans-serif; font-size: 17px; color: var(--pale); font-variant-numeric: tabular-nums; }
.c-val small { font-size: 9px; color: var(--cyan); }
.cell.lime  .c-val { color: var(--lime); }
.cell.amber .c-val { color: var(--amber); }

.elev-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.elev-head .l { font-size: 9px; font-weight: 700; letter-spacing: 2px; color: var(--cyan-c); }
.elev-head .r { font-size: 9px; letter-spacing: 1px; color: var(--cyan); font-variant-numeric: tabular-nums; }
#chartwrap { position: relative; border-bottom: 1px solid rgba(52,245,255,.18); }
#chart { display: block; width: 100%; height: 64px; }
.elev-line { filter: drop-shadow(0 0 5px rgba(52,245,255,.9)); }
.elev-lab { fill: rgba(223,252,255,.4); font-size: 8px; font-family: 'Space Mono', monospace; }
#playhead { position: absolute; top: -2px; bottom: 0; left: 0; width: 2px; background: #fff; box-shadow: 0 0 9px #fff; display: none; transition: left .1s linear; }
body.tracking #playhead { display: block; }
.track-meta { display: none; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 9px; letter-spacing: .5px; color: var(--cyan-c); font-variant-numeric: tabular-nums; }
body.tracking .track-meta { display: flex; }

.segbar { display: flex; height: 9px; margin-top: 10px; border: 1px solid rgba(255,255,255,.12); }
.segbar > i { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 13px; margin-top: 7px; font-size: 8px; letter-spacing: .5px; color: rgba(223,252,255,.6); }
.legend span { display: flex; align-items: center; gap: 4px; }
.legend span i { display: inline-block; width: 9px; height: 9px; }

.gmaps {
  width: 100%; margin-top: 15px; padding: 13px 0; cursor: pointer;
  background: rgba(255,46,154,.08); border: 1px solid rgba(255,46,154,.4); color: var(--mag-soft);
  font-family: 'Bungee', sans-serif; font-size: 13px; letter-spacing: 1px;
}
.gmaps:active { transform: translateY(1px); }
.attrib { font-size: 7px; letter-spacing: .5px; color: rgba(223,252,255,.3); text-align: center; margin-top: 10px; }

/* ── Map markers ─────────────────────────────────────────────── */
.pin { position: relative; }
.pin .pin-dot { display: block; width: 15px; height: 15px; border-radius: 50%; border: 2px solid #060709; }
.pin .pin-ring { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; border-radius: 50%; transform: translate(-50%,-50%); animation: pinpulse 1.9s ease-out infinite; }
.pin .pin-tag { position: absolute; left: 16px; top: -5px; font-size: 8px; font-weight: 700; letter-spacing: 1px; background: rgba(6,8,11,.82); padding: 2px 5px; white-space: nowrap; }
.pin.start .pin-dot { background: var(--lime); box-shadow: 0 0 14px var(--lime); }
.pin.start .pin-ring { border: 2px solid var(--lime); }
.pin.start .pin-tag { color: var(--lime); }
.pin.end .pin-dot { background: var(--mag); box-shadow: 0 0 14px var(--mag); }
.pin.end .pin-ring { border: 2px solid var(--mag); }
.pin.end .pin-tag { color: var(--mag); }
@keyframes pinpulse { 0%{transform:translate(-50%,-50%) scale(.6);opacity:.85} 70%{transform:translate(-50%,-50%) scale(2.8);opacity:0} 100%{opacity:0} }

.spot { display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.spot-emoji { font-size: 15px; line-height: 1; filter: drop-shadow(0 0 6px rgba(52,245,255,.85)); }
.spot-cap { font-size: 7px; font-weight: 700; letter-spacing: .5px; color: rgba(52,245,255,.75); background: rgba(6,8,11,.78); padding: 1px 4px; white-space: nowrap; }

.live-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--cyan); border: 3px solid var(--pale); box-shadow: 0 0 0 2px var(--cyan), 0 0 12px var(--cyan); animation: livepulse 1.8s ease-out infinite; }
@keyframes livepulse { 0%{box-shadow:0 0 0 0 rgba(52,245,255,.5),0 0 12px var(--cyan)} 70%{box-shadow:0 0 0 15px rgba(52,245,255,0),0 0 12px var(--cyan)} 100%{box-shadow:0 0 0 0 rgba(52,245,255,0),0 0 12px var(--cyan)} }
.proj-dot { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--mag); box-shadow: 0 0 8px var(--mag); }

/* ── Toast ───────────────────────────────────────────────────── */
#toast {
  position: fixed; left: 50%; top: calc(86px + env(safe-area-inset-top)); transform: translateX(-50%) translateY(-6px);
  background: rgba(7,10,13,.95); border: 1px solid rgba(52,245,255,.4); color: var(--cyan-c);
  padding: 9px 14px; font-size: 11px; letter-spacing: .5px; box-shadow: 0 0 20px rgba(0,0,0,.6);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 40; max-width: 86%; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.warn { border-color: var(--amber); color: var(--amber); }

.spinner { width: 14px; height: 14px; border: 2px solid rgba(4,22,26,.3); border-top-color: #04161a; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .rec-dot, #fx-grain, #fx-track, .pin .pin-ring, .live-dot, .spinner { animation: none !important; }
  #sheet, #playhead { transition: none !important; }
}
