:root {
  --paper: #fdf6e3;
  --ink: #1f1b24;
  --panel: #ffffff;
  --line: #1f1b24;
  --blue: #ef7650;  /* the game's accent colour (buttons); new_game.py --accent */
  --title: #f6f1e4;  /* big title fill; new_game.py --title-color */
  --green: #2f9e44;
  --red: #e2574c;
  --gold: #f5b622;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: 18px;
}
/* page = header, game, status; the game takes all the room that is left (16:9) */
.wrap { height: 100vh; display: flex; flex-direction: column; padding: 8px 12px; }
.top { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 24px; margin: 0 0 8px; }
.stage-box { flex: 1 1 auto; min-height: 0; container-type: size; display: flex; justify-content: center; }
h1 { font-family: "Fredoka", "Nunito", system-ui, sans-serif; font-size: 34px; margin: 0; color: var(--title); -webkit-text-stroke: 1.5px var(--ink); }
/* Ata7 Games label: logo + name in the header (a "◀ all games" link inside the catalogue),
   "presents" on the title card, "a game by" at the end */
.brand { display: flex; align-items: center; gap: 8px; margin-right: -10px; font-family: "Fredoka", system-ui, sans-serif; font-weight: 700; font-size: 18px; color: #1d5fae; text-decoration: none; }
.brand img { width: 40px; height: auto; display: block; }
.brand[href] { padding: 2px 12px 2px 8px; border: 3px solid var(--ink); border-radius: 999px; background: #fff; }
.brand[href]:hover { background: #e9f5ff; }
.brand .back { font-size: 14px; }
.brand.solo .back { display: none; }
.presents { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0 0 2px; font-family: "Fredoka", system-ui, sans-serif; font-weight: 700; font-size: 17px; color: #1d5fae; }
.presents img { width: 34px; height: auto; }
.presents.madeby { margin: 12px 0 0; font-size: 15px; opacity: 0.85; }
.presents.madeby img { width: 28px; }
.sub { margin: 0; font-size: 17px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.sub .gap { width: 12px; }
.keys { display: inline-flex; gap: 4px; }
kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  border-radius: 8px;
  border: 3px solid var(--line);
  border-bottom-width: 6px;
  background: #fff;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 20px;
}
kbd.wide { padding: 0 12px; font-size: 17px; }
kbd.act { background: #ffd23f; }
.stage { position: relative; width: min(100cqw, 100cqh * 16 / 9); align-self: flex-start; }
.stage:fullscreen {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1f1b24;
}
.stage:fullscreen canvas { width: min(100vw, calc(100vh * 16 / 9)); border: 0; border-radius: 0; }
.stage:fullscreen .overlay { border-radius: 0; }
canvas {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  display: block;
  border-radius: 14px;
  border: 4px solid var(--line);
  background: #fdf6e3;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(31, 27, 36, 0.35);
  border-radius: 14px;
}
.overlay.hidden { display: none; }
.card {
  background: var(--panel);
  border: 4px solid var(--line);
  border-radius: 24px;
  padding: 20px 28px;
  max-width: 900px;
  margin: 0 16px;
  text-align: center;
}
.card h2 { font-family: "Fredoka", system-ui, sans-serif; font-size: 50px; margin: 0 0 6px; color: var(--title); -webkit-text-stroke: 2px var(--ink); }
.card p { margin: 0 0 14px; font-size: 21px; }
.card p.small { margin: 16px 0 8px; font-size: 17px; font-weight: 700; opacity: 0.7; }
.card em { font-style: normal; opacity: 0.6; }
/* the child's pause (index.html #pauseStage, #pausedOv): a round ⏸ under the mini-map, the picture dimmed behind ▶ */
.pausebtn { position: absolute; top: 27%; right: 3.2%; width: clamp(38px, 5.4cqw, 56px); height: clamp(38px, 5.4cqw, 56px);
  border-radius: 50%; border: 3px solid var(--ink); background: #fff8ea; color: var(--ink); font-size: clamp(16px, 2.4cqw, 24px);
  line-height: 1; padding: 0; cursor: pointer; opacity: 0.88; z-index: 3; }
.pausebtn[hidden] { display: none; }
.overlay.paused { background: rgba(13, 11, 24, 0.5); z-index: 4; }
/* the version, small in the title screen's bottom-right corner (white with a soft shadow, readable on any picture):
   which build this is (raise it for each publish) */
.build-stamp { position: absolute; right: 10px; bottom: 5px; font: 600 10px/1.2 Nunito, sans-serif; color: #fff; opacity: 0.8; text-shadow: 0 1px 2px #0009, 0 0 6px #0006; white-space: nowrap; pointer-events: none; z-index: 2; }
.card .stats { font-size: 30px; font-weight: 700; }
.card .row { display: flex; gap: 12px; justify-content: center; }
.legend { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: flex-end; margin: 6px 0 18px; }
.legend div { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 18px; font-weight: 700; line-height: 1.15; }
/* the rocket flies nose-up: turning it makes it taller than its box, so the margins keep it off the words */
.legend img.tilt { transform: rotate(-65deg); margin: 52px 0 46px; } /* the face reads upright when the nose points up */
.chapters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.pick { margin-top: 6px; font-size: 16px; font-weight: 700; opacity: 0.75; }
.pick[open] { opacity: 1; }
.pick summary { cursor: pointer; list-style: none; }
.pick summary::before { content: "▸ "; }
.pick[open] summary::before { content: "▾ "; }
.btn {
  font-family: "Fredoka", system-ui, sans-serif;
  font-size: 19px;
  font-weight: 700;
  border: 3px solid var(--line);
  border-radius: 999px;
  padding: 10px 24px;
  cursor: pointer;
  color: #fff;
}
.btn.green { background: var(--green); }
.btn.night { background: #5b4fb3; } /* 🚀 free flight */
.btn.big { font-size: 28px; padding: 14px 46px; }
.btn.mini { font-size: 16px; padding: 6px 14px; background: var(--blue); }
.btn.chap { font-size: 17px; padding: 8px 16px; background: #fff; color: var(--ink); }
.btn.chap .ic { margin-right: 6px; }
.btn:focus-visible { outline: 4px solid #ffb703; outline-offset: 2px; }
.status { flex: none; font-size: 17px; font-weight: 700; margin: 6px 0 0; min-height: 1.4em; }
/* touch screens: ◀ ▼ ▶ bottom-left (turn, the red ▼ brake, turn), big ⇧ fly button bottom-right and the yellow 📯
   horn button next to it (it glows when there is something to open); hidden on book pages and menus */
.touch {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@media (pointer: coarse) { .touch { display: block; } }
body.touch-mode .touch { display: block; }
.touch.off { display: none !important; }
/* left-handed (Topach's Settings tab; assets/ata7.js sets html.ata7-left): the buttons mirrored, the arrows on the right
   and the action buttons on the left; the pad and each button flip back, so ◀ stays left of ▶ and every sign reads right */
html.ata7-left .touch, html.ata7-left .touch .dpad, html.ata7-left .touch > .tbtn { scale: -1 1; }
.tbtn {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  border: 4px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 700;
  font-size: 26px;
  line-height: 1;
}
.tbtn.pressed { transform: scale(0.9); filter: brightness(0.92); }
.tbtn[hidden] { display: none; }
.dpad { position: absolute; left: max(10px, env(safe-area-inset-left)); bottom: 14px; width: 216px; height: 70px; }
.tbtn.arrow { width: 66px; height: 66px; border-radius: 16px; font-size: 26px; }
.tbtn.a-left { left: 0; top: 0; }
.tbtn.a-right { right: 0; top: 0; }
.tbtn.a-brake { left: 75px; top: 0; background: rgba(224, 82, 62, 0.85); color: #fff; font-size: 24px; }
.tbtn.jump { right: max(14px, env(safe-area-inset-right)); bottom: 18px; width: 84px; height: 84px; background: rgba(47, 158, 68, 0.85); color: #fff; font-size: 42px; }
.tbtn.act { right: calc(max(14px, env(safe-area-inset-right)) + 98px); bottom: 26px; width: 72px; height: 72px; background: rgba(255, 210, 63, 0.6); font-size: 34px; flex-direction: column; gap: 1px; }
.tbtn.act.ready { background: #ffd23f; animation: actpulse 0.8s ease-in-out infinite alternate; }
@keyframes actpulse { from { transform: scale(1); } to { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .tbtn.act.ready { animation: none; } }
.tbtn small { font-size: 13px; line-height: 1; }
/* the phone is held upright: "⛶ Tam ekran" (script in index.html) turns the game sideways. Android: real full
   screen + the screen locked sideways. iPhone (web pages can't go full screen or rotate the screen there):
   body.turned draws the page turned 90°, upright when the phone is held sideways, even with rotation lock on. */
.rotate { display: none; }
@media (orientation: portrait) and (pointer: coarse) and (max-width: 600px) {
  .rotate {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 10;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: var(--blue);
    color: #fff;
    font-family: "Fredoka", system-ui, sans-serif;
    font-size: 28px;
    text-align: center;
  }
  .rotate p { margin: 0; }
  .rotate .rot-icon { font-size: 80px; }
  body.turned .rotate, body.turned #fullBtn { display: none; } /* drawn turned = full screen isn't possible here */
  body.turned .wrap {
    position: fixed; top: 0; left: 100vw;
    width: 100vh; width: 100dvh; height: 100vw;
    transform: rotate(90deg); transform-origin: top left;
  }
}
/* phones and tablets have no keyboard: hide the key help, no double-tap zoom */
@media (pointer: coarse) {
  .keyhelp, .status { display: none; }
  body { touch-action: manipulation; }
}
/* short screens (a phone held sideways): small header, compact cards */
@media (max-height: 520px), (orientation: portrait) and (pointer: coarse) and (max-width: 600px) {
  .wrap { padding: 4px max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left)); }
  .top { margin: 0 0 4px; gap: 4px 12px; }
  h1 { font-size: 20px; -webkit-text-stroke-width: 1px; }
  .brand { font-size: 14px; gap: 5px; margin-right: -4px; }
  .brand img { width: 26px; }
  .presents { font-size: 13px; gap: 5px; }
  .presents img { width: 22px; }
  .presents.madeby { margin-top: 6px; }
  .btn.mini { font-size: 13px; padding: 4px 10px; }
  .status { display: none; }
  .card { padding: 8px 16px; border-radius: 18px; }
  .card h2 { font-size: 26px; margin: 0 0 4px; }
  .card p { font-size: 15px; margin: 0 0 6px; }
  .card p.small { margin: 6px 0 4px; font-size: 13px; }
  .card .stats { font-size: 20px; }
  .legend { gap: 8px; margin: 2px 0 8px; }
  .legend div { font-size: 12px; gap: 2px; }
  .legend img { height: 40px; width: auto; }
  .legend img.tilt { margin: 16px 0 14px; }
  .btn.big { font-size: 20px; padding: 8px 28px; }
  .btn.chap { font-size: 13px; padding: 5px 10px; }
  .chapters { gap: 5px; margin-top: 4px; }
  canvas { border-width: 3px; border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Waiting on the start buttons (the parent, 13 Nov 2026: children can't read, and a button that looks ready but does
   nothing made them keep tapping): until boot() has the pictures, both start buttons show a light running across them
   and a turning ring, drawn by CSS alone so they show before any script arrives; a tap meanwhile makes the button
   bounce (the inline script under the buttons). Pseudo-elements, not a child: the kit swaps a button's whole content
   for its data-en / data-fr text. */
.btn.loading { position: relative; overflow: hidden; cursor: progress; }
.btn.loading::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .45) 50%, transparent 62%) no-repeat; background-size: 250% 100%; animation: startSweep 1.5s linear infinite; }
.btn.loading::after { content: ""; display: inline-block; vertical-align: -0.1em; width: .75em; height: .75em; margin-left: .45em; border: .13em solid currentColor; border-right-color: transparent; border-radius: 50%; animation: startSpin .8s linear infinite; }
.btn.loading.nudge { animation: startNudge .35s ease-out; }
@keyframes startSweep { from { background-position: 130% 0; } to { background-position: -30% 0; } }
@keyframes startSpin { to { transform: rotate(1turn); } }
@keyframes startNudge { 30% { transform: scale(.94); } 65% { transform: scale(1.04); } 100% { transform: none; } }
