/* Vice City — interface chrome.
   Light and dark follow the system. The city canvas fills the window and the
   panels float over it, so the chrome has to stay legible over any sky. */

:root {
  --bg: #eef1f6;
  --panel: rgba(252, 253, 255, 0.86);
  --panel-solid: #f7f9fc;
  --border: rgba(24, 32, 48, 0.14);
  --text: #16202e;
  --muted: #5a6679;
  --accent: #1f5fd0;
  --accent-text: #ffffff;
  --shadow: 0 10px 30px rgba(12, 20, 36, 0.18);
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070b14;
    --panel: rgba(16, 22, 36, 0.74);
    --panel-solid: #121a2a;
    --border: rgba(180, 205, 255, 0.18);
    --text: #eef3fb;
    --muted: #9dabc2;
    --accent: #7aa7ff;
    --accent-text: #0a1020;
    --shadow: 0 12px 34px rgba(0, 0, 0, 0.45);
  }
}

* { box-sizing: border-box; }

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

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 40;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

.stage {
  position: fixed;
  inset: 0;
}

#city {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  outline: none;
  background: #0a1020;
}
#city.is-grabbing { cursor: grabbing; }
#city:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

/* ------------------------------------------------------------------ panels */

.panel {
  position: absolute;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}

.panel-title {
  margin: 0 0 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Stats, top left. */
.stats {
  top: 14px;
  left: 14px;
  padding: 12px 16px 13px;
  min-width: 168px;
}
.stat-list {
  margin: 0;
  display: grid;
  gap: 4px;
}
.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.stat dt {
  font-size: 0.78rem;
  color: var(--muted);
}
.stat dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* FPS, top right. */
.fps {
  top: 14px;
  right: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.fps-key {
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 700;
}
.fps-value {
  font-family: var(--mono);
  font-size: 0.98rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 2.2ch;
  text-align: right;
}

/* Controls legend, bottom right. */
.legend {
  position: absolute;
  right: 14px;
  bottom: 14px;
  margin: 0;
  padding: 7px 12px;
  max-width: min(72vw, 620px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: right;
}

/* Earthquake badge. */
.badge {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 20px;
  border-radius: 999px;
  background: #b3271f;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 0.82rem;
  box-shadow: 0 12px 30px rgba(120, 20, 10, 0.45);
  animation: badge-in 0.18s ease-out;
}
.badge[hidden] { display: none; }
.badge-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #ffd9d4;
  animation: pulse 0.7s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}
@keyframes badge-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ----------------------------------------------------------------- sidebar */

.sidebar {
  top: 62px;
  right: 14px;
  width: 300px;
  max-height: calc(100% - 78px);
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-head h1 {
  margin: 0 0 4px;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--muted);
}

.controls {
  display: grid;
  gap: 8px;
}

.btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 10px 34px 11px 13px;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: rgba(130, 150, 190, 0.14);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.08s ease;
}
.btn:hover { background: rgba(130, 150, 190, 0.24); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: transparent;
}
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 650;
  letter-spacing: 0.005em;
}
.btn-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  line-height: 1.35;
  opacity: 0.78;
}
.key {
  position: absolute;
  top: 9px;
  right: 10px;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: 0.5;
}

.note {
  margin: 0;
  padding: 9px 11px;
  font-size: 0.73rem;
  line-height: 1.45;
  border-radius: 8px;
  border: 1px dashed var(--border);
  color: var(--muted);
  background: rgba(130, 150, 190, 0.1);
}

.help { border-top: 1px solid var(--border); padding-top: 12px; }
.help-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 5px;
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--muted);
}
.kbd {
  font-family: var(--mono);
  font-size: 0.7rem;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: rgba(130, 150, 190, 0.16);
  color: var(--text);
}

/* ------------------------------------------------------------- small screens */

@media (max-width: 899px) {
  .sidebar {
    top: auto;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 46vh;
  }
  .legend {
    right: 12px;
    left: 12px;
    bottom: auto;
    top: 108px;
    text-align: center;
    max-width: none;
  }
  .stats { padding: 10px 12px; min-width: 140px; }
  .badge { top: 58px; }
}

/* ------------------------------------------------------------ reduced motion */

.reduced-motion .badge-dot { animation: none; }
.reduced-motion .badge { animation: none; }

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
