/* Vice City — open world city generator
   All UI chrome. The city itself is drawn procedurally to <canvas>. */

:root {
  --panel-bg: rgba(11, 14, 28, 0.66);
  --panel-bg-solid: rgba(11, 14, 28, 0.88);
  --panel-border: rgba(255, 255, 255, 0.16);
  --panel-shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
  --text: #f2f4fb;
  --text-dim: rgba(242, 244, 251, 0.62);
  --accent: #ff6fae;
  --accent-2: #4fd8d0;
  --danger: #ff8a5c;
  --focus: #ffe27a;
  --radius: 12px;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --panel-bg: rgba(252, 250, 248, 0.74);
    --panel-bg-solid: rgba(252, 250, 248, 0.92);
    --panel-border: rgba(24, 22, 40, 0.16);
    --panel-shadow: 0 10px 30px rgba(28, 24, 48, 0.22);
    --text: #191728;
    --text-dim: rgba(25, 23, 40, 0.6);
    --accent: #cf2d78;
    --accent-2: #10817c;
    --danger: #c1471d;
    --focus: #6b3bd6;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0a0d1c;
  font-family: var(--sans);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-color-scheme: light) {
  html, body { background: #cfe4f4; }
}

#city-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  outline: none;
}
#city-canvas.dragging { cursor: grabbing; }
#city-canvas:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

/* ---------- shared panel look ---------- */
.panel {
  position: fixed;
  z-index: 5;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
}

.panel-title {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}

/* ---------- stats: top-left ---------- */
#stats {
  top: 14px;
  left: 14px;
  padding: 12px 14px 11px;
  min-width: 178px;
}

.stat-list { margin: 0; }

.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 3px 0;
}
.stat-row dt {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.stat-row dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  color: var(--text);
}
#stat-buildings { color: var(--accent-2); }
#stat-population { color: var(--accent); }

/* ---------- fps: top-right ---------- */
#fps {
  top: 14px;
  right: 14px;
  padding: 8px 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.fps-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  font-weight: 700;
}
#fps-value { min-width: 2.4ch; text-align: right; }

/* ---------- sidebar: right ---------- */
#sidebar {
  top: 62px;
  right: 14px;
  width: 226px;
  padding: 14px;
  max-height: calc(100vh - 140px);
  overflow: auto;
}

.brand {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1;
  background: linear-gradient(96deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub {
  display: block;
  margin-top: 5px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--text-dim);
  -webkit-text-fill-color: var(--text-dim);
}

.btn-stack { display: grid; gap: 7px; }

.ctl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--panel-border);
  border-radius: 9px;
  cursor: pointer;
  transition: background 120ms linear, border-color 120ms linear, transform 90ms ease-out;
}
@media (prefers-color-scheme: light) {
  .ctl { background: rgba(24, 22, 40, 0.05); }
}
.ctl:hover { background: rgba(255, 111, 174, 0.18); border-color: rgba(255, 111, 174, 0.5); }
.ctl:active { transform: translateY(1px); }
.ctl:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.ctl[aria-pressed="true"] {
  background: rgba(79, 216, 208, 0.2);
  border-color: rgba(79, 216, 208, 0.62);
}
.ctl-danger:hover { background: rgba(255, 138, 92, 0.2); border-color: rgba(255, 138, 92, 0.55); }

.ctl-name { flex: 1 1 auto; }
.ctl-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
}
kbd {
  display: inline-block;
  min-width: 16px;
  padding: 1px 4px;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.4;
  text-align: center;
  color: var(--text-dim);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.14);
}

.zone-head { margin-top: 16px; }

.zones {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
}
.zones li { display: flex; align-items: center; gap: 7px; }
.sw {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.25);
}
.sw-downtown    { background: #6c7ea0; }
.sw-commercial  { background: #e8d6be; }
.sw-residential { background: #e7a4a8; }
.sw-industrial  { background: #9a8476; }
.sw-mixed       { background: #b0d6ce; }

/* ---------- legend: bottom-right ---------- */
#legend {
  right: 14px;
  bottom: 14px;
  max-width: min(560px, calc(100vw - 28px));
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  text-transform: uppercase;
}

/* ---------- earthquake badge ---------- */
#eq-badge {
  position: fixed;
  z-index: 9;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.86);
  padding: 12px 26px;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: #fff4ec;
  background: rgba(190, 44, 30, 0.86);
  border: 2px solid rgba(255, 205, 150, 0.85);
  border-radius: 10px;
  box-shadow: 0 0 44px rgba(255, 90, 40, 0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms linear, transform 200ms ease-out, visibility 200ms;
}
#eq-badge.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
  animation: eq-pulse 0.9s ease-in-out infinite;
}
@keyframes eq-pulse {
  0%, 100% { box-shadow: 0 0 30px rgba(255, 90, 40, 0.45); }
  50%      { box-shadow: 0 0 60px rgba(255, 140, 60, 0.85); }
}

/* ---------- misc ---------- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.noscript {
  position: fixed;
  z-index: 20;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 18px 22px;
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  font-size: 14px;
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ctl { transition: none; }
  #eq-badge { transition: opacity 1ms linear; animation: none; }
  #eq-badge.show { animation: none; transform: translate(-50%, -50%) scale(1); }
}

/* ---------- narrow screens ---------- */
@media (max-width: 720px) {
  #sidebar {
    top: auto;
    bottom: 56px;
    left: 14px;
    right: 14px;
    width: auto;
    max-height: 44vh;
  }
  .btn-stack { grid-template-columns: 1fr 1fr; }
  .zones { grid-template-columns: 1fr 1fr; }
  #legend {
    left: 14px;
    right: 14px;
    bottom: 12px;
    font-size: 9px;
    text-align: center;
  }
  #stats { min-width: 150px; padding: 9px 11px; }
  #eq-badge { font-size: 18px; padding: 10px 18px; }
}
