/* =====================================================================
   Pokémon League · V3.0
   Um único sistema visual. Nada de camadas de versão por cima.
   ===================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #0f1014;
  --panel: #16171c;
  --raised: #1d1f26;
  --hover: #22242c;
  --line: #24262e;
  --line-2: #32353f;
  --text: #eceef2;
  --muted: #8d91a0;
  --faint: #5f6372;
  --volt: #f2c94c;        /* acento único: líder, ativo, ação principal */
  --volt-text: #f2c94c;
  --volt-ink: #1b1605;
  --volt-soft: rgba(242, 201, 76, .12);
  --good: #4cc38a;
  --bad: #f0616d;
  --bad-soft: rgba(240, 97, 109, .12);
  --mon-bg: radial-gradient(circle at 50% 62%, rgba(255,255,255,.07), rgba(255,255,255,0) 68%);
  --shadow-pop: 0 24px 60px rgba(0,0,0,.5);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --raised: #f7f8fa;
  --hover: #eef0f3;
  --line: #e4e6eb;
  --line-2: #d2d5dc;
  --text: #15171c;
  --muted: #5f6472;
  --faint: #9a9fac;
  --volt: #f2c94c;
  --volt-text: #8a6300;
  --volt-ink: #1b1605;
  --volt-soft: rgba(242, 201, 76, .22);
  --good: #16935a;
  --bad: #cf3442;
  --bad-soft: rgba(207, 52, 66, .08);
  --mon-bg: radial-gradient(circle at 50% 62%, rgba(20,23,28,.06), rgba(20,23,28,0) 68%);
  --shadow-pop: 0 24px 60px rgba(20,23,28,.18);
  color-scheme: light;
}

:root {
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 7px;
  --sidebar-w: 236px;
  --gutter: clamp(16px, 3vw, 40px);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font: 400 14px/1.5 var(--font);
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
img { display: block; }
svg { width: 18px; height: 18px; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
code { font-size: .92em; padding: 1px 5px; border-radius: 5px; background: var(--raised); border: 1px solid var(--line); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.015em; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--volt); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }

/* ---------- Estrutura ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px 14px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 50%; flex: none; position: relative;
  background: linear-gradient(var(--text) 0 46%, var(--bg) 46% 54%, var(--text) 54%);
  box-shadow: inset 0 0 0 2px var(--text);
  opacity: .92;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 50% auto auto 50%; width: 9px; height: 9px; border-radius: 50%;
  transform: translate(-50%, -50%); background: var(--bg); box-shadow: 0 0 0 2px var(--text);
}
.brand-text { display: grid; line-height: 1.25; }
.brand-text strong { font-size: 14px; font-weight: 600; }
.brand-text small { color: var(--muted); font-size: 12px; }

.nav { display: grid; gap: 1px; }
.nav-group { margin: 14px 10px 6px; font-size: 12px; color: var(--faint); font-weight: 500; }
.nav-group:first-child { margin-top: 0; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 500; text-align: left;
  transition: background .12s, color .12s;
}
.nav-item svg { width: 17px; height: 17px; opacity: .85; }
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.nav-item.active svg { color: var(--volt-text); opacity: 1; }

.sidebar-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 16px; }
.mode {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel);
  transition: border-color .15s;
}
.mode:hover { border-color: var(--line-2); }
.mode strong { display: block; font-size: 13px; font-weight: 600; }
.mode small { display: block; font-size: 12px; color: var(--muted); }
.lock { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; margin: 0 3px; }
body.organizer .mode { border-color: rgba(242, 201, 76, .45); background: var(--volt-soft); }
body.organizer .lock { background: var(--volt); box-shadow: 0 0 0 3px var(--volt-soft); }

.main { min-width: 0; padding: 0 var(--gutter) 80px; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; gap: 14px;
  min-height: 76px; padding: 18px 0 14px; margin-bottom: 8px;
  background: linear-gradient(var(--bg) 78%, transparent);
}
.title { min-width: 0; flex: 1; }
.title h1 { font-size: clamp(22px, 2.4vw, 28px); line-height: 1.15; letter-spacing: -.025em; }
.title p { color: var(--muted); margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.save-indicator { color: var(--faint); font-size: 12.5px; transition: color .2s; }
.save-indicator.pulse { color: var(--good); }
.icon-btn.menu-btn { display: none; }
.scrim { display: none; }
.view { max-width: 1680px; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--raised);
  font-weight: 500; font-size: 13.5px; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); border-color: var(--faint); }
.btn.primary { background: var(--volt); border-color: var(--volt); color: var(--volt-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; flex: none;
  border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--muted);
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.icon-btn.danger:hover { color: var(--bad); background: var(--bad-soft); }
#themeToggle .moon { display: none; }
#themeToggle[data-mode="light"] .sun { display: none; }
#themeToggle[data-mode="light"] .moon { display: block; }
.back { color: var(--muted); font-weight: 500; margin-bottom: 18px; }
.back:hover { color: var(--text); }

/* ---------- Seções ---------- */
.section { margin-top: 44px; }
.section.first, .lede + .section { margin-top: 8px; }
.lede { color: var(--muted); max-width: 70ch; margin-bottom: 26px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.sec-head h2 { font-size: 17px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sec-head p { color: var(--muted); margin-top: 3px; max-width: 75ch; }
.sec-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 36px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-title { font-size: 13.5px; font-weight: 600; margin-bottom: 10px; }

.empty {
  border: 1px dashed var(--line-2); border-radius: var(--r-lg);
  padding: 28px 20px; text-align: center; color: var(--muted);
}
.empty strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 3px; }
.empty p { max-width: 52ch; margin: 0 auto; }
.card-grid > .empty, .mon-grid > .empty { grid-column: 1 / -1; }

.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap;
}
.tag.on { color: var(--text); border-color: var(--line-2); background: var(--raised); }
.tag.pass2 { color: var(--volt-text); border-color: rgba(242, 201, 76, .4); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.count { color: var(--muted); font-size: 13px; white-space: nowrap; }

/* ---------- Tipos ---------- */
.types { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.type {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; color: var(--muted);
  line-height: 1;
}
.type::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--t); }
.type + .type::before { margin-left: 4px; }

/* ---------- Avatares e sprites ---------- */
.avatar {
  --size: 32px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: none; overflow: hidden;
  display: inline-grid; place-items: center;
  background: color-mix(in srgb, var(--c) 30%, var(--raised));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent);
  color: var(--text); font-size: calc(var(--size) * .36); font-weight: 600; letter-spacing: .02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { --size: 24px; }
.avatar.md { --size: 40px; }
.avatar.lg { --size: 64px; }
.avatar.xl { --size: 96px; }

.mon {
  --size: 44px;
  width: var(--size); height: var(--size); flex: none; display: inline-grid; place-items: center;
  border-radius: 50%; background: var(--mon-bg);
}
.mon img { width: 116%; height: 116%; object-fit: contain; }
.mon.xs { --size: 26px; }
.mon.sm { --size: 34px; }
.mon.lg { --size: 72px; }
.mon.empty { background: none; box-shadow: inset 0 0 0 1px var(--line); transform: scale(.62); }
.team-strip { display: flex; align-items: center; gap: 2px; min-width: 0; }
.pokemon-sprite[data-remote="unavailable"] { opacity: .4; }

/* ---------- Início ---------- */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 4px 0 40px; border-top: 1px solid var(--line); }
.facts > div { padding: 16px 16px 0 0; }
.facts > div + div { padding-left: 16px; border-left: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 12.5px; }
.facts dd { margin: 4px 0 0; font-size: 26px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; overflow-wrap: anywhere; }
.facts dd small { font-size: 15px; color: var(--faint); font-weight: 500; margin-left: 2px; }
.facts.compact { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin: 12px 0 0; border: 0; gap: 14px 0; }
.facts.compact > div { padding-top: 0; }
.facts.compact > div + div { border-left: 0; padding-left: 0; }
.facts.compact { column-gap: 28px; }
.facts.compact dd { font-size: 16px; letter-spacing: -.01em; }
.facts.compact dd small { display: block; margin: 2px 0 0; font-size: 12px; color: var(--muted); }

/* Quadro da temporada */
.board { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.board-row {
  display: grid; align-items: center; width: 100%; text-align: left;
  grid-template-columns: 40px minmax(150px, 1fr) minmax(0, 300px) repeat(3, 38px) 54px 52px;
  gap: 0 10px; padding: 8px 16px; min-height: 64px;
  border-top: 1px solid var(--line);
  transition: background .12s;
}
.board-row.no-team { grid-template-columns: 40px minmax(150px, 1fr) repeat(3, 38px) 54px 52px; }
button.board-row:hover { background: var(--hover); }
.board-head { min-height: 38px; border-top: 0; color: var(--faint); font-size: 12px; font-weight: 500; background: var(--raised); }
.board .num { text-align: right; color: var(--muted); }
.board .pts { color: var(--text); font-weight: 600; font-size: 16px; }
.board .pos { color: var(--faint); font-weight: 600; font-size: 15px; }
.board-row.in-playoff .pos { color: var(--text); }
.board-row.is-leader { background: linear-gradient(90deg, var(--volt-soft), transparent 55%); }
.board-row.is-leader .pos, .board-row.is-leader .pts { color: var(--volt-text); }
.who { display: flex; align-items: center; gap: 11px; min-width: 0; }
.who-text { display: grid; min-width: 0; line-height: 1.3; }
.who-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .mon { --size: 48px; }
.board .mon.empty { transform: scale(.45); }

/* Partidas */
.matches { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.match {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 16px; border-top: 1px solid var(--line);
}
.match:first-child { border-top: 0; }
.match-meta { display: grid; line-height: 1.3; }
.match-meta strong { font-size: 12.5px; font-weight: 500; }
.match-meta small { color: var(--faint); font-size: 12px; }
.match-side { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--muted); }
.match-side span:not(.avatar) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match-side.right { justify-content: flex-end; text-align: right; }
.match-side.won { color: var(--text); font-weight: 600; }
.score { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; }
.score b { color: var(--muted); min-width: 12px; text-align: center; }
.score b.won { color: var(--text); }
.score i { font-style: normal; color: var(--faint); font-size: 13px; }
.match .icon-btn { width: 28px; height: 28px; }

.highlights { display: grid; gap: 10px; }
.highlight {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 12px 16px 12px 10px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel);
}
button.highlight:hover { background: var(--hover); }
.highlight > span:last-child { display: grid; line-height: 1.35; min-width: 0; }
.highlight small { color: var(--muted); font-size: 12.5px; }
.highlight strong { font-size: 16px; font-weight: 600; }
.highlight em { font-style: normal; color: var(--muted); font-size: 13px; }
.highlight.is-empty { display: block; padding: 16px; }
.highlight.is-empty p { color: var(--faint); margin-top: 2px; }

/* Listas de destaque (KDA / PT) */
.leaders { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.leaders li { display: grid; grid-template-columns: 22px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 4px 0; }
.leaders .pos { color: var(--faint); font-weight: 600; font-size: 13px; }
.leaders li:first-child .pos { color: var(--volt-text); }
.leaders .val { font-weight: 600; font-size: 15px; text-align: right; }
.leaders .val small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }

/* ---------- Treinadores ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; }
.toolbar.wide { justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.select-wrap { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
select, input:not([type="checkbox"]):not([type="color"]):not([type="file"]), textarea {
  height: 34px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea { height: auto; padding: 8px 10px; resize: vertical; width: 100%; }
select:focus, input:focus, textarea:focus { border-color: var(--volt); box-shadow: 0 0 0 3px var(--volt-soft); }
.select-wrap select { height: 28px; font-size: 13px; }

.search { position: relative; display: flex; align-items: center; min-width: min(300px, 100%); }
.search svg { position: absolute; left: 10px; color: var(--faint); width: 16px; height: 16px; }
.search input { width: 100%; padding-left: 32px !important; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.trainer-card {
  position: relative; display: grid; gap: 12px; padding: 14px; cursor: pointer;
  border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel);
  transition: border-color .12s, background .12s;
}
.trainer-card:hover { border-color: var(--line-2); background: color-mix(in srgb, var(--panel) 70%, var(--hover)); }
.trainer-card header { display: flex; align-items: center; gap: 11px; min-width: 0; }
.trainer-card header .who-text { flex: 1; }
.trainer-card header .who-text strong { font-size: 15px; }
.trainer-card .team-strip { justify-content: space-between; padding: 6px 2px; border-block: 1px solid var(--line); }
.trainer-card .mon { --size: 36px; }
.trainer-card footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.money { color: var(--muted); font-size: 13px; white-space: nowrap; }
.card-action { justify-self: start; }
.shiny-number-pill { display: inline-flex; gap: 3px; align-items: center; color: var(--volt-text); font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Perfil */
.profile { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 24px; align-items: start; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.profile-main { min-width: 0; }

.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
/* Equipe: sempre 6 numa linha, 3 + 3 ou 2 + 2 + 2. Nunca 5 + 1 ou 4 + 2. Responde ao espaço real (container query), inclusive com zoom. */
.grid-host { container-type: inline-size; }
.mon-grid.team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mon-grid.box-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 620px) { .mon-grid.team-grid, .mon-grid.box-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (min-width: 1140px) { .mon-grid.team-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } .mon-grid.box-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.mon-card { display: grid; grid-template-rows: auto 1fr; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.mon-art { position: relative; display: grid; place-items: center; height: 150px; background: var(--mon-bg), var(--raised); border-bottom: 1px solid var(--line); }
.mon-art > .pokemon-sprite { width: 136px; height: 136px; object-fit: contain; }
.rank {
  position: absolute; left: 10px; top: 10px; display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px 0 5px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: color-mix(in srgb, var(--panel) 80%, transparent); border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.rank-ball, .mon-art .rank .rank-ball { width: 18px; height: 18px; image-rendering: pixelated; }
.rank-ball.big { width: 30px; height: 30px; }
.mon-body { display: grid; align-content: start; gap: 10px; padding: 12px 14px 14px; }
.mon-body h3 { font-size: 16px; }
.mon-species { color: var(--muted); font-size: 12.5px; margin-top: -6px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.mon-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 0; font-size: 13px; }
.mon-facts div { min-width: 0; }
.mon-facts dt { color: var(--faint); font-size: 11.5px; }
.mon-facts dd { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kda {
  display: grid; grid-template-columns: minmax(0, 1fr) repeat(3, 30px); align-items: center; gap: 2px 4px;
  padding: 8px 10px; border-radius: var(--r-sm); background: var(--raised); font-size: 12.5px; color: var(--muted);
}
.kda i { font-style: normal; text-align: center; color: var(--faint); font-size: 11px; font-weight: 600; }
.kda b { font-weight: 600; color: var(--text); text-align: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.inventory-list { display: grid; }
.inventory-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); }
.inventory-item:first-child { border-top: 0; }
.inv-main { display: grid; min-width: 0; }
.inv-main strong { font-weight: 500; }
.inv-main small { color: var(--muted); font-size: 12.5px; }
.qty { font-weight: 600; color: var(--muted); }
.inventory-item .icon-btn { width: 28px; height: 28px; }

.boxes { display: grid; gap: 12px; }
.box-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.box-head .panel-title { margin: 0; }

/* ---------- Capturas e Pokédex ---------- */
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-md); background: var(--panel); border: 1px solid var(--line); overflow-x: auto; max-width: 100%; }
.segmented button { height: 28px; padding: 0 12px; border-radius: 7px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.segmented button:hover { color: var(--text); }
.segmented button.on { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.area + .area { padding-top: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 8px; }
.mon-tile {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 0;
  padding: 6px 10px 6px 4px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel);
}
.mon-tile .mon { --size: 52px; }
.mon-tile-text { display: grid; gap: 2px; min-width: 0; }
.mon-tile-text strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-tile .gen { position: absolute; right: 8px; top: 6px; color: var(--faint); font-size: 11px; }

/* ---------- Playoffs ---------- */
.bracket { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: center; max-width: 900px; }
.bracket-col { display: grid; gap: 18px; }
.bracket-col.final { position: relative; }
.bracket-col.final::before { content: ""; position: absolute; left: -28px; top: 50%; width: 28px; border-top: 1px solid var(--line-2); }
.game { display: grid; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.game > small { padding: 8px 14px; font-size: 12.5px; color: var(--muted); background: var(--raised); border-bottom: 1px solid var(--line); }
.bracket-col.final .game { border-color: rgba(242, 201, 76, .45); }
.bracket-col.final .game > small { color: var(--volt-text); }
.seed { display: grid; grid-template-columns: 28px auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px; }
.seed + .seed { border-top: 1px solid var(--line); }
.seed .pos { color: var(--faint); font-weight: 600; }
.seed.tbd { grid-template-columns: 28px minmax(0, 1fr); color: var(--faint); }
.bracket-col.final .seed.tbd { grid-template-columns: minmax(0, 1fr); }
.seed.tbd strong { font-weight: 500; color: var(--faint); }

/* ---------- Dados ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 18px; border-top: 1px solid var(--line); }
.setting:first-child { border-top: 0; }
.setting h3 { font-size: 14px; }
.setting p { color: var(--muted); margin-top: 2px; max-width: 70ch; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.file-input { display: none; }
.foot { margin-top: 36px; }
.boot-error { margin: 24px 0; padding: 20px; border: 1px solid var(--bad); border-radius: var(--r-lg); background: var(--bad-soft); }
.boot-error p { color: var(--muted); margin-top: 6px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 90; transform: translate(-50%, 12px);
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: var(--r-md);
  background: var(--text); color: var(--bg); font-weight: 500; box-shadow: var(--shadow-pop);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--bad); color: #fff; }

/* =====================================================================
   Modais e formulários (markup herdado da V2, restilizado)
   ===================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 6, 8, .62); backdrop-filter: blur(3px);
  animation: fade .14s ease-out;
}
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-pop);
  animation: rise .16s ease-out;
}
.modal.pokemon-editor-modal, .modal.sheet-modal { width: min(860px, 100%); }
.modal form { display: flex; flex-direction: column; min-height: 0; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 16px; }
.close-button { width: 30px; height: 30px; border-radius: var(--r-sm); color: var(--muted); font-size: 20px; line-height: 1; }
.close-button:hover { background: var(--hover); color: var(--text); }
.modal-body { padding: 18px; overflow-y: auto; min-height: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field > label, .pokemon-search-field > label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field input, .field select { width: 100%; }
.field input[type="color"] { width: 100%; height: 34px; padding: 3px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--panel); }
.field input[type="file"] { font-size: 13px; color: var(--muted); }
.field-help { color: var(--faint); font-size: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.avatar-edit-preview { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.pokemon-search-field { display: grid; gap: 6px; margin-bottom: 14px; }
.pokemon-search-field input { width: 100%; }
.rank-picker { display: flex; align-items: center; gap: 8px; }
.rank-picker select { flex: 1; }
.rank-picker-preview { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--line); flex: none; }
.modal-body > p.field-help { margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.btn.mini { height: 28px; }

/* Ficha PokéRole (editor) */
.sheet-editor { margin-top: 18px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--raised); }
.sheet-editor > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; cursor: pointer; }
.sheet-editor > summary::-webkit-details-marker { display: none; }
.sheet-editor > summary strong { display: block; font-weight: 600; }
.sheet-editor > summary small { color: var(--muted); font-size: 12.5px; }
.sheet-chevron { color: var(--muted); transition: transform .15s; }
.sheet-editor[open] .sheet-chevron { transform: rotate(180deg); }
.sheet-editor-body { display: grid; gap: 14px; padding: 0 14px 14px; }
.sheet-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12.5px; }
.pokerole-window { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--panel); padding: 12px; }
.pokerole-window-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.sheet-quick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pokerole-main-grid, .pokerole-bottom-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr); gap: 14px; }
.pokerole-attribute-stack, .pokerole-social-stack, .pokerole-info-dots { display: grid; gap: 8px; }
.pokerole-skill-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.pokerole-skill-group { display: grid; gap: 6px; align-content: start; }
.pokerole-skill-group-title { font-size: 12px; color: var(--volt-text); font-weight: 600; }
.pokerole-info-fields { margin-top: 12px; }
.dot-field { grid-template-columns: 84px 1fr; align-items: center; gap: 8px; }
.dot-field > label { font-size: 12.5px; }
.dot-input { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.dot-button { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; }
.dot-button i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--line-2); transition: background .1s, border-color .1s; }
.dot-button:hover i { border-color: var(--muted); }
.dot-button.active i { background: var(--volt); border-color: var(--volt); }
.dot-clear { margin-left: 6px; font-size: 11.5px; color: var(--faint); }
.dot-clear:hover { color: var(--text); }
.move-editor-list { display: grid; gap: 10px; }
.move-editor-row { border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px; }
.move-editor-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-size: 13px; }
.move-remove { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); font-size: 16px; }
.move-remove:hover { background: var(--bad-soft); color: var(--bad); }
.move-editor-grid { display: grid; grid-template-columns: 1.4fr 1fr .7fr 1.2fr .7fr; gap: 8px; }
.move-editor-grid .move-effect { grid-column: 1 / -1; }

/* KDA (modal) */
.kda-modal-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.kda-modal-summary > div { display: grid; padding: 12px; border-radius: var(--r-md); background: var(--raised); border: 1px solid var(--line); }
.kda-modal-summary small { color: var(--muted); font-size: 12px; }
.kda-modal-summary strong { font-size: 20px; font-weight: 600; }
.kda-modal-summary span { color: var(--faint); font-size: 12px; }
.kda-modal-help { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.kda-delta-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kda-correction { margin-top: 14px; }
.kda-correction summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.kda-correction .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* Ficha PokéRole (leitura) */
.pokemon-sheet-view { display: grid; gap: 16px; }
.sheet-hero { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.sheet-hero-sprite { width: 110px; height: 110px; object-fit: contain; background: var(--mon-bg); border-radius: 50%; }
.sheet-kicker { color: var(--muted); font-size: 12.5px; }
.sheet-hero h3 { font-size: 22px; letter-spacing: -.02em; }
.sheet-hero p { color: var(--muted); }
.sheet-basic-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sheet-basic-tags > span { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; }
.sheet-kda-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-kda-bar > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: var(--r-md); background: var(--raised); }
.sheet-kda-bar small { color: var(--muted); font-size: 12px; }
.sheet-kda-bar span { display: flex; gap: 10px; }
.sheet-kda-bar b::before { color: var(--faint); font-weight: 500; margin-right: 3px; }
.sheet-kda-bar .kda-k::before { content: "K"; } .sheet-kda-bar .kda-d::before { content: "D"; } .sheet-kda-bar .kda-a::before { content: "A"; }
.sheet-metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sheet-metric { display: grid; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.sheet-metric small { color: var(--muted); font-size: 11.5px; }
.sheet-metric strong { font-size: 17px; font-weight: 600; }
.sheet-view-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sheet-view-section { border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.sheet-view-section h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; }
.sheet-view-scores, .sheet-info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.sheet-view-scores > div, .sheet-info-list > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; }
.sheet-view-scores span:first-child, .sheet-info-list span:first-child { color: var(--muted); }
.score-dots { display: inline-flex; gap: 3px; }
.score-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--volt); }
.sheet-empty, .sheet-empty-line { color: var(--faint); }
.sheet-move-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-move { padding: 10px; border-radius: var(--r-sm); background: var(--raised); }
.sheet-move > div { display: flex; justify-content: space-between; margin-bottom: 6px; }
.sheet-move > div span { color: var(--muted); font-size: 12.5px; }
.sheet-move dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 12.5px; }
.sheet-move dt { color: var(--faint); }
.sheet-move dd { margin: 0; }
.sheet-notes p { color: var(--muted); margin-top: 4px; }
.sheet-empty-state { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 18px; }
.sheet-empty-sprite { width: 120px; height: 120px; object-fit: contain; }
.sheet-empty-state p { color: var(--muted); max-width: 46ch; }

/* =====================================================================
   Responsivo
   ===================================================================== */
@media (max-width: 1100px) {
  .split { grid-template-columns: 1fr; gap: 44px; }
  .board-row { grid-template-columns: 36px minmax(140px, 1fr) minmax(0, 220px) repeat(3, 32px) 48px 44px; padding: 8px 12px; }
  .board .mon { --size: 38px; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40; width: min(280px, 84vw);
    transform: translateX(-102%); transition: transform .2s ease;
    background: var(--panel); box-shadow: var(--shadow-pop);
  }
  body.menu-open .sidebar { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(5,6,8,.5); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.menu-open .scrim { opacity: 1; pointer-events: auto; }
  .icon-btn.menu-btn { display: inline-grid; }
  .save-indicator { display: none; }
  .topbar { min-height: 64px; padding: 12px 0; }
  .grid-3 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts:not(.compact) > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts:not(.compact) > div:nth-child(n+3) { border-top: 1px solid var(--line); margin-top: 16px; }
  .profile { grid-template-columns: auto minmax(0, 1fr); }
  .profile-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .bracket { grid-template-columns: 1fr; }
  .bracket-col.final::before { display: none; }
}

@media (max-width: 640px) {
  body { font-size: 14px; }
  .top-actions .btn.primary { padding: 0 10px; font-size: 13px; }
  .board-head { display: none; }
  .board-row, .board-row.no-team {
    grid-template-columns: 26px minmax(0, 1fr) 28px 28px 40px;
    grid-template-areas: "pos who w l pts" "pos team team team team";
    gap: 6px 8px; padding: 10px 12px;
  }
  .board-row > .pos { grid-area: pos; align-self: start; padding-top: 6px; }
  .board-row > .who { grid-area: who; }
  .board-row > .col-team { grid-area: team; }
  .board-row > .col-j { display: none; }
  .board-row > .col-sg { display: none; }
  .board-row > .col-w { grid-area: w; }
  .board-row > .col-l { grid-area: l; }
  .board-row > .pts { grid-area: pts; }
  .board-row > .col-w::after { content: "V"; color: var(--faint); font-size: 11px; margin-left: 1px; }
  .board-row > .col-l::after { content: "D"; color: var(--faint); font-size: 11px; margin-left: 1px; }
  .board .mon { --size: 40px; }
  .board .team-strip { justify-content: space-between; max-width: 300px; }
  .match { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); grid-template-areas: "meta meta meta" "a s b"; row-gap: 6px; }
  .match-meta { grid-area: meta; grid-auto-flow: column; justify-content: start; gap: 8px; }
  .match .icon-btn { position: absolute; right: 10px; }
  .match { position: relative; }
  .facts dd { font-size: 22px; }
  .sec-head { flex-wrap: wrap; align-items: flex-start; }
  .profile { gap: 16px; }
  .avatar.xl { --size: 64px; }
  .mon-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .facts.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; gap: 12px 16px; }
  .facts.compact dd { font-size: 15px; }
  .profile { grid-template-columns: 1fr; }
  .profile > .avatar.xl { --size: 72px; }
  /* Card de Pokémon compacto no celular: 2 por linha */
  .mon-art { height: 104px; }
  .mon-art > .pokemon-sprite { width: 96px; height: 96px; }
  .rank, .mvp-count { top: 6px; height: 20px; font-size: 11px; padding: 0 7px 0 4px; }
  .rank { left: 6px; } .mvp-count { right: 6px; padding: 0 7px; }
  .rank .rank-ball { width: 14px !important; height: 14px !important; }
  .mon-body { padding: 9px 10px 10px; gap: 8px; }
  .mon-body h3 { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mon-species { font-size: 11.5px; margin-top: -5px; }
  .mon-facts { font-size: 12px; gap: 5px 8px; }
  .mon-facts dt { font-size: 10.5px; }
  .kda { grid-template-columns: minmax(0, 1fr) repeat(3, 18px); padding: 6px 8px; font-size: 11px; gap: 1px 2px; }
  .kda > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mon-card .row-actions .btn.sm { height: 26px; padding: 0 8px; font-size: 11.5px; }

  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mon-tile .mon { --size: 44px; }
  .setting { flex-direction: column; align-items: flex-start; gap: 12px; }
  .form-grid, .sheet-quick-grid, .kda-correction .form-grid { grid-template-columns: 1fr 1fr; }
  .pokerole-main-grid, .pokerole-bottom-grid, .pokerole-skill-groups, .sheet-view-columns, .sheet-move-grid, .sheet-kda-bar { grid-template-columns: 1fr; }
  .sheet-metric-grid { grid-template-columns: 1fr 1fr; }
  .sheet-hero { grid-template-columns: 80px minmax(0, 1fr); }
  .sheet-hero-sprite { width: 80px; height: 80px; }
  .sheet-edit-action { grid-column: 1 / -1; }
  .move-editor-grid { grid-template-columns: 1fr 1fr; }
  .move-editor-grid .move-name { grid-column: 1 / -1; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
}

@media (max-width: 400px) {
  .tile-grid { grid-template-columns: 1fr; }
  .kda-delta-grid { grid-template-columns: 1fr 1fr 1fr; }
}

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

/* Linha de corte dos playoffs */
.board-row.in-playoff + .board-row:not(.in-playoff) { border-top: 1px dashed color-mix(in srgb, var(--volt) 55%, transparent); }

/* =====================================================================
   V3.1 · Trade Center
   ===================================================================== */
.trades { display: grid; gap: 12px; }
.trade { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.trade-meta { display: flex; align-items: center; gap: 14px; padding: 9px 16px; background: var(--raised); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.trade-meta span { font-weight: 500; color: var(--text); }
.trade-meta p { flex: 1; min-width: 0; }
.trade-meta .btn { margin-left: auto; }
.trade-body { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
.trade-side { padding: 14px 16px; min-width: 0; }
.trade-side header { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; color: var(--muted); }
.trade-side header strong { color: var(--text); font-weight: 600; }
.trade-arrow { display: grid; place-items: center; padding: 0 4px; color: var(--volt-text); }
.trade-arrow svg { width: 22px; height: 22px; }
.goods { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.good { display: flex; align-items: center; gap: 10px; min-width: 0; }
.good-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--raised); color: var(--muted); }
.good-icon svg { width: 16px; height: 16px; }
.money-icon { font-weight: 600; color: var(--volt-text); }
.goods-empty { padding: 6px 0; }

/* Montador */
.modal.trade-modal { width: min(980px, 100%); }
.trade-cols { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: start; }
.trade-cols > .trade-arrow { padding-top: 30px; }
.trade-col { display: grid; gap: 14px; min-width: 0; }
.trade-hint { padding: 20px 0; }
.pick-title { font-size: 14px; font-weight: 600; padding-top: 4px; border-top: 1px solid var(--line); padding-top: 14px; }
.pick-block { display: grid; gap: 8px; }
.pick-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.pick-label small { color: var(--faint); font-weight: 400; margin-left: 4px; }
.pick-block > input { width: 100%; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.pick {
  position: relative; display: flex; align-items: center; gap: 6px; min-width: 0; text-align: left;
  padding: 4px 28px 4px 4px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--panel);
  transition: border-color .12s, background .12s;
}
.pick:hover { border-color: var(--line-2); background: var(--hover); }
.pick.on { border-color: var(--volt); background: var(--volt-soft); }
.pick .check { position: absolute; right: 9px; top: 50%; width: 14px; height: 14px; margin-top: -7px; border-radius: 4px; border: 1.5px solid var(--line-2); }
.pick.on .check { background: var(--volt); border-color: var(--volt); }
.pick.on .check::after { content: ""; position: absolute; left: 3.5px; top: .5px; width: 4px; height: 8px; border: solid var(--volt-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.pick-items { display: grid; gap: 6px; }
.pick-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 4px 4px 12px; border-radius: var(--r-md); border: 1px solid var(--line); }
.pick-item small { color: var(--faint); }
.pick-item input { width: 72px; }
.trade-extra { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.trade-actions { align-items: center; }
.trade-summary { flex: 1; min-width: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.trade-summary strong { color: var(--text); font-weight: 600; }

@media (max-width: 760px) {
  .trade-body, .trade-cols { grid-template-columns: 1fr; }
  .trade-arrow { padding: 2px 0; transform: rotate(90deg); justify-self: center; }
  .trade-cols > .trade-arrow { padding-top: 0; }
  .trade-body .trade-side + .trade-arrow + .trade-side { border-top: 1px solid var(--line); }
  .trade-actions { flex-wrap: wrap; }
  .trade-summary { flex-basis: 100%; }
}

/* =====================================================================
   V3.2 · Nocautes nas partidas
   ===================================================================== */
.match-actions { display: flex; gap: 6px; }
.match.has-kos { grid-template-rows: auto auto; }
.ko-board { grid-column: 2 / 5; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; padding-top: 4px; }
.ko-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; align-content: start; }
.ko-list.right { justify-items: end; }
.ko-list.full { grid-column: 1 / -1; }
.ko { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); min-width: 0; }
.ko strong { color: var(--text); font-weight: 500; }
.ko .ko-victim { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 70%, transparent); }
.ko-verb { color: var(--faint); }
.ko-assist { color: var(--faint); }
.ko-assist::before { content: "·"; margin-right: 6px; }

.modal.match-modal { width: min(860px, 100%); }
.match-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ko-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.ko-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ko-head h3 { font-size: 14px; }
.ko-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; max-width: 60ch; }
.ko-empty { padding: 4px 0; }
.ko-row {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.3fr) auto; gap: 10px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--raised);
}
.ko-num { padding-top: 30px; color: var(--faint); font-weight: 600; text-align: center; }
.ko-remove { margin-top: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel); font-size: 12.5px; color: var(--muted); }
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip.on { color: var(--volt-ink); background: var(--volt); border-color: var(--volt); font-weight: 600; }

@media (max-width: 760px) {
  .ko-row { grid-template-columns: 1fr auto; }
  .ko-num { display: none; }
  .ko-row > .field { grid-column: 1 / 2; }
  .ko-remove { grid-column: 2; grid-row: 1; margin-top: 22px; }
  .ko-head { flex-direction: column; }
}
@media (max-width: 640px) {
  .ko-board { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .ko-list.right { justify-items: start; }
  .match-actions { position: absolute; right: 10px; top: 8px; }
  .match .icon-btn { position: static; }
}

/* V3.3 · MVP */
.mvp-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; margin-top: 14px; }
.mvp-field select { width: 100%; }
.mvp-star { width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--r-sm); background: var(--volt-soft); color: var(--volt-text); font-size: 16px; }
.mvp-line { grid-column: 2 / 5; display: flex; align-items: center; gap: 8px; font-size: 13px; padding-top: 2px; }
.mvp-line strong { font-weight: 600; }
.mvp-badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--volt); color: var(--volt-ink); font-size: 11.5px; font-weight: 700; letter-spacing: .02em; }
.mvp-count { position: absolute; right: 10px; top: 10px; display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--volt); color: var(--volt-ink); font-size: 12px; font-weight: 600; }
@media (max-width: 640px) { .mvp-line { grid-column: 1 / -1; } }

/* V3.4 · Evoluções */
.evo-hint { color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.evo-hint.none { opacity: .7; }
.evolve { display: grid; gap: 14px; }
.evolve-from { display: flex; align-items: center; gap: 12px; }
.evolve-from strong { font-size: 17px; font-weight: 600; }
.evolve-from small { color: var(--muted); }
.evolve-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.evolve-option {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; text-align: left;
  padding: 8px 12px 8px 6px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--raised);
}
.evolve-option:hover { border-color: var(--volt); }
.evolve-option .btn { pointer-events: none; }
.evolve-btn { border-color: rgba(242, 201, 76, .45); color: var(--volt-text); }

/* V3.5 · Nocautes recolhíveis no celular */
.ko-details { grid-column: 2 / 5; }
.ko-details > summary { display: none; list-style: none; cursor: pointer; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; padding: 4px 0; }
.ko-details > summary::-webkit-details-marker { display: none; }
.ko-details > summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); margin-top: -3px; transition: transform .15s; }
.ko-details[open] > summary::after { transform: rotate(-135deg); margin-top: 3px; }
.ko-details .ko-board { grid-column: auto; }
@media (max-width: 640px) { .ko-details { grid-column: 1 / -1; } .ko-details > summary { display: inline-flex; } }

/* V3.6 · Penalidades e ajustes */
.pts-adj { display: inline-block; margin-right: 6px; font-size: 11px; font-weight: 600; padding: 1px 5px; border-radius: 999px; vertical-align: 2px; }
.pts-adj.neg { color: var(--bad); background: var(--bad-soft); }
.pts-adj.pos { color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.adj-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); }
.adj-row:first-child { border-top: 0; }
.adj-pts { font-size: 18px; font-weight: 700; text-align: center; letter-spacing: -.02em; }
.adj-pts.neg { color: var(--bad); }
.adj-pts.pos { color: var(--good); }
.adj-main { display: grid; min-width: 0; }
.adj-main strong { font-weight: 500; }
.adj-main small { color: var(--muted); font-size: 12.5px; }
.adj-notes { margin-top: 14px; }
.adj-notes h3 { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 8px; }
@media (max-width: 640px) { .adj-row { grid-template-columns: 40px minmax(0, 1fr); } .adj-row .btn { grid-column: 2; justify-self: start; } }

/* V3.7 · Amistosos, rankings */
.comp-tag { justify-self: start; margin-top: 3px; font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; color: var(--muted); border: 1px solid var(--line-2); }
.comp-tag.friendly { color: var(--volt-text); border-color: rgba(242, 201, 76, .4); }
.rank-list { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--panel); overflow: hidden; }
.rank-row { display: grid; grid-template-columns: 40px auto minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 6px 16px; border-top: 1px solid var(--line); }
.rank-row:first-child { border-top: 0; }
.rank-row:hover { background: var(--hover); }
.rank-row .pos { color: var(--faint); font-weight: 600; font-size: 15px; text-align: center; }
.rank-row.top .pos, .rank-row.top .rank-val { color: var(--volt-text); }
.rank-row.top { background: linear-gradient(90deg, var(--volt-soft), transparent 55%); }
.rank-row .mon { --size: 46px; }
.rank-val { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.rank-val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.rank-row.zero { opacity: .55; }
.toolbar.wide .segmented + .segmented { margin-left: auto; }
@media (max-width: 640px) { .rank-row { padding: 6px 12px; gap: 8px; grid-template-columns: 28px auto minmax(0, 1fr) auto; } .rank-row .mon { --size: 38px; } .toolbar.wide .segmented + .segmented { margin-left: 0; } }

/* V3.7 · Empréstimo */
.loan-owed { color: var(--bad); }
.loan-tag { display: block; color: var(--bad); font-size: 11.5px; font-weight: 600; text-align: right; }
.loan-panel { padding: 0; overflow: hidden; }
.loan-big { display: grid; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.loan-big small { color: var(--muted); font-size: 12.5px; }
.loan-big strong { font-size: 26px; font-weight: 700; letter-spacing: -.03em; color: var(--bad); }
.loan-hist .adj-row:first-child { border-top: 0; }
.loan-hist .adj-pts { font-size: 14px; }

/* =====================================================================
   V4.0 · Modo online
   ===================================================================== */
.online-msg { display: grid; gap: 10px; max-width: 560px; }
.online-msg.center { margin: 12vh auto 0; text-align: center; justify-items: center; color: var(--muted); }
.online-msg.center strong { color: var(--text); font-size: 17px; font-weight: 600; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--line-2); border-top-color: var(--volt); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.save-indicator[data-state="saving"] { color: var(--muted); }
.save-indicator[data-state="ok"] { color: var(--good); }
.save-indicator[data-state="error"] { color: var(--bad); font-weight: 600; }
.login-error { color: var(--bad) !important; font-weight: 500; }
.auth-btn span { flex: 1; }
body.online:not(.online-admin) .organizer-only { display: none !important; }
@media (max-width: 860px) { body.online .save-indicator[data-state="error"], body.online .save-indicator[data-state="saving"] { display: inline; } }
