:root {
  --bg: #0b0b0d;
  --panel: #121215;
  --panel-2: #17171b;
  --line: #26262c;
  --line-soft: #1d1d22;
  --text: #e9e9ee;
  --muted: #8b8b96;
  --muted-2: #61616c;
  --radius: 14px;

  --Grass: #6dbf58;
  --Fire: #f0762b;
  --Water: #4a90e2;
  --Electric: #f2c33d;
  --Psychic: #f05a8c;
  --Ice: #74d0e0;
  --Dragon: #7a5ce0;
  --Dark: #6b5a55;
  --Fairy: #f096d8;
  --Normal: #a8a878;
  --Fighting: #d0563c;
  --Flying: #96a8e8;
  --Poison: #a458c8;
  --Ground: #d0a44c;
  --Rock: #b8a262;
  --Bug: #9fc12c;
  --Ghost: #7a5fa8;
  --Steel: #8fa3b4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1440px; margin: 0 auto; padding: 20px 24px 64px; }

/* ---------- top bar ---------- */

.topbar {
  padding: 14px 18px;
  margin-bottom: 24px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
}

.topbar .row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar .row + .row { margin-top: 12px; }

.brand { display: flex; align-items: center; padding-right: 4px; }
.brand img { height: 38px; width: auto; display: block; }

.typebar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.tfilter {
  border: 0; background: none; padding: 0;
  border-radius: 6px;
  cursor: pointer;
  line-height: 0;
  opacity: .42;
  outline: 1px solid transparent;
  outline-offset: 2px;
  transition: opacity .12s, outline-color .12s;
}
.tfilter img { height: 22px; width: auto; display: block; border-radius: 5px; }
.tfilter:hover { opacity: .8; }
.tfilter.on { opacity: 1; outline-color: currentColor; }

.tfilter.all {
  line-height: 22px; height: 22px;
  font-size: 11px; letter-spacing: .1em; font-weight: 600;
  color: var(--muted); padding: 0 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  opacity: 1;
}
.tfilter.all.on { color: var(--text); background: #ffffff14; }

.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0 16px;
  height: 40px;
  min-width: 240px;
}
.search input {
  background: none; border: 0; outline: 0;
  color: var(--text); font: inherit; width: 100%;
}
.search input::placeholder { color: var(--muted-2); }
.search svg { flex: none; color: var(--muted); }

/* ---------- list page ---------- */

.meta {
  display: flex; align-items: baseline; gap: 12px;
  color: var(--muted); font-size: 13px;
  margin: 0 4px 14px;
}
.meta strong { color: var(--text); font-weight: 600; }

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

/* --card-edge is a gradient built from the mon's types, so a dual-type box gets a
   two-colour edge. Painting it on the border-box layer keeps the rounded corners;
   --inner is what fills the middle, so :hover can recolour without wiping the edge. */
.card, .stage {
  --inner: var(--panel);
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--inner), var(--inner)) padding-box,
    var(--card-edge, linear-gradient(var(--line), var(--line))) border-box;
}

.card {
  border-radius: var(--radius);
  padding: 14px 10px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: transform .12s ease;
}
.card:hover { transform: translateY(-3px); --inner: var(--panel-2); }
.card .sprite { height: 84px; display: grid; place-items: center; }
.card .sprite img {
  max-height: 84px; max-width: 100%;
  image-rendering: pixelated;
  filter: drop-shadow(0 3px 6px #0009);
}
.card .name { font-size: 13px; font-weight: 550; text-align: center; line-height: 1.25; }

.badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; line-height: 0; }
.badges img { height: 18px; width: auto; border-radius: 4px; display: block; }

.empty { color: var(--muted); text-align: center; padding: 80px 0; }

/* ---------- family page ---------- */

.back {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 12px; color: var(--muted);
  margin-bottom: 22px;
}
.back:hover { color: var(--text); border-color: var(--line); }

.chain {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}

.stage {
  flex: 1 1 200px;
  min-width: 180px;
  border-radius: var(--radius);
  padding: 18px 14px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer;
  font: inherit;
  color: var(--text);   /* buttons do not inherit page colour - without this the names go black */
}
.stage:hover { --inner: var(--panel-2); }
.stage.active { --inner: var(--panel-2); box-shadow: 0 0 22px -8px var(--card-color); }
/* Direct child only - the type badges inside .badges must keep their own size.
   112px is the native canvas height of every icon, which keeps the pixels crisp. */
.stage > img { height: 112px; width: auto; image-rendering: pixelated; filter: drop-shadow(0 4px 8px #000a); }
.stage .badges img { height: 20px; }
.stage .name { font-weight: 600; font-size: 15px; }
.stage .tier { font-size: 10px; letter-spacing: .12em; color: var(--muted-2); }

.arrow {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 12px; flex: none; padding: 0 2px;
}
.arrow .lvl { white-space: nowrap; }
.arrow .lvl.blank { color: var(--muted-2); }
.arrow .glyph { font-size: 17px; line-height: 1; color: var(--muted-2); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.panel > h2 {
  margin: 0 0 16px;
  font-size: 11.5px; letter-spacing: .18em; font-weight: 600;
  color: var(--muted);
}

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

/* stats */

.stat { display: grid; grid-template-columns: 74px 34px 1fr; align-items: center; gap: 12px; margin-bottom: 9px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.stat .bar { height: 9px; background: #ffffff0f; border-radius: 999px; overflow: hidden; }
.stat .bar span { display: block; height: 100%; border-radius: 999px; background: var(--card-color, var(--muted)); }

.total {
  display: grid; grid-template-columns: 74px 34px 1fr; gap: 12px;
  border-top: 1px solid var(--line-soft); margin-top: 14px; padding-top: 12px;
}
.total .label { color: var(--muted); font-size: 13px; }
.total .val { font-weight: 700; text-align: right; }

/* abilities */

.ability {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 9px;
}
.ability .dot {
  width: 10px; height: 10px; flex: none;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--card-color, #888);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--card-color, #888) 18%, transparent);
}
.ability .body { flex: 1; min-width: 0; }
.ability .an { font-weight: 600; font-size: 14.5px; }
.ability .ad { color: var(--muted); font-size: 13px; margin-top: 2px; }
.ability .ad.slot { color: var(--muted-2); font-style: italic; }
.ability .tag {
  font-size: 9.5px; letter-spacing: .12em; font-weight: 600;
  color: var(--muted-2); white-space: nowrap; padding-top: 3px;
}
.ability .tag.hidden { color: color-mix(in srgb, var(--card-color, #888) 65%, white); }

/* moves */

.movehead {
  display: flex; align-items: center; gap: 10px;
  margin: 26px 0 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.movehead:first-of-type { margin-top: 0; }
.movehead img { height: 22px; width: auto; border-radius: 5px; display: block; }
.movehead .n { color: var(--muted-2); font-size: 12px; }

.tablescroll { overflow-x: auto; }

table.moves { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 780px; }
table.moves th {
  text-align: left; font-weight: 500; font-size: 10.5px; letter-spacing: .12em;
  color: var(--muted-2); padding: 0 10px 8px; white-space: nowrap;
}
table.moves td { padding: 9px 10px; border-top: 1px solid var(--line-soft); vertical-align: top; }
table.moves tbody tr:hover { background: #ffffff06; }
table.moves .mv { font-weight: 550; white-space: nowrap; }
table.moves .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.moves .add { color: var(--muted); white-space: pre-line; min-width: 190px; }
table.moves .dash { color: var(--muted-2); }

.pill {
  display: inline-block; padding: 2px 7px; border-radius: 6px;
  font-size: 10.5px; letter-spacing: .06em; font-weight: 600;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill.P { color: #e8a06a; border-color: #e8a06a44; background: #e8a06a12; }
.pill.S { color: #7fb6f0; border-color: #7fb6f044; background: #7fb6f012; }
.pill.BA { color: #b39ae8; border-color: #b39ae844; background: #b39ae812; }

.contact { font-size: 15px; font-weight: 700; line-height: 1; }
.contact.yes { color: #4fc46a; }
.contact.no  { color: #e2554a; }

/* ================================================================
   Signed-in app: login gate, navigation, forms, admin editors
   ================================================================ */

.wrap.wide { max-width: 1680px; }

/* ---------- login gate ---------- */

body.centered { display: grid; place-items: center; min-height: 100vh; padding: 24px; }

.gate {
  width: 100%; max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 32px 28px;
}
.gatelogo { width: 100%; max-width: 260px; display: block; margin: 0 auto 26px; }

.switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 4px; margin-bottom: 22px;
}
.switch button {
  border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 13.5px; padding: 7px; border-radius: 7px; cursor: pointer;
}
.switch button.on { background: #ffffff12; color: var(--text); font-weight: 600; }

.formerror {
  background: #e2554a1a; border: 1px solid #e2554a44; color: #f0a19a;
  border-radius: 9px; padding: 9px 12px; font-size: 13.5px; margin: 0 0 14px;
}

/* ---------- forms ---------- */

/* display:block on .field would otherwise beat the [hidden] attribute. */
[hidden] { display: none !important; }

.field { display: block; margin-bottom: 14px; }
.field > span, .fieldlabel {
  display: block; font-size: 10.5px; letter-spacing: .12em; font-weight: 600;
  color: var(--muted); margin-bottom: 5px;
}
.field.row { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 10px; }
.field.row > span { margin: 0; }
.field.wide2 { grid-column: span 2; }

input[type=text], input[type=password], input[type=number], input[type=search],
input:not([type]), select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit; font-size: 14px;
  padding: 9px 11px;
  outline: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--muted); }
textarea { resize: vertical; line-height: 1.55; }
input[type=file] { padding: 7px; font-size: 12.5px; color: var(--muted); }
select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right 14px center, right 9px center;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
  padding-right: 30px; }

/* Not tied to <button>: file pickers are <label>s wrapping a hidden input, and
   they should look like the buttons beside them. */
.primary, .ghost {
  display: inline-block;
  font: inherit; font-size: 13.5px; font-weight: 550;
  border-radius: 9px; padding: 9px 16px; cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text);
}
.primary { width: 100%; background: #ffffff16; border-color: #ffffff24; font-weight: 600; }
.primary:hover { background: #ffffff22; }
.ghost { color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--muted-2); }
.ghost.tiny { padding: 5px 10px; font-size: 12px; }
.danger:hover { color: #f0a19a; border-color: #e2554a66; }
button:disabled { opacity: .5; cursor: default; }

.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { width: auto; accent-color: #7fb6f0; }

/* ---------- header nav ---------- */

.mainnav { display: flex; gap: 4px; background: var(--panel-2);
  border: 1px solid var(--line-soft); border-radius: 999px; padding: 4px; }
.navtab {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 13.5px;
  padding: 7px 18px; border-radius: 999px; cursor: pointer;
}
.navtab:hover { color: var(--text); }
.navtab.on { background: #ffffff14; color: var(--text); font-weight: 600; }

.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.role {
  font-size: 9.5px; letter-spacing: .1em; font-weight: 700; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; border: 1px solid var(--line);
  color: var(--muted);
}
.role.admin { color: #f0a86a; border-color: #f0a86a55; background: #f0a86a12; }

.controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.controls .search { margin-left: 0; max-width: 420px; }

/* ---------- undiscovered ---------- */

.card.shadow { opacity: .8; }
.card.shadow .sprite img { filter: brightness(0) saturate(0); opacity: .5; }
.card.shadow .name { color: var(--muted-2); letter-spacing: .2em; }
.unknown { font-size: 10px; letter-spacing: .1em; color: var(--muted-2);
  border: 1px dashed var(--line); border-radius: 5px; padding: 2px 8px; }

.stage.shadow { cursor: default; }
.stage.shadow img { filter: brightness(0) saturate(0); opacity: .45; }
.stage.shadow .name { color: var(--muted-2); letter-spacing: .2em; }

/* ---------- team ---------- */

.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }

.slot { border-radius: var(--radius); padding: 14px 16px 16px; }
.slot.blank { --card-edge: repeating-linear-gradient(115deg, var(--line) 0 8px, transparent 8px 16px); }

.slothead { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.slotno {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: #ffffff10; color: var(--muted);
  font-size: 12px; font-weight: 700;
}
.slothead select { flex: 1; }
.slotempty { color: var(--muted-2); font-size: 13.5px; margin: 6px 0 0; font-style: italic; }

.slotbody { display: flex; gap: 14px; align-items: flex-start; }
.slotmon { flex: none; width: 96px; text-align: center; }
.slotmon img { width: 96px; image-rendering: pixelated; filter: drop-shadow(0 3px 6px #0009); }
.slotmon .badges { margin-top: 4px; }
.slotmon .badges img { height: 15px; }
.slotfields { flex: 1; min-width: 0; }
.slotfields .field { margin-bottom: 8px; }

.moveslots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.moveslots .fieldlabel { grid-column: span 2; margin-bottom: 0; }

/* ---------- bag / items ---------- */

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

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

.itemcard {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 12px;
}
.itemart {
  width: 56px; height: 56px; flex: none; border-radius: 10px;
  background: #ffffff08; border: 1px solid var(--line-soft);
  display: grid; place-items: center; overflow: hidden;
}
.itemart img { width: 100%; height: 100%; object-fit: contain; }
.itemart .noart { font-size: 20px; font-weight: 700; color: var(--muted-2); }
.itembody { flex: 1; min-width: 0; }
.itembody p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.itemtop { display: flex; align-items: baseline; gap: 8px; }
.qty { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.teaches { color: var(--muted) !important; }
.teaches b { color: var(--text); }
.itemcard.editable .itembody input { margin-bottom: 6px; font-size: 13.5px; padding: 6px 9px; }

/* ---------- admin: dex rows ---------- */

.bulkbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.bulkbar .grow { flex: 1; }
.counter { font-size: 13px; color: var(--muted); }

.dexrows { display: flex; flex-direction: column; gap: 6px; }

.dexrow {
  --inner: var(--panel);
  display: grid;
  grid-template-columns: 52px minmax(180px, 1.4fr) minmax(280px, 2fr) 130px 78px;
  align-items: center; gap: 14px;
  border: 1.5px solid transparent;
  background: linear-gradient(var(--inner), var(--inner)) padding-box,
              var(--card-edge) border-box;
  border-radius: 11px; padding: 8px 14px 8px 8px;
  opacity: .62;
}
.dexrow.seen { opacity: 1; }
.dexrow:hover { --inner: var(--panel-2); }
.dexrow .thumb { width: 48px; image-rendering: pixelated; justify-self: center; }
.dexname { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dexname .badges { justify-content: flex-start; }
.dexname .badges img { height: 15px; }

.dexstats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; font-variant-numeric: tabular-nums; }
.dexstats span { display: flex; gap: 5px; align-items: baseline; }
.dexstats i { font-style: normal; font-size: 9.5px; letter-spacing: .08em; color: var(--muted-2); }
.dexstats .bst { font-weight: 700; }

.reveal { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.reveal input { width: auto; accent-color: #4fc46a; }
.dexrow.seen .reveal span { color: #6ecb84; }

/* ---------- admin: editor ---------- */

.editor { --inner: var(--panel); border: 1.5px solid transparent;
  background: linear-gradient(var(--inner), var(--inner)) padding-box,
              var(--card-edge) border-box; }
.editor h3 {
  font-size: 10.5px; letter-spacing: .16em; color: var(--muted);
  margin: 22px 0 10px; font-weight: 600;
}
.editgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.statgrid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; }
.statgrid output {
  display: block; font-size: 20px; font-weight: 700; padding-top: 4px;
  font-variant-numeric: tabular-nums;
}
.typepick { display: flex; flex-wrap: wrap; gap: 6px; }

.abilityedit { display: flex; flex-direction: column; gap: 8px; }
.abilityrow { display: grid; grid-template-columns: 200px 1fr 100px 36px; gap: 8px; align-items: center; }

.movepick {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 5px;
  max-height: 320px; overflow-y: auto;
  border: 1px solid var(--line-soft); border-radius: 11px; padding: 10px;
  background: #00000030;
}
.movechip {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 9px; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--line-soft); font-size: 13px;
}
.movechip:hover { background: #ffffff08; }
.movechip.on { background: color-mix(in srgb, var(--c) 14%, transparent);
  border-color: color-mix(in srgb, var(--c) 40%, transparent); }
.movechip input { width: auto; accent-color: var(--c); flex: none; }
.movechip b { font-weight: 550; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.movechip i { font-style: normal; font-size: 10px; color: var(--muted-2); }

.editactions { display: flex; gap: 10px; margin-top: 22px; }
.editactions .primary { width: auto; }

/* ---------- admin: moves ---------- */

.moveform { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0 12px; }
.moveform .field { margin-bottom: 10px; }

.moverow {
  border: 1px solid var(--line-soft); border-left: 3px solid var(--c);
  border-radius: 11px; padding: 12px 14px 4px; margin-bottom: 8px;
  background: var(--panel);
}
.rowactions { display: flex; gap: 8px; padding-bottom: 10px; }

/* ---------- admin: items + players ---------- */

.itemform { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.itemart.preview { width: 56px; height: 56px; }

.joinrow { display: flex; gap: 10px; align-items: center; }
.joinrow input { max-width: 220px; font-size: 18px; letter-spacing: .18em; font-weight: 700; text-align: center; }

.panel.player h2 .sub { font-size: 11px; letter-spacing: 0; color: var(--muted-2); font-weight: 400; margin-left: 8px; }
.panel.player h3 { font-size: 10.5px; letter-spacing: .16em; color: var(--muted); margin: 20px 0 10px; font-weight: 600; }

.trackerteam { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.tslot {
  --inner: var(--panel-2); border: 1.5px solid transparent;
  background: linear-gradient(var(--inner), var(--inner)) padding-box, var(--card-edge) border-box;
  border-radius: 11px; padding: 11px 13px; font-size: 13px;
}
.tslot.empty { display: flex; align-items: center; gap: 10px; --card-edge: linear-gradient(var(--line-soft), var(--line-soft)); }
.tshead { display: flex; gap: 10px; align-items: center; }
.tshead img { width: 46px; image-rendering: pixelated; }
.tshead b { display: block; }
.tshead .muted { font-size: 11.5px; }
.tshead .badges { justify-content: flex-start; margin-top: 3px; }
.tshead .badges img { height: 14px; }
.muted { color: var(--muted-2); }

.tsmeta { display: grid; grid-template-columns: 58px 1fr; gap: 2px 8px; margin: 10px 0 8px; font-size: 12.5px; }
.tsmeta dt { color: var(--muted-2); font-size: 10px; letter-spacing: .08em; padding-top: 2px; }
.tsmeta dd { margin: 0; }
.tsmoves { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.tsmoves li {
  font-size: 12px; padding: 3px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--c, var(--line)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--c, var(--line)) 30%, transparent);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tsmoves li.muted { background: none; border: 1px dashed var(--line-soft); }

.trackerbag { display: flex; flex-direction: column; gap: 5px; }
.bagrow { display: flex; align-items: center; gap: 10px; font-size: 13.5px;
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 9px; padding: 7px 12px; }
.bagrow .qty { margin-left: auto; }
.cat { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px;
  border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }
.cat.held { color: #7fb6f0; border-color: #7fb6f044; }
.cat.tm { color: #b39ae8; border-color: #b39ae844; }
.cat.usable { color: #6ecb84; border-color: #6ecb8444; }

.ownedlist { display: flex; flex-wrap: wrap; gap: 6px; }
.ownedchip {
  --inner: var(--panel-2); display: inline-flex; align-items: center; gap: 6px;
  border: 1.5px solid transparent;
  background: linear-gradient(var(--inner), var(--inner)) padding-box, var(--card-edge) border-box;
  border-radius: 999px; padding: 3px 6px 3px 3px; font-size: 12.5px;
}
.ownedchip img { width: 26px; image-rendering: pixelated; }
.ownedchip .x { border: 0; background: none; color: var(--muted-2); cursor: pointer; padding: 0 4px; font-size: 11px; }
.ownedchip .x:hover { color: #f0a19a; }

.giverow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.giverow select { max-width: 260px; }
.giveqty { max-width: 70px; }

/* ---------- toasts ---------- */

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 3px solid #6ecb84;
  border-radius: 9px; padding: 10px 16px; font-size: 13.5px;
  box-shadow: 0 8px 24px #000a;
  transition: opacity .3s, transform .3s;
}
.toast.bad { border-left-color: #e2554a; }
.toast.out { opacity: 0; transform: translateY(6px); }

.dexnote { margin: 0; color: var(--muted); white-space: pre-line; }

@media (max-width: 1100px) {
  .dexrow { grid-template-columns: 46px 1fr 120px 70px; }
  .dexstats { display: none; }
  .statgrid { grid-template-columns: repeat(4, 1fr); }
  .abilityrow { grid-template-columns: 1fr; padding-bottom: 10px; border-bottom: 1px solid var(--line-soft); }
  .abilityrow .remove { justify-self: start; }
}

/* ================================================================
   Game board
   ================================================================ */

.boardpage .wrap { padding-bottom: 24px; }

.boardlayout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .boardlayout { grid-template-columns: 1fr; } }

.boardside { display: flex; flex-direction: column; gap: 12px; max-height: 80vh; overflow-y: auto; padding-right: 4px; }

.sidebox {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px 16px;
}
.sidebox h3 {
  font-size: 10.5px; letter-spacing: .16em; color: var(--muted);
  margin: 0 0 12px; font-weight: 600;
}
.sidebox h3.sep { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.sidebox .field { margin-bottom: 10px; }
.sidebox .primary { margin-top: 10px; }
.hint { color: var(--muted-2); font-size: 12px; margin: 8px 0 0; line-height: 1.5; }

.filebtn { display: inline-block; cursor: pointer; }
.filename { display: block; margin-top: 6px; }
.gridsize { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.avatarrow { display: flex; align-items: center; gap: 12px; }
.avatarart {
  width: 54px; height: 54px; flex: none; border-radius: 50%; overflow: hidden;
  background: #ffffff08; border: 1px solid var(--line); display: grid; place-items: center;
}
.avatarart img { width: 100%; height: 100%; object-fit: cover; }
.avatarart .noart { font-size: 20px; font-weight: 700; color: var(--muted-2); }

.maprow {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center;
  padding: 8px; border-radius: 10px; border: 1px solid var(--line-soft);
  background: var(--panel-2); margin-bottom: 6px;
}
.maprow.active { border-color: #6ecb8466; background: #6ecb840d; }
.maprow img { width: 44px; height: 34px; object-fit: cover; border-radius: 6px; }
.maprowbody { min-width: 0; font-size: 13px; }
.maprowbody b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maprowbody .muted { font-size: 11px; }
.maprowactions { display: flex; gap: 4px; }

.seerow { display: flex; padding: 5px 0; }

.tokenrow {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
  padding: 6px 8px; border-radius: 8px; background: var(--panel-2);
  border: 1px solid var(--line-soft); margin-bottom: 5px;
}
.tokenrow .muted { margin-left: auto; font-size: 11.5px; }
.tokenrow .del { margin-left: 4px; }
.swatch { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.swatch.trainer { background: #7fb6f0; }
.swatch.pokemon { background: #6ecb84; }

/* ---------- bar ---------- */

.boardbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 8px 12px; margin-bottom: 12px;
}
.maptabs { display: flex; gap: 4px; flex-wrap: wrap; }
.maptab {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 8px; cursor: pointer;
}
.maptab.on { background: #ffffff16; color: var(--text); font-weight: 600; border-color: #ffffff24; }

.tools { display: flex; gap: 4px; align-items: center; }
.tools.right { margin-left: auto; }
.tool {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1;
}
.tool:hover { color: var(--text); }
.tool.on { background: #f2c33d1f; border-color: #f2c33d66; color: #f2c33d; }
.zoomlabel { font-size: 12px; color: var(--muted); min-width: 42px; text-align: center; font-variant-numeric: tabular-nums; }

.livedot { font-size: 11px; color: #6ecb84; display: flex; align-items: center; gap: 5px; }
.livedot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #6ecb84; }
.livedot.off { color: #e8a06a; }
.livedot.off::before { background: #e8a06a; }

/* ---------- the map ---------- */

.stagewrap {
  background: #08080a; border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: auto; max-height: 78vh; padding: 12px;
}
.boardstage { min-height: 200px; }

.mapboard { position: relative; margin: 0 auto; user-select: none; touch-action: none; }
.mapimg { display: block; width: 100%; height: auto; }

.mapboard canvas, .gridlines, .tokens, .rulerlayer, .pings {
  position: absolute; inset: 0; width: 100%; height: 100%;
}
.fog { image-rendering: pixelated; pointer-events: none; }
.ink { pointer-events: none; }
.rulerlayer, .pings { pointer-events: none; }

.gridlines {
  pointer-events: none;
  background-image:
    linear-gradient(to right, #ffffff1c 1px, transparent 1px),
    linear-gradient(to bottom, #ffffff1c 1px, transparent 1px);
}

/* ---------- tokens ---------- */

.token { position: absolute; display: grid; place-items: center; cursor: default; }
.token.mine { cursor: grab; }
.token.dragging { cursor: grabbing; z-index: 20; }
.token.dragging .tokeninner { transform: scale(1.12); }

.tokeninner {
  width: 86%; height: 86%; border-radius: 50%; overflow: hidden;
  background: #14141a; display: grid; place-items: center;
  box-shadow: 0 2px 6px #000c;
  transition: transform .08s;
}
.token.trainer .tokeninner { border: 2px solid #7fb6f0; }
.token.pokemon .tokeninner { border: 2px solid #6ecb84; }
.token.mine .tokeninner { box-shadow: 0 0 0 2px #f2c33d88, 0 2px 6px #000c; }
.tokeninner img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.tokeninner .initial { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }

.tokenname {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  font-size: 9px; white-space: nowrap; color: #fff;
  background: #000000b0; padding: 1px 5px; border-radius: 4px;
  pointer-events: none; opacity: 0; transition: opacity .12s;
}
.token:hover .tokenname, .token.dragging .tokenname { opacity: 1; }

.rulertag {
  position: absolute; transform: translate(10px, -50%);
  background: #f2c33d; color: #1a1400; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 5px; white-space: nowrap; pointer-events: none;
}

.ping {
  position: absolute; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border: 3px solid #f0762b; border-radius: 50%;
  animation: pingout 2.2s ease-out forwards;
}
@keyframes pingout {
  0%   { transform: scale(.2); opacity: 1; }
  70%  { transform: scale(1.6); opacity: .5; }
  100% { transform: scale(2); opacity: 0; }
}

/* ---------- per-Pokémon level ---------- */

.levelrow { display: flex; align-items: center; gap: 10px; }
.levelrow .level { width: 74px; flex: none; }
.hpcalc { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hpcalc i { font-style: normal; color: var(--muted-2); }

.ownedchip .lvl {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); white-space: nowrap;
}
.ownedchip .lvl input {
  width: 46px; padding: 2px 5px; font-size: 12px; text-align: center;
  background: #00000040; border-radius: 5px;
}

/* ---------- fight panel ---------- */

.fightpanel {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px 16px; margin-top: 14px;
}
.fightpanel h3 {
  font-size: 10.5px; letter-spacing: .16em; color: var(--muted);
  margin: 0; font-weight: 600;
}
.fighthead { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.fighthead .grow { flex: 1; }
.fightpanel.empty .hint { margin: 8px 0 12px; }

.fightsides { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) { .fightsides { grid-template-columns: 1fr; } }

.fightside { border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px; }
.fightside.opponents { border-color: #e2554a33; }
.sidehead { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.sidehead .count { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }

.fightcards { display: flex; flex-direction: column; gap: 8px; }

.fightcard {
  --inner: var(--panel-2);
  display: flex; gap: 10px; align-items: flex-start;
  border: 1.5px solid transparent;
  background: linear-gradient(var(--inner), var(--inner)) padding-box,
              var(--card-edge, linear-gradient(var(--line), var(--line))) border-box;
  border-radius: 11px; padding: 10px;
}
.fightcard.pending { opacity: .75; border-style: dashed; }

.fcart {
  width: 52px; height: 52px; flex: none; border-radius: 9px; overflow: hidden;
  background: #00000040; display: grid; place-items: center;
}
.fcart img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }

.fcbody { flex: 1; min-width: 0; }
.fctop { display: flex; align-items: baseline; gap: 8px; }
.fctop b { font-size: 14px; }
.fctop .lv { font-size: 11px; color: var(--muted-2); }
.fctrainer { font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }

.hpbar { height: 7px; border-radius: 999px; background: #ffffff10; overflow: hidden; margin-bottom: 6px; }
.hpbar span { display: block; height: 100%; border-radius: 999px; transition: width .18s; }
.hpbar.ok  span { background: #4fc46a; }
.hpbar.mid span { background: #f2c33d; }
.hpbar.low span { background: #e2554a; }

.hprow { display: flex; align-items: center; gap: 5px; }
.hprow .hpnow {
  width: 62px; padding: 4px 6px; font-size: 13px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.hprow .hpmax { font-size: 12px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.hprow button { padding: 3px 9px; }

.fcactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; align-items: center; }
.pendingtag { font-size: 10.5px; color: #e8a06a; }

.fightadd { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.fightadd select { flex: 1; min-width: 130px; font-size: 13px; padding: 6px 9px; }
.fightadd input[type=number] { width: 64px; padding: 6px; font-size: 13px; }

/* ---------- admin: map editor ---------- */

.mappreview {
  width: 100%; max-width: 220px; aspect-ratio: 3/2; border-radius: 9px; overflow: hidden;
  background: #ffffff08; border: 1px solid var(--line-soft); display: grid; place-items: center;
}
.mappreview img { width: 100%; height: 100%; object-fit: cover; }
.mappreview .noart { font-size: 20px; color: var(--muted-2); }

.maprow.big {
  grid-template-columns: 120px 1fr auto;
  padding: 12px; margin-bottom: 10px; align-items: start;
}
.maprow.big img { width: 120px; height: 84px; }
.maprow.big .maprowbody { font-size: 14px; }
.maprow.big .mname { margin-bottom: 8px; }
.maprow.big .maprowactions { flex-direction: column; }

.gridfields { display: flex; gap: 10px; margin-bottom: 10px; }
.gridfields label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.gridfields input { width: 74px; padding: 5px 8px; font-size: 13px; }

.seelist { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seelist .hint { margin: 0; }

/* the player's own side, in the board sidebar */
.sidebox .fightcards { gap: 8px; }
.sidebox .fightcard { padding: 9px; }
.sidebox .fcart { width: 42px; height: 42px; }
.sidebox .fightadd { margin-top: 10px; }
