:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #0b0f14;
  --line: #2d333b;
  --ink: #e6edf3;
  --quiet: #8b949e;
  --accent: #f5b301;
  --good: #3fb950;
  --bad: #f85149;
  --face: #050608;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
button, input { font: inherit; color: inherit; }
button {
  background: #21262d; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; touch-action: manipulation;
}
button:active { background: #30363d; }
button.primary { background: var(--accent); color: #111; border-color: var(--accent); font-weight: 700; }
button.danger { color: var(--bad); }
[hidden] { display: none !important; }

/* sign in */
#login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: 100%; max-width: 360px; }
.brand { color: var(--accent); letter-spacing: .2em; font-size: 12px; font-weight: 700; }
.login-card h1 { margin: 4px 0 24px; font-size: 28px; }
.login-card label { display: block; margin-bottom: 16px; color: var(--quiet); font-size: 14px; }
.login-card input {
  display: block; width: 100%; margin-top: 6px; padding: 12px; font-size: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; text-transform: uppercase;
}
.login-card button { width: 100%; padding: 14px; font-size: 18px; }
.error { color: var(--bad); min-height: 1.4em; }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: 10px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
}
.callsign { font-weight: 800; font-size: 20px; letter-spacing: .05em; }
.sub { color: var(--quiet); font-size: 13px; }
.status { display: flex; gap: 6px; align-items: center; }
.pill { font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 999px; background: #21262d; color: var(--quiet); white-space: nowrap; }
.pill.ok { color: var(--good); }
.pill.warn { color: var(--accent); }
.pill.bad { color: var(--bad); }
.icon-btn { padding: 4px 12px; font-size: 20px; line-height: 1; }

.menu {
  position: sticky; top: 58px; z-index: 9; display: grid; gap: 8px; padding: 12px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.menu-row { display: flex; justify-content: space-between; color: var(--quiet); }
.menu-row b { color: var(--ink); text-transform: capitalize; }

.banner {
  margin: 12px 16px 0; padding: 12px; border-radius: 10px; background: #2a1f00; border: 1px solid #6b5200;
  display: grid; gap: 10px; font-size: 15px;
}
.banner-actions { display: flex; gap: 12px; align-items: center; }
.banner a { color: var(--accent); }

/* panels */
.panels { display: grid; gap: 16px; padding: 16px; max-width: 980px; margin: 0 auto; }
@media (min-width: 760px) { .panels { grid-template-columns: 1fr 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.panel-title { font-size: 12px; font-weight: 800; letter-spacing: .12em; color: var(--accent); }
.station { font-size: 13px; color: var(--quiet); text-align: right; }

.tuner { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 6px; align-items: center; }
.tuner button { padding: 12px 6px; min-width: 40px; }
.freq {
  width: 100%; min-width: 0; text-align: center; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: clamp(22px, 7vw, 30px); font-weight: 700; color: #ffcf4d; background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 4px; letter-spacing: .04em;
}
.unit { text-align: center; color: var(--quiet); font-size: 12px; margin: 2px 0 8px; }

.instrument-wrap { display: grid; gap: 10px; }
.instrument { width: 100%; max-width: 320px; margin: 0 auto; display: block; touch-action: none; user-select: none; }

.obs { display: grid; grid-template-columns: auto auto 1fr auto auto; gap: 6px; align-items: center; }
.obs button { padding: 10px 8px; min-width: 46px; }
.obs-read { text-align: center; color: var(--quiet); }
.obs-read b, .readouts b { font-family: ui-monospace, Consolas, monospace; color: var(--ink); font-size: 20px; }

.readouts { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.readouts > div { display: flex; gap: 8px; align-items: baseline; }
.readouts span { color: var(--quiet); font-size: 12px; font-weight: 700; }
.ident-btn { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .08em; }
.lamp { width: 12px; height: 12px; border-radius: 50%; background: #3a2a00; border: 1px solid #5a4500; }
.lamp.on { background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* simple mode */
.simple { display: grid; gap: 10px; text-align: center; padding: 8px 0; }
.simple .big { font-size: 26px; font-weight: 800; line-height: 1.2; }
.simple .big em { font-style: normal; color: var(--accent); }
.simple .line { color: var(--quiet); font-size: 15px; }
.simple .line b { color: var(--ink); }
.simple .arrow { width: 120px; height: 120px; margin: 0 auto; }
.simple .off { color: var(--bad); font-weight: 700; font-size: 18px; }

/* test mode */
.sim { margin: 0 16px 16px; }
#sim-map { height: 300px; border-radius: 8px; }
.sim-hdg { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--quiet); }
.sim-hdg input { flex: 1; }

/* station list */
dialog { background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; width: min(560px, calc(100vw - 32px)); max-height: 80vh; }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h2 { margin: 0 0 4px; }
dialog table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
dialog th, dialog td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
dialog td:last-child, dialog th:last-child { text-align: right; font-family: ui-monospace, Consolas, monospace; }
