/* Build Battle: a mini PeeWeeTanks. Its look is the game's own: ink outlines, paper cards,
   chunky drop shadows and Fredoka (SIL Open Font License, see fredoka-OFL.txt). */
@font-face { font-family: Fredoka; src: url(fredoka.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
:root {
  --ink: #21173a; --ink-2: #3a2d5c; --paper: #fff7e6; --paper-2: #fbeccc; --yellow: #ffd23f; --red: #e5383b;
  --bg: #17112a; --text: #fff7e6; --muted: #cbbfe6; --muted-ink: #5b4f78; --line: rgba(255, 247, 230, .16);
  --sans: Fredoka, ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 18px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font: 400 16px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
a { color: var(--yellow); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 3px solid var(--ink); background: var(--yellow); color: var(--ink);
  box-shadow: 0 4px 0 var(--ink); font: 600 16px/1 var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn.ghost { background: var(--paper); }
.bar .btn.ghost { background: rgba(255, 247, 230, .08); color: var(--text); border-color: rgba(255, 247, 230, .35); box-shadow: none; }
.bar .btn.ghost:hover { background: rgba(255, 247, 230, .16); }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 2px solid rgba(255, 247, 230, .35);
  background: rgba(255, 247, 230, .08); color: var(--text); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: rgba(255, 247, 230, .16); }
.icon-btn svg { width: 22px; height: 22px; }
#soundBtn .cross { display: none; }
#soundBtn[aria-pressed="false"] .cross { display: inline; }
#soundBtn[aria-pressed="false"] .wave { display: none; }

/* The pennant each toy flies: a little flag in its build's stack colour. */
.pen {
  --c: var(--yellow); flex: none; position: relative; width: 34px; height: 30px; display: inline-grid; place-items: center start;
  padding-left: 5px; color: #fff; font: 700 14px/1 var(--sans);
}
.pen::before {
  content: ""; position: absolute; inset: 0; background: var(--c); border: 0;
  clip-path: polygon(0 0, 100% 50%, 0 100%); filter: drop-shadow(0 0 0 var(--ink));
}
.pen::after { content: ""; position: absolute; left: -3px; top: -4px; bottom: -6px; width: 3px; border-radius: 2px; background: var(--ink); }
.pen b { position: relative; text-shadow: 0 1px 0 rgba(0, 0, 0, .45); }
.pen.king { --c: var(--yellow); color: var(--ink); }
.pen.king b { text-shadow: none; }
.brand-pen { width: 26px; height: 22px; font-size: 11px; color: var(--ink); }
.brand-pen::after { background: var(--paper); }

/* ---- Header ---- */
.bar {
  display: flex; align-items: center; gap: 10px; flex: none;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  background: rgba(23, 17, 42, .92); border-bottom: 2px solid rgba(0, 0, 0, .25); position: relative; z-index: 6;
}
.brand { margin: 0; display: flex; align-items: center; gap: 10px; font: 700 21px/1 var(--sans); flex: 1; min-width: 0; white-space: nowrap; }
.bar-end { display: flex; gap: 8px; }
#viewBtn { padding: 0 14px; font-size: 15px; }
@media (max-width: 440px) {
  .brand { font-size: 17px; }
  .brand-pen { display: none; }
  #viewBtn { padding: 0 11px; font-size: 14px; }
  .bar { gap: 6px; }
  .bar-end { gap: 5px; }
}
@media (max-width: 359px) { .brand-t { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

/* ---- Views: the list by default; html.play shows the tabletop ---- */
main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.arena { display: none; }
html.play:not(.browsing) body { height: 100vh; height: 100dvh; overflow: hidden; }
html.play:not(.browsing) .bar { position: fixed; top: 0; left: 0; right: 0; background: linear-gradient(rgba(23, 17, 42, .9), rgba(23, 17, 42, .72)); }
html.play:not(.browsing) .browse { display: none; }
html.play:not(.browsing) .arena { display: block; }
html:not(.gl) #viewBtn, html:not(.js) #viewBtn { display: none; }

/* ---- The list ---- */
.browse { padding: 28px max(16px, env(safe-area-inset-right)) max(40px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.browse-in { max-width: 1120px; margin: 0 auto; }
.eyebrow { margin: 0 0 6px; font: 600 13px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--yellow); }
.browse h2 { margin: 0 0 10px; font: 700 clamp(28px, 4.6vw, 42px)/1.1 var(--sans); }
.lede { margin: 0 0 24px; color: var(--muted); max-width: 64ch; }
.nogl-note, .reduced-note { display: none; margin: -8px 0 22px; color: var(--muted); }
html.nogl .nogl-note { display: block; }
html.reduced.gl:not(.play) .reduced-note { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.blist { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.bitem {
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r); box-shadow: 0 6px 0 var(--ink);
  padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.bhead { display: flex; gap: 12px; align-items: center; }
.bitem h3 { margin: 0; font: 700 19px/1.2 var(--sans); }
.tagline { margin: 2px 0 0; color: var(--muted-ink); font-size: 14.5px; }
.bitem .shot { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 10px; border: 2px solid var(--ink); background: var(--paper-2); }
.blurb { margin: 0; }
.links { margin: auto 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.bitem.contact { margin-bottom: 22px; background: var(--yellow); }
.bitem.contact .tagline { color: var(--ink-2); }
.bitem.contact .btn { background: var(--paper); }
.foot { color: var(--muted); font-size: 15px; border-top: 2px solid var(--line); padding-top: 14px; }
.foot .btn.ghost { background: var(--paper); }

/* ---- The tabletop ---- */
.arena { position: fixed; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; background: #2a2140; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse 75% 70% at 50% 55%, transparent 55%, rgba(16, 10, 30, .55)); }
.tags, .callouts { position: absolute; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
.tag {
  position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 6px; border-radius: 999px;
  background: rgba(255, 247, 230, .94); color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 2px 0 var(--ink);
  font: 600 12.5px/1.1 var(--sans); white-space: nowrap; will-change: transform; transition: opacity .2s;
}
.tag i { width: 9px; height: 9px; border-radius: 2px; background: var(--c); flex: none; border: 1.5px solid var(--ink); }
.tag.gone { opacity: 0; }
.callout {
  position: absolute; left: 0; top: 0; font: 700 20px/1 var(--sans); color: var(--c, #fff); white-space: nowrap;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; animation: callout .9s cubic-bezier(.2, .8, .2, 1) forwards;
}
@keyframes callout { 0% { opacity: 0; translate: -50% 0; scale: .6; } 15% { opacity: 1; scale: 1.08; } 30% { scale: 1; } 100% { opacity: 0; translate: -50% -38px; } }

/* HUD: the wave, the key, the builds found. It sits under the header so the bottom of the
   screen stays free for thumbs (PeeWeeTanks' touch controls live there). */
.hud {
  position: absolute; z-index: 5; top: var(--bar-h, 60px); left: 0; right: 0; display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap;
  padding: 8px max(12px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left)); pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-row { display: flex; align-items: center; gap: 10px; }
.wave, .key {
  margin: 0; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 999px;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font: 600 14px/1 var(--sans); white-space: nowrap;
}
.wave:empty { display: none; }
.key-label { font-size: 13px; letter-spacing: .04em; }
.key-track { position: relative; width: 74px; height: 12px; border-radius: 6px; background: var(--paper-2); border: 2px solid var(--ink); overflow: hidden; }
.key-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(min(var(--k, 1), 1) * 100%); background: #2bb673; transition: width .12s linear; }
.key.low .key-fill { background: #f59e0b; }
.key.stalled .key-fill { background: var(--red); }
.key.surge .key-fill, .key.over .key-fill { background: var(--yellow); }
.key.off { display: none; }
.tray-wrap { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; justify-content: flex-end; min-height: 44px; }
.tray-empty { margin: 0; color: var(--text); font-size: 14px; text-shadow: 0 1px 2px rgba(0, 0, 0, .7); text-align: right; }
.tray { list-style: none; margin: 0; padding: 2px; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tray::-webkit-scrollbar { display: none; }
.tray button {
  width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--ink); padding: 0 0 0 4px; background: var(--paper);
  box-shadow: 0 3px 0 var(--ink); cursor: pointer; display: grid; place-items: center;
}
.tray button .pen { width: 26px; height: 22px; font-size: 11px; }
.tray button:hover { background: #fff; }
.tray li { animation: tray-in .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes tray-in { from { transform: translateY(-8px) scale(.6); opacity: 0; } }
@media (max-width: 600px) {
  .tray-wrap { flex-basis: 100%; justify-content: flex-start; margin-top: -2px; }
  .tray-empty { text-align: left; }
}
@media (max-width: 380px) {
  .hud-row { gap: 6px; }
  .wave, .key { padding: 0 9px; font-size: 13px; gap: 6px; }
  .key-track { width: 44px; }
}

.toast {
  position: absolute; z-index: 5; left: 50%; top: calc(var(--hud-b, 120px) + 6px); transform: translateX(-50%); margin: 0; max-width: min(92%, 520px);
  display: flex; align-items: center; gap: 10px; text-align: left; pointer-events: none;
  font: 600 15px/1.3 var(--sans); padding: 8px 16px 8px 12px; border-radius: 16px; background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); transition: opacity .25s, transform .25s;
}
.toast:empty { opacity: 0; transform: translate(-50%, -6px); }
.toast small { display: block; font-weight: 400; color: var(--muted-ink); font-size: 13.5px; }
.count {
  position: absolute; z-index: 4; left: 50%; top: 50%; margin: 0; transform: translate(-50%, -50%); pointer-events: none;
  font: 700 clamp(64px, 14vw, 120px)/1 var(--sans); color: var(--yellow); -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill;
}
.count:empty { display: none; }
.count.pop { animation: count-pop .55s cubic-bezier(.2, .8, .2, 1); }
@keyframes count-pop { from { scale: 1.6; opacity: 0; } }

.panel {
  position: absolute; z-index: 7; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 460px); max-height: calc(100% - 32px); overflow: auto;
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 8px 0 var(--ink); padding: 20px 22px 22px;
}
.panel h2 { margin: 0 0 8px; font: 700 26px/1.15 var(--sans); }
.panel .eyebrow { color: #8f4f00; }
.panel p { margin: 0 0 12px; }
.panel .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.panel .small { font-size: 15px; color: var(--muted-ink); }
.found { list-style: none; margin: 2px 0 14px; padding: 0; display: grid; gap: 8px; }
.found-b {
  width: 100%; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 14px; text-align: left; cursor: pointer;
  background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 14px; box-shadow: 0 3px 0 var(--ink); font: inherit;
}
.found-b:hover { background: var(--paper-2); }
.found-b span { display: grid; min-width: 0; }
.found-b b { font-weight: 600; font-size: 16px; line-height: 1.2; }
.found-b small { color: var(--muted-ink); font-size: 13.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.found-b .pen { width: 28px; height: 24px; font-size: 12px; }
.panel.wide { width: min(94vw, 640px); }
.found.all { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); gap: 8px; }
.found.all .found-b { min-height: 46px; padding: 4px 10px 4px 12px; }
.found.all .found-b b { font-size: 15px; line-height: 1.15; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .found.all { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .found.all .found-b { padding: 4px 6px 4px 9px; gap: 6px; }
  .found.all .found-b b { font-size: 14px; }
}
@media (max-width: 360px) {
  .panel { padding: 16px 14px 18px; }
  .panel h2 { font-size: 23px; }
  .found.all .found-b { padding: 3px 5px 3px 7px; gap: 5px; }
  .found.all .found-b .pen { width: 22px; height: 20px; font-size: 10px; }
  .found.all .found-b b { font-size: 13px; }
}
/* The arena is its own layer (position: fixed), so the header always draws over it: panels
   sit in the space below the header instead of under it. */
.panel { top: calc(50% + var(--bar-h, 60px) / 2); max-height: calc(100% - var(--bar-h, 60px) - 24px); }
.help ul { margin: 0 0 12px; padding-left: 18px; }
.help li, .help p { font-size: 15px; }
html.coarse .k-kbm, html:not(.coarse) .k-touch { display: none; }

/* PeeWeeTanks' touch controls (drawn by its TouchControls), restyled from its own sheet. */
.touch { position: fixed; inset: 0; z-index: 1; touch-action: none; --tc: 1; }
.stick {
  position: absolute; width: 152px; height: 152px; margin: -76px 0 0 -76px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .75);
  background: radial-gradient(circle, rgba(33, 23, 58, .12), rgba(33, 23, 58, .32)); box-shadow: 0 0 0 3px rgba(33, 23, 58, .35);
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.stick.on { opacity: 1; }
.stick .knob { position: absolute; left: 50%; top: 50%; width: 66px; height: 66px; margin: -33px 0 0 -33px; border-radius: 50%; background: #fff; border: 3px solid var(--ink); box-shadow: 0 4px 0 var(--ink); }
.stick.aim .knob { background: var(--yellow); }
.touch::before, .touch::after {
  content: ""; position: absolute; bottom: calc(env(safe-area-inset-bottom) + 34px); width: 128px; height: 128px; border-radius: 50%;
  border: 3px dashed rgba(255, 255, 255, .45); pointer-events: none;
}
.touch[data-mode="target"]::after { display: none; }
.touch::before { left: calc(env(safe-area-inset-left) + 34px); }
.touch::after { right: calc(env(safe-area-inset-right) + 34px); border-color: rgba(255, 210, 63, .55); }
.touch.used::before, .touch.used::after { opacity: 0; transition: opacity .6s; }
.mine-btn {
  position: absolute; right: calc(env(safe-area-inset-right) + 18px); bottom: calc(env(safe-area-inset-bottom) + 18px); width: 84px; height: 84px;
  border-radius: 50%; border: 3px solid var(--ink); background: var(--paper); box-shadow: 0 5px 0 var(--ink); display: grid; place-items: center;
  align-content: center; gap: 0; font: 700 11.5px/1.1 var(--sans); letter-spacing: .08em; color: var(--ink); padding: 0; touch-action: none;
}
.mine-btn svg { width: 42px; height: 34px; }
.mine-btn.down { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.wind-btn { right: calc(env(safe-area-inset-right) + 114px); }
.wind-btn svg { width: 38px; height: 38px; }
.touch.no-wind .wind-btn { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
  .mine-btn { width: 72px; height: 72px; right: calc(env(safe-area-inset-right) + 12px); bottom: calc(env(safe-area-inset-bottom) + 12px); }
  .wind-btn { right: calc(env(safe-area-inset-right) + 12px); bottom: calc(env(safe-area-inset-bottom) + 96px); }
  .mine-btn svg { width: 34px; height: 28px; }
}

/* ---- Reveal card ---- */
.card { padding: 0; border: 0; background: transparent; color: var(--ink); width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: visible; }
.card::backdrop { background: rgba(16, 10, 30, .55); }
.card[open] { animation: card-in .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes card-in { from { transform: translateY(30px) scale(.96); opacity: 0; } }
.card-in {
  position: relative; background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; overflow: auto; max-height: calc(100dvh - 32px);
  box-shadow: 0 8px 0 var(--ink);
}
.card-x { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--paper); color: var(--ink); border: 2px solid var(--ink); }
.card-x:hover { background: #fff; }
.card .shot { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; object-position: top; background: var(--paper-2); border-bottom: 3px solid var(--ink); }
.card-body { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.card .bhead { padding-right: 44px; }
.card h2 { margin: 0; font: 700 26px/1.12 var(--sans); }
.card .eyebrow { margin: 0 0 3px; color: var(--ink-2); }
.card .icon { width: 40px; height: 40px; border-radius: 10px; margin-left: auto; flex: none; border: 2px solid var(--ink); }
.card .tagline { font-size: 15.5px; }
.card .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.card .contact-hero { padding: 28px 20px 4px; display: grid; justify-items: center; text-align: center; gap: 6px; }
.card .contact-hero .pen { width: 60px; height: 52px; font-size: 22px; }

html.reduced *, html.reduced *::before, html.reduced *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
