/* The hidden arcade: neon cabinet menu, a CRT-style screen, touch controls on phones. */
:root {
  --neon: #19f0ff;
  --pink: #ff3bd4;
  --yellow: #ffe14d;
  --ink: #e9e9ff;
  --dim: #8f94c8;
  color-scheme: dark;
}
* { box-sizing: border-box; }
/* The menu and the screen swap with the hidden attribute; a display rule must not undo it. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; background: #06060c; color: var(--ink); font-family: "Press Start 2P", ui-monospace, Menlo, Consolas, monospace; -webkit-font-smoothing: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; }

.arcade { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: radial-gradient(ellipse 120% 70% at 50% -10%, #221763 0%, #0b0a24 45%, #06060c 75%); }
.arc-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px clamp(12px, 3vw, 28px); font-size: 10px; letter-spacing: 1px; }
/* The way back to the portfolio: small type, but a full-size tap target. */
.arc-back { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; margin: 0 -10px; color: #9aa4ff; text-decoration: none; }
.arc-back:hover { color: #fff; }
.arc-free { color: var(--yellow); text-shadow: 0 0 6px rgb(255 225 77 / 60%); }
.arc-mute { min-height: 44px; padding: 7px 9px; border: 1px solid #3a3a7a; border-radius: 4px; background: rgb(255 255 255 / 3%); cursor: pointer; font-size: 9px; }
.arc-mute:hover { border-color: var(--neon); }
@media (max-width: 520px) { .arc-free { display: none; } }

.arc-main { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px clamp(10px, 3vw, 24px) 12px; overflow: auto; }

/* ---------- menu ---------- */
.arc-menu { width: min(680px, 100%); text-align: center; padding-bottom: 12px; }
.arc-logo { margin: 8px 0 6px; font-size: clamp(22px, 5.2vw, 42px); line-height: 1.25; font-weight: 400; color: #fff; text-shadow: 0 0 6px var(--pink), 0 0 20px var(--pink), 4px 4px 0 #2b1466; }
.arc-logo span { display: block; margin-bottom: 10px; font-size: .45em; color: var(--neon); text-shadow: 0 0 8px var(--neon); }
.arc-blink { margin: 14px 0 28px; font-size: 12px; color: var(--yellow); animation: arc-blink 1.1s steps(2, start) infinite; }
@keyframes arc-blink { to { visibility: hidden; } }
.arc-games { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.arc-cab { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; padding: 18px 20px; text-align: left; cursor: pointer; border: 2px solid #2d2d6e; border-radius: 10px; background: linear-gradient(180deg, #16163c 0%, #0c0c22 100%); transition: transform .12s, border-color .12s, box-shadow .12s; }
.arc-cab-title { font-size: clamp(13px, 2.4vw, 17px); color: #fff; }
.arc-cab-tag { grid-column: 1 / -1; font-size: 9px; line-height: 1.8; color: var(--dim); }
.arc-cab-hi { font-size: 10px; color: var(--yellow); white-space: nowrap; }
.arc-cab--maze .arc-cab-title { color: #ffe14d; }
.arc-cab--burger .arc-cab-title { color: #ffa94d; }
.arc-cab--moto .arc-cab-title { color: #ff5c6c; }
.arc-cab--chip .arc-cab-title { color: #8cd0ff; }
.arc-cab--layers .arc-cab-title { color: #8cf05a; }
.arc-cab:hover, .arc-cab.is-selected { border-color: var(--neon); box-shadow: 0 0 18px rgb(25 240 255 / 40%), inset 0 0 14px rgb(25 240 255 / 12%); transform: translateY(-2px); }
.arc-cab.is-selected .arc-cab-title::before { content: "▶ "; content: "▶ " / ""; color: var(--pink); }
.arc-hint { margin: 24px 0 0; font-size: 9px; line-height: 2; color: #6f74a8; }

/* ---------- game screen ---------- */
.arc-screen { width: 100%; height: 100%; display: grid; place-items: center; }
.arc-bezel { position: relative; padding: 10px; border-radius: 14px; background: #000; box-shadow: 0 0 0 3px #23234f, 0 0 0 6px #0d0d22, 0 0 46px rgb(90 70 255 / 35%); }
#canvas { display: block; width: 224px; height: 288px; background: #000; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: none; }
/* Scanlines and a soft vignette, like an old tube. */
.arc-bezel::after { content: ""; position: absolute; inset: 10px; pointer-events: none; background: repeating-linear-gradient(0deg, rgb(0 0 0 / 22%) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 60%, rgb(0 0 0 / 35%) 100%); }
.arc-overlay { position: absolute; inset: 10px; z-index: 2; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; text-align: center; font-size: 10px; line-height: 1.9; background: rgb(4 4 14 / 80%); cursor: pointer; }
.arcade[data-state="loading"] .arc-overlay,
.arcade[data-state="title"] .arc-overlay,
.arcade[data-state="paused"] .arc-overlay,
.arcade[data-state="over"] .arc-overlay,
.arcade[data-state="error"] .arc-overlay { display: flex; }
.arc-overlay h2 { margin: 0; font-size: clamp(14px, 3.4vw, 20px); font-weight: 400; color: #fff; text-shadow: 0 0 8px var(--pink), 0 0 18px var(--pink); }
.arc-overlay p { margin: 0; }
.arc-overlay ul { list-style: none; margin: 4px 0; padding: 0; color: var(--neon); font-size: 9px; line-height: 2.1; }
.arc-o-tag { color: var(--dim); font-size: 9px; max-width: 32ch; }
.arc-o-small { color: #8c90c0; font-size: 8px; }
.arc-o-new { color: var(--yellow); text-shadow: 0 0 8px rgb(255 225 77 / 70%); }
.arc-o-blink { color: var(--yellow); animation: arc-blink 1.1s steps(2, start) infinite; }

/* ---------- touch controls ---------- */
.arc-pad { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 8px 18px calc(16px + env(safe-area-inset-bottom)); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.arc-pad[hidden] { display: none; }
.arc-dpad { position: relative; justify-self: start; width: 138px; height: 138px; touch-action: none; }
.arc-dpad span { position: absolute; background: #2a2a5a; box-shadow: inset 0 -4px 0 rgb(0 0 0 / 35%); border-radius: 6px; }
.arc-dpad .u, .arc-dpad .d { left: 46px; width: 46px; height: 52px; }
.arc-dpad .u { top: 0; }
.arc-dpad .d { bottom: 0; }
.arc-dpad .l, .arc-dpad .r { top: 46px; width: 52px; height: 46px; }
.arc-dpad .l { left: 0; }
.arc-dpad .r { right: 0; }
.arc-dpad::before { content: ""; position: absolute; left: 44px; top: 44px; width: 50px; height: 50px; background: #2a2a5a; border-radius: 4px; }
.arc-dpad span.is-down { background: #4a4aa0; }
.arc-sys { display: flex; flex-direction: column; gap: 10px; }
.arc-sys button { min-height: 44px; padding: 9px 10px; border: 0; border-radius: 14px; background: #262650; color: #cfd2ff; font-size: 8px; }
.arc-ab { justify-self: end; display: flex; align-items: center; gap: 14px; }
.arc-ab button { width: 66px; height: 66px; border: 0; border-radius: 50%; font-size: 10px; color: #fff; background: #d0214f; box-shadow: 0 5px 0 #7e0f2c; touch-action: none; }
.arc-ab .arc-b { margin-top: 36px; background: #3b4bd6; box-shadow: 0 5px 0 #1f2878; }
.arc-ab button[hidden] { display: none; }
.arc-pad button.is-down { transform: translateY(4px); box-shadow: none; filter: brightness(1.2); }

/* Five cabinets fit a laptop screen side by side in two columns; an odd last one spans both. */
@media (min-width: 900px) {
  .arc-menu { width: min(920px, 100%); }
  .arc-games { grid-template-columns: 1fr 1fr; }
  .arc-games li:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .arc-cab { height: 100%; }
}
@media (min-width: 900px) and (max-height: 760px) {
  .arc-logo { margin-top: 0; }
  .arc-blink { margin: 8px 0 16px; }
}

/* Reduced motion: nothing blinks; the text simply stays on. */
@media (prefers-reduced-motion: reduce) {
  .arc-blink, .arc-o-blink { animation: none; }
}

/* The key hint is for keyboards; touch screens get the on-screen buttons. */
@media (pointer: coarse) { .arc-hint { display: none; } }
