/* PadParty game kit — shared look for every game. Single deliberate dark arcade look. */
@font-face { font-family: "Chakra Petch"; font-weight: 500; font-display: swap; src: url("fonts/chakra-petch-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Chakra Petch"; font-weight: 700; font-display: swap; src: url("fonts/chakra-petch-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 700; font-display: swap; src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); }

:root {
  --bg: #07070d; --panel: #0e0f1e; --ink: #e8eaf6; --muted: #a9add0; --line: #2a2d4f;
  --p1: #ff2bd6; --p2: #00f0ff; --yellow: #f5ff3b;
  --display: "Chakra Petch", system-ui, sans-serif; --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--display); overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  touch-action: manipulation; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
html { overscroll-behavior: none; }
.pk-wrap { --pad: 8px; height: 100%; display: flex; align-items: center; justify-content: center; padding: var(--pad); }
.pk-stage { --ar: 1.7778; position: relative; width: min(100%, calc((100vh - var(--pad) * 2) * var(--ar))); width: min(100%, calc((100dvh - var(--pad) * 2) * var(--ar)));
  max-width: 100%; aspect-ratio: var(--ar); background: var(--bg); }
/* phones and tablets: use every pixel, keep clear of the notch / home bar */
@media (pointer: coarse) {
  .pk-wrap { --pad: 0px; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
}
.pk-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.pk-panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(7, 7, 13, .8); padding: 16px; z-index: 5; }
.pk-card { width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 26px 30px; background: var(--panel); border: 2px solid var(--p2);
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px)); display: flex; flex-direction: column; gap: 13px; }
.pk-tag { font-family: var(--mono); font-size: 13px; color: var(--p2); letter-spacing: .5px; }
.pk-title { margin: 0; font-size: clamp(32px, 6vw, 62px); line-height: .95; font-weight: 700; letter-spacing: 2px; text-shadow: 3px 0 var(--p1), -3px 0 var(--p2); text-wrap: balance; }
.pk-h2 { margin: 0; font-size: clamp(28px, 4.5vw, 48px); font-weight: 700; letter-spacing: 2px; text-shadow: 3px 0 var(--p1), -3px 0 var(--p2); }
.pk-p { margin: 0; color: var(--muted); font-size: 16px; line-height: 1.45; }
.pk-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-family: var(--mono); font-size: 13px; }
.pk-pads div { border: 1px solid var(--line); padding: 9px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pk-pads b { font-size: 15px; }
.pk-pads span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-menu { display: flex; flex-direction: column; gap: 9px; }
.pk-btn { font-family: var(--mono); font-weight: 700; font-size: 15px; letter-spacing: 1px; text-align: left; min-height: 46px; padding: 0 18px; color: var(--ink);
  background: #141530; border: 1px solid var(--line); cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pk-btn:hover { border-color: var(--p2); color: var(--p2); }
.pk-btn:focus-visible, .pk-btn.pad-focus { outline: none; background: var(--yellow); color: #07070d; border-color: var(--yellow); }
.pk-btn small { font-weight: 400; opacity: .8; }
.pk-help { font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.6; }
.pk-help b { color: var(--ink); }
.pk-back { font-family: var(--mono); font-size: 13px; }
.pk-back a { color: var(--p2); }
.pk-hint { position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); font-family: var(--mono); font-size: 12px; color: var(--muted); pointer-events: none; white-space: nowrap; z-index: 2; }
/* on-screen buttons for touch screens */
.pk-touch { position: absolute; inset: auto 0 0 0; max-width: 100%; overflow: hidden; display: flex; justify-content: space-between; align-items: flex-end; padding: 10px; pointer-events: none; z-index: 3; }
.pk-cluster { display: flex; gap: 10px; pointer-events: auto; }
.pk-tb { width: clamp(52px, 8vw, 84px); height: clamp(52px, 8vw, 84px); border-radius: 50%; border: 2px solid currentColor; background: rgba(14, 15, 30, .55);
  color: var(--ink); font: 700 clamp(11px, 1.4vw, 15px) var(--mono); display: flex; align-items: center; justify-content: center; touch-action: none; }
.pk-tb.on { background: var(--c, currentColor); color: #07070d !important; }
@media (max-width: 520px) { .pk-card { padding: 18px; } .pk-pads { grid-template-columns: 1fr; } }

/* pause + fullscreen (touch screens): pinned to the screen corner, so on a sideways phone they sit in the black side bar, off the game */
.pk-sys { position: fixed; top: max(6px, env(safe-area-inset-top)); right: max(6px, env(safe-area-inset-right)); z-index: 6; display: flex; gap: 6px; }
@media (min-aspect-ratio: 16/9) { .pk-sys { flex-direction: column; } }
.pk-pausebtn, .pk-fsbtn, .pk-exitbtn { width: 42px; height: 42px; border: 1px solid var(--line); background: rgba(14, 15, 30, .75); color: var(--ink);
  font: 700 16px var(--mono); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.pk-fsbtn { font-size: 20px; }
/* turn-your-phone prompt */
.pk-rotate { position: fixed; z-index: 7; background: rgba(7, 7, 13, .94); }
.pk-rot-icon { font-size: 64px; line-height: 1; color: var(--p2); animation: pk-spin 2.4s ease-in-out infinite; align-self: center; }
@keyframes pk-spin { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(90deg); } }
@media (prefers-reduced-motion: reduce) { .pk-rot-icon { animation: none; } }

/* short screens (a phone on its side): compact menus so everything fits without scrolling */
@media (max-height: 520px) {
  .pk-panel { padding: 8px 56px; }
  .pk-card { width: min(640px, 100%); padding: 14px 18px; gap: 8px; }
  .pk-title { font-size: 34px; }
  .pk-h2 { font-size: 30px; }
  .pk-p { font-size: 14px; }
  .pk-pads, .pk-help { display: none; }
  .pk-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .pk-btn { min-height: 42px; font-size: 14px; padding: 0 12px; }
}
/* upright layout */
.pk-portrait .pk-touch { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
/* two players sharing an upright phone: one row of buttons each */
.pk-portrait .pk-touch.pk-touch-2p { flex-direction: column-reverse; align-items: center; gap: 8px; }
.pk-portrait .pk-touch-2p .pk-tb { width: 50px; height: 50px; }
/* two players on one screen: smaller buttons so both sets fit */
.pk-touch-2p { gap: 6px; }
.pk-touch-2p .pk-cluster { gap: 6px; }
.pk-touch-2p .pk-tb { width: clamp(40px, 5.6vw, 72px); height: clamp(40px, 5.6vw, 72px); font-size: clamp(9px, 1.2vw, 13px); }

/* phones: the keyboard / controller panel isn't useful on a touch screen (help still lists the touch controls) */
@media (pointer: coarse) { .pk-pads { display: none; } }
/* full-page play on an upright phone: keep menus clear of the pause / ✕ buttons in the corner */
@media (orientation: portrait) { .pk-fullpage .pk-panel { padding-top: 64px; } }

/* sideways game on an upright phone: the kit turns the whole game 90° (size + position set by kit.js) */
.pk-root { position: relative; width: 100%; height: 100%; }
.pk-root.pk-side { position: fixed; top: 0; transform-origin: 0 0; transform: rotate(90deg); }
.pk-side .pk-wrap { padding: 0; }
.pk-side .pk-stage { width: min(100%, calc(var(--rh) * var(--ar))); }
.pk-side .pk-sys { top: 6px; right: 6px; flex-direction: column; }
.pk-side .pk-panel { padding: 8px 56px; }
.pk-side .pk-card { width: min(640px, 100%); padding: 14px 18px; gap: 8px; }
.pk-side .pk-title { font-size: 34px; }
.pk-side .pk-h2 { font-size: 30px; }
.pk-side .pk-p { font-size: 14px; }
.pk-side .pk-pads, .pk-side .pk-help { display: none; }
.pk-side .pk-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pk-side .pk-btn { min-height: 42px; font-size: 14px; padding: 0 12px; }
.pk-side .pk-tb { width: 64px; height: 64px; font-size: 13px; }
.pk-side .pk-touch-2p .pk-tb { width: 50px; height: 50px; font-size: 11px; }
.pk-sidehint { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; background: rgba(7, 7, 13, .92); border: 2px solid var(--p2); font: 700 16px var(--mono); letter-spacing: 1px; color: var(--ink); white-space: nowrap; }
.pk-sidehint .pk-rot-icon { font-size: 34px; }
.pk-side .pk-pausebtn, .pk-side .pk-fsbtn, .pk-side .pk-exitbtn { width: 34px; height: 34px; font-size: 13px; opacity: .7; }

/* ---------- phones: menus cover the whole screen, not just the game box ---------- */
.pk-phone .pk-panel { position: fixed; inset: 0; z-index: 9; }
.pk-sys { z-index: 10; }
@media (max-height: 380px) { .pk-phone .pk-p { display: none; } .pk-phone .pk-title { font-size: 28px; } .pk-phone .pk-card { gap: 6px; } }

/* ---------- phones with button games: handheld-console layout ---------- */
.pk-padzone { display: none; }
.pk-console .pk-wrap { display: grid; padding: 0; gap: 0; }
.pk-console .pk-padzone { display: flex; align-items: center; justify-content: center; gap: 14px; touch-action: none; min-width: 0; min-height: 0; }
.pk-console:not(.pk-playing) .pk-padzone { opacity: .3; pointer-events: none; }
.pk-console .pk-stage { grid-area: s; }
.pk-console .pk-padL { grid-area: l; } .pk-console .pk-padR { grid-area: r; }
/* upright: game across the top, controller underneath */
.pk-con-up .pk-wrap { grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; grid-template-areas: "s s" "l r";
  padding: 56px 0 max(12px, env(safe-area-inset-bottom)); align-items: stretch; }
.pk-con-up .pk-stage { width: 100%; align-self: start; }
.pk-con-up.pk-con-noacts .pk-wrap { grid-template-areas: "s s" "l l"; }
.pk-con-up.pk-con-2p .pk-padzone { flex-direction: column; gap: 18px; }
/* sideways: game in the middle, d-pad on the left, buttons on the right */
.pk-con-side .pk-wrap { --padw: 168px; grid-template-columns: var(--padw) 1fr var(--padw); grid-template-rows: 100%; grid-template-areas: "l s r";
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left); align-items: center; }
.pk-con-side .pk-stage { justify-self: center; width: min(100%, calc(100vh * var(--ar))); width: min(100%, calc(100dvh * var(--ar))); }
.pk-con-side .pk-padzone { height: 100%; flex-direction: column; }
.pk-con-side .pk-padR { padding-top: 40px; } /* clear of the pause / exit buttons */
/* the d-pad */
.pk-dpad { position: relative; width: 156px; height: 156px; flex: none; touch-action: none; display: grid;
  grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr 1fr; grid-template-areas: ". u ." "l m r" ". d ."; }
.pk-dpad-h { height: 64px; grid-template-rows: 1fr; grid-template-areas: "l m r"; }
.pk-arm { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: 18px; color: inherit;
  background: rgba(20, 21, 48, .85); border: 2px solid currentColor; pointer-events: none; }
.pk-arm-u { grid-area: u; border-bottom: 0; border-radius: 10px 10px 0 0; }
.pk-arm-d { grid-area: d; border-top: 0; border-radius: 0 0 10px 10px; }
.pk-arm-l { grid-area: l; border-right: 0; border-radius: 10px 0 0 10px; }
.pk-arm-r { grid-area: r; border-left: 0; border-radius: 0 10px 10px 0; }
.pk-mid { grid-area: m; border: 0; background: rgba(20, 21, 48, .85); border-top: 2px solid transparent; border-bottom: 2px solid transparent; }
.pk-dpad:not(.pk-dpad-h) .pk-mid { border: 0; }
.pk-dpad-h .pk-mid { border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.pk-dpad:not(.pk-dpad-h) .pk-arm-l, .pk-dpad:not(.pk-dpad-h) .pk-arm-r { border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.pk-arm.on { background: var(--c); color: #07070d; border-color: var(--c); }
.pk-arm.on { text-shadow: none; }
/* action buttons: big A, smaller B tucked down-left (like a real pad) */
.pk-acts { display: flex; align-items: flex-end; gap: 14px; }
.pk-ab { border-radius: 50%; border: 3px solid currentColor; background: rgba(20, 21, 48, .85); font: 700 13px var(--mono); letter-spacing: .5px;
  display: flex; align-items: center; justify-content: center; touch-action: none; color: inherit; padding: 0; }
.pk-ab-a { width: 84px; height: 84px; margin-bottom: 34px; font-size: 14px; }
.pk-ab-b { width: 66px; height: 66px; }
.pk-ab.on { background: var(--c); color: #07070d !important; }
/* two players sharing one phone: smaller controls each */
.pk-con-2p .pk-dpad { width: 120px; height: 120px; } .pk-con-2p .pk-dpad-h { height: 52px; }
.pk-con-2p .pk-ab-a { width: 64px; height: 64px; margin-bottom: 20px; } .pk-con-2p .pk-ab-b { width: 52px; height: 52px; font-size: 11px; }
.pk-con-side.pk-con-2p .pk-wrap { --padw: 150px; }
.pk-con-side.pk-con-2p .pk-padzone { gap: 10px; }
@media (max-height: 360px) { .pk-con-side .pk-dpad { width: 132px; height: 132px; } .pk-con-side .pk-dpad-h { height: 56px; } .pk-con-side .pk-ab-a { width: 72px; height: 72px; margin-bottom: 26px; } .pk-con-side .pk-ab-b { width: 58px; height: 58px; } }
/* d-pad + buttons overlaid on the game: a little smaller and see-through */
.pk-touch { align-items: flex-end; }
.pk-touch .pk-cluster { align-items: flex-end; gap: 12px; }
.pk-touch .pk-dpad { width: 132px; height: 132px; opacity: .85; } .pk-touch .pk-dpad-h { height: 56px; }
.pk-touch .pk-ab-a { width: 72px; height: 72px; margin-bottom: 26px; } .pk-touch .pk-ab-b { width: 58px; height: 58px; }
.pk-touch .pk-ab { background: rgba(20, 21, 48, .6); }
.pk-touch.pk-touch-2p .pk-dpad { width: 100px; height: 100px; } .pk-touch.pk-touch-2p .pk-dpad-h { height: 46px; }
.pk-touch.pk-touch-2p .pk-ab-a { width: 54px; height: 54px; margin-bottom: 16px; } .pk-touch.pk-touch-2p .pk-ab-b { width: 46px; height: 46px; font-size: 10px; }
