:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --warn: #ffb454;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%; height: 100%; position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column;
}
.screen.hidden { display: none; }

.focusable {
  transition: all 0.15s ease;
  border: 2px solid transparent;
  cursor: pointer; outline: none;
}
.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
}
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  height: 56px; flex: 0 0 56px;
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid #22222e;
}
.brand {
  font-size: 18px; font-weight: 700; letter-spacing: 2px;
  display: flex; align-items: center; gap: 10px; flex: 1;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px 2px var(--accent);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.spacer { width: 48px; }

.status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-muted); }
.status.live { color: var(--accent-secondary); }
.status.live .status-dot { background: var(--accent-secondary); box-shadow: 0 0 8px var(--accent-secondary); }
.status.stale { color: var(--warn); }
.status.stale .status-dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.status.sim { color: var(--accent); }
.status.sim .status-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.iconbtn {
  width: 48px; height: 48px; flex: 0 0 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; line-height: 1; font-weight: 400;
  background: var(--bg-tertiary); color: var(--text-primary);
  border-radius: var(--radius-md);
}

/* ---------- Map ---------- */
.map-wrap {
  position: relative;
  width: 600px; height: 300px; flex: 0 0 300px;
  background: #000;
  border-bottom: 1px solid #22222e;
}
#map { position: absolute; top: 0; left: 0; }

.iss-marker {
  position: absolute; left: 300px; top: 150px;
  width: 16px; height: 16px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.iss-marker::after {
  content: ''; position: absolute; inset: 4px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 12px 3px var(--accent);
}
.iss-marker .ping {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--accent);
  animation: ping 2s ease-out infinite;
}
@keyframes ping {
  0%   { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(2.6); opacity: 0; }
}

/* ---------- Readout ---------- */
.readout {
  flex: 1 1 auto;
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; background: #22222e;
  border-bottom: 1px solid #22222e;
}
.readout .stat {
  background: var(--bg-primary);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 8px 4px; gap: 4px;
}
.stat .k { font-size: 10px; letter-spacing: 1px; color: var(--text-muted); }
.stat .v { font-size: 17px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }

.region {
  flex: 0 0 30px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; letter-spacing: 1px; color: var(--text-secondary);
  background: var(--bg-secondary);
}
.region::before { content: '◎'; color: var(--accent); margin-right: 8px; }

/* ---------- Buttons ---------- */
.btnrow {
  flex: 0 0 96px;
  display: flex; gap: 10px; padding: 12px 16px;
  background: var(--bg-primary);
}
.btn {
  flex: 1; height: 72px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); color: var(--text-primary);
  border-radius: var(--radius-md);
  font-size: 15px; font-weight: 700; letter-spacing: 1px;
}

/* ---------- Details ---------- */
.grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 14px 16px;
}
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 12px 14px; min-height: 66px;
  display: flex; flex-direction: column; gap: 6px; justify-content: center;
}
.card .k { font-size: 11px; letter-spacing: 1px; color: var(--text-muted); }
.card .v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

.facts {
  margin: 4px 16px 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 6px 16px;
}
.fact {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0; border-bottom: 1px solid #22222e;
  font-size: 14px;
}
.fact:last-child { border-bottom: none; }
.fact span:first-child { color: var(--text-secondary); }
.fact span:last-child { font-weight: 600; }

/* ---------- About ---------- */
.about-body { padding: 22px 22px; overflow: hidden; }
.about-body p { font-size: 16px; line-height: 1.55; margin-bottom: 16px; color: var(--text-primary); }
.about-body b { color: var(--accent); }
.about-body .muted { color: var(--text-secondary); font-size: 14px; }
