:root {
  --bg: #07040f;
  --stage: #14081f;
  --panel: #1c0f2c;
  --ink: #f7f1ff;
  --muted: #c9b8e0;
  --pink: #ff3cac;
  --cyan: #2de2e6;
  --gold: #ffd166;
  --ok: #4ade80;
  --bad: #fb7185;
  --land: #7a48b0;
  --land-line: #f3cfff;
  --ocean-fill: #0b1b3a;
  --hit: 52px;
  --radius: 18px;
  --font: "Outfit", "Trebuchet MS", sans-serif;
  --display: "Bungee", "Impact", sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%; min-height: 100dvh;
  background: var(--bg); color: var(--ink); font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}
html { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
body {
  background:
    radial-gradient(1200px 500px at 50% -10%, #ff3cac33, transparent 60%),
    radial-gradient(800px 400px at 100% 100%, #2de2e622, transparent 50%),
    var(--bg);
}
button, a { font-family: inherit; }
.wrap { max-width: 920px; margin: 0 auto; padding: 12px 12px 96px; }
.ipad-tip {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #241037; border: 1px solid var(--cyan); border-radius: 16px;
  padding: 12px 14px; margin-bottom: 12px; font-size: 15px; line-height: 1.35;
}
.ipad-tip[hidden] { display: none !important; }
.ipad-tip button {
  appearance: none; border: 0; background: var(--cyan); color: #071018;
  font-weight: 800; border-radius: 12px; min-height: 44px; padding: 8px 14px; cursor: pointer; flex: 0 0 auto;
}
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 4px 14px;
}
.brand { display: flex; flex-direction: column; gap: 2px; }
.brand h1 {
  font-family: var(--display); font-size: 22px; letter-spacing: 1px; margin: 0;
  background: linear-gradient(90deg, var(--pink), var(--gold), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand p { margin: 0; color: var(--muted); font-size: 13px; }
.xp {
  min-width: 180px; text-align: right; font-size: 12px; color: var(--gold);
}
.xp.prize { max-width: 240px; }
.xp bar, .bar {
  display: block; height: 8px; background: #2a163d; border-radius: 99px; overflow: hidden; margin-top: 6px;
}
.bar > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--pink), var(--cyan)); transition: width .35s ease; }
.modes {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px;
}
.modes button, .chip {
  appearance: none; border: 1px solid #3a2158; background: var(--panel); color: var(--ink);
  border-radius: 14px; padding: 10px 8px; font-size: 13px; font-weight: 600;
  min-height: var(--hit); cursor: pointer;
}
.modes button.on, .chip.on {
  border-color: var(--pink); box-shadow: 0 0 0 2px #ff3cac44, 0 0 24px #ff3cac33;
  background: #2a103d;
}
.stage {
  background: linear-gradient(180deg, #1a0a2c, #0c0716);
  border: 1px solid #3a2158; border-radius: 22px; overflow: hidden;
  box-shadow: 0 20px 80px #ff3cac1a, inset 0 0 80px #2de2e60d;
}
.prompt {
  padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 6px;
}
.prompt .kicker { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); }
.prompt h2 { margin: 0; font-size: 26px; line-height: 1.15; }
.prompt .hint { color: var(--muted); font-size: 14px; min-height: 1.3em; }
.map-box { position: relative; padding: 0 8px 8px; min-height: 0; }
svg.map {
  width: 100%; height: auto; display: block; aspect-ratio: 2 / 1;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
  max-width: 100%;
  background: var(--ocean-fill);
}
.land { fill: var(--land); stroke: var(--land-line); stroke-width: 1.15; }
.ocean { fill: var(--ocean-fill); }
.ocean-basin { fill: var(--ocean-fill); }
.graticule line { stroke: #2de2e633; stroke-width: 0.8; fill: none; }
.glow { pointer-events: none; }
.hotspot { cursor: pointer; }
.hud {
  display: flex; justify-content: space-between; gap: 8px; padding: 8px 14px 14px; font-size: 13px; color: var(--muted);
}
.actions { display: flex; gap: 8px; padding: 0 12px 14px; flex-wrap: wrap; }
.actions button, .primary {
  flex: 1; min-height: var(--hit); border: 0; border-radius: 14px; font-weight: 700; cursor: pointer;
}
.primary { background: linear-gradient(90deg, var(--pink), #ff7ac8); color: #1a0518; }
.ghost { background: #2a163d; color: var(--ink); border: 1px solid #4a2a6a; }
.teach {
  margin: 8px 12px 14px; padding: 14px; border-radius: 16px; background: #241037;
  border: 1px solid #ff3cac55;
}
.teach .tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 99px; margin-bottom: 8px; }
.howto ol, .howto ul.plain { margin: 0 0 14px; padding-left: 1.25em; }
.howto li { margin: 0 0 8px; }
.howto .step-title { color: var(--gold); font-weight: 800; margin: 14px 0 6px; }
.howto .step-title:first-child { margin-top: 0; }
.sheet { margin-top: 16px; background: #12081c; border-radius: 18px; border: 1px solid #3a2158; overflow: hidden; }
.sheet h3 { margin: 0; padding: 12px 14px; font-size: 14px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 14px;
  border-top: 1px solid #2a163d; font-size: 15px; align-items: center;
}
.row b { font-weight: 700; }
.tick { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #241037; color: #5b4570; font-size: 14px; }
.tick.yes { background: #14532d; color: var(--ok); }
.science { margin-top: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.science summary { cursor: pointer; color: var(--cyan); font-weight: 600; }
.flash {
  position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-family: var(--display); font-size: 42px; opacity: 0; transform: scale(.8);
}
.flash.show { animation: pop .7s ease; }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 25% { opacity: 1; transform: scale(1.05); } 100% { opacity: 0; transform: scale(1.2); } }
.toast {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #1a0a2c; border: 1px solid var(--cyan); color: var(--ink);
  padding: 10px 16px; border-radius: 999px; font-weight: 700; z-index: 5;
  max-width: calc(100% - 24px);
}
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 12px 14px; }
.choices button { min-height: 52px; border-radius: 14px; border: 1px solid #4a2a6a; background: #241037; color: var(--ink); font-weight: 700; }
.choices button.good { background: #14532d; border-color: var(--ok); }
.choices button.bad { background: #4c0519; border-color: var(--bad); }
@media (max-width: 520px) {
  .brand h1 { font-size: 18px; }
  .prompt h2 { font-size: 22px; }
  .modes { grid-template-columns: 1fr 1fr; }
}

/* iPad portrait and up */
@media (min-width: 768px) {
  :root { --hit: 58px; }
  .wrap { max-width: 1180px; padding: 22px 28px 40px; }
  .brand h1 { font-size: 34px; letter-spacing: 2px; }
  .brand p { font-size: 16px; }
  .xp { min-width: 180px; font-size: 15px; }
  .modes { grid-template-columns: repeat(6, 1fr); gap: 10px; }
  .modes button { font-size: 16px; padding: 14px 10px; }
  .prompt { padding: 18px 20px 8px; }
  .prompt .kicker { font-size: 13px; }
  .prompt h2 { font-size: 34px; }
  .prompt .hint { font-size: 18px; }
  .teach { font-size: 18px; padding: 18px; margin: 12px 16px 16px; }
  .teach .tag { font-size: 13px; }
  .actions button, .primary, .ghost { font-size: 18px; }
  .choices { gap: 12px; padding: 0 16px 18px; }
  .choices button { min-height: 68px; font-size: 18px; }
  .hud { font-size: 16px; padding: 10px 18px 18px; }
  .sheet h3 { font-size: 16px; padding: 16px 18px; }
  .sheet-body { display: grid; grid-template-columns: 1fr 1fr; }
  .row { font-size: 17px; padding: 12px 18px; }
  .tick { width: 34px; height: 34px; }
  .map-box { padding: 8px 16px 16px; }
  .flash { font-size: 72px; }
  .science { font-size: 15px; }
}

/* iPad landscape: map beside the hunt card. Keep the whole world visible. */
@media (min-width: 900px) and (orientation: landscape) {
  .stage:has(.map-box) {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.9fr);
    grid-template-areas:
      "map prompt"
      "map teach"
      "map extras"
      "map hud";
    align-items: start;
    min-height: min(72dvh, 640px);
  }
  .map-box {
    grid-area: map;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 10px 12px 14px;
    align-self: stretch;
    min-height: 0;
  }
  svg.map { max-height: min(68dvh, 560px); }
  .prompt { grid-area: prompt; }
  .teach { grid-area: teach; }
  .actions, .choices { grid-area: extras; }
  .hud { grid-area: hud; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
