/* Nostalgia Pro Arcade: shared game shell styles */
@font-face { font-family: "Press Start 2P"; src: url("fonts/press-start-2p.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("fonts/silkscreen.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Silkscreen"; src: url("fonts/silkscreen-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #101219; --panel: #1d2029; --line: #2c3040; --text: #eceae2; --dim: #8e93a2;
  --red: #ff4b3e; --cyan: #3ff0ff; --pink: #ff3fa4; --lime: #9bff3f; --gold: #ffd23f; --violet: #a77bff;
  --accent: var(--cyan);
  --display: "Press Start 2P", ui-monospace, monospace;
  --ui: "Silkscreen", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body.np-game {
  background: var(--bg); color: var(--text); font-family: var(--ui);
  overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%;
}
.np-app {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Top bar */
.np-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  min-height: 56px; padding: 6px 8px; background: var(--panel); border-bottom: 2px solid var(--line);
}
.np-title {
  flex: 1 1 auto; margin: 0; min-width: 0; text-align: center;
  font: 400 12px/1.3 var(--display); color: var(--accent); letter-spacing: 1px;
  text-shadow: 0 0 6px color-mix(in srgb, var(--accent) 70%, transparent);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.np-back, .np-icon {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 44px; min-height: 44px; padding: 0 12px;
  background: var(--bg); color: var(--text); border: 2px solid var(--line); border-radius: 6px;
  font: 700 13px/1 var(--ui); text-decoration: none; cursor: pointer;
}
.np-icon { padding: 0; width: 44px; }
.np-icon svg { width: 22px; height: 22px; display: block; }
.np-back:hover, .np-icon:hover { border-color: var(--accent); }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.np-stage canvas:focus, .np-stage canvas:focus-visible { outline: none; }

/* Stage */
.np-stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  background: radial-gradient(ellipse at center, #171a24 0%, var(--bg) 70%);
}
.np-stage canvas {
  display: block; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none; image-rendering: pixelated;
  border-radius: 4px; box-shadow: 0 0 0 2px var(--line), 0 0 28px color-mix(in srgb, var(--accent) 22%, transparent);
}
/* CRT scanlines + vignette, kept faint so contrast holds */
.np-crt { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.np-crt::before {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.12) 2px 3px);
}
.np-crt::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 60%, rgba(0,0,0,.45) 100%);
}

/* Overlays */
.np-ov {
  position: absolute; inset: 0; z-index: 5; display: none;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(10, 11, 16, .78);
}
.np-ov.on { display: flex; }
.np-ov[data-tap] { cursor: pointer; }
.np-card {
  width: min(380px, 100%); max-height: 100%; overflow: auto;
  background: var(--panel); border: 2px solid var(--line); border-radius: 10px;
  padding: 22px 18px 18px; text-align: center;
  box-shadow: 0 0 0 2px #0006, 0 0 30px color-mix(in srgb, var(--accent) 25%, transparent);
}
.np-kicker { margin: 0 0 10px; font: 700 12px/1.2 var(--ui); color: var(--dim); letter-spacing: 2px; text-transform: uppercase; }
.np-h {
  margin: 0 0 14px; font: 400 18px/1.4 var(--display); color: var(--accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 75%, transparent);
}
.np-how { margin: 0 0 8px; font: 400 15px/1.45 var(--ui); color: var(--text); }
.np-keys { margin: 0 0 14px; font: 400 12px/1.5 var(--ui); color: var(--dim); }
.np-best { margin: 0 0 16px; font: 400 11px/1.6 var(--display); color: var(--dim); }
.np-best b { color: var(--gold); font-weight: 400; }
.np-score { margin: 4px 0 6px; font: 400 26px/1.3 var(--display); color: var(--text); }
.np-newbest { display: none; margin: 0 0 12px; }
.np-newbest.on { display: block; }
.np-newbest strong {
  display: block; font: 400 14px/1.5 var(--display); color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 210, 63, .8); animation: np-blink .5s steps(2) 6;
}
.np-newbest span { display: block; margin-top: 6px; font: 400 14px/1.4 var(--ui); color: var(--text); }
.np-extra { margin: 0 0 14px; font: 400 14px/1.5 var(--ui); color: var(--text); }
.np-extra table { margin: 0 auto; border-collapse: collapse; font: 400 13px/1.4 var(--ui); }
.np-extra td, .np-extra th { padding: 3px 5px; border: 1px solid var(--line); text-align: center; min-width: 24px; }
.np-extra th { color: var(--dim); font-weight: 400; }
.np-extra .np-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed var(--line); }
.np-extra .np-row:last-child { border-bottom: 0; }
.np-extra .np-row b { color: var(--gold); font-weight: 400; }
.np-tip { margin: 14px 0 0; font: 400 12px/1.4 var(--ui); color: var(--dim); }
.np-actions { display: grid; gap: 10px; }
.np-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 16px; border-radius: 8px; cursor: pointer;
  background: var(--bg); color: var(--text); border: 2px solid var(--line);
  font: 700 15px/1.2 var(--ui); text-decoration: none;
}
.np-btn:hover { border-color: var(--accent); }
.np-primary {
  background: var(--accent); color: #101219; border-color: var(--accent);
  font: 400 14px/1.3 var(--display); min-height: 56px;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 45%, #000), 0 0 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
.np-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.np-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 color-mix(in srgb, var(--accent) 45%, #000); }
.np-small { display: inline-flex; align-items: center; min-height: 44px; margin-top: 12px; padding: 12px 8px; font: 400 13px/1.2 var(--ui); color: var(--gold); }
.np-pulse { animation: np-pulse 1.1s ease-in-out infinite; }

/* Flash banner (ACE!, SWISH!, HOME RUN!) */
.np-flash {
  position: absolute; left: 50%; top: 38%; z-index: 4; pointer-events: none;
  transform: translate(-50%, -50%) scale(.6); opacity: 0;
  width: max-content; max-width: 92%; text-align: center;
}
.np-flash b {
  display: block; font: 400 24px/1.3 var(--display); color: var(--fc, var(--gold));
  text-shadow: 3px 3px 0 #000, 0 0 14px var(--fc, var(--gold));
}
.np-flash span { display: block; margin-top: 8px; font: 700 15px/1.3 var(--ui); color: var(--text); text-shadow: 2px 2px 0 #000; }
.np-flash.on { opacity: 1; transform: translate(-50%, -50%) scale(1); transition: transform .18s cubic-bezier(.3,1.6,.6,1), opacity .12s; }
.np-flash.off { opacity: 0; transform: translate(-50%, -60%) scale(1); transition: transform .3s, opacity .3s; }

.np-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes np-blink { 50% { opacity: .25; } }
@keyframes np-pulse { 50% { filter: brightness(1.18); } }

@media (max-width: 420px) {
  .np-title { font-size: 9px; line-height: 1.5; }
  .np-back { padding: 0 10px; }
  .np-h { font-size: 15px; }
  .np-flash b { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .np-newbest strong, .np-pulse { animation: none; }
  .np-flash.on, .np-flash.off { transition: none; transform: translate(-50%, -50%); }
}
