/* The Arcade.
 *
 * Three playable cabinets on one page, plus a cross-link to Signal Defence on
 * the waiting page. Everything leans on styles.css for the buttons and the
 * type; this file only lays out the boards and draws the two DOM games'
 * pieces. Same rules as every page here: no motion until the reader starts a
 * game, 60fps once they do, and nothing animates layout, only transform and
 * opacity.
 */

.arcade-body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 500px at 80% -10%, rgba(38, 64, 110, 0.35), transparent 70%),
    radial-gradient(900px 500px at 10% 110%, rgba(28, 52, 44, 0.3), transparent 70%),
    #050b16;
  color: #e9f0fa;
}

/* The header, borrowed by class from the waiting page and styled here because
   this page does not load waiting.css: without these rules the back link and
   the mark sat shoulder to shoulder at the left edge. */
.arcade-body .waiting-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 4vw, 44px);
}

.arcade-body .waiting-top img { width: 151px; height: 26px; opacity: 0.92; }

.arcade-body .waiting-back {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 14px;
  color: rgba(233, 240, 250, 0.85);
}

.arcade-body .waiting-back:hover { border-color: rgba(184, 231, 106, 0.6); color: #ffffff; }

.arcade-main {
  max-width: 860px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px) clamp(14px, 3vw, 24px) 80px;
  display: grid;
  gap: clamp(30px, 5vw, 56px);
}

.arcade-note h1 {
  margin: 10px 0 18px;
  font-size: clamp(30px, 5.4vw, 52px);
  line-height: 1.08;
}

.arcade-note h1 em { font-style: normal; color: rgba(184, 231, 106, 0.95); }

.arcade-copy {
  max-width: 62ch;
  font-size: 16px;
  line-height: 1.65;
  color: rgba(233, 240, 250, 0.82);
}

.arcade-claim-copy {
  margin-top: 14px;
  padding-left: 14px;
  border-left: 2px solid rgba(184, 231, 106, 0.45);
}

.arcade-game .game-head h2 { margin: 0 0 4px; font-size: clamp(22px, 3vw, 30px); }
.arcade-game .game-head .sub { margin: 0; color: rgba(233, 240, 250, 0.66); }

.arcade-line {
  margin: 8px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(184, 231, 106, 0.85);
}

.arcade-shell {
  position: relative;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(4, 9, 18, 0.92);
  overflow: hidden;
  display: grid;
  justify-items: center;
  padding: 14px 10px 12px;
}

.arcade-shell canvas {
  max-width: 100%;
  height: auto;
  display: block;
  touch-action: none;
}

.arcade-shell .game-keys {
  margin: 10px 0 0;
  font-size: 13px;
  color: rgba(233, 240, 250, 0.6);
  text-align: center;
}

/* Touch controls. Buttons rather than gestures, for the same reason the
   waiting game grew a FIRE button: a double tap on the playfield is the
   browser's zoom gesture, and a game should never fight the browser. */
.arcade-touch {
  display: none;
  gap: 10px;
  margin-top: 12px;
}

.arcade-touch button {
  min-width: 58px;
  min-height: 46px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: #e9f0fa;
  font-size: 18px;
}

.arcade-touch button:active { background: rgba(184, 231, 106, 0.25); }

@media (pointer: coarse) {
  .arcade-touch { display: flex; }
}

/* HUD and overlays reuse the waiting-game classes from styles.css where they
   exist; the shell here only needs the overlay to sit on top of the board. */
.arcade-shell .game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
  background: rgba(4, 8, 16, 0.88);
  backdrop-filter: blur(2px);
}

.arcade-shell .game-overlay[hidden] { display: none; }

.arcade-shell .game-overlay h3 { margin: 0 0 10px; font-size: 24px; }

.arcade-shell .game-overlay p {
  max-width: 46ch;
  margin: 0 auto 16px;
  font-size: 15px;
  line-height: 1.6;
  color: rgba(233, 240, 250, 0.8);
}

.arcade-shell .game-hud {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.08em;
  color: rgba(233, 240, 250, 0.85);
  pointer-events: none;
}

.arcade-claim {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin: 0 0 14px;
}

/* ------------------------------------------------------------ the wiremap */

/* Extra headroom so the score HUD sits above pin slot one, not on it. */
.arcade-shell-dom { padding: 40px 12px 16px; }

.wiremap-board {
  width: min(560px, 100%);
  display: grid;
  gap: 16px;
}

.wiremap-slots {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.wiremap-slot {
  position: relative;
  height: 74px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.wiremap-slot::after {
  content: attr(data-pin);
  position: absolute;
  bottom: 3px;
  font-family: var(--mono);
  font-size: 10px;
  color: rgba(233, 240, 250, 0.45);
}

.wiremap-slot.filled { border-style: solid; border-color: rgba(184, 231, 106, 0.6); }

.wiremap-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  min-height: 66px;
}

/* A conductor chip. The stripe pair is the actual jacket colouring, done with
   a gradient rather than an image so it costs nothing and prints crisp at any
   size. Solid colours get one band; striped get white between two bands. */
.wire-chip {
  width: 54px;
  height: 60px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: grid;
  align-content: end;
  justify-items: center;
  padding-bottom: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: #0a0f18;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms var(--ease);
}

.wire-chip:hover { transform: translateY(-3px); }

.wire-chip.wrong { animation: chip-shake 240ms linear; }

@keyframes chip-shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

.wiremap-slot .wire-chip { cursor: default; }
.wiremap-slot .wire-chip:hover { transform: none; }

.wiremap-timer {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

/* Width is driven by transform so the bar never causes layout. */
#wiremapFuel {
  height: 100%;
  width: 100%;
  transform-origin: left;
  background: linear-gradient(90deg, #b8e76a, #6ac7e7);
}

/* -------------------------------------------------------------- crosslink */

.arcade-crosslink {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 18px 20px;
  background: rgba(255, 255, 255, 0.03);
}

.arcade-crosslink .arcade-copy { margin-top: 8px; }

.game-foot { color: rgba(233, 240, 250, 0.7); font-size: 14px; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .wire-chip, .wire-chip:hover { transition: none; transform: none; }
}
