:root {
  color-scheme: dark;
  --cyan: #00efff;
  --pink: #ff009d;
  --yellow: #ffe600;
  --black: #020008;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--black);
}

body {
  min-height: 100svh;
  font-family: "Courier New", Courier, monospace;
}

button { font: inherit; }

.intro {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}

.intro-art {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: .12;
  background: repeating-linear-gradient(to bottom, transparent 0 3px, rgba(0,0,0,.65) 4px);
  mix-blend-mode: multiply;
}

.sound-gate,
.enter-prompt {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: max(5.5%, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border: 2px solid var(--pink);
  color: #fff;
  background: rgba(0,0,0,.88);
  box-shadow: 0 0 10px var(--pink), inset 0 0 12px rgba(255,0,157,.35);
  padding: .8rem 1.25rem;
  text-align: center;
  text-shadow: 2px 2px 0 #7e0052;
  cursor: pointer;
  white-space: nowrap;
}

.sound-gate__main,
.enter-prompt {
  font-weight: 900;
  letter-spacing: .09em;
  font-size: clamp(.9rem, 2.2vw, 1.6rem);
}

.sound-gate__sub {
  display: block;
  margin-top: .25rem;
  color: var(--cyan);
  font-size: .65em;
  letter-spacing: .18em;
}

.enter-prompt {
  border-color: transparent;
  background: rgba(0,0,0,.7);
  box-shadow: none;
  color: var(--yellow);
  animation: arcade-blink .85s steps(1, end) infinite;
}

.touch-copy { display: none; }

.mute-button {
  position: absolute;
  z-index: 4;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  width: 2.75rem;
  height: 2.75rem;
  border: 2px solid var(--cyan);
  border-radius: 0;
  color: var(--cyan);
  background: rgba(0,0,0,.72);
  cursor: pointer;
}

.mute-button.is-muted::after {
  content: "";
  position: absolute;
  width: 2px;
  height: 2.6rem;
  top: -.05rem;
  left: 1.25rem;
  transform: rotate(45deg);
  background: var(--pink);
}

.arcade {
  position: fixed;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: max(2rem, env(safe-area-inset-top)) max(2.5rem, env(safe-area-inset-right)) max(2rem, env(safe-area-inset-bottom)) max(2.5rem, env(safe-area-inset-left));
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(74, 255, 0, .12), transparent 32%),
    linear-gradient(180deg, #071006 0%, #020702 62%, #000 100%);
  color: #fff;
}

.arcade:not([hidden]) { display: block; }

.arcade-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .14;
  background-image:
    linear-gradient(rgba(114,255,66,.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(114,255,66,.35) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, transparent, #000 30%, #000 80%, transparent);
}

.game-selector,
.swipe-hint { position: relative; z-index: 1; }

.game-counter {
  position: fixed;
  z-index: 3;
  top: max(1rem, env(safe-area-inset-top));
  right: max(1rem, env(safe-area-inset-right));
  color: #ffaf19;
  letter-spacing: .08em;
  font-size: .8rem;
}

.game-selector {
  display: grid;
  grid-template-columns: minmax(3rem, 5vw) minmax(0, 1fr) minmax(3rem, 5vw);
  justify-content: center;
  align-items: center;
  width: 100%;
  min-height: calc(100svh - 4rem);
  margin: 0 auto;
  touch-action: pan-y;
}

.game-card {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(17rem, 38%) minmax(0, 62%);
  align-items: center;
  gap: clamp(2rem, 4vw, 6rem);
  width: min(100%, 105rem);
  min-width: 0;
  margin: 0 auto;
  padding: 0;
  text-align: center;
  min-width: 0;
  animation: game-arrival .35s ease-out;
}

.game-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(3rem, 12vh, 9rem);
  min-width: 0;
  padding: 2vh 0;
}

.game-logo {
  display: block;
  width: min(100%, 66rem);
  max-height: 34vh;
  object-fit: contain;
  margin: 0 auto;
  filter: drop-shadow(0 0 14px rgba(101,255,45,.35));
}

.cabinet-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  margin: 0 auto;
}

.cabinet-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: 2%;
  width: 72%;
  height: 8%;
  border-radius: 50%;
  background: rgba(89,255,27,.18);
  filter: blur(18px);
}

.game-cabinet {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 86vh;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(0,0,0,.75));
}

.game-description {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(1.1rem, 1.75vw, 2.3rem);
  line-height: 1.2;
  text-transform: uppercase;
}

.nav-arrow {
  position: relative;
  z-index: 2;
  width: clamp(2.75rem, 5vw, 4.5rem);
  height: clamp(4.5rem, 9vw, 7.5rem);
  border: 2px solid #74ff3c;
  color: #b5ff8d;
  background: rgba(3,15,2,.78);
  box-shadow: 0 0 14px rgba(102,255,42,.35);
  font-size: clamp(2rem, 5vw, 4.5rem);
  cursor: pointer;
}

.nav-arrow--previous { grid-column: 1; }
.nav-arrow--next { grid-column: 3; }

.swipe-hint {
  margin: 1rem 0 0;
  color: #90ff5c;
  font-size: .72rem;
  letter-spacing: .13em;
}

.intro.is-leaving { animation: screen-off .5s ease-in forwards; }

@keyframes arcade-blink { 0%, 48% { opacity: 1; } 49%, 100% { opacity: 0; } }
@keyframes screen-off {
  0% { opacity: 1; transform: scale(1); filter: brightness(1); }
  65% { opacity: 1; transform: scaleY(.015) scaleX(.94); filter: brightness(5); }
  100% { opacity: 0; transform: scale(0); filter: brightness(8); }
}

@keyframes game-arrival {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (hover: none), (pointer: coarse) {
  .desktop-copy { display: none; }
  .touch-copy { display: inline; }
}

@media (orientation: portrait) {
  .intro-art { width: 100%; height: auto; }
  .sound-gate, .enter-prompt { bottom: max(9%, env(safe-area-inset-bottom)); }
}

@media (max-width: 700px) {
  .arcade {
    padding: max(3rem, env(safe-area-inset-top)) 1.25rem max(4rem, env(safe-area-inset-bottom));
  }
  .game-selector { display: block; min-height: auto; }
  .game-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: clamp(3.5rem, 10vh, 7rem);
  }
  .nav-arrow { display: none !important; }
  .game-info { display: contents; }
  .game-logo {
    order: 1;
    width: min(96%, 44rem);
    max-height: none;
  }
  .cabinet-stage { order: 2; width: min(68vw, 30rem); }
  .game-cabinet { width: 100%; max-height: none; }
  .game-description {
    order: 3;
    width: min(92%, 45rem);
    margin: 0 auto;
    padding: 0;
    font-size: clamp(1rem, 3.3vw, 1.7rem);
    line-height: 1.25;
  }
  .swipe-hint { margin-top: 3rem; }
}

@media (max-height: 650px) and (orientation: landscape) {
  .arcade { padding-top: 1rem; padding-bottom: 1rem; }
  .game-selector { min-height: calc(100svh - 2rem); }
  .game-card { grid-template-columns: minmax(13rem, 35%) minmax(0, 65%); gap: 2rem; }
  .game-info { gap: 8vh; }
  .game-logo { max-height: 28vh; }
  .game-cabinet { max-height: 92vh; }
  .game-description { font-size: clamp(.9rem, 1.5vw, 1.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .scanlines { display: none; }
  .enter-prompt { animation-duration: 1.6s; }
  .intro.is-leaving { animation: none; opacity: 0; }
}
