﻿/* Pokémon-style game UI: deep navy panels, Poké-yellow accents, pixel display font. */
:root {
  --bg: #0d1226;
  --panel: #141b38;
  --card: #1d2650;
  --card-hi: #263266;
  --ink: #eef1ff;
  --muted: #b6bee3;
  --line: #313d78;
  --gold: #ffcb05;
  --gold-deep: #c79a00;
  --blue: #3d7dca;
  --danger: #ff5c6c;
  --ok: #5ee08a;
  --hud: rgba(13, 18, 38, 0.82);
  --pixel: 'Pixelify Sans', system-ui, sans-serif;
  --display: 'Fredoka', system-ui, sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif;
  /* Phones: quick taps in a row (searching Wild Areas, levelling up, placing) never zoom the page
     in and out; pinch-to-zoom and scrolling still work. */
  touch-action: manipulation;
}

/* (Every control too, for browsers that only honour it on the element tapped.) */
button,
a,
input,
select,
label,
[role='button'] {
  touch-action: manipulation;
}

/* Phones (iOS Safari): focusing a text box or picker under 16px zooms the whole page in, and it
   stays zoomed. Every one is at least 16px on touch screens. */
@media (pointer: coarse) and (max-width: 760px) {
  input:not([type='checkbox'], [type='radio'], [type='range'], [type='color']),
  select,
  textarea {
    font-size: max(16px, 1em) !important;
  }
}

#app {
  display: grid;
  grid-template-columns: 1fr 312px;
  height: 100vh;
}

/* Smaller windows: a slimmer side panel so the map gets more room. */
@media (max-width: 1200px) {
  #app {
    grid-template-columns: 1fr 292px;
  }
}

#stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #13241a;
}

#stage canvas {
  display: block;
  cursor: crosshair;
}

/* ---------- Icons ---------- */
.ico {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  flex: none;
}

.ico.coin {
  background: radial-gradient(circle at 35% 30%, #fff3a6, var(--gold) 55%, var(--gold-deep));
  color: #6b4e00;
  box-shadow: inset 0 0 0 2px #a67c00;
}

.ico.heart {
  background: radial-gradient(circle at 35% 30%, #ff9aa6, #e3243b);
  color: #fff;
  font-size: 11px;
}

/* Poké Ball: red top, white bottom, black band and button. */
.ico.ball {
  background:
    radial-gradient(circle, #fff 0 18%, #222 19% 30%, transparent 31%),
    linear-gradient(#e3243b 0 44%, #222 44% 56%, #f4f4f4 56%);
  box-shadow: inset 0 0 0 2px #222;
}

.ico.ball.big {
  width: 38px;
  height: 38px;
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}

.stat.map-chip {
  padding-left: 12px;
  font-size: 14px;
  color: var(--gold);
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--hud);
  color: #fff;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  border: 2px solid rgba(255, 203, 5, 0.55);
  font-family: var(--display);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

.stat.dim {
  padding-left: 12px;
  border-color: var(--line);
  color: var(--muted);
}

.stat.dim:empty {
  display: none;
}

#toast {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translate(-50%, -6px);
  background: var(--hud);
  color: #fff;
  font-family: var(--display);
  font-size: 16px;
  padding: 7px 16px;
  border-radius: 10px;
  border: 2px solid var(--gold);
  opacity: 0;
  transition:
    opacity 0.25s,
    transform 0.25s;
  pointer-events: none;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

#overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
  background: rgba(5, 8, 20, 0.6);
  backdrop-filter: blur(2px);
}

#overlay[hidden],
#overlay [hidden] {
  display: none;
}

/* (A tip never sits over the results.) */
body:has(#overlay:not([hidden])) .tip-card {
  display: none;
}

.card {
  background: linear-gradient(180deg, var(--card-hi), var(--panel));
  border: 3px solid var(--gold);
  border-radius: 16px;
  padding: 22px 26px;
  min-width: 280px;
  max-width: 90%;
  box-shadow:
    0 0 0 4px #0d1226,
    0 18px 50px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.card h2 {
  margin: 0 0 6px;
  font-family: var(--pixel);
  font-size: 30px;
  color: var(--gold);
  text-shadow: 0 3px 0 #3d4fa0;
}

/* End-of-match results (src/main.js matchSummary) */
#overlay .card {
  max-width: min(520px, 92vw);
  max-height: 92%;
  overflow-y: auto;
}

.ov-summary {
  display: grid;
  gap: 10px;
  margin: 10px 0 14px;
}

.ov-summary:empty {
  display: none;
}

.ov-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ov-stat,
.ov-mvp,
.ov-leaks {
  background: rgba(10, 14, 32, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px;
}

.ov-stat {
  display: grid;
}

.ov-summary small {
  color: #8f9bc8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ov-stat b {
  font-family: var(--pixel);
  font-size: 20px;
  color: #fff;
}

.ov-mvp {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border-color: rgba(255, 204, 51, 0.45);
}

.ov-mvp span {
  display: grid;
}

.ov-mvp small:last-child {
  text-transform: none;
  letter-spacing: 0;
}

.ov-leaks {
  display: grid;
  gap: 4px;
  text-align: left;
}

.ov-leak {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ov-leak em {
  margin-left: auto;
  font-style: normal;
  font-weight: 700;
  color: #ff7a7a;
}

.ov-tip {
  margin: 0;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 204, 51, 0.12);
  border: 1px solid rgba(255, 204, 51, 0.35);
  text-align: left;
  line-height: 1.45;
}

.card .row {
  justify-content: center;
}

/* ---------- Sidebar ---------- */
#side {
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(61, 125, 202, 0.25), transparent 70%),
    linear-gradient(180deg, var(--panel), var(--bg));
  border-left: 3px solid var(--line);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 4px;
  color: inherit;
  text-decoration: none;
}

a.brand:hover h1 {
  filter: brightness(1.15);
}

.brand h1 {
  margin: 0;
  font-family: var(--pixel);
  font-size: 24px;
  line-height: 1;
  color: var(--gold);
  text-shadow:
    0 2px 0 #3d4fa0,
    0 3px 0 #22306e;
  letter-spacing: 0.02em;
}

.brand h1 span {
  display: block;
  font-size: 13px;
  color: var(--ink);
  text-shadow: none;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 3px;
}

.block {
  background: rgba(29, 38, 80, 0.7);
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.block[hidden] {
  display: none;
}

h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}

.row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}

.grow {
  flex: 1;
}

/* ---------- Buttons ---------- */
button {
  font: inherit;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 6px 11px;
  cursor: pointer;
  transition:
    transform 0.08s,
    border-color 0.15s,
    background 0.15s,
    box-shadow 0.15s;
}

button:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--card-hi);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

button.primary {
  font-family: var(--display);
  font-size: 16px;
  background: linear-gradient(180deg, #ffe066, var(--gold) 55%, #f0b400);
  color: #3a2c00;
  border-color: var(--gold-deep);
  box-shadow: 0 3px 0 var(--gold-deep);
}

button.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #fff09a, #ffd633 55%, #f5bd00);
  border-color: var(--gold-deep);
}

button.primary:active:not(:disabled) {
  box-shadow: 0 1px 0 var(--gold-deep);
  transform: translateY(2px);
}

button.danger {
  color: var(--danger);
  border-color: rgba(255, 92, 108, 0.45);
}

button.active {
  border-color: var(--gold);
  color: var(--gold);
}

input[type='number'] {
  width: 80px;
  font: inherit;
  padding: 3px 6px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
}

input[type='checkbox'] {
  accent-color: var(--gold);
}

.check {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
}

details summary {
  cursor: pointer;
  margin: 6px 0;
  color: var(--muted);
}

/* ---------- Shop ---------- */
#shop {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.shop-item {
  --type: var(--blue);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  text-align: center;
  background: var(--card);
  border: 2px solid color-mix(in srgb, var(--type) 45%, var(--line));
}

.shop-item:hover:not(:disabled) {
  border-color: var(--type);
  background: var(--card);
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px var(--type),
    0 6px 18px color-mix(in srgb, var(--type) 45%, transparent);
}

.shop-item.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold);
}

/* Header strip in the Pokémon's type colour. */
.shop-head {
  display: block;
  padding: 3px 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

/* Type matchup against the next round, under the price. */
.shop-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.matchup {
  margin-top: 2px;
  padding: 0 5px;
  border-radius: 999px;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-shadow: none;
}

.matchup.strong {
  background: #1f6f3a;
  color: #b9f6ca;
  box-shadow: 0 0 0 1px #5ee08a;
}

.matchup.weak {
  background: #6f1f2a;
  color: #ffcdd2;
  box-shadow: 0 0 0 1px #ff5c6c;
}

/* The next round's wild Pokémon and their types. */
.next-wave {
  margin: 0 0 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.next-wave:empty {
  display: none;
}

.nw-title {
  display: block;
  margin-bottom: 4px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.nw-free {
  color: var(--muted);
}

.nw-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.nw-enemy {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
}

.nw-enemy canvas {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
}

.nw-types {
  display: inline-flex;
  gap: 2px;
  margin-left: 4px;
  vertical-align: 1px;
}

.nw-type {
  padding: 0 4px;
  border-radius: 999px;
  font-style: normal;
  font-size: 8.5px;
  font-weight: 800;
  line-height: 13px;
  text-transform: uppercase;
}

.shop-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 4px 8px 6px;
  background: radial-gradient(60% 90% at 30% 50%, color-mix(in srgb, var(--type) 28%, transparent), transparent 70%);
}

.shop-sprite,
#panel-sprite {
  image-rendering: pixelated;
  flex: none;
}

.shop-item small {
  font-family: var(--display);
  font-size: 15px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.shop-item small::before {
  content: '₽';
  margin-right: 2px;
  opacity: 0.8;
}

.shop-item:disabled {
  opacity: 0.5;
}

.shop-item:disabled .shop-sprite {
  filter: grayscale(1);
}

/* ---------- Selected tower panel ---------- */
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -10px -10px 10px;
  padding: 6px 10px;
  border-radius: 10px 10px 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 20px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

#panel-sprite {
  background: rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.kv dt {
  color: var(--muted);
}

.kv dd {
  margin: 0;
  font-weight: 600;
}

/* ---------- Level and evolution (tower panel) ---------- */
.panel-lv {
  margin-left: auto;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-size: 13px;
  text-shadow: none;
}

.level-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.level-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.level-head b {
  font-family: var(--display);
  font-size: 18px;
  color: var(--gold);
}

.level-head small {
  color: var(--muted);
  font-size: 12px;
}

.level-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.level-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ee08a, #ffcb05);
}

.evo-note {
  color: var(--muted);
  font-size: 12px;
}

.evo-note.ready {
  color: var(--gold);
  font-weight: 700;
}

.evolve-btn {
  width: 100%;
  animation: evolve-glow 1.2s ease-in-out infinite alternate;
}

@keyframes evolve-glow {
  from {
    box-shadow: 0 0 0 rgba(255, 203, 5, 0);
  }
  to {
    box-shadow: 0 0 14px rgba(255, 203, 5, 0.75);
  }
}

/* Mega Evolution: a rainbow button, and the Mega's power shown like its trait. */
.mega-btn {
  width: 100%;
  color: #fff;
  border-color: #ba68c8;
  background: linear-gradient(90deg, #4fc3f7, #ba68c8, #f06292, #ffb74d);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  animation: mega-glow 1s ease-in-out infinite alternate;
}

@keyframes mega-glow {
  from {
    box-shadow: 0 0 0 rgba(186, 104, 200, 0);
  }
  to {
    box-shadow: 0 0 16px rgba(186, 104, 200, 0.9);
  }
}

.mega-box {
  border-color: #ba68c8;
}

.mega-note {
  color: #ce93d8;
}

.level-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.level-buttons button {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px;
  font-family: var(--display);
  font-weight: 700;
}

.level-buttons small {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
}

/* Evolution prompt */
.evolve-row {
  align-items: center;
}

.evolve-arrow {
  font-size: 28px;
  color: var(--gold);
}

.evolve-to canvas {
  animation: evolve-pulse 1s ease-in-out infinite alternate;
}

@keyframes evolve-pulse {
  from {
    filter: brightness(1) drop-shadow(0 0 0 #fff);
  }
  to {
    filter: brightness(1.6) drop-shadow(0 0 10px #fff);
  }
}

.evolve-actions {
  justify-content: center;
  gap: 8px;
}

.note {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* ---------- Collapsible side panel ---------- */
.side-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 50;
  display: flex;
  gap: 6px;
  transition: right 0.22s ease;
}

.side-toggle {
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 203, 5, 0.55);
  background: var(--hud);
  color: #fff;
  font-family: var(--display);
  font-size: 14px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

.side-toggle:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Collapsed: the map takes the full width; the panel slides in over it on demand. */
#app.panel-collapsed {
  grid-template-columns: 1fr;
}

#app.panel-collapsed #side {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 312px;
  z-index: 40;
  transform: translateX(105%);
  transition: transform 0.22s ease;
  box-shadow: -14px 0 34px rgba(0, 0, 0, 0.5);
}

#app.panel-collapsed.panel-open #side {
  transform: none;
}

/* Keep the controls beside the panel while it's slid in. */
#app.panel-collapsed.panel-open .side-controls {
  right: 324px;
}

@media (max-width: 760px) {
  .side-controls {
    display: none;
  }
}

/* ---------- Scrollbar ---------- */
#side::-webkit-scrollbar {
  width: 10px;
}

#side::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 6px;
}

@media (max-width: 760px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: 58vh auto;
    grid-template-rows: 58svh auto;
    height: auto;
    min-height: 100vh;
  }

  #side {
    border-left: none;
    border-top: 3px solid var(--line);
    padding: 12px 16px;
  }
}

/* Small phones held sideways: 58% of a short screen left a strip of map. The map takes the whole
   screen (the panel is still below it). */
@media (max-width: 760px) and (max-height: 500px) {
  #app {
    grid-template-rows: 100vh auto;
    grid-template-rows: 100svh auto;
  }
}

/* Phones held sideways: a picked Pokémon's card is a column down the left, clear of the Fight! box
   on the right, and tutorial tips sit top right while it's open. */
@media (max-height: 500px) {
  #app .poke-card {
    position: fixed;
    top: 8px !important;
    bottom: 8px;
    left: 8px !important;
    right: auto;
    z-index: 60;
    width: min(300px, 48%);
    max-height: none;
  }

  /* (Level-ups and evolving straight after the header, as on phones held upright.) */
  .poke-card:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  .poke-card > * {
    flex: none;
  }

  .poke-card > .pc-head {
    order: -4;
  }

  .poke-card > .pc-evo {
    order: -3;
  }

  .poke-card > .pc-big {
    order: -2;
  }

  .poke-card > .pc-levels {
    order: -1;
  }

  .game-page:has(.poke-card:not([hidden])) .tutorial-card {
    top: 8px;
    right: 8px;
    bottom: auto;
    left: auto;
    width: min(380px, calc(50% - 16px));
    transform: none;
  }
}

/* ================= Pokémon Center (gacha, collection, milestones) ================= */
.ico.sp {
  background: radial-gradient(circle at 35% 30%, #fff, #9be7ff 45%, #3d7dca);
  color: #fff;
  font-size: 12px;
  box-shadow: inset 0 0 0 2px #2b5aa0;
}

.meta-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.meta-bar .sp-balance {
  margin-right: auto;
}

.sp-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  color: #cfe8ff;
}

.meta {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(5, 8, 20, 0.72);
  backdrop-filter: blur(3px);
  padding: 16px;
}

.meta[hidden] {
  display: none;
}

.meta-card {
  width: min(980px, 100%);
  max-height: min(760px, 100%);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(90% 50% at 50% 0%, rgba(61, 125, 202, 0.3), transparent 70%),
    linear-gradient(180deg, var(--card-hi), var(--panel));
  border: 3px solid var(--gold);
  border-radius: 18px;
  box-shadow:
    0 0 0 4px #0d1226,
    0 24px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.meta-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--line);
}

/* On the website the top bar already shows the balance; the Pokémon Center pages don't repeat it
   (the game page's pop-up Pokémon Center still does). */
.meta.inline .meta-head .sp-balance {
  display: none;
}

.meta-head h2 {
  margin: 0 auto 0 0;
  font-family: var(--pixel);
  font-size: 26px;
  color: var(--gold);
  text-shadow: 0 2px 0 #3d4fa0;
}

.meta-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

.meta-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
}

.meta-tabs[hidden] {
  display: none;
}

.meta-tabs button {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px 10px 0 0;
  border-bottom: none;
}

.meta-tabs button[aria-selected='true'] {
  background: var(--gold);
  color: #3a2c00;
  border-color: var(--gold-deep);
}

.meta-body {
  padding: 16px;
  overflow-y: auto;
}

.meta-lead {
  color: var(--muted);
  margin: 0 0 14px;
}

.muted {
  color: var(--muted);
}

.portrait {
  image-rendering: pixelated;
}

.portrait.silhouette {
  filter: brightness(0) opacity(0.35);
}

.type-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Starter pick */
.starter-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.starter-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 10px;
  border: 3px solid color-mix(in srgb, var(--type) 60%, var(--line));
  background: radial-gradient(70% 60% at 50% 35%, color-mix(in srgb, var(--type) 35%, transparent), var(--card) 75%);
}

.starter-card:hover:not(:disabled) {
  border-color: var(--type);
  transform: translateY(-3px);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--type) 45%, transparent);
}

.starter-name {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
}

.starter-card small {
  color: var(--muted);
}

/* Summon */
.banner-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

/* Banner tabs: small copies of each banner's splash art, titled in its colour. */
.banner-tab {
  position: relative;
  display: block;
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  aspect-ratio: 480 / 195;
  container-type: inline-size;
  text-align: left;
  opacity: 0.72;
  transition: opacity 0.15s, transform 0.15s;
}

.banner-tab:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

.banner-tab.on {
  opacity: 1;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 6px 18px rgba(0, 0, 0, 0.35);
}

.tab-art {
  display: block;
  width: 100%;
  height: 100%;
}

.tab-label {
  position: absolute;
  left: 5cqw;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  max-width: 34%;
  font-family: var(--display);
}

.tab-label span {
  color: #fff;
  font-weight: 700;
  font-size: clamp(11px, 6.4cqw, 20px);
  line-height: 1.05;
  font-style: italic;
  text-shadow: 0 1px 0 var(--ink), 0 0 6px rgba(0, 0, 0, 0.6);
}

.tab-label small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.8);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  font-size: clamp(9px, 3.6cqw, 12px);
  font-weight: 600;
}

/* The selected banner: wish-style splash on top, rates and summon buttons below. */
.banner-hero {
  border-radius: 14px;
  border: 2px solid var(--line);
  background: #141a33;
  overflow: hidden;
}

.banner-limited {
  border-color: var(--gold);
}

.wish-banner {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 1280 / 520;
  overflow: hidden;
}

.wish-banner::after {
  /* A slow sheen sweeping across the art. */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.22) 50%, transparent 60%);
  background-size: 250% 100%;
  animation: wish-sheen 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes wish-sheen {
  0%, 35% { background-position: 120% 0; }
  70%, 100% { background-position: -20% 0; }
}

.wish-art {
  display: block;
  width: 100%;
  height: 100%;
}

.wish-text {
  position: absolute;
  left: 4.5cqw;
  top: 0;
  bottom: 0;
  width: 30cqw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.9cqw;
  font-family: var(--display);
}

.wish-kicker {
  align-self: flex-start;
  padding: 0.3cqw 1.2cqw;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 1.6cqw;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wish-title {
  margin: 0;
  color: #fff;
  font-size: 4.8cqw;
  font-weight: 800;
  line-height: 1;
  font-style: italic;
  text-shadow: 0 0.25cqw 0 var(--ink), 0 0 1.6cqw var(--accent), 0 0.4cqw 1.2cqw rgba(0, 0, 0, 0.45);
}

.wish-new {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.5cqw;
  font-weight: 600;
  text-shadow: 0 0.15cqw 0.4cqw rgba(0, 0, 0, 0.5);
}

.wish-plate {
  align-self: flex-start;
  display: grid;
  gap: 0.2cqw;
  margin-top: 1.2cqw;
  padding: 0.8cqw 1.6cqw 0.8cqw 1.2cqw;
  border-left: 0.5cqw solid var(--accent);
  border-radius: 0 1cqw 1cqw 0;
  background: linear-gradient(90deg, rgba(20, 22, 40, 0.88), rgba(20, 22, 40, 0.6));
  color: #fff;
}

.wish-plate b {
  font-size: 2.2cqw;
}

.wish-stars {
  color: #ffd84d;
  font-size: 1.5cqw;
  letter-spacing: 0.1em;
}

.wish-plate small {
  color: #c9cde0;
  font-size: 1.2cqw;
}

.wish-timer {
  color: #ffe27a;
  text-shadow: 0 0.15cqw 0.4cqw rgba(0, 0, 0, 0.5);
  font-size: 1.4cqw;
  font-weight: 700;
}

.wish .banner-info {
  padding: 14px 16px 16px;
}

.banner-info h3 {
  font-size: 20px;
  margin-bottom: 4px;
}

.banner-info p {
  margin: 0 0 8px;
  color: #d6dcf5;
}

.rates {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

.rates li {
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid var(--r);
  font-size: 12px;
}

.rates b {
  color: var(--r);
}

.pity {
  font-size: 13px;
}

.gold {
  color: var(--gold);
}

.pull-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.pull-row .primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 140px;
}

.pull-row .primary small {
  font-size: 13px;
  opacity: 0.85;
}

/* Reveal */
.reveal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.reveal-grid.single {
  grid-template-columns: minmax(180px, 240px);
  justify-content: center;
}

.reveal-card {
  position: relative;
  min-height: 170px;
  border-radius: 14px;
  border: 3px solid var(--line);
  background: var(--card);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
}

.reveal-card .face {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px;
  text-align: center;
}

.reveal-card.open {
  border-color: var(--r);
  box-shadow: 0 0 22px color-mix(in srgb, var(--g) 60%, transparent);
  background: radial-gradient(70% 60% at 50% 40%, color-mix(in srgb, var(--r) 30%, transparent), var(--card) 75%);
  animation: pop-in 0.35s ease-out;
}

.reveal-card.open .ball-wrap {
  display: none;
}

.reveal-card.open .face {
  display: flex;
}

.reveal-card.rarity-legendary.open {
  box-shadow:
    0 0 0 2px var(--gold),
    0 0 36px rgba(255, 203, 5, 0.75);
}

.shake {
  animation: shake 0.6s ease-in-out infinite;
}

.r-name {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
}

.r-rarity {
  font-size: 12px;
  font-weight: 700;
  color: var(--r);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge {
  font-size: 12px;
  color: var(--gold);
}

.badge.new {
  color: #3a2c00;
  background: var(--gold);
  padding: 1px 8px;
  border-radius: 999px;
}

.badge.refund {
  color: #9be7ff;
}

.legendary-flash {
  animation: flash 0.9s ease-out;
}

@keyframes shake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-14deg);
  }
  75% {
    transform: rotate(14deg);
  }
}

@keyframes pop-in {
  from {
    transform: scale(0.7);
    opacity: 0.3;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes flash {
  0% {
    box-shadow: inset 0 0 0 999px rgba(255, 240, 160, 0.45);
  }
  100% {
    box-shadow: inset 0 0 0 999px rgba(255, 240, 160, 0);
  }
}

/* Item icons */
.item-icon {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--item) 55%, color-mix(in srgb, var(--item) 60%, #000));
  color: #1b1b1b;
  font-weight: 800;
  font-size: 13px;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* An item's sprite: just the picture, no orb behind it. */
.item-icon.has-picture {
  background: none;
  box-shadow: none;
  border-radius: 0;
}

.item-icon.has-picture img {
  image-rendering: pixelated;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

/* Collection */
.dex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.dex-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--r) 70%, var(--line));
  background: radial-gradient(70% 55% at 50% 40%, color-mix(in srgb, var(--r) 18%, transparent), var(--card) 80%);
}

.dex-card.locked {
  opacity: 0.6;
}

.dex-top {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  gap: 4px;
}

.dex-stars {
  color: var(--gold);
  letter-spacing: 1px;
}

.dex-base {
  color: var(--muted);
  font-size: 12px;
}

.item-select {
  width: 100%;
  margin-top: 4px;
  font: inherit;
  font-size: 12px;
  padding: 3px 4px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.bag {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.bag-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--r) 60%, var(--line));
  background: var(--card);
}

.bag-item small {
  display: block;
  color: var(--muted);
}

/* Milestones */
.milestones {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.milestone {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
}

.milestone > div {
  flex: 1;
}

.milestone small {
  color: var(--muted);
}

.milestone .bar {
  height: 7px;
  margin: 4px 0 2px;
  border-radius: 4px;
  background: var(--bg);
  overflow: hidden;
}

.milestone .bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6ec6ff, var(--gold));
}

.milestone .reward {
  font-family: var(--display);
  font-weight: 700;
  color: #9be7ff;
  white-space: nowrap;
}

.milestone.done {
  border-color: rgba(94, 224, 138, 0.5);
}

.milestone.done .reward {
  color: var(--ok);
}

/* Milestone sections and their reward chips (Star Pieces, Heart Scales, items, Pokémon). */
.ms-head {
  margin: 14px 0 0;
  font-family: var(--display);
  font-size: 18px;
}

.ms-head small {
  margin-left: 6px;
  font-size: 13px;
  color: var(--muted);
}

.ms-blurb {
  margin: 0 0 2px;
  font-size: 13px;
  color: var(--muted);
}

.milestone > .ms-reward {
  flex: 0 1 auto;
  max-width: 48%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.rw-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
}

.rw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 4px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--r, var(--line)) 60%, var(--line));
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.rw-chip .ico.sp {
  color: #9be7ff;
}

.rw-chip.hs .ico.hs {
  color: #ff7aa2;
}

.rw-chip .item-icon {
  font-size: 9px;
}

.milestone.done .rw-chips {
  opacity: 0.5;
}

@media (max-width: 640px) {
  .milestone {
    flex-wrap: wrap;
  }

  .milestone > .ms-reward {
    max-width: 100%;
    align-items: flex-start;
  }

  .rw-chips {
    justify-content: flex-start;
  }
}

.shop-stars {
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 1px;
}

@media (max-width: 760px) {
  .banner-hero,
  .starter-row {
    grid-template-columns: 1fr;
  }

  .reveal-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .banner-tabs {
    grid-template-columns: 1fr;
  }
}

.shop-body > span {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.15;
}

.starter-mode .meta-close {
  display: none;
}

.meta-head h2 {
  font-family: var(--display);
  font-weight: 700;
}

/* ================= Website main menu ================= */
a.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  text-decoration: none;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 6px 11px;
  cursor: pointer;
}

a.button:hover {
  border-color: var(--blue);
  background: var(--card-hi);
}

a.button.primary {
  font-family: var(--display);
  font-weight: 600;
  background: linear-gradient(180deg, #ffe066, var(--gold) 55%, #f0b400);
  color: #3a2c00;
  border-color: var(--gold-deep);
  box-shadow: 0 3px 0 var(--gold-deep);
}

a.button.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

body.menu-page {
  height: auto;
  min-height: 100%;
  background:
    radial-gradient(60% 40% at 15% 0%, rgba(61, 125, 202, 0.35), transparent 70%),
    radial-gradient(50% 40% at 90% 10%, rgba(255, 203, 5, 0.12), transparent 70%),
    var(--bg);
}

.menu-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(13, 18, 38, 0.82);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--line);
}

.menu-top .brand {
  padding: 0;
}

/* The brand and team sit on the left; alerts, account and balances group on the right. */
.menu-top .team-bar {
  margin: 0 auto 0 12px;
}

.menu-top .sp-balance {
  margin-left: 6px;
}

.menu-main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.menu-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background:
    radial-gradient(70% 90% at 20% 50%, rgba(122, 199, 76, 0.35), transparent 70%),
    linear-gradient(135deg, #1d3d2a, #16224a 70%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.team-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 14px;
  border-radius: 14px;
  background: rgba(13, 18, 38, 0.45);
  min-height: 80px;
}

.team-strip .portrait {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), transparent 70%);
}

.hero-copy h2 {
  margin: 0 0 6px;
  font-family: var(--pixel);
  font-size: 34px;
  color: var(--gold);
  text-shadow: 0 3px 0 #3d4fa0;
}

.hero-copy p {
  color: #d6dcf5;
  margin: 0 0 14px;
}

a.button.play {
  font-size: 24px;
  padding: 10px 44px;
  border-radius: 14px;
  box-shadow: 0 5px 0 var(--gold-deep);
}

a.button.play:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--gold-deep);
}

.hero-stats {
  margin-top: 12px !important;
  font-size: 13px;
  color: var(--muted) !important;
}

/* The Pokémon Center embedded on the page instead of a modal. */
.meta.inline {
  position: static;
  display: block;
  background: none;
  backdrop-filter: none;
  padding: 0;
}

.meta.inline .meta-card {
  max-height: none;
  width: 100%;
}

#toast.menu-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  top: auto;
  transform: translate(-50%, 8px);
  z-index: 60;
}

#toast.menu-toast.show {
  transform: translate(-50%, 0);
}

.menu-foot {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 0 16px 24px;
}

.menu-foot p {
  margin: 4px auto;
  max-width: 640px;
}

.menu-foot a {
  color: #8fc4ff;
}

@media (max-width: 760px) {
  .menu-hero {
    grid-template-columns: 1fr;
  }
}

/* ---------- Team bar (top of the homepage) ---------- */
.team-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 12px;
  border-radius: 14px;
  background: rgba(29, 38, 80, 0.75);
}

.team-label {
  display: flex;
  flex-direction: column;
  font-size: 11px;
  line-height: 1.1;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.team-label b {
  font-family: var(--display);
  font-size: 15px;
  color: var(--gold);
  letter-spacing: 0;
}

.team-slots {
  display: grid;
  grid-template-columns: repeat(10, 34px);
  gap: 3px;
}

.team-slot {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), rgba(13, 18, 38, 0.5) 75%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

/* Each Pokémon plays its idle animation (menu.js); hovering the bar makes them hop in a wave,
   and a Pokémon that just joined pops in. */
.team-slot canvas {
  transform-origin: 50% 90%;
  transition: transform 0.18s ease;
}

.team-bar:hover .team-slot:not(.empty) canvas {
  animation: slot-hop 0.42s ease calc(var(--i, 0) * 45ms);
}

.team-slot:not(.empty):hover canvas {
  transform: scale(1.18);
}

.team-slot.joined {
  animation: slot-join 0.55s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes slot-hop {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px) scale(1.04, 0.96); }
  70% { transform: translateY(0) scale(1.06, 0.94); }
}

@keyframes slot-join {
  0% { transform: scale(0.3); box-shadow: 0 0 0 0 rgba(255, 203, 5, 0.8); }
  60% { transform: scale(1.15); box-shadow: 0 0 14px 4px rgba(255, 203, 5, 0.5); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .team-bar:hover .team-slot canvas,
  .team-slot.joined {
    animation: none;
  }
}

.team-slot.empty .ico.ball {
  width: 14px;
  height: 14px;
  opacity: 0.25;
}

.team-toggle {
  width: 100%;
  margin-top: 4px;
  font-size: 12px;
  padding: 4px 6px;
}

.team-toggle.on {
  border-color: var(--ok);
  color: var(--ok);
}

@media (max-width: 900px) {
  .menu-top {
    flex-wrap: wrap;
  }

  /* The team wraps to its own row, so the brand pushes the rest right. */
  .menu-top .brand {
    margin-right: auto;
  }

  .menu-top .team-bar {
    margin: 0;
  }

  .team-bar {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .team-slots {
    grid-template-columns: repeat(10, minmax(0, 30px));
  }

  .team-slot {
    width: 30px;
    height: 30px;
  }

  .team-slot canvas {
    width: 28px;
    height: 28px;
  }
}

/* ---------- Homepage side navigation ---------- */
.menu-shell {
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  gap: 0;
  align-items: start;
}

.side-nav {
  position: sticky;
  top: 58px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: calc(100vh - 58px);
  overflow-y: auto;
  padding: 8px 12px 10px;
  border-right: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 27, 56, 0.85), rgba(13, 18, 38, 0.6));
}

/* Nav sections (Play, Pokémon, Free Stuff, Economy), each under a small heading. */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-group + .nav-group {
  margin-top: 2px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
}

.nav-group-title {
  padding: 0 14px 2px;
  font-family: var(--display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c3cbf0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 12px;
  line-height: 1.2;
  border-radius: 12px;
  border: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--display);
  font-size: 16px;
  white-space: nowrap;
  font-weight: 600;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: currentColor;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--card);
}

.nav-item[aria-current='page'] {
  color: var(--gold);
  background: var(--card-hi);
  border-color: rgba(255, 203, 5, 0.55);
  box-shadow: inset 4px 0 0 var(--gold);
}

/* My Team's sub-links, shown under it while a My Team page is open. */
.nav-sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin: -2px 0 4px 26px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.nav-sub.open {
  display: flex;
}

.nav-subitem {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
}

.nav-subitem:hover {
  color: var(--ink);
  background: var(--card);
}

.nav-subitem[aria-current='page'] {
  color: var(--gold);
  background: var(--card-hi);
}

.nav-item.nav-play {
  margin-top: auto;
  justify-content: center;
  color: #3a2c00;
  background: linear-gradient(180deg, #ffe066, var(--gold) 55%, #f0b400);
  border-color: var(--gold-deep);
  box-shadow: 0 3px 0 var(--gold-deep);
}

.nav-item.nav-play:hover {
  color: #3a2c00;
  background: linear-gradient(180deg, #fff09a, #ffd633 55%, #f5bd00);
}

.nav-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.menu-shell .menu-main {
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}

.menu-shell #center[hidden],
.menu-shell .menu-hero[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .menu-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* On phones the side nav becomes a bottom tab bar. */
  .side-nav {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    height: auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: none;
    border-top: 2px solid var(--line);
    background: rgba(13, 18, 38, 0.95);
  }

  /* The bottom bar shows every item in one row: the groups and their headings drop away. */
  .nav-group,
  .nav-group + .nav-group {
    display: contents;
  }

  .nav-group-title {
    display: none;
  }

  /* Ten tabs don't fit a phone's width: each keeps a comfortable size and the bar scrolls. */
  .nav-item {
    flex: 1 0 64px;
    flex-direction: column;
    gap: 2px;
    padding: 6px 2px;
    font-size: 11px;
    text-align: center;
  }

  .nav-item[aria-current='page'] {
    box-shadow: inset 0 3px 0 var(--gold);
  }

  .nav-item.nav-play {
    margin-top: 0;
  }

  /* The in-page tab row covers My Team's sub-tabs on phones. */
  .nav-sub.open {
    display: none;
  }

  body.menu-page {
    padding-bottom: 76px;
  }

  /* (The header is about 145px tall on a phone: kept sticky with the tab bar below, it left the
     page under half the screen. It scrolls away with the page instead.) */
  .menu-top {
    position: static;
  }

  /* Toasts sit above the bottom tab bar instead of on it. */
  #toast.menu-toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
    max-width: calc(100% - 32px);
  }

  /* The tab bar scrolls sideways: its right edge fades out so the cut-off tabs read as "more". */
  .side-nav {
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
}

/* ---------- First-time starter page ---------- */
.starter-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.starter-main {
  width: min(900px, 100%);
}

.starter-welcome {
  text-align: center;
  margin-bottom: 18px;
}

.starter-welcome .ico.ball.big {
  width: 56px;
  height: 56px;
  animation: shake 1.6s ease-in-out infinite;
}

.starter-welcome h1 {
  margin: 10px 0 6px;
  font-family: var(--pixel);
  font-size: 42px;
  color: var(--gold);
  text-shadow:
    0 3px 0 #3d4fa0,
    0 5px 0 #22306e;
}

.starter-welcome p {
  margin: 0;
  color: #d6dcf5;
  font-size: 16px;
}

.starter-page .meta-lead {
  display: none;
}

.starter-page.leaving .starter-main {
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 0.6s,
    transform 0.6s;
}

.starter-page .meta-head {
  display: none;
}

/* ---------- Home (landing dashboard) ---------- */
.view[hidden] {
  display: none;
}

.view-title {
  margin: 0 0 14px;
  font-family: var(--display);
  font-size: 26px;
  color: var(--gold);
}

.home-hero {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px;
  margin-bottom: 18px;
  border-radius: 18px;
  border: 3px solid var(--line);
  background:
    radial-gradient(60% 120% at 12% 50%, rgba(122, 199, 76, 0.4), transparent 70%),
    linear-gradient(135deg, #1d3d2a, #16224a 70%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.home-partner {
  flex: none;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), rgba(13, 18, 38, 0.4) 70%);
  box-shadow: inset 0 0 0 3px rgba(255, 203, 5, 0.45);
}

.home-greeting h2 {
  margin: 0 0 6px;
  font-family: var(--pixel);
  font-size: 32px;
  color: var(--gold);
  text-shadow: 0 3px 0 #3d4fa0;
}

.home-greeting p {
  margin: 0 0 12px;
  color: #d6dcf5;
}

.home-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.home-stat {
  display: flex;
  flex-direction: column;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(13, 18, 38, 0.5);
  font-size: 12px;
  color: var(--muted);
}

.home-stat b {
  font-family: var(--display);
  font-size: 20px;
  color: var(--ink);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.home-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition:
    transform 0.12s,
    border-color 0.15s,
    box-shadow 0.15s;
}

.home-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.home-card b {
  font-family: var(--display);
  font-size: 20px;
}

.home-card small {
  color: var(--muted);
}

/* ---------- Challenges, Trainer Card and Lottery pages (src/ui/pages.js) ---------- */
.ch-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.ch-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--card);
}

.ch-card h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
}

.ch-card .button,
.ch-card button {
  align-self: flex-start;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.ch-card .button small,
.ch-card button small {
  display: block;
  font-size: 12px;
  font-weight: 600;
  opacity: 0.85;
}

.ch-card.locked {
  opacity: 0.7;
}

.ch-section {
  margin-top: 22px;
}

.ch-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ch-tag {
  padding: 1px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
  color: #10183a;
  background: var(--gold);
}

.rule-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--ink);
}

.ch-status {
  margin: 0;
  font-size: 13.5px;
}

.ok {
  color: var(--ok);
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.legend-row canvas {
  flex: none;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 10px rgba(255, 224, 120, 0.45));
}

.gym-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.gym-card {
  border-color: color-mix(in srgb, var(--gem) 55%, var(--line));
}

.gym-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gym-head > div {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.gym-head b {
  font-family: var(--display);
  font-size: 18px;
}

.gym-head small {
  color: var(--muted);
}

.gym-quote {
  margin: 0;
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
}

/* A Gym badge (its artwork): faded grey until earned, then in full colour with a glow in the
   Gym's colour. */
.badge-gem {
  display: inline-block;
  flex: none;
  object-fit: contain;
  filter: grayscale(1) opacity(0.45);
}

.badge-gem.earned {
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--gem) 70%, transparent));
}

.elite-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: elite;
}

.elite-steps li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--bg);
}

.elite-steps li small {
  color: var(--muted);
}

.elite-steps li.beaten {
  border-color: var(--ok);
}

.elite-steps li.beaten b::after {
  content: ' ✓';
  color: var(--ok);
}

.elite-steps li.next {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(255, 203, 5, 0.3);
}

.ch-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trainer-card {
  display: flex;
  gap: 18px;
  padding: 18px;
  border-radius: 16px;
  border: 3px solid #5a7bd8;
  background:
    linear-gradient(135deg, rgba(90, 123, 216, 0.25), transparent 60%),
    var(--card);
}

.tc-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tc-pfp {
  display: grid;
  gap: 2px;
  justify-items: center;
  font-size: 11px;
  color: var(--muted);
}

.tc-pfp select {
  max-width: 150px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: inherit;
  font: inherit;
  font-size: 12px;
}

.tc-pfp-trainers {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.tc-pfp-trainers:hover,
.tc-pfp-trainers:focus-visible {
  border-color: var(--gold);
}

/* The trainer portrait picker (ui/pages.js openTrainerPicker). */
.tr-pick-region {
  padding: 4px 14px 0;
}

.tr-pick-region h4 {
  margin: 10px 0 8px;
  font-family: var(--display);
  color: var(--gold);
}

.tr-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 8px;
}

.tr-pick {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 8px 4px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--card);
  color: inherit;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.tr-pick img {
  width: 144px;
  height: 144px;
  image-rendering: pixelated;
}

.tr-pick:hover,
.tr-pick:focus-visible {
  border-color: var(--line);
}

.tr-pick.on {
  border-color: var(--gold);
}

.tc-left canvas {
  border-radius: 12px;
  background: var(--bg);
  image-rendering: pixelated;
}

.tc-level {
  font-family: var(--display);
  font-size: 20px;
  color: var(--gold);
}

.tc-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tc-main h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 24px;
}

.tc-xp {
  height: 10px;
  border-radius: 5px;
  background: var(--bg);
  overflow: hidden;
}

.tc-xp span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6ec6ff, var(--gold));
}

.tc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 6px 0 0;
}

.tc-stats div {
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--bg);
}

.tc-stats dt {
  font-size: 12px;
  color: var(--muted);
}

.tc-stats dd {
  margin: 0;
  font-family: var(--display);
  font-size: 18px;
}

.badge-case {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--card);
}

.badge-case figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.medal-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.medal-sum {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
}

.medal-sum b {
  font-family: var(--display);
}

.medal-sum small {
  color: var(--muted);
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.research-node {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
}

.research-node.on {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
}

.rn-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rn-head b {
  flex: 1;
  font-family: var(--display);
}

.rn-pips {
  display: flex;
  gap: 3px;
}

.rn-pips i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
}

.rn-pips i.on {
  background: var(--gold);
  border-color: var(--gold-deep);
}

.research-node button {
  font-size: 12.5px;
}

.research-reset {
  margin-left: auto;
}

.lotto-tickets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.lotto-ticket {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  border: 2px dashed #f5c542;
  font-family: var(--pixel);
  font-size: 16px;
  letter-spacing: 0.12em;
  color: #ffe9a3;
  background: rgba(245, 197, 66, 0.1);
}

.lotto-number {
  font-family: var(--pixel) !important;
  font-size: 34px !important;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.lotto-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.lotto-table td {
  padding: 5px 4px;
  border-top: 1px solid var(--line);
}

.lotto-table td small {
  display: block;
  color: var(--muted);
}

.lotto-results td {
  text-align: left;
}

@media (max-width: 640px) {
  .trainer-card {
    flex-direction: column;
  }

  .badge-case {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Home: What's New and At a Glance, side by side under the greeting. */
.home-info {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 14px;
}

@media (max-width: 860px) {
  .home-info {
    grid-template-columns: minmax(0, 1fr);
  }
}

.home-card.static:hover {
  transform: none;
  border-color: var(--line);
  box-shadow: none;
}

.news-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.news-list li + li {
  border-top: 1px solid var(--line);
}

.news-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 6px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.news-list a:hover {
  background: var(--card-hi);
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.news-tag {
  padding: 0 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11.5px;
  color: #10183a;
  background: #b6bee3;
}

.news-tag.tag-promo { background: #6fd3ff; }
.news-tag.tag-maps { background: #8fe08a; }
.news-tag.tag-feature { background: var(--gold); }
.news-tag.tag-update { background: #d7b4ff; }

.home-card .news-new {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: #ff7a8a;
}

.news-meta time {
  margin-left: auto;
}

.home-card .news-title {
  font-size: 16px;
}

/* The Jukebox (Home): every tune as a button, the picked one lit; across the whole row. */
.jukebox-card {
  grid-column: 1 / -1;
}

.jukebox-now {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.jukebox-now b {
  color: var(--gold);
}

.jukebox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}

.jukebox-track {
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.jukebox-track:hover {
  border-color: var(--gold);
}

.jukebox-track.on {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 16%, var(--card));
}

.jukebox-icon {
  grid-row: 1 / 3;
  color: var(--gold);
  font-size: 16px;
  text-align: center;
}

.jukebox-track b {
  font-family: var(--display);
  font-size: 14px;
}

.jukebox-track small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.glance-list {
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
}

.glance-list div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 2px;
  font-size: 13.5px;
}

.glance-list div + div {
  border-top: 1px solid var(--line);
}

.glance-list dt {
  color: var(--muted);
  font-weight: 600;
}

.glance-list dd {
  margin: 0;
}

.glance-list a {
  color: #9fd4ff;
  text-decoration: none;
  font-weight: 600;
}

.glance-list a:hover {
  text-decoration: underline;
}

.home-card .glance-ready {
  font-family: inherit;
  font-size: inherit;
  color: var(--ok);
}

.card-kicker {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.card-continue {
  background: linear-gradient(135deg, #2a5a2f, #1d2650 75%);
}

.card-cta {
  margin-top: auto;
  align-self: flex-start;
  padding: 6px 16px;
  border-radius: 10px;
  font-family: var(--display);
  font-weight: 700;
  color: #3a2c00;
  background: linear-gradient(180deg, #ffe066, var(--gold) 55%, #f0b400);
  box-shadow: 0 3px 0 var(--gold-deep);
}

.card-banner {
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, #5a1f78, #1b1648 70%);
  border-color: rgba(255, 203, 5, 0.6);
}

.card-banner .card-kicker {
  align-self: flex-start;
}

.card-banner canvas {
  filter: drop-shadow(0 0 10px rgba(255, 203, 5, 0.6));
}

.mini-team {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 4px 0;
}

.goal-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.goal-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
}

.goal-reward {
  color: #9be7ff;
  font-weight: 700;
}

.goal-list .bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
}

.goal-list .bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6ec6ff, var(--gold));
}

/* Quests (src/meta/quests.js): the whole row, daily and weekly side by side. */
.home-grid .card-quests {
  grid-column: 1 / -1;
}

.quest-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.quest-col > b {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.quest-col > b small {
  color: var(--muted);
  font-weight: 400;
}

.quest-list {
  list-style: none;
  margin: 6px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.quest-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
}

.quest-list li small {
  color: var(--muted);
}

.quest-list li.done span:first-child {
  text-decoration: line-through;
  opacity: 0.7;
}

.quest-bar {
  grid-row: 2;
  height: 6px;
  border-radius: 3px;
  background: var(--bg);
  overflow: hidden;
}

.quest-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #81c784, var(--gold));
}

/* ---------- Play (map select) ---------- */
.map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.map-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid var(--gold);
  background: var(--card);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.map-card.locked {
  border-color: var(--line);
  opacity: 0.6;
  box-shadow: none;
}

.map-art {
  position: relative;
  height: 180px;
  display: grid;
  place-items: center;
  font-size: 34px;
  overflow: hidden;
}

/* The Endless tab's card (menu.js renderEndless): the map's picture beside its reward ladder. */
.map-card.endless-card {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
}

.endless-card .map-art {
  align-self: start;
  height: auto;
  aspect-ratio: 9 / 5;
}

.endless-ladder {
  gap: 3px;
  margin: 8px 0 12px;
}

.endless-ladder li {
  white-space: nowrap;
  font-size: 13px;
  opacity: 0.85;
}

.endless-head {
  margin: 10px 0 0;
  font-size: 14px;
}

.endless-prizes summary {
  cursor: pointer;
  font-size: 13px;
}

.endless-board .lb-table {
  width: 100%;
  font-size: 13px;
}

.endless-ladder li.got {
  opacity: 0.55;
}

@media (max-width: 760px) {
  .map-card.endless-card {
    grid-template-columns: 1fr;
  }

}

/* The real map picture (baked from the game's own map painter). */
.map-art .map-thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.map-num {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(10, 14, 30, 0.8);
  color: var(--gold);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.map-lock {
  position: relative;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.6));
}

.map-card.locked .map-art .map-thumb {
  filter: grayscale(0.85) brightness(0.6);
}

/* The next map to play on the journey. */
.map-card.current {
  box-shadow:
    0 0 0 3px rgba(255, 203, 5, 0.35),
    0 12px 30px rgba(0, 0, 0, 0.35);
  animation: current-map 1.6s ease-in-out infinite alternate;
}

@keyframes current-map {
  to {
    box-shadow:
      0 0 0 3px rgba(255, 203, 5, 0.8),
      0 0 26px rgba(255, 203, 5, 0.45);
  }
}

.map-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.map-tag.done {
  background: rgba(94, 224, 138, 0.18);
  color: #5ee08a;
}

.map-tag.locked-tag {
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.map-tag.feature {
  background: rgba(143, 211, 255, 0.14);
  color: #8fd3ff;
}

.map-info .map-threat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
  color: var(--muted);
}

.map-threat small {
  font-size: 11.5px;
}

.pips {
  display: inline-flex;
  gap: 3px;
}

.pips i {
  width: 12px;
  height: 7px;
  border-radius: 3px;
  background: var(--line);
}

.pips i.on {
  background: linear-gradient(180deg, #ff9f6b, #ff5c6c);
  box-shadow: 0 0 6px rgba(255, 92, 108, 0.5);
}

.map-modes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.map-modes .button.mode-nuzlocke {
  border-color: #b23a48;
}

/* Medals beside a map's name: Easy bronze, Medium silver, Hard gold, Nuzlocke crimson. A star
   inside marks a flawless clear (no lives lost). */
.medals {
  display: inline-flex;
  gap: 4px;
  margin-left: 10px;
  vertical-align: middle;
}

.medal {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px dashed var(--line);
  font-size: 10px;
  line-height: 1;
  color: #fff;
}

.medal.won {
  border-style: solid;
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}

.medal-easy.won { background: radial-gradient(circle at 35% 30%, #f3c38b, #b5712f); }
.medal-medium.won { background: radial-gradient(circle at 35% 30%, #ffffff, #9ea7b8); color: #3a4152; }
.medal-hard.won { background: radial-gradient(circle at 35% 30%, #fff3a6, #e0a800); color: #5a3e00; }
.medal-nuzlocke.won { background: radial-gradient(circle at 35% 30%, #ff8b8b, #8e1b2a); }

.map-info .map-modes .button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  margin: 0;
  padding: 6px 4px;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.15;
  text-decoration: none;
}

.map-modes .button small {
  font-family: system-ui, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.85;
}

.map-modes .button.disabled {
  border: 2px dashed var(--line);
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  cursor: not-allowed;
}

.journey-bar {
  height: 10px;
  margin: 0 0 12px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.journey-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ee08a, #ffcb05);
}

.map-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}

.map-info h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.map-tag {
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255, 203, 5, 0.15);
  color: var(--gold);
}

.map-info p {
  margin: 0;
  color: #d6dcf5;
  font-size: 14px;
}

.map-info .map-stats {
  color: var(--muted);
  font-size: 13px;
}

.map-info .play {
  align-self: flex-start;
  margin-top: 6px;
}

@media (max-width: 760px) {
  .home-hero {
    flex-direction: column;
    text-align: center;
  }

  .home-stats {
    justify-content: center;
  }
}

/* ---------- My Team ---------- */
/* Before a match: the bar over My Team (menu.js matchPrep): the map and difficulty, its wild
   types, Suggested team and Start match. It stays in view while the team is changed. */
.match-prep {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 203, 5, 0.16), rgba(20, 27, 56, 0.96));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}
.match-prep[hidden] {
  display: none;
}
.mp-info {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.mp-info > small {
  color: var(--gold);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 11px;
}
.mp-info > b {
  font-family: var(--display);
  font-size: 18px;
}
.mp-types {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.mp-types small {
  color: var(--muted);
  margin-right: 2px;
}
.mp-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.mp-actions .button {
  margin: 0;
}
.mp-close {
  padding: 6px 10px;
}
@media (max-width: 640px) {
  .match-prep {
    top: 4px;
  }
  .mp-actions {
    width: 100%;
  }
  .mp-actions .button.primary {
    flex: 1;
    text-align: center;
  }
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
}

.sub-tabs a {
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--display);
  font-weight: 600;
}

.sub-tabs a:hover {
  color: var(--ink);
}

.sub-tabs a[aria-current='page'] {
  color: #3a2c00;
  background: linear-gradient(180deg, #ffe066, var(--gold) 55%, #f0b400);
}

.team-panel[hidden] {
  display: none;
}

.view-lead a {
  color: var(--gold);
}

.view-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

/* Current Team has no intro text, so give the grid some room under the heading. */
#panel-team .view-head {
  margin-bottom: 10px;
}

.view-head .view-title {
  margin-bottom: 4px;
}

.team-size {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  color: var(--muted);
}

.view-lead {
  margin: 0 0 14px;
  color: var(--muted);
}

/* Five across, so a full team of 10 is two rows of five. */
.team-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 22px;
}

@media (max-width: 760px) {
  .team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tm-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 8px 6px 6px;
  border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--r) 70%, var(--line));
  background: radial-gradient(70% 45% at 50% 28%, color-mix(in srgb, var(--type) 30%, transparent), var(--card) 80%);
  text-align: center;
}

.tm-card.empty {
  justify-content: center;
  min-height: 170px;
  font-size: 12px;
  border: 2px dashed var(--line);
  background: rgba(29, 38, 80, 0.35);
  color: var(--muted);
}

.tm-card.empty .ico.ball.big {
  opacity: 0.25;
}

a.tm-card.empty {
  text-decoration: none;
}

a.tm-card.empty:hover {
  border-color: var(--gold-deep);
  color: var(--ink);
}

/* In My Inventory, Pokémon already on the team get a gold edge. */
.tm-card.on-team {
  box-shadow: 0 0 0 2px var(--gold) inset;
}

.tm-on {
  color: var(--gold);
}

.tm-slot {
  position: absolute;
  top: 5px;
  left: 7px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 12px;
  color: var(--muted);
}

.tm-art {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent 70%);
}

.tm-art canvas {
  width: 46px;
  height: 46px;
}

.tm-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--display);
  font-size: 15px;
}

.tm-evo,
.tm-cost {
  font-size: 12px;
  line-height: 1.25;
  color: var(--muted);
}

.tm-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px 4px;
}

.tm-tags .type-chip {
  padding: 0 6px;
  font-size: 10.5px;
}

.tm-stars {
  color: var(--gold);
  font-size: 11.5px;
  letter-spacing: 0;
}

.tm-card .item-select {
  font-size: 12px;
  padding: 2px 3px;
}

.tm-actions {
  display: grid;
  width: 100%;
  margin-top: 3px;
}

.tm-actions button {
  padding: 3px 6px;
  font-size: 12px;
}

/* ---------- My Items: item inventory ---------- */
.inv-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.inv-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.inv-chip {
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--r) 55%, var(--line));
  background: var(--card);
  color: var(--ink);
  font-family: var(--display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.inv-chip small {
  margin-left: 2px;
  color: var(--muted);
}

.inv-chip[aria-pressed='true'] {
  border-color: var(--r);
  background: color-mix(in srgb, var(--r) 22%, var(--card));
  box-shadow: 0 0 10px color-mix(in srgb, var(--r) 45%, transparent);
}

.inv-sort {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.inv-sort select {
  font: inherit;
  padding: 4px 6px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

.inv-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
  align-items: start;
}

#panel-items.empty .inv-layout {
  grid-template-columns: minmax(0, 1fr);
}

#panel-items.empty .inv-detail,
#panel-items.empty .inv-toolbar {
  display: none;
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
}

.inv-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 12px 6px 8px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--r) 55%, var(--line));
  background: radial-gradient(70% 50% at 50% 30%, color-mix(in srgb, var(--r) 18%, transparent), var(--card) 80%);
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.12s,
    border-color 0.12s;
}

.inv-tile:hover {
  transform: translateY(-2px);
  border-color: var(--r);
}

.inv-tile[aria-pressed='true'] {
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px var(--gold) inset,
    0 0 14px rgba(255, 203, 5, 0.3);
}

.inv-tile b {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--display);
  font-size: 14px;
}

.inv-tile small {
  font-size: 12px;
  color: var(--muted);
}

.inv-count {
  position: absolute;
  top: 5px;
  right: 7px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  color: var(--gold);
}

.inv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 16px;
  border-radius: 14px;
  border: 2px dashed var(--line);
  color: var(--muted);
  text-align: center;
}

.inv-empty b {
  color: var(--ink);
  font-family: var(--display);
  font-size: 18px;
}

.inv-empty a {
  color: var(--gold);
}

.inv-detail {
  position: sticky;
  top: 74px;
  padding: 14px;
  border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--r) 60%, var(--line));
  background: radial-gradient(90% 40% at 50% 0%, color-mix(in srgb, var(--r) 18%, transparent), var(--card) 85%);
}

.inv-detail:empty {
  display: none;
}

.inv-detail-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inv-detail-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
}

.inv-rarity {
  font-size: 13px;
  font-weight: 700;
  color: var(--r);
}

.inv-desc {
  margin: 10px 0;
}

.inv-detail h4 {
  margin: 12px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.inv-detail .muted {
  margin: 0;
  font-size: 13px;
}

.inv-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0;
}

.inv-stats div {
  padding: 6px;
  border-radius: 10px;
  background: var(--bg);
  text-align: center;
}

.inv-stats dt {
  font-size: 12px;
  color: var(--muted);
}

.inv-stats dd {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
}

.inv-fits {
  margin: 0;
  font-size: 13px;
}

.inv-holders {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.inv-holders li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 6px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 14px;
}

.inv-holders li > span:nth-child(2) {
  flex: 1;
}

.inv-holders small {
  font-size: 12px;
}

.inv-holders button {
  padding: 2px 8px;
  font-size: 12px;
}

.inv-holder-art {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
}

.inv-give {
  display: flex;
  gap: 6px;
}

.inv-give select {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}

@media (max-width: 900px) {
  .inv-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .inv-detail {
    position: static;
    order: -1;
  }
}

/* ---------- "New teammates" card after the first match ---------- */
.joined-modal[hidden] {
  display: none;
}
.joined-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(5, 8, 20, 0.7);
  backdrop-filter: blur(3px);
}

.joined-modal .card {
  animation: pop-in 0.35s ease-out;
}

.joined-modal p {
  color: #d6dcf5;
}

.joined-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 10px 0 18px;
}

.joined-row figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.joined-row canvas {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.2), rgba(13, 18, 38, 0.4) 70%);
  box-shadow: inset 0 0 0 3px rgba(255, 203, 5, 0.45);
}

.joined-row figcaption {
  font-family: var(--display);
  font-weight: 700;
}

/* ---------- Shiny Pokémon (cosmetic) ---------- */
.portrait.is-shiny {
  filter: drop-shadow(0 0 4px rgba(255, 236, 140, 0.9));
}

.tm-card.shiny,
.shop-item.shiny {
  box-shadow: 0 0 0 1px rgba(255, 224, 102, 0.7), 0 0 14px rgba(255, 224, 102, 0.35);
}

/* ---------- Promo Pokémon (src/data/promos.js) ---------- */
/* A "PROMO" ribbon in the corner of any card, button or slot showing a promo Pokémon. */
.promo {
  position: relative;
  box-shadow: 0 0 0 1px rgba(54, 198, 255, 0.75), 0 0 14px rgba(54, 198, 255, 0.35);
}

.promo::before {
  content: 'PROMO';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  padding: 1px 6px;
  border-radius: 999px;
  font: 800 10px/1.4 var(--display, inherit);
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(90deg, #0f86c9, #36c6ff 55%, #ff7ab6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

/* Buttons that clip their overflow: the ribbon sits just inside the top edge. */
.shop-item.promo::before {
  top: 1px;
}

.team-slot.promo::before {
  content: '';
  top: 2px;
  left: auto;
  right: 2px;
  transform: none;
  width: 8px;
  height: 8px;
  padding: 0;
}

.promo-bonus,
.banner-info p.promo-bonus {
  font-size: 12px;
  line-height: 1.35;
  color: #0b5e8f;
  background: #e3f6ff;
  border: 1px solid #9fdcfa;
  border-radius: 8px;
  padding: 3px 7px;
}

.promo-bonus b {
  color: #0b6aa8;
}

/* The Promotional Pokémon page: a note from Professor Oak, the Current Promo table and the past
   promos behind a link. */
.promo-page {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.promo-say {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card) 85%, #ffffff 15%);
}

.promo-say-art {
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 2px solid #e8473a;
  background: #fff;
}

.promo-say p {
  margin: 2px 0 0;
  font-size: 14px;
}

.promo-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--card);
  text-align: center;
}

.promo-table th {
  padding: 8px;
  font-family: var(--display);
  font-size: 15px;
  color: #fff;
  background: linear-gradient(180deg, #4a9af0, #1f5fc4);
}

.promo-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.promo-table td small {
  display: block;
  color: var(--muted);
}

.promo-table .promo-sub {
  font-weight: 700;
  background: color-mix(in srgb, #36c6ff 14%, var(--card));
}

.promo-art canvas {
  display: block;
  margin: 0 auto;
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}

.promo-obtain {
  min-width: 150px;
  font-weight: 700;
}

.promo-none {
  padding: 22px 12px !important;
}

.promo-past-link {
  align-self: center;
  background: none;
  border: 0;
  font-weight: 700;
  font-size: 15px;
  color: #6fb6ff;
  cursor: pointer;
  text-decoration: underline;
}

.promo-past .promo-table td {
  text-align: left;
}

.promo-past-art {
  width: 56px;
}

.promo-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.promo-section-head small {
  color: var(--muted);
}

.shiny-toggle {
  align-self: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #6b5600;
  background: #fff3b0;
  border: 1px solid #f5c542;
}

.shiny-toggle[aria-pressed='false'] {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

.shiny-mark {
  font-size: 14px;
}

.badge.shiny-badge {
  color: #4a3a00;
  background: linear-gradient(90deg, #fff3b0, #ffd84d, #fff3b0);
}

/* A finish from a summon (meta/gacha.js SUMMON_FINISH_ODDS). */
.badge.finish-badge {
  color: #fff;
  background: linear-gradient(90deg, #7b5cff, #ff5ca8, #ffb84d);
}

.reveal-card.shiny .face {
  position: relative;
}

.reveal-card.shiny .face::before {
  /* A rainbow shimmer behind a shiny pull. */
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  background: conic-gradient(from 0deg, #ff8a8a, #ffe066, #8affc1, #7fd3ff, #c99bff, #ff8a8a);
  opacity: 0.35;
  filter: blur(8px);
  animation: shiny-spin 3s linear infinite;
  z-index: -1;
}

@keyframes shiny-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Daily Prize chests and the Loyalty Shop ---------- */
.hs-balance { color: #ffc2d6; }
.ico.hs { color: #ff6f9a; font-style: normal; }

.card-daily {
  align-items: center;
  text-align: center;
  border-color: #f5c542;
  background: radial-gradient(circle at 50% 35%, rgba(255, 216, 77, 0.18), transparent 70%), var(--card);
}
.card-daily.claimed { border-color: var(--line); background: var(--card); }
.card-daily small { color: var(--muted); }
.card-daily button { margin-top: 6px; }

/* A chest drawn as a Poké Ball in its tier's colours. */
.daily-chest {
  --top: #e53935;
  position: relative;
  width: 64px;
  height: 64px;
  margin: 4px auto;
  border-radius: 50%;
  border: 4px solid #1a1a24;
  background: linear-gradient(var(--top) 0 46%, #1a1a24 46% 54%, #f4f4f4 54%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.daily-chest i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22%;
  height: 22%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #f4f4f4;
  border: 3px solid #1a1a24;
}
.daily-chest[data-tier='great'] { background: linear-gradient(#1e88e5 0 46%, #1a1a24 46% 54%, #f4f4f4 54%); }
.daily-chest[data-tier='ultra'] { background: linear-gradient(#2b2b2b 0 20%, #fdd835 20% 32%, #2b2b2b 32% 46%, #1a1a24 46% 54%, #f4f4f4 54%); }
.daily-chest[data-tier='master'] { background: linear-gradient(#8e24aa 0 46%, #1a1a24 46% 54%, #f4f4f4 54%); box-shadow: 0 0 18px rgba(201, 120, 255, 0.8); }
.daily-chest[data-tier='empty'] { filter: grayscale(1) opacity(0.45); }
.daily-chest.big { width: 120px; height: 120px; border-width: 6px; }
.daily-chest.shaking { animation: chest-shake 0.5s ease-in-out infinite; }
.daily-chest.opened { animation: chest-pop 0.5s ease-out; box-shadow: 0 0 30px rgba(255, 236, 140, 0.9); }
@keyframes chest-shake {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-14deg); }
  75% { transform: rotate(14deg); }
}
@keyframes chest-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.chest-card { text-align: center; min-width: 280px; }
.chest-reveal h2 { margin: 8px 0 2px; }
.chest-disguised { margin: 10px 0 0; color: #ffe27a !important; font-weight: 700; }
.chest-streak { margin: 0 0 8px; }
.chest-loot {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
  display: grid;
  gap: 6px;
  font-family: var(--display);
  font-size: 17px;
}
.chest-loot li { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }

/* Loyalty Shop */
.hs-count { display: inline-flex; align-items: center; gap: 4px; }
.shop-tabs { margin-bottom: 12px; }
.shop-note { color: var(--muted); margin: 0 0 12px; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.shop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 2px solid var(--r, var(--line));
  background: var(--card);
  text-align: center;
}
.shop-card small { color: var(--muted); font-size: 12px; min-height: 2.4em; }
.shop-card button { margin-top: auto; width: 100%; }
.shop-card.deal { box-shadow: 0 0 0 2px #ffd84d, 0 0 16px rgba(255, 216, 77, 0.35); }
.deal-tag {
  position: absolute;
  top: -9px;
  right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #ffd84d;
  color: #3a2c00;
  font-size: 12px;
  font-weight: 700;
}
.big-sp { font-size: 40px; color: #9ad7ff; font-style: normal; }

/* ---------- Daily Prize page, nav dot and top-right notification ---------- */
/* Header pills: New Promo (promos.js) and Daily Prize, side by side before the balances. */
.top-alerts {
  display: flex;
  gap: 8px;
}

.top-alerts:not(:has(> :not([hidden]))) {
  display: none;
}

.daily-alert {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  color: #3a2c00;
  text-decoration: none;
  background: linear-gradient(90deg, #ffe27a, #ffc94d);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35), 0 6px 18px rgba(0, 0, 0, 0.35);
  animation: alert-pulse 2s ease-in-out infinite;
}
.daily-alert[hidden] { display: none; }
.promo-alert {
  color: #fff;
  background: linear-gradient(90deg, #0f86c9, #36c6ff);
}

/* Narrower windows: the pills shorten to "Promo" / "Daily" so the balances keep their room, and
   on phones to their icons. */
@media (max-width: 1150px) {
  .alert-long {
    display: none;
  }

  .menu-top {
    gap: 8px;
    padding-left: 14px;
    padding-right: 14px;
  }

  .top-alerts {
    gap: 6px;
  }

  .daily-alert {
    padding: 5px 10px;
  }
}

/* Between the phone layout and wide windows the header's row runs out of room: the team bar
   slims down, and in the narrowest of these the pills and the account button show only their
   icons, so nothing pushes the page wider than the window. */
@media (min-width: 901px) and (max-width: 1240px) {
  .team-slots {
    grid-template-columns: repeat(10, 28px);
    gap: 2px;
  }

  .team-slot {
    width: 28px;
    height: 28px;
  }

  .team-slot canvas {
    width: 26px;
    height: 26px;
  }

  .team-bar {
    gap: 8px;
    padding: 4px 8px;
  }

  .menu-top .team-bar {
    margin-left: 4px;
  }
}

@media (min-width: 901px) and (max-width: 1060px) {
  .daily-alert > span:last-child,
  .account-btn > span:last-child {
    display: none;
  }
}

@media (max-width: 640px) {
  .daily-alert > span:last-child {
    display: none;
  }
}
.daily-alert:hover { filter: brightness(1.05); }
@keyframes alert-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.nav-item { position: relative; }
.nav-dot {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5a7a;
  box-shadow: 0 0 0 2px var(--panel, #12183a);
}
.nav-dot[hidden] { display: none; }

.dp-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px;
  margin-bottom: 18px;
  border-radius: 14px;
  border: 2px solid #f5c542;
  background: radial-gradient(circle at 15% 50%, rgba(255, 216, 77, 0.2), transparent 55%), var(--card);
}
.dp-hero .daily-chest.big { width: 130px; height: 130px; flex: none; margin: 0; }
.dp-hero .daily-chest.ready { animation: chest-shake 1.6s ease-in-out infinite; }
.dp-info b { font-family: var(--display); font-size: 22px; }
.dp-info p { color: var(--muted); margin: 6px 0 12px; }
.dp-claim { font-size: 17px; padding: 10px 22px; }
.dp-head { margin: 6px 0 10px; font-size: 16px; }
.daily-chest.small { width: 36px; height: 36px; border-width: 3px; margin: 2px auto; }
.dp-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.dp-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  text-align: center;
}
.dp-day.today { border-color: #f5c542; box-shadow: 0 0 12px rgba(255, 216, 77, 0.3); }
.dp-day.done { opacity: 0.7; }
.dp-day-label { font-family: var(--display); font-weight: 700; font-size: 13px; }
.dp-day small { color: var(--muted); font-size: 12px; }
/* The 7-day track (src/meta/daily.js TRACK): each day's bonus; Day 7 stands out. */
.dp-bonus-icon { font-size: 22px; line-height: 1.2; }
.dp-bonus { font-size: 12px; line-height: 1.25; }
.dp-day.big { border-color: #c084fc; background: color-mix(in srgb, #c084fc 12%, var(--card)); }
.dp-day.big.today { border-color: #f5c542; }
.chest-saved { color: #8ee6a8; font-weight: 700; margin: 4px 0 8px; }
.dp-odds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.dp-odd {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--c);
  background: var(--card);
}
.dp-odd .daily-chest { grid-row: span 2; margin: 0; }
.dp-odd span { font-family: var(--display); font-weight: 700; color: var(--c); }
.dp-odd small { grid-column: 2 / span 2; color: var(--muted); }
.dp-rules a { color: #ffc2d6; }
@media (max-width: 640px) {
  .dp-hero { flex-direction: column; text-align: center; }
  .dp-week { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Marketplace ---------- */
.mk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.mk-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px 12px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--r) 70%, var(--line));
  background: radial-gradient(90% 45% at 50% 0%, color-mix(in srgb, var(--r) 16%, transparent), var(--card) 80%);
  text-align: center;
}
.mk-card > b { font-family: var(--display); font-size: 16px; }
.mk-card small { color: var(--muted); font-size: 12.5px; }
.mk-card .mk-seller { font-style: italic; }
.mk-art { height: 64px; display: grid; place-items: center; }
.mk-tags { position: absolute; top: -9px; right: 8px; display: flex; gap: 4px; }
.mk-tag {
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.mk-tag.bargain { background: var(--ok); color: #05321a; }
.mk-tag.shiny { background: #ffd84d; color: #3a2c00; }
.mk-tag.auction { background: var(--blue); color: #fff; }
.mk-market {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.mk-market em { font-style: normal; font-weight: 700; }
.mk-market em.up, .mk-sp.up { color: var(--ok); }
.mk-market em.down, .mk-sp.down { color: var(--danger); }
.spark { width: 60px; height: 18px; }
.spark polyline { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.spark.up polyline { stroke: var(--ok); }
.spark.down polyline { stroke: var(--danger); }
.mk-price { margin-top: auto; padding-top: 4px; font-family: var(--display); font-size: 20px; font-weight: 700; color: var(--gold); }
.mk-card > button { width: 100%; }
.mk-bids { min-height: 0 !important; }
.mk-you { font-size: 12px; font-weight: 700; }
.mk-you.lead { color: var(--ok); }
.mk-you.out { color: var(--danger); }
.mk-bid-row { display: flex; gap: 6px; width: 100%; }
.mk-bid-row input, .mk-field input, .mk-field select {
  min-width: 0;
  flex: 1;
  font: inherit;
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
  color: var(--ink);
}
.mk-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.mk-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--r) 45%, var(--line));
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.mk-pick small { color: var(--muted); font-size: 12px; }
.mk-pick.on { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold) inset, 0 0 12px rgba(255, 203, 5, 0.3); }
.mk-sell { --r: var(--gold); display: flex; flex-direction: column; gap: 10px; }
.mk-sell-head { display: flex; align-items: center; gap: 12px; }
.mk-sell-head b { display: block; font-family: var(--display); font-size: 19px; }
.mk-sell-head small { color: var(--muted); }
.mk-facts { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; font-size: 14px; }
.mk-facts dt { color: var(--muted); }
.mk-facts dd { margin: 0; font-weight: 700; }
.mk-mode { display: flex; gap: 6px; }
.mk-field input, .mk-field select { width: 100%; box-sizing: border-box; }
.mk-field { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.mk-outlook { margin: 0; font-weight: 700; }
.mk-outlook small { font-weight: 400; color: var(--muted); }
.mk-outlook.good { color: var(--ok); }
.mk-outlook.warn { color: #ffd84d; }
.mk-outlook.bad { color: var(--danger); }
.mk-warn { margin: 0; font-size: 13px; color: #ffd84d; }
.mk-list { width: 100%; }
.mk-rows { display: flex; flex-direction: column; gap: 8px; }
.mk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
}
.mk-row-main { flex: 1; min-width: 0; }
.mk-row-main small { color: var(--muted); }
.mk-status { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.mk-status.active { background: color-mix(in srgb, var(--blue) 35%, transparent); color: #cfe2ff; }
.mk-status.sold { background: color-mix(in srgb, var(--ok) 25%, transparent); color: var(--ok); }
.mk-status.out { background: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.mk-status.off { background: color-mix(in srgb, var(--muted) 20%, transparent); color: var(--muted); }
.mk-sp { font-family: var(--display); white-space: nowrap; }
.mk-ghost {
  padding: 5px 12px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.mk-ghost:hover { border-color: var(--gold); }
@media (max-width: 720px) {
  .mk-row { flex-wrap: wrap; }
}

/* ---------- Account (cloud saves) ---------- */
.account-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  color: #fff;
  background: rgba(61, 121, 214, 0.35);
  border: 2px solid rgba(143, 196, 255, 0.55);
}

/* Options, beside the account button (it used to be the last side-nav link). */
.header-options {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.header-options svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.header-options:hover,
.header-options[aria-current='page'] {
  color: var(--gold);
  border-color: var(--gold);
}

/* The bell (src/ui/notices.js): a red count for what's new, and its list dropping down below. */
.notice-wrap {
  position: relative;
  display: inline-flex;
  flex: none;
}

.notice-bell {
  position: relative;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.notice-bell[hidden] {
  display: none;
}

.notice-bell.has-new {
  color: var(--gold);
  border-color: var(--gold);
}

.notice-bell.has-new svg {
  animation: notice-ring 2.4s ease-in-out infinite;
  transform-origin: 50% 10%;
}

@keyframes notice-ring {
  0%, 70%, 100% { transform: rotate(0); }
  75% { transform: rotate(14deg); }
  82% { transform: rotate(-12deg); }
  89% { transform: rotate(8deg); }
  95% { transform: rotate(-4deg); }
}

@media (prefers-reduced-motion: reduce) {
  .notice-bell.has-new svg {
    animation: none;
  }
}

.notice-count {
  position: absolute;
  top: -6px;
  right: -7px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font: 700 11px/18px var(--display);
  font-style: normal;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.notice-count[hidden] {
  display: none;
}

.notice-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: -60px;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  max-height: min(480px, 70vh);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.notice-panel[hidden] {
  display: none;
}

.notice-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 2px solid var(--line);
  font-family: var(--display);
}

.notice-head small {
  color: var(--muted);
  font-size: 12px;
}

.notice-list {
  overflow-y: auto;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  line-height: 1.35;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.notice:hover {
  background: var(--card);
}

.notice.new {
  background: rgba(255, 203, 5, 0.08);
  box-shadow: inset 3px 0 0 var(--gold);
}

.notice-icon {
  flex: none;
  width: 22px;
  text-align: center;
  font-size: 17px;
}

.notice-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice-text small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.notice-empty {
  margin: 0;
  padding: 18px 14px;
  color: var(--muted);
  font-size: 14px;
}

/* On phones the list spans the window under the header. */
@media (max-width: 900px) {
  .notice-panel {
    position: fixed;
    top: var(--notice-top, 56px);
    left: 16px;
    right: 16px;
    width: auto;
    max-height: calc(100vh - var(--notice-top, 56px) - 16px);
  }
}

.account-btn[data-status='synced'] {
  background: rgba(46, 160, 90, 0.3);
  border-color: rgba(120, 220, 150, 0.55);
}

.account-btn[data-status='error'] {
  background: rgba(200, 60, 60, 0.35);
  border-color: rgba(255, 140, 140, 0.6);
}

@media (max-width: 640px) {
  .account-btn > span:last-child {
    display: none;
  }
}

.starter-account {
  margin-top: 14px;
}

.starter-account .account-btn {
  font-size: 15px;
  padding: 8px 18px;
}

.account-dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: #1a2140;
  color: #e8ecff;
}

.account-dialog::backdrop {
  background: rgba(5, 8, 20, 0.6);
}

.account-form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.account-form h3 {
  margin: 0;
  font-family: var(--display);
  color: var(--gold);
}

.account-form p {
  margin: 0;
  line-height: 1.45;
}

.account-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.account-form input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid rgba(143, 196, 255, 0.4);
  background: #10162e;
  color: #fff;
  font: inherit;
}

.account-msg {
  min-height: 1.2em;
  color: #b8c4ee;
  font-size: 14px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.account-links {
  font-size: 14px;
  color: #8f9bc8;
  text-align: center;
}

.account-hint {
  margin-top: -6px;
  color: #8f9bc8;
}

/* A text link that's really a button (switching between the sign-in forms). */
button.link-btn {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: #8fc4ff;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

button.link-btn:hover:not(:disabled) {
  background: none;
  color: #fff;
  transform: none;
}

/* ---------- Free daily summon ---------- */
.free-summon {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(143, 196, 255, 0.25);
}

.free-summon.ready {
  border-color: var(--gold);
  background: rgba(255, 203, 5, 0.1);
}

.free-summon-icon {
  font-size: 30px;
}

.free-summon > div {
  flex: 1;
  display: grid;
  gap: 2px;
}

.free-summon small {
  color: #b8c4ee;
}

/* ---------- My Profile ---------- */
.pf-head .tc-left canvas {
  width: 128px;
  height: 128px;
  image-rendering: pixelated;
}

.pf-name {
  margin: 0;
  font-family: var(--pixel);
  font-size: 30px;
  color: var(--gold);
}

/* ---------- Trainer titles (src/meta/titles.js, ui/titleTag.js) ---------- */
.title-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.03em;
  vertical-align: 0.15em;
  white-space: nowrap;
  text-shadow: none;
}

.pf-name .title-tag {
  font-size: 14px;
  vertical-align: 0.4em;
}

.title-bronze {
  border-color: #c98a4b;
  background: rgba(201, 138, 75, 0.18);
  color: #f0b77d;
}

.title-champion {
  border-color: #6aa8ff;
  background: rgba(70, 120, 230, 0.25);
  color: #bcd7ff;
}

.title-mega {
  border-color: #c77dff;
  background: linear-gradient(90deg, rgba(255, 90, 160, 0.3), rgba(120, 90, 255, 0.3));
  color: #f3d6ff;
}

.title-legend {
  border-color: #ffd257;
  background: rgba(255, 196, 0, 0.16);
  color: #ffe08a;
}

.title-shiny {
  border-color: #9ff3ff;
  background: rgba(120, 230, 255, 0.16);
  color: #c9f8ff;
}

.title-dex {
  border-color: #ff6b6b;
  background: linear-gradient(90deg, rgba(229, 57, 53, 0.3), rgba(255, 255, 255, 0.08));
  color: #ffd0cc;
}

.title-endless {
  border-color: #ff7a59;
  background: rgba(255, 110, 70, 0.2);
  color: #ffc2ad;
}

/* The Creator: gold, with a shine sweeping across now and then. */
.title-creator {
  border-color: #ffe27a;
  background: linear-gradient(110deg, #b8860b 0%, #ffd34d 35%, #fff6c8 50%, #ffd34d 65%, #b8860b 100%) 0 0 / 250% 100%;
  color: #3a2500;
  box-shadow: 0 0 8px rgba(255, 210, 77, 0.55);
  animation: title-shine 3.2s linear infinite;
}

@keyframes title-shine {
  0% {
    background-position: 100% 0;
  }
  60%,
  100% {
    background-position: -150% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .title-creator {
    animation: none;
  }
}

.pf-title-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 2px;
  font-size: 13px;
  color: var(--muted, #b9c2e0);
}

.pf-title-pick select {
  max-width: 260px;
}

/* The trainer's name change (ui/pages.js renameForm). */
.pf-rename {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 2px;
}
.pf-rename input {
  width: 9.5em;
  max-width: 100%;
  height: 34px;
  padding: 4px 8px;
  box-sizing: border-box;
}
.pf-rename small {
  flex-basis: 100%;
}
.pf-rename-btn {
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}

/* "About me" on the profile: the text as written (line breaks kept), or a box on your own. */
.pf-bio-text {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.pf-bio-form textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 4.6em;
  padding: 8px 10px;
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}
.pf-bio-form textarea:focus {
  outline: none;
  border-color: var(--gold);
}
.pf-bio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.pf-bio-bar .bad {
  color: var(--danger);
}

.pf-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pf-columns {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.2fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .pf-columns {
    grid-template-columns: 1fr;
  }
}

.pf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pf-table th,
.pf-table td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.pf-table th {
  width: 48%;
  font-weight: 600;
  color: #b8c4ee;
}

.pf-table tr:nth-child(odd) {
  background: rgba(255, 255, 255, 0.03);
}

.pf-online {
  color: #6ee7a0;
}

.pf-team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
}

.pf-mon {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0;
  padding: 10px 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(143, 196, 255, 0.2);
  text-align: center;
}

.pf-mon.shiny {
  border-color: rgba(255, 203, 5, 0.55);
}

.pf-mon canvas {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
}

.pf-mon figcaption {
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.pf-mon small {
  color: #b8c4ee;
}

.pf-stars {
  color: var(--gold) !important;
  letter-spacing: 1px;
}

/* The showcase: the trainer's Pokémon on show, edged in their rarity's colour. */
.pf-showcase .promo-section-head button {
  margin-left: auto;
}

.pf-show-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

.pf-show {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0;
  padding: 10px 6px;
  border-radius: 14px;
  border: 2px solid var(--rar);
  background: radial-gradient(70% 55% at 50% 38%, color-mix(in srgb, var(--rar) 22%, transparent), rgba(255, 255, 255, 0.03));
  text-align: center;
}

.pf-show.finish-golden {
  border-color: #ffcb05;
  box-shadow: 0 0 14px rgba(255, 203, 5, 0.35);
}

.pf-show.finish-crystal {
  border-color: #8cdcff;
  box-shadow: 0 0 14px rgba(140, 220, 255, 0.35);
}

.pf-show.finish-shadow {
  border-color: #b46cff;
  box-shadow: 0 0 14px rgba(150, 80, 230, 0.4);
}

.pf-show canvas {
  width: 80px;
  height: 80px;
  image-rendering: pixelated;
}

.pf-show figcaption {
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.pf-show-tag {
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
}

.pf-show-grid.pick {
  max-height: min(60vh, 560px);
  overflow-y: auto;
  padding: 12px 16px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}

.pf-show-pick {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: none;
  color: inherit;
  cursor: pointer;
}

.pf-show-pick .pf-show canvas {
  width: 56px;
  height: 56px;
}

.pf-show-pick.on .pf-show {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}

.pf-show-pick:disabled {
  opacity: 0.45;
  cursor: default;
}

.pf-show-no {
  position: absolute;
  top: 4px;
  left: 6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1030;
  font-style: normal;
  font-weight: 800;
  font-size: 12px;
}

.pf-show-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px;
}

/* ---------- Weekly tournament ---------- */
.tourney-card {
  border-color: rgba(255, 203, 5, 0.55);
}

.tourney-prizes summary {
  cursor: pointer;
  color: var(--gold);
}

.tourney-prizes ul {
  margin: 8px 0;
  padding-left: 18px;
}

.tourney-board .lb-table td {
  padding: 6px 8px;
}

/* The Endless board's run viewer (src/ui/runViewer.js): the map with the team pinned on it. */
.run-view {
  padding: 2px 8px;
  min-height: 0;
}

.run-map {
  position: relative;
  margin: 10px auto;
  border-radius: 10px;
  overflow: hidden;
  background: #22301f;
}

.run-map img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.run-pin {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -60%);
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.6));
}

.run-pin.mega {
  filter: drop-shadow(0 0 5px #ce93d8);
}

.run-team {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

/* ---------- Weekly Endless ---------- */
.endless-card {
  border-color: rgba(149, 128, 255, 0.6);
}

/* Milestone rounds, ticked once reached this week. */
.endless-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.endless-steps li {
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
}

.endless-steps li small {
  color: var(--muted);
}

.endless-steps li.done {
  border-color: var(--ok);
}

.endless-steps li.done b::after {
  content: ' ✓';
  color: var(--ok);
}

/* ---------- First-match tutorial ---------- */
.tutorial-card {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  width: min(420px, calc(100vw - 32px));
  transform: translateX(-50%);
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(16, 22, 46, 0.95);
  border: 2px solid var(--gold);
  color: #e8ecff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.tutorial-card b {
  font-family: var(--display);
  font-size: 18px;
  color: var(--gold);
}

.tutorial-card p {
  margin: 0;
  line-height: 1.45;
}

.tutorial-step {
  color: #8f9bc8;
}

.tutorial-actions {
  display: flex;
  justify-content: flex-end;
}

/* One-time tips (src/ui/tips.js): the same card, up top so it clears the Fight box. */
.tip-card {
  top: 64px;
  bottom: auto;
  animation: tip-in 0.25s ease-out;
}

.tip-card p b {
  font: inherit;
  font-weight: 700;
  color: #ffe58a;
}

@keyframes tip-in {
  from {
    opacity: 0;
    transform: translate(-50%, -8px);
  }
}

/* ---------- Settings ---------- */
.set-card {
  display: grid;
  gap: 12px;
  max-width: 640px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(143, 196, 255, 0.22);
}

.set-card h3 {
  margin: 0;
  font-family: var(--display);
  color: var(--gold);
}

.set-row {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  align-items: center;
  gap: 12px;
}

.set-row output {
  min-width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #b8c4ee;
}

.set-row select,
.set-danger input:not([type='checkbox']) {
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid rgba(143, 196, 255, 0.4);
  background: #10162e;
  color: #fff;
  font: inherit;
}

.set-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.set-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  margin: 0;
}

.set-facts dt {
  color: #b8c4ee;
}

.set-facts dd {
  margin: 0;
}

.set-danger {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 10px;
}

.set-danger summary {
  cursor: pointer;
  color: #ff9a9a;
  font-weight: 600;
}

.set-danger form {
  display: grid;
  gap: 10px;
  max-width: 360px;
  margin-top: 10px;
}

.set-danger label:not(.set-check) {
  display: grid;
  gap: 6px;
}

.set-foot {
  color: #8f9bc8;
  font-size: 14px;
}

@media (max-width: 560px) {
  .set-row {
    grid-template-columns: 1fr auto;
  }
  .set-row > span {
    grid-column: 1 / -1;
  }
}

/* Reduce motion (Settings, or the device's preference): stop decorative animation. */
.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

.lb-report {
  margin-left: 6px;
  font-size: 13px;
  opacity: 0.55;
  text-decoration: none;
}

.lb-report:hover {
  opacity: 1;
}

/* ---------- Privacy page ---------- */
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 18px 60px;
  line-height: 1.6;
  color: #e8ecff;
}

.legal h1,
.legal h2 {
  font-family: var(--display);
  color: var(--gold);
}

.legal a {
  color: #8fc4ff;
}

/* ---------- Friends ---------- */
.fr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.tl-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tl-tools input { flex: 1; min-width: 0; }

.tl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

.tl-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tl-row .pfp, .tl-blank { flex: none; width: 32px; height: 32px; }

.tl-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.tl-name small { display: block; color: var(--muted); }

.tl-no { flex: none; color: var(--muted); }

.tl-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.fr-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid rgba(143, 196, 255, 0.25);
}

.fr-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.fr-head canvas {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
}

.fr-head small {
  display: block;
  color: #b8c4ee;
}

.fr-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0;
}

.fr-stats div {
  padding: 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  text-align: center;
}

.fr-stats dt {
  font-size: 12px;
  color: #b8c4ee;
}

.fr-stats dd {
  margin: 2px 0 0;
  font-family: var(--display);
  font-weight: 700;
}

.fr-champ {
  color: var(--gold);
}

.fr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Trading Center (ui/trades.js) ---------- */
.tc-count {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-style: normal;
  font-size: 12px;
}
.tc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 10px; }
.tc-all { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.tc-row input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--gold); }
.tc-row.picked { border-color: var(--gold); }
.tc-swap { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 4px; }
.tc-swap > div > small { display: block; color: var(--muted); }
.tc-arrow { font-size: 22px; color: var(--gold); }
.tc-new { color: var(--gold); }
.tc-st { display: grid; justify-items: center; gap: 2px; }
.tc-st small { color: var(--muted); font-size: 12px; }
.tc-row-actions { display: flex; gap: 6px; }
.tc-x { color: var(--danger); }
.tc-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.tc-send { display: grid; justify-items: start; gap: 8px; margin-top: 16px; }
.tc-options { display: grid; gap: 8px; justify-items: start; }
.tc-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 100%);
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
  cursor: pointer;
}
.tc-option:has(input:checked) { border-color: var(--gold); }
.tc-option input { accent-color: var(--gold); }
.tc-option small { display: block; color: var(--muted); }
.tc-rules { margin: 6px 0 0; padding-left: 20px; color: var(--muted); }
.tc-rules li { margin: 4px 0; }
.tc-view { display: grid; gap: 10px; padding: 14px; }
.tc-view .tc-st { justify-items: start; }
.tr-mons { display: inline-flex; flex-wrap: wrap; gap: 6px; vertical-align: middle; }
.tr-mon { display: inline-flex; flex-direction: column; align-items: center; min-width: 52px; }
.tr-mon canvas { width: 40px; height: 40px; image-rendering: pixelated; }
.tr-mon small { font-size: 11px; white-space: nowrap; }
.tr-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; max-height: 340px; overflow-y: auto; }
.tr-pick-mon {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.tr-pick-mon canvas { width: 48px; height: 48px; }
.tr-pick-mon i { font-style: normal; font-size: 10px; color: var(--gold); }
.tr-pick-mon:hover:not(:disabled) { border-color: var(--gold); }
.tr-pick-mon.on { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 14%, var(--card)); }
.tr-pick-mon:disabled { opacity: 0.4; cursor: default; }
.tr-count { position: absolute; top: 4px; right: 6px; font-size: 12px; color: var(--gold); }
@media (max-width: 720px) {
  .tc-sides { grid-template-columns: 1fr; }
  .tc-row { flex-wrap: wrap; }
  .tc-row .mk-row-main { flex: 1 1 calc(100% - 40px); }
  .tc-row .tc-st { margin-left: 30px; }
  .tc-row .tc-row-actions { margin-left: auto; }
  .tr-pick { max-height: 260px; }
}

/* ---------- Leaderboards ---------- */
.lb-you {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: rgba(61, 121, 214, 0.18);
  border: 2px solid rgba(143, 196, 255, 0.35);
}

.lb-name label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  flex: 1 1 220px;
}

.lb-name input,
.lb-picker select {
  padding: 9px 12px;
  border-radius: 10px;
  border: 2px solid rgba(143, 196, 255, 0.4);
  background: #10162e;
  color: #fff;
  font: inherit;
}

.lb-msg {
  flex-basis: 100%;
  color: #b8c4ee;
}

.lb-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.lb-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lb-mode.active {
  background: var(--gold);
  color: #2a2000;
}

/* Tabs between pages that share a nav item (Wild Areas: Search · Expeditions). */
.page-tabs {
  margin: 0 0 10px;
}

.page-tabs a.lb-mode {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  text-decoration: none;
}

.page-tabs a.lb-mode.active {
  border-color: var(--gold);
  background: var(--gold);
  color: #2a2000;
}

.nav-dot.tab-dot {
  position: static;
}

.nav-dot.tab-dot:not([hidden]) {
  display: inline-block;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.lb-table th,
.lb-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.lb-table th {
  font-family: var(--display);
  color: #b8c4ee;
  font-weight: 600;
}

.lb-rank {
  width: 44px;
  font-weight: 700;
}

.lb-table tr.me td {
  background: rgba(255, 203, 5, 0.12);
}

.lb-name-cell small {
  color: var(--gold);
}

.lb-empty {
  padding: 20px 0;
  color: #b8c4ee;
}

/* ---------- Chat box (src/ui/chat.js) ---------- */
/* A gold "💬 Chat" pill in the corner, pulsing while messages wait unread. */
.chat-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 20px 0 14px;
  border-radius: 999px;
  border: 3px solid #fff3b0;
  background: linear-gradient(180deg, #ffd84d, #f2b600);
  color: #2b2000;
  font: 700 18px var(--display);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 18px rgba(255, 203, 5, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.chat-fab-icon {
  font-size: 24px;
}
.chat-fab.has-unread {
  animation: chat-pulse 1.6s ease-out infinite;
}
@keyframes chat-pulse {
  0% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(255, 203, 5, 0.75); }
  70% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 16px rgba(255, 203, 5, 0); }
  100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(255, 203, 5, 0); }
}
/* A new message's preview over the button while the chat is closed (chat.js peek). */
.chat-peek {
  position: fixed;
  right: 20px;
  bottom: 84px;
  z-index: 40;
  display: grid;
  gap: 2px;
  max-width: min(300px, calc(100vw - 40px));
  padding: 10px 14px;
  border: 2px solid var(--gold);
  border-radius: 14px 14px 4px 14px;
  color: var(--ink);
  background: var(--card-hi);
  text-align: left;
  font: 500 14px var(--display);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.chat-peek[hidden] {
  display: none;
}
.chat-peek b {
  color: var(--gold);
}
.chat-peek.show {
  animation: chat-peek-in 0.3s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes chat-peek-in {
  from { transform: translateY(10px) scale(0.95); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-fab.has-unread,
  .chat-peek.show {
    animation: none;
  }
}

.chat-fab:hover {
  transform: scale(1.07);
}

.chat-badge,
.chat-dot {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font: 700 12px/18px var(--display);
}

.chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
}

.chat-dot {
  margin-left: 6px;
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 88px;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  height: min(480px, calc(100vh - 140px));
  display: flex;
  flex-direction: column;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.chat-panel[hidden] {
  display: none;
}

.chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--card);
  font-family: var(--display);
  color: var(--gold);
}

.chat-close {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
}

.chat-tabs {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.chat-tabs:empty {
  display: none;
}

.chat-tab {
  flex: none;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 600 13px var(--display);
  cursor: pointer;
}

.chat-tab.active {
  border-color: var(--gold);
  background: rgba(255, 203, 5, 0.15);
  color: var(--ink);
}

.chat-log {
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-line {
  display: grid;
  gap: 2px;
  max-width: 88%;
}

.chat-line.mine {
  align-self: flex-end;
  text-align: right;
}

.chat-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.chat-line.mine .chat-meta {
  justify-content: flex-end;
}

.chat-meta b {
  color: #8fc4ff;
}

/* A trainer's profile picture beside their name (src/ui/avatar.js). */
.pfp {
  flex: none;
  width: 24px;
  height: 24px;
  align-self: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(13, 18, 38, 0.6) 75%);
  image-rendering: pixelated;
}

.chat-meta .pfp {
  margin-right: -2px;
}

.chat-line.mine .chat-meta b {
  color: var(--gold);
}

.chat-body {
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--card);
  overflow-wrap: anywhere;
  text-align: left;
}

.chat-line.mine .chat-body {
  background: #2d3a7a;
}

/* A rare Wild Areas catch, announced: full width, the Pokémon beside the line. */
.chat-line.chat-find {
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 2px 6px;
  max-width: 100%;
  padding: 4px 6px;
  border-radius: 12px;
  border: 1px solid rgba(255, 203, 5, 0.35);
  background: linear-gradient(90deg, rgba(255, 203, 5, 0.12), transparent);
}

.chat-find canvas {
  grid-row: span 2;
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.chat-find .chat-body {
  padding: 0;
  background: none;
  font-size: 13px;
}

.chat-find .chat-body b {
  color: var(--gold);
}

.chat-find .chat-census-pic {
  grid-row: span 2;
  display: block;
  line-height: 0;
}

.chat-find .chat-census {
  text-decoration: none;
}

.chat-find .chat-census:hover b,
.chat-find .chat-census:focus-visible b {
  text-decoration: underline;
}

.chat-find time {
  font-size: 11px;
  color: var(--muted);
}

.chat-find.finish-crystal {
  border-color: rgba(140, 220, 255, 0.45);
  background: linear-gradient(90deg, rgba(140, 220, 255, 0.14), transparent);
}

.chat-find.finish-shadow {
  border-color: rgba(180, 108, 255, 0.5);
  background: linear-gradient(90deg, rgba(120, 60, 200, 0.2), transparent);
}

.chat-report {
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  font-size: 12px;
}

.chat-line:hover .chat-report,
.chat-report:focus-visible {
  opacity: 0.8;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
}

.chat-empty button {
  margin-top: 8px;
}

.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.chat-form[hidden] {
  display: none;
}

.chat-form input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 2px solid rgba(143, 196, 255, 0.35);
  border-radius: 10px;
  background: #10162e;
  color: var(--ink);
  font: inherit;
}

.chat-msg {
  padding: 0 12px;
  color: #ff9aa5;
  font-size: 13px;
}

.chat-msg:not(:empty) {
  padding-bottom: 8px;
}

/* On phones the side nav is a bottom tab bar (about 85px): the chat sits above it. */
@media (max-width: 760px) {
  .chat-fab {
    right: 14px;
    bottom: 98px;
    height: 50px;
    padding: 0 12px;
  }

  /* (Just the gold bubble on phones: no room for the label.) */
  .chat-fab-label {
    display: none;
  }

  .chat-peek {
    right: 14px;
    bottom: 156px;
  }

  .chat-panel {
    right: 8px;
    left: 8px;
    bottom: 156px;
    width: auto;
    height: min(60vh, calc(100vh - 220px));
    min-height: 220px;
  }

  /* (No hover on phones: the report button stays visible.) */
  .chat-report {
    opacity: 0.6;
  }
}

/* Phones held sideways, in a match: the chat bubble sat on the Fight! box (bottom right). It goes
   just above it, smaller, and the chat opens the full height of the screen. */
@media (max-height: 500px) {
  .game-page .chat-fab {
    right: 12px;
    bottom: 128px;
    height: 40px;
    padding: 0 10px;
  }

  .game-page .chat-fab-label {
    display: none;
  }

  .game-page .chat-peek {
    right: 12px;
    bottom: 176px;
  }

  .game-page .chat-panel {
    top: 8px;
    bottom: 8px;
    height: auto;
    min-height: 0;
  }
}

/* ---------- Map intro (each map's wild Pokémon, leader and rule; src/data/wild.js) ---------- */
.map-intro {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 6;
  display: grid;
  gap: 6px;
  max-width: min(360px, calc(100% - 24px));
  padding: 12px 14px;
  border: 2px solid var(--gold);
  border-radius: 14px;
  background: rgba(13, 18, 38, 0.9);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  font-size: 13px;
}

.map-intro[hidden] {
  display: none;
}

.map-intro-title {
  font-family: var(--display);
  font-size: 16px;
  color: var(--gold);
}

.map-intro-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.map-intro-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.map-intro-row canvas {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
}

.map-intro small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  color: var(--muted);
}

.map-intro-rule {
  margin: 2px 0 0;
  line-height: 1.4;
}

.map-intro-rule b {
  display: block;
  color: var(--ink);
}

.nw-enemy.leader b {
  color: var(--gold);
}

/* ---------- Move choice (src/data/moves.js) ---------- */
.move-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.move-option {
  display: grid;
  gap: 6px;
  padding: 14px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.move-option:hover,
.move-option:focus-visible {
  border-color: var(--gold);
  background: var(--card-hi);
}

.move-option b {
  font-family: var(--display);
  font-size: 17px;
}

.move-option small {
  color: var(--muted);
  line-height: 1.35;
}

.move-note {
  display: block;
  margin-top: 2px;
}

@media (max-width: 480px) {
  .move-options {
    grid-template-columns: 1fr;
  }
}

/* Play cards: the map's wild types, leader and rule (src/data/wild.js). */
.map-wild {
  display: grid;
  gap: 4px;
  margin: 6px 0 2px;
  font-size: 12px;
  color: var(--muted);
}

.map-wild small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
}

.map-wild b {
  color: var(--ink);
}

.map-rule {
  display: block !important;
  line-height: 1.4;
}

/* ---------- A leader's entrance (src/main.js leaderEntrance) ---------- */
.leader-banner {
  position: absolute;
  top: 34%;
  left: 0;
  right: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 24px;
  background: linear-gradient(90deg, transparent, rgba(13, 18, 38, 0.92) 18%, rgba(13, 18, 38, 0.92) 82%, transparent);
  border-top: 3px solid var(--gold);
  border-bottom: 3px solid var(--gold);
  pointer-events: none;
}

.leader-banner[hidden] {
  display: none;
}

.leader-banner.show {
  animation: leader-sweep 3.2s ease-in-out forwards;
}

.leader-banner canvas {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 10px rgba(255, 213, 79, 0.7));
}

.leader-banner div {
  display: grid;
  gap: 4px;
}

.leader-banner small {
  font-family: var(--display);
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.leader-banner b {
  font-family: var(--pixel);
  font-size: clamp(22px, 3.2vw, 36px);
  color: #fff;
  text-shadow: 0 3px 0 #000;
}

@keyframes leader-sweep {
  0% { transform: translateX(-110%); opacity: 0; }
  12% { transform: translateX(0); opacity: 1; }
  82% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(110%); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .leader-banner.show {
    animation: none;
  }
}

/* Wave timeline: the rounds after the next one (src/main.js renderNextWave). */
.nw-timeline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
}

.nw-timeline > small {
  width: 100%;
  color: var(--muted);
  font-size: 11px;
}

.nw-round {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 2px 5px 2px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-size: 11px;
}

.nw-round b {
  margin-right: 2px;
  color: var(--muted);
}

.nw-round canvas {
  width: 20px;
  height: 20px;
  image-rendering: pixelated;
}

.nw-round.leader {
  border-color: var(--gold);
}

.nw-round.leader b {
  color: var(--gold);
}

/* Roles and signature traits (src/data/kits.js) */
.shop-role {
  margin-right: 3px;
  font-size: 10px;
}

.panel-trait {
  margin: 6px 0 2px;
  padding: 6px 8px;
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  background: rgba(255, 203, 5, 0.08);
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}

.panel-trait b {
  display: block;
  color: var(--ink);
}

.dex-kit {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.dex-kit b {
  color: var(--ink);
}

/* ---------- Pokémon summary card (the selected Pokémon, beside it on the battlefield) ---------- */
.poke-card {
  position: absolute;
  z-index: 8;
  width: 272px;
  max-height: calc(100% - 120px);
  overflow-y: auto;
  padding: 0 0 10px;
  border: 4px solid #2b2f45;
  border-radius: 14px;
  background: #fbf7ec;
  color: #2b2f45;
  box-shadow: 0 0 0 2px #fbf7ec inset, 0 10px 26px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  scrollbar-width: thin;
}

.poke-card[hidden] {
  display: none;
}

.pc-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 34px 8px 8px;
  border-bottom: 3px solid #2b2f45;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(135deg, var(--type) 0 62%, color-mix(in srgb, var(--type) 70%, #fff) 62%);
}

.pc-head canvas {
  flex: none;
  width: 64px;
  height: 64px;
  border: 3px solid #2b2f45;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #fff 0 55%, #e8ecf6 56%);
  image-rendering: pixelated;
}

.pc-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.pc-title b {
  font-family: var(--pixel);
  font-size: 17px;
  color: #fff;
  text-shadow: 2px 2px 0 #2b2f45;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* (A dark pill, so the level reads on any type colour behind it.) */
.pc-lv {
  justify-self: start;
  padding: 1px 9px;
  border-radius: 999px;
  color: #fff;
  background: #2b2f45;
  font: 700 14px / 1.3 var(--display);
  letter-spacing: 0.02em;
  text-shadow: none;
}

.pc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.pc-role {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #2b2f45;
  font-size: 11px;
  font-weight: 700;
}

.pc-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #2b2f45;
  border-radius: 50%;
  background: #fff;
  color: #2b2f45;
  font-size: 12px;
  line-height: 1;
}

.pc-evo,
.pc-stat {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
}

.pc-evo {
  margin-top: 8px;
}

.pc-evo small,
.pc-stat small {
  font-family: var(--pixel);
  font-size: 11px;
  color: #6b6f86;
}

.pc-evo small:last-child,
.pc-stat small:last-child {
  font-family: var(--display);
  color: #2b2f45;
  text-align: right;
}

.pc-evo.ready small:last-child {
  color: #c27b00;
  font-weight: 700;
}

.pc-bar {
  position: relative;
  height: 8px;
  border: 2px solid #2b2f45;
  border-radius: 999px;
  background: #d8dbe6;
  overflow: hidden;
}

.pc-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: #3ea0ff;
  border-radius: 999px;
}

.pc-bar.stat i {
  background: #5ee08a;
}

.pc-box {
  margin: 8px 10px 0;
  padding: 6px 8px;
  border: 2px solid #2b2f45;
  border-radius: 8px;
  background: #fff;
}

.pc-box small {
  font-family: var(--pixel);
  font-size: 10px;
  color: #6b6f86;
}

.pc-box b {
  display: block;
  font-family: var(--display);
}

.pc-box p {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: #4a4e66;
}

.pc-stats {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.pc-moves {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 8px 10px 0;
}

.pc-move {
  padding: 3px 8px;
  border: 2px solid #2b2f45;
  border-radius: 8px;
  background: var(--type);
  font-family: var(--display);
  font-size: 12px;
  font-weight: 600;
}

.pc-note {
  display: block;
  margin: 4px 10px 0;
  color: #6b6f86;
  font-size: 11px;
}

.pc-target {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 8px 10px 0;
  border: 2px solid #2b2f45;
  border-radius: 8px;
  overflow: hidden;
}

.pc-target button {
  padding: 4px 0;
  border: 0;
  border-right: 1px solid #c5c9d8;
  border-radius: 0;
  background: #fff;
  color: #2b2f45;
  font-size: 11px;
  font-weight: 700;
}

.pc-target button:last-child {
  border-right: 0;
}

.pc-target button.active {
  background: #2b2f45;
  color: #fff;
}

.pc-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin: 8px 10px 0;
}

.pc-levels button {
  display: grid;
  padding: 5px 2px;
  border: 2px solid #2b2f45;
  border-radius: 8px;
  background: #ffcb05;
  color: #2b2f45;
}

.pc-levels button:disabled {
  background: #e3e5ec;
  color: #8a8ea3;
}

.pc-levels small {
  font-size: 11px;
}

.pc-big {
  display: block;
  width: calc(100% - 20px);
  margin: 8px 10px 0;
  padding: 7px;
  border: 2px solid #2b2f45;
  border-radius: 8px;
  background: #ffcb05;
  color: #2b2f45;
  font-family: var(--display);
  font-weight: 700;
}

.pc-details {
  margin: 8px 10px 0;
  font-size: 12px;
}

.pc-details summary {
  cursor: pointer;
  color: #6b6f86;
  font-weight: 700;
}

.pc-details .kv {
  color: #2b2f45;
}

.pc-details .kv dt {
  color: #6b6f86;
}

.pc-sell {
  display: block;
  margin: 8px 10px 0 auto;
  padding: 4px 10px;
  border: 2px solid #b3261e;
  border-radius: 8px;
  background: #fff;
  color: #b3261e;
  font-size: 12px;
  font-weight: 700;
}

/* Phones: the card is a sheet at the bottom of the screen, under the map (the map is 58% of the
   screen), so the battlefield and the Fight! button stay in view and tappable. Level-ups and
   evolving come straight after the header, where a thumb reaches them without scrolling the card. */
@media (max-width: 760px) {
  .poke-card {
    position: fixed;
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 60;
    width: auto;
    max-height: calc(42vh - 16px);
    max-height: calc(42svh - 16px);
  }

  .poke-card:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  .poke-card > * {
    flex: none;
  }

  .poke-card > .pc-head {
    order: -4;
  }

  .poke-card > .pc-evo {
    order: -3;
  }

  .poke-card > .pc-big {
    order: -2;
  }

  .poke-card > .pc-levels {
    order: -1;
  }

  /* (While the card is open, tutorial tips go to the top of the screen instead of covering it.) */
  .game-page:has(.poke-card:not([hidden])) .tutorial-card {
    top: 8px;
    bottom: auto;
  }

}

/* ---------- Fight box: round controls on the battlefield ---------- */
.fight-box {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 7;
  display: grid;
  gap: 6px;
  width: 150px;
  padding: 8px;
  border: 4px solid #2b2f45;
  border-radius: 14px;
  background: #fbf7ec;
  color: #2b2f45;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.fb-round {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.fb-round small {
  font-family: var(--pixel);
  font-size: 11px;
  color: #6b6f86;
}

.fb-round b {
  font-family: var(--pixel);
  font-size: 18px;
}

.fb-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fb-small {
  min-width: 34px;
  padding: 3px 6px;
  border: 2px solid #2b2f45;
  border-radius: 8px;
  background: #fff;
  color: #2b2f45;
  font-weight: 700;
}

.fb-auto {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
}

.fb-fight {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border: 3px solid #2b2f45;
  border-radius: 999px;
  background: linear-gradient(#e53935 0 50%, #fff 50%);
  color: #2b2f45;
  cursor: pointer;
}

.fb-fight b {
  padding: 1px 8px;
  border: 2px solid #2b2f45;
  border-radius: 999px;
  background: #fff;
  font-family: var(--pixel);
  font-size: 17px;
}

.fb-ball {
  width: 22px;
  height: 22px;
  border: 3px solid #2b2f45;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 6px #2b2f45;
}

.fb-fight:hover {
  filter: brightness(1.06);
}

.fb-fight:not(.busy) {
  animation: fb-pulse 1.6s ease-in-out infinite;
}

.fb-fight.busy {
  background: linear-gradient(#9aa0b4 0 50%, #fff 50%);
}

@keyframes fb-pulse {
  50% { box-shadow: 0 0 0 4px rgba(255, 203, 5, 0.75); }
}

@media (prefers-reduced-motion: reduce) {
  .fb-fight:not(.busy) {
    animation: none;
  }
}

/* Phones: the team is in the panel under the map; a compact Fight box. */
@media (max-width: 760px) {
  .fight-box {
    width: auto;
    padding: 5px;
  }

  .fb-round,
  .fb-auto {
    display: none;
  }
}

/* ---------- Lives as an HP bar, and the red flash when a wild Pokémon gets through ---------- */
.lives-stat {
  gap: 4px;
}

.hp-label {
  padding: 0 4px;
  border-radius: 4px;
  background: #2b2f45;
  color: #ffcb05;
  font: 700 10px var(--pixel);
}

.hp-bar {
  position: relative;
  width: 74px;
  height: 8px;
  border: 2px solid #2b2f45;
  border-radius: 999px;
  background: #4a4e66;
  overflow: hidden;
}

.hp-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: #5ee08a;
  transition: width 0.35s ease, background 0.3s;
}

.hp-bar i.mid {
  background: #ffcb05;
}

.hp-bar i.low {
  background: #ff5c6c;
  animation: hp-blink 0.8s step-end infinite;
}

@keyframes hp-blink {
  50% { opacity: 0.45; }
}

#stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 0 6px rgba(255, 60, 80, 0.9), inset 0 0 70px rgba(255, 40, 60, 0.6);
}

#stage.hurt::after {
  animation: hurt-flash 0.55s ease-out;
}

#stage.hurt .lives-stat {
  animation: hurt-shake 0.4s ease-out;
}

@keyframes hurt-flash {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes hurt-shake {
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  .hp-bar i.low,
  #stage.hurt .lives-stat {
    animation: none;
  }
}

/* A match saved mid-way: the Continue button on its map's card and the Home card. */
.continue-save {
  display: grid;
  width: 100%;
  margin: 6px 0 2px;
  background: #ffcb05;
  color: #2b2f45;
  border-color: #2b2f45;
}

.continue-save small {
  font-weight: 600;
}

.card-continue.saved .card-kicker {
  color: #ffcb05;
}

/* ---------- Type icons on type chips ---------- */
[data-t]::before {
  margin-right: 3px;
  font-size: 0.95em;
  font-style: normal;
  line-height: 1;
}
[data-t='normal']::before { content: '⚪'; }
[data-t='fire']::before { content: '🔥'; }
[data-t='water']::before { content: '💧'; }
[data-t='electric']::before { content: '⚡'; }
[data-t='grass']::before { content: '🌿'; }
[data-t='ice']::before { content: '❄️'; }
[data-t='fighting']::before { content: '👊'; }
[data-t='poison']::before { content: '☠️'; }
[data-t='ground']::before { content: '⛰️'; }
[data-t='flying']::before { content: '🪶'; }
[data-t='psychic']::before { content: '🔮'; }
[data-t='bug']::before { content: '🐛'; }
[data-t='rock']::before { content: '🪨'; }
[data-t='ghost']::before { content: '👻'; }
[data-t='dragon']::before { content: '🐉'; }
[data-t='dark']::before { content: '🌙'; }
[data-t='steel']::before { content: '⚙️'; }
[data-t='fairy']::before { content: '✨'; }

/* ---------- Poké Ball loading spinner ---------- */
.pb-spin {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 16px;
  margin-right: 6px;
  vertical-align: -3px;
  border: 2px solid #2b2f45;
  border-radius: 50%;
  background: linear-gradient(#e53935 0 46%, #2b2f45 46% 54%, #fff 54%);
  animation: pb-spin 0.9s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.pb-spin::after {
  content: '';
  display: block;
  width: 30%;
  height: 30%;
  margin: 35% auto 0;
  border: 2px solid #2b2f45;
  border-radius: 50%;
  background: #fff;
  box-sizing: border-box;
}

.pb-spin.big {
  width: 54px;
  height: 54px;
  margin: 0;
  border-width: 4px;
}

.pb-spin.big::after {
  border-width: 3px;
}

@keyframes pb-spin {
  0% { transform: rotate(0); }
  60% { transform: rotate(380deg); }
  70% { transform: rotate(350deg); }
  100% { transform: rotate(360deg); }
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.boot {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: #13241a;
  color: #e8ecff;
  font-family: var(--display);
}

@media (prefers-reduced-motion: reduce) {
  .pb-spin {
    animation-duration: 2.4s;
  }
}

/* ---------- My Profile: a trainer card (the site's dark panels, with a gold trim) ---------- */
.trainer-card.pf-head {
  position: relative;
  flex-wrap: wrap;
  padding: 0 18px 16px;
  border: 2px solid rgba(255, 203, 5, 0.55);
  border-radius: 16px;
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(61, 125, 202, 0.28), transparent 60%),
    linear-gradient(180deg, var(--card), var(--panel));
  color: var(--ink);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.tc-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% + 36px);
  margin: 0 -18px 4px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255, 203, 5, 0.16), rgba(255, 203, 5, 0.03) 70%);
  color: var(--gold);
  font-family: var(--pixel);
  letter-spacing: 0.06em;
}

.tc-band b {
  font-size: 18px;
}

.tc-band span {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
}

.pf-head .tc-left {
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

.pf-head .tc-left canvas {
  background: radial-gradient(circle at 50% 55%, var(--card-hi), var(--bg) 70%);
}

.pf-head .pf-name {
  color: var(--gold);
}

.pf-head .muted {
  color: var(--muted);
}

.pf-head .muted a {
  color: #8cc4ff;
}

.pf-head .tc-level {
  color: var(--gold);
}

.pf-head .pf-badges {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

/* ---------- Phones (portrait): one HUD row, the team as a strip under it, the map card below ---------- */
@media (max-width: 760px) {
  #hud {
    left: 8px;
    right: 8px;
    top: 8px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  #hud .stat {
    font-size: 13px;
    padding: 3px 8px 3px 4px;
    gap: 4px;
  }

  #hud .map-chip,
  .hp-label {
    display: none;
  }

  .hp-bar {
    width: 44px;
  }

  .map-intro {
    top: 100px;
    bottom: auto;
    left: 8px;
    right: 8px;
    font-size: 12px;
    max-height: calc(100% - 190px);
    overflow-y: auto;
  }

  .map-intro-row canvas {
    width: 24px;
    height: 24px;
  }

  .tip-card {
    top: 100px;
  }

  #overlay .card {
    padding: 14px 12px;
  }

  .card h2 {
    font-size: 24px;
  }

  .ov-stat b {
    font-size: 16px;
  }
}

/* Short screens (phones held sideways): a smaller map card and Fight box; cards scroll. */
@media (max-height: 500px) {
  .map-intro {
    font-size: 12px;
    max-height: calc(100% - 70px);
    overflow-y: auto;
  }

  .map-intro-row {
    display: none;
  }

  .fight-box .fb-round {
    display: none;
  }

  .poke-card {
    max-height: calc(100% - 66px);
    overflow-y: auto;
  }

  .tip-card {
    top: 8px;
  }
}

/* ---------- Expeditions (src/ui/expeditions.js) ---------- */
.team-slot.away {
  position: relative;
  opacity: 0.45;
}

.team-slot.away::after {
  content: '🧭';
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 11px;
}

.card-expedition {
  background: linear-gradient(135deg, #2d4a2a, #1d2650 75%);
}

.card-expedition.ready {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 204, 51, 0.35), 0 0 18px rgba(255, 204, 51, 0.25);
}

.exp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.exp-head h3 {
  margin: 0;
}

.exp-head h3 small {
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  margin-left: 6px;
}

.exp-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.exp-slot {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 84px;
  padding: 12px;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--card);
}

.exp-slot.empty,
.exp-slot.locked {
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border-style: dashed;
  color: var(--muted);
  text-align: center;
}

.exp-slot.locked {
  opacity: 0.6;
}

.exp-lock {
  font-size: 22px;
}

.exp-slot.done {
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(255, 204, 51, 0.16), var(--card) 70%);
}

.exp-slot canvas {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  flex: none;
}

.exp-info {
  display: grid;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.exp-info small {
  color: var(--muted);
}

.exp-bar {
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.exp-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5fd16b, #ffcb05);
}

.exp-reports {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.exp-reports li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
}

.exp-reports canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
  flex: none;
}

.exp-areas {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0 8px;
  margin-top: 8px;
}

.exp-area {
  flex: none;
  display: grid;
  gap: 4px;
  justify-items: start;
  min-width: 140px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-align: left;
}

.exp-area .type-chip {
  font-size: 10px;
  margin-right: 3px;
}

.exp-area.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 204, 51, 0.3);
}

.exp-area:disabled {
  opacity: 0.45;
}

.exp-area-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  color: var(--muted);
}

.exp-area-note canvas {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}

.exp-picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
  margin: 8px 0 12px;
}

.exp-pick {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.exp-pick canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.exp-pick small {
  font-size: 11px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exp-pick.good {
  border-color: rgba(95, 209, 107, 0.6);
}

.exp-pick.active {
  border-color: var(--gold);
  background: rgba(255, 204, 51, 0.14);
}

.exp-good {
  position: absolute;
  top: 3px;
  right: 6px;
  font-style: normal;
  color: #5fd16b;
  font-size: 12px;
}

.exp-trips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.exp-trip {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
}

.exp-trip small {
  color: var(--muted);
  font-size: 11px;
}

.exp-trip.active {
  border-color: var(--gold);
  background: rgba(255, 204, 51, 0.14);
}

.exp-go {
  width: 100%;
}

.exp-foot {
  font-size: 13px;
}

@media (max-width: 760px) {
  .exp-trips {
    grid-template-columns: 1fr;
  }
}

/* (Six Home cards: the milestones card takes two columns on wide screens so its list fits.) */
@media (min-width: 1100px) {
  .home-grid .card-goals {
    grid-column: span 2;
  }
}

/* Password fields: a 👁 button to show or hide what's typed (src/ui/account.js). */
.pw-field {
  position: relative;
  display: block;
}

.pw-field input {
  width: 100%;
  padding-right: 42px;
}

.pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 34px;
  height: 30px;
  padding: 0;
  border: none;
  background: transparent;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

/* A Gym leader's team on their card: the ace last, a little bigger. */
.gym-team {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}

.gym-team canvas {
  width: 36px;
  height: 36px;
  image-rendering: pixelated;
}

.gym-team canvas.ace {
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 0 4px var(--gem, #ffcb05));
}

/* A Johto Elite Four member's team in their step. */
.elite-team {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-top: 4px;
}

.elite-team canvas {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}

.elite-team canvas.ace {
  width: 36px;
  height: 36px;
  filter: drop-shadow(0 0 3px #ffcb05);
}

.badge-case + .badge-case {
  margin-top: 10px;
}

/* An income Pokémon's earnings on its card (src/main.js renderPanel). */
.pc-box.pc-income {
  border-color: #c9a227;
  background: #fff8dc;
}

.pc-box.pc-income b {
  color: #8a6a00;
}

/* ---------- Pokémon summary page (src/ui/pokeSummary.js), like the games' summary screen ---------- */
.tm-art[data-act],
.tm-name[data-act],
.dex-card.has-summary {
  cursor: pointer;
}

.poke-summary {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
}

.poke-summary::backdrop {
  background: rgba(5, 8, 20, 0.65);
  backdrop-filter: blur(2px);
}

.ps-card {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-bottom: 12px;
  border: 4px solid #2b2f45;
  border-radius: 16px;
  background: #f6f2e6;
  color: #2b2f45;
  box-shadow: 0 0 0 3px var(--r), 0 20px 50px rgba(0, 0, 0, 0.5);
}

.ps-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--type), color-mix(in srgb, var(--type) 45%, #2b2f45));
  color: #fff;
}

.ps-sprite {
  width: 112px;
  height: 112px;
  flex: none;
  image-rendering: pixelated;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 70%);
}

.ps-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.ps-title h2 {
  margin: 0;
  font-family: var(--pixel);
  font-size: 24px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.ps-rarity {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  opacity: 0.9;
}

.ps-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.ps-role {
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  font-size: 12px;
  font-weight: 700;
}

.ps-stars {
  color: #ffd84d;
  letter-spacing: 1px;
}

.ps-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
}

.ps-evo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  flex-wrap: wrap;
}

.ps-evo figure {
  margin: 0;
  display: grid;
  justify-items: center;
  font-size: 12px;
  font-weight: 700;
}

.ps-evo canvas {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
}

.ps-arrow {
  display: grid;
  justify-items: center;
  color: #6b6f86;
  font-size: 18px;
}

.ps-arrow small {
  font-size: 11px;
}

.ps-box {
  margin: 8px 12px 0;
  padding: 8px 10px;
  border: 2px solid #2b2f45;
  border-radius: 10px;
  background: #fff;
}

.ps-box > small {
  font-family: var(--pixel);
  font-size: 11px;
  color: #6b6f86;
}

.ps-box > b {
  display: block;
  font-family: var(--display);
}

.ps-box p {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.4;
}

.ps-stats {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 4px;
}

.ps-stats th,
.ps-stats td {
  padding: 3px 6px;
  text-align: left;
}

.ps-stats tbody tr:nth-child(odd) {
  background: #f1ede1;
}

.ps-stats td {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.ps-note {
  display: block;
  margin-top: 4px;
  color: #6b6f86;
  font-size: 12px;
}

.ps-atk {
  font-size: 13px;
}

.ps-learn {
  margin-top: 6px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 4px 6px;
  align-items: stretch;
}

.ps-learn > small {
  grid-column: 1 / -1;
  color: #6b6f86;
  font-size: 12px;
  font-weight: 700;
}

.ps-or {
  align-self: center;
  font-style: normal;
  font-size: 12px;
  color: #6b6f86;
}

.ps-move {
  display: grid;
  gap: 1px;
  padding: 5px 8px;
  border-radius: 8px;
  border-left: 6px solid var(--type);
  background: color-mix(in srgb, var(--type) 14%, #fff);
  font-size: 12px;
}

.ps-move b {
  font-size: 13px;
}

.ps-notes {
  margin: 4px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 520px) {
  .ps-learn {
    grid-template-columns: 1fr;
  }

  .ps-or {
    display: none;
  }

  .ps-sprite {
    width: 80px;
    height: 80px;
  }
}

/* ---------- Trainer names that open profiles, and other trainers' profiles (src/ui/trainerCard.js) ---------- */
.trainer-link {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: pointer;
}

.trainer-link:hover,
.trainer-link:focus-visible {
  color: var(--gold);
}

.tcard-dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
}

.tcard-dialog.wide {
  width: min(980px, calc(100vw - 24px));
}

.tcard-dialog::backdrop {
  background: rgba(5, 8, 20, 0.65);
  backdrop-filter: blur(2px);
}

.tcard {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 0 0 16px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: var(--panel, #141a33);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.tcard > p {
  padding: 18px;
}

.tcard-loading {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px;
}

.tcard-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel, #141a33);
  border-bottom: 1px solid var(--line);
}

.tcard-bar > b {
  flex: 1;
  font-family: var(--display);
}

.tcard-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tcard-note {
  font-weight: 700;
  color: #7ee08a;
}

.tcard-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
}

.tcard-profile {
  padding: 14px 16px 0;
}

.trainer-finder label {
  font-weight: 700;
}

.box-regions {
  margin: 0 0 12px;
}

/* ---------- Home: Battle and Collect ---------- */
.home-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.home-mode {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 2px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}

.home-mode:hover {
  transform: translateY(-2px);
  border-color: var(--gold);
}

.home-mode.mode-battle {
  background: radial-gradient(120% 140% at 0% 0%, rgba(229, 57, 53, 0.3), transparent 60%), var(--card);
}

.home-mode.mode-collect {
  background: radial-gradient(120% 140% at 0% 0%, rgba(61, 125, 202, 0.35), transparent 60%), var(--card);
}

.mode-icon {
  font-size: 34px;
  line-height: 1;
}

.mode-text {
  flex: 1;
  display: grid;
  gap: 3px;
}

.mode-text b {
  font-family: var(--display);
  font-size: 22px;
  color: var(--gold);
}

.mode-text small {
  color: var(--muted);
}

/* ---------- Pokédex (src/ui/pokedex.js) ---------- */
.pdx-head {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: radial-gradient(120% 120% at 0% 0%, rgba(229, 57, 53, 0.18), transparent 55%), var(--panel);
}

.pdx-head > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 14px;
}

.pdx-head > div > b {
  font-family: var(--display);
  font-size: 20px;
  color: var(--gold);
}

.pdx-big {
  font-family: var(--display);
  font-size: 22px;
  color: var(--ink);
}

.pdx-bar {
  height: 9px;
}

.pdx-regions {
  margin: 12px 0 0;
}

.pdx-regions small {
  opacity: 0.8;
}

.pdx-filters {
  margin: 8px 0 10px;
}

.pdx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 6px;
}

.pdx-cell {
  display: grid;
  justify-items: center;
  gap: 1px;
  padding: 6px 4px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.pdx-cell canvas {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
}

.pdx-cell small {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pdx-cell span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdx-cell.caught {
  border-color: rgba(255, 203, 5, 0.45);
}

.pdx-cell.seen {
  color: var(--muted);
}

.pdx-cell.none {
  background: var(--panel);
  color: var(--muted);
  opacity: 0.7;
}

.pdx-cell:hover {
  border-color: var(--gold);
}

.pdx-shadow {
  filter: brightness(0) invert(0.8);
  opacity: 0.5;
}

.pdx-unknown {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  font-family: var(--display);
  font-size: 22px;
  color: var(--line);
}

.pdx-unknown.big {
  width: 96px;
  height: 96px;
  font-size: 44px;
}

.pdx-dialog {
  width: min(92vw, 380px);
  padding: 0;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
}

.pdx-dialog::backdrop {
  background: rgba(5, 8, 20, 0.6);
}

.pdx-detail {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
}

.pdx-detail canvas {
  width: 96px;
  height: 96px;
  image-rendering: pixelated;
}

.pdx-detail h3 {
  margin: 0;
  font-family: var(--display);
}

.pdx-detail ul {
  margin: 4px 0 0;
  padding-left: 18px;
  text-align: left;
  color: var(--muted);
}

.pdx-detail li + li {
  margin-top: 4px;
}

.pdx-state.caught {
  color: var(--ok);
}

.pdx-state.seen {
  color: var(--gold);
}

.pdx-state.none {
  color: var(--muted);
}

.pdx-close {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
}

/* ---------- Wild Areas (src/ui/wild.js) ---------- */
/* Area cards: the area's map picture behind its name, level and checklist count. */
.wild-areas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
}

.wild-area {
  position: relative;
  display: grid;
  align-content: end;
  gap: 2px;
  min-height: 86px;
  padding: 8px 10px;
  overflow: hidden;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card);
  color: #fff;
  text-align: left;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.wild-area-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--art) center / cover;
  filter: saturate(1.1);
}

.wild-area-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(13, 18, 38, 0.05) 20%, rgba(13, 18, 38, 0.85));
}

.wild-area > :not(.wild-area-art) {
  position: relative;
  z-index: 1;
}

.wild-area small {
  display: flex;
  gap: 6px;
  align-items: center;
}

.wild-area.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255, 203, 5, 0.35);
}

.wild-area.locked .wild-area-art {
  filter: grayscale(1) brightness(0.4);
}

/* A Legendary Realm still to buy: its picture dimmed, not greyed, and its price in gold. */
.wild-area.buyable .wild-area-art {
  filter: brightness(0.55);
}

.wild-area.buyable:hover .wild-area-art {
  filter: brightness(0.8);
}

.wild-buy-realm {
  color: #ffd34d;
  font-weight: 700;
}

a.wild-area {
  color: inherit;
  text-decoration: none;
}

.wild-shards {
  color: inherit !important;
  text-decoration: none;
}

.wild-chk.done {
  color: var(--ok);
}

/* The area's panel: its name and level, its map with Pokémon about, then the search or the
   encounter. */
.wild-panel {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}

.wild-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.wild-panel-head b {
  font-family: var(--display);
  color: var(--gold);
  font-size: 20px;
}

.wild-panel-head small {
  color: var(--muted);
}

.wild-hud-bag {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-weight: 700;
}

.wild-map {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 7 / 5;
  justify-self: center;
  overflow: hidden;
  border-radius: 12px;
  border: 2px solid rgba(0, 0, 0, 0.45);
  background: #10162e;
}

.wild-map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.wild-map-mons {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.wild-map-mon {
  position: absolute;
  width: 12%;
  aspect-ratio: 1;
  transform: translate(-50%, -72%);
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.45));
  transition: left 0.6s ease-in-out, top 0.6s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
  .wild-map-mon {
    transition: none;
  }
}

.wild-panel .wild-stage {
  margin-top: 0;
}

/* The Search button and the "Stop for" choice: the same under the map and under an encounter. */
.wild-search-bar {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.wild-stage.encounter .wild-search-bar {
  width: 100%;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.wild-skip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  border-radius: 999px;
  background: rgba(13, 18, 38, 0.72);
  font-size: 14px;
}

.wild-skip select {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.wild-log li.faded {
  opacity: 0.6;
}

/* Special Pokémon, the Wild Pokémon list and the shop under the panel. */
.wild-specials,
.wild-checklist,
.wild-shop {
  margin-top: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.wild-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-bottom: 8px;
}

.wild-section-head small {
  flex: 1;
  color: var(--muted);
}

.wild-chk-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.wild-chk-mon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--card);
  cursor: help;
}

/* A tapped Wild Areas tooltip, as a label (ui/wild.js showTapTip): phones can't hover. */
.wild-tap-tip {
  position: absolute;
  z-index: 80;
  max-width: min(280px, calc(100vw - 16px));
  padding: 6px 10px;
  border: 2px solid var(--gold);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  font: 600 13px/1.3 var(--display);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.wild-chk-mon.caught {
  box-shadow: 0 0 0 2px rgba(94, 224, 138, 0.6) inset;
}

.wild-chk-mon canvas {
  width: 40px;
  height: 40px;
  image-rendering: pixelated;
}

.wild-chk-mon canvas[data-silhouette] {
  filter: brightness(0) invert(0.8);
  opacity: 0.35;
}

.wild-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.wild-special-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.wild-special-row > .wild-special {
  width: 112px;
}

.wild-special {
  display: grid;
  justify-items: center;
  gap: 2px;
  margin: 0;
  padding: 8px 6px;
  border-radius: 12px;
  background: var(--card);
  text-align: center;
}

.wild-special canvas {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.wild-special canvas[data-silhouette] {
  filter: brightness(0);
  opacity: 0.55;
}

.wild-special figcaption {
  display: grid;
  gap: 1px;
  font-size: 13px;
}

.wild-special small {
  color: var(--muted);
  font-size: 11px;
}

.wild-specials .wild-section-head small b {
  color: var(--gold);
}

/* This week's rare spawn and showcase: smaller, under the area's Special Pokémon. */
.wild-week {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.wild-special-row.small > .wild-special {
  width: 88px;
}

.wild-special-row.small .wild-special {
  padding: 6px 4px;
}

.wild-special-row.small canvas {
  width: 44px;
  height: 44px;
}

.wild-special-row.small figcaption {
  font-size: 11px;
}

.wild-shop-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wild-shop-item {
  display: grid;
  gap: 2px;
  min-width: 120px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card-hi);
  color: var(--ink);
  text-align: left;
}

.wild-shop-item small {
  color: var(--muted);
}

.wild-shop-item:disabled {
  opacity: 0.45;
}

.wild-more {
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.wild-more summary {
  cursor: pointer;
  font-weight: 700;
}

.wild-more .wild-conditions {
  justify-content: flex-start;
  margin: 8px 0;
}
.wild-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}

.wild-energy {
  display: grid;
  grid-template-columns: auto minmax(120px, 220px) auto;
  align-items: center;
  gap: 10px;
}

.wild-energy b {
  color: var(--gold);
  font-family: var(--display);
}

.wild-energy small,
.wild-bag small {
  color: var(--muted);
}

.wild-bag {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}

.wild-regions {
  margin: 12px 0 0;
}

.wild-area {
  position: relative;
}

.wild-area.site {
  border-color: rgba(255, 203, 5, 0.35);
}

.wild-area.site.active {
  border-color: var(--gold);
}

.wild-site-mark {
  font-style: normal;
}

.wild-mini-meter {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.wild-mini-meter i,
.wild-meter i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7c4dff, #ffcb05);
}

.wild-site {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(124, 77, 255, 0.45);
  border-radius: 14px;
  background: radial-gradient(120% 120% at 0% 50%, rgba(124, 77, 255, 0.22), transparent 60%), var(--card);
}

.wild-site canvas {
  width: 64px;
  height: 64px;
  image-rendering: pixelated;
}

.wild-site canvas[data-silhouette] {
  filter: brightness(0) drop-shadow(0 0 6px rgba(124, 77, 255, 0.9));
  opacity: 0.85;
}

.wild-site.ready {
  border-color: var(--gold);
  box-shadow: 0 0 18px rgba(255, 203, 5, 0.25);
}

.wild-site.ready canvas {
  animation: wild-float 2s ease-in-out infinite;
}

.wild-site-info {
  flex: 1;
  min-width: 200px;
  display: grid;
  gap: 5px;
}

.wild-site small,
.wild-site-info small {
  color: var(--muted);
}

.wild-site.locked div {
  display: grid;
  gap: 3px;
}

.wild-meter {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.wild-stage {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card), var(--panel));
  text-align: center;
}

.wild-where {
  margin: 0;
}

.wild-where .type-chip {
  font-size: 11px;
}

.wild-conditions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.wild-conditions li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
}

.wild-conditions .type-chip {
  font-size: 10px;
}

.wild-conditions canvas {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
}

.wild-wx {
  font-style: normal;
}

.wild-lv {
  margin-right: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 203, 5, 0.18);
  color: var(--gold);
  font-weight: 700;
}

.wild-site-pics {
  display: flex;
  gap: 4px;
}

/* A Golden, Crystal or Shadow wild Pokémon. */
.wild-stage.finish-golden,
.wild-stage.finish-crystal,
.wild-stage.finish-shadow {
  box-shadow: 0 0 0 1px var(--rar) inset, 0 0 26px rgba(255, 211, 77, 0.45);
  animation: wild-finish-glow 1.6s ease-in-out infinite;
}

.wild-finish {
  max-width: 420px;
  color: var(--gold) !important;
}

@keyframes wild-finish-glow {
  50% { box-shadow: 0 0 0 1px var(--rar) inset, 0 0 40px rgba(255, 211, 77, 0.7); }
}

.wild-search {
  min-width: 220px;
  padding: 16px 28px;
  font-size: 22px;
  border-radius: 999px;
}

.wild-search.searching {
  animation: wild-rustle 0.35s ease-in-out infinite;
}

.wild-lives {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin: 0;
}

.wild-lives canvas,
.wild-log canvas {
  width: 28px;
  height: 28px;
  image-rendering: pixelated;
}

/* The encounter: the wild Pokémon, its HP while the team wears it down, and the throw's result. */
.wild-stage.encounter {
  --hp: 100%;
  border-color: var(--rar);
  box-shadow: 0 0 0 1px var(--rar) inset;
}

.wild-arena {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(100%, 420px);
  padding: 10px 0 4px;
  border-radius: 14px;
  background: radial-gradient(60% 40% at 50% 70%, rgba(95, 209, 107, 0.25), transparent 70%);
}

.wild-hp {
  display: block;
  width: 140px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.wild-hp i {
  display: block;
  width: var(--hp);
  height: 100%;
  background: linear-gradient(90deg, #ff5c6c, #5ee08a);
  transition: width 0.45s ease-out;
}

.wild-foe {
  width: 120px;
  height: 120px;
  image-rendering: pixelated;
}

.wild-team {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.wild-team canvas {
  width: 32px;
  height: 32px;
  image-rendering: pixelated;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.wild-team canvas.strong {
  box-shadow: 0 0 0 2px var(--gold);
}

.wild-result {
  min-height: 1.4em;
  font-family: var(--display);
  font-size: 20px;
  color: var(--gold);
}

.wild-foe-info {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.wild-foe-info h3 {
  margin: 0;
  font-family: var(--display);
}

.wild-rarity {
  color: var(--rar);
  font-size: 13px;
}

.wild-foe-info small {
  color: var(--muted);
}

.wild-note {
  color: #ffb36b !important;
}

.wild-away {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 179, 107, 0.12);
  color: #ffb36b;
  font-size: 0.9rem;
}

.wild-away a {
  color: var(--gold);
}

.wild-balls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.wild-ball {
  display: grid;
  gap: 2px;
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--card-hi);
  color: var(--ink);
}

.wild-ball small {
  color: var(--muted);
}

.wild-ball.ball-poke {
  border-color: #ff5c6c;
}

.wild-ball.ball-great {
  border-color: #4aa3ff;
}

.wild-ball.ball-ultra {
  border-color: var(--gold);
}

.wild-ball:disabled {
  opacity: 0.45;
}

.wild-run {
  align-self: center;
  padding: 8px 14px;
  border-radius: 12px;
}

/* Running from a good pull takes a second click (ui/wild.js runArmed). */
.wild-run.armed {
  border-color: #ff6b6b;
  color: #ffb3b3;
}

/* Where the Search button was while a good pull waits (meta/wild.js goodPull). */
.wild-held {
  margin: 10px 0 0;
  padding: 8px 12px;
  border: 1px dashed var(--gold);
  border-radius: 12px;
  color: var(--gold);
  font-weight: 700;
  text-align: center;
}

/* The chase, then the throw's result. */
.wild-stage.chasing {
  --hp: 40%;
}

.wild-stage.chasing .wild-hp i {
  transition-duration: 0.7s;
}

.wild-stage.chasing .wild-foe {
  animation: wild-dodge 0.5s ease-in-out infinite;
}

.wild-stage.chasing .wild-team canvas {
  animation: wild-attack 0.35s ease-in-out infinite alternate;
}

.wild-stage.chasing .wild-team canvas:nth-child(2n) {
  animation-delay: 0.17s;
}

.wild-stage.caught .wild-foe {
  animation: wild-caught 0.9s ease-in forwards;
}

.wild-stage.broke .wild-foe {
  animation: wild-shake 0.5s ease-in-out;
}

.wild-stage.fled .wild-foe {
  animation: wild-flee 0.9s ease-in forwards;
}

.wild-log {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.wild-log li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
}

.wild-log li:first-child {
  color: var(--ink);
}

.wild-log li.good {
  color: var(--gold);
}

.wild-log-ball {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0 5px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.05) 50%);
}

.wild-log-ball.ball-great {
  background: linear-gradient(180deg, #4aa3ff 50%, #eee 50%);
}

.wild-log-ball.ball-ultra {
  background: linear-gradient(180deg, #333 50%, #eee 50%);
  box-shadow: inset 0 3px 0 var(--gold);
}

.wild-foot {
  margin-top: 12px;
}

@keyframes wild-float {
  50% { transform: translateY(-5px); }
}

@keyframes wild-rustle {
  25% { transform: rotate(-2deg); }
  75% { transform: rotate(2deg); }
}

@keyframes wild-dodge {
  25% { transform: translateX(-12px); }
  75% { transform: translateX(12px); }
}

@keyframes wild-attack {
  to { transform: translateY(-6px) scale(1.08); filter: brightness(1.4); }
}

@keyframes wild-caught {
  60% { transform: scale(0.3); filter: brightness(3); opacity: 1; }
  to { transform: scale(0); opacity: 0; }
}

@keyframes wild-shake {
  20% { transform: translateX(-8px) rotate(-6deg); }
  60% { transform: translateX(8px) rotate(6deg); }
}

@keyframes wild-flee {
  to { transform: translateX(260px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wild-stage .wild-foe,
  .wild-stage .wild-team canvas,
  .wild-search.searching,
  .wild-site.ready canvas {
    animation: none !important;
  }
}

/* ---------- Amount Viewer (src/ui/amounts.js) ---------- */
.amounts {
  --hot: #ff6b4a;
  --warm: #ffb547;
}

.amt-status {
  margin: -4px 0 12px;
  font-size: 13px;
}

.amt-section {
  margin-bottom: 22px;
}

.amt-heat-hot {
  --heat: var(--hot);
}
.amt-heat-warm {
  --heat: var(--warm);
}
.amt-heat-cool {
  --heat: var(--muted);
}
.amt-heat-none {
  --heat: #6f78a8;
}

.amt-count {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--heat, var(--ink));
}

.amt-scarcity {
  color: var(--heat, var(--muted));
  font-weight: 600;
}

.amt-heat-hot .amt-scarcity::before {
  content: '🔥 ';
}

.amt-rarest {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
}

.amt-rare {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--heat) 60%, var(--line));
  background: radial-gradient(70% 55% at 50% 35%, color-mix(in srgb, var(--r) 20%, transparent), var(--card) 80%);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.amt-rare:hover {
  background-color: var(--card-hi);
  box-shadow: 0 0 12px color-mix(in srgb, var(--heat) 40%, transparent);
}

.amt-rare.amt-heat-hot {
  animation: amt-pulse 2.4s ease-in-out infinite;
}

@keyframes amt-pulse {
  50% {
    box-shadow: 0 0 14px color-mix(in srgb, var(--hot) 55%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .amt-rare.amt-heat-hot {
    animation: none;
  }
}

.amt-rare canvas,
.amt-variant canvas,
.amt-cell canvas,
.amt-stone canvas {
  image-rendering: pixelated;
}

.amt-rare-name {
  font-family: var(--display);
  font-weight: 600;
  text-align: center;
}

.amt-rare small {
  color: var(--muted);
}

.amt-detail {
  padding: 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--r) 60%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--r) 12%, var(--panel)), var(--panel));
}

.amt-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  margin-bottom: 10px;
}

.amt-detail-head h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 22px;
}

.amt-detail-head .r-rarity {
  color: var(--r);
  font-weight: 700;
}

.amt-detail-head small {
  color: var(--muted);
}

.amt-variants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}

.amt-where {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.amt-where h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.amt-where h4 {
  margin: 8px 0 2px;
  font-size: 13px;
  color: var(--gold);
}

.amt-where ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
  font-size: 13px;
}

.amt-where a {
  color: var(--gold);
}

.amt-variant {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 8px 4px 10px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--heat) 45%, var(--line));
  background: var(--card);
  text-align: center;
}

.amt-variant.amt-heat-none canvas {
  opacity: 0.45;
}

.amt-variant.mine {
  border-color: var(--ok);
}

.amt-label {
  font-family: var(--display);
  font-size: 13px;
}

.amt-mine {
  color: var(--ok);
  font-weight: 600;
}

.amt-first {
  color: var(--gold);
}

.amt-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 10px;
}

.amt-controls .inv-filters {
  margin: 0;
}

.amt-search {
  flex: 0 1 220px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.amt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.amt-cell {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  border: 2px solid color-mix(in srgb, var(--r) 35%, var(--line));
  background: var(--card);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.amt-cell canvas {
  grid-row: span 2;
}

.amt-cell span {
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.amt-cell small {
  color: var(--muted);
}

.amt-cell:hover,
.amt-cell.active {
  border-color: var(--r);
  background: var(--card-hi);
}

.amt-stones {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 8px;
}

.amt-stone {
  display: grid;
  grid-template-columns: 48px 32px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 12px;
  border: 2px solid color-mix(in srgb, var(--heat) 45%, var(--line));
  background: var(--card);
}

.amt-stone img {
  image-rendering: pixelated;
}

.amt-stone span {
  display: grid;
}

.amt-stone small {
  color: var(--muted);
}

/* "Only N exist" on summon results (src/ui/meta.js reveal). */
.r-exists {
  font-size: 11px;
  font-weight: 700;
  color: #ff8a6b;
}

/* ---------- Wild Areas: a big find (src/ui/wild.js bigFind) ---------- */
.wild-banner {
  position: fixed;
  top: 72px;
  left: 50%;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(440px, calc(100vw - 24px));
  padding: 10px 16px 10px 10px;
  border: 2px solid var(--gold);
  border-radius: 16px;
  background: linear-gradient(120deg, rgba(255, 203, 5, 0.22), rgba(13, 18, 38, 0.96) 55%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(255, 203, 5, 0.35);
  color: #fff;
  cursor: pointer;
  transform: translateX(-50%);
  animation: wild-banner-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.wild-banner.leaving {
  opacity: 0;
  transform: translate(-50%, -16px);
  transition: opacity 0.4s, transform 0.4s;
}

.wild-banner canvas {
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(13, 18, 38, 0.4) 70%);
  image-rendering: pixelated;
}

.wild-banner div {
  display: grid;
  gap: 2px;
}

.wild-banner b {
  font-family: var(--display);
  font-size: 18px;
  color: var(--gold);
}

.wild-banner span {
  font-size: 14px;
}

.wild-banner.legendary,
.wild-banner.special {
  border-color: #ff9d2e;
  background: linear-gradient(120deg, rgba(255, 140, 40, 0.3), rgba(13, 18, 38, 0.96) 55%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 140, 40, 0.45);
}

.wild-banner.finish-crystal {
  border-color: #8cdcff;
  background: linear-gradient(120deg, rgba(140, 220, 255, 0.25), rgba(13, 18, 38, 0.96) 55%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(140, 220, 255, 0.4);
}

.wild-banner.finish-crystal b {
  color: #bfeaff;
}

.wild-banner.finish-shadow {
  border-color: #b46cff;
  background: linear-gradient(120deg, rgba(150, 80, 230, 0.32), rgba(13, 18, 38, 0.96) 55%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 24px rgba(150, 80, 230, 0.45);
}

.wild-banner.finish-shadow b {
  color: #d7adff;
}

@keyframes wild-banner-in {
  from {
    opacity: 0;
    transform: translate(-50%, -24px) scale(0.92);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wild-banner {
    animation: none;
  }
}

@media (max-width: 900px) {
  .wild-banner {
    top: 10px;
  }
}

/* ---------- Events (data/events.js): the landing popup, Haunted Hollow's banner, the event challenge ---------- */
.event-pop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, rgba(60, 20, 90, 0.55), rgba(5, 2, 12, 0.88));
  backdrop-filter: blur(3px);
  animation: event-pop-in 0.35s ease-out;
}
.event-pop.closing {
  animation: event-pop-in 0.25s ease-in reverse forwards;
}
@keyframes event-pop-in {
  from { opacity: 0; }
}
.event-pop-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 150px 24px 22px;
  border: 2px solid #ff8a1e;
  border-radius: 20px;
  color: #fbeeff;
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 138, 30, 0.22), transparent 45%),
    linear-gradient(180deg, #24103d 0%, #160a28 55%, #0c0617 100%);
  box-shadow: 0 0 0 4px rgba(255, 138, 30, 0.15), 0 24px 70px rgba(0, 0, 0, 0.6), 0 0 60px rgba(160, 80, 255, 0.35);
  animation: event-card-in 0.5s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes event-card-in {
  from { transform: translateY(24px) scale(0.94); opacity: 0; }
}
.event-pop-sky {
  position: absolute;
  inset: 0 0 auto;
  height: 170px;
  overflow: hidden;
  border-radius: 18px 18px 0 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(120, 60, 200, 0.35), transparent);
}
.event-pop-moon {
  position: absolute;
  top: 18px;
  left: 50%;
  width: 92px;
  height: 92px;
  margin-left: -46px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff6d6, #ffd36b 55%, #ff9a2e);
  box-shadow: 0 0 40px 10px rgba(255, 190, 80, 0.45), 0 0 120px 30px rgba(255, 140, 40, 0.2);
}
.event-pop-bat {
  position: absolute;
  top: calc(14px + var(--i) * 16px);
  left: -10%;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 6px rgba(150, 90, 230, 0.6));
  animation: event-bat calc(7s + var(--i) * 1.3s) linear infinite;
  animation-delay: calc(var(--i) * -2.1s);
}
@keyframes event-bat {
  0% { transform: translate(0, 0); }
  25% { transform: translate(30vw, -14px); }
  50% { transform: translate(60vw, 10px); }
  75% { transform: translate(90vw, -8px); }
  100% { transform: translate(130vw, 4px); }
}
.event-pop-ghost {
  position: absolute;
  image-rendering: pixelated;
  opacity: 0.92;
  filter: drop-shadow(0 0 10px rgba(190, 120, 255, 0.7));
  animation: event-ghost 4.5s ease-in-out infinite alternate;
  animation-delay: calc(var(--d) * -1);
}
@keyframes event-ghost {
  from { transform: translateY(0) rotate(-3deg); }
  to { transform: translateY(14px) rotate(3deg); }
}
.event-pop-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #fbeeff;
  background: rgba(0, 0, 0, 0.45);
  font-size: 16px;
  cursor: pointer;
}
.event-pop-kicker {
  position: relative;
  margin: 0;
  color: #ffb35c;
  font: 600 13px var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.event-pop-title {
  position: relative;
  margin: 4px 0 8px;
  font: 700 clamp(34px, 9vw, 52px) / 1 var(--display);
  color: #ffe0b0;
  text-shadow: 0 0 18px rgba(255, 138, 30, 0.85), 0 3px 0 #6a2a00;
  animation: event-flicker 5s infinite;
}
@keyframes event-flicker {
  0%, 92%, 100% { opacity: 1; }
  94% { opacity: 0.55; }
  96% { opacity: 1; }
  97% { opacity: 0.7; }
}
.event-pop-lede {
  margin: 0 0 14px;
  color: #e6d6f5;
}
.event-pop-list {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.event-pop-list li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid rgba(255, 138, 30, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
}
.event-pop-list li > span {
  font-size: 24px;
  line-height: 1.2;
}
.event-pop-list b {
  color: #ffd08a;
}
.event-pop-list small {
  display: block;
  margin-top: 2px;
  color: #d9c7ec;
  line-height: 1.4;
}
.event-pop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.event-pop-actions a.button.primary {
  background: linear-gradient(180deg, #ffab3d, #f2721b);
  border-color: #ffcf7a;
  color: #2a1000;
  box-shadow: 0 0 18px rgba(255, 138, 30, 0.5);
}
.event-pop-later {
  margin-left: auto;
  border: 0;
  color: #c8b4dd;
  background: none;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
@media (max-width: 480px) {
  .event-pop-card {
    padding: 130px 16px 18px;
  }
  .event-pop-actions a.button {
    flex: 1 1 100%;
    text-align: center;
  }
  .event-pop-later {
    margin: 0 auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .event-pop-bat,
  .event-pop-ghost,
  .event-pop-title {
    animation: none;
  }
}
.wild-event-banner {
  margin: 0 0 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 138, 30, 0.45);
  border-radius: 10px;
  color: #ffe0b0;
  background: linear-gradient(90deg, rgba(110, 40, 170, 0.45), rgba(255, 120, 30, 0.18));
  font-size: 14px;
}
.ch-card.event-ch {
  margin-bottom: 16px;
  border-color: #ff8a1e;
  background:
    radial-gradient(circle at 90% 0%, rgba(255, 138, 30, 0.2), transparent 50%),
    linear-gradient(180deg, #2a1446, #170b2a);
  box-shadow: 0 0 30px rgba(160, 80, 255, 0.25);
}
.ch-card.event-ch h3 {
  margin: 0;
  color: #ffe0b0;
}
.wild-log-candy {
  width: 24px;
  text-align: center;
  font-size: 18px;
}

/* The "N online" pill (ui/onlineCount.js): a live green dot and the count. */
.online-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--hud);
  font: 600 13px var(--display);
  white-space: nowrap;
}
.online-count[hidden] {
  display: none;
}
.online-count b {
  color: var(--ink);
}
.online-count i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(94, 224, 138, 0.6);
  animation: online-pulse 2s ease-out infinite;
}
@keyframes online-pulse {
  70% { box-shadow: 0 0 0 6px rgba(94, 224, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(94, 224, 138, 0); }
}
@media (max-width: 600px) {
  .menu-top .online-count {
    padding: 3px 7px;
    font-size: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .online-count i {
    animation: none;
  }
}

/* ================= Haunted Week landing page (halloween.html, src/halloween.js) ================= */
body.hw-page {
  --hw-orange: #ff8a1e;
  --hw-amber: #ffd08a;
  --hw-ink: #fbeeff;
  --hw-muted: #d0bde6;
  --hw-card: rgba(40, 18, 68, 0.72);
  --hw-line: rgba(255, 138, 30, 0.32);
  min-height: 100%;
  color: var(--hw-ink);
  background:
    radial-gradient(ellipse at 50% 0%, #3a1663 0%, transparent 60%),
    linear-gradient(180deg, #1d0b33 0%, #0e0619 40%, #07030d 100%);
}
html:has(body.hw-page) {
  background: #07030d;
}
.hw-page a:not(.button) {
  color: var(--hw-amber);
}
.hw-hero {
  position: relative;
  overflow: hidden;
  min-height: min(620px, 92vh);
  padding: 0 16px 48px;
  border-bottom: 2px solid var(--hw-line);
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 150, 50, 0.18), transparent 40%),
    linear-gradient(180deg, #2b1050 0%, #1a0a30 60%, #12071f 100%);
}
.hw-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hw-moon {
  position: absolute;
  top: 70px;
  left: 50%;
  width: 190px;
  height: 190px;
  margin-left: -95px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff6d6, #ffd36b 55%, #ff9a2e);
  box-shadow: 0 0 70px 20px rgba(255, 190, 80, 0.4), 0 0 200px 60px rgba(255, 140, 40, 0.18);
}
.hw-fog {
  position: absolute;
  left: -20%;
  right: -20%;
  bottom: -40px;
  height: 180px;
  background: radial-gradient(ellipse at 30% 60%, rgba(200, 170, 255, 0.22), transparent 60%), radial-gradient(ellipse at 75% 50%, rgba(200, 170, 255, 0.16), transparent 55%);
  filter: blur(8px);
  animation: hw-fog 18s ease-in-out infinite alternate;
}
.hw-fog.two {
  bottom: 40px;
  opacity: 0.6;
  animation-duration: 26s;
  animation-direction: alternate-reverse;
}
@keyframes hw-fog {
  from { transform: translateX(-6%); }
  to { transform: translateX(6%); }
}
.hw-bat {
  position: absolute;
  top: calc(30px + var(--i) * 34px);
  left: -10%;
  filter: drop-shadow(0 0 8px rgba(150, 90, 230, 0.6));
  animation: event-bat calc(9s + var(--i) * 1.7s) linear infinite;
  animation-delay: calc(var(--i) * -2.3s);
}
.hw-h2-spr {
  width: 40px;
  height: 40px;
  margin: -10px 2px -12px -6px;
  vertical-align: middle;
}
.hw-spr {
  image-rendering: pixelated;
}
.hw-ghost {
  position: absolute;
  opacity: 0.9;
  filter: drop-shadow(0 0 12px rgba(190, 120, 255, 0.75));
  animation: event-ghost 5s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * -0.9s);
}
.hw-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 0;
}
.hw-page .hw-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--hw-ink);
  font: 700 16px var(--display);
  text-decoration: none;
}
.hw-candy {
  padding: 5px 12px;
  border: 1px solid var(--hw-line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--display);
}
.hw-candy b {
  color: var(--hw-amber);
}
.hw-hero-text {
  position: relative;
  max-width: 680px;
  margin: 230px auto 0;
  text-align: center;
}
.hw-kicker {
  margin: 0;
  color: #ffb35c;
  font: 600 14px var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hw-title {
  margin: 6px 0 12px;
  font: 700 clamp(48px, 12vw, 92px) / 1 var(--display);
  color: #ffe0b0;
  text-shadow: 0 0 24px rgba(255, 138, 30, 0.85), 0 4px 0 #6a2a00;
  animation: event-flicker 6s infinite;
}
.hw-lede {
  margin: 0 auto 20px;
  max-width: 560px;
  color: #eadcf8;
  font-size: 17px;
  line-height: 1.5;
}
.hw-countdown {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}
.hw-cd-label {
  flex-basis: 100%;
  color: var(--hw-muted);
  font: 600 13px var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hw-cd-cell {
  display: grid;
  min-width: 70px;
  padding: 8px 6px;
  border: 1px solid var(--hw-line);
  border-radius: 12px;
  background: rgba(10, 4, 20, 0.6);
}
.hw-cd-cell b {
  font: 700 30px/1 var(--pixel);
  color: #ffd08a;
}
.hw-cd-cell small {
  color: var(--hw-muted);
  font-size: 12px;
}
.hw-ended {
  margin: 0;
  color: var(--hw-amber);
  font-family: var(--display);
  font-size: 18px;
}
.hw-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.hw-actions a.button {
  padding: 10px 20px;
  font: 600 16px var(--display);
}
.hw-page a.button {
  border-color: var(--hw-line);
  background: rgba(40, 18, 68, 0.85);
  color: var(--hw-ink);
}
.hw-page a.button.primary {
  background: linear-gradient(180deg, #ffab3d, #f2721b);
  border-color: #ffcf7a;
  color: #2a1000;
  box-shadow: 0 0 22px rgba(255, 138, 30, 0.55);
}
.hw-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}
.hw-section {
  margin-top: 40px;
}
.hw-section h2 {
  margin: 0 0 6px;
  color: #ffe0b0;
  font: 700 26px var(--display);
}
.hw-sub {
  margin: 0 0 14px;
  color: var(--hw-muted);
}
.hw-new,
.hw-features,
.hw-shop {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}
.hw-features {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.hw-new {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.hw-shop {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.hw-card,
.hw-new-card,
.hw-item-card {
  position: relative;
  padding: 16px;
  border: 1px solid var(--hw-line);
  border-radius: 16px;
  background: var(--hw-card);
}
.hw-card h3,
.hw-new-card h3,
.hw-item-card h3 {
  margin: 0 0 6px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--hw-amber);
  font: 700 19px var(--display);
}
.hw-card p,
.hw-new-card p,
.hw-item-card p {
  margin: 0 0 10px;
  color: #e3d3f3;
  line-height: 1.45;
}
.hw-card b {
  color: #ffd08a;
}
.hw-card-icon {
  float: right;
  font-size: 30px;
}
.hw-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 8px;
}
.hw-roster span {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.3);
}
.hw-rare {
  font-size: 13px;
  color: var(--hw-muted) !important;
}
.hw-done {
  color: var(--ok) !important;
  font-weight: 600;
}
.hw-new-card {
  text-align: center;
  border-color: var(--hw-orange);
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 138, 30, 0.25), transparent 60%),
    linear-gradient(180deg, #2f1450, #1a0a2e);
  box-shadow: 0 0 30px rgba(160, 80, 255, 0.3);
}
.hw-new-pic {
  display: grid;
  place-items: center;
  height: 136px;
  font-size: 56px;
}
.hw-new-pic canvas {
  filter: drop-shadow(0 0 14px rgba(255, 150, 60, 0.6));
}
.hw-item-card {
  display: flex;
  flex-direction: column;
}
.hw-item-card.star {
  border-color: rgba(190, 120, 255, 0.6);
  background: linear-gradient(180deg, rgba(70, 30, 110, 0.8), rgba(30, 12, 52, 0.85));
}
.hw-item-card.new::after {
  content: 'New';
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hw-orange);
  color: #2a1000;
  font: 700 12px var(--display);
}
.hw-item-card.done {
  opacity: 0.6;
}
.hw-item-pic {
  display: grid;
  place-items: center;
  height: 100px;
  margin-bottom: 6px;
  font-size: 40px;
}
.hw-item {
  width: 72px;
  height: 72px;
  image-rendering: pixelated;
}
.hw-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}
.hw-price {
  color: #ffd08a;
  font: 700 17px var(--display);
}
.hw-tag {
  padding: 2px 8px;
  border: 1px solid var(--hw-line);
  border-radius: 999px;
  color: var(--hw-muted);
  font-size: 12px;
}
.hw-tag.ok {
  border-color: var(--ok);
  color: var(--ok);
}
.hw-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
}
.hw-earn,
.hw-pics {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.hw-earn li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--hw-line);
  border-radius: 12px;
  background: var(--hw-card);
}
.hw-earn li > span {
  font-size: 22px;
}
.hw-earn small {
  color: #ffd08a;
  font-weight: 600;
  text-align: right;
}
.hw-pics li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid var(--hw-line);
  border-radius: 12px;
  background: var(--hw-card);
}
.hw-pics li canvas {
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 70, 220, 0.45), rgba(0, 0, 0, 0.3));
}
.hw-pics small {
  display: block;
  color: var(--hw-muted);
}
.hw-pics .hw-tag {
  display: inline-block;
  margin-top: 4px;
}
.hw-foot {
  padding: 24px 16px 40px;
  border-top: 1px solid var(--hw-line);
  text-align: center;
  color: var(--hw-muted);
  font-size: 13px;
}
.hw-over .hw-title {
  animation: none;
  opacity: 0.8;
}
@media (max-width: 600px) {
  .hw-moon {
    top: 60px;
    width: 130px;
    height: 130px;
    margin-left: -65px;
  }
  .hw-hero-text {
    margin-top: 170px;
  }
  /* (On a phone the bats and ghosts fly across the text: they stay behind it, dimmer.) */
  .hw-hero-text {
    z-index: 1;
    text-shadow: 0 1px 6px rgba(10, 4, 24, 0.9);
  }
  .hw-bat,
  .hw-ghost {
    opacity: 0.5;
  }
  .hw-cd-cell {
    min-width: 60px;
  }
  .hw-shop {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .hw-item-card {
    padding: 12px;
  }
  .hw-item-card p {
    font-size: 13px;
  }
  .hw-item-pic {
    height: 76px;
  }
  .hw-item-foot {
    flex-wrap: wrap;
  }
  .hw-earn li {
    grid-template-columns: 30px 1fr;
  }
  .hw-earn small {
    grid-column: 2;
    text-align: left;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hw-bat,
  .hw-ghost,
  .hw-fog,
  .hw-title {
    animation: none;
  }
}

/* An event's link in the side menu and its banner on Home (menu.js renderEventLinks). */
.nav-item.nav-event[hidden],
.home-event[hidden] {
  display: none;
}
.nav-item.nav-event {
  color: #ffb35c;
}
.nav-item.nav-event:hover {
  color: #ffe0b0;
  background: rgba(255, 138, 30, 0.14);
}
.nav-emoji {
  width: 22px;
  flex: none;
  font-size: 18px;
  line-height: 22px;
  text-align: center;
}
.home-event {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 18px;
  overflow: hidden;
  border: 2px solid #ff8a1e;
  border-radius: 18px;
  color: #fbeeff;
  text-decoration: none;
  background:
    radial-gradient(circle at 92% 20%, rgba(255, 138, 30, 0.28), transparent 40%),
    linear-gradient(110deg, #2a1446, #170b2a 60%, #24103d);
  box-shadow: 0 0 26px rgba(160, 80, 255, 0.28);
  transition: transform 0.15s, box-shadow 0.15s;
}
.home-event:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(255, 138, 30, 0.4);
}
.home-event-moon {
  position: absolute;
  top: -30px;
  right: 120px;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 35%, #fff6d6, #ffd36b 55%, #ff9a2e);
  box-shadow: 0 0 40px 10px rgba(255, 190, 80, 0.35);
  opacity: 0.55;
  pointer-events: none;
}
.home-event-ghost {
  position: relative;
  flex: none;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 10px rgba(190, 120, 255, 0.7));
  animation: event-ghost 4.5s ease-in-out infinite alternate;
}
.home-event-text {
  position: relative;
  display: grid;
  gap: 2px;
  min-width: 0;
}
.home-event-text small {
  color: #ffb35c;
  font: 600 12px var(--display);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.home-event-text b {
  color: #ffe0b0;
  font: 700 26px / 1.1 var(--display);
  text-shadow: 0 0 14px rgba(255, 138, 30, 0.7);
}
.home-event-text span {
  color: #d9c7ec;
  font-size: 14px;
}
.home-event .card-cta {
  position: relative;
  margin-left: auto;
  flex: none;
  padding: 8px 14px;
  border-radius: 999px;
  color: #2a1000;
  background: linear-gradient(180deg, #ffab3d, #f2721b);
  font: 700 14px var(--display);
}
@media (max-width: 600px) {
  .home-event {
    flex-wrap: wrap;
    padding: 12px 14px;
  }
  .home-event-ghost {
    width: 56px;
    height: 56px;
  }
  .home-event-text {
    flex: 1 1 0;
  }
  .home-event-text b {
    font-size: 22px;
  }
  .home-event .card-cta {
    flex: 1 1 100%;
    margin-left: 0;
    text-align: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .home-event-ghost {
    animation: none;
  }
}

/* A Pokémon's held item as a picture: on its party card's art, on the profile, in its summary. */
.tm-art {
  position: relative;
}
.tm-art .held-item {
  position: absolute;
  right: -4px;
  bottom: -4px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}
.pf-held,
.ps-held {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ps-held {
  display: flex;
  flex-wrap: wrap;
}

/* The Admin title (meta/titles.js): a red shield-like tag with a soft shine. */
.title-admin {
  border-color: #ff8a8a;
  background: linear-gradient(110deg, #8f1d2c 0%, #e0364a 35%, #ff9aa5 50%, #e0364a 65%, #8f1d2c 100%) 0 0 / 250% 100%;
  color: #fff;
  box-shadow: 0 0 8px rgba(224, 54, 74, 0.55);
  animation: title-shine 3.2s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .title-admin {
    animation: none;
  }
}

/* A rare Wild Areas find's popup (ui/wild.js findPopup): the Pokémon big over turning light rays,
   coloured by what it is. */
.find-pop {
  --glow: #ffcb05;
  --glow-soft: rgba(255, 203, 5, 0.35);
  position: fixed;
  width: min(380px, calc(100vw - 32px));
  padding: 22px 22px 20px;
  overflow: hidden;
  border: 3px solid var(--glow);
  border-radius: 22px;
  color: var(--ink);
  background: radial-gradient(circle at 50% 38%, var(--glow-soft), transparent 60%), linear-gradient(180deg, #1d2650, #0d1226);
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.25), 0 0 60px var(--glow-soft), 0 24px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: find-pop-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.find-pop::backdrop {
  background: radial-gradient(circle, rgba(13, 18, 38, 0.55), rgba(5, 7, 16, 0.85));
  backdrop-filter: blur(2px);
}
@keyframes find-pop-in {
  from { transform: scale(0.7); opacity: 0; }
}
.find-pop.finish-crystal {
  --glow: #8fe3ff;
  --glow-soft: rgba(143, 227, 255, 0.35);
}
.find-pop.finish-shadow {
  --glow: #b07cff;
  --glow-soft: rgba(176, 124, 255, 0.4);
}
.find-pop.shiny {
  --glow: #ff9ad5;
  --glow-soft: rgba(255, 154, 213, 0.35);
}
.find-pop-rays {
  position: absolute;
  top: 110px;
  left: 50%;
  width: 520px;
  height: 520px;
  margin: -260px 0 0 -260px;
  background: repeating-conic-gradient(var(--glow-soft) 0deg 10deg, transparent 10deg 24deg);
  mask-image: radial-gradient(circle, #000 20%, transparent 62%);
  animation: find-pop-spin 14s linear infinite;
  pointer-events: none;
}
@keyframes find-pop-spin {
  to { transform: rotate(360deg); }
}
.find-pop > :not(.find-pop-rays) {
  position: relative;
}
.find-pop-kicker {
  margin: 0;
  color: var(--glow);
  font: 700 16px var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.find-pop-mon {
  display: block;
  width: 168px;
  height: 168px;
  margin: 6px auto 0;
  image-rendering: pixelated;
  filter: drop-shadow(0 0 16px var(--glow-soft));
}
.find-pop h2 {
  margin: 4px 0 2px;
  color: #fff;
  font: 700 28px / 1.1 var(--display);
  text-shadow: 0 0 16px var(--glow-soft), 0 2px 0 rgba(0, 0, 0, 0.5);
}
.find-pop-odds {
  margin: 0 0 8px;
  color: var(--glow);
  font: 600 13px var(--display);
}
.find-pop-text {
  margin: 0 0 16px;
  color: var(--muted);
}
.find-pop-go {
  min-width: 180px;
  font-size: 18px;
}
.find-pop-go:disabled {
  opacity: 0.55;
}
.find-pop-wait {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}
.find-pop.ready .find-pop-wait {
  visibility: hidden;
}
@media (prefers-reduced-motion: reduce) {
  .find-pop,
  .find-pop-rays {
    animation: none;
  }
}

/* The Haunted Week page's shop buys right here (src/halloween.js). */
.hw-buy {
  width: 100%;
  margin-top: 10px;
  padding: 8px 0;
  border: 2px solid #ffcf7a;
  border-radius: 999px;
  color: #2a1000;
  background: linear-gradient(180deg, #ffab3d, #f2721b);
  font: 700 15px var(--display);
  cursor: pointer;
}
.hw-buy:disabled {
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(251, 238, 255, 0.55);
  background: rgba(255, 255, 255, 0.06);
  cursor: default;
}
.hw-shop-msg {
  min-height: 1.4em;
  margin: 0 0 10px;
  color: #ff9aa5;
  font-weight: 600;
}
.hw-shop-msg.ok {
  color: #8ff0b0;
}

/* The chat button hops when a message comes in (ui/chat.js), and its unread count is big and red. */
.chat-fab.bump {
  animation: chat-bump 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.chat-fab.bump.has-unread {
  animation: chat-bump 0.6s cubic-bezier(0.2, 1.6, 0.4, 1), chat-pulse 1.6s ease-out 0.6s infinite;
}
@keyframes chat-bump {
  30% { transform: translateY(-10px) scale(1.08); }
  60% { transform: translateY(0) scale(0.97); }
}
.chat-fab .chat-badge {
  top: -8px;
  right: -6px;
  min-width: 24px;
  padding: 2px 7px;
  border: 2px solid #fff;
  font-size: 13px;
  line-height: 18px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
/* On the game page the chat is compact (the bottom-right corner, over the side panel, clear of
   the battlefield and Fight!). */
.game-page .chat-fab {
  height: 46px;
  padding: 0 12px;
}
.game-page .chat-fab-label {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .chat-fab.bump,
  .chat-fab.bump.has-unread {
    animation: none;
  }
}

/* A locked Wild Area card's very rare Pokémon, as silhouettes (ui/wild.js lockText). */
.wild-lock-tease {
  display: flex;
  gap: 2px;
  margin-top: 2px;
}
.wild-lock-tease canvas {
  width: 24px;
  height: 24px;
  image-rendering: pixelated;
  filter: brightness(0) drop-shadow(0 0 3px rgba(255, 203, 5, 0.8));
}

/* Beginners' titles (meta/titles.js): fresh greens, trail teal and a warm spark. */
.title-sprout {
  border-color: #7ad67a;
  background: rgba(90, 200, 100, 0.18);
  color: #c4f5c4;
}
.title-trail {
  border-color: #4fd1c5;
  background: rgba(60, 200, 190, 0.16);
  color: #b8f4ee;
}
.title-spark {
  border-color: #ffb547;
  background: linear-gradient(90deg, rgba(255, 170, 60, 0.26), rgba(255, 120, 60, 0.14));
  color: #ffe0b0;
}

/* Medium and veteran titles (meta/titles.js): silver-blue aces, dark-gold veterans, and the two
   hardest of all in a slow rainbow shine. */
.title-ace {
  border-color: #a8c4ff;
  background: linear-gradient(90deg, rgba(150, 180, 255, 0.24), rgba(200, 210, 230, 0.12));
  color: #e2eaff;
}
.title-veteran {
  border-color: #e0b84a;
  background: linear-gradient(90deg, rgba(60, 40, 10, 0.75), rgba(150, 110, 30, 0.45));
  color: #ffe08a;
  box-shadow: 0 0 6px rgba(224, 184, 74, 0.4);
}
.title-mythic {
  border-color: #fff;
  background: linear-gradient(110deg, #ff6b6b, #ffd34d, #6bff95, #6bc6ff, #c86bff, #ff6b6b) 0 0 / 300% 100%;
  color: #1a1030;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.45);
  animation: title-shine 4s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .title-mythic {
    animation: none;
  }
}

/* Content Creator (meta/titles.js): a recording-red dot on a purple-to-pink tag. */
.title-content-creator {
  border-color: #f08cff;
  background: linear-gradient(110deg, #5b2a9e, #b23bd6 55%, #ff5fa2);
  color: #fff;
  box-shadow: 0 0 8px rgba(214, 72, 200, 0.5);
}
.title-content-creator::before {
  content: '';
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.35em;
  border-radius: 50%;
  background: #ff3b3b;
  box-shadow: 0 0 4px #ff3b3b;
  vertical-align: 0.06em;
  animation: rec-blink 1.6s steps(2, start) infinite;
}
@keyframes rec-blink {
  50% {
    opacity: 0.25;
  }
}
@media (prefers-reduced-motion: reduce) {
  .title-content-creator::before {
    animation: none;
  }
}

/* N (meta/titles.js): a given title, in green: a shining emerald tag with a black letter in a pale
   halo, a pulsing neon glow and a twinkling spark. */
.title-n {
  position: relative;
  border-color: #b6ffd0;
  background: linear-gradient(110deg, #0a5c30 0%, #1fa855 30%, #c8ffdc 50%, #1fa855 70%, #0a5c30 100%) 0 0 / 250% 100%;
  color: #000;
  font-weight: 900;
  letter-spacing: 0.12em;
  padding-inline: 0.75em;
  text-shadow: 0 0 3px #e4fff0, 0 0 1px #fff;
  animation: title-shine 2.6s linear infinite, n-glow 2.4s ease-in-out infinite;
}
.title-n::after {
  content: '✦';
  position: absolute;
  top: -0.75em;
  right: -0.5em;
  font: 1.15em/1 system-ui, sans-serif;
  color: #eafff2;
  text-shadow: 0 0 4px #4dff9a, 0 0 8px #4dff9a;
  animation: n-spark 1.8s ease-in-out infinite;
}
@keyframes n-glow {
  0%,
  100% {
    box-shadow: 0 0 6px rgba(34, 179, 94, 0.55);
  }
  50% {
    box-shadow: 0 0 14px 2px rgba(77, 255, 154, 0.85), inset 0 0 4px rgba(255, 255, 255, 0.6);
  }
}
@keyframes n-spark {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.4) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1) rotate(90deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .title-n,
  .title-n::after {
    animation: none;
  }
}

/* A Pokémon shared in chat (ui/chat.js): its card, like the profile showcase's. */
.chat-share {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted, #b9c2e0);
}
.chat-mon.pf-show {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--rar);
  border-radius: 10px;
  background: color-mix(in srgb, var(--rar) 14%, transparent);
  text-align: left;
}
.chat-mon canvas {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
}
.chat-mon figcaption {
  display: grid;
  gap: 1px;
}
.chat-mon-rar {
  color: var(--rar);
  font-size: 11px;
}
/* Its share button on the Pokémon's summary (ui/pokeSummary.js). */
.ps-share-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.ps-share {
  padding: 4px 10px;
  font-size: 13px;
}

/* The Pokémon Census's owners page (ui/amounts.js showOwners), and its look cards that open it. */
.amt-variant.has-owners {
  cursor: pointer;
}
.amt-variant.has-owners:hover,
.amt-variant.has-owners:focus-visible {
  outline: 2px solid var(--gold, #ffcb05);
  outline-offset: 2px;
}
.amt-owners-link {
  color: var(--gold, #ffcb05);
  font-weight: 600;
}
.amt-back {
  margin: 4px 0 12px;
}
.amt-owners-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--r);
  border-radius: 12px;
  background: color-mix(in srgb, var(--r) 12%, transparent);
}
.amt-owners-head h3 {
  margin: 0 0 4px;
}
.amt-owners-head canvas {
  width: 96px;
  height: 96px;
}
.amt-owner-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.amt-owner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
}
.amt-owner-more {
  grid-column: 1 / -1;
}

/* My Profile: searches in each Wild Area (ui/pages.js wildSearches). */
.pf-wild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.pf-wild-area {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid rgba(120, 200, 120, 0.35);
  border-radius: 10px;
  background: rgba(80, 160, 80, 0.08);
}
.pf-wild-area b {
  font-size: 13px;
}
.pf-wild-n {
  font-size: 18px;
  font-weight: 700;
  color: #8fe08f;
}
.pf-wild-area small {
  color: var(--muted, #b9c2e0);
}
.pf-wild-area.none {
  opacity: 0.5;
}

/* Invite a friend (Union Room, ui/referrals.js) */
.ref-code small {
  display: block;
  opacity: 0.75;
}

.ref-code-text {
  font-size: 1.6rem;
  letter-spacing: 0.18em;
  font-family: ui-monospace, monospace;
  color: var(--gold);
}

.ref-done {
  color: #7be08f;
  font-weight: 600;
}

/* The PC Box's filters (ui/meta.js renderCollection): search, type, sort, what to show, rarity. */
.box-filters {
  display: grid;
  gap: 8px;
  margin: 8px 0 4px;
}
.box-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.box-search,
.box-select select {
  padding: 6px 10px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}
.box-search {
  flex: 1 1 180px;
  max-width: 260px;
}
.box-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted, #b9c2e0);
}
.box-clear {
  font-size: 13px;
}
.box-count {
  margin: 4px 0 8px;
  font-size: 13px;
}

/* A shared Pokémon's card opens its summary (ui/chat.js openShared). */
.chat-mon[data-chat='share'] {
  cursor: pointer;
}
.chat-mon[data-chat='share']:hover,
.chat-mon[data-chat='share']:focus-visible {
  outline: 2px solid var(--rar);
  outline-offset: 1px;
}
.ps-owner {
  display: block;
  margin-top: 4px;
  color: var(--muted, #b9c2e0);
}

/* The Wild Areas Search button's spot across its bar (ui/wild.js searchSpot): it jumps every 50 to
   100 searches, with a glow where it landed. */
.wild-search-bar {
  width: 100%;
}
.wild-search-slot {
  display: flex;
  width: 100%;
}
.wild-search-slot::before,
.wild-search-slot::after {
  content: '';
}
.wild-search-slot::before {
  flex: var(--at) 1 0;
}
.wild-search-slot::after {
  flex: calc(1 - var(--at)) 1 0;
}
.wild-search.moved {
  animation: wild-search-moved 1.2s ease-out;
}
@keyframes wild-search-moved {
  from {
    box-shadow: 0 0 0 0 rgba(255, 203, 5, 0.9);
  }
  to {
    box-shadow: 0 0 0 22px rgba(255, 203, 5, 0);
  }
}

/* The summon page for a player who isn't signed in (ui/meta.js renderSummon). */
.pull-signin {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.pull-signin p {
  margin: 0;
  color: var(--muted, #b9c2e0);
}

/* The Update Log (menu.js renderUpdates), and its link under What's New on Home. */
.news-all {
  display: inline-block;
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
}
.news-all:hover {
  text-decoration: underline;
}
.update-month {
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.update-month h3 {
  margin: 0 0 4px;
}
.update-list .news-title {
  font-size: 16px;
}

/* The type filter chips (ui/typeFilter.js): each in its type's colour, white text when picked. */
.type-filters .inv-chip {
  text-transform: capitalize;
}
.type-filters .inv-chip[aria-pressed='true'] {
  background: var(--r);
  color: #fff;
}

/* Invite a friend's page (invite.html, src/invite.js): the game's navy and gold, with tickets. */
body.iv-page {
  min-height: 100%;
  background:
    radial-gradient(ellipse at 50% -10%, #2a3a86 0%, transparent 60%),
    linear-gradient(180deg, #121a3c 0%, var(--bg) 45%);
}
html:has(body.iv-page) {
  background: var(--bg);
}
.iv-page a:not(.button) {
  color: var(--gold);
}
.iv-hero {
  position: relative;
  overflow: hidden;
  padding: 0 16px 44px;
  border-bottom: 2px solid var(--line);
  background:
    radial-gradient(circle at 78% 45%, rgba(255, 203, 5, 0.16), transparent 34%),
    radial-gradient(circle, rgba(255, 255, 255, 0.06) 1.5px, transparent 1.6px) 0 0 / 22px 22px,
    linear-gradient(180deg, #23307a 0%, #18215a 60%, #131a45 100%);
}
.iv-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px 0;
}
.iv-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink) !important;
  text-decoration: none;
}
.iv-top-link {
  font-weight: 600;
  text-decoration: none;
}
.iv-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 32px;
  max-width: 1080px;
  margin: 20px auto 0;
}
.iv-kicker {
  margin: 0 0 8px;
  font-family: var(--pixel);
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.iv-title {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  line-height: 1.05;
  text-wrap: balance;
}
.iv-lede {
  margin: 0 0 20px;
  max-width: 34em;
  font-size: 1.08rem;
  line-height: 1.55;
  color: var(--muted);
}
.iv-lede b {
  color: var(--ink);
}
.iv-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.iv-actions .button {
  padding: 10px 18px;
  font-size: 1.02rem;
}
.iv-duo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 220px;
}
.iv-duo::before {
  content: '';
  position: absolute;
  width: min(340px, 90%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px dashed rgba(255, 203, 5, 0.35);
  animation: iv-spin 40s linear infinite;
}
.iv-duo-mon {
  position: relative;
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 70%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 70%);
  animation: iv-bob 3.2s ease-in-out infinite;
}
.iv-duo-mon.two {
  animation-delay: -1.6s;
}
.iv-duo-spark {
  position: relative;
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255, 203, 5, 0.7);
  animation: iv-pulse 2s ease-in-out infinite;
}
.iv-spr {
  image-rendering: pixelated;
}
@keyframes iv-bob {
  50% { transform: translateY(-8px); }
}
@keyframes iv-pulse {
  50% { transform: scale(1.25); opacity: 0.8; }
}
@keyframes iv-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .iv-duo::before,
  .iv-duo-mon,
  .iv-duo-spark {
    animation: none;
  }
}

/* A ticket with a code on it: the hero's (an invite link) and the player's own. */
.iv-ticket {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 16px;
  padding: 12px 26px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8d6, #ffe58a);
  color: #3a2c00;
  box-shadow: 0 4px 0 var(--gold-deep);
  -webkit-mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 9px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle 9px at 0 50%, transparent 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle 9px at 100% 50%, transparent 98%, #000) right / 51% 100% no-repeat;
}
.iv-ticket small {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.7;
}
.iv-code {
  font-family: ui-monospace, 'Cascadia Mono', monospace;
  font-size: 2rem;
  letter-spacing: 0.22em;
}
.iv-ticket-note {
  font-size: 0.8rem;
  opacity: 0.75;
}
.iv-gets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}
.iv-gets span {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(13, 18, 38, 0.5);
  font-size: 0.92rem;
}
.iv-gets b {
  color: var(--gold);
}

.iv-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 8px 16px 40px;
}
.iv-section {
  margin-top: 40px;
}
.iv-section h2 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.55rem;
}
.iv-sub {
  margin: -6px 0 14px;
  color: var(--muted);
}
.iv-panel {
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.iv-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.iv-empty p {
  margin: 0;
  font-size: 1.02rem;
}
.iv-mine {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
  border-color: rgba(255, 203, 5, 0.45);
  background: linear-gradient(135deg, #1d2650, var(--panel));
}
.iv-mine .iv-ticket {
  margin: 0;
}
.iv-link {
  flex: 1 1 300px;
  min-width: 0;
}
.iv-link label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: var(--muted);
}
.iv-link input,
.iv-join input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink);
  font: 1rem ui-monospace, monospace;
}
.iv-link-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.iv-link-actions button {
  padding: 8px 16px;
}
.iv-msg {
  min-height: 1.2em;
  margin: 6px 0 0;
  color: var(--ok);
  font-weight: 600;
}
.iv-progress-head {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.iv-progress-head small {
  display: block;
  color: var(--muted);
}
.iv-progress-head b {
  font-family: var(--display);
  font-size: 1.5rem;
}
.iv-progress-head b span:not(.iv-title-tag) {
  font-size: 1rem;
  color: var(--muted);
}
.iv-title-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  color: #3a2c00;
  background: linear-gradient(90deg, #ffe066, #ffb84d);
  vertical-align: middle;
}
.iv-title-tag.locked {
  filter: grayscale(1);
  opacity: 0.5;
}
.iv-bar {
  height: 12px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
}
.iv-bar i {
  display: block;
  height: 100%;
  min-width: 0;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold));
}
.iv-friends {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}
.iv-friends li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.iv-friends b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iv-friends li > span:last-child {
  min-width: 8.5em;
  text-align: right;
}
.iv-ok {
  color: var(--ok);
  font-weight: 600;
}
.iv-none {
  margin: 14px 0 0;
}
.iv-pips {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
}
.iv-pips i {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--bg);
}
.iv-pips i.on {
  border-color: var(--gold-deep);
  background: var(--gold);
}
.iv-joined p {
  margin: 0;
  line-height: 1.8;
}
.iv-join label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}
.iv-join-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}
.iv-join-row input {
  flex: 1;
  min-width: 0;
}

.iv-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.iv-steps li {
  position: relative;
  padding: 18px 16px 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}
.iv-step-n {
  position: absolute;
  top: -12px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: #3a2c00;
  font-family: var(--display);
  font-weight: 700;
}
.iv-step-icon {
  font-size: 1.9rem;
}
.iv-steps h3 {
  margin: 6px 0 4px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.12rem;
}
.iv-steps p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.iv-maps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.iv-maps li {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: var(--card);
}
.iv-maps li.done {
  border-color: var(--ok);
}
.iv-maps img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  image-rendering: pixelated;
  background: var(--bg);
}
.iv-maps b {
  display: block;
  padding: 8px 10px;
  font-family: var(--display);
  font-weight: 600;
}
.iv-map-n {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(13, 18, 38, 0.85);
  color: var(--gold);
  font-weight: 700;
}
.iv-map-ok {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ok);
  color: #06301a;
  font-size: 0.8rem;
  font-weight: 700;
}

.iv-rewards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.iv-reward {
  padding: 20px 22px;
  border: 2px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.iv-reward.you {
  border-color: rgba(255, 203, 5, 0.5);
  background: linear-gradient(160deg, rgba(255, 203, 5, 0.12), var(--panel) 55%);
}
.iv-reward.friend {
  border-color: rgba(61, 125, 202, 0.6);
  background: linear-gradient(160deg, rgba(61, 125, 202, 0.16), var(--panel) 55%);
}
.iv-reward h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--muted);
}
.iv-reward-big {
  margin: 4px 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 2.6rem;
  color: var(--gold);
}
.iv-reward p {
  margin: 0 0 10px;
  line-height: 1.5;
}
.iv-reward-items {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.iv-reward-items span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.iv-item {
  image-rendering: pixelated;
}
.iv-reward-title {
  color: var(--muted);
}

.iv-rules {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}
.iv-foot {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
}

/* The Ticket shop: one row of cards per price tier, each card tinted by its finish. */
.iv-shop-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 10px;
}
.iv-wallet {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  border: 2px solid rgba(255, 203, 5, 0.5);
  background: rgba(255, 203, 5, 0.1);
  font-weight: 600;
}
.iv-wallet b {
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--gold);
}
.iv-shop-msg {
  min-height: 1.3em;
  margin: 0 0 6px;
  font-weight: 600;
  color: var(--danger);
}
.iv-shop-msg.ok {
  color: var(--ok);
}
.iv-tier {
  margin-bottom: 22px;
}
.iv-tier h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
  text-transform: none;
  letter-spacing: normal;
}
.iv-tier h3::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.iv-price {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--gold);
  color: #3a2c00;
  font-size: 0.92rem;
}
.iv-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.iv-mon {
  --fin: #b6bee3;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 14px;
  border: 2px solid color-mix(in srgb, var(--fin) 45%, var(--line));
  border-radius: 16px;
  background: radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--fin) 26%, transparent), transparent 60%), var(--panel);
}
.iv-mon.fin-gold { --fin: #ffcb05; }
.iv-mon.fin-ice { --fin: #8fe3ff; }
.iv-mon.fin-dark { --fin: #a070ff; }
.iv-mon.fin-ruby { --fin: #ff4d6d; }
.iv-mon.fin-sapphire { --fin: #3f7bff; }
.iv-mon.fin-emerald { --fin: #2ee68a; }
.iv-mon.fin-steel { --fin: #d6dde8; }
.iv-mon.fin-cosmos { --fin: #b18cff; }
.iv-tier-legendary .iv-mon,
.iv-tier-mythical .iv-mon {
  box-shadow: 0 0 22px color-mix(in srgb, var(--fin) 30%, transparent);
}
.iv-mon-pic {
  display: grid;
  place-items: center;
  height: 132px;
}
.iv-mon h4 {
  margin: 4px 0 4px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
}
.iv-perk {
  flex: 1;
  margin: 0 0 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--muted);
}
.iv-perk b {
  color: var(--ink);
}
.iv-mon button {
  width: 100%;
  padding: 8px 10px;
}
.iv-mon.owned {
  opacity: 0.8;
}
.iv-owned {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  text-align: center;
  font-weight: 700;
  color: var(--ok);
  background: rgba(94, 224, 138, 0.1);
}
.iv-reward-big small {
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

@media (max-width: 860px) {
  .iv-hero-inner {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .iv-duo {
    order: -1;
    min-height: 210px;
  }
  .iv-duo::before {
    width: 200px;
  }
  .iv-duo-mon {
    width: 112px;
    height: 112px;
  }
  .iv-duo-mon canvas {
    width: 100px;
    height: 100px;
  }
  .iv-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 22px;
  }
  .iv-maps {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .iv-rewards {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 520px) {
  .iv-steps {
    grid-template-columns: 1fr;
  }
  .iv-progress-head {
    grid-template-columns: 1fr 1fr;
  }
  .iv-friends li {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .iv-friends li > span:last-child {
    grid-column: 1 / -1;
    text-align: left;
  }
  .iv-code {
    font-size: 1.6rem;
  }
  .iv-shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .iv-mon {
    padding: 10px;
  }
  .iv-perk {
    font-size: 0.8rem;
  }
  .iv-mon-pic {
    height: 112px;
  }
  .iv-mon-pic canvas {
    width: 108px;
    height: 108px;
  }
}

/* Saved teams (ui/teamSwitch.js): one tap to switch, on the Party, Play and Gyms & League pages. */
.team-switch {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 12px;
}
.ts-label {
  margin-right: 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted, #b9c2e0);
}
.ts-slot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.ts-slot small {
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
}
.ts-slot.on {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 20%, var(--card));
  box-shadow: 0 0 10px color-mix(in srgb, var(--gold) 40%, transparent);
}
.ts-new {
  border-style: dashed;
  color: var(--muted, #b9c2e0);
}
.ts-edit {
  padding: 4px 8px;
  border: 0;
  background: none;
  font-size: 15px;
  cursor: pointer;
}

/* The way to the Hall of Fame page (leaderboard.html) from the game's own boards. */
.lb-hof {
  display: grid;
  gap: 2px;
  flex-basis: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid var(--gold);
  border-radius: 12px;
  background: linear-gradient(110deg, color-mix(in srgb, var(--gold) 22%, var(--card)), var(--card));
  color: var(--ink);
  text-decoration: none;
}
.lb-hof b {
  color: var(--gold);
  font-size: 16px;
}
.lb-hof span {
  font-size: 13px;
  color: var(--muted, #b9c2e0);
}
.lb-hof:hover {
  box-shadow: 0 0 12px color-mix(in srgb, var(--gold) 45%, transparent);
}

/* Reporting a trainer's name, on their trainer card (ui/trainerCard.js). */
.tcard-report {
  padding: 4px 10px;
  font-size: 12px;
  opacity: 0.8;
}

/* Wild Areas for a player who isn't signed in (ui/wild.js searchBar). */
.wild-signin {
  text-align: center;
}
.wild-signin p {
  margin: 0 0 4px;
  color: var(--muted, #b9c2e0);
}

/* Evolving a Pokémon in the PC Box (ui/meta.js evolveInBox) */
.evolve-btn {
  width: 100%;
  margin-top: 4px;
  font-size: 12px;
  padding: 4px 6px;
  border-color: var(--gold);
  color: var(--gold);
}

.ps-evo figure.ps-here figcaption {
  color: var(--gold);
  font-weight: 700;
}

.ps-evo figure.ps-here canvas {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 8px;
}

.ps-evolve {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 10px;
}

.ps-evolve small {
  flex: 1 1 200px;
  color: var(--muted, #9aa);
}

/* Wild Areas: in a bar too narrow to move it sideways, the Search button moves up and down
   (ui/wild.js placeSearch). */
.wild-search-slot.narrow {
  align-items: flex-start;
  min-height: 215px;
}


/* Trainer Coins (meta/coins.js): the website's own currency for trading. The header chip on the
   homepage and their page (coins.html, reusing the invite page's look). */
.coin-balance {
  color: #ffe9a3;
  text-decoration: none;
}
.coin-balance:hover {
  color: #fff3c4;
}
.ico.coin {
  font-style: normal;
  font-size: 0.95em;
}
.cn-coin-art {
  display: grid;
  place-items: center;
  min-height: 200px;
}
.cn-big-coin {
  font-size: 128px;
  line-height: 1;
  filter: drop-shadow(0 8px 24px rgba(255, 203, 5, 0.45));
  animation: iv-bob 3.2s ease-in-out infinite;
}
.cn-earn {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cn-earn li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.cn-earn-icon {
  font-size: 1.6rem;
}
.cn-earn p {
  margin: 2px 0 0;
  color: var(--muted);
}
.cn-hist-h {
  margin: 18px 0 6px;
  font-family: var(--display);
  font-size: 1rem;
}
.cn-history {
  margin: 0;
  padding: 0;
  list-style: none;
}
.cn-history li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
}
.cn-plus {
  color: var(--ok);
}
.cn-minus {
  color: var(--danger);
}
@media (max-width: 860px) {
  .cn-coin-art {
    order: -1;
    min-height: 140px;
  }
  .cn-big-coin {
    font-size: 96px;
  }
}
.coin-balance[hidden] {
  display: none;
}
/* (The header on laptops: tighter, with smaller team slots and no online count, so the balances fit.) */
.menu-top .brand h1 span {
  white-space: nowrap;
}
@media (min-width: 901px) and (max-width: 1359px) {
  .menu-top {
    gap: 8px;
    padding-inline: 12px;
  }
  .menu-top .brand {
    flex: none;
  }
  .menu-top .online-count {
    display: none;
  }
  .menu-top .team-slots {
    grid-template-columns: repeat(10, 24px);
    gap: 2px;
  }
  .menu-top .team-slot {
    width: 24px;
    height: 24px;
  }
  .menu-top .team-slot canvas {
    max-width: 24px;
    max-height: 24px;
  }
}

/* ---------- The Underground (src/ui/mining.js) ---------- */
/* The Underground's clicker: the numbers, the rock (with its helpers) and the upgrades. */
.mine-away {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid rgba(255, 203, 5, 0.5);
  background: rgba(255, 203, 5, 0.08);
}

.mine-away small {
  color: var(--muted);
}

.mine-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.mine-stat {
  display: grid;
  gap: 2px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.mine-stat small {
  color: var(--muted);
  font-size: 12px;
}

.mine-stat b {
  font-family: var(--display);
  font-size: 1.45rem;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.mine-stat.ore {
  border-color: rgba(232, 195, 122, 0.55);
  background: linear-gradient(160deg, rgba(232, 195, 122, 0.12), transparent 60%), var(--panel);
}

.mine-stat.ore b {
  color: #f1d39a;
}

.mine-stat.sph {
  border-color: rgba(200, 140, 255, 0.55);
  background: linear-gradient(160deg, rgba(200, 140, 255, 0.14), transparent 60%), var(--panel);
}

.mine-stat.sph b {
  color: #e3c6ff;
}

.mine-clicker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 14px;
  align-items: stretch;
}

/* (The stage: a cave floor from the Gen 3 cave tileset, tiled at 3×, lit from the middle. The
   floor picture is set on the element, by depth.) */
.mine-stage {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  min-height: 420px;
  padding: 24px 16px 18px;
  overflow: hidden;
  border-radius: 6px;
  border: 4px solid #140e10;
  box-shadow: 0 0 0 2px #4a3a3c, 0 6px 0 2px #0b0809;
  background-color: #2a2024;
  background-size: 144px 48px;
  image-rendering: pixelated;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.mine-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 60% 55% at 50% 45%, rgba(8, 4, 6, 0.35) 30%, rgba(8, 4, 6, 0.7) 75%, rgba(8, 4, 6, 0.9));
}

.mine-stage > * {
  position: relative;
}

.mine-rock {
  position: relative;
  width: 282px;
  height: 288px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform-origin: 50% 90%;
  -webkit-tap-highlight-color: transparent;
}

/* (Its shadow on the floor.) */
.mine-rock::before {
  content: '';
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: -10px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
}

.mine-rock:focus-visible {
  outline: 3px dashed var(--gold);
  outline-offset: 6px;
}

.mine-rock.hit {
  animation: mine-squash 0.12s steps(2, end);
}

@keyframes mine-squash {
  50% { transform: scale(1.03, 0.96) translateY(3px); }
  100% { transform: none; }
}

.mine-rock-cracks[hidden] {
  display: none;
}

.mine-rock-body,
.mine-rock-cracks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  pointer-events: none;
  -webkit-user-drag: none;
}

.mine-hp {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(300px, 80%);
}

.mine-hp .exp-bar {
  width: 100%;
  height: 10px;
  border-radius: 0;
  border: 2px solid #140e10;
  background: #3a3032;
  box-shadow: 0 0 0 2px #e8e0d8;
}

.mine-hp .exp-bar i {
  border-radius: 0;
  background: linear-gradient(180deg, #70f8a8 0 50%, #18c020 50%);
  transition: width 0.12s steps(4, end);
}

.mine-hp small,
.mine-next {
  color: #f0e8e0;
  font-size: 13px;
  text-shadow: 1px 1px 0 #000;
}

.mine-next {
  margin: 0;
}


/* (The helpers: along the bottom of the cave, each hitting the rock in turn.) */
.mine-helpers {
  position: absolute;
  inset: auto 8px 6px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 6px;
  pointer-events: none;
}

.mine-helpers:empty {
  display: none;
}

.mine-stage:has(.mine-helper) {
  padding-bottom: 76px;
}

.mine-helper {
  position: relative;
  animation: mine-work 0.9s ease-in-out infinite;
  animation-delay: calc(var(--i) * -0.23s);
}

.mine-helper canvas {
  width: 56px;
  height: 56px;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 2px rgba(0, 0, 0, 0.6));
}

.mine-helper em {
  position: absolute;
  right: -2px;
  bottom: 2px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold);
  color: #3a2c00;
  font-style: normal;
  font-weight: 700;
  font-size: 11px;
}

@keyframes mine-work {
  50% { transform: translateY(-6px) rotate(-6deg); }
}

.mine-pop,
.mine-gain {
  position: absolute;
  z-index: 4;
  pointer-events: none;
  font-family: var(--display);
  font-weight: 700;
  text-shadow: 2px 0 0 #140e10, -2px 0 0 #140e10, 0 2px 0 #140e10, 0 -2px 0 #140e10, 2px 2px 0 #140e10;
}

.mine-pop {
  color: #fff3d6;
  font-size: 18px;
  transform: translate(-50%, -50%);
  animation: mine-float 0.7s ease-out forwards;
}

.mine-gain {
  top: 18%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 4px;
  color: #f1d39a;
  font-size: 22px;
  white-space: nowrap;
  transform: translateX(-50%);
  animation: mine-rise 1.1s ease-out forwards;
}

.mine-gain .px-ico {
  width: 28px;
  height: 28px;
}

@keyframes mine-float {
  from { opacity: 1; transform: translate(-50%, -50%); }
  to { opacity: 0; transform: translate(-50%, -150%); }
}

@keyframes mine-rise {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -30px) scale(1); }
}

/* (The upgrades, cheapest first, like a clicker's store.) */
.mine-store {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.mine-store h3 {
  margin: 0;
  font-size: 15px;
}

.mine-store h3 small {
  margin-left: 6px;
  font-weight: 400;
  color: var(--muted);
}

.mine-upgrades {
  display: grid;
  gap: 6px;
}

.mine-up {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: linear-gradient(160deg, rgba(232, 195, 122, 0.08), transparent 60%), var(--card);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mine-up:not(:disabled):hover {
  border-color: #e8c37a;
  background: linear-gradient(160deg, rgba(232, 195, 122, 0.18), transparent 60%), var(--card-hi);
}

.mine-up:disabled {
  opacity: 1;
  cursor: default;
}

.mine-up:disabled .mine-up-pic,
.mine-up:disabled .mine-up-text,
.mine-up:disabled em {
  opacity: 0.5;
}

.mine-up-pic {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: #2a2024;
  box-shadow: inset 0 0 0 2px #140e10, inset 0 0 0 4px #4a3a3c;
  font-style: normal;
  font-size: 24px;
}

.mine-up-pic .px-ico.big {
  width: 32px;
  height: 32px;
  margin: 0;
}

.mine-up-pic canvas {
  width: 42px;
  height: 42px;
  image-rendering: pixelated;
}

.mine-up-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.mine-up-text small {
  color: var(--muted);
  font-size: 12px;
}

.mine-up-side {
  display: grid;
  justify-items: end;
}

.mine-up-side em {
  font-style: normal;
  font-weight: 700;
  color: #f1d39a;
  white-space: nowrap;
}

.mine-up-side small {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 900px) {
  .mine-clicker {
    grid-template-columns: minmax(0, 1fr);
  }

  .mine-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mine-stage {
    min-height: 340px;
  }
}

/* The Underground's small pixel icons (assets/underground/: Ore, Spheres, the pick) and item sprites. */
.px-ico {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  margin-right: 0.25em;
  vertical-align: -0.2em;
  image-rendering: pixelated;
}

.px-item {
  image-rendering: pixelated;
}

/* A Sphere: a glassy ball in its colour. */
.mine-sphere {
  display: block;
  width: min(72cqw, 72cqh);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #fff 0 8%, color-mix(in srgb, var(--sc) 55%, #fff) 16%, var(--sc) 45%, color-mix(in srgb, var(--sc) 55%, #000) 100%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--sc) 60%, transparent), 0 2px 3px rgba(0, 0, 0, 0.6);
}

.mine-sphere.prism {
  background:
    radial-gradient(circle at 34% 30%, #fff 0 8%, transparent 20%),
    conic-gradient(from 30deg, #ff7a7a, #ffd36b, #7cf0a0, #6bb8ff, #c88cff, #ff7a7a);
}

/* Rock dust where a blow lands. */
.mine-dust {
  position: absolute;
  z-index: 3;
  width: 0;
  height: 0;
  pointer-events: none;
}

.mine-dust i {
  position: absolute;
  width: 6px;
  height: 6px;
  margin: -3px;
  background: var(--chip, #9a9a9a);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6);
  animation: mine-dust 0.45s ease-out forwards;
}

.mine-dust.hammer i {
  width: 32px;
  height: 32px;
  margin: -16px;
  background-color: transparent;
  background-size: 100% 100%;
  box-shadow: none;
  image-rendering: pixelated;
}

@keyframes mine-dust {
  from { transform: rotate(var(--a)) translateX(0); opacity: 1; }
  to { transform: rotate(var(--a)) translateX(var(--d)) scale(0.4); opacity: 0; }
}

.mine-rules {
  margin: 0 0 8px;
  font-size: 13px;
}

.mine-log {
  margin: 0;
}

/* (The mine's name, on a sign in the cave's corner.) */
.mine-here {
  position: absolute;
  top: 10px;
  left: 12px;
  margin: 0;
  padding: 3px 10px;
  border: 2px solid #140e10;
  border-radius: 3px;
  background: #e8e0d8;
  color: #2a2024;
  font-weight: 700;
  font-size: 13px;
  box-shadow: inset 0 0 0 2px #b8a898, 0 3px 0 #0b0809;
}

/* ---- The mines: places to dig, opened one by one ---- */
.mine-mines {
  margin-top: 16px;
}

.mine-map-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.mine-map {
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 8px 8px 10px;
  border-radius: 6px;
  border: 2px solid var(--line);
  background: var(--panel);
}

.mine-map.here {
  border-color: var(--gold);
}

.mine-map-pic {
  display: grid;
  place-items: center;
  height: 104px;
  border-radius: 3px;
  border: 2px solid #140e10;
  background-size: 96px 32px;
  image-rendering: pixelated;
  box-shadow: inset 0 0 24px rgba(8, 4, 6, 0.8);
}

.mine-map-pic img {
  width: 94px;
  height: 96px;
  image-rendering: pixelated;
}

.mine-map.locked .mine-map-pic img {
  filter: brightness(0.15);
}

.mine-map h4 {
  margin: 2px 0 0;
  font-size: 15px;
}

.mine-map-perk {
  margin: 0;
  color: #f1d39a;
  font-size: 12px;
  font-weight: 700;
}

.mine-map-text {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.mine-map button {
  margin-top: 2px;
}

.mine-map-here {
  justify-self: start;
  margin-top: 2px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 203, 5, 0.15);
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
}

/* ---- The way to the Mining Shop ---- */
.mine-shop-banner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-top: 16px;
  padding: 12px 18px;
  border-radius: 16px;
  border: 2px solid rgba(180, 140, 255, 0.55);
  background:
    radial-gradient(circle at 12% 50%, rgba(200, 140, 255, 0.25), transparent 40%),
    radial-gradient(circle, rgba(255, 255, 255, 0.05) 1.5px, transparent 1.6px) 0 0 / 20px 20px,
    linear-gradient(120deg, #3a2a1d, #2a1d38 70%);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
}

.mine-shop-banner:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(160, 110, 255, 0.25);
}

.mine-shop-banner-art {
  display: flex;
}

.mine-shop-banner-art canvas {
  width: 72px;
  height: 72px;
  margin-right: -4px;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.5));
}

.mine-shop-banner-text {
  display: grid;
  gap: 2px;
}

.mine-shop-banner-text b {
  font-family: var(--display);
  font-size: 1.2rem;
}

.mine-shop-banner-text small {
  color: var(--muted);
}

.mine-shop-cta {
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid #7a46c8;
  background: linear-gradient(180deg, #c99bff, #9a62ec);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 0 #5d34a0;
}

@media (max-width: 640px) {
  .mine-shop-banner {
    grid-template-columns: minmax(0, 1fr);
    justify-items: start;
  }
}

/* ---- Everything found so far ---- */
.mine-collection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mine-collection li {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: 8px;
  border: 2px solid var(--line);
  background: var(--bg);
  text-align: center;
}

.mine-collection li .px-item {
  width: 48px;
  height: 48px;
  margin: -6px 0 -4px;
}

.mine-collection li small {
  color: var(--muted);
  font-size: 11px;
}

.mine-collection li.none {
  opacity: 0.45;
}

.mine-collection li.none .px-item {
  filter: brightness(0);
  opacity: 0.6;
}

@media (max-width: 520px) {
  .mine-stage {
    border-width: 4px;
  }

  .mine-rock {
    width: 188px;
    height: 192px;
  }

  .mine-stat b {
    font-size: 1.2rem;
  }
}

.iv-owned.mn-soldout {
  color: var(--muted);
  background: rgba(182, 190, 227, 0.08);
}

/* ---------- The Mining Shop's page (mining-shop.html, src/miningShop.js): the invite page's
   layout, in the Underground's earth and Sphere purple. ---------- */
body.mn-page {
  background:
    radial-gradient(ellipse at 50% -10%, #4a2f6e 0%, transparent 60%),
    linear-gradient(180deg, #1d1530 0%, var(--bg) 45%);
}

.mn-hero {
  background:
    radial-gradient(circle at 78% 45%, rgba(200, 140, 255, 0.22), transparent 34%),
    radial-gradient(circle, rgba(255, 220, 160, 0.07) 1.5px, transparent 1.6px) 0 0 / 22px 22px,
    linear-gradient(180deg, #3d2a1e 0%, #2b1f2e 60%, #1a1530 100%);
  border-bottom-color: #5a4532;
}

.mn-hero .iv-kicker {
  color: #e3c6ff;
}

.mn-duo::before {
  border-color: rgba(200, 140, 255, 0.45);
}

.mn-duo .iv-duo-spark {
  text-shadow: 0 0 18px rgba(200, 140, 255, 0.8);
}

.mn-purse {
  margin: 0 0 16px;
}

.mn-purse .iv-wallet,
.mn-shelf .iv-wallet {
  border-color: rgba(200, 140, 255, 0.6);
  background: rgba(200, 140, 255, 0.12);
}

.mn-purse .iv-wallet b,
.mn-shelf .iv-wallet b {
  color: #e3c6ff;
}

.mn-purse .iv-wallet {
  padding: 8px 18px;
  font-size: 1.1rem;
}

.mn-purse .iv-wallet b {
  font-size: 1.5rem;
}

.mn-purse span:not(.iv-wallet) {
  color: var(--muted);
}

.mn-msg {
  position: sticky;
  top: 8px;
  z-index: 5;
  margin: 0;
  min-height: 0;
}

.mn-msg.on {
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid currentColor;
  background: var(--panel);
}

.mn-card .iv-mon-pic {
  height: 120px;
}

.mn-card .iv-mon-pic canvas {
  max-height: 120px;
}

.mn-item-pic img {
  width: 104px;
  height: 104px;
  image-rendering: pixelated;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

.mn-icon {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 60%, rgba(255, 220, 160, 0.14), rgba(255, 255, 255, 0.02) 70%);
  font-size: 44px;
}

.mn-gear,
.mn-supply,
.mn-trade,
.mn-fossil {
  --fin: #c2753d;
}

.mn-gear .iv-mon-pic,
.mn-supply .iv-mon-pic,
.mn-trade .iv-mon-pic {
  height: 96px;
}

.mn-shelf .iv-mon button.primary {
  background: linear-gradient(180deg, #c99bff, #9a62ec);
  border-color: #7a46c8;
  color: #fff;
}

.mn-spheres {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.mn-sphere-kind {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 110px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.mn-sphere-kind small {
  color: var(--muted);
}

/* (The page's pixel art: Spheres drawn for the Underground, item sprites by each shelf, a
   boulder from the cave tileset in the hero, Diglett and the pick in the steps.) */
.mn-sphere-kind .mn-sphere-pic {
  width: 48px;
  height: 48px;
  margin: 0;
}

.mn-shelf-ico {
  width: 40px;
  height: 40px;
  margin: -8px 4px -10px -6px;
  vertical-align: middle;
  image-rendering: pixelated;
}

.mn-duo .iv-duo-spark {
  animation: none;
}

.mn-duo-rock {
  display: block;
  width: 94px;
  height: 96px;
  image-rendering: pixelated;
}

.mn-page .iv-step-icon .px-ico {
  width: 40px;
  height: 40px;
  margin: 0;
}

.mn-page .iv-step-icon canvas {
  width: 48px;
  height: 48px;
  margin: -4px;
  image-rendering: pixelated;
}

/* ---------- Raid Boss of the Week (src/ui/raid.js) ---------- */
.raid-section {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px;
}

.raid-section .promo-section-head {
  grid-column: 1 / -1;
}

.raid-card {
  display: grid;
  gap: 8px;
  border-color: rgba(255, 92, 108, 0.55);
  background: linear-gradient(160deg, rgba(255, 92, 108, 0.12), transparent 55%), var(--card);
}

.raid-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.raid-head canvas {
  width: 112px;
  height: 112px;
  flex: none;
  image-rendering: pixelated;
}

.raid-head h3 {
  margin: 0;
}

.raid-head p {
  margin: 4px 0 0;
}

.raid-community {
  display: grid;
  gap: 4px;
}

.raid-bar {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

.raid-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #ff5c6c, #ffcb05);
  transition: width 0.6s;
}

.raid-bar s {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(13, 18, 38, 0.8);
}

.raid-community.beaten .raid-bar i {
  background: linear-gradient(90deg, #5ee08a, #ffcb05);
}

@media (max-width: 720px) {
  .raid-section {
    grid-template-columns: 1fr;
  }

  .raid-head canvas {
    width: 80px;
    height: 80px;
  }
}

/* ---------- The Realm Gate (realms.html, src/realms.js) ---------- */
.rg-hero {
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 1.5px, transparent 1.6px) 0 0 / 22px 22px,
    linear-gradient(180deg, #1c1846 0%, #161338 60%, #110f2c 100%);
}
.rg-hero-text {
  max-width: 1080px;
  margin: 20px auto 0;
}
.rg-wallet {
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  font-weight: 600;
}
.rg-list {
  display: grid;
  gap: 18px;
}
.rg-card {
  display: grid;
  grid-template-columns: minmax(0, 448px) minmax(0, 1fr);
  gap: 20px;
  padding: 16px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  scroll-margin-top: 16px;
}
.rg-card.mine {
  border-color: var(--gold);
}
.rg-map canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  image-rendering: pixelated;
}
.rg-body h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.4rem;
}
.rg-body p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}
.rg-foot {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rg-price {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
}
.rg-tag {
  color: var(--gold);
  font-weight: 600;
}
.rg-earn {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rg-earn li {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 10px;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.rg-earn li span {
  grid-row: span 2;
  font-size: 1.4rem;
}
.rg-earn small {
  color: var(--muted);
}
@media (max-width: 760px) {
  .rg-card {
    grid-template-columns: 1fr;
  }
}

/* The weekly update's popup (src/ui/updatePopup.js): the event popup's layout in the site's colours. */
.update-pop {
  background: radial-gradient(ellipse at 50% 30%, rgba(30, 44, 110, 0.6), rgba(4, 6, 18, 0.88));
}
.update-pop .event-pop-card {
  padding-top: 22px;
  border-color: var(--gold);
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 203, 5, 0.16), transparent 45%),
    linear-gradient(180deg, #1d2650 0%, #141b38 100%);
  box-shadow: 0 0 0 4px rgba(255, 203, 5, 0.15), 0 24px 70px rgba(0, 0, 0, 0.6);
}
.update-pop .event-pop-kicker,
.update-pop .event-pop-title {
  color: var(--gold);
}
.update-pop .event-pop-title {
  text-shadow: 0 2px 0 #3d4fa0, 0 3px 0 #22306e;
}
.update-pop .event-pop-list b {
  color: var(--ink);
}
.update-pop .event-pop-list small {
  color: var(--muted);
}
