/* Styles for the game kit (every game), the games hub and the first set of games. */

/* ---------- the game kit: stage, start / pause / finish card, speed buttons, on-screen buttons ---------- */
.gk { max-width: 100%; }
.gk-stage { margin: 0 auto; max-width: 100%; scroll-margin: 8px; }
.gk-stage canvas { display: block; width: 100%; height: auto; outline: none; }
.gk-stage canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
/* while a card is showing, the picture is only a backdrop and the stage grows to hold the card (a short phone screen still shows all of it) */
.gk-stage.menu { touch-action: auto; }
.gk-stage.menu canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gk-stage .gk-menu { position: relative; inset: auto; box-sizing: border-box; min-height: var(--gk-h, 240px); padding: 56px 12px 16px; background: rgba(5,10,36,.84); }
.gk-stage .gk-menu[hidden], .gk-flash[hidden] { display: none; }
.gk-hud { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 2; display: flex; align-items: center; gap: 6px; pointer-events: none; font-weight: 700; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,.6); }
.gk-hud > span:not(.gk-grow) { background: rgba(5,10,36,.68); border-radius: 999px; padding: 4px 10px; white-space: nowrap; font-size: calc(14px * var(--k)); font-variant-numeric: tabular-nums; }
.gk-grow { flex: 1; }
.gk-pause { pointer-events: auto; flex: none; width: calc(46px * var(--k)); height: calc(46px * var(--k)); min-width: 44px; min-height: 44px; border-radius: 50%; border: 2px solid rgba(255,255,255,.75); background: rgba(5,10,36,.72); color: #fff; font-size: calc(22px * var(--k)); font-weight: 800; line-height: 1; cursor: pointer; padding: 0; }
.gk-pause[disabled] { opacity: .45; cursor: default; }
.gk-ii { display: inline-block; box-sizing: border-box; width: .72em; height: .8em; border-left: .26em solid currentColor; border-right: .26em solid currentColor; vertical-align: -0.08em; }
.gk-pause:focus-visible, .gk-speed button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.gk-flash { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 2; width: max-content; max-width: 92%; background: rgba(5,10,36,.88); color: #fff; border-radius: 16px; padding: 8px 14px; font-weight: 700; font-size: calc(15.5px * var(--k)); text-align: center; pointer-events: none; }
.gk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.gk-card { display: grid; gap: 10px; justify-items: center; width: 100%; max-width: 520px; margin: 0 auto; text-align: center; }
.gk-emoji { font-size: calc(46px * var(--k)); line-height: 1; }
.gk-title { font-size: calc(24px * var(--k)); font-weight: 800; line-height: 1.15; }
.gk-sub { margin: 0; max-width: 460px; font-size: calc(16px * var(--k)); line-height: 1.35; }
.gk-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.gk-speed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: min(100%, 400px); }
.gk-speed button { min-height: 64px; border-radius: 18px; border: 3px solid rgba(255,255,255,.35); background: rgba(255,255,255,.14); color: inherit; font: inherit; font-weight: 800; font-size: calc(15px * var(--k)); display: grid; justify-items: center; align-content: center; gap: 0; padding: 4px; cursor: pointer; }
.gk-speed button .e { font-size: calc(26px * var(--k)); line-height: 1.15; }
.gk-speed button.on { background: var(--gold); color: var(--gold-ink, #2a1a00); border-color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 55%, transparent); }
.gk-start .gk-speed button, .gk-hubspeed .gk-speed button { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.gk-start .gk-speed button.on, .gk-hubspeed .gk-speed button.on { background: var(--gold); color: var(--gold-ink, #2a1a00); border-color: var(--gold); }
/* the same speed buttons on any other card (Code-a-Bot, Robot Challenge, the Build-a-Car garage): on a light card the ones that are not chosen need an outline that can be seen */
.kcard .gk-speed button, .cb-speed .gk-speed button { background: var(--panel2); border-color: var(--line2); color: var(--text); }
.kcard .gk-speed button.on, .cb-speed .gk-speed button.on { background: var(--gold); color: var(--gold-ink, #2a1a00); border-color: var(--gold); }
.gk-under { display: grid; gap: 10px; justify-items: center; margin-top: 12px; }
.gk-pad:empty { display: none; }
.gk-padrow { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.gk-padrow .kbtn.round { width: max(64px, calc(64px * var(--k))); min-height: max(64px, calc(64px * var(--k))); font-size: calc(26px * var(--k)); touch-action: none; -webkit-user-select: none; user-select: none; }
.gk-tools { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.gk-again { min-height: max(52px, calc(52px * var(--k))); }
.gk-bar { display: flex; align-items: center; gap: 10px; min-height: 48px; margin: -4px 0 8px; }
.gk-status { font-weight: 700; font-size: calc(16px * var(--k)); }
.gk-pausebtn { flex: none; }
.gk-start { padding-top: calc(20px * var(--k)); padding-bottom: calc(20px * var(--k)); }
.gk-start[hidden] { display: none; }
.gk-hubspeed { display: grid; gap: 8px; justify-items: start; margin: 12px 0; } .gk-hubspeed b { font-size: calc(16px * var(--k)); }
/* inside a game every chip and small button is finger-sized */
.gk .kchip { min-height: 44px; } .gk .kbtn.sm { min-height: 44px; }
.gk-msg { text-align: center; font-weight: 700; font-size: calc(17px * var(--k)); margin: 10px 0; min-height: 1.4em; }
body.calm .gk-speed button.on { box-shadow: none; }
/* on a phone the floating helper button sits on top of the game's right-hand buttons: it steps aside while a round is running (pause brings it back) */
@media (max-width: 699px) { body.gk-playing #helperFab { opacity: 0; pointer-events: none; } }
@media (max-width: 699px) { .gk-stage .gk-menu { padding-top: 60px; } .gk-pausebtn span { display: none; } }

/* ---------- the hub and the first games ---------- */
.gm-best { font-size: 12px; opacity: .95; }
.gm-pz { display: grid; gap: 3px; width: min(100%, 560px, max(260px, calc((calc(100 * var(--dvh)) - 250px) * 1.6))); margin: 0 auto; touch-action: manipulation; }
.gm-pz button { padding: 0; border: 4px solid transparent; border-radius: 10px; background: none; cursor: pointer; overflow: hidden; aspect-ratio: 8 / 5; }
.gm-pz button canvas { width: 100%; height: 100%; display: block; } .gm-pz button.sel { border-color: var(--gold); transform: scale(.96); }
.gm-pz.hint button.ok { border-color: #7dffb5; } .gm-pz.look button { cursor: default; }
.gm-word { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 14px 0; }
.gm-word span { width: calc(44px * var(--k)); height: calc(54px * var(--k)); border-bottom: 5px solid var(--line2); display: grid; place-items: center; font-size: calc(30px * var(--k)); font-weight: 800; text-transform: uppercase; }
.gm-pic { font-size: calc(64px * var(--k)); line-height: 1.1; text-align: center; }
.gm-keys { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; max-width: 620px; margin: 0 auto; }
.gm-keys button { height: calc(46px * var(--k)); min-height: 44px; border-radius: 12px; border: 2px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 800; font-size: calc(17px * var(--k)); cursor: pointer; padding: 0; text-transform: uppercase; }
.gm-keys.big { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 380px; }
.gm-keys.big button { height: max(64px, calc(60px * var(--k))); font-size: calc(26px * var(--k)); border-radius: 16px; }
.gm-keys.mid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; max-width: 480px; } .gm-keys.mid button { height: max(52px, calc(52px * var(--k))); font-size: calc(21px * var(--k)); }
.gm-keys button.hit { background: #1fb863; border-color: #7dffb5; color: #fff; } .gm-keys button.miss { opacity: .3; }
.gm-keys button.tip { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 60%, transparent); }
.gm-fuel { height: 22px; }
@media (max-width: 699px) { .gm-keys { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
/* the games hub on a phone: the speed choice is one slim row and the kinds of game one row that slides sideways, so the first games can be seen without scrolling */
@media (max-width: 699px) {
  body[data-page="games"] .kcard.gk-hubspeed { grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px 10px; margin: 8px 0; padding: 10px 12px; }
  body[data-page="games"] .kcard.gk-hubspeed > b { font-size: 15px; line-height: 1.15; max-width: 84px; }
  body[data-page="games"] .kcard.gk-hubspeed > .small { display: none; }
  body[data-page="games"] .kcard.gk-hubspeed .gk-speed { width: 100%; gap: 6px; }
  body[data-page="games"] .kcard.gk-hubspeed .gk-speed button { min-height: 48px; grid-auto-flow: column; justify-content: center; align-items: center; gap: 4px; font-size: 13.5px; border-width: 2px; border-radius: 16px; }
  body[data-page="games"] .kcard.gk-hubspeed .gk-speed button .e { font-size: 18px; }
  body[data-page="games"] [data-skills] { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 8px -12px !important; padding: 2px 12px 6px; }
  body[data-page="games"] [data-skills]::-webkit-scrollbar { display: none; }
  body[data-page="games"] [data-skills] .kchip { flex: none; }
  body[data-page="games"] .buddy-row { margin-bottom: 0; }
}
