:root { color-scheme: dark; --bg: #05070d; --ink: #f4f6fb; --muted: #9aa3b8; --royal: #2456e0; --royal-l: #5c86ff; --silver: #c3cad8; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, 'Segoe UI', Arial, sans-serif; }
body { min-height: 100vh; overflow-x: hidden; }
.shell { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 12px 12px 28px; }
.stage { width: 100%; display: flex; justify-content: center; }
canvas#screen {
  display: block; background: #000; image-rendering: pixelated; image-rendering: crisp-edges;
  width: 320px; height: 224px; /* JS sets an integer (or best-fit) scale */
  outline: none; touch-action: none; box-shadow: 0 0 0 2px var(--royal), 0 0 0 3px var(--silver), 0 12px 40px rgba(0,0,0,.7);
}
.info { width: 100%; max-width: 960px; }
.links { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; margin: 4px 0 8px; font-size: 14px; }
.links a { color: var(--ink); border-bottom: 2px solid var(--royal); text-decoration: none; font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.links a:hover { text-decoration: underline; }
.soon { color: var(--muted); display: inline-flex; align-items: center; }
.help { max-width: 560px; margin: 0 auto; color: var(--muted); font-size: 14px; }
.help summary { cursor: pointer; color: var(--silver); text-align: center; color: var(--ink); min-height: 32px; }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0 0; }
.help dt { color: var(--ink); font-weight: 600; }
.help dd { margin: 0; }
.fine { text-align: center; color: #6c7590; font-size: 12px; margin-top: 14px; }

/* ---------------- Touch controls (phones/tablets) ---------------- */
.touch { display: none; }
.has-touch, .has-touch body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.has-touch body { position: fixed; inset: 0; }
.has-touch .shell { position: fixed; inset: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); gap: 0; justify-content: flex-start; }
.has-touch .info { display: none; }
.has-touch .stage { flex: none; padding-top: 4px; }
.has-touch .touch {
  display: flex; flex-direction: column; flex: 1; width: 100%; min-height: 0;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none;
}
.has-touch canvas#screen, .has-touch .touch * { -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; touch-action: none; }
.deck-bar { display: flex; justify-content: center; gap: 8px; padding: 8px 10px 4px; }
.pill { font: 800 11px/1 system-ui, sans-serif; letter-spacing: .06em; color: var(--ink); background: #0b0f1a; border: 1.5px solid #3a4258; border-radius: 999px; padding: 9px 12px; min-height: 34px; display: inline-flex; align-items: center; text-decoration: none; }
.pill-start { border-color: var(--silver); }
.pill.on { background: #1a2238; }
.deck { flex: 1; display: flex; justify-content: space-between; align-items: stretch; min-height: 0; padding: 0 6px 6px; }
/* left half: the stick appears where your thumb lands */
.stick-zone { position: relative; flex: 1 1 50%; min-height: 150px; }
.stick { position: absolute; left: 50%; top: 50%; width: 132px; height: 132px; margin: -66px 0 0 -66px; border-radius: 50%; background: radial-gradient(circle, #141a2c 0%, #07090f 70%); border: 2px solid var(--silver); opacity: .9; pointer-events: none; }
.stick.live { opacity: 1; border-color: #fff; }
.knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--royal-l), var(--royal)); border: 2px solid #fff; }
.stick-zone::after { content: 'MOVE'; position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); font: 800 10px/1 system-ui, sans-serif; letter-spacing: .12em; color: #5a6278; }
/* right half: three big action pads in an arc; thumb between two pads presses both */
.acts { position: relative; flex: 0 0 214px; min-height: 196px; align-self: center; height: 196px; }
.act { position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,.28); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0; font: 900 14px/1 system-ui, sans-serif; letter-spacing: .03em; box-shadow: 0 4px 0 rgba(0,0,0,.45); }
.act small { font: 800 8.5px/1.1 system-ui, sans-serif; opacity: .85; letter-spacing: .04em; }
.act-shoot { width: 100px; height: 100px; right: 4px; bottom: 6px; background: radial-gradient(circle at 35% 30%, var(--royal-l), var(--royal) 70%); font-size: 17px; }
.act-turbo { width: 78px; height: 78px; left: 61px; top: 31px; background: radial-gradient(circle at 35% 30%, #2a3250, #07090f 75%); border-color: var(--royal-l); }
.act-steal { width: 78px; height: 78px; left: 0; bottom: 18px; background: radial-gradient(circle at 35% 30%, #ffffff, var(--silver) 75%); color: #05070d; }
.act.idle { opacity: .45; }
.act.on { filter: brightness(1.35); transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.45); }
@media (max-width: 380px) and (orientation: portrait) {
  .acts { flex-basis: 194px; transform: scale(.9); transform-origin: right bottom; }
}
/* phones held sideways: court fills the height, pads sit on the sides */
@media (orientation: landscape) {
  .has-touch .shell { justify-content: center; }
  .has-touch .stage { padding-top: 0; height: 100%; align-items: center; }
  .has-touch .touch { position: fixed; inset: 0; pointer-events: none; }
  .has-touch .deck-bar { position: fixed; top: max(6px, env(safe-area-inset-top)); left: max(6px, env(safe-area-inset-left)); padding: 0; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: auto; }
  .has-touch .deck-bar .pill { opacity: .85; padding: 7px 10px; min-height: 30px; font-size: 10px; }
  .has-touch .deck { position: fixed; inset: 0; padding: 0 max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  .has-touch .stick-zone { pointer-events: auto; flex: 0 0 40%; margin-top: 140px; }
  .has-touch .stick { left: 76px; top: auto; bottom: 10px; margin: 0 0 0 -66px; opacity: .75; }
  .has-touch .stick-zone::after { display: none; }
  .has-touch .acts { pointer-events: auto; align-self: flex-end; flex: 0 0 116px; height: 276px; min-height: 0; opacity: .88; }
  .has-touch .act-steal { left: auto; right: 19px; top: 0; bottom: auto; }
  .has-touch .act-turbo { left: auto; right: 19px; top: 86px; }
  .has-touch .act-shoot { right: 8px; top: auto; bottom: 0; }
}
