/* Shared styles for the title page and the game page.
   Change the colours here to re-paint the whole game! */
:root {
  --cream: #fbf8f1;  /* page background */
  --ink:   #2b2d42;  /* text and outlines */
  --mint:  #c9efdc;
  --butter:#fff0b3;
  --sky:   #d3e8ff;
  --coral: #ffd3c7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--cream);
  color: var(--ink);
  font-family: system-ui, sans-serif;
}

/* ---------- Title page ---------- */
.title-page {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: env(safe-area-inset-top) 1rem env(safe-area-inset-bottom);
  text-align: center;
  background: linear-gradient(160deg, var(--sky), var(--cream) 45%, var(--butter));
}
.title-page h1 {
  margin: 0;
  font-size: clamp(2.4rem, 9vw, 5rem);
}
.play-button {
  display: inline-block;
  padding: 1rem 3.5rem;
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 800;
  color: var(--ink);
  text-decoration: none;
  background: var(--mint);
  border: 4px solid var(--ink);
  border-radius: 2rem;
  box-shadow: 0 6px 0 var(--ink);
}
.play-button:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.by-line { margin: 0; font-size: 0.8rem; opacity: 0.6; }

/* ---------- Bonk Arena: pick your brawler ---------- */
.pick-line { margin: 0; font-size: 1.3rem; font-weight: 800; }
.hero-cards { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; }
.hero-card {
  width: 9.5rem; padding: 1rem 0.6rem; display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  color: var(--ink); text-decoration: none; background: #fff;
  border: 4px solid var(--ink); border-radius: 1.4rem; box-shadow: 0 6px 0 var(--ink);
}
.hero-card:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.hero-card b { font-size: 1.4rem; }
.hero-card small { font-size: 0.8rem; line-height: 1.3; }
.hero-cards { max-width: 62rem; padding-bottom: 0.5rem; }
.hero-card { width: 13.5rem; background: linear-gradient(180deg, var(--c) 0 3.2rem, #fff 3.2rem); }
.hero-card em { font-size: 0.85rem; font-weight: 700; opacity: 0.75; }
.hero-card p { margin: 0; font-size: 0.8rem; line-height: 1.35; }
.hero-card .atk { background: var(--cream); border: 2px dashed var(--ink); border-radius: 0.7rem; padding: 0.35rem 0.5rem; }
.hero-card .stats { display: grid; grid-template-columns: auto auto; gap: 0.1rem 0.6rem; font-size: 0.78rem; text-align: left; }
.hero-card .stats i { font-style: normal; letter-spacing: 1px; }
.hero-card .go, .hero-card .lock { margin-top: 0.2rem; padding: 0.25rem 1rem; border: 3px solid var(--ink); border-radius: 999px; font-weight: 800; }
.hero-card .go { background: var(--mint); }
.hero-card .lock { background: #eee; }
.hero-card.locked { filter: grayscale(0.85); opacity: 0.7; box-shadow: 0 3px 0 var(--ink); }
.hero-card.locked:active { transform: none; }
.star-line { margin: 0; font-size: 1.15rem; font-weight: 800; padding: 0.3rem 1rem; background: #fff; border: 3px solid var(--ink); border-radius: 999px; }
.earn-line { margin: 0; font-size: 0.85rem; max-width: 28rem; }
.hero-face {
  width: 3.4rem; height: 3.4rem; border-radius: 50%; border: 3px solid var(--ink); background: var(--c);
  background-image: radial-gradient(circle at 35% 42%, var(--ink) 0 5px, transparent 6px),
                    radial-gradient(circle at 65% 42%, var(--ink) 0 5px, transparent 6px);
}
/* Map picker */
.map-cards { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; max-width: 62rem; }
.map-card {
  width: 13.5rem; padding: 0.7rem; display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
  font: inherit; color: var(--ink); cursor: pointer;
  background: linear-gradient(180deg, var(--w) 0 2.6rem, var(--f) 2.6rem);
  border: 4px solid var(--ink); border-radius: 1.2rem; box-shadow: 0 5px 0 var(--ink); opacity: 0.7;
}
.map-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.map-card.picked { opacity: 1; outline: 4px solid #5b8def; outline-offset: 3px; }
.map-card .map-emoji { font-size: 1.8rem; line-height: 1; }
.map-card b { font-size: 1.1rem; }
.map-card p { margin: 0; font-size: 0.78rem; line-height: 1.35; }
.how-line { margin: 0; max-width: 28rem; font-size: 0.95rem; }
.classic-link { color: var(--ink); font-size: 0.9rem; font-weight: 700; }
.home-btn { position: fixed; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); z-index: 20;
  padding: 6px 12px; border-radius: 999px; border: 2px solid var(--ink); background: rgba(255,255,255,.85);
  font-weight: 800; font-size: 14px; color: var(--ink); text-decoration: none; }

/* ---------- Game page ---------- */
.game-page { overflow: hidden; touch-action: none; }
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
/* ---- app feel on iPad Safari: no scrolling, zooming or rubber-banding (see js/touch.js) ---- */
html, body { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; -webkit-overflow-scrolling: auto; }
body:not(.game-page) { overflow-y: auto; touch-action: pan-y; }
.game-page canvas { display: block; width: 100vw; height: 100vh; height: 100dvh; touch-action: none; }
#fsBtn { position: fixed; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); z-index: 20; min-height: 40px; padding: 6px 12px; border-radius: 999px; border: 2px solid #2b2d42; background: rgba(255,255,255,.85); font: inherit; font-weight: 800; font-size: 14px; color: #2b2d42; }
.home-hint { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); margin: 0; padding: 10px 14px; border-radius: 14px; border: 2px dashed #b98a00; background: #fff0b3; color: #7a5b00; font-size: 14px; text-align: center; line-height: 1.4; }
.home-hint .share-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; border: 2px solid #2b2d42; border-radius: 5px; font-size: 12px; background: #fff; vertical-align: middle; }
.home-hint button { font: inherit; font-weight: 800; min-height: 36px; padding: 4px 10px; border-radius: 999px; border: 2px solid #2b2d42; background: #c9efdc; margin-top: 4px; }
