/* Radar — dark tower theme, one system for phone and desktop. */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --panel: #0b1114; --raised: #1c2129; --stroke: rgba(255,255,255,0.09);
  --text: #f1f5f9; --dim: #94a3b8;
  --green: #4ade80; --cyan: #38bdf8; --amber: #fbbf24; --red: #f87171;
  --magenta: #de6bfa; --pro: #a78bfa;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
html, body { height: 100%; overscroll-behavior: none; }
body { background: var(--panel); color: var(--text); font-family: var(--sans); }
button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
.mono { font-family: var(--mono); }

.screen { position: fixed; inset: 0; display: none; }
.screen.active { display: flex; }

/* ---------- Home ---------- */
#home { flex-direction: column; overflow-y: auto; display: none; }
#home.active { display: block; }
.home-inner { max-width: 1060px; margin: 0 auto; padding: 18px 16px 60px; }
.home-top { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; }
.home-top h1 { font-size: 26px; letter-spacing: 5px; color: var(--green);
  text-shadow: 0 0 18px rgba(74,222,128,0.45); }
.home-top .logo { width: 40px; height: 40px; border-radius: 50%; flex: none;
  border: 2px solid rgba(74,222,128,0.5); position: relative; overflow: hidden; }
.home-top .logo::after { content: ""; position: absolute; inset: 0;
  background: conic-gradient(from 0deg, rgba(74,222,128,0.55), transparent 70deg);
  animation: sweep 3s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.section-label { font-family: var(--mono); font-size: 11px; letter-spacing: 2px;
  color: var(--dim); margin: 22px 0 10px; }
.home-top .sub { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.home-top .spacer { flex: 1; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,0.08);
  display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.pills { display: flex; gap: 8px; margin: 10px 0 18px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  background: var(--raised); font-family: var(--mono); font-size: 12px; }
.pill .amber { color: var(--amber); } .pill .green { color: var(--green); }

.daily-card, .training-card { width: 100%; text-align: left; display: flex; align-items: center; gap: 14px;
  padding: 15px 16px; border-radius: 16px; margin-bottom: 16px;
  background: linear-gradient(120deg, rgba(251,191,36,0.13), var(--raised));
  border: 1px solid rgba(251,191,36,0.4); }
.training-card { background: linear-gradient(120deg, rgba(74,222,128,0.12), var(--raised));
  border-color: rgba(74,222,128,0.4); }
.daily-card .dot, .training-card .dot { width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: rgba(251,191,36,0.15); }
.training-card .dot { background: rgba(74,222,128,0.15); }
.card-title { font-size: 17px; font-weight: 700; }
.card-kicker { font-family: var(--mono); font-size: 10px; color: var(--amber); letter-spacing: 1px; }
.training-card .card-kicker { color: var(--green); }
.card-sub { font-size: 12px; color: var(--dim); margin-top: 2px; }
.card-chev { margin-left: auto; color: var(--amber); font-size: 18px; }
.training-card .card-chev { color: var(--green); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.level-card { text-align: left; background: var(--raised); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 14px; transition: transform 0.1s; }
.level-card:not(.locked):hover { transform: translateY(-2px); border-color: rgba(74,222,128,0.5); }
.level-card.locked { opacity: 0.55; }
.level-card .row { display: flex; justify-content: space-between; align-items: baseline; }
.level-card .idx { font-family: var(--mono); font-size: 12px; color: var(--cyan); }
.level-card .stars { color: var(--amber); font-size: 13px; letter-spacing: 2px; }
.level-card .stars .off { color: rgba(255,255,255,0.18); }
.level-card h3 { font-size: 16px; margin: 6px 0 2px; }
.level-card .city { font-size: 12px; color: var(--dim); }
.level-card .meta { font-family: var(--mono); font-size: 11px; color: var(--dim); margin-top: 9px; }
.level-card .lockline { font-family: var(--mono); font-size: 10px; color: var(--amber); margin-top: 8px; }

.record { margin-top: 26px; background: var(--raised); border: 1px solid var(--stroke);
  border-radius: 16px; padding: 16px; }
.record h2 { font-size: 15px; margin-bottom: 10px; }
.record .cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.record .cell { background: rgba(255,255,255,0.04); border-radius: 12px; padding: 10px; }
.record .cell b { font-family: var(--mono); font-size: 18px; display: block; }
.record .cell span { font-size: 11px; color: var(--dim); }

.foot { margin-top: 26px; font-size: 11px; color: var(--dim); text-align: center; }

/* ---------- Game ---------- */
#game { flex-direction: column; }
.hud { display: flex; align-items: center; gap: 4px; padding: 8px 12px;
  background: rgba(18,24,29,0.92); backdrop-filter: blur(8px); z-index: 5; }
.hud .readout { text-align: center; min-width: 58px; }
.hud .readout b { font-family: var(--mono); font-size: 16px; display: block; }
.hud .readout span { font-family: var(--mono); font-size: 8px; color: var(--dim); letter-spacing: 1px; }
.hud .spacer { flex: 1; }
.hud .rwy b { color: var(--amber); }
.hud .done b { color: var(--green); }
.hud .alerts.bad b { color: var(--red); }

.stage { position: relative; flex: 1; min-height: 0; display: flex; }
.radar-wrap { position: relative; flex: 1; min-width: 0; touch-action: none; }
canvas#radar { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.float-tools { position: absolute; top: 10px; right: 12px; display: flex; gap: 8px; z-index: 4; }
.speed-box { display: flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(11,17,20,0.85); border: 1px solid var(--stroke); }
.speed-box button { font-family: var(--mono); font-size: 13px; color: var(--dim);
  width: 38px; height: 30px; border-radius: 9px; }
.speed-box button.on { background: var(--cyan); color: var(--panel); }
.corner-stack { position: absolute; top: 10px; left: 12px; z-index: 4;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
#zoomChip { display: none; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px;
  background: var(--amber); color: var(--panel); font-family: var(--mono); font-size: 12px; font-weight: 700; }
#zoomChip.show { display: inline-flex; }

.crt { position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.14) 0 1px, transparent 1px 3px); opacity: 0.5; }
.vignette { position: absolute; inset: 0; pointer-events: none; z-index: 2;
  box-shadow: inset 0 0 120px 30px rgba(0,0,0,0.55); }
#alarmEdge { position: absolute; inset: 0; pointer-events: none; z-index: 3; opacity: 0;
  box-shadow: inset 0 0 34px 10px rgba(248,113,113,0.85); transition: opacity 0.45s; }
#alarmEdge.on { opacity: 1; transition: opacity 0.05s; }

#coach { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 4; display: none;
  align-items: flex-start; gap: 10px; padding: 13px; border-radius: 16px;
  background: rgba(28,33,41,0.96); border: 1px solid rgba(251,191,36,0.5);
  box-shadow: 0 6px 24px rgba(0,0,0,0.5); }
#coach.show { display: flex; }
#coach .hand { width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--amber);
  color: var(--panel); display: flex; align-items: center; justify-content: center;
  animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(0.94); } 50% { transform: scale(1.08); } }
#coach p { font-size: 14px; line-height: 1.4; }

#msgLine { position: absolute; left: 50%; transform: translateX(-50%); bottom: 12px; z-index: 3;
  font-family: var(--mono); font-size: 12px; color: var(--text); background: rgba(11,17,20,0.85);
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--stroke);
  white-space: nowrap; display: none; }
#msgLine.show { display: block; }

#chooser { position: absolute; z-index: 6; width: 140px; padding: 8px; border-radius: 13px;
  background: var(--raised); border: 1px solid rgba(56,189,248,0.5);
  box-shadow: 0 6px 20px rgba(0,0,0,0.6); display: none; }
#chooser.show { display: block; }
#chooser .q { font-family: var(--mono); font-size: 9px; color: var(--dim); text-align: center; margin-bottom: 4px; }
#chooser button { display: block; width: 100%; font-family: var(--mono); font-size: 14px;
  padding: 8px; border-radius: 8px; background: rgba(255,255,255,0.09); margin-top: 4px; }

/* control panel */
.panel { background: var(--raised); border-radius: 22px 22px 0 0; padding: 14px;
  display: flex; flex-direction: column; gap: 10px; z-index: 5; }
.panel .empty { text-align: center; padding: 18px 0 8px; }
.panel .empty b { font-size: 16px; display: block; }
.panel .empty span { font-size: 13px; color: var(--dim); }
.sel-head { display: flex; align-items: center; gap: 8px; }
.sel-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cyan); }
.sel-head .cs { font-family: var(--mono); font-size: 18px; }
.sel-head .role { font-size: 12px; color: var(--dim); }
.sel-head .fuel { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--dim); }
.sel-head .fuel.low { color: var(--red); }
.alt-label { font-family: var(--mono); font-size: 9px; color: var(--dim); letter-spacing: 0.5px; }
.alt-row { display: flex; gap: 7px; }
.alt-row button { flex: 1; padding: 9px 0 7px; border-radius: 11px; background: rgba(255,255,255,0.07);
  font-family: var(--mono); font-size: 17px; }
.alt-row button small { display: block; font-size: 8px; }
.alt-row button.on { background: var(--cyan); color: var(--panel); }
.action-btn { width: 100%; padding: 13px; border-radius: 14px; font-size: 15px; font-weight: 700;
  background: var(--green); color: var(--panel); display: flex; gap: 8px; align-items: center; justify-content: center; }
.action-btn.ghost { background: rgba(255,255,255,0.06); color: var(--dim); border: 1px solid var(--stroke); }
.action-btn.okay { background: rgba(74,222,128,0.12); color: var(--green); }
.strip { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
.strip button { display: inline-flex; align-items: center; gap: 5px; padding: 7px 10px; flex: none;
  border-radius: 999px; background: rgba(255,255,255,0.06); font-family: var(--mono); font-size: 12px; }
.strip button.sel { background: rgba(56,189,248,0.2); }
.strip .cdot { width: 6px; height: 6px; border-radius: 50%; }

/* modal */
.modal { position: absolute; inset: 0; z-index: 10; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.76); padding: 20px; }
.modal.show { display: flex; }
.modal .box { width: 100%; max-width: 460px; max-height: 92%; overflow-y: auto; background: var(--raised);
  border: 1px solid var(--stroke); border-radius: 18px; padding: 20px; }
.modal h2 { font-size: 22px; margin-bottom: 6px; }
.modal .icao-line { font-family: var(--mono); font-size: 13px; color: var(--cyan); margin-bottom: 10px; }
.modal p.brief { font-size: 14px; color: var(--dim); line-height: 1.5; margin-bottom: 14px; }
.modal .stat-row { display: flex; gap: 22px; margin-bottom: 16px; }
.modal .stat-row div { text-align: center; }
.modal .stat-row b { font-family: var(--mono); font-size: 17px; display: block; }
.modal .stat-row span { font-size: 11px; color: var(--dim); }
.modal .btns { display: flex; flex-direction: column; gap: 9px; margin-top: 8px; }
.stars-line { text-align: center; font-size: 32px; letter-spacing: 8px; color: var(--amber); margin: 8px 0; }
.stars-line .off { color: rgba(255,255,255,0.15); }
.payslip { background: rgba(255,255,255,0.05); border-radius: 13px; padding: 13px; margin: 12px 0; font-size: 13px; }
.payslip .line { display: flex; justify-content: space-between; padding: 3px 0; color: var(--dim); }
.payslip .line b { font-family: var(--mono); color: var(--text); }
.payslip .total { border-top: 1px solid var(--stroke); margin-top: 6px; padding-top: 8px; color: var(--text); font-weight: 700; }
.payslip .total b { color: var(--amber); font-size: 18px; }
.hint { font-size: 12px; color: var(--dim); text-align: center; margin-top: 10px; }
.howto-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--stroke); }
.howto-step:last-child { border-bottom: none; }
.howto-step .n { font-family: var(--mono); color: var(--panel); background: var(--green); width: 24px; height: 24px;
  flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.howto-step p { font-size: 13px; color: var(--dim); line-height: 1.45; }
.howto-step b { color: var(--text); }

/* sidebar on wide screens */
#sidebar { display: none; }
@media (min-width: 900px) {
  #game .panel.bottom { display: none; }
  #sidebar { display: flex; flex-direction: column; gap: 12px; width: 340px; flex: none;
    padding: 16px; background: var(--panel); border-left: 1px solid var(--stroke); overflow-y: auto; }
  #sidebar .empty { background: var(--raised); border: 1px solid var(--stroke);
    border-radius: 14px; padding: 18px 12px; }
  #sidebar .sel-head { background: var(--raised); border: 1px solid var(--stroke);
    border-radius: 14px; padding: 12px; flex-wrap: wrap; }
  #sidebar .strip { flex-wrap: wrap; overflow: visible; }
  #sidebar .live-data { grid-template-columns: 1fr 1fr; }
  #sidebar .action-btn { padding: 15px; }
  .modal .box { max-width: 520px; }
  .home-top h1 { font-size: 30px; }
}
@media (max-width: 899px) {
  #sidebar { display: none !important; }
  .panel.bottom { min-height: 218px; }
}

/* mode picker + live */
.mode-row { display: flex; gap: 10px; margin-bottom: 16px; }
.mode-card { flex: 1; display: flex; align-items: center; gap: 14px; padding: 18px;
  border-radius: 18px; background: var(--raised); border: 1px solid var(--stroke);
  text-align: left; transition: transform 0.12s, border-color 0.12s; }
.mode-card:hover { transform: translateY(-2px); }
.mode-card .mode-emoji { font-size: 30px; }
.mode-card b { display: block; font-size: 18px; letter-spacing: 3px; }
.mode-card small { color: var(--dim); font-size: 12px; }
.mode-card.on { border-color: rgba(74,222,128,0.55); background: linear-gradient(120deg, rgba(74,222,128,0.10), var(--raised)); }
#modeLive.on { border-color: rgba(56,189,248,0.55); background: linear-gradient(120deg, rgba(56,189,248,0.10), var(--raised)); }
#liveBadge { display: none;
  align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px;
  background: rgba(248,113,113,0.15); border: 1px solid rgba(248,113,113,0.6);
  color: var(--red); font-family: var(--mono); font-size: 12px; font-weight: 700;
  animation: liveblink 1.6s ease-in-out infinite; }
@keyframes liveblink { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; }
.live-grid button { background: var(--raised); border: 1px solid var(--stroke); border-radius: 13px;
  padding: 12px 10px; text-align: left; }
.live-grid button:hover { border-color: rgba(56,189,248,0.5); }
.live-grid .icao { font-family: var(--mono); font-size: 11px; color: var(--cyan); }
.live-grid .city { font-size: 14px; font-weight: 700; }
.live-data { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.live-data div { background: rgba(255,255,255,0.05); border-radius: 11px; padding: 9px; text-align: center; }
.live-data b { font-family: var(--mono); font-size: 14px; display: block; }
.live-data span { font-size: 9px; color: var(--dim); }

.kbd-hint { margin-top: auto; font-family: var(--mono); font-size: 10px; color: var(--dim);
  text-align: center; padding-top: 10px; border-top: 1px solid var(--stroke); }

.foot a { color: var(--dim); }
.foot a:hover { color: var(--text); }
