@font-face {
  font-family: Inter;
  src: url("../assets/Inter-Variable.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #030405;
  --bg-2: #07090a;
  --bg-3: #0b0d0e;
  --ink: #f3f3ef;
  --text: #d8ffe0;
  --muted: #d2d2cc;
  --dim: #9a9a94;
  --lbl: #7d8a86;
  --line: #1d2622;
  --line-2: #2a2a2a;
  --ice: #93C5FD;
  --ice-deep: #60A5FA;
  --amber: #F59E0B;
  --brand-amber: #ffb000;
  --cyan: #00e5ff;
  --green: #39ff14;
  --lime: #b6ff00;
  --ex: #FBBF24;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --radius: 10px;
  --nav-h: 64px;
  --top-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  min-height: 100%;
}
html, body, #app-shell, #view, .screen, .panel, .card, .topbar, .dock, .sidenav, .bottom-nav {
  background-color: var(--bg);
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--cyan); }

body.is-printing { background: #000; }

.ex {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 800;
  color: #111;
  background: var(--ex);
  padding: 2px 5px;
  border-radius: 3px;
  line-height: 1.15;
  vertical-align: middle;
  text-transform: uppercase;
}

/* Chrome */
#app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  flex: 0 0 auto;
  min-height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: #050505;
  position: sticky;
  top: 0;
  z-index: 40;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
}
.brand-art {
  width: 36px;
  height: 36px;
  background: #030405;
  border-radius: 6px;
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #030405;
}
.wordmark {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.private-pill {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ex);
  border: 1px solid #5a4a10;
  padding: 3px 6px;
  border-radius: 999px;
  white-space: nowrap;
}
.topbar .spacer { flex: 1; }
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  overflow: hidden;
  background: #0b0d0e;
}
.lang-switch button {
  background: transparent;
  border: 0;
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 6px 8px;
}
.lang-switch button.on { background: #152033; color: var(--ice); }

/* Keep the top bar on one row at phone widths: no overlap, nothing clipped. */
.topbar .private-pill,
.topbar .lang-switch,
.topbar .plan-chip,
.topbar .club-escape {
  flex: 0 0 auto;
}
.topbar .brand-lockup {
  flex: 1 1 auto;
  min-width: 0;
}
@media (max-width: 599px) {
  .topbar {
    gap: 6px;
    padding: 8px 8px;
  }
  .brand-art { width: 28px; height: 28px; }
  .wordmark {
    font-size: 11px;
    letter-spacing: 0.06em;
  }
  .private-pill {
    font-size: 8px;
    letter-spacing: 0.08em;
    padding: 2px 5px;
  }
  .lang-switch button { padding: 5px 6px; }
  .topbar .plan-chip { display: none; }
}

#view { flex: 1 1 auto; min-height: 0; width: 100%; }
.screen {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px 16px 96px;
}
.screen.full { width: 100%; max-width: none; padding: 0 0 72px; display: flex; flex-direction: column; min-height: calc(100dvh - var(--top-h) - var(--nav-h)); }
.screen.wide { width: min(1280px, 100%); }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.03em; margin: 0 0 8px; }
h1 { font-size: 28px; }
h2 { font-size: 20px; }
.kicker {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brand-amber);
  font-weight: 600;
}
.deck { margin: 0 0 18px; color: var(--muted); line-height: 1.5; font-size: 15px; max-width: 40em; }
.note, .side-note, .hint { color: var(--dim); font-size: 13px; line-height: 1.45; }

.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  background: #1c1c1c;
  color: var(--ink);
}
.btn.pri { background: var(--amber); color: #111; border-color: var(--amber); }
.btn.ghost { background: transparent; color: var(--ink); border-color: #3a3a3a; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.gold { background: #140e00; border-color: var(--brand-amber); color: var(--brand-amber); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions .btn { flex: 1 1 140px; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.field label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--lbl); font-weight: 650; }
.field input, .field select, .field textarea {
  height: 44px;
  background: #141414;
  border: 1px solid #2c2c2c;
  border-radius: 8px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--ink);
}
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; }

.card, .block, .event-card, .site-card {
  background: #0c0c0c;
  border: 1px solid #262626;
  border-radius: 12px;
  padding: 14px 16px;
}
.card + .card, .site-card + .site-card, .event-card + .event-card { margin-top: 10px; }
.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 16px;
  line-height: 1.4;
}
.row .v { font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.row b { font-weight: 650; }
.hr { height: 1px; background: #222; border: 0; margin: 8px 0; }

/* Welcome */
.welcome {
  min-height: calc(100dvh - var(--top-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px 80px;
}
.welcome-art {
  width: min(280px, 70vw);
  aspect-ratio: 1 / 1;
  background: #030405;
  margin: 0 auto 20px;
}
.welcome-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: #030405;
}
.welcome h1 { font-size: clamp(28px, 7vw, 48px); letter-spacing: -0.04em; max-width: 16ch; margin-left: auto; margin-right: auto; }
.welcome .deck { margin-left: auto; margin-right: auto; }
.welcome .wm {
  width: min(180px, 50vw);
  height: auto;
  margin: 0 auto 12px;
  background: #030405;
}

/* Toggles */
.toggle {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #1a1a1a;
}
.toggle:last-child { border-bottom: 0; }
.switch {
  position: relative;
  width: 48px; height: 28px; flex: 0 0 48px;
  background: #1c1c1c;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
}
.switch[aria-pressed="true"] { background: #152033; border-color: var(--ice-deep); }
.switch i {
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #888;
  transition: left .15s ease, background .15s ease;
}
.switch[aria-pressed="true"] i { left: 23px; background: var(--ice); }

/* Stepper for inches */
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper .val { font-size: 28px; font-weight: 650; font-variant-numeric: tabular-nums; min-width: 4ch; text-align: center; }
.stepper .btn { width: 44px; flex: 0 0 44px; padding: 0; height: 44px; }

/* Maps — never crop */
.map-frame {
  position: relative;
  background: #000;
  width: 100%;
  min-height: 200px;
  overflow: hidden;
}
.map-frame.svg-host { display: flex; align-items: center; justify-content: center; }
.map-svg {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}
/* Phone / tall frames letterbox the 16:10 aerial */
.map-frame.contain-box {
  aspect-ratio: auto;
  background: #000;
}
.work {
  flex: 1;
  display: flex;
  min-height: 0;
  background: #000;
}
.work.split { flex-direction: column; }
.side {
  background: #0b0b0b;
  border-top: 1px solid #222;
  padding: 16px;
}
.tools-rail {
  display: none;
}

/* Bottom nav */
.bottom-nav {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: #050505;
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
}
.bottom-nav button {
  background: transparent;
  border: 0;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 8px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.bottom-nav button.on { color: var(--ice); }
.bottom-nav button .ico {
  width: 22px; height: 3px; border-radius: 2px; background: currentColor;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 22px 0 10px;
}
.muted { color: var(--dim); }
.site-card h3, .event-card h3 { font-size: 17px; margin: 0 0 4px; }
.site-card .meta, .event-card .meta { color: var(--dim); font-size: 13px; }

/* Gold */
.pricing { padding: 8px 0 24px; }
.plans { display: grid; gap: 12px; }
.plan {
  border: 1px solid #2a2a2a;
  border-radius: 14px;
  padding: 20px;
  background: #0c0c0c;
}
.plan.hi { border-color: var(--brand-amber); }
.plan .name { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.plan .price { font-size: 44px; font-weight: 650; letter-spacing: -0.04em; margin: 8px 0 4px; }
.plan .unit { font-size: 18px; font-weight: 500; color: var(--muted); }
.plan .fine { font-size: 15px; color: var(--muted); }
.perks { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.perks li {
  font-size: 16px;
  padding-left: 22px;
  position: relative;
  line-height: 1.4;
}
.perks li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 10px; height: 10px;
  background: var(--ice-deep);
  border-radius: 2px;
}

/* Extent picker */
.extent-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: #0b0b0b;
  border-bottom: 1px solid #222;
}
.status {
  padding: 8px 12px;
  color: var(--muted);
  font-size: 13px;
}
.status.err { color: #ffb0a0; }

/* Draw tools */
.draw-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: #0b0b0b;
  border-bottom: 1px solid #222;
}
.draw-tools .btn { height: 36px; font-size: 11px; padding: 0 10px; }
.draw-tools .btn.on { border-color: var(--ice); background: #152033; color: var(--ice); }

/* Preview banner */
.app-banner {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ex);
  text-align: center;
  padding: 6px 10px;
  background: #100e00;
  border-bottom: 1px solid #3a3200;
}

/* Print preview on screen */
.print-preview-wrap {
  background: #111;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
}
.print-preview-wrap .print-root {
  width: 8.5in;
  min-height: 11in;
  margin: 0 auto;
  transform-origin: top center;
}

/* Print document */
.print-root {
  color: #f3f3ef;
  background: #050505;
  font-family: var(--sans);
}
.print-root.ink {
  color: #111;
  background: #fff;
}
.print-sheet { padding: 0.45in 0.5in 0.4in; }
.print-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 2px solid #ffb000;
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.print-root.ink .print-head { border-bottom-color: #111; }
.print-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.03em; }
.print-head .sub { margin: 0; font-size: 13px; color: #c8c8c2; }
.print-root.ink .print-head .sub { color: #333; }
.print-meta { font-size: 13px; text-align: right; }
.print-map {
  background: #000;
  width: 100%;
  margin: 8px 0 12px;
  break-inside: avoid;
}
.print-root.ink .print-map { background: #fff; border: 1px solid #111; }
.print-map .map-svg { width: 100%; height: auto; aspect-ratio: 2400 / 1500; background: #000; }
.print-root.ink .print-map .map-svg { background: #fff; }
.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 0 0 14px;
}
.print-table th, .print-table td {
  border: 1px solid #333;
  padding: 8px 8px;
  text-align: left;
  vertical-align: top;
}
.print-root.ink .print-table th, .print-root.ink .print-table td { border-color: #111; }
.print-table th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c8c8c2;
}
.print-root.ink .print-table th { color: #111; background: #f0f0f0; }
.print-table .num { font-weight: 800; font-size: 18px; width: 2.2em; }
.print-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.print-block h3 {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #9a9a94;
  margin: 0 0 8px;
}
.print-root.ink .print-block h3 { color: #333; }
.sign-lines { display: grid; gap: 16px; margin-top: 8px; }
.sign-line { border-bottom: 1px solid #666; height: 28px; display: flex; justify-content: space-between; font-size: 11px; color: #9a9a94; }
.print-root.ink .sign-line { border-bottom-color: #111; color: #333; }
.notes-lines { display: grid; gap: 0; }
.notes-lines i { display: block; border-bottom: 1px solid #444; height: 26px; }
.print-root.ink .notes-lines i { border-bottom-color: #111; }
.print-foot {
  margin-top: 16px;
  padding-top: 8px;
  border-top: 1px solid #333;
  font-size: 10px;
  color: #9a9a94;
  line-height: 1.4;
}
.print-root.ink .print-foot { border-top-color: #111; color: #333; }
.zone-badge-svg { font-weight: 800; }

@media (min-width: 900px) {
  .topbar { padding: 8px 24px; }
  .screen { padding: 28px 28px 48px; }
  h1 { font-size: 34px; }
  .welcome h1 { max-width: 18ch; }
  .plans { grid-template-columns: 1fr 1fr; }
  .work.split { flex-direction: row; }
  .work.split .map-frame { flex: 1 1 auto; min-height: 0; }
  .work.split .side { flex: 0 0 36%; border-top: 0; border-left: 1px solid #222; overflow: auto; }
  .bottom-nav { display: none; }
  #app-shell { flex-direction: row; }
  .sidenav {
    display: flex;
    flex-direction: column;
    width: 200px;
    flex: 0 0 200px;
    border-right: 1px solid var(--line);
    background: #050505;
    padding: 16px 10px;
    gap: 4px;
  }
  .sidenav button {
    background: transparent;
    border: 0;
    color: var(--dim);
    text-align: left;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .sidenav button.on { background: #152033; color: var(--ice); }
  #app-shell .col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .tools-rail {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 10px;
    background: #0c0c0c;
    border-right: 1px solid #222;
    width: 52px;
    flex: 0 0 52px;
  }
  .tool {
    width: 32px; height: 32px; border-radius: 5px;
    background: #1c1c1c; border: 1px solid #2e2e2e;
  }
  .tool.on { border-color: var(--ice); background: #152033; }
  .desktop-split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 20px; align-items: start; }
}
@media (max-width: 899px) {
  .sidenav { display: none; }
}

.sidenav[hidden], .bottom-nav[hidden] { display: none !important; }

.screen.full {
  overflow: hidden;
  height: calc(100dvh - var(--top-h) - 32px);
  max-height: calc(100dvh - var(--top-h) - 32px);
  min-height: 0;
}
@media (max-width: 899px) {
  .screen.full {
    height: calc(100dvh - var(--top-h) - var(--nav-h) - 32px);
    max-height: calc(100dvh - var(--top-h) - var(--nav-h) - 32px);
  }
}
.screen.full > .map-frame,
.screen.full > #draw-map,
.screen.full > #extent-map {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: auto !important;
  height: auto;
}
.screen.full > .actions,
.screen.full > .extent-toolbar {
  flex: 0 0 auto;
  background: #050505;
  z-index: 6;
}
.screen.full > .actions {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #222;
}

/* Hide print root on screen unless previewing or dedicated print view */
#print-root { display: none; }
body.print-view #app-shell { display: none !important; }
body.print-view #print-root { display: block; }
body.print-view { background: #050505; }
body.print-view.ink-view { background: #fff; }

@media print {
  @page { size: Letter; margin: 0.4in; }
  html, body { background: #fff !important; }
  body { color: #111; }
  #app-shell, .app-banner, .bottom-nav, .sidenav, .topbar { display: none !important; }
  #print-root, #print-root .print-root { display: block !important; width: auto; min-height: 0; background: transparent; }
  #print-root .print-sheet { padding: 0; }
  .print-root.dark, .print-root:not(.ink) {
    background: #050505 !important;
    color: #f3f3ef !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-root.ink {
    background: #fff !important;
    color: #111 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-map, .print-map .map-svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a[href]::after { content: none !important; }
}

/* Reveal animation */
.layer-anim { opacity: 0; }
.layer-anim.show { animation: fadeLayer .55s ease forwards; }
@keyframes fadeLayer { from { opacity: 0; } to { opacity: 1; } }
