/* =========================================================
   Chasey · Deep Space Arcade
   The game page reuses the site's typography and tokens,
   then drops into a dense, dark instrument panel.
   ========================================================= */

.arcade-page {
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 82% 4%, rgba(79, 70, 229, 0.1), transparent 64%),
    radial-gradient(700px 450px at 8% 38%, rgba(13, 148, 136, 0.06), transparent 66%),
    var(--bg);
}

.arcade-container {
  width: min(1120px, calc(100% - 48px));
  margin-inline: auto;
}

.arcade-skip {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink, #17130e);
  color: #fff;
  font-size: 12px;
  text-decoration: none;
  transform: translateY(-180%);
  transition: transform 0.2s var(--ease);
}

.arcade-skip:focus {
  transform: translateY(0);
}

.arcade-header {
  padding: 24px 0;
}

.arcade-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.arcade-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.arcade-brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: linear-gradient(135deg, #9db4ff, #6ee7d8 55%, #d8b4fe);
  color: #080a10;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}

.arcade-brand-dot {
  color: var(--accent);
}

.arcade-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.arcade-nav a {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

.arcade-nav a:hover {
  color: var(--text);
}

.arcade-theme {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.arcade-theme:hover {
  border-color: var(--border-strong);
  transform: rotate(-12deg);
}

.arcade-main {
  padding: clamp(40px, 7vw, 84px) 0 72px;
}

.arcade-intro {
  max-width: 660px;
}

.arcade-kicker {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.arcade-kicker span {
  color: var(--accent);
}

.arcade-title {
  margin-top: 14px;
  color: var(--text);
  font-size: clamp(3rem, 7vw, 5.6rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.arcade-title span {
  color: var(--accent-2);
}

.arcade-lede {
  max-width: 560px;
  margin-top: 24px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.9;
}

/* ---------- instrument panel ---------- */

.game-stage {
  margin-top: clamp(38px, 5vw, 64px);
  overflow: hidden;
  border: 1px solid rgba(148, 165, 205, 0.2);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(28, 36, 65, 0.5), transparent 48%),
    #080b15;
  box-shadow:
    0 36px 90px -52px rgba(3, 6, 18, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.025) inset;
}

.game-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #99a6c2;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.game-hud-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.game-live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6ee7d8;
  box-shadow: 0 0 10px rgba(110, 231, 216, 0.85);
}

.game-hud-stats {
  display: flex;
  align-items: center;
  gap: 18px;
}

.game-hud-stats > div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.game-hud-stats span {
  color: #68748d;
  font-size: 8px;
}

.game-hud-stats strong {
  color: #eef3ff;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.game-pause {
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: transparent;
  color: #c3ccdf;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.game-pause:hover:not(:disabled),
.game-pause:focus-visible {
  border-color: rgba(110, 231, 216, 0.65);
  color: #6ee7d8;
}

.game-pause:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.game-viewport {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse 60% 55% at 76% 22%, rgba(79, 70, 229, 0.22), transparent 68%),
    radial-gradient(ellipse 45% 55% at 18% 82%, rgba(13, 148, 136, 0.12), transparent 68%),
    linear-gradient(180deg, #0a1020 0%, #060912 72%, #05070d 100%);
}

.game-viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 173, 225, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 173, 225, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, #000, transparent 88%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 88%);
}

.game-viewport::after {
  content: "SECTOR 07 / ORBITAL DEBRIS";
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 1;
  color: rgba(177, 195, 230, 0.25);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.12em;
  pointer-events: none;
}

#gameCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1000 / 420;
  touch-action: manipulation;
  cursor: pointer;
  outline: none;
}

#gameCanvas:focus-visible {
  box-shadow: inset 0 0 0 2px #6ee7d8;
}

.game-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(22px, 5vw, 54px);
  background: linear-gradient(90deg, rgba(5, 8, 16, 0.92), rgba(5, 8, 16, 0.58) 60%, transparent);
  transition: opacity 0.25s var(--ease), visibility 0.25s;
}

.game-overlay.is-hidden {
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

.game-overlay-kicker {
  color: #6ee7d8;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.13em;
}

.game-overlay-title {
  max-width: 470px;
  margin-top: 12px;
  color: #f5f2ea;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.game-overlay-text {
  max-width: 430px;
  margin-top: 12px;
  color: #9ba8c2;
  font-size: 13px;
  line-height: 1.75;
}

.game-start {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-top: 22px;
  padding: 0 17px;
  border: 1px solid rgba(110, 231, 216, 0.6);
  border-radius: 999px;
  background: rgba(110, 231, 216, 0.1);
  color: #dffcf5;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.game-start:hover,
.game-start:focus-visible {
  border-color: #6ee7d8;
  background: rgba(110, 231, 216, 0.18);
  transform: translateY(-2px);
}

.game-start span {
  color: #6ee7d8;
  transition: transform 0.2s;
}

.game-start:hover span {
  transform: translate(2px, -2px);
}

.game-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: #6f7c95;
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.game-status {
  margin-left: auto;
  color: #aab8d3;
}

.game-key--desktop {
  display: none;
}

.arcade-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 32px;
}

.arcade-notes p {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.75;
}

.arcade-note-index {
  display: inline-block;
  margin-right: 7px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
}

.arcade-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 42px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 0.2s, gap 0.2s;
}

.arcade-back:hover {
  gap: 12px;
  color: var(--text);
}

.arcade-back span {
  color: var(--accent-2);
}

.arcade-footer {
  border-top: 1px solid var(--border);
}

.arcade-footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0 24px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.05em;
}

@media (min-width: 760px) {
  .game-key--desktop {
    display: inline;
  }
}

@media (max-width: 640px) {
  .arcade-container {
    width: calc(100% - 32px);
  }

  .arcade-header {
    padding: 18px 0;
  }

  .arcade-main {
    padding-top: 32px;
  }

  .arcade-lede {
    margin-top: 18px;
    font-size: 14px;
  }

  .game-stage {
    border-radius: 18px;
  }

  .game-hud {
    padding: 12px 14px;
  }

  .game-hud-label {
    max-width: 130px;
    line-height: 1.5;
  }

  .game-hud-stats {
    gap: 11px;
  }

  .game-hud-stats > div {
    flex-direction: column;
    gap: 2px;
  }

  .game-hud-stats strong {
    font-size: 10px;
  }

  .game-pause {
    padding: 0 8px;
  }

  .game-overlay {
    background: linear-gradient(180deg, rgba(5, 8, 16, 0.86), rgba(5, 8, 16, 0.92));
    padding: 22px;
  }

  .game-overlay-title {
    font-size: 1.55rem;
  }

  .game-overlay-text {
    font-size: 12px;
    line-height: 1.65;
  }

  .game-start {
    min-height: 40px;
    margin-top: 18px;
  }

  .game-footer {
    padding: 11px 14px;
    font-size: 7px;
  }

  .game-status {
    width: 100%;
    margin-left: 0;
  }

  .arcade-notes {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 24px;
  }

  .arcade-footer-inner {
    flex-direction: column;
    gap: 5px;
    padding: 16px 0 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arcade-theme:hover,
  .game-start:hover,
  .arcade-back:hover {
    transform: none;
  }

  .game-overlay {
    transition: none;
  }
}

/* click and score feedback */
.game-ripple {
  position: absolute;
  z-index: 3;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 1px solid rgba(110, 231, 216, 0.9);
  border-radius: 50%;
  pointer-events: none;
  animation: gameRipple 0.58s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes gameRipple {
  from {
    opacity: 0.9;
    transform: scale(0.45);
  }
  to {
    opacity: 0;
    transform: scale(4.8);
  }
}

.game-hud-stats strong.is-pop {
  animation: scorePop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes scorePop {
  0% { transform: translateY(0); color: #eef3ff; }
  45% { transform: translateY(-2px); color: #6ee7d8; }
  100% { transform: translateY(0); color: #eef3ff; }
}

.game-start:active,
.game-pause:active:not(:disabled),
.arcade-theme:active {
  transform: scale(0.96);
}

#gameCanvas:active {
  cursor: grabbing;
}
