:root {
  --bg: #07081a;
  --panel: rgba(14, 16, 38, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --ink: #10121f;
  --text: #e6e8f5;
  --muted: #9aa0c3;
  --mint: #2ee6a8;
  --red: #ff4d6d;
  --pink: #ff4dd2;
  --gold: #ffd84a;
  --cyan: #4dd4ff;
  --display: "Bungee", Impact, sans-serif;
  --body: "Inter", system-ui, sans-serif;
  --cell: min(11.2vw, 74px, calc((100vh - 330px) / 6.4));
  /* the glyphs embossed on the discs: contactless for player 1, a card chip for player 2 */
  --glyph-p1: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310121f' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M7.5 7.5c1.8 2.9 1.8 6.1 0 9'/%3E%3Cpath d='M11.5 5.5c2.9 4.1 2.9 8.9 0 13'/%3E%3Cpath d='M15.5 3.5c4 5.3 4 11.7 0 17'/%3E%3C/svg%3E");
  --glyph-p2: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310121f' stroke-width='2.2' stroke-linejoin='round'%3E%3Crect x='4' y='6' width='16' height='12' rx='3'/%3E%3Cpath d='M4 12h5M15 12h5M12 6v12M9 9.5v5M15 9.5v5'/%3E%3C/svg%3E");
}
@property --spin { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--text); font-family: var(--body); background: var(--bg); overflow-x: hidden; }
[hidden] { display: none !important; }

/* ---- the scene: the high street, blurred and drifting, under rain */
.scene {
  position: fixed; inset: -4%; z-index: -3;
  background: url("../doorstep/assets/keyart.webp") center / cover no-repeat;
  filter: blur(6px) brightness(0.34) saturate(1.25);
  animation: drift 40s ease-in-out infinite alternate;
}
.scene::after {
  content: ""; position: fixed; inset: 0;
  background: radial-gradient(ellipse at 50% 40%, rgba(7, 8, 26, 0) 30%, rgba(7, 8, 26, 0.85) 90%);
}
@keyframes drift { to { transform: scale(1.08) translate(-1.5%, 1%); } }
#rain { position: fixed; inset: 0; z-index: -2; pointer-events: none; }
#fx { position: fixed; inset: 0; z-index: 8; pointer-events: none; }

.arcade-back { position: fixed; top: 14px; left: 16px; color: var(--muted); font-weight: 800; text-decoration: none; font-size: 14px; z-index: 5; }
.arcade-back:hover { color: var(--mint); }

.screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 44px 16px 20px; }

/* ---- neon signs */
.neon {
  margin: 0; font-family: var(--display); font-weight: 400; text-align: center; line-height: 0.95; color: #fff5fd;
  font-size: clamp(26px, 4vw, 40px); letter-spacing: 2px;
  text-shadow: 0 0 6px #fff, 0 0 14px var(--pink), 0 0 30px var(--pink), 0 0 60px rgba(255, 77, 210, 0.6);
  animation: flicker 6s infinite;
}
.neon.big { font-size: clamp(52px, 9vw, 110px); }
.neon.small { font-size: clamp(26px, 4vw, 38px); }
@keyframes flicker {
  0%, 92%, 100% { opacity: 1; }
  93% { opacity: 0.55; } 94% { opacity: 1; } 96% { opacity: 0.7; } 97% { opacity: 1; }
}
.tag { margin: 0; font-weight: 800; color: var(--mint); letter-spacing: 2px; text-transform: uppercase; font-size: 14px; text-align: center; text-shadow: 0 0 12px rgba(46, 230, 168, 0.6); }

/* ---- the setup screen */
.card { background: var(--panel); border: 2px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); }
.setup { width: min(540px, 100%); display: grid; gap: 16px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode, .levels button {
  font-family: var(--body); color: #fff; background: #1c1f44; border: 3px solid var(--ink); border-radius: 14px; cursor: pointer;
  padding: 12px; display: grid; gap: 4px; justify-items: center; text-align: center; transition: transform 0.12s;
}
.mode:hover, .levels button:hover { transform: translateY(-2px); }
.mode b { font: 400 17px var(--display); }
.mode small { color: var(--muted); font-weight: 700; }
.mode .art { display: flex; align-items: center; gap: 8px; height: 52px; }
.mode .art em { font: 400 13px var(--display); color: var(--muted); font-style: normal; }
.mode[aria-pressed="true"], .levels button[aria-pressed="true"] { background: var(--mint); color: var(--ink); box-shadow: 0 0 24px rgba(46, 230, 168, 0.45); }
.mode[aria-pressed="true"] small, .mode[aria-pressed="true"] .art em { color: var(--ink); }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.levels button { font: 400 15px var(--display); }
.fields { display: grid; gap: 8px; }
label { font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
input { font: 800 17px var(--body); padding: 12px 14px; border-radius: 12px; border: 3px solid var(--ink); background: #fff7e3; color: var(--ink); outline: none; width: 100%; }
input:focus { box-shadow: 0 0 0 3px var(--mint); }
.hint { margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; }
.mint { color: var(--mint); } .red { color: var(--red); } .gold { color: var(--gold); }

.btn {
  font: 400 17px var(--display); padding: 12px 20px; border-radius: 12px; border: 3px solid var(--ink);
  background: #2a2e57; color: #fff; cursor: pointer; text-decoration: none; display: inline-block; box-shadow: 0 5px 0 var(--ink);
}
.btn.primary { background: var(--mint); color: var(--ink); box-shadow: 0 5px 0 var(--ink), 0 0 26px rgba(46, 230, 168, 0.35); }
.btn.big { font-size: 21px; padding: 15px; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---- tokens (the discs) */
.token, .disc {
  border-radius: 50%; border: 4px solid var(--ink);
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.75) 0 7%, transparent 8%),
    var(--glyph) center / 44% no-repeat,
    radial-gradient(circle, transparent 0 54%, rgba(0, 0, 0, 0.2) 55% 62%, transparent 63%),
    radial-gradient(circle at 38% 32%, var(--lite), var(--base) 58%, var(--dark));
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.25), 0 0 16px var(--glow);
}
.p1 { --lite: #a8ffe0; --base: #2ee6a8; --dark: #0b8f64; --glow: rgba(46, 230, 168, 0.5); --glyph: var(--glyph-p1); }
.p2 { --lite: #ffc0f1; --base: #ff4dd2; --dark: #a50f84; --glow: rgba(255, 77, 210, 0.5); --glyph: var(--glyph-p2); }
.token { display: inline-block; width: 44px; height: 44px; flex: none; }
.token.mini { width: 20px; height: 20px; border-width: 3px; }

/* faces: initials for people, the boss for the computer */
.avatar, .face {
  flex: none; width: 50px; height: 50px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center;
  font: 400 19px var(--display); color: var(--ink); position: relative; overflow: hidden;
}
.avatar.p1 { background: radial-gradient(circle at 35% 30%, #a8ffe0, #2ee6a8 60%, #0b8f64); }
.avatar.p2 { background: radial-gradient(circle at 35% 30%, #ffc0f1, #ff4dd2 60%, #a50f84); }
.avatar.boss, .face.boss {
  background: url("../doorstep/assets/boss.webp") 62% 6% / 190% auto no-repeat, radial-gradient(circle at 50% 30%, #6b2a8a, #210f33);
  box-shadow: 0 0 18px rgba(255, 77, 210, 0.55);
}
.face { width: 52px; height: 52px; }
.avatar.big { width: 96px; height: 96px; font-size: 34px; border-width: 5px; }

/* ---- the game screen */
#game { justify-content: flex-start; padding-top: 40px; gap: 10px; }
.players { display: flex; align-items: center; gap: 12px; width: min(calc(var(--cell) * 7 + 240px), 100%); }
.player {
  flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 12px; border-radius: 16px; position: relative;
  background: var(--panel); border: 3px solid transparent; transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.player .who { display: grid; min-width: 0; }
.player .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.player .score { color: var(--muted); font-weight: 800; font-size: 13px; }
.player .streak { position: absolute; top: -13px; right: 12px; font: 400 12px var(--display); border: 2px solid var(--ink); color: var(--ink); background: var(--gold); border-radius: 8px; padding: 3px 7px; white-space: nowrap; opacity: 0; transform: scale(0.6); transition: 0.2s; }
.player .streak.show { opacity: 1; transform: scale(1); box-shadow: 0 0 18px rgba(255, 216, 74, 0.6); }
.player.on { transform: translateY(-3px) scale(1.02); }
#pl0.on { border-color: var(--mint); box-shadow: 0 0 28px rgba(46, 230, 168, 0.45); }
#pl1.on { border-color: var(--pink); box-shadow: 0 0 28px rgba(255, 77, 210, 0.45); }
.vs { font: 400 18px var(--display); color: #fff; text-shadow: 0 0 12px var(--pink); }
.turn { margin: 0; font-weight: 800; font-size: 17px; min-height: 24px; text-align: center; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8); }

/* the computer's reactions */
.bubble {
  position: absolute; top: -20px; left: 46px; font: 400 15px var(--display); color: var(--ink); background: #fff; border: 3px solid var(--ink);
  border-radius: 12px; padding: 3px 9px; opacity: 0; transform: scale(0.4) rotate(-8deg); transition: 0.18s; pointer-events: none; z-index: 2;
}
.bubble.show { opacity: 1; transform: scale(1) rotate(-6deg); }
.react-yes .avatar { animation: hop 0.6s ease-out; }
.react-no .avatar { animation: shake 0.5s; }
@keyframes hop { 30% { transform: translateY(-10px) scale(1.1); } 60% { transform: translateY(0) scale(0.96); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px) rotate(-6deg); } 40%, 80% { transform: translateX(5px) rotate(6deg); } }

/* ---- the board: a neon-framed cabinet */
.board-wrap { position: relative; margin-top: 4px; }
.board-wrap.thud { animation: thud 0.22s ease-out; }
@keyframes thud { 40% { transform: translateY(5px); } }
.ghostrow { display: grid; grid-template-columns: repeat(7, var(--cell)); padding: 0 14px; height: calc(var(--cell) * 0.92); }
.ghost { width: calc(var(--cell) * 0.8); height: calc(var(--cell) * 0.8); margin: auto; opacity: 0; transition: opacity 0.15s; animation: bob 1.1s ease-in-out infinite; }
.ghost.show { opacity: 0.92; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.board {
  display: grid; grid-template-columns: repeat(7, var(--cell)); padding: 14px; border-radius: 26px; position: relative;
  background: linear-gradient(180deg, #232a78, #151a52 60%, #10133f);
  border: 5px solid var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65), inset 0 2px 0 rgba(255, 255, 255, 0.12), inset 0 -10px 0 rgba(0, 0, 0, 0.3);
}
.board::before {     /* the neon tube around the frame */
  content: ""; position: absolute; inset: -13px; border-radius: 36px; padding: 4px; pointer-events: none;
  background: conic-gradient(from var(--spin), var(--mint), var(--cyan), var(--pink), var(--gold), var(--mint));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  filter: drop-shadow(0 0 8px rgba(77, 212, 255, 0.9)) drop-shadow(0 0 18px rgba(255, 77, 210, 0.6));
  animation: spin 9s linear infinite;
}
@keyframes spin { to { --spin: 360deg; } }
.board.flash { animation: flash 0.5s; }
@keyframes flash { 30% { filter: brightness(1.6); } }

.col { display: grid; grid-template-rows: repeat(6, var(--cell)); cursor: default; border-radius: 14px; border: 0; padding: 0; background: transparent; position: relative; }
.board.live .col { cursor: pointer; }
.board.live .col.focus { background: linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.03) 85%); box-shadow: 0 0 22px rgba(255, 255, 255, 0.12) inset; }
.board.live .col.full { cursor: not-allowed; }
.cell { position: relative; display: grid; place-items: center; }
.cell::before {
  content: ""; width: 80%; height: 80%; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #05061a 0 55%, #0c0e30);
  border: 3px solid var(--ink); box-shadow: inset 0 7px 10px rgba(0, 0, 0, 0.75), 0 0 0 2px rgba(77, 212, 255, 0.14);
}
.disc { position: absolute; width: 80%; height: 80%; will-change: transform; }
.disc.win { animation: winpulse 0.55s ease-in-out infinite alternate; box-shadow: 0 0 0 5px var(--gold), 0 0 34px var(--gold); }
@keyframes winpulse { to { transform: scale(1.12); } }

.slam { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 3; }
.slam span {
  font: 400 clamp(30px, 6.5vw, 66px) var(--display); color: var(--gold); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill;
  padding: 6px 22px; border: 6px solid var(--gold); border-radius: 16px; background: rgba(14, 16, 38, 0.82);
  box-shadow: 0 0 44px rgba(255, 216, 74, 0.65); transform: rotate(-8deg); animation: slam 0.5s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
@keyframes slam { from { transform: rotate(-8deg) scale(3); opacity: 0; } }
.keys { margin: 6px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.keys b { color: #fff; }

/* ---- the turn banner */
.banner { position: fixed; left: 0; right: 0; top: 42%; z-index: 9; pointer-events: none; display: grid; place-items: center; }
.banner span {
  font: 400 clamp(26px, 5vw, 54px) var(--display); color: var(--ink); padding: 10px 40px; width: 100%; text-align: center;
  background: var(--mint); border-top: 5px solid var(--ink); border-bottom: 5px solid var(--ink);
  box-shadow: 0 0 50px rgba(46, 230, 168, 0.6); animation: sweep 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}
.banner.p2 span { background: var(--pink); box-shadow: 0 0 50px rgba(255, 77, 210, 0.6); }
@keyframes sweep {
  0% { transform: translateX(-110%) skewX(-12deg); }
  25%, 75% { transform: translateX(0) skewX(-12deg); }
  100% { transform: translateX(110%) skewX(-12deg); }
}

/* ---- the question card: a deal ticket */
.overlay { position: fixed; inset: 0; background: rgba(4, 4, 18, 0.66); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 10; overflow-y: auto; }
.qcard {
  width: min(690px, 100%); position: relative; background: linear-gradient(180deg, #1a1d48, #11133a); border: 4px solid var(--ink);
  border-radius: 22px; padding: 26px 24px 22px; display: grid; gap: 12px; animation: rise 0.25s ease-out;
  box-shadow: 0 0 0 3px var(--gold), 0 0 40px rgba(255, 216, 74, 0.35), 0 24px 70px rgba(0, 0, 0, 0.7);
}
.qcard::before {     /* the perforated ticket edge */
  content: ""; position: absolute; left: 18px; right: 18px; top: 9px; height: 6px;
  background: radial-gradient(circle, rgba(255, 216, 74, 0.55) 2px, transparent 2.5px) 0 0 / 14px 6px repeat-x;
}
.qcard.center { text-align: center; justify-items: center; }
.qcard.shake { animation: shake 0.45s; }
@keyframes rise { from { transform: translateY(26px) scale(0.97); opacity: 0; } }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.qkind { font: 400 13px var(--display); padding: 5px 10px; border-radius: 8px; background: var(--gold); color: var(--ink); box-shadow: 0 0 16px rgba(255, 216, 74, 0.5); }
.qwho { font-weight: 900; font-size: 14px; color: var(--muted); }
.qwho.p1 { color: var(--mint); } .qwho.p2 { color: var(--pink); }
.qtitle { margin: 0; font: 400 15px var(--display); color: var(--cyan); letter-spacing: 1px; }
.qprompt { margin: 0; font-weight: 900; font-size: 21px; line-height: 1.35; color: #fff; }
.placard {
  justify-self: start; background: #fff7e3; color: var(--ink); border: 3px solid var(--ink); border-left: 12px solid var(--mint);
  border-radius: 10px; padding: 10px 18px; font-weight: 900; font-size: 20px; box-shadow: 0 6px 0 rgba(0, 0, 0, 0.4); transform: rotate(-1.5deg);
}
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.opt {
  display: flex; gap: 10px; align-items: center; text-align: left; padding: 12px 14px; border-radius: 14px; cursor: pointer;
  background: #232766; border: 3px solid var(--ink); color: #fff; font: 800 15px var(--body); line-height: 1.3; min-height: 58px;
  box-shadow: 0 4px 0 var(--ink); transition: transform 0.08s, background 0.15s;
}
.opt:hover:not(:disabled) { background: #2f3488; transform: translateY(-2px); }
.opt .key { font: 400 15px var(--display); background: var(--mint); color: var(--ink); border-radius: 8px; width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.opt:disabled { cursor: default; }
.opt.right { background: rgba(46, 230, 168, 0.3); border-color: var(--mint); box-shadow: 0 0 20px rgba(46, 230, 168, 0.4); }
.opt.wrong { background: rgba(255, 77, 109, 0.28); border-color: var(--red); }
.opt.picked { outline: 3px solid #fff; outline-offset: 2px; }

/* the fuse: burns down, sparks at the end, turns red for the last five seconds */
.fuse { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); }
.fuse i { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; border-radius: 4px; background: linear-gradient(90deg, #ff9f43, var(--gold)); }
.fuse i::after {
  content: ""; position: absolute; right: -7px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 25%, var(--gold) 40%, rgba(255, 159, 67, 0) 70%); animation: spark 0.15s infinite alternate;
}
.fuse.out i::after { display: none; }
.fuse.hurry i { background: linear-gradient(90deg, #ff4d6d, #ff9f43); }
.fuse.hurry { animation: hurry 0.5s infinite alternate; }
@keyframes spark { to { transform: scale(1.5); } }
@keyframes hurry { to { box-shadow: 0 0 14px rgba(255, 77, 109, 0.8); } }

.feedback { display: grid; gap: 6px; border-top: 2px dashed rgba(255, 216, 74, 0.35); padding-top: 12px; }
.verdict { margin: 0; font: 400 21px var(--display); }
.verdict.ok { color: var(--mint); text-shadow: 0 0 14px rgba(46, 230, 168, 0.6); } .verdict.no { color: var(--red); }
.why { margin: 0; line-height: 1.45; }
.src { margin: 0; color: var(--muted); font-size: 12px; font-weight: 800; }
.feedback .btn { justify-self: start; margin-top: 4px; }

.qstamp {
  position: absolute; top: 18px; right: 18px; font: 400 26px var(--display); padding: 4px 14px; border: 5px solid; border-radius: 12px;
  transform: rotate(10deg); animation: stamp 0.4s cubic-bezier(0.2, 1.7, 0.4, 1) both; pointer-events: none; background: rgba(14, 16, 38, 0.85);
}
.qstamp.ok { color: var(--mint); border-color: var(--mint); box-shadow: 0 0 24px rgba(46, 230, 168, 0.55); }
.qstamp.no { color: var(--red); border-color: var(--red); box-shadow: 0 0 24px rgba(255, 77, 109, 0.55); }
@keyframes stamp { from { transform: rotate(10deg) scale(2.6); opacity: 0; } }

.tally { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.tally div { background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 12px; }
.tally b { display: block; font: 400 24px var(--display); color: #fff; }
.tally small { color: var(--muted); font-weight: 800; }

@media (max-width: 640px) {
  .options { grid-template-columns: 1fr; }
  .keys { display: none; }
  .qprompt { font-size: 18px; }
  .qstamp { font-size: 18px; top: 12px; right: 12px; }
  .player .streak { display: none; }
  .avatar { width: 40px; height: 40px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .scene, .neon, .board::before, .ghost, .fuse i::after { animation: none; }
}
