/* Stella Sage Arcade — Tempest clone showcase styles.
 * CRT vector aesthetic: deep-space background, neon glow, scanlines. */

:root {
  --bg: #030308;
  --panel: rgba(8, 10, 24, 0.92);
  --cyan: #00f6ff;
  --yellow: #ffe14d;
  --red: #ff2e63;
  --blue: #4d7cff;
  --green: #39ff88;
  --text: #d7f4ff;
  --muted: #7d8aa5;
  --border: rgba(0, 246, 255, 0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
}

body {
  background:
    radial-gradient(ellipse at 50% 120%, rgba(77, 124, 255, 0.12), transparent 60%),
    radial-gradient(ellipse at 50% -20%, rgba(0, 246, 255, 0.08), transparent 55%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(4, 6, 16, 0.85);
  position: sticky;
  top: 0;
  z-index: 30;
}

.brand {
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 15px;
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(0, 246, 255, 0.8);
  white-space: nowrap;
}

.brand small {
  display: block;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
  text-shadow: none;
  font-weight: 400;
}

.topbar nav { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  letter-spacing: 1px;
  transition: box-shadow 0.15s, background 0.15s, color 0.15s;
}

.btn:hover, .btn:focus-visible {
  background: rgba(0, 246, 255, 0.12);
  box-shadow: 0 0 12px rgba(0, 246, 255, 0.45);
  outline: none;
}

.btn.primary {
  border-color: var(--yellow);
  color: var(--yellow);
  text-shadow: 0 0 8px rgba(255, 225, 77, 0.7);
}

.btn.primary:hover {
  background: rgba(255, 225, 77, 0.12);
  box-shadow: 0 0 14px rgba(255, 225, 77, 0.5);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 16px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}

.stage-wrap { min-width: 0; }

.hud {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 8px 4px 12px;
  font-size: 14px;
  letter-spacing: 1px;
}

.hud .label { color: var(--muted); font-size: 11px; letter-spacing: 2px; }
.hud .value { color: var(--yellow); font-weight: 700; text-shadow: 0 0 8px rgba(255, 225, 77, 0.6); }
.hud .value.cyan { color: var(--cyan); text-shadow: 0 0 8px rgba(0, 246, 255, 0.6); }

.stage {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 32px rgba(0, 246, 255, 0.12), inset 0 0 120px rgba(0, 0, 0, 0.9);
}

#game {
  display: block;
  width: 100%;
  height: min(72vh, 640px);
  touch-action: none;
  cursor: crosshair;
}

/* CRT scanlines + vignette overlay (pure CSS, zero cost per frame). */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: rgba(2, 3, 10, 0.78);
  z-index: 5;
  padding: 20px;
}

.overlay.hidden { display: none; }

.overlay .card { max-width: 520px; }

.overlay h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 5vw, 52px);
  letter-spacing: 8px;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(0, 246, 255, 0.9), 0 0 60px rgba(0, 246, 255, 0.4);
}

.overlay h2 {
  margin: 0 0 10px;
  letter-spacing: 4px;
  color: var(--red);
  text-shadow: 0 0 14px rgba(255, 46, 99, 0.8);
}

.overlay p { color: var(--text); line-height: 1.55; font-size: 15px; }
.overlay p.dim { color: var(--muted); font-size: 13px; }

.key-hints {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  text-align: left;
  font-size: 13px;
  margin: 14px auto;
  max-width: 340px;
  color: var(--muted);
}

.key-hints kbd {
  background: #10142a;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 8px;
  color: var(--yellow);
  font-family: Consolas, monospace;
  white-space: nowrap;
}

.touch-controls {
  display: none;
  gap: 10px;
  justify-content: center;
  padding: 12px 0 2px;
  flex-wrap: wrap;
}

.touch-controls .btn {
  min-width: 64px;
  min-height: 48px;
  font-size: 18px;
  user-select: none;
  -webkit-user-select: none;
}

@media (pointer: coarse) {
  .touch-controls { display: flex; }
  #game { height: 62vh; }
}

/* Case study sidebar. */
.case-study {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  font-size: 14px;
  line-height: 1.6;
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

.case-study h2 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--yellow);
  text-shadow: 0 0 10px rgba(255, 225, 77, 0.5);
}

.case-study .byline { color: var(--muted); font-size: 12px; letter-spacing: 1px; margin-bottom: 12px; }

.case-study h3 {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--cyan);
  margin: 16px 0 6px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.case-study ul { margin: 6px 0; padding-left: 18px; }
.case-study li { margin-bottom: 4px; }
.case-study code {
  font-family: Consolas, monospace;
  font-size: 12px;
  color: var(--green);
  background: rgba(57, 255, 136, 0.08);
  padding: 0 4px;
  border-radius: 3px;
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.metric {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  text-align: center;
}

.metric b { display: block; font-size: 18px; color: var(--yellow); }
.metric span { font-size: 11px; color: var(--muted); letter-spacing: 1px; }

.enemy-legend { list-style: none; padding: 0; }
.enemy-legend li { display: flex; gap: 8px; align-items: baseline; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; transform: translateY(1px); }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 1px;
  padding: 18px 12px 28px;
}

footer a { color: var(--cyan); }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .case-study { position: static; max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { text-shadow: none !important; }
  .stage { box-shadow: none; }
}
