:root {
  --bg: #11151c;
  --panel: #1b212b;
  --ink: #e8ecf1;
  --muted: #9aa6b4;
  --accent: #ff3b30;
  --line: #2a3340;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding: 24px 16px 48px;
  max-width: 1100px;
  margin-inline: auto;
}

header h1 { margin: 0 0 4px; font-size: 1.5rem; }
.sub { margin: 0 0 20px; color: var(--muted); }

form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

#query {
  flex: 1;
  padding: 10px 12px;
  font-size: 1rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}
#query:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button:disabled { opacity: .5; cursor: progress; }

.status { min-height: 1.4em; margin: 0 0 12px; color: var(--muted); }
.status.error { color: #ff6b61; }

.modes { display: inline-flex; gap: 0; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mode {
  padding: 7px 14px; font-size: .9rem; font-weight: 600;
  background: var(--panel); color: var(--muted); border: 0; border-radius: 0; cursor: pointer;
}
.mode + .mode { border-left: 1px solid var(--line); }
.mode.active { background: var(--accent); color: #fff; }

#stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  overflow: auto;
}

#map {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
  cursor: crosshair;
  touch-action: none;
}

.result {
  margin-top: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px;
}
.result.hidden { display: none; }
.result h2 { margin: 0 0 12px; font-size: 1.15rem; }

dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px 24px; margin: 0; }
dl div { display: flex; flex-direction: column; }
dt { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
dd { margin: 2px 0 0; font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }

footer { margin-top: 28px; color: var(--muted); font-size: .85rem; }
footer p { margin: 4px 0; }
footer a { color: var(--muted); }
