/* Pixel Tanks site: static, no cookies, no external requests (fonts and scripts would send visitors' IPs away).
   The look of the game: its 5x7 font (fonts/pixel.woff2), riveted steel frames (img/frame.png:
   an 18x18 picture cut by border-image into 6-pixel slices, drawn twice as large; buttons in CSS), the dark outline (34,28,46). */
@font-face {
  font-family: "Pixel Tanks";
  src: url(/fonts/pixel.woff2) format("woff2");
  font-display: swap;
}
:root {
  --bg: #16141f;
  --panel: #221f30;
  --line: #34304a;
  --text: #ece9f4;
  --muted: #a7a2ba;
  --accent: #f4d25c;
  --link: #8fd0ff;
  --ink: #221c2e;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --px: "Pixel Tanks", ui-monospace, monospace;
  --sheet: rgba(22, 20, 31, .94);  /* the page over the metal plates */
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --sheet: rgba(246, 244, 238, .96);
    --bg: #f6f4ee;
    --panel: #ffffff;
    --line: #dcd7c8;
    --text: #1d1b26;
    --muted: #5e5a6c;
    --accent: #9a6a00;
    --link: #1f5f9e;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* Around everything: the riveted steel plates the game puts around its field (assets/atlas/backdrop.png of the game,
   480 px, shown at twice its pixels). The same in both themes, like the game; the page itself lies on a sheet. */
body {
  margin: 0;
  background: #5c606c url(/img/backdrop.png) repeat;
  background-size: 960px 960px;
  image-rendering: pixelated;
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--link); }
img.pixel { image-rendering: pixelated; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* The game's font: a pixel is a tenth of the size, so 20 px, 30 px, 40 px give whole pixels. Capitals only, like the
   game; a letter the font lacks falls back to the system's monospace. */
.px {
  font-family: var(--px);
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0;
  line-height: 1.3;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

/* --- frames and buttons --- */
.screen {
  display: block;
  border: 12px solid transparent;
  border-image: url(/img/frame.png) 6 / 12px;
  background: #16141f;
  image-rendering: pixelated;
}
.screen img { display: block; width: 100%; height: auto; }

/* Buttons in CSS, not pictures: a picture cut by border-image shows seams on screens with a fractional scale.
   The dark outline with cut corners, a lit top left edge, a dark lip at the bottom (pressed by moving down). */
.btn {
  --face: #54586a; --lit: #888ca0; --shade: #2a2a38; --ring: var(--ink);
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0;
  padding: 10px 18px 14px;
  background: var(--face);
  box-shadow: inset 0 0 0 2px var(--ring), inset 4px 4px 0 var(--lit), inset -4px -6px 0 var(--shade);
  clip-path: polygon(2px 0, calc(100% - 2px) 0, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 0 calc(100% - 2px), 0 2px);
  color: #ece9f4;
  font-size: 20px;
  text-decoration: none;
  cursor: pointer;
  text-shadow: 2px 2px 0 var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.btn.yellow { --face: #f4d25c; --lit: #fff0aa; --shade: #aa7a1a; color: var(--ink); text-shadow: none; }
a.btn:hover, button.btn:hover { filter: brightness(1.08); }
a.btn:active, button.btn:active { transform: translateY(2px); filter: brightness(.95); }
.btn:focus-visible { outline: none; --ring: #ffffff; }
.btn.arrow { width: 48px; height: 48px; padding: 0; }
.btn.arrow::before {  /* a pixel triangle */
  content: ""; width: 0; height: 0; border-top: 8px solid transparent; border-bottom: 8px solid transparent;
  border-left: 10px solid #ece9f4; filter: drop-shadow(2px 2px 0 var(--ink));
}
.btn.arrow.prev::before { transform: scaleX(-1); }

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 30px; margin: 0 0 12px; }
h2 { font-size: 20px; margin: 32px 0 8px; }
h3 { font-size: 16px; margin: 20px 0 4px; }
h1.px, h2.px { color: var(--accent); text-shadow: 2px 2px 0 var(--ink); }
h1.px { font-size: 40px; }
h2.px { font-size: 30px; margin: 44px 0 14px; }
p, ul, ol { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) h1.px, :root:not([data-theme="dark"]) h2.px { text-shadow: 2px 2px 0 #e2d9b8; }
}

/* --- the bars at the top and the bottom: dark in both themes, like the hero --- */
header.top {
  position: sticky; top: 0; z-index: 10;
  background: rgba(22, 20, 31, .94); border-bottom: 2px solid var(--ink);
  box-shadow: 0 2px 0 rgba(255, 255, 255, .06);
}
header.top .wrap { display: flex; align-items: center; gap: 20px; height: 60px; }
header.top a.brand { display: flex; align-items: center; gap: 10px; color: #ece9f4; text-decoration: none; font-size: 20px; text-shadow: 2px 2px 0 var(--ink); }
header.top a.brand img { width: 32px; height: 32px; }
header.top .links { display: flex; gap: 18px; margin-left: auto; }
header.top .links a { color: #d6d2e4; text-decoration: none; font-size: 20px; text-shadow: 2px 2px 0 var(--ink); }
header.top .links a:hover { color: var(--accent); }
.langs { position: relative; }
.langs summary {
  list-style: none; cursor: pointer; color: #ece9f4; font-size: 20px; padding: 6px 10px;
  border: 2px solid #4a4566; background: #221f30; text-shadow: 2px 2px 0 var(--ink);
}
.langs summary::-webkit-details-marker { display: none; }
.langs summary::after { content: " \25BE"; font-family: system-ui, sans-serif; font-size: 12px; }
.langs .menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px; padding: 6px;
  background: #221f30; border: 2px solid var(--ink); box-shadow: 0 4px 0 rgba(0, 0, 0, .4);
  display: flex; flex-direction: column;
}
.langs .menu a { color: #ece9f4; text-decoration: none; padding: 6px 10px; }
.langs .menu a:hover, .langs .menu a[aria-current] { background: #34304a; color: #f4d25c; }
@media (max-width: 640px) {
  header.top .links { display: none; }
  header.top .langs { margin-left: auto; }
}

main.wrap {
  background: var(--sheet);
  border: 12px solid transparent;
  border-image: url(/img/frame.png) 6 / 12px;
  background-clip: padding-box;
  width: calc(100% - 32px);
  margin: 28px auto 36px;
  padding: 16px 24px 36px;
}
main.wrap > :first-child, main.wrap > section:first-child > h2:first-child { margin-top: 12px; }
@media (max-width: 600px) {
  main.wrap { width: calc(100% - 16px); margin: 16px auto 24px; padding: 8px 12px 24px; }
}

/* --- the top of the main page: a battle (hero.js) under the game's dimming; one can drive a tank in it --- */
.hero { position: relative; overflow: hidden; background: #16141f; color: #ece9f4; text-align: center; padding: 44px 0 40px; border-bottom: 2px solid var(--ink); min-height: 560px; }
.hero #battle { position: absolute; left: 0; top: 0; width: 100%; height: 100%; image-rendering: pixelated; opacity: 0; transition: opacity .4s; }
.hero #battle.on { opacity: 1; }
.hero .intro { position: relative; transition: opacity .3s; text-shadow: 0 1px 2px #000, 0 0 12px rgba(0, 0, 0, .8); }
.hero .logo { width: 368px; max-width: 100%; height: auto; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .45)); }
.hero h1 { margin-top: 20px; font-size: 30px; color: #ece9f4; text-shadow: 3px 3px 0 var(--ink); }
.hero .lead { font-size: 18px; color: #d6d2e4; max-width: 640px; margin: 0 auto; }
.hero .play { margin: 4px 0 18px; font-size: 20px; }
.hero .play::before {
  content: ""; display: inline-block; margin-right: 10px; vertical-align: -2px;
  border-top: 8px solid transparent; border-bottom: 8px solid transparent; border-left: 10px solid var(--ink);
}
.hero .play { flex-direction: row; }
.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 20px; }
.facts li { font-size: 20px; color: #f4d25c; text-shadow: 2px 2px 0 var(--ink); }
.facts li + li::before { content: ""; display: inline-block; width: 6px; height: 6px; background: #8a86a0; margin: 0 14px 4px 0; vertical-align: middle; box-shadow: 2px 2px 0 var(--ink); }
.facts li.pad::after, .features li.pad b::after {  /* the white gamepad of the store screenshots */
  content: ""; display: inline-block; width: 60px; height: 36px; margin-left: 10px; vertical-align: middle;
  background: url(/img/gamepad.png) no-repeat; background-size: 60px 36px; image-rendering: pixelated;
}
.hero.playing { cursor: crosshair; }
.hero.playing .intro { opacity: 0; pointer-events: none; }
.hero.playing .game canvas { touch-action: none; }
.hero .hud[hidden], .hero .toast[hidden] { display: none; }
.hero .hud {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  justify-content: space-between; padding: 12px 16px; background: rgba(22, 20, 31, .8); border-top: 2px solid var(--ink);
}
.hero .hud .score { font-size: 30px; color: #f4d25c; text-shadow: 2px 2px 0 var(--ink); }
.hero .hud .hint { font-size: 20px; color: #b9b4cc; }
.hero .hud .hint.touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hero .hud .hint.keys { display: none; }
  .hero .hud .hint.touch { display: inline; }
}
.hero .toast {
  position: absolute; left: 0; right: 0; top: 40%; margin: 0; font-size: 40px; color: #f4d25c;
  text-shadow: 4px 4px 0 var(--ink); pointer-events: none; animation: toast 1.4s steps(8) forwards;
}
@keyframes toast { 0% { transform: scale(.5); opacity: 0; } 15% { transform: scale(1.1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-20px); } }
/* the mini stage (stage.js) over the top: the game's canvas, touch buttons under it on touch screens, the result */
.hero .game {
  position: absolute; left: 0; right: 0; top: 0; bottom: 58px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; background: rgba(14, 12, 22, .55);
}
.hero .game[hidden], .hero .over[hidden] { display: none; }
.hero .game canvas {
  display: block; image-rendering: pixelated;
  box-shadow: 0 0 0 4px var(--ink), 0 0 0 7px #5c606c, 0 0 0 9px var(--ink), 0 10px 0 9px rgba(0, 0, 0, .35);
}
.hero .pad { display: none; width: 100%; max-width: 520px; justify-content: space-between; align-items: center; padding: 0 20px; touch-action: none; user-select: none; -webkit-user-select: none; }
@media (pointer: coarse) { .hero .pad { display: flex; } }
/* a phone on its side: the buttons on both sides of the field, over the free space */
@media (pointer: coarse) and (orientation: landscape) {
  .hero .pad { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); max-width: none; padding: 0 12px; pointer-events: none; }
  .hero .pad > * { pointer-events: auto; }
}
.hero .dpad { width: 136px; height: 136px; background: url(/game/dpad.png) center / 100% no-repeat; image-rendering: pixelated; touch-action: none; }
.hero .fire { width: 104px; height: 104px; border: 0; padding: 0; background: url(/game/fire.png) center / 100% no-repeat; image-rendering: pixelated; touch-action: none; -webkit-tap-highlight-color: transparent; }
.hero .fire:active { transform: scale(.94); }
.hero .over {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 16px; text-align: center; background: rgba(14, 12, 22, .88);
}
.hero .over .title { font-size: 40px; color: #f4d25c; text-shadow: 4px 4px 0 var(--ink); margin: 0; }
.hero .over .result { font-size: 20px; color: #ece9f4; text-shadow: 2px 2px 0 var(--ink); margin: 0; }
.hero .over .cta-text { max-width: 540px; color: #d6d2e4; margin: 8px 0 12px; }
.hero .over .row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero .hud .score small { font-size: 20px; color: #b9b4cc; margin-left: 16px; }
.hero .hud .score small b { color: #ece9f4; }

/* playing: the top is the screen's height under the bar, whatever its content (hero.js re-lays the field on resize) */
.hero.playing { height: calc(100vh - 62px); height: calc(100svh - 62px); min-height: 320px; }


.stores { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin: 22px 0 14px; }
.store { min-width: 200px; padding: 12px 18px 16px; cursor: default; }
.store b { font-size: 20px; }
.store small { font-size: 10px; color: #f4d25c; }
.stores.center { margin-top: 18px; }

/* --- the scenes: a row that scrolls sideways --- */
.carousel { position: relative; display: flex; align-items: center; gap: 8px; }
.carousel .track {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(100%, 420px); gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; padding: 4px 2px 12px; flex: 1;
}
.carousel .track:focus-visible { outline: 2px solid var(--accent); }
.scene { margin: 0; scroll-snap-align: start; }
.scene figcaption { padding: 8px 4px 0; display: flex; flex-direction: column; gap: 2px; }
.scene figcaption b { font-size: 20px; color: var(--accent); }
.scene figcaption span { font-size: 10px; color: var(--muted); }
@media (max-width: 600px) { .carousel .arrow { display: none; } .carousel .track { grid-auto-columns: 86%; } }

/* --- the modes: framed screens playing their clips --- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 12px 0 16px; }
.card { margin: 0; }
.card figcaption { padding: 10px 4px 0; font-size: 15px; }
.card b { display: block; color: var(--accent); font-size: 20px; margin-bottom: 4px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; padding: 0; list-style: none; margin: 28px 0; }
.features li { background: var(--panel); border: 2px solid var(--line); box-shadow: 4px 4px 0 rgba(0, 0, 0, .25); padding: 12px 14px; margin: 0; }
.features b { display: block; color: var(--accent); font-size: 20px; margin-bottom: 4px; }
.features li.pad b::after { width: 40px; height: 24px; background-size: 40px 24px; margin-left: 8px; vertical-align: -4px; }

/* --- the worlds: a grid of small screens, a click shows one large --- */
.worlds { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 12px; margin: 16px 0; }
.world {
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 0; border: 0; background: none;
  color: var(--text); cursor: zoom-in; text-align: center;
}
.world img {
  width: 100%; height: auto; display: block; image-rendering: auto;
  border: 2px solid var(--ink); box-shadow: 0 0 0 2px #5c606c, 4px 4px 0 2px rgba(0, 0, 0, .3);
  transition: transform .12s steps(2);
}
.world:hover img, .world:focus-visible img { transform: translateY(-3px); box-shadow: 0 0 0 2px var(--accent), 4px 6px 0 2px rgba(0, 0, 0, .3); }
.world:focus-visible { outline: none; }
.world span { font-size: 10px; color: var(--muted); }
.world:hover span { color: var(--accent); }

#viewer {
  border: 0; padding: 0; background: none; color: #ece9f4; max-width: min(92vw, 856px); width: 100%;
  text-align: center;
}
#viewer::backdrop { background: rgba(10, 8, 16, .85); }
#viewer .screen { max-width: min(856px, 80vh); margin: 0 auto; }
#viewer .name { font-size: 30px; color: #f4d25c; margin: 12px 0; text-shadow: 3px 3px 0 var(--ink); }
#viewer .row { display: flex; justify-content: center; gap: 12px; }

.cta { text-align: center; padding: 8px 0 0; }
.cta h2.px { margin-top: 48px; }

/* --- the press kit --- */
.kit { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin: 12px 0 20px; align-items: start; }
.kit .logo-box { background: #5c606c url(/img/backdrop.png); background-size: 960px; padding: 24px; }
.press table th { width: 30%; }

/* --- legal pages --- */
.legal .note { background: var(--panel); border: 2px solid var(--line); border-left: 6px solid var(--accent); padding: 10px 14px; font-size: 15px; }
.legal h2 { border-top: 1px solid var(--line); padding-top: 20px; }
table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: 15px; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border: 1px solid var(--line); }
th { background: var(--panel); }
.table-scroll { overflow-x: auto; }
code { font-family: var(--mono); font-size: 14px; }

footer { background: rgba(22, 20, 31, .94); border-top: 2px solid var(--ink); padding: 20px 0 32px; font-size: 14px; color: #b9b4cc; }
footer a { color: #8fd0ff; }
footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
footer .langlist { display: flex; gap: 12px; flex-wrap: wrap; }
footer p { margin: 0 0 6px; }

/* phones: a shorter top, two modes and three worlds in a row, thinner frames */
@media (max-width: 600px) {
  .hero { min-height: 0; padding: 20px 0 24px; }
  .hero .logo { width: 240px; }
  .hero h1 { font-size: 20px; margin-top: 12px; }
  .hero .lead { font-size: 16px; line-height: 1.5; }
  .stores { gap: 10px; margin: 16px 0 12px; }
  .store { min-width: 0; flex: 1 1 0; max-width: 190px; padding: 10px 8px 14px; }
  .hero .play { margin-bottom: 14px; }
  .facts { gap: 2px 16px; }
  .facts li + li::before { display: none; }
  .facts li.pad::after { width: 40px; height: 24px; background-size: 40px 24px; }
  .hero .hud { gap: 8px 12px; padding: 8px 10px; }
  .hero .hud .score { font-size: 20px; }
  .hero .hud .hint { font-size: 10px; flex: 1; text-align: center; }

  h2.px { font-size: 20px; margin: 32px 0 10px; }
  .screen { border-width: 6px; border-image-width: 6px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 14px 10px; }
  .card figcaption { font-size: 13px; line-height: 1.45; padding-top: 6px; }
  .card b { font-size: 10px; line-height: 1.4; }
  .features { grid-template-columns: 1fr; gap: 8px; margin: 20px 0; }
  .features li { padding: 10px 12px; font-size: 15px; }
  .worlds { grid-template-columns: repeat(3, 1fr); gap: 10px 8px; }
  #viewer .name { font-size: 20px; }
  .scene figcaption b { font-size: 10px; }
  .hero .over .title { font-size: 30px; }
  .hero .over .cta-text { font-size: 15px; }
  .hero .hud .score small { font-size: 10px; margin-left: 8px; }
  .hero .dpad { width: 120px; height: 120px; }
  .hero .fire { width: 92px; height: 92px; }
}
