:root {
  color-scheme: dark;
  --bg: #081019;
  --panel: #0d1721;
  --panel-2: #101d29;
  --line: #223447;
  --line-strong: #34506a;
  --text: #edf4fa;
  --muted: #91a2b3;
  --accent: #85c9ff;
  --accent-strong: #b6e0ff;
  --warning: #f3d27e;
  --warning-bg: #1e190d;
  --ok: #8fe1b6;
  --error: #ff9e9e;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% -10%, rgba(52, 101, 143, .28), transparent 34rem),
    linear-gradient(180deg, #09111a 0%, #070d13 100%);
}

button, input { font: inherit; }

.topbar,
main,
footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 34px 0 22px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.eyebrow,
.kicker,
.section-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent);
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 3.8rem);
  letter-spacing: -.05em;
  line-height: .95;
}

h2 {
  max-width: 14ch;
  margin-bottom: 18px;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: .98;
  letter-spacing: -.055em;
}

h3 {
  margin-bottom: 0;
  font-size: 1.16rem;
}

.status-pill,
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  white-space: nowrap;
  font-size: .82rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 14px rgba(243,210,126,.55);
}

main { padding: 26px 0 10px; }

.warning {
  padding: 13px 16px;
  border: 1px solid #4e4225;
  border-radius: 12px;
  background: var(--warning-bg);
  color: #dccb9a;
  line-height: 1.5;
}

.warning strong { color: var(--warning); }

.hero {
  display: grid;
  grid-template-columns: 1.35fr .65fr;
  gap: 28px;
  align-items: end;
  padding: clamp(46px, 8vw, 88px) 0;
}

.hero > div > p:last-child {
  max-width: 64ch;
  color: #b8c5d0;
  line-height: 1.7;
}

.hero-card,
.panel,
.mini-panel {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17,30,42,.94), rgba(10,19,28,.94));
  box-shadow: 0 18px 70px rgba(0,0,0,.18);
}

.hero-card {
  border-radius: 18px;
  overflow: hidden;
}

.metric {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.metric:last-child { border-bottom: 0; }
.metric span { color: var(--muted); }
.metric strong { text-align: right; }

.workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.panel {
  border-radius: 18px;
  padding: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.badge {
  padding: 6px 9px;
  font-size: .73rem;
  white-space: nowrap;
}

.address-search {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.address-search .button-row {
  margin-top: 12px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field-grid label:last-child {
  grid-column: 1 / -1;
}

label em {
  color: var(--muted);
  font-size: .74rem;
  font-style: normal;
  font-weight: 500;
}

label {
  display: grid;
  gap: 7px;
  color: #d8e1e8;
  font-size: .9rem;
}

label span { font-weight: 650; }

small {
  color: #6f8395;
  font-size: .76rem;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  padding: 0 13px;
  color: var(--text);
  background: #08121b;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(133,201,255,.09);
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

button {
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  padding: 10px 14px;
  cursor: pointer;
}

button.primary {
  color: #07111a;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  font-weight: 750;
}

button.secondary {
  color: #c4d0da;
  background: transparent;
}

button:hover { filter: brightness(1.05); }

.message {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.45;
}

.message.ok { color: var(--ok); }
.message.error { color: var(--error); }

.precision-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 18px;
}

.precision-card {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,13,20,.5);
}

.precision-card strong { font-size: 1.3rem; }
.precision-name { color: var(--muted); font-size: .75rem; }
.precision-card code {
  color: var(--accent-strong);
  font-size: .72rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.result-placeholder,
.map-placeholder {
  position: relative;
  overflow: hidden;
  border: 1px dashed var(--line-strong);
  background: #071019;
}

.result-placeholder {
  min-height: 205px;
  margin-top: 18px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

.crosshair {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 54px;
  height: 54px;
  translate: -50% -50%;
  border: 1px solid rgba(133,201,255,.35);
  border-radius: 50%;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(133,201,255,.35);
}

.crosshair::before {
  width: 80px;
  height: 1px;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
}

.crosshair::after {
  width: 1px;
  height: 80px;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
}

.result-placeholder p {
  position: relative;
  z-index: 1;
  max-width: 36ch;
  margin: 88px 0 0;
}

.map-panel { margin-top: 18px; }

.map-placeholder {
  min-height: 330px;
  border-style: solid;
  border-radius: 14px;
  display: grid;
  place-items: center;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  opacity: .18;
  background-image:
    linear-gradient(rgba(133,201,255,.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(133,201,255,.25) 1px, transparent 1px);
  background-size: 40px 40px;
}

.map-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
  padding: 30px;
  text-align: center;
}

.map-copy strong { font-size: 1.25rem; }
.map-copy p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 18px 0 34px;
}

.mini-panel {
  min-height: 165px;
  border-radius: 16px;
  padding: 20px;
}

.mini-panel p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 40px;
  border-top: 1px solid rgba(255,255,255,.06);
  color: #607386;
  font-size: .78rem;
}

@media (max-width: 820px) {
  .hero,
  .workspace,
  .project-grid {
    grid-template-columns: 1fr;
  }

  .hero { padding: 52px 0; }
  h2 { max-width: 16ch; }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-grid,
  .precision-grid {
    grid-template-columns: 1fr;
  }

  .panel { padding: 18px; }
  .panel-heading { flex-direction: column; gap: 10px; }
  .button-row { flex-direction: column; }
  button { width: 100%; }

  footer {
    flex-direction: column;
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
}


.decode-copy {
  position: relative;
  z-index: 1;
  width: 100%;
}

.decode-copy p {
  margin: 12px auto 10px;
}

#decoded-corners {
  display: block;
  color: #6f8395;
  font-size: .72rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.map-heading {
  margin-bottom: 14px;
}

.map-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.map-toolbar #map-message {
  margin-left: auto;
  color: var(--muted);
  font-size: .82rem;
}

.meridian-map {
  width: 100%;
  height: min(62vh, 610px);
  min-height: 410px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  background: #071019;
  z-index: 0;
}

.map-readout {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(5,13,20,.55);
}

.map-readout span {
  color: var(--muted);
  font-size: .78rem;
}

.map-readout code {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
  text-align: right;
}

.map-note {
  margin: 11px 2px 0;
  color: #6f8395;
  font-size: .76rem;
  line-height: 1.5;
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-control-attribution {
  font-size: 10px;
}

@media (max-width: 680px) {
  .map-toolbar {
    align-items: stretch;
  }

  .map-toolbar button {
    width: 100%;
  }

  .map-toolbar #map-message {
    width: 100%;
    margin-left: 0;
    line-height: 1.4;
  }

  .meridian-map {
    min-height: 360px;
    height: 55vh;
  }

  .map-readout {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-readout code {
    text-align: left;
  }
}


.map-readout > div {
  display: grid;
  gap: 5px;
}

.map-readout > div:last-child {
  text-align: right;
}


.map-mode.active {
  color: #07111a;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  font-weight: 750;
}


.resolution-control {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,13,20,.5);
}

.resolution-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 12px;
}

.resolution-heading > div {
  display: grid;
  gap: 4px;
}

.resolution-heading span,
.selected-output span {
  color: var(--muted);
  font-size: .76rem;
}

.resolution-heading strong {
  font-size: 1.5rem;
}

#resolution-slider {
  min-height: auto;
  padding: 0;
  accent-color: var(--accent-strong);
}

.resolution-scale {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 8px;
  color: #6f8395;
  font-size: .66rem;
  text-align: center;
}

.resolution-scale span:first-child { text-align: left; }
.resolution-scale span:last-child { text-align: right; }

.selected-output {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.selected-output > div {
  display: grid;
  gap: 6px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,13,20,.5);
}

.selected-output code {
  color: var(--accent-strong);
  font-size: .95rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.selected-output strong {
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#decoded-address {
  margin: 10px auto 0;
  color: var(--text);
  line-height: 1.45;
}

.map-address-readout {
  flex: 1 1 100%;
  text-align: left !important;
}

.map-readout {
  flex-wrap: wrap;
}

.map-address-readout code {
  text-align: left;
  white-space: normal;
}

@media (max-width: 680px) {
  .resolution-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .resolution-scale {
    font-size: .58rem;
  }
}


.map-resolution-control {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5,13,20,.5);
}

.map-resolution-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.map-resolution-heading span {
  color: var(--muted);
  font-size: .76rem;
}

.map-resolution-heading strong {
  font-size: 1.15rem;
}

.map-resolution-heading small {
  margin-left: auto;
}

#map-resolution-slider {
  min-height: auto;
  padding: 0;
  accent-color: var(--accent-strong);
}

@media (max-width: 680px) {
  .map-resolution-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .map-resolution-heading small {
    width: 100%;
    margin-left: 0;
  }
}
