/* DJW Arcade — game styles. Brand tokens (--bg, --pink, --cyan, --display…) come from /style.css. */
html, body { background: var(--bg, #07080d); }
body.arcade { overflow-x: hidden; }
.arcade button { -webkit-tap-highlight-color: transparent; }

/* ---------- cabinet picker ---------- */
.arc-select { padding: 8px 0 20px; }

.cab-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 600px) { .cab-grid { grid-template-columns: repeat(4, 1fr); gap: 10px; } }
@media (min-width: 1040px) { .cab-grid { grid-template-columns: repeat(7, 1fr); } .cab strong { font-size: 19px; } }
.cab {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  min-height: 148px; padding: 14px 14px 12px; border-radius: var(--r-lg); cursor: pointer; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  transition: transform .25s var(--ease), border-color .25s, background .25s;
}
.cab::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 85% 15%, rgba(36, 216, 255, .12), transparent 45%); pointer-events: none; }
.cab:nth-child(even)::before { background: radial-gradient(circle at 85% 15%, rgba(255, 46, 166, .14), transparent 45%); }
.cab:hover { transform: translateY(-3px); border-color: rgba(255, 255, 255, .25); }
.cab.active { border-color: var(--pink); background: var(--surface-2); box-shadow: 0 0 0 1px var(--pink), 0 14px 40px -18px rgba(255, 46, 166, .8); }
.cab .game-no { font: 400 12px var(--display); color: var(--muted); letter-spacing: .08em; }
.cab .game-emoji { font-size: 32px; line-height: 1; margin: 14px 0 10px; }
.cab strong { font: 400 21px/1 var(--display); text-transform: uppercase; }
.cab small { color: var(--muted); font-size: 12.5px; margin-top: 4px; line-height: 1.3; }
.cab i { margin-top: auto; padding-top: 10px; font: 700 11px var(--body); font-style: normal; letter-spacing: .12em; color: var(--cyan); }
.cab .new { position: absolute; top: 12px; right: 12px; font: 700 10px var(--body); letter-spacing: .12em; color: var(--pink-ink); background: var(--pink); padding: 3px 7px; border-radius: 999px; }
.cab.is-playing i { color: var(--pink); }
/* phones: compact two-up chips so the games are one short scroll away */
@media (max-width: 599px) {
  .cab { min-height: 64px; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 8px; padding: 10px 10px; border-radius: var(--r); }
  .cab:hover { transform: none; }
  .cab .game-no, .cab i { display: none; }
  .cab .game-emoji { grid-row: 1 / 3; font-size: 26px; margin: 0; }
  .cab strong { font-size: 16px; line-height: 1.05; }
  .cab small { font-size: 11.5px; margin-top: 2px; }
  .cab .new { top: 6px; right: 6px; font-size: 8px; padding: 2px 5px; }
  .cab .new ~ strong { padding-right: 30px; }   /* long names wrap instead of running under the badge */
  .cab.is-playing { border-color: var(--cyan); }
}

/* ---------- stage ---------- */
.arc-stage { padding: 6px 0 56px; }
.stage { border-radius: 28px; border: 1px solid var(--line); background: var(--surface); overflow: hidden; scroll-margin-top: 12px; }
.full-game { display: none; padding: clamp(16px, 3vw, 30px); }
.full-game.active { display: block; }
.full-game > header { display: grid; gap: .5rem 2rem; align-items: end; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
@media (min-width: 860px) { .full-game > header { grid-template-columns: auto 1fr; } }
.full-game > header > span { font: 700 12px var(--body); letter-spacing: .14em; color: var(--cyan); }
.full-game > header h2 { font-size: clamp(2rem, 4.4vw, 3.6rem); }
.full-game > header p { color: var(--muted); font-size: 15px; margin: 0; line-height: 1.5; }
.full-game-board { margin-top: 18px; padding: clamp(12px, 2.4vw, 22px); border-radius: 22px; background: #05070d; border: 1px solid rgba(255, 255, 255, .06); text-align: center; position: relative; }

.game-hud { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; font: 700 11px var(--body); letter-spacing: .14em; color: var(--muted); text-transform: uppercase; }
.game-hud b { color: var(--text); font: 400 22px var(--display); letter-spacing: .02em; margin-left: 6px; vertical-align: -3px; }
.game-message { color: var(--muted); font: 700 13px var(--body); letter-spacing: .12em; margin-top: 12px; }
.big-game-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 50px; margin: 16px auto 0; padding: 0 30px;
  border: 0; border-radius: 999px; background: var(--pink); color: #fff; cursor: pointer;
  font: 700 14px var(--body); letter-spacing: .1em; text-transform: uppercase;
  box-shadow: 0 8px 30px -10px rgba(255, 46, 166, .8); transition: transform .15s var(--ease), opacity .2s;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.big-game-button:active { transform: scale(.96); }
.big-game-button[disabled] { opacity: .5; cursor: default; box-shadow: none; }

.game-canvas { display: block; width: 100%; max-width: 700px; height: auto; margin: 14px auto 0; border-radius: 18px; border: 1px solid rgba(255, 255, 255, .08); background: #05070d; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.game-canvas.tall { max-width: 440px; }
.game-canvas.stacker { max-width: 340px; }
.game-canvas.square { max-width: 560px; }
.ctl-row { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.ctl-row .big-game-button { margin: 0; }
.ctl { min-width: 64px; min-height: 54px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 22px; font-weight: 700; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ctl:active { background: #232838; border-color: var(--cyan); }
.ctl.fire { min-width: 110px; font: 700 14px var(--body); letter-spacing: .12em; background: var(--cyan); color: var(--cyan-ink); border: 0; }

/* phones: tighter stage so board + controls fit one screen */
@media (max-width: 599px) {
  .stage { border-radius: 20px; }
  .full-game { padding: 12px; }
  .full-game > header { padding-bottom: 10px; gap: 2px; }
  .full-game > header h2 { font-size: 1.65rem; }
  .full-game-board { margin-top: 10px; padding: 10px; border-radius: 16px; }
  .game-canvas { margin-top: 8px; border-radius: 12px; }
  .snake-pad { grid-template-columns: repeat(3, 60px); gap: 6px; margin-top: 8px; }
  .snake-pad .ctl, .ctl { min-height: 48px; }
  .ctl-row { margin-top: 8px; }
}

/* While a round is on, touches on the board never scroll the page. */
.full-game-board.is-live, .full-game-board.is-live * { touch-action: none; overscroll-behavior: contain; }

/* ---------- Play / Game over / Paused overlay ---------- */
.go-overlay { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 20px; text-align: center; border-radius: inherit; background: rgba(7, 8, 13, .74); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); cursor: pointer; }
.go-overlay[hidden] { display: none; }
.go-kicker { font: 700 13px var(--body); letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); margin: 0; }
.go-overlay.is-over .go-kicker { color: var(--pink); }
.go-score { font: 400 clamp(48px, 12vw, 88px)/1 var(--display); margin-top: 4px; }
.go-line { color: var(--muted); font-size: 15px; margin: 2px 0 0; }
.go-score:empty, .go-line:empty, .go-hint:empty { display: none; }
.go-play { min-height: 64px; min-width: 210px; margin-top: 12px; padding: 0 36px; border: 0; border-radius: 999px; background: var(--pink); color: #fff; font: 400 30px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; box-shadow: 0 10px 40px -10px rgba(255, 46, 166, .9); transition: transform .15s var(--ease); }
.go-play::before { content: "▶  "; font-size: .7em; vertical-align: .12em; }
.go-play:hover { transform: scale(1.04); }
.go-hint { color: var(--text); font-size: 16px; margin: 12px 0 0; max-width: 32ch; line-height: 1.4; }
.go-save { margin-top: 10px; min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--cyan); font: 700 14px var(--body); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.go-save[hidden] { display: none; }

/* ---------- Punching Machine ---------- */
.punch-board { padding-bottom: 26px; }
.full-punch-target { display: block; width: 260px; height: 300px; margin: 14px auto 0; border: 0; background: transparent; position: relative; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.full-punch-rope { position: absolute; top: 0; left: 50%; width: 3px; height: 70px; background: #4d5667; transform: translateX(-50%); }
.full-punch-bag { position: absolute; left: 50%; top: 68px; width: 130px; height: 190px; transform: translateX(-50%); transform-origin: 50% 0; border-radius: 52px 52px 40px 40px; background: linear-gradient(180deg, #23123a 0 15%, #0c0d16 15% 81%, #23123a 81%); border: 2px solid #02030a; box-shadow: 0 25px 40px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 46, 166, .25); }
.full-punch-bag::before, .full-punch-bag::after { content: ""; position: absolute; left: 0; right: 0; height: 5px; background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.full-punch-bag::before { top: 22px; } .full-punch-bag::after { bottom: 30px; }
.full-punch-bag i { position: absolute; left: 0; right: 0; top: 82px; font: 400 32px var(--display); font-style: normal; color: var(--cyan); }
.full-punch-bag b { position: absolute; left: 0; right: 0; top: 44px; color: #fff; font-size: 24px; }
.full-punch-target.hit .full-punch-bag { animation: punchSwing .14s ease; }
@keyframes punchSwing { 50% { transform: translateX(-50%) rotate(12deg) translateY(-4px); } }

/* ---------- Whack-a-Rabbit ---------- */
.whack-grid { width: min(560px, 100%); margin: 16px auto 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.whack-hole { aspect-ratio: 1.15; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); position: relative; overflow: hidden; cursor: pointer; touch-action: manipulation; }
.whack-hole::after { content: ""; position: absolute; left: 14%; right: 14%; bottom: 9%; height: 21%; border-radius: 50%; background: #02030a; }
.whack-hole span { position: absolute; left: 50%; bottom: -80%; transform: translateX(-50%); font-size: clamp(36px, 9vw, 56px); transition: bottom .12s ease; z-index: 2; user-select: none; -webkit-user-select: none; }
.whack-hole.active span { bottom: 16%; }
.whack-hole.hit-good { box-shadow: inset 0 0 0 3px var(--cyan); }
.whack-hole.hit-bad { box-shadow: inset 0 0 0 3px var(--pink); }

/* ---------- Ball Pit Pop + Queen of Hearts ---------- */
.ball-pop-arena, .hearts-arena { width: 100%; max-width: 760px; height: 390px; margin: 14px auto 0; border-radius: 20px; border: 1px solid rgba(255, 255, 255, .08); position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.ball-pop-arena { background: linear-gradient(180deg, #08101c, #05070d); }
.hearts-arena { background: #060810; }
.ball-pop-arena.penalty, .hearts-arena.penalty { animation: penaltyFlash .2s ease; }
@keyframes penaltyFlash { 50% { box-shadow: inset 0 0 0 3px rgba(255, 93, 108, .8), inset 0 0 55px rgba(255, 93, 108, .2); } }
.pop-ball { position: absolute; padding: 0; border: 0; border-radius: 50%; cursor: pointer; touch-action: none; box-shadow: inset -8px -10px 18px rgba(0, 0, 0, .26), inset 8px 7px 13px rgba(255, 255, 255, .2), 0 9px 20px rgba(0, 0, 0, .3); }
.pop-ball.pink { background: radial-gradient(circle at 30% 25%, #ff9bd8, #ff2ea6 48%, #b30b6b); }
.pop-ball.blue { background: radial-gradient(circle at 30% 25%, #b5edff, #24d8ff 48%, #087da7); }
.pop-ball.gold { background: radial-gradient(circle at 30% 25%, #fff5b1, #ffcf35 48%, #b77d00); }
.falling-suit { position: absolute; top: 0; padding: 4px 8px; border: 0; background: transparent; font-size: 44px; line-height: 1; cursor: pointer; touch-action: none; animation: suitFall linear forwards; }
.hearts-arena.paused .falling-suit { animation-play-state: paused; }
.suit-pink { color: var(--pink); } .suit-blue { color: var(--cyan); } .suit-white { color: #f7f7fb; }
@keyframes suitFall { from { transform: translateY(-70px) rotate(0); } to { transform: translateY(400px) rotate(260deg); } }

/* ---------- Memory Madness ---------- */
.memory-grid { width: min(520px, 100%); margin: 16px auto 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.memory-card { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); cursor: pointer; overflow: hidden; touch-action: manipulation; transition: background .2s, border-color .2s; }
.memory-card-back, .memory-card-face { position: absolute; inset: 0; display: grid; place-items: center; transition: opacity .16s; }
.memory-card-back { font: 400 20px var(--display); color: #4a5064; letter-spacing: .05em; }
.memory-card-face { opacity: 0; }
.memory-card-face svg { width: 50%; height: 50%; }
.memory-card.flipped, .memory-card.matched { background: var(--surface-2); border-color: rgba(36, 216, 255, .35); }
.memory-card.matched { border-color: rgba(255, 46, 166, .45); }
.memory-card.flipped .memory-card-back, .memory-card.matched .memory-card-back { opacity: 0; }
.memory-card.flipped .memory-card-face, .memory-card.matched .memory-card-face { opacity: 1; }
.memory-card.matched .memory-card-face { filter: drop-shadow(0 0 9px currentColor); }

/* ---------- Snake ---------- */
.snake-pad { display: grid; grid-template-columns: repeat(3, 64px); grid-template-areas: ". up ." "left start right" ". down ."; gap: 8px; justify-content: center; margin-top: 14px; }
.snake-pad [data-snake-up] { grid-area: up; } .snake-pad [data-snake-down] { grid-area: down; }
.snake-pad [data-snake-left] { grid-area: left; } .snake-pad [data-snake-right] { grid-area: right; }
.game-canvas.snake-dead { animation: snakeDeath .5s ease; }
@keyframes snakeDeath { 30% { box-shadow: 0 0 0 3px var(--pink), 0 0 40px rgba(255, 46, 166, .5); } }

/* ---------- Simon Says ---------- */
.simon { position: relative; width: min(380px, 100%); aspect-ratio: 1; margin: 16px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.simon .pad { border: 0; cursor: pointer; opacity: .38; transition: opacity .08s, transform .08s, box-shadow .08s; touch-action: manipulation; position: relative; font: 700 12px var(--body); color: rgba(0, 0, 0, .55); }
.simon .pad:nth-child(1) { border-radius: 100% 12px 12px 12px; background: var(--pink); }
.simon .pad:nth-child(2) { border-radius: 12px 100% 12px 12px; background: var(--cyan); }
.simon .pad:nth-child(3) { border-radius: 12px 12px 12px 100%; background: var(--gold); }
.simon .pad:nth-child(4) { border-radius: 12px 12px 100% 12px; background: var(--violet); }
.simon .pad.lit { opacity: 1; transform: scale(1.02); box-shadow: 0 0 40px currentColor; }
.simon .pad:nth-child(1).lit { color: var(--pink); } .simon .pad:nth-child(2).lit { color: var(--cyan); } .simon .pad:nth-child(3).lit { color: var(--gold); } .simon .pad:nth-child(4).lit { color: var(--violet); }
.simon .pad.wrong { background: var(--danger); opacity: 1; }
.simon .pad kbd { position: absolute; bottom: 10px; right: 12px; font: inherit; color: rgba(0, 0, 0, .55); }
.simon .pad:nth-child(odd) kbd { right: auto; left: 12px; }
@media (hover: none) { .simon .pad kbd { display: none; } }
.simon.watching .pad { cursor: wait; }
.simon-core { position: absolute; left: 50%; top: 50%; width: 34%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: #05070d; border: 6px solid var(--bg); display: grid; place-content: center; text-align: center; pointer-events: none; }
.simon-core b { font: 400 clamp(30px, 9vw, 44px)/1 var(--display); }
.simon-core small { font: 700 10px var(--body); letter-spacing: .14em; color: var(--muted); }

/* ---------- Stacker ---------- */
.big-game-button.is-live { min-width: 220px; min-height: 60px; font-size: 18px; background: var(--cyan); color: var(--cyan-ink); box-shadow: 0 8px 30px -8px rgba(36, 216, 255, .8); }

/* ---------- leaderboard + score panel ---------- */
.lb { display: grid; gap: 14px; margin-top: 16px; scroll-margin-top: 12px; }
@media (min-width: 860px) { .lb { grid-template-columns: 1fr 1.15fr; } }
.lb-panel { border-radius: 24px; border: 1px solid var(--line); background: var(--surface); padding: clamp(18px, 3vw, 28px); min-width: 0; }
.lb-panel h3 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.lb-copy { color: var(--muted); font-size: 15px; margin: .6rem 0 0; }
.lb-result { font: 400 clamp(2.6rem, 7vw, 4rem)/1 var(--display); color: var(--cyan); margin: 14px 0; }
.lb-best { color: var(--muted); font-size: 13px; margin: 0 0 12px; min-height: 1em; }
.lb-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.lb-form label span, .reward-form label span { display: block; font: 700 12px var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.lb-form input, .reward-form input { width: 100%; min-height: 50px; padding: 0 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 16px; }
.lb-form input:focus, .reward-form input:focus { outline: none; border-color: var(--cyan); }
.lb-rule { display: block; color: var(--muted); font-size: 12.5px; margin-top: 10px; }
.lb-status { font-size: 13px; margin-top: 10px; color: var(--muted); }
.lb-status.ok { color: var(--cyan); } .lb-status.error { color: var(--danger); }
@media (max-width: 520px) { .lb-form { grid-template-columns: 1fr; } .lb-form .btn { width: 100%; } }

.lb-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.lb-head p { color: var(--muted); font-size: 14px; margin: .4rem 0 0; }
.lb-live { display: inline-flex; align-items: center; gap: 6px; font: 700 11px var(--body); letter-spacing: .14em; color: var(--pink); white-space: nowrap; }
.lb-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 10px var(--pink); animation: livePulse 1.6s infinite; }
@keyframes livePulse { 50% { opacity: .35; } }
.lb-tag { font: 700 11px var(--body); letter-spacing: .14em; color: var(--cyan); }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lb-list li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--bg); border: 1px solid transparent; }
.lb-list li:nth-child(1) { border-color: rgba(255, 194, 51, .45); }
.lb-list li.me { border-color: var(--cyan); }
.lb-rank { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 400 15px var(--display); background: var(--surface-2); }
.lb-list li:nth-child(1) .lb-rank { background: var(--gold); color: #2a1d00; }
.lb-list li:nth-child(2) .lb-rank { background: #cfd3de; color: #15171f; }
.lb-list li:nth-child(3) .lb-rank { background: #d38a4f; color: #2a1405; }
.lb-player { min-width: 0; }
.lb-player b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-player small { color: var(--cyan); font: 700 10px var(--body); letter-spacing: .14em; }
.lb-score { font: 400 18px var(--display); letter-spacing: .02em; white-space: nowrap; }
.lb-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 0; color: var(--muted); text-align: center; }
.lb-empty span { font-size: 30px; }
.lb-empty p { margin: 0; }
.lb-pop { animation: lbPop .35s var(--ease); }
@keyframes lbPop { from { opacity: .4; transform: translateY(4px); } }

/* ---------- reward ---------- */
.reward { margin-top: 16px; padding: 18px; border-radius: 18px; background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, linear-gradient(120deg, var(--pink), var(--cyan)) border-box; border: 2px solid transparent; }
.reward h4 { font: 400 clamp(1.4rem, 3vw, 1.9rem)/1 var(--display); text-transform: uppercase; margin: 0; }
.reward-kicker { font: 700 11px var(--body); letter-spacing: .14em; text-transform: uppercase; color: var(--pink); margin: 0 0 6px; }
.reward-copy { color: var(--muted); font-size: 14px; margin: 8px 0 12px; }
.reward-form { display: grid; gap: 10px; }
@media (min-width: 560px) { .reward-form { grid-template-columns: 1fr 1fr; } .reward-form .btn, .reward-error { grid-column: 1 / -1; } }
.reward-error { color: var(--danger); font-size: 14px; margin: 0; }
.reward.weekly { background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, linear-gradient(120deg, var(--cyan), var(--pink)) border-box; }
.reward.weekly .reward-kicker { color: var(--cyan); }
.reward-tick { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; }
.reward-tick input { width: 20px; height: 20px; margin: 0; accent-color: var(--pink); }
@media (min-width: 560px) { .reward-tick { grid-column: 1 / -1; } }
.reward-code { font: 400 clamp(2rem, 6vw, 2.8rem)/1 var(--display); letter-spacing: .06em; color: var(--cyan); margin: 12px 0 0; user-select: all; -webkit-user-select: all; }

@media (prefers-reduced-motion: reduce) {
  .cab, .big-game-button, .memory-card, .go-play { transition: none; }
  .cab:hover { transform: none; }
  .full-punch-target.hit .full-punch-bag, .lb-pop, .lb-live i, .game-canvas.snake-dead { animation: none; }
}
