:root {
  --ink:    #0c1015;     /* base */
  --panel:  #11171f;     /* solid instrument bezel - no glass */
  --panel-2:#0d121a;
  --line:   #29333f;     /* hairline rules */
  --line-2: #1b232d;
  --text:   #e7ebef;
  --muted:  #8a96a2;
  --amber:  #e0a13a;     /* survey / contour ink - the accent */
  --amber-d:#7a5a1f;
  --amber-bg:#241b0d;
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ink); color: var(--text);
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { opacity: 0 !important; pointer-events: none !important; }

/* ── Registration frame (map-margin marks) ─────────────────────────────── */
.frame { position: fixed; inset: 14px; z-index: 5; pointer-events: none; }
.frame i {
  position: absolute; width: 16px; height: 16px;
  border-color: var(--line); border-style: solid; border-width: 0;
}
.frame i:nth-child(1) { top: 0; left: 0; border-top-width: 1px; border-left-width: 1px; }
.frame i:nth-child(2) { top: 0; right: 0; border-top-width: 1px; border-right-width: 1px; }
.frame i:nth-child(3) { bottom: 0; left: 0; border-bottom-width: 1px; border-left-width: 1px; }
.frame i:nth-child(4) { bottom: 0; right: 0; border-bottom-width: 1px; border-right-width: 1px; }

/* ── Mono utility labels ───────────────────────────────────────────────── */
.grouplabel, .eyebrow, .intro-tip, #byline, #readout, #stats,
button.upload, .panel-foot button, #enter, #intro-about, .modal-card h3 {
  font-family: var(--mono);
}

/* ── Intro ─────────────────────────────────────────────────────────────── */
#intro {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; padding: 0 8vw;
  transition: opacity 1s ease;
  /* topographic contour rings instead of a generic glow */
  background:
    repeating-radial-gradient(circle at 74% 36%,
      transparent 0 46px, rgba(224,161,58,0.045) 46px 47px),
    repeating-radial-gradient(circle at 74% 36%,
      transparent 0 184px, rgba(224,161,58,0.06) 184px 186px),
    linear-gradient(180deg, rgba(8,11,15,0.82), rgba(8,11,15,0.95));
}
.intro-inner { max-width: 640px; animation: rise 0.9s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.eyebrow {
  text-transform: uppercase; letter-spacing: 0.28em; font-size: 0.72rem;
  color: var(--amber); margin: 0 0 18px;
}
#intro h1 {
  margin: 0 0 22px; font-family: var(--display); font-weight: 700;
  font-size: clamp(2.1rem, 5.2vw, 3.6rem); line-height: 1.04; letter-spacing: -0.015em;
}
.lede { font-size: 1.04rem; line-height: 1.62; color: #cad3dc; max-width: 54ch; margin: 0 0 30px; }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.intro-tip { margin: 26px 0 0; font-size: 0.7rem; letter-spacing: 0.12em; color: var(--muted); }

/* ── Buttons (drafted, square, hairline) ───────────────────────────────── */
button {
  font-family: var(--mono); color: var(--text); cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 8px 11px; font-size: 0.78rem; letter-spacing: 0.02em;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
button:hover { border-color: var(--amber-d); }
button:active { transform: translateY(1px); }
button.active { background: var(--amber); border-color: var(--amber); color: #1a1206; font-weight: 600; }
button:disabled { opacity: 0.55; cursor: default; }

#enter {
  background: var(--amber); border-color: var(--amber); color: #1a1206;
  font-weight: 600; padding: 13px 26px; font-size: 0.82rem;
  text-transform: uppercase; letter-spacing: 0.14em; border-radius: 3px;
}
#enter:not(:disabled):hover { background: #ecb255; border-color: #ecb255; }
button.ghost { background: transparent; text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.74rem; }
button.ghost:hover { background: rgba(224,161,58,0.08); }
button.ghost.small { font-size: 0.7rem; }
#intro-about { padding: 13px 18px; }

button.upload {
  width: 100%; margin-top: 6px; border-style: dashed; color: var(--muted);
  font-size: 0.72rem; letter-spacing: 0.1em; padding: 9px;
}
button.upload:hover { color: var(--amber); border-color: var(--amber-d); }
.sample-link {
  display: block; margin-top: 7px; font-family: var(--mono); font-size: 0.64rem;
  letter-spacing: 0.04em; color: var(--muted); text-decoration: none; text-align: center;
}
.sample-link:hover { color: var(--amber); text-decoration: underline; }

/* ── HUD ───────────────────────────────────────────────────────────────── */
#titlebar {
  position: fixed; top: 24px; left: 28px; z-index: 10; pointer-events: none;
  display: flex; align-items: center; gap: 10px; transition: opacity 0.6s ease;
}
.tb-mark {
  font-family: var(--mono); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.1em;
  color: #1a1206; background: var(--amber); padding: 3px 6px; border-radius: 2px;
}
.tb-name { font-size: 0.95rem; font-weight: 500; letter-spacing: 0.01em; }
.tb-tag {
  font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.18em;
  color: var(--amber); border: 1px solid var(--amber-d);
  padding: 2px 6px; border-radius: 2px; margin-left: 4px;
}

#readout {
  position: fixed; top: 22px; right: 30px; z-index: 10; text-align: right;
  transition: opacity 0.6s ease; pointer-events: none;
}
.ro-title { font-size: 0.74rem; letter-spacing: 0.08em; color: var(--text); }
.ro-coord { font-size: 0.7rem; color: var(--muted); margin-top: 3px; }
.compass {
  position: relative; width: 38px; height: 38px; margin: 10px 0 0 auto;
  border: 1px solid var(--line); border-radius: 50%;
}
.compass .card-n {
  position: absolute; top: 1px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 0.6rem; color: var(--muted);
}
.compass .needle {
  position: absolute; top: 50%; left: 50%; width: 2px; height: 15px;
  background: var(--amber); transform-origin: 50% 100%;
  transform: translate(-50%, -100%) rotate(0deg);
}

#panel {
  position: fixed; top: 74px; left: 28px; width: 274px; z-index: 10;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  padding: 16px; box-shadow: 0 18px 50px rgba(0,0,0,0.55);
  transition: opacity 0.6s ease;
}

.group { margin-bottom: 15px; }
.grouplabel {
  display: block; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--muted); margin-bottom: 8px;
}
.grouplabel .hint { text-transform: none; letter-spacing: 0.04em; opacity: 0.66; }

.row { display: flex; flex-wrap: wrap; gap: 6px; }
.row button { flex: 1 1 auto; min-width: 54px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

input[type=range] { width: 100%; accent-color: var(--amber); }

#stats {
  margin: 14px 0 6px; padding-top: 12px; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 0.74rem;
}
#stats dt { color: var(--muted); letter-spacing: 0.04em; }
#stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; color: var(--amber); }

.panel-foot { margin-top: 8px; }
#source { margin: 10px 0 0; font-family: var(--display); font-size: 0.68rem; color: var(--muted); line-height: 1.45; }

#loading {
  position: fixed; bottom: 46px; right: 30px; z-index: 11; font-family: var(--mono);
  font-size: 0.74rem; color: var(--amber);
  background: var(--panel); border: 1px solid var(--line);
  padding: 8px 13px; border-radius: 3px; transition: opacity 0.3s ease;
}

/* ── Byline (every screen) ─────────────────────────────────────────────── */
/* black ink on a paper chip - legible on any background (map-credit stamp) */
#byline {
  position: fixed; bottom: 20px; right: 28px; z-index: 30;
  font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.07em;
  color: #0c1015; text-decoration: none;
  background: rgba(234, 237, 241, 0.94); border: 1px solid rgba(0, 0, 0, 0.22);
  padding: 5px 9px; border-radius: 2px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: background 0.15s ease;
}
#byline:hover { background: #ffffff; }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center;
  justify-content: center; padding: 24px; background: rgba(6,9,13,0.74);
  transition: opacity 0.3s ease;
}
.modal-card {
  position: relative; max-width: 660px; max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  padding: 32px 36px; box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.modal-card h2 { margin: 0 0 14px; font-family: var(--display); font-size: 1.5rem; }
.modal-card h3 {
  margin: 22px 0 8px; font-size: 0.74rem; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--amber);
}
.modal-card p, .modal-card li { font-size: 0.92rem; line-height: 1.62; color: #d2dbe4; }
.modal-card .pipeline { padding-left: 20px; }
.modal-card .pipeline li { margin: 6px 0; }
.modal-card .tech { list-style: none; padding: 0; }
.modal-card .tech li { margin: 8px 0; padding-left: 16px; position: relative; }
.modal-card .tech li::before {
  content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px;
  background: var(--amber);
}
.repo-link { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.modal-card a { color: var(--amber); }
.modal-close {
  position: absolute; top: 14px; right: 16px; width: 34px; height: 34px;
  border-radius: 3px; font-size: 1.4rem; line-height: 1; padding: 0;
}

@media (max-width: 760px) {
  #panel { top: auto; bottom: 44px; left: 12px; right: 12px; width: auto; }
  #readout { top: 16px; right: 18px; }
  #titlebar { top: 16px; left: 18px; }
  #intro { padding: 0 7vw; }
  .modal-card { padding: 24px; }
  #byline { right: 14px; bottom: 14px; }
}
