/* Batmash website. Colours and type come from brand/tokens.json. */

@font-face {
  font-family: "Bungee";
  src: url("fonts/bungee.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("fonts/baloo2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --yellow: #F4E04D;
  --brick: #C4623A;
  --brick-shadow: #8E3F22;
  --asphalt: #34353A;
  --night: #1E1F23;
  --chalk: #F2F2EA;
  --kerb: #8A8A86;
  --red: #D8342C;

  --display: "Bungee", "Arial Black", sans-serif;
  --body: "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--asphalt);
  color: var(--chalk);
  font-family: var(--body);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.55;
  overflow-x: hidden;
}

img, svg { max-width: 100%; height: auto; display: block; }

a { color: var(--yellow); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: -9999px; top: 8px;
  background: var(--yellow); color: var(--night); padding: 8px 14px; border-radius: 8px; z-index: 10;
}
.skip:focus { left: 8px; }

/* Display type: Bungee, uppercase only, never for sentences. */
.display, h1, h2 {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.1;
  margin: 0 0 0.5em;
}
h1 { font-size: clamp(2.2rem, 6.5vw, 4.4rem); color: var(--yellow); }
h2 { font-size: clamp(1.6rem, 4vw, 2.5rem); }
h3 { font-family: var(--body); font-weight: 800; font-size: 1.35rem; line-height: 1.25; margin: 0 0 0.35em; }
p { margin: 0 0 1em; }

.lede { font-size: clamp(1.15rem, 2.2vw, 1.4rem); color: var(--chalk); max-width: 34ch; }
.muted { color: var(--kerb); }

/* Header */
.site-header {
  background: var(--night);
  border-bottom: 4px solid var(--brick);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-top: 14px; padding-bottom: 14px;
}
.site-header .logo img { width: clamp(170px, 30vw, 250px); }
.site-nav { display: flex; gap: clamp(12px, 3vw, 28px); flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { color: var(--chalk); text-decoration: none; font-weight: 800; font-size: 1rem; }
.site-nav a:hover { color: var(--yellow); }
@media (max-width: 640px) {
  .site-nav .hide-sm { display: none; }
  .site-nav { gap: 14px; flex-wrap: nowrap; }
  .site-nav a { font-size: 0.9rem; white-space: nowrap; }
  .site-header .logo img { width: 150px; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--body); font-weight: 800; font-size: 1.1rem;
  padding: 12px 22px; border-radius: 999px; text-decoration: none;
  border: 3px solid var(--night);
  box-shadow: 0 4px 0 var(--night);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--night); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--night); }
.btn-primary { background: var(--yellow); color: var(--night); }
.btn-secondary { background: var(--brick); color: var(--chalk); }
.btn[aria-disabled="true"] { cursor: default; }
.btn small { font-weight: 600; opacity: 0.8; }
/* Official store badges: keep them unaltered, equal height, with clear space. */
.store-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 8px 0 10px; }
.store-badges a { display: block; border-radius: 9px; line-height: 0; }
.store-badges img { height: 52px; width: auto; }
.store-note { font-size: 1rem; color: var(--kerb); margin: 0; }
.store-note a { color: var(--chalk); }
.challenge .store-badges { margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }

/* Hero: asphalt on the left, gully wall on the right */
.hero {
  position: relative;
  background:
    linear-gradient(100deg, var(--asphalt) 0 58%, transparent 58.1%),
    var(--brick);
  overflow: hidden;
}
.hero::after {
  /* Brick courses on the wall side */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='88'%3E%3Cg fill='%238E3F22'%3E%3Crect width='96' height='3'/%3E%3Crect y='44' width='96' height='3'/%3E%3Crect width='3' height='44'/%3E%3Crect x='48' y='44' width='3' height='44'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 88px;
  -webkit-mask-image: linear-gradient(100deg, transparent 58.2%, #000 58.3%);
          mask-image: linear-gradient(100deg, transparent 58.2%, #000 58.3%);
  opacity: 0.55;
}
.hero .wrap {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 32px; align-items: center;
  padding-top: clamp(48px, 9vw, 110px); padding-bottom: clamp(48px, 9vw, 110px);
}
/* 3D street scene. Without WebGL (or before it loads) the scorecard shows instead. */
.stage {
  position: relative; margin: 0; justify-self: center;
  width: min(100%, 460px); aspect-ratio: 4 / 5;
}
.stage-canvas, .stage-banner { display: none; }
.stage-fallback {
  width: min(100%, 380px); margin: 0 auto;
  transform: rotate(4deg);
  border: 6px solid var(--night); border-radius: 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}
.stage.is-3d .stage-fallback { display: none; }
.stage.is-3d .stage-canvas {
  display: block; position: absolute; inset: 0;
  border: 6px solid var(--night); border-radius: 22px; overflow: hidden;
  background: #a9d4ef;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  transition: opacity 0.3s ease;
}
.stage.is-3d .stage-canvas canvas { display: block; width: 100%; height: 100%; }
.stage.is-3d .stage-canvas.fade { opacity: 0; }
.stage.is-3d .stage-banner {
  display: block; position: absolute; left: 50%; top: 14%; margin: 0;
  font-family: var(--display); font-size: clamp(1.6rem, 4.5vw, 2.4rem); line-height: 1; white-space: nowrap;
  color: var(--yellow); text-transform: uppercase;
  -webkit-text-stroke: 2px var(--night); paint-order: stroke fill;
  text-shadow: 0 4px 0 var(--brick-shadow), 0 6px 0 var(--night);
  transform: translateX(-50%) rotate(-6deg) scale(0.3); opacity: 0;
  transition: transform 0.25s cubic-bezier(.2, 1.6, .4, 1), opacity 0.15s ease;
  pointer-events: none;
}
.stage.is-3d .stage-banner.show { transform: translateX(-50%) rotate(-6deg) scale(1); opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .stage.is-3d .stage-banner { transition: none; }
}
.stage.is-3d .stage-banner[data-kind="caught"], .stage.is-3d .stage-banner[data-kind="onetip"],
.stage.is-3d .stage-banner[data-kind="khidki"], .stage.is-3d .stage-banner[data-kind="bowled"] { color: var(--chalk); text-shadow: 0 4px 0 #8e1f1a, 0 6px 0 var(--night); }

/* Playable scene: overlay on the canvas */
.stage-ui { display: none; }
.stage.is-3d .stage-ui { display: block; position: absolute; inset: 6px; pointer-events: none; border-radius: 16px; overflow: hidden; }
.stage-ui > * { pointer-events: auto; }
.stage-ui [hidden] { display: none !important; }
.stage.is-3d .stage-canvas canvas { touch-action: pan-y; }
.stage.is-playing .stage-canvas canvas { touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; }
.stage-loading {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); margin: 0;
  font-weight: 700; font-size: 0.9rem; white-space: nowrap; color: var(--chalk);
  background: rgba(30, 31, 35, 0.72); padding: 6px 14px; border-radius: 999px;
}
.stage-play {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  font: 400 1.15rem/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--night); background: var(--yellow); border: 3px solid var(--night); border-radius: 14px;
  padding: 14px 26px; box-shadow: 0 5px 0 var(--night); cursor: pointer; white-space: nowrap;
}
.stage-play:hover { background: #fff07a; }
.stage-play:active { transform: translateX(-50%) translateY(3px); box-shadow: 0 2px 0 var(--night); }
.stage-hud {
  position: absolute; left: 10px; top: 10px; right: 52px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; pointer-events: none;
}
.stage-score {
  margin: 0; font: 400 1.5rem/1 var(--display); color: var(--chalk);
  background: rgba(30, 31, 35, 0.8); padding: 6px 12px; border-radius: 10px;
}
.stage-balls { display: flex; flex-wrap: wrap; gap: 3px; margin: 0; padding: 0; list-style: none; max-width: 190px; }
.stage-balls li {
  width: 20px; height: 20px; border-radius: 50%; font-size: 0.7rem; font-weight: 800; line-height: 20px; text-align: center;
  background: rgba(242, 242, 234, 0.25); color: var(--night); border: 1px solid rgba(30, 31, 35, 0.4);
}
.stage-balls li:not(:empty) { background: var(--chalk); }
.stage-balls li.is-four { background: #7fd3a8; }
.stage-balls li.is-six { background: var(--yellow); }
.stage-balls li.is-out { background: #d8342c; color: var(--chalk); }
.stage-hint {
  position: absolute; left: 10px; right: 10px; bottom: 12px; margin: 0; pointer-events: none;
  font-size: 0.9rem; font-weight: 700; line-height: 1.3; text-align: center; color: var(--chalk);
  background: rgba(30, 31, 35, 0.72); padding: 8px 12px; border-radius: 12px;
}
.stage-quit {
  position: absolute; right: 10px; top: 10px; width: 36px; height: 36px; border-radius: 50%;
  font-size: 1.4rem; line-height: 1; color: var(--chalk); background: rgba(30, 31, 35, 0.8); border: 0; cursor: pointer;
}
.stage-over {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 16px; text-align: center; background: rgba(30, 31, 35, 0.78);
}
.stage-over p { margin: 0; }
.stage-over-kicker { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--yellow); }
.stage-over-score { font: 400 clamp(2.6rem, 12vw, 3.6rem)/1 var(--display); color: var(--chalk); }
.stage-over-sub { color: var(--chalk); opacity: 0.85; margin-bottom: 14px !important; }
.stage-over-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px 14px; }
.stage-over .stage-play { position: static; transform: none; }
.stage-over .stage-play:active { transform: translateY(3px); }
.stage-get { font: inherit; font-weight: 800; color: var(--chalk); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hero-logo { margin: 0 0 18px; }
.hero-logo img { width: min(100%, 520px); margin-left: -2%; }
.kicker {
  display: inline-block; font-weight: 800; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--night); background: var(--yellow); padding: 2px 12px; border-radius: 6px; margin-bottom: 18px;
}
@media (max-width: 820px) {
  .hero { background: var(--asphalt); }
  .hero::after { display: none; }
  .hero .wrap { grid-template-columns: 1fr; }
  .stage { width: min(100%, 420px); margin-top: 8px; }
}

/* Sections */
section { padding: clamp(56px, 8vw, 96px) 0; }
.section-night { background: var(--night); }
.section-chalk { background: var(--chalk); color: var(--night); }
.section-chalk h2 { color: var(--night); }
.section-chalk a { color: var(--brick-shadow); }
.section-head { max-width: 680px; margin-bottom: 36px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 860px) { .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--asphalt);
  border: 3px solid var(--night);
  border-radius: var(--radius);
  padding: 24px;
}
.section-night .card { background: var(--asphalt); border-color: #2A2B30; }
.section-chalk .card { background: #fff; border-color: var(--night); box-shadow: 0 5px 0 var(--night); }
.card p:last-child { margin-bottom: 0; }

.big-num {
  font-family: var(--display); color: var(--yellow);
  font-size: clamp(2.8rem, 6vw, 3.6rem); line-height: 1; margin-bottom: 10px;
}

/* Street rules */
.rule { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.chip {
  font-family: var(--display); font-size: 1.25rem; line-height: 1;
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  border: 3px solid var(--night);
}
.chip-six { background: var(--yellow); color: var(--night); }
.chip-four { background: var(--brick); color: var(--chalk); }
.chip-out { background: var(--red); color: var(--chalk); }
.chip-tip { background: var(--chalk); color: var(--night); }
.chip-x2 { background: var(--night); color: var(--yellow); }
.street-word { font-family: var(--display); font-size: 1.15rem; text-transform: uppercase; margin: 0 0 4px; }

/* Controls list */
.controls { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.controls li { display: grid; grid-template-columns: 9.5rem 1fr; gap: 14px; align-items: baseline; border-bottom: 2px dashed rgba(242, 242, 234, 0.18); padding-bottom: 14px; }
.controls li:last-child { border-bottom: 0; }
.controls strong { color: var(--yellow); font-weight: 800; }
@media (max-width: 520px) { .controls li { grid-template-columns: 1fr; gap: 2px; } }

/* Bowling: the pitch mat */
.bowl { align-items: center; }
.mat {
  margin: 0; background: var(--night); border: 4px solid var(--night); border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 6px 0 #000; max-width: 460px; width: 100%; justify-self: center;
}
.mat-scene { width: 100%; height: auto; display: block; }
.ms-ball { offset-rotate: 0deg; offset-distance: 58%; animation: ms-bowl 2.6s cubic-bezier(.45, 0, .7, 1) infinite; }
@keyframes ms-bowl {
  0% { offset-distance: 0%; opacity: 0; }
  8% { opacity: 1; }
  80% { offset-distance: 100%; opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}
.ms-ripple { transform-box: fill-box; transform-origin: center; animation: ms-ripple 2.6s ease-out infinite; }
@keyframes ms-ripple {
  0%, 50% { transform: scale(.4); opacity: 0; }
  55% { opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}
.ms-cell { animation: ms-cell 2.6s ease-in-out infinite; }
@keyframes ms-cell { 0%, 100% { fill-opacity: .14; } 50% { fill-opacity: .34; } }
.ms-bulb { animation: ms-bulb 1.8s ease-in-out infinite alternate; }
.ms-bulb:nth-of-type(3n) { animation-delay: .6s; }
.ms-bulb:nth-of-type(3n+1) { animation-delay: 1.2s; }
@keyframes ms-bulb { from { opacity: 1; } to { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .ms-ball, .ms-ripple, .ms-cell, .ms-bulb { animation: none; }
}
.mat-hud { padding: 14px 16px 16px; background: linear-gradient(180deg, #26272C, var(--night)); }
.pace { display: flex; gap: 8px; margin-bottom: 12px; }
.pace span {
  flex: 1; text-align: center; font-weight: 800; font-size: 0.9rem; padding: 4px 0;
  border-radius: 999px; border: 2px solid #3A3B41; color: var(--kerb);
}
.pace .on { background: var(--yellow); border-color: var(--yellow); color: var(--night); }
.meter {
  position: relative; height: 18px; border-radius: 9px;
  background: #0F1013; overflow: hidden;
}
.meter-green { position: absolute; left: 62%; width: 14%; top: 0; bottom: 0; background: #46C46A; }
.meter-needle {
  position: absolute; top: -2px; bottom: -2px; width: 4px; left: 66%; background: var(--chalk);
  animation: needle 2.4s ease-in-out infinite alternate;
}
@keyframes needle { from { left: 4%; } to { left: 94%; } }
@media (prefers-reduced-motion: reduce) { .meter-needle { animation: none; } }
.ticks { list-style: none; padding: 0; margin: 0; }
.ticks li { padding-left: 1.6em; position: relative; margin-bottom: 0.4em; }
.ticks li::before { content: "✓"; position: absolute; left: 0; color: var(--yellow); font-weight: 800; }

/* Modes */
.modes h3 { color: var(--yellow); }

/* With friends */
.friends .card { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: start; }
.friends .chip { font-size: 0.85rem; border-color: var(--chalk); }
.note { margin: 28px 0 0; color: var(--kerb); max-width: 680px; }

/* Character roster */
.roster {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
@media (max-width: 700px) { .roster { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.roster li {
  background: linear-gradient(180deg, var(--night) 0%, #26272C 70%, var(--brick-shadow) 100%);
  border: 3px solid var(--night); border-radius: var(--radius);
  padding: 10px 12px 14px; text-align: center;
}
.roster img { width: 100%; aspect-ratio: 36 / 46; object-fit: contain; margin-bottom: 6px; }
.roster strong { display: block; font-family: var(--display); font-weight: 400; color: var(--yellow); font-size: 0.95rem; text-transform: uppercase; }
.roster span { display: block; font-size: 0.95rem; color: var(--kerb); line-height: 1.35; }

/* Gullies and venues */
.tags { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 10px; }
.tags li {
  background: var(--yellow); color: var(--night); font-weight: 800;
  padding: 4px 14px; border-radius: 999px; border: 3px solid var(--night);
}
.tags-alt li { background: var(--brick); color: var(--chalk); }

/* Challenge band */
.challenge {
  background: var(--yellow); color: var(--night);
}
.challenge h2 { color: var(--night); }
.challenge .wrap { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 32px; align-items: center; }
.challenge .pledge {
  background: var(--night); color: var(--chalk); border-radius: var(--radius); padding: 24px;
}
.challenge .pledge ul { margin: 0; padding-left: 1.2em; }
.challenge .pledge h3 { color: var(--yellow); }
@media (max-width: 820px) { .challenge .wrap { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { background: var(--night); border-top: 4px solid var(--brick); padding: 40px 0 48px; font-size: 1rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 24px 48px; justify-content: space-between; align-items: flex-start; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.site-footer nav a { color: var(--chalk); }
.site-footer .credit { color: var(--kerb); }
.site-footer .credit strong { color: var(--chalk); font-weight: 800; }
.site-footer .credit { margin: 0 0 8px; }
.publisher-logo { width: 160px; margin: 0 0 14px; }

/* Long-form legal pages */
.doc { padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 8vw, 96px); }
.doc .wrap { max-width: 780px; }
.doc h1 { font-size: clamp(1.9rem, 5vw, 3rem); }
.doc h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); color: var(--yellow); margin-top: 1.8em; }
.doc h3 { margin-top: 1.4em; }
.doc ul, .doc ol { padding-left: 1.3em; margin: 0 0 1em; }
.doc li { margin-bottom: 0.4em; }
.doc .updated { color: var(--kerb); font-size: 1rem; }
.callout {
  background: var(--night); border-left: 6px solid var(--yellow);
  border-radius: 10px; padding: 18px 20px; margin: 1.2em 0 1.6em;
}
.callout p:last-child { margin-bottom: 0; }
.table-wrap { overflow-x: auto; margin: 0 0 1.2em; }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid rgba(242, 242, 234, 0.15); }
th { font-weight: 800; color: var(--yellow); }

/* 404 */
.lost { text-align: center; padding: clamp(64px, 12vw, 140px) 0; }
.lost img { width: 140px; margin: 0 auto 28px; }
.lost .actions { justify-content: center; }
