/* Voxlings — app stylesheet. The app sets its own palette (see js/theme.js): a cute purple default and a
 * location palette while browsing or playing a biome. The tokens below are the first-paint defaults. */
@font-face {
  font-family: 'Cherry Bomb One';
  src: url('../fonts/CherryBombOne-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('../fonts/Nunito-Variable.woff2') format('woff2');
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}
:root {
  color-scheme: light;
  --bg: #f2edfb;
  --bg-2: #e6dcf6;
  --surface: rgba(255, 255, 255, 0.74);
  --surface-solid: #f8f5fd;
  --surface-2: rgba(160, 130, 230, 0.14);
  --text: #2b2242;
  --muted: #776d93;
  --line: rgba(43, 34, 66, 0.08);
  --accent: #8656e6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(134, 86, 230, 0.16);
  --accent-deep: #6f42cc;
  --accent-2: #ff8a5b;
  --gold: #e9a92c;
  --gold-soft: rgba(233, 169, 44, 0.18);
  --danger: #e05a6a;
  --danger-soft: rgba(224, 90, 106, 0.12);
  --hp: #4fc07a;
  --xp: #6f8cff;
  --shiny: #f7c948;
  --shadow: 0 10px 30px rgba(70, 40, 120, 0.14), 0 2px 6px rgba(70, 40, 120, 0.08);
  --shadow-sm: 0 4px 14px rgba(70, 40, 120, 0.1);
  --nav-bg: rgba(255, 255, 255, 0.7);
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t: 200ms;
  --font-body: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: 'Cherry Bomb One', 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  transition: background-color 350ms var(--ease), color 350ms var(--ease);
  line-height: 1.4;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* Non-interactive chrome must not be selectable; inputs and content areas opt back in. */
.app, .nav, .loading, .topbar, .hud, h1, h2, h3, label, .chip, .btn { user-select: none; -webkit-user-select: none; }
input, textarea, .selectable, .prose, .note-text { user-select: text; -webkit-user-select: text; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; margin: 0; }
img { max-width: 100%; display: block; }
canvas { display: block; }
[hidden] { display: none !important; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 28px; height: 28px; }

/* ---------- Loading screen ---------- */
.loading {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  transition: opacity 350ms var(--ease), visibility 0s linear 350ms;
}
.loading.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loading__logo { display: flex; gap: 6px; }
.loading__cube { width: 18px; height: 18px; border-radius: 5px; background: var(--accent); animation: bob 1.1s var(--ease) infinite; }
.loading__cube:nth-child(2) { background: var(--accent-2); animation-delay: 0.15s; }
.loading__cube:nth-child(3) { background: var(--gold); animation-delay: 0.3s; }
.loading__cube:nth-child(4) { background: #6f8cff; animation-delay: 0.45s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.loading__wordmark { width: min(64vw, 260px); height: auto; }
.loading__sub { color: var(--muted); font-size: 13px; }

/* ---------- App shell ---------- */
.app { position: fixed; inset: 0; overflow: hidden; }
.screens { position: absolute; inset: 0; }
.screen {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px calc(env(safe-area-inset-bottom, 0px) + 104px);
  opacity: 0; transform: translateY(10px); visibility: hidden; pointer-events: none;
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease), visibility 0s linear var(--t);
}
.screen.is-active { opacity: 1; transform: none; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.screen--full { padding: 0; overflow: hidden; }
.screen__inner { max-width: 640px; margin: 0 auto; }
.no-nav .screen { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); }

/* ---------- Typography ---------- */
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1, h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: 0.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.display { font-family: var(--font-display); font-weight: 400; }
.sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }
.small { font-size: 13px; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.section { margin-top: 22px; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; gap: 12px; }
.section__head h2 { flex: none; }
.section__head .small { text-align: right; }
.link { color: var(--accent); font-weight: 600; text-decoration: none; }
.prose { line-height: 1.55; }
.prose p { margin: 0 0 12px; }

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 12px; }
.topbar h1 { flex: 1; font-size: 26px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 999px;
  background: var(--surface-solid); color: var(--text); font-weight: 700; font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms var(--ease), background var(--t), opacity var(--t), box-shadow var(--t);
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn { transition: transform 150ms var(--ease), background-color 350ms var(--ease), color 350ms var(--ease), opacity var(--t), box-shadow var(--t); }
.btn--accent { background: var(--accent-2); color: #fff; }
.btn--ghost { background: var(--surface-2); box-shadow: none; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger-soft { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.btn--gold { background: var(--gold); color: #3a2a05; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--icon { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; background: var(--surface-2); box-shadow: none; }
.btn--lg { min-height: 54px; font-size: 17px; }
@media (hover: hover) {
  .btn:hover { box-shadow: var(--shadow); }
  .btn--ghost:hover, .btn--icon:hover { background: var(--surface); }
}

/* ---------- Cards & layout ---------- */
.card {
  background: var(--surface); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  transition: background-color 350ms var(--ease), border-color 350ms var(--ease), box-shadow var(--t);
}
.card--tap { cursor: pointer; transition: transform 150ms var(--ease), box-shadow var(--t); }
.card--tap:active { transform: scale(0.985); }
@media (hover: hover) { .card--tap:hover { box-shadow: var(--shadow); } }
.card--flat { background: var(--surface-2); box-shadow: none; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack--sm { gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.mt-lg { margin-top: 20px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; background: var(--surface-2); color: var(--muted); line-height: 1.3;
}
.chip svg.icon { width: 13px; height: 13px; }
.chip--type { --type: #999; background: color-mix(in srgb, var(--type) 20%, transparent); color: color-mix(in srgb, var(--type) 70%, var(--text)); }
.chip--gold { background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 60%, var(--text)); }
.chip--accent { background: var(--accent-soft); color: var(--accent); }
.chip--danger { background: var(--danger-soft); color: var(--danger); }
.chip--solid { background: var(--text); color: var(--bg); }
.coins { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--gold); }
.coins svg.icon { width: 18px; height: 18px; }

.bar { height: 8px; border-radius: 999px; background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; position: relative; }
.bar__fill { height: 100%; border-radius: 999px; background: var(--hp); transition: width 300ms var(--ease); width: 0; }
.bar--xp .bar__fill { background: var(--xp); }
.bar--sm { height: 6px; }
.bar--lg { height: 12px; }

/* ---------- Sprites ---------- */
.sprite { image-rendering: auto; }
.sprite--bob { animation: spriteBob 2.4s ease-in-out infinite; }
@keyframes spriteBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.sprite-box { display: flex; align-items: flex-end; justify-content: center; }
.sprite-box--grey { filter: grayscale(1) opacity(0.55); }
@media (prefers-reduced-motion: reduce) { .sprite--bob, .loading__cube { animation: none; } .screen { transition-duration: 0s; } }

/* ---------- Bottom navigation ---------- */
.nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: min(calc(100% - 32px), 440px); height: 64px; z-index: 40;
  display: flex; align-items: stretch; padding: 6px;
  border-radius: 999px; background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: transform var(--t) var(--ease), opacity var(--t);
}
.nav.is-hidden { transform: translate(-50%, 120px); opacity: 0; pointer-events: none; }
.nav__btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 700;
  transition: background var(--t), color var(--t);
}
.nav__btn.is-active { color: var(--accent); background: var(--accent-soft); }
.nav__btn svg.icon { width: 22px; height: 22px; }
.nav__btn span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Camp (home) ---------- */
.wordmark { display: block; max-width: 100%; height: auto; image-rendering: auto; }
.wordmark-wrap { display: flex; justify-content: center; }
.wordmark-wrap .wordmark { max-width: min(100%, 340px); }
.camp { position: absolute; inset: 0; overflow: hidden; }
.camp__canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: pointer; }
.camp-top { position: absolute; left: 0; right: 0; top: 0; padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 0; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.camp-top > * { pointer-events: none; }
.camp-top > * > * { pointer-events: auto; }
.camp-top__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.camp-top .wordmark { height: 32px; width: auto; filter: drop-shadow(0 2px 4px rgba(40, 25, 70, 0.25)); }
.hud-pill--gold { color: color-mix(in srgb, var(--gold) 70%, var(--text)); font-weight: 800; }
.camp-greet { font-size: 12px; color: var(--muted); gap: 6px; height: 32px; padding: 0 12px; min-width: 0; }
.camp-greet strong { color: var(--text); white-space: nowrap; }
.camp-greet span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-progress { height: 32px; padding: 0 12px; font-size: 12px; color: var(--accent); }
.camp-board { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 90px); padding: 0 12px; display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.camp-daily {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 10px 0 6px; border-radius: 999px; min-width: 0;
  background: var(--nav-bg); backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: var(--shadow-sm); font-size: 13px; text-align: left; color: var(--text);
  transition: transform 150ms var(--ease);
}
.camp-daily:active { transform: scale(0.98); }
.camp-daily__icon { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.camp-daily__text { display: flex; gap: 6px; min-width: 0; flex: 1; align-items: baseline; }
.camp-daily__text strong { white-space: nowrap; }
.camp-daily > svg.icon { color: var(--accent); }
.camp-card {
  display: grid; grid-template-columns: 64px 1fr; gap: 10px 12px; align-items: center; padding: 10px;
  background: var(--nav-bg); backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5);
  border-radius: 18px; border: 1px solid var(--line); box-shadow: var(--shadow);
}
.camp-card__art { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: var(--bg-2); }
.camp-card__art canvas { width: 100%; height: 100%; }
.camp-card h3 { font-size: 15px; margin-top: 2px; }
.camp-card .adv-meta { margin-top: 5px; }
.camp-card__actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.camp-card__actions .btn--ghost { background: var(--surface-solid); }
.camp-bubble {
  position: absolute; left: 0; top: 0; z-index: 3; display: flex; align-items: center; gap: 6px; padding: 7px 10px 7px 12px; border-radius: 14px;
  background: #ffffff; color: var(--text); box-shadow: var(--shadow); font-size: 13px; white-space: nowrap; cursor: pointer;
  animation: bubbleIn 220ms var(--ease); will-change: transform;
}
.camp-bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 12px; height: 12px; background: #ffffff; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.camp-bubble__name { font-weight: 800; }
.camp-bubble__meta { color: var(--muted); font-size: 12px; }
.camp-bubble__chip { font-size: 11px; }
.camp-bubble__go { color: var(--accent); }
@keyframes bubbleIn { from { opacity: 0; scale: 0.85; } to { opacity: 1; scale: 1; } }
@media (prefers-reduced-motion: reduce) { .camp-bubble { animation: none; } }

/* ---------- Party strip (Party screen) ---------- */
.party-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.party-slot {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 130px; text-align: center; cursor: pointer;
  transition: transform 150ms var(--ease);
}
.party-slot:active { transform: scale(0.97); }
.party-slot--empty { border-style: dashed; color: var(--muted); justify-content: center; }
/* Fixed art area so names, levels and bars line up across the three slots; oversized sprites scale to fit. */
.party-slot .sprite-box { height: 64px; width: 100%; }
.party-slot .sprite-box img { max-height: 100%; width: auto; }
.party-slot__name { font-weight: 700; font-size: 13px; max-width: 100%; line-height: 1.3; min-height: 17px; }
.party-slot__lvl { font-size: 11px; color: var(--muted); font-weight: 700; line-height: 1.3; }
.party-slot .bar { width: 100%; margin-top: auto; }
.dots { display: flex; gap: 5px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--text) 14%, transparent); }
.dot.is-done { background: var(--accent); }
.dot.is-next { background: var(--gold); }

/* ---------- World map ---------- */
.trail { position: relative; margin-top: 4px; }
.trail__path { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.trail__path path { fill: none; stroke: color-mix(in srgb, var(--accent) 50%, transparent); stroke-width: 4; stroke-dasharray: 1 11; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.trail-node { position: absolute; width: 46%; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: var(--text); }
.trail-node--left { left: 4%; }
.trail-node--right { right: 4%; }
.trail-node__art { position: relative; width: 96px; height: 96px; border-radius: 50%; overflow: hidden; border: 4px solid #ffffff; box-shadow: var(--shadow); background: var(--bg-2); display: block; transition: transform 150ms var(--ease), box-shadow var(--t); }
.trail-node:active .trail-node__art { transform: scale(0.95); }
.trail-node__art canvas { width: 100%; height: 100%; display: block; }
.trail-node--locked .trail-node__art canvas { filter: grayscale(0.85) brightness(0.85); }
.trail-node__lock { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(30, 20, 50, 0.4); color: #ffffff; }
.trail-node__crown { position: absolute; right: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; background: var(--gold); color: #3a2a05; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(120, 80, 0, 0.3); }
.trail-node--next .trail-node__art { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow); animation: readyPulse 1.6s ease-in-out infinite; }
.trail-node--done .trail-node__art { border-color: var(--gold); }
.trail-node__body { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.trail-node__name { font-family: var(--font-display); font-size: 16px; line-height: 1.15; }
.trail-node--locked { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .trail-node--next .trail-node__art { animation: none; } }

/* ---------- Location ---------- */
.loc-hero { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); position: relative; }
.loc-hero canvas { width: 100%; height: 170px; display: block; }
.loc-hero__caption { position: absolute; left: 14px; bottom: 12px; right: 14px; color: #fff; text-shadow: 0 1px 6px rgba(0,0,0,0.5); }
.adv-trail { gap: 14px; }
.adv-card { display: flex; align-items: center; gap: 12px; position: relative; }
.adv-trail .adv-card:not(:first-child)::before { content: ""; position: absolute; left: 35px; top: -15px; height: 15px; border-left: 3px dotted color-mix(in srgb, var(--accent) 50%, transparent); }
.adv-card__num { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 800; flex: none; }
.adv-card--boss .adv-card__num { background: var(--danger-soft); color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.adv-card--cleared .adv-card__num { background: var(--gold-soft); color: var(--gold); }
.adv-card--locked { opacity: 0.55; }
.adv-card--locked .adv-card__num { background: var(--surface-2); color: var(--muted); }
.adv-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.found-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.found-strip .mini { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.found-strip .mini img { max-height: 30px; width: auto; }
.found-strip .mini--unknown { color: var(--muted); font-weight: 800; font-size: 14px; }

/* ---------- Party & creature ---------- */
.box-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.mon-cell {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px 6px 8px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; position: relative; transition: transform 150ms var(--ease);
}
.mon-cell:active { transform: scale(0.96); }
.mon-cell__name { font-size: 12px; font-weight: 700; max-width: 100%; }
.mon-cell__lvl { font-size: 11px; color: var(--muted); font-weight: 700; }
.mon-cell__badge { position: absolute; top: 6px; right: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--gold); color: #3a2a05; display: grid; place-items: center; }
.mon-cell__badge svg.icon { width: 12px; height: 12px; stroke-width: 3; }
.mon-cell--party { border-color: var(--accent); }
.creature-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 12px 14px; }
.creature-hero .sprite-box { min-height: 120px; }
.stat-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stat-row:last-child { border-bottom: 0; }
.stat-row__icon { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); flex: none; }
.stat-row__val { font-weight: 800; font-size: 17px; min-width: 40px; text-align: right; }
.stat-row__focus { font-size: 11px; color: var(--accent); font-weight: 700; }
.moves-list .move { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.moves-list .move:last-child { border-bottom: 0; }
.move__icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; flex: none; }
.levelup-panel { background: var(--accent-soft); border-radius: var(--radius); padding: 14px; }
.focus-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.focus-btn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; background: var(--surface-solid); box-shadow: var(--shadow-sm); font-weight: 700; font-size: 14px; text-align: left; }
.focus-btn:active { transform: scale(0.97); }
.confirm-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Field notes ---------- */
.dex-summary { display: flex; align-items: center; gap: 14px; }
.dex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.dex-cell {
  aspect-ratio: 1 / 1.15; border-radius: 14px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; cursor: pointer; text-align: center;
  transition: transform 150ms var(--ease);
}
.dex-cell:active { transform: scale(0.96); }
.dex-cell__no { font-size: 10px; color: var(--muted); font-weight: 700; }
.dex-cell__name { font-size: 11px; font-weight: 700; max-width: 100%; }
.dex-cell__q { font-size: 26px; font-weight: 800; color: color-mix(in srgb, var(--text) 30%, transparent); }
.dex-cell--unknown { background: var(--surface-2); }
.dex-cell--met .sprite-box { filter: grayscale(1) opacity(0.5); }
.dex-cell--met .dex-cell__name { color: var(--muted); }
.dex-cell--collected { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.filter-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin: 16px -16px 6px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-btn { flex: none; padding: 7px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.filter-btn.is-active { background: var(--text); color: var(--bg); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 700; }
.input, .textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; background: var(--surface-solid); color: var(--text);
  outline: none; transition: border-color var(--t), box-shadow var(--t);
}
.input:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field.is-error .input, .field.is-error .textarea { border-color: var(--danger); }
.field__hint { font-size: 12px; color: var(--muted); }
.field__error { font-size: 12px; color: var(--danger); font-weight: 600; }
.field__error:empty { display: none; }
.textarea { min-height: 96px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle:last-child { border-bottom: 0; }
.switch { width: 48px; height: 28px; border-radius: 999px; background: color-mix(in srgb, var(--text) 18%, transparent); position: relative; transition: background var(--t); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.25); transition: transform var(--t) var(--ease); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.settings-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row__icon { width: 36px; height: 36px; border-radius: 11px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); flex: none; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 26px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg.icon { width: 34px; height: 34px; opacity: 0.6; }
.empty strong { color: var(--text); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 12px); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(calc(100% - 32px), 420px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; animation: toastIn 250ms var(--ease); pointer-events: auto; }
.toast--action { cursor: pointer; }
.toast.is-out { opacity: 0; transform: translateY(-8px); transition: opacity 250ms, transform 250ms; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* ---------- Welcome ---------- */
.welcome { min-height: calc(100vh - 120px); min-height: calc(100svh - 120px); display: flex; flex-direction: column; justify-content: center; gap: 18px; text-align: center; padding: 20px 0; }
.welcome__logo { display: flex; justify-content: center; gap: 8px; }
.welcome__logo span { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); animation: bob 1.4s var(--ease) infinite; }
.welcome__logo span:nth-child(2) { background: var(--accent-2); animation-delay: 0.15s; }
.welcome__logo span:nth-child(3) { background: var(--gold); animation-delay: 0.3s; }
.welcome__logo span:nth-child(4) { background: #6f8cff; animation-delay: 0.45s; }
.welcome h1 { font-size: 44px; color: var(--accent); }
.reveal { animation: reveal 500ms var(--ease); }
@keyframes reveal { from { opacity: 0; transform: scale(0.85) translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Adventure ---------- */
.adventure { position: absolute; inset: 0; background: var(--bg); }
.adventure canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud { position: absolute; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between; }
.hud > * { pointer-events: auto; }
.hud-top { display: flex; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 0; }
.hud-pill { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--nav-bg); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--shadow-sm); border: 1px solid var(--line); font-weight: 700; font-size: 13px; }
.hud-pill--btn { cursor: pointer; }
.hud-pill--btn:active { transform: scale(0.96); }
.hud-pill--danger { color: var(--danger); }
.hud-title { flex: 1; text-align: center; min-width: 0; }
.hud-title__name { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title__wave { font-size: 12px; color: var(--muted); font-weight: 700; }
.hud-msg { position: absolute; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top, 0px) + 66px); background: rgba(20,16,28,0.6); color: #fff; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; opacity: 0; transition: opacity 250ms; white-space: nowrap; max-width: calc(100% - 40px); overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.hud-msg.is-on { opacity: 1; }
.hud-bottom { padding: 0 10px calc(env(safe-area-inset-bottom, 0px) + 12px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hud-card { background: var(--nav-bg); backdrop-filter: blur(16px) saturate(1.5); -webkit-backdrop-filter: blur(16px) saturate(1.5); border-radius: 16px; border: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 6px; box-shadow: var(--shadow-sm); transition: opacity var(--t); }
.hud-card.is-down { opacity: 0.5; }
.hud-card__head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.hud-card__thumb { width: 28px; height: 28px; flex: none; display: flex; align-items: flex-end; justify-content: center; }
.hud-card__thumb img { max-height: 28px; max-width: 28px; }
.hud-card__name { font-size: 12px; font-weight: 800; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.moves-row { display: flex; gap: 6px; justify-content: center; align-items: center; }
.move-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-solid); color: var(--muted); display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: transform 120ms var(--ease), background-color var(--t), color var(--t), opacity var(--t); flex: none; }
.move-btn svg.icon { width: 18px; height: 18px; position: relative; z-index: 1; }
.move-btn__cd { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(30, 20, 50, 0.32) calc(var(--cd, 0) * 100%), transparent 0); pointer-events: none; }
.move-btn.is-ready { background: var(--move-color, var(--accent)); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--move-color, var(--accent)) 35%, transparent), 0 0 16px color-mix(in srgb, var(--move-color, var(--accent)) 55%, transparent); animation: readyPulse 1.3s ease-in-out infinite; }
.move-btn.is-ready:active { transform: scale(0.92); }
.move-btn:disabled { opacity: 0.55; }
.move-btn.is-locked { opacity: 0.4; }
.move-btn.is-locked svg.icon { width: 14px; height: 14px; }
@keyframes readyPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }
@media (prefers-reduced-motion: reduce) { .move-btn.is-ready { animation: none; } }
.hud-card__meta { display: flex; justify-content: space-between; font-size: 10px; font-weight: 800; color: var(--muted); margin-top: -2px; }
.hud-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px; color: #fff; text-align: center; background: rgba(15, 12, 20, 0.35); opacity: 0; transition: opacity 400ms; pointer-events: none; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.hud-overlay.is-on { opacity: 1; }
.hud-overlay h2 { font-size: 34px; }
.hud-overlay .eyebrow { color: rgba(255,255,255,0.8); }
.wave-banner { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%) scale(0.8); background: rgba(20,16,28,0.7); color: #fff; padding: 10px 22px; border-radius: 999px; font-family: var(--font-display); font-size: 22px; opacity: 0; transition: opacity 250ms, transform 300ms var(--ease); pointer-events: none; white-space: nowrap; }
.wave-banner.is-on { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* ---------- Results ---------- */
.result-hero { text-align: center; padding: 12px 0 4px; }
.result-hero h1 { font-size: 32px; color: var(--accent); }
.reward-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.reward-row:last-child { border-bottom: 0; }
.reward-row__icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); flex: none; }
.new-creature { display: flex; align-items: center; gap: 14px; background: var(--accent-soft); border-radius: var(--radius); padding: 14px; }
.xp-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.xp-row .bar { flex: 1; }

/* ---------- Privacy page ---------- */
.page { max-width: 680px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 20px) 20px 60px; }
.page h1 { margin-bottom: 6px; }
.page h2 { margin: 26px 0 8px; font-size: 18px; }
.page ul { padding-left: 20px; }
.page li { margin: 4px 0; }
.page table { width: 100%; border-collapse: collapse; font-size: 14px; }
.page th, .page td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }

/* ---------- Responsive ---------- */
@media (min-width: 720px) {
  .screen { padding-left: 24px; padding-right: 24px; }
  .hud-bottom { max-width: 640px; margin: 0 auto; width: 100%; }
  .hud-top { max-width: 680px; margin: 0 auto; width: 100%; }
  .camp-top { max-width: 720px; margin: 0 auto; }
  .camp-board { max-width: 600px; margin: 0 auto; }
}

/* ---------- Daily bonus, shinies, quick trade ---------- */
.daily-card { position: relative; overflow: hidden; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface-solid)), var(--surface-solid)); }
.daily-card::before { content: ""; position: absolute; right: -30px; top: -30px; width: 120px; height: 120px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, transparent); pointer-events: none; }
.daily-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.daily-card__icon { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.daily-card--done { opacity: 0.85; }
.shiny-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: linear-gradient(135deg, #ffe38a, #f7b733); color: #4a3205; font-size: 11px; font-weight: 900; box-shadow: 0 1px 4px rgba(120, 80, 0, 0.25); }
.shiny-badge svg.icon { width: 12px; height: 12px; stroke-width: 2.5; }
.shiny-mark { position: absolute; top: 6px; left: 6px; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(135deg, #ffe38a, #f7b733); color: #4a3205; display: grid; place-items: center; box-shadow: 0 1px 4px rgba(120, 80, 0, 0.25); }
.shiny-mark svg.icon { width: 12px; height: 12px; stroke-width: 2.5; }
.sprite-box--shiny { background: radial-gradient(closest-side, rgba(247, 201, 72, 0.28), transparent); border-radius: 50%; }
.quick-trade { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lock-chip { display: inline-flex; align-items: center; gap: 4px; }
