/* GRID_DARK - Post-blackout phosphor palette */
:root {
  --bg: #080a0f;
  --bg-deep: #040508;
  --amber: #ffb000;
  --amber-dim: #996a00;
  --amber-glow: rgba(255, 176, 0, 0.15);
  --phosphor-green: #00ff88;
  --phosphor-green-dim: #007a44;
  --phosphor-red: #ff3344;
  --phosphor-red-dim: #7a1a22;
  --text: #e0e0e0;
  --text-dim: #666970;
  --grid-line: rgba(255, 176, 0, 0.06);
  --cell-inactive: rgba(255, 176, 0, 0.04);
  --cell-hover: rgba(255, 176, 0, 0.12);
  --font-mono: 'Courier New', 'SF Mono', 'Consolas', monospace;
  --font-heading: 'Impact', 'Arial Black', sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  font-family: var(--font-mono);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* Amber flash overlay */
#amber-flash {
  position: fixed;
  inset: 0;
  background: var(--amber);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity 0.3s ease-out;
}

#amber-flash.active {
  opacity: 0.35;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem;
  gap: 0.5rem;
}

/* Header - heavy type, strong hierarchy */
header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--grid-line);
}

#title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  text-shadow:
    0 0 8px var(--amber-glow),
    0 0 30px var(--amber-glow);
  line-height: 1;
}

#hud {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
}

#score, #round {
  display: block;
}

#score span, #round span {
  color: var(--amber);
}

/* Grid container */
#grid-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  min-height: 0;
}

#grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
  position: relative;
}

/* Grid cells */
.cell {
  background: var(--cell-inactive);
  border: 1px solid var(--grid-line);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: background 0.1s, border-color 0.1s, box-shadow 0.15s;
}

.cell:hover {
  background: var(--cell-hover);
  border-color: var(--amber-dim);
}

/* Cell states via BEM-style modifiers */
.cell.contact {
  animation: pulse-contact 1.2s infinite alternate;
}

.cell.intercept {
  background: var(--amber) !important;
  border-color: var(--amber) !important;
  box-shadow: 0 0 30px var(--amber), 0 0 60px var(--amber-glow);
  animation: none;
}

.cell.miss {
  background: var(--phosphor-red-dim) !important;
  border-color: var(--phosphor-red-dim) !important;
}

.cell.silenced {
  background: var(--phosphor-green-dim) !important;
  border-color: var(--phosphor-green-dim) !important;
  box-shadow: 0 0 15px var(--phosphor-green-dim);
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
}

/* Contact pulse animation */
@keyframes pulse-contact {
  0% {
    background: var(--cell-hover);
    box-shadow: none;
  }
  100% {
    background: var(--amber-glow);
    box-shadow: 0 0 12px var(--amber-glow);
  }
}

/* Status bar */
#status-bar {
  padding-top: 0.75rem;
  text-align: center;
}

#status-text {
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  text-transform: uppercase;
  transition: color 0.3s;
}

#status-text.warning {
  color: var(--amber);
  text-shadow: 0 0 6px var(--amber-glow);
}

#status-text.success {
  color: var(--phosphor-green);
}

/* Footer controls */
footer {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--grid-line);
}

footer button {
  background: transparent;
  border: 1px solid var(--grid-line);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  padding: 0.4rem 1rem;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

footer button:hover {
  background: var(--cell-hover);
  color: var(--text);
  border-color: var(--amber-dim);
}

footer button:active {
  background: var(--amber-glow);
}

/* Responsive adjustments */
@media (max-width: 600px) {
  #app { padding: 1rem; }
  #grid { gap: 4px; }
  #title { letter-spacing: 0.1em; }
  #hud { gap: 1rem; }
  footer button { padding: 0.35rem 0.6rem; font-size: 0.65rem; }
}

@media (max-height: 500px) and (orientation: landscape) {
  header { padding-bottom: 0.25rem; }
  #grid-container { padding: 0; }
  footer { padding-top: 0.25rem; }
  #title { font-size: 1.5rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .cell.contact { animation: none; }
  #amber-flash { transition: none; }
}
