/*
 * The page around the canvas: the score, the burns left, the doneness gauge,
 * the stamps, and the three cards (start, game over, paused). Chunky, like the
 * art: thick ink, hard drop shadows, truck-art colours. The site's CSP allows
 * this file and inline style attributes; it never needs inline script.
 */
:root {
  --ink: #1b1530;
  --cream: #fff6e2;
  --gold: #f8ad40;
  --red: #eb3845;
  --yellow: #ffd140;
  --green: #2bb573;
  --teal: #12a3a6;
  --font: 'Lilita One', 'Arial Rounded MT Bold', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  background: #1b1530;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
body { font-family: var(--font); color: var(--ink); }
[hidden] { display: none !important; }

.stage { position: fixed; inset: 0; outline: none; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* ---- HUD -------------------------------------------------------------- */
.hud {
  position: absolute; left: 0; right: 0;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 14px; pointer-events: none;
}
.pill {
  min-width: 64px; padding: 6px 16px 4px; text-align: center;
  font-size: 30px; line-height: 1; letter-spacing: 0.02em;
  background: var(--cream); border: 4px solid var(--ink); border-radius: 999px;
  box-shadow: 0 5px 0 var(--ink);
  font-variant-numeric: tabular-nums;
}
.pill.bump { animation: bump 0.25s ease-out; }
@keyframes bump { 40% { transform: scale(1.18); } }
.lives { display: flex; gap: 6px; }
.lives i {
  display: block; width: 30px; height: 30px; border-radius: 50%;
  border: 4px solid var(--ink); box-shadow: 0 4px 0 var(--ink);
  background: radial-gradient(circle at 35% 40%, #c66f22 0 3px, transparent 4px),
    radial-gradient(circle at 65% 62%, #c66f22 0 3px, transparent 4px), var(--gold);
}
.lives i.gone {
  background: radial-gradient(circle at 50% 50%, #2b1d17 0 6px, transparent 7px), #6a3a18;
  transform: rotate(-12deg) scale(0.92);
}
.lives i.lost { animation: lost 0.5s ease-out; }
@keyframes lost { 30% { transform: scale(1.5) rotate(-20deg); } }

/* ---- the doneness gauge: the face on the iron, in the ramp's own colours - */
.gauge {
  position: absolute; left: 50%; width: min(300px, calc(100vw - 48px));
  transform: translateX(-50%); height: 34px; pointer-events: none;
  transition: opacity 0.2s;
}
.gauge.idle { opacity: 0.45; }
.track {
  position: absolute; left: 0; right: 0; top: 8px; height: 22px;
  border: 4px solid var(--ink); border-radius: 12px; box-shadow: 0 4px 0 var(--ink);
  overflow: hidden;
}
.track .perfect {
  position: absolute; top: 0; bottom: 0;
  border-left: 3px solid var(--ink); border-right: 3px solid var(--ink);
  background: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255, 255, 255, 0.28) 6px 9px);
}
.track .burn {
  position: absolute; top: 0; bottom: 0; right: 0; width: 10px; background: var(--red);
  border-left: 3px solid var(--ink);
}
.needle {
  position: absolute; top: 0; left: 0; width: 0; height: 0;
  border-left: 9px solid transparent; border-right: 9px solid transparent;
  border-top: 13px solid var(--ink); margin-left: -9px;
  will-change: transform;
}
.needle::after {
  content: ''; position: absolute; left: -3px; top: -2px; width: 6px; height: 30px;
  background: var(--ink); border-radius: 3px;
}
.gauge.hot .track { animation: hot 0.22s steps(2) infinite; }
@keyframes hot { 50% { border-color: var(--red); } }

/* ---- stamps: what a tap was worth, and the shout ------------------------- */
.stamp {
  position: absolute; left: 0; right: 0; text-align: center; pointer-events: none;
  font-size: 34px; line-height: 1.05; color: var(--cream);
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill;
  text-shadow: 0 5px 0 var(--ink);
  opacity: 0;
}
.stamp.show { animation: stamp 0.85s ease-out forwards; }
.stamp.burn { font-size: 40px; white-space: nowrap; color: var(--yellow); animation-duration: 1.5s; }
.stamp.perfect { color: var(--yellow); }
.stamp.kacha { color: #fff; }
.stamp small { display: block; font-size: 22px; }
@keyframes stamp {
  0% { opacity: 0; transform: scale(0.4) rotate(-6deg); }
  15% { opacity: 1; transform: scale(1.12) rotate(2deg); }
  25% { transform: scale(1) rotate(-1deg); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-26px) scale(1); }
}

/* ---- cards ---------------------------------------------------------------- */
.card {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -62%);
  width: min(320px, calc(100vw - 40px));
  padding: 22px 20px 18px; text-align: center;
  background: var(--cream); border: 5px solid var(--ink); border-radius: 26px;
  box-shadow: 0 8px 0 var(--ink);
}
.card::before {
  /* the truck-art chevron band across the top of every card */
  content: ''; position: absolute; left: 18px; right: 18px; top: -5px; height: 12px;
  border: 4px solid var(--ink); border-radius: 6px;
  background: repeating-linear-gradient(90deg, var(--red) 0 14px, var(--yellow) 14px 28px, var(--green) 28px 42px);
}
h1, h2 { margin: 6px 0 8px; font-weight: 400; line-height: 0.95; color: var(--gold); -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; text-shadow: 0 5px 0 var(--ink); }
h1 { font-size: 64px; }
h2 { font-size: 46px; }
.card p { margin: 6px 0; }
.card .go {
  display: inline-block; margin-top: 12px; padding: 10px 22px 8px; font-size: 24px;
  background: var(--yellow); border: 4px solid var(--ink); border-radius: 999px; box-shadow: 0 5px 0 var(--ink);
  animation: nudge 1.2s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); } }
.card .big { font-size: 64px; line-height: 1; }
.card .line { font-size: 19px; }
.card .best { font-size: 20px; color: #6a4a2a; }
.card .fine { margin-top: 14px; font-size: 15px; color: #6a4a2a; }
.card a { color: inherit; text-decoration: underline; text-underline-offset: 3px; padding: 6px 2px; }
.card a:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
#over .go, #title .go { pointer-events: none; }

.noscript { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: #fff; font: 18px system-ui, sans-serif; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .card .go, .gauge.hot .track, .pill.bump, .lives i.lost { animation: none; }
}
@media (max-height: 520px) {
  h1 { font-size: 46px; }
  .card { padding: 14px 16px 12px; transform: translate(-50%, -50%); }
}
