/* Juegos · David Quintero — salón recreativo */

@font-face {
  font-family: "Press Start 2P";
  src: url("../fonts/press-start-2p-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("../fonts/vt323-latin.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #07060b;
  --cab: #14111c;
  --cab-hi: #221c2e;
  --screen: #05060a;
  --ink: #f3ece4;
  --ink-soft: #b9ada0;
  --line: #342e29;
  --pulse: #ff5a43;
  --pulse-glow: rgba(255, 90, 67, .4);
  --amber: #ffd23f;
  --cyan: #4ee3ff;
  --green: #7cff9b;
  --px: "Press Start 2P", ui-monospace, "SF Mono", Menlo, monospace;
  --vt: "VT323", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(10px, 4vw, 32px);
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100svh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--vt);
  font-size: 22px;
  line-height: 1.15;
  -webkit-font-smoothing: none;
  overflow-x: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; clip-path: inset(50%);
}
/* ---------- Sala ---------- */
.room {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 50% at 50% 38%, rgba(255, 90, 67, .12), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 120%, rgba(78, 227, 255, .08), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' shape-rendering='crispEdges'%3E%3Cg fill='%234ee3ff' opacity='.10'%3E%3Crect x='10' y='12' width='6' height='6'/%3E%3Crect x='64' y='50' width='6' height='6'/%3E%3C/g%3E%3Cg fill='%23ff5a43' opacity='.12'%3E%3Crect x='56' y='10' width='6' height='6'/%3E%3Crect x='18' y='62' width='6' height='6'/%3E%3C/g%3E%3Cg fill='%23ffd23f' opacity='.08'%3E%3Crect x='38' y='38' width='4' height='4'/%3E%3Crect x='82' y='80' width='4' height='4'/%3E%3C/g%3E%3C/svg%3E"),
    var(--bg);
}

/* ---------- Máquina ---------- */
.cabinet {
  width: min(680px, 100% - 2 * var(--gutter));
  margin: clamp(12px, 3vw, 28px) auto 0;
  padding: 10px 10px 12px;
  background: linear-gradient(180deg, var(--cab-hi), var(--cab) 22%, #0d0b13);
  border: 3px solid #000;
  border-radius: 20px 20px 10px 10px;
  box-shadow:
    inset 0 0 0 2px #2c2540,
    0 0 0 2px #000,
    0 0 36px rgba(255, 90, 67, .22),
    0 28px 80px rgba(0, 0, 0, .7);
  position: relative;
}
/* Neón lateral */
.cabinet::before, .cabinet::after {
  content: ""; position: absolute; top: 90px; bottom: 150px; width: 4px; border-radius: 2px;
  background: linear-gradient(180deg, var(--pulse), var(--cyan));
  opacity: .55; box-shadow: 0 0 10px currentColor; color: var(--pulse);
}
.cabinet::before { left: 3px; }
.cabinet::after { right: 3px; }

/* Marquesina */
.marquee {
  position: relative;
  display: grid; justify-items: center; gap: 8px;
  padding: 14px 14px 16px;
  margin-bottom: 10px;
  background: linear-gradient(180deg, #1c1626, #0b0910);
  border: 2px solid #000; border-radius: 12px 12px 4px 4px;
  box-shadow: inset 0 0 22px rgba(255, 90, 67, .28), inset 0 0 0 2px #2c2540;
  text-align: center;
}
.marquee-kicker {
  font: 8px/1.4 var(--px); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft);
}
.marquee-title {
  font: 400 clamp(26px, 8.6vw, 54px)/1 var(--px);
  color: var(--pulse);
  letter-spacing: .04em;
  text-shadow: 0 0 6px var(--pulse-glow), 0 0 18px var(--pulse-glow), 3px 3px 0 #000;
}

/* Bisel + pantalla */
.bezel {
  padding: 12px;
  background: linear-gradient(180deg, #08070d, #121019);
  border: 2px solid #000; border-radius: 14px;
  box-shadow: inset 0 0 0 2px #2c2540, inset 0 6px 14px rgba(0, 0, 0, .8);
}
.screen {
  position: relative; isolation: isolate;
  display: grid;                         /* las pantallas se apilan: la altura es la de la más alta */
  grid-template-rows: auto 1fr;
  min-height: 480px;
  padding: 12px 14px 16px;
  background: radial-gradient(ellipse at 50% 40%, #12101c 0%, var(--screen) 80%);
  border-radius: 22px / 26px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(78, 227, 255, .12), 0 0 0 3px #000;
  color: var(--ink);
  text-shadow: 0 0 4px rgba(243, 236, 228, .25);
}
.hud {
  grid-row: 1; display: flex; justify-content: space-between;
  font: 10px/1 var(--px); color: var(--pulse); letter-spacing: .03em;
  padding-bottom: 10px;
}
.hud span:last-child { color: var(--amber); }

/* Pantallas del juego */
.scr {
  grid-row: 2; grid-column: 1;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px;
  visibility: hidden; opacity: 0;
}
.scr.is-on { visibility: visible; opacity: 1; }

.scr-title {
  font: 400 clamp(15px, 4.8vw, 24px)/1.3 var(--px);
  letter-spacing: .04em;
  text-shadow: 0 0 8px currentColor, 2px 0 0 rgba(255, 90, 67, .55), -2px 0 0 rgba(78, 227, 255, .45);
}
.amber { color: var(--amber); }
.cyan { color: var(--cyan); }
.vt { font-size: clamp(21px, 5.6vw, 27px); line-height: 1.05; max-width: 25ch; color: var(--ink); }

.insert {
  font: 12px/1 var(--px); color: var(--pulse); letter-spacing: .06em;
  text-shadow: 0 0 8px var(--pulse-glow);
}

/* Botón dentro de la pantalla */
.btn-screen {
  appearance: none; cursor: pointer;
  min-height: 48px; padding: 14px 18px;
  font: 12px/1.2 var(--px); letter-spacing: .06em; color: #1a0703;
  background: var(--amber);
  border: 3px solid #000; border-radius: 0;
  box-shadow: 4px 4px 0 var(--pulse), 4px 4px 0 3px #000;
  text-shadow: none;
  transition: transform .08s steps(2), box-shadow .08s steps(2);
}
.btn-screen:hover { background: #ffe27a; }
.btn-screen:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--pulse), 1px 1px 0 3px #000; }
.btn-screen[aria-disabled="true"] {
  background: #3a3548; color: #b9b0c9; cursor: not-allowed;
  box-shadow: 4px 4px 0 #1b1824, 4px 4px 0 3px #000;
}
.btn-screen[aria-disabled="true"]:hover { background: #3a3548; }

/* Parpadeo (se desactiva con reduced-motion) */
.blink { animation: blink 1.2s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Cartucho grande de la portada */
.attract-cart { width: clamp(84px, 24vw, 118px); animation: bob 2.4s steps(4, end) infinite; }
.attract-cart svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 0 14px rgba(255, 138, 76, .45)); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- Selección ---------- */
.carts {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(6px, 2vw, 14px);
  width: 100%; padding-top: 16px;
}
.cart {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
  position: relative; display: block; min-width: 0;
  aspect-ratio: 3 / 4;
  transition: transform .12s steps(3), filter .12s steps(3);
  filter: brightness(.7) saturate(.8);
}
.cart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cart:hover { filter: brightness(.95); }
.cart[aria-current="true"] {
  transform: translateY(-8px);
  filter: brightness(1.08) drop-shadow(0 0 10px var(--c, var(--pulse)));
}
.cart[aria-current="true"]::before {            /* cursor ▼ */
  content: ""; position: absolute; left: 50%; top: -22px; width: 14px; height: 10px; margin-left: -7px;
  background: var(--amber);
  clip-path: polygon(0 0, 100% 0, 100% 30%, 80% 30%, 80% 50%, 60% 50%, 60% 70%, 40% 70%, 40% 50%, 20% 50%, 20% 30%, 0 30%);
  animation: blink 1.2s steps(1, end) infinite;
}
.cart[aria-disabled="true"] svg { filter: saturate(.35); }
.cart:focus-visible { outline: 3px solid var(--amber); outline-offset: 4px; }
.cart.nope { animation: nope .28s steps(4, end); }
@keyframes nope { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }

.details { display: grid; width: 100%; margin-top: 6px; }
.detail {
  grid-area: 1 / 1;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  visibility: hidden; opacity: 0;
}
.detail.is-on { visibility: visible; opacity: 1; }
.d-status { font: 9px/1 var(--px); letter-spacing: .08em; color: var(--green); }
.detail.soon .d-status { color: var(--pulse); }
.d-title {
  font: 400 clamp(17px, 5.6vw, 28px)/1.2 var(--px); color: var(--ink);
  text-shadow: 0 0 8px var(--c, var(--pulse)), 2px 2px 0 #000;
}
.d-name { font: 9px/1.5 var(--px); color: var(--amber); letter-spacing: .04em; }
.d-desc { font-size: clamp(20px, 5.2vw, 25px); line-height: 1.05; max-width: 34ch; color: var(--ink); }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; padding: 0; margin: 2px 0 0; }
.tags li { font: 8px/1 var(--px); padding: 5px 6px 4px; border: 2px solid var(--cyan); color: var(--cyan); }
.d-note { font-size: 20px; color: var(--ink-soft); line-height: 1; }
.detail .btn-screen { margin-top: 6px; }
.detail { gap: 7px; }

/* ---------- Cargando ---------- */
.scr-loading { justify-content: center; }
.bar { display: flex; gap: 4px; padding: 6px; border: 3px solid var(--ink); width: min(260px, 100%); }
.bar i { flex: 1; height: 18px; background: var(--pulse); opacity: .12; }
.bar i.on { opacity: 1; box-shadow: 0 0 8px var(--pulse-glow); }

/* ---------- Efectos CRT ---------- */
.fx { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.fx-scan {
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 0) 2px, rgba(0, 0, 0, .24) 2px, rgba(0, 0, 0, .24) 3px);
  mix-blend-mode: multiply;
}
.fx-sweep {
  top: -30%; bottom: auto; height: 30%;
  background: linear-gradient(to bottom, transparent, rgba(180, 240, 255, .06), transparent);
  animation: sweep 7s linear infinite;
}
@keyframes sweep { from { transform: translateY(0); } to { transform: translateY(440%); } }
.fx-glass { background: linear-gradient(125deg, rgba(255, 255, 255, .07) 0%, transparent 28%); }
.fx-vig {
  background: radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, .55) 85%, rgba(0, 0, 0, .85) 100%);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, .8);
}

/* ---------- Panel de mandos ---------- */
.panel {
  margin-top: 12px; padding: 14px 10px 12px;
  background:
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .02) 0 6px, transparent 6px 12px),
    linear-gradient(180deg, #2a2338, #181321);
  border: 2px solid #000; border-radius: 6px 6px 12px 12px;
  box-shadow: inset 0 2px 0 #3d3352, inset 0 0 0 2px rgba(0, 0, 0, .4);
}
.controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.stick { display: flex; align-items: center; gap: 4px; }
.pad {
  appearance: none; cursor: pointer;
  width: 48px; height: 48px; padding: 8px; display: grid; place-items: center;
  background: #0d0b13; color: var(--ink);
  border: 3px solid #000; border-radius: 6px;
  box-shadow: inset 0 0 0 2px #3a3150, 0 4px 0 #000;
  transition: transform .06s steps(2), box-shadow .06s steps(2);
}
.pad svg { width: 100%; height: 100%; display: block; }
.pad:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px #3a3150, 0 1px 0 #000; }
.pad[aria-disabled="true"] { color: #5d5470; cursor: default; }
.joy { width: 44px; height: auto; display: block; }
.joy-stick { transform-origin: 24px 46px; transition: transform .12s steps(3); }
.stick[data-tilt="l"] .joy-stick { transform: rotate(-16deg); }
.stick[data-tilt="r"] .joy-stick { transform: rotate(16deg); }

.start-wrap, .sound-wrap { display: grid; justify-items: center; gap: 8px; }
.lbl { font: 8px/1 var(--px); color: var(--ink-soft); letter-spacing: .08em; }
.start {
  appearance: none; cursor: pointer; padding: 0;
  width: 64px; height: 64px; border-radius: 50%;
  background: #1a0703; border: 3px solid #000;
  box-shadow: inset 0 0 0 3px #3a3150, 0 5px 0 #000;
  display: grid; place-items: center;
  transition: transform .06s steps(2), box-shadow .06s steps(2);
}
.start span {
  width: 46px; height: 46px; border-radius: 50%; display: block;
  background: radial-gradient(circle at 36% 30%, #ff9c8c 0 12%, var(--pulse) 36%, #b82a17 100%);
  border: 2px solid #000;
  box-shadow: 0 0 12px var(--pulse-glow);
}
.start:active { transform: translateY(4px); box-shadow: inset 0 0 0 3px #3a3150, 0 1px 0 #000; }
.start[data-pulse="1"] span { animation: glow 1.2s steps(2, end) infinite; }
@keyframes glow { 50% { box-shadow: 0 0 22px var(--pulse), 0 0 6px #fff; } }

.sound {
  appearance: none; cursor: pointer;
  display: grid; justify-items: center; gap: 6px;
  min-width: 68px; min-height: 48px; padding: 8px 6px;
  font: 8px/1.2 var(--px); color: var(--ink-soft); letter-spacing: .04em; text-align: center;
  background: #0d0b13;
  border: 3px solid #000; border-radius: 6px;
  box-shadow: inset 0 0 0 2px #3a3150, 0 4px 0 #000;
}
.sound svg { width: 22px; height: 22px; }
.sound b { font-weight: 400; color: var(--pulse); }
.sound .waves, .sound .mute { display: none; }
.sound[aria-pressed="true"] { color: var(--ink); }
.sound[aria-pressed="true"] b { color: var(--green); }
.sound[aria-pressed="true"] .waves { display: inline; }
.sound[aria-pressed="false"] .mute { display: inline; }
.sound:active { transform: translateY(3px); box-shadow: inset 0 0 0 2px #3a3150, 0 1px 0 #000; }

/* Ranura de monedas */
.coin-door {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 14px auto 0; padding: 7px 12px; width: fit-content; max-width: 100%;
  background: #0b0910; border: 2px solid #000; border-radius: 4px;
  box-shadow: inset 0 0 0 2px #2c2540;
}
.coin-text { font: 8px/1 var(--px); color: var(--ink-soft); letter-spacing: .08em; }
.slot { width: 14px; height: 22px; background: #000; border: 2px solid #3a3150; display: grid; place-items: center; }
.slot i { width: 2px; height: 12px; background: var(--pulse); box-shadow: 0 0 6px var(--pulse); }
.led { width: 8px; height: 8px; background: var(--pulse); border: 1px solid #000; box-shadow: 0 0 8px var(--pulse); animation: blink 1.6s steps(1, end) infinite; }
.led:last-child { animation-delay: .8s; }

/* ---------- Pie ---------- */
.foot {
  width: min(680px, 100% - 2 * var(--gutter));
  margin: clamp(36px, 8vw, 64px) auto 0;
  padding: 22px 0 calc(40px + env(safe-area-inset-bottom));
  border-top: 2px dashed var(--line);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px 24px;
  color: var(--ink-soft);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.foot a { font: 10px/1.4 var(--px); text-decoration: none; color: var(--ink); padding: 8px 0; border-bottom: 2px solid var(--pulse); }
.foot a:hover { color: var(--pulse); }
.foot p { font-size: 20px; align-self: center; }

.noscript { max-width: 680px; margin: 20px auto; padding: 16px; border: 2px dashed var(--amber); text-align: center; }

/* ---------- Escritorio ---------- */
@media (min-width: 640px) {
  body { font-size: 24px; }
  .cabinet { padding: 14px 16px 16px; }
  .marquee { padding: 18px 18px 20px; }
  .marquee-kicker { font-size: 10px; }
  .screen { min-height: 560px; padding: 16px 28px 26px; }
  .hud { font-size: 10px; }
  .vt { max-width: 28ch; }
  .carts { max-width: 480px; }
  .d-status, .d-name { font-size: 10px; }
  .tags li { font-size: 9px; }
  .insert { font-size: 14px; }
  .btn-screen { font-size: 13px; }
  .pad { width: 56px; height: 56px; }
  .joy { width: 52px; }
  .start { width: 72px; height: 72px; }
  .start span { width: 52px; height: 52px; }
  .sound { font-size: 9px; min-width: 84px; }
  .lbl, .coin-text { font-size: 9px; }
}

/* ---------- Movimiento reducido: sin parpadeos ni efectos animados ---------- */
@media (prefers-reduced-motion: reduce) {
  .blink, .led, .cart[aria-current="true"]::before, .start[data-pulse="1"] span { animation: none; }
  .attract-cart, .fx-sweep, .cart.nope { animation: none; }
  .fx-sweep { display: none; }
  .btn-screen, .pad, .start, .cart, .joy-stick { transition: none; }
}
