:root {
  --bg-deep: #0b1020;
  --bg-mid: #131a30;
  --bg-card: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f7fa;
  --text-muted: #a5adc0;
  --text-dim: #6f7689;
  --brand: #6c8aff;
  --brand-warm: #ffb35e;
  --accent-green: #7ce0a0;
  --accent-rose: #ff8aa3;
  --pixel-shadow: rgba(108, 138, 255, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(108, 138, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at 90% 10%, rgba(255, 179, 94, 0.12), transparent 55%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

.wide {
  max-width: 1100px;
}

/* Header */
header {
  padding: 28px 0 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}
.brand-mark .dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 16px var(--pixel-shadow);
}

/* Hero */
.hero {
  padding: 80px 0 48px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(36px, 7vw, 64px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  background: linear-gradient(180deg, #fff 30%, #c8d0e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .kicker {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  background: rgba(108, 138, 255, 0.1);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 24px;
  font-weight: 600;
}
.hero .sub {
  font-size: clamp(16px, 2.2vw, 19px);
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 32px;
}
.hero .pixel-dog {
  font-size: 84px;
  filter: drop-shadow(0 12px 28px var(--pixel-shadow));
  margin-bottom: 12px;
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* Waitlist form */
.waitlist {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.waitlist input[type="email"] {
  flex: 1;
  min-width: 220px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.waitlist input[type="email"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(108, 138, 255, 0.18);
}
.waitlist button {
  padding: 14px 22px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(180deg, var(--brand) 0%, #4f6dd9 100%);
  color: white;
  font-weight: 600;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.15s;
  box-shadow: 0 6px 18px rgba(108, 138, 255, 0.35);
}
.waitlist button:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(108, 138, 255, 0.45); }
.waitlist button:active { transform: translateY(0); }
.waitlist button:disabled { opacity: 0.5; cursor: progress; }
.waitlist .hp { position: absolute; left: -9999px; }
.waitlist-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
}
.waitlist-msg {
  margin-top: 16px;
  min-height: 22px;
  font-size: 14px;
  font-weight: 500;
}
.waitlist-msg.ok { color: var(--accent-green); }
.waitlist-msg.err { color: var(--accent-rose); }

/* Features */
.features {
  padding: 64px 0 32px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.feature {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  backdrop-filter: blur(8px);
}
.feature .emoji {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}
.feature h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}
.feature p {
  font-size: 14px;
  color: var(--text-muted);
}

/* Quote / pitch block */
.pitch {
  padding: 56px 0 24px;
  text-align: center;
}
.pitch blockquote {
  font-size: clamp(18px, 3vw, 22px);
  line-height: 1.45;
  color: var(--text);
  max-width: 640px;
  margin: 0 auto;
  font-weight: 500;
}
.pitch blockquote::before, .pitch blockquote::after {
  content: '"';
  color: var(--brand);
  font-size: 36px;
  font-weight: 700;
  line-height: 0.2;
  vertical-align: -0.4em;
  margin: 0 4px;
}

/* Footer */
footer {
  padding: 64px 0 40px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
footer a { color: var(--text-muted); margin: 0 8px; }

/* Privacy / join page */
.doc {
  padding: 64px 0;
}
.doc h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}
.doc .lede {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 16px;
}
.doc h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
}
.doc p, .doc li {
  font-size: 15px;
  color: #e2e6f0;
  margin-bottom: 12px;
}
.doc ul, .doc ol { padding-left: 22px; }
.doc strong { color: white; }
.doc .meta {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 48px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* Join page CTA */
.join-card {
  margin: 48px auto 0;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 32px;
  text-align: center;
}
.join-card .code {
  display: inline-block;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 28px;
  letter-spacing: 6px;
  font-weight: 700;
  padding: 8px 18px;
  background: rgba(108, 138, 255, 0.12);
  border-radius: 10px;
  margin: 12px 0 24px;
}
.btn-primary {
  display: inline-block;
  padding: 14px 28px;
  background: linear-gradient(180deg, var(--brand) 0%, #4f6dd9 100%);
  color: white;
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(108, 138, 255, 0.35);
}
.btn-primary:hover { text-decoration: none; transform: translateY(-1px); }
.btn-secondary {
  display: inline-block;
  padding: 10px 18px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  margin-top: 12px;
}

/* Live Park Demo
   ============================================================ */
.park-frame {
  position: relative;
  width: 100%;
  max-width: 1040px;
  margin: 32px auto 24px;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(255,255,255,0.06);
  cursor: pointer;
  touch-action: manipulation;
}

/* Top-down 2D park — the whole frame is a tiled grass texture (RPG-style).
   A 32x32 SVG tile with grass blades and a checkerboard-ish two-tone base
   repeats across the canvas. No sky, no horizon. */
.park-flat {
  background-color: #6cc578;
  background-image:
    /* Tiled 32x32 SVG grass — base + small blades + tiny flowers */
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32' shape-rendering='crispEdges'>\
<rect width='32' height='32' fill='%236cc578'/>\
<rect x='0' y='0' width='16' height='16' fill='%2367c074'/>\
<rect x='16' y='16' width='16' height='16' fill='%2367c074'/>\
<rect x='3' y='9' width='1' height='2' fill='%23498b53'/>\
<rect x='4' y='10' width='1' height='1' fill='%233e7b48'/>\
<rect x='11' y='4' width='1' height='2' fill='%23498b53'/>\
<rect x='10' y='5' width='1' height='1' fill='%233e7b48'/>\
<rect x='20' y='6' width='1' height='2' fill='%23498b53'/>\
<rect x='21' y='7' width='1' height='1' fill='%233e7b48'/>\
<rect x='25' y='13' width='1' height='2' fill='%23498b53'/>\
<rect x='26' y='14' width='1' height='1' fill='%233e7b48'/>\
<rect x='7' y='22' width='1' height='2' fill='%23498b53'/>\
<rect x='8' y='23' width='1' height='1' fill='%233e7b48'/>\
<rect x='15' y='20' width='1' height='2' fill='%23498b53'/>\
<rect x='14' y='21' width='1' height='1' fill='%233e7b48'/>\
<rect x='22' y='27' width='1' height='2' fill='%23498b53'/>\
<rect x='23' y='28' width='1' height='1' fill='%233e7b48'/>\
<rect x='28' y='2' width='1' height='2' fill='%23498b53'/>\
<rect x='27' y='3' width='1' height='1' fill='%233e7b48'/>\
<rect x='17' y='13' width='1' height='1' fill='%23f7d97a'/>\
<rect x='5' y='27' width='1' height='1' fill='%23eaa6c0'/>\
</svg>");
  background-repeat: repeat;
  background-size: 64px 64px;  /* 32px tile drawn at 2x for chunkier RPG feel */
  image-rendering: pixelated;
}
.park-flat::after {
  /* Soft vignette overlay — sits above the canvas, pointer-events: none so clicks still hit */
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.22) 100%);
  z-index: 4;
}
#park-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}
.park-hint {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  color: rgba(0, 0, 0, 0.55);
  background: rgba(255, 255, 255, 0.78);
  padding: 4px 12px;
  border-radius: 999px;
  pointer-events: none;
  font-weight: 600;
  letter-spacing: 0.04em;
  z-index: 5;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.park-hud {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  pointer-events: none;
}
.hud-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 6px;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  backdrop-filter: blur(8px);
}
.hud-icon {
  width: 22px; height: 22px;
  image-rendering: pixelated;
}

/* Session summary overlay (in-park modal) */
.session-summary {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.session-summary.visible {
  opacity: 1;
  pointer-events: auto;
}
.summary-card {
  background: linear-gradient(180deg, #1a223f 0%, #131a30 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 18px;
  padding: 24px 28px;
  min-width: 280px;
  max-width: 90%;
  text-align: center;
  box-shadow: 0 22px 60px rgba(0,0,0,0.5);
  transform: scale(0.95);
  transition: transform 0.25s;
}
.session-summary.visible .summary-card { transform: scale(1); }
.summary-kicker {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 12px;
}
.summary-silver {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: white;
  margin-bottom: 4px;
}
.summary-silver small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.summary-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.summary-loot {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  margin: 8px 0 18px;
}
.summary-loot img {
  width: 64px; height: 64px;
  image-rendering: pixelated;
  margin-bottom: 8px;
}
.summary-loot-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.summary-loot-name {
  font-size: 17px;
  font-weight: 700;
  color: white;
}
.summary-loot-rarity {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  margin-top: 2px;
}

/* Session button */
.session-bar {
  margin: 18px auto 4px;
  max-width: 540px;
  text-align: center;
  padding: 0 12px;
}
.session-btn {
  display: inline-block;
  padding: 14px 36px;
  border: none;
  border-radius: 14px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: white;
  background: linear-gradient(180deg, var(--brand-warm) 0%, #e08e3a 100%);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 179, 94, 0.35);
  transition: transform 0.08s, box-shadow 0.15s;
  letter-spacing: 0.02em;
}
.session-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(255, 179, 94, 0.5); }
.session-btn:active { transform: translateY(0); }
.session-btn:disabled, .session-btn.active {
  background: linear-gradient(180deg, #6c8aff 0%, #4f6dd9 100%);
  box-shadow: none;
  cursor: progress;
  animation: sessionPulse 1.6s ease-in-out infinite;
}
@keyframes sessionPulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}
.session-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-dim);
}

/* Breed picker (debug-mode breed selector) */
.breed-picker {
  margin: 8px auto 18px;
  max-width: 720px;
}
.breed-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: x proximity;
  padding: 6px 4px 12px;
  -webkit-overflow-scrolling: touch;
}
.breed-strip::-webkit-scrollbar { height: 6px; }
.breed-strip::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }
.breed-pill {
  flex: 0 0 auto;
  scroll-snap-align: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-transform: capitalize;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.breed-pill img {
  width: 28px; height: 28px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.2));
}
.breed-pill:hover { background: rgba(255, 255, 255, 0.08); }
.breed-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: 0 4px 14px rgba(108, 138, 255, 0.35);
}

/* Item palette */
.palette-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  max-width: 720px;
  margin: 12px auto 6px;
  padding: 0 4px;
}
.item-palette {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  padding: 6px 4px 8px;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.item-palette::-webkit-scrollbar { height: 6px; }
.item-palette::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 999px; }
.item-pill {
  flex: 0 0 auto;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
  min-width: 58px;
}
.item-pill img {
  width: 32px; height: 32px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.item-pill:hover { background: rgba(255, 255, 255, 0.08); }
.item-pill.active {
  background: rgba(255, 179, 94, 0.18);
  border-color: var(--brand-warm);
  box-shadow: 0 4px 14px rgba(255, 179, 94, 0.25);
}
.clear-btn {
  flex: 0 0 auto;
  align-self: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.clear-btn:hover { background: rgba(255, 138, 163, 0.15); color: var(--accent-rose); border-color: var(--accent-rose); }

.state-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 16px auto 6px;
  max-width: 640px;
}
.state-bar button {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.state-bar button:hover { background: rgba(255, 255, 255, 0.08); }
.state-bar button:active { transform: translateY(1px); }
.state-bar button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  box-shadow: 0 4px 14px rgba(108, 138, 255, 0.35);
}
.park-status {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 6px;
  font-variant: small-caps;
  letter-spacing: 0.08em;
}
.park-status span {
  color: var(--brand);
  font-weight: 700;
  margin-left: 4px;
}

.waitlist-wrap {
  margin-top: 36px;
}

/* Responsive */
@media (max-width: 600px) {
  .hero { padding: 56px 0 32px; }
  .features { padding: 40px 0; }
  .pitch { padding: 40px 0; }
  footer { padding: 48px 0 32px; }
  .park-frame { aspect-ratio: 4 / 3; }
  .state-bar button { padding: 7px 11px; font-size: 12px; }
}

/* ===========================================================
   Game top bar — dog name, wallet, shop/backpack/profile
   =========================================================== */
.game-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px auto 16px;
  max-width: 720px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(8px);
}
.game-top-dog {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
}
.brand-dot {
  width: 9px; height: 9px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 12px var(--pixel-shadow);
}
.dog-name {
  font-weight: 800;
  letter-spacing: -0.01em;
}
.game-top-wallet { display: inline-flex; gap: 8px; }
.wallet-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px 5px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
}
.wallet-pill.silver { color: #d2c8ad; }
.wallet-pill.gold   { color: #ffd76a; }
.wallet-pill.large {
  font-size: 26px;
  padding: 10px 18px;
  font-weight: 800;
}
.wallet-pill.large small {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-left: 4px;
}
.wallet-icon { font-size: 16px; }
.game-top-buttons { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.top-btn {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, transform 0.06s;
}
.top-btn:hover { background: rgba(255,255,255,0.1); }
.top-btn:active { transform: translateY(1px); }

/* State debug collapse */
.state-debug {
  margin: 16px auto;
  max-width: 720px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}
.state-debug summary {
  cursor: pointer;
  padding: 4px 8px;
  user-select: none;
}

/* Inventory palette — depleted state */
.item-pill.depleted {
  opacity: 0.4;
  cursor: not-allowed;
}
.item-pill .item-qty {
  position: absolute;
  top: 4px; right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--brand);
  background: rgba(0,0,0,0.5);
  padding: 1px 5px;
  border-radius: 999px;
}
.item-pill { position: relative; }
.palette-empty {
  flex: 1;
  text-align: center;
  padding: 18px 12px;
  color: var(--text-dim);
  font-size: 13px;
  font-style: italic;
}

/* Session button — when active */
.session-bar { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; max-width: 540px; margin: 18px auto 4px; padding: 0 12px; align-items: center; }
.session-bar .session-note { width: 100%; margin-top: 8px; }

/* ===========================================================
   Modal system — onboarding, shop, backpack, profile, convert, summary
   =========================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 12, 22, 0.78);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.modal-overlay.visible { opacity: 1; }

.modal-card {
  background: linear-gradient(180deg, #1a223f 0%, #131a30 100%);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 22px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform: scale(0.96);
  transition: transform 0.22s ease;
}
.modal-overlay.visible .modal-card { transform: scale(1); }

.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.modal-close:hover { background: rgba(255,255,255,0.1); color: var(--text); }

.modal-header h2 { font-size: 24px; margin-bottom: 4px; }
.modal-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 16px; }
.modal-section-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 700;
}

body.modal-open { overflow: hidden; }
body.holding-item, body.holding-item .park-frame { cursor: grabbing !important; }
body.holding-item #park-stage { cursor: crosshair !important; }

/* Onboarding */
.modal-onboarding .modal-card { max-width: 520px; }
.ob-kicker {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
  margin-bottom: 8px;
}
.ob-step h2 {
  font-size: 30px;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin-bottom: 8px;
}
.ob-sub {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 20px;
}
.ob-input {
  width: 100%;
  padding: 16px 18px;
  font-size: 18px;
  font-family: inherit;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  outline: none;
  margin-bottom: 8px;
}
.ob-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(108,138,255,0.2);
}
.ob-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}
.ob-breed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
  margin: 16px 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.ob-breed-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 2px solid transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.ob-breed-pill img {
  width: 32px; height: 32px;
  image-rendering: pixelated;
}
.ob-breed-pill:hover { background: rgba(255,255,255,0.08); }
.ob-breed-pill.active {
  border-color: var(--brand);
  background: rgba(108,138,255,0.15);
}
.ob-breed-meta {
  text-align: center;
  margin: 12px 0;
}
.ob-breed-name {
  font-weight: 700;
  font-size: 18px;
  text-transform: capitalize;
}
.ob-breed-fact {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  margin-top: 4px;
}
.ob-final-sprite {
  display: block;
  margin: 16px auto;
  width: 128px; height: 128px;
  image-rendering: pixelated;
  filter: drop-shadow(0 12px 24px rgba(108,138,255,0.3));
}
.ob-big {
  width: 100%;
  padding: 16px;
  font-size: 17px;
}

/* Shop */
.modal-shop .modal-card { max-width: 760px; padding: 0; }
.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 28px 14px;
  border-bottom: 1px solid var(--border);
}
.shop-header h2 { font-size: 22px; }
.wallet-pills { display: flex; gap: 8px; }
.shop-tabs {
  display: flex;
  gap: 4px;
  padding: 12px 28px 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}
.shop-tab {
  padding: 8px 14px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.1s, background 0.1s;
}
.shop-tab.active {
  color: var(--text);
  background: rgba(108,138,255,0.18);
}
.shop-tab:hover:not(.active) { color: var(--text); background: rgba(255,255,255,0.04); }
.shop-body { padding: 16px 28px 28px; max-height: 60vh; overflow-y: auto; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.shop-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: center;
  position: relative;
}
.shop-item-img {
  width: 48px; height: 48px;
  image-rendering: pixelated;
}
.shop-item-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.shop-item-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.3;
  min-height: 28px;
}
.shop-item-owned {
  font-size: 10px;
  color: var(--accent-green);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.shop-buy {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(180deg, var(--brand) 0%, #4f6dd9 100%);
  color: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.shop-buy:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(108,138,255,0.4); }
.shop-buy.disabled, .shop-buy[disabled] {
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}
.shop-buy-icon { font-size: 14px; }

/* Backpack */
.backpack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.backpack-item {
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border: 2px solid var(--border);
  border-radius: 12px;
}
.backpack-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.backpack-rarity {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-bottom: 6px;
}
.backpack-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.backpack-when { font-size: 10px; color: var(--text-dim); margin-top: 8px; }

/* Profile */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.profile-portrait {
  width: 72px; height: 72px;
  image-rendering: pixelated;
  filter: drop-shadow(0 6px 14px rgba(108,138,255,0.25));
}
.profile-header h2 { font-size: 24px; margin-bottom: 4px; text-transform: capitalize; }
.profile-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.profile-dot { color: var(--text-dim); }
.profile-fact {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 4px;
}
.profile-section { margin-bottom: 22px; }
.profile-section h3 {
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 10px;
}
.trait-grid { display: flex; flex-direction: column; gap: 8px; }
.trait-row {
  display: grid;
  grid-template-columns: 80px 1fr 90px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.trait-label { font-weight: 700; }
.trait-track {
  position: relative;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.trait-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-rose), var(--brand-warm), var(--accent-green));
}
.trait-midline {
  position: absolute;
  top: -2px; bottom: -2px;
  left: 50%;
  width: 1px;
  background: rgba(255,255,255,0.2);
}
.trait-pos { color: var(--text-muted); font-style: italic; text-align: right; font-size: 11px; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.stat-tile {
  padding: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.stat-label { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.stat-big { font-size: 22px; font-weight: 800; margin: 4px 0 2px; }
.stat-small { font-size: 11px; color: var(--text-muted); }
.wallet-row { display: flex; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.session-list { display: flex; flex-direction: column; gap: 6px; }
.session-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  font-size: 12px;
}
.session-when { color: var(--text-muted); flex: 1; }
.session-dur { color: var(--text); font-weight: 600; }
.session-silver { color: #d2c8ad; font-weight: 700; }
.session-medal {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.session-medal.bronze { background: rgba(205, 127, 50, 0.2); color: #cd7f32; }
.session-medal.silver { background: rgba(192, 192, 192, 0.2); color: #c0c0c0; }
.session-medal.gold { background: rgba(255, 215, 0, 0.2); color: #ffd700; }
.session-medal.diamond { background: rgba(108, 138, 255, 0.2); color: var(--brand); }
.btn-danger {
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent-rose);
  background: transparent;
  color: var(--accent-rose);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(255, 138, 163, 0.1); }

/* Convert */
.convert-tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}
.convert-tab {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.convert-tab.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}
.convert-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  background: rgba(255,255,255,0.04);
  border-radius: 14px;
  margin-bottom: 16px;
  justify-content: center;
}
.convert-from, .convert-to { flex: 1; text-align: center; }
.convert-big { font-size: 28px; font-weight: 800; }
.convert-unit {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  font-weight: 600;
  margin-top: 2px;
}
.convert-arrow { font-size: 20px; color: var(--text-dim); }
.convert-slider {
  width: 100%;
  margin: 12px 0 8px;
  -webkit-appearance: none;
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  outline: none;
}
.convert-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--brand);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid #fff;
}
.convert-amount {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Session summary modal (overrides v2 in-park summary; uses generic modal now) */
.modal-summary .summary-silver-big {
  font-size: 56px;
  font-weight: 900;
  text-align: center;
  letter-spacing: -0.03em;
  margin: 8px 0 4px;
  background: linear-gradient(180deg, #fff 0%, #c8d0e8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.modal-summary .summary-silver-big small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  -webkit-text-fill-color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 4px;
}
.summary-section { margin-top: 22px; }
.summary-discoveries {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.summary-discovery {
  padding: 10px 8px;
  background: rgba(255,255,255,0.04);
  border: 2px solid;
  border-radius: 10px;
  text-align: center;
}
.summary-discovery-name { font-weight: 700; font-size: 13px; }
.summary-discovery-rarity {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  margin-top: 2px;
}

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--brand) 0%, #4f6dd9 100%);
  color: white;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(108,138,255,0.35);
  transition: transform 0.08s, box-shadow 0.15s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(108,138,255,0.45); }
.btn-primary[disabled] {
  background: rgba(255,255,255,0.06);
  color: var(--text-dim);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-secondary {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); }

.park-hint.session-active {
  background: rgba(108, 138, 255, 0.92);
  color: white;
}

/* Mobile */
@media (max-width: 600px) {
  .game-top { flex-direction: column; align-items: stretch; }
  .game-top-buttons { justify-content: space-around; }
  .modal-card { padding: 20px 16px 16px; border-radius: 18px; }
  .trait-row { grid-template-columns: 70px 1fr; }
  .trait-pos { display: none; }
}
