:root {
  --yellow: #ffe81f;
  --blue: #4fc3ff;
  --red: #ff3b3b;
  --green: #39ff6a;
  --bg: #000;
  --panel: #0b0b14;
  --text: #e8e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Press Start 2P", monospace;
  line-height: 1.8;
  overflow-x: hidden;
  image-rendering: pixelated;
}

#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; }

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
  background: rgba(0, 0, 0, .75);
  border-bottom: 2px solid #222;
  backdrop-filter: blur(4px);
}
.logo { color: var(--yellow); font-size: 12px; }
.nav nav { display: flex; gap: 18px; }
.nav a { color: var(--text); text-decoration: none; font-size: 10px; }
.nav a:hover { color: var(--yellow); }

/* Hero */
.hero {
  min-height: 92vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 16px; gap: 28px;
}
.intro { color: var(--blue); font-size: 12px; max-width: 520px; opacity: 0; animation: fadeIn 2s .3s forwards; }
.title {
  color: transparent;
  -webkit-text-stroke: 2px var(--yellow);
  font-size: clamp(36px, 10vw, 96px);
  line-height: 1.15;
  letter-spacing: 4px;
  text-shadow: 0 0 24px rgba(255, 232, 31, .35);
  opacity: 0; transform: scale(1.6);
  animation: zoomIn 2.2s 2.2s forwards ease-out;
}
.tag { font-size: 10px; color: #aaa; opacity: 0; animation: fadeIn 1s 4s forwards; }
.btn {
  display: inline-block; padding: 16px 26px;
  color: #000; background: var(--yellow); text-decoration: none; font-size: 12px;
  box-shadow: 4px 4px 0 #8a7a00;
  opacity: 0; animation: fadeIn 1s 4.4s forwards, blink 1.2s 5.4s infinite steps(2);
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #8a7a00; }

@keyframes fadeIn { to { opacity: 1; } }
@keyframes zoomIn { to { opacity: 1; transform: scale(1); } }
@keyframes blink { 50% { opacity: .55; } }

/* Game */
.section-title { text-align: center; color: var(--yellow); font-size: 14px; margin-bottom: 28px; }
.play { padding: 60px 16px; }
.cabinet {
  width: min(760px, 100%, calc((100vh - 140px) * 0.75 + 36px));
  min-width: min(420px, 100%);
  margin: 0 auto; padding: 18px;
  background: linear-gradient(#1a1a2a, #0a0a12);
  border: 4px solid #333; border-radius: 14px;
  box-shadow: 0 0 0 4px #000, 0 0 60px rgba(79, 195, 255, .15);
}
.hud-top { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 12px; color: #bbb; }
.hud-top b { color: var(--yellow); font-weight: normal; }
.screen { position: relative; border: 3px solid #000; border-radius: 6px; overflow: hidden; background: #000; }
#game { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; outline: none; image-rendering: pixelated; touch-action: none; }
.scanlines {
  pointer-events: none; position: absolute; inset: 0;
  background: repeating-linear-gradient(transparent 0 2px, rgba(0, 0, 0, .25) 2px 4px);
}
/* Controls overlaid on the game screen */
.controls { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.controls button {
  pointer-events: auto; font-family: inherit; color: #fff;
  background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .28);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  backdrop-filter: blur(2px);
}
.controls button.active { background: rgba(255, 255, 255, .3); }
.ctl-top {
  position: absolute; display: flex; gap: 6px;
  top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right));
}
.opt { padding: 7px 9px; font-size: 8px; border-radius: 6px; opacity: .75; }
.opt:hover { opacity: 1; }
.opt.on { background: rgba(79, 195, 255, .85) !important; color: #000 !important; border-color: #4fc3ff !important; opacity: 1; }
.dpad {
  position: absolute; pointer-events: auto; width: 150px; height: 150px; border-radius: 50%;
  left: max(10px, env(safe-area-inset-left)); bottom: max(10px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .07); border: 2px solid rgba(255, 255, 255, .25);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.dpad span {
  position: absolute; width: 46px; height: 46px; display: grid; place-items: center;
  font-size: 16px; color: rgba(255, 255, 255, .8); border-radius: 50%; pointer-events: none;
}
.dpad .u { top: 4px; left: 50%; transform: translateX(-50%); }
.dpad .d { bottom: 4px; left: 50%; transform: translateX(-50%); }
.dpad .l { left: 4px; top: 50%; transform: translateY(-50%); }
.dpad .r { right: 4px; top: 50%; transform: translateY(-50%); }
.dpad[data-dir*="u"] .u, .dpad[data-dir*="d"] .d, .dpad[data-dir*="l"] .l, .dpad[data-dir*="r"] .r {
  background: rgba(255, 255, 255, .3); color: #fff;
}
.controls .fire {
  position: absolute; width: 84px; height: 84px; border-radius: 50%; font-size: 11px;
  right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom));
  background: rgba(255, 59, 59, .35); border-color: rgba(255, 90, 90, .7);
}
.controls .fire.active { background: rgba(255, 59, 59, .7); }
.touch-only { display: none !important; }

/* Phones & tablets: bigger, edge-to-edge game */
@media (hover: none), (pointer: coarse) {
  .dpad.touch-only { display: block !important; }
  .opt.touch-only, .fire.touch-only { display: block !important; }
  .play { padding: 12px 0 40px; }
  .play .section-title { margin-bottom: 10px; }
  .cabinet { width: 100%; min-width: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; }
  .hud-top { display: none; }
  .screen { border: 0; border-radius: 0; }
  #game { width: min(100%, calc(100dvh * .75)); margin: 0 auto; }
}

/* Phone in landscape: game fills the screen height, controls float at the edges */
@media (orientation: landscape) and (max-height: 600px) and (pointer: coarse) {
  .nav { display: none; }
  .play { padding: 0; }
  .play .section-title { display: none; }
  .screen { height: 100vh; height: 100dvh; display: flex; align-items: center; justify-content: center; }
  #game { height: 100%; width: auto; }
}

/* Fullscreen mode (real fullscreen, or a full-window fallback on iPhone) */
body.fs { overflow: hidden; }
body.fs .screen {
  position: fixed; inset: 0; z-index: 1000; border: 0; border-radius: 0;
  display: flex; align-items: center; justify-content: center; background: #000;
}
body.fs #game { width: min(100vw, calc(100dvh * .75)); height: auto; max-height: 100dvh; margin: 0; }
.screen:fullscreen { background: #000; }

/* How */
.how { padding: 60px 16px 80px; }
.cards {
  max-width: 900px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px;
}
.card { background: rgba(11, 11, 20, .9); border: 2px solid #2a2a3a; padding: 22px; }
.card .ico { display: inline-block; color: var(--green); font-size: 16px; margin-bottom: 10px; }
.card .pu-t { color: var(--yellow); }
.card .pu-s { color: var(--blue); }
.card .red { color: var(--red); }
.card h3 { font-size: 11px; color: var(--yellow); margin-bottom: 8px; }
.card p { font-size: 9px; color: #aaa; }

.foot { text-align: center; padding: 40px 16px 60px; border-top: 2px solid #1a1a1a; }
.foot p { color: var(--yellow); font-size: 11px; margin-bottom: 10px; }
.foot small { font-size: 8px; color: #666; }

@media (max-width: 520px) {
  .nav nav { gap: 10px; }
  .logo { font-size: 9px; }
  .nav a { font-size: 8px; }
  .cabinet { padding: 10px; }
  .hud-top { font-size: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .title, .intro, .tag, .btn { animation: none; opacity: 1; transform: none; }
}
