/* Munchkin Companion — mesmo sistema visual do LifeCounter (tema escuro, Inter, roxo de destaque),
   com a camada Munchkin por cima: medalhão de nível, trilha até a vitória, moedas e faíscas. */
:root {
  --bg-primary: #0a0a0a;
  --bg-secondary: #111111;
  --bg-tertiary: #252525;
  --bg-card: #1a1a1a;
  --bg-card-2: #1e1e1e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --accent: #8b5cf6;
  --accent-2: #6366f1;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #333333;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --anim: 1;              /* intensidade de animação (0 = sem, 0.5 = sutil, 1 = normal, 1.6 = intensa) */
  --player: var(--accent);
  --player-text: #fff;
  --sidebar-w: 112px;
  color-scheme: dark;
}
@media (prefers-reduced-motion: reduce) { :root { --anim: 0; } }
[data-anim="0"] { --anim: 0; }
[data-anim="subtle"] { --anim: .5; }
[data-anim="intense"] { --anim: 1.6; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
[x-cloak] { display: none !important; }
@media (max-width: 760px) { .hide-sm { display: none !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg { fill: currentColor; }
svg.i { width: 1.25em; height: 1.25em; flex: none; fill: currentColor; vertical-align: -0.25em; }

/* ------------------------------------------------------------ layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
  background: var(--bg-primary); border-right: 1px solid #1d1d1d;
  display: flex; flex-direction: column; align-items: stretch; padding: 16px 0; gap: 6px; z-index: 30;
}
.sidebar .brand { display: grid; place-items: center; padding: 6px 0 16px; color: var(--accent); }
.sidebar .brand svg { width: 44px; height: 44px; }
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px;
  color: var(--text-muted); font-weight: 600; font-size: 14px; position: relative;
}
.nav-item svg { width: 28px; height: 28px; fill: currentColor; }
.nav-item:hover { color: var(--text-secondary); }
.nav-item.active { color: var(--accent); }
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0;
  background: var(--accent);
}
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; padding: 20px 28px 40px; }
.main.flush { padding: 0; }
.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.topbar .logo { color: var(--accent); width: 52px; height: 52px; }
.topbar h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { color: var(--text-secondary); font-size: 16px; }
.topbar .spacer { flex: 1; }

@media (max-width: 760px) {
  .sidebar {
    inset: auto 0 0 0; width: auto; height: 64px; flex-direction: row; padding: 0 4px;
    border-right: 0; border-top: 1px solid #1d1d1d; justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar .brand { display: none; }
  .nav-item { padding: 8px 2px; font-size: 11px; flex: 1; }
  .nav-item svg { width: 24px; height: 24px; }
  .nav-item.active::before { left: 25%; right: 25%; top: 0; bottom: auto; width: auto; height: 3px; border-radius: 0 0 4px 4px; }
  .main { margin-left: 0; padding: 16px 16px 90px; }
  .main.flush { padding-bottom: 64px; }
  .topbar h1 { font-size: 24px; }
  .topbar .logo { width: 40px; height: 40px; }
}

/* ------------------------------------------------------------ componentes base */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px;
}
.panel.tight { padding: 16px; }
.panel-title { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; font-size: 22px; font-weight: 800; }
.panel-title svg { color: var(--accent); width: 28px; height: 28px; }
.label { color: var(--text-secondary); font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  margin: 18px 0 8px; }
.muted { color: var(--text-secondary); }
.faint { color: var(--text-muted); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 18px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px;
  border-radius: var(--r); border: 1px solid var(--border); background: var(--bg-tertiary); font-weight: 700;
  transition: transform calc(120ms * var(--anim)) ease, background 150ms ease, opacity 150ms;
  user-select: none;
}
.btn:hover { background: #2e2e2e; }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { background: #7c4ff0; }
.btn.danger { background: transparent; border-color: rgba(239, 68, 68, .5); color: var(--danger); }
.btn.success { background: var(--success); color: #062b12; border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.big { min-height: 60px; font-size: 20px; padding: 0 28px; border-radius: var(--r-lg); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: var(--r-sm); }
.btn.icon { width: 48px; padding: 0; }
.btn.player { background: var(--player); color: var(--player-text); border-color: transparent; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-secondary); font-size: 14px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; background: var(--bg-tertiary); border: 1px solid var(--border); border-radius: var(--r);
  padding: 10px 14px; outline: none; font-size: 16px;
}
textarea.input { min-height: 80px; resize: vertical; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, .25); }
.input.code { text-transform: uppercase; letter-spacing: .35em; font-weight: 800; font-size: 28px; text-align: center; }

.segmented { display: flex; background: var(--bg-tertiary); border-radius: var(--r); padding: 4px; gap: 4px; flex-wrap: wrap; }
.segmented button {
  flex: 1; min-height: 44px; border: 0; background: transparent; border-radius: var(--r-sm); font-weight: 700;
  color: var(--text-secondary); padding: 0 12px;
}
.segmented button.on { background: var(--accent); color: #fff; }

.toggle { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.toggle .txt { flex: 1; }
.toggle .txt small { display: block; color: var(--text-muted); font-size: 13px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .knob { position: absolute; inset: 0; background: #3a3a3a; border-radius: 999px; transition: background 150ms; }
.switch .knob::after { content: ''; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; transition: transform calc(180ms * var(--anim)); }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(22px); }

.stepper { display: inline-flex; align-items: center; background: var(--bg-primary); border-radius: 999px; padding: 4px;
  border: 1px solid var(--border); }
.stepper button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg-tertiary); font-size: 22px; font-weight: 700; }
.stepper output { min-width: 56px; text-align: center; font-size: 22px; font-weight: 800; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--bg-tertiary);
  font-size: 13px; font-weight: 600; color: var(--text-secondary); white-space: nowrap; }
.chip.accent { background: rgba(139, 92, 246, .18); color: #c4b5fd; }
.chip.good { background: rgba(34, 197, 94, .15); color: #86efac; }
.chip.bad { background: rgba(239, 68, 68, .15); color: #fca5a5; }
.chip.warn { background: rgba(245, 158, 11, .15); color: #fcd34d; }
.chip button { border: 0; background: none; padding: 0; color: inherit; opacity: .7; }

.avatar {
  width: 56px; height: 56px; border-radius: 50%; flex: none; object-fit: cover; background: var(--bg-tertiary);
  display: grid; place-items: center; font-weight: 800; font-size: 20px; border: 3px solid var(--player, #444);
  color: var(--text-primary); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; border-width: 2px; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; }
.dot { width: 18px; height: 18px; border-radius: 50%; background: var(--player); flex: none; }

.list-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--bg-card-2);
}
.list-item + .list-item { margin-top: 10px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; font-size: 18px; }
.empty { text-align: center; color: var(--text-muted); padding: 32px 12px; }
.empty svg { width: 48px; height: 48px; opacity: .5; display: block; margin: 0 auto 10px; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 12px 14px; font-weight: 700; color: var(--text-muted);
  border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--text-primary); border-bottom-color: var(--accent); }

/* paleta de cores do jogador */
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 10px; }
.swatch { aspect-ratio: 1; border-radius: 50%; border: 3px solid transparent; background: var(--c); position: relative;
  display: grid; place-items: center; color: var(--t); }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 3px var(--accent); }
.swatch.taken { opacity: .2; cursor: not-allowed; }
.swatch svg { width: 22px; height: 22px; opacity: .85; }

/* grade de perfis (escolher o próprio rosto) */
.faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px; }
.face { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border-radius: var(--r-lg);
  border: 2px solid transparent; background: var(--bg-card-2); }
.face .avatar { width: 72px; height: 72px; }
.face.on { border-color: var(--accent); background: rgba(139, 92, 246, .12); }
.face.taken { opacity: .3; pointer-events: none; }
.face span { font-weight: 700; }

/* ------------------------------------------------------------ toasts, folhas, modais */
.toasts { position: fixed; z-index: 100; left: 50%; transform: translateX(-50%); bottom: 24px; display: flex; flex-direction: column;
  gap: 8px; width: min(92vw, 460px); pointer-events: none; }
@media (max-width: 760px) { .toasts { bottom: 80px; } }
.toast { background: #262626; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--r);
  padding: 12px 16px; box-shadow: var(--shadow-lg); font-weight: 600; animation: toast-in calc(220ms * var(--anim)) ease-out;
  pointer-events: auto; }
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 60; display: grid; place-items: center; padding: 16px; }
.sheet { background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; width: min(560px, 100%);
  max-height: 88vh; overflow: auto; padding: 24px; box-shadow: var(--shadow-lg); animation: sheet-in calc(220ms * var(--anim)) ease-out; }
.sheet h2 { margin: 0 0 16px; font-size: 22px; }
@keyframes sheet-in { from { transform: translateY(24px) scale(.98); opacity: 0; } }
@media (max-width: 760px) {
  .backdrop { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; border-radius: 20px 20px 0 0; max-height: 92vh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------ mesa (painel da partida) */
.table-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid #1d1d1d;
  position: sticky; top: 0; background: var(--bg-primary); z-index: 20; }
.table-top .ttl { flex: 1; min-width: 0; text-align: center; }
.table-top .ttl b { display: block; font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-top .ttl small { color: var(--text-secondary); }
.square { width: 52px; height: 52px; border-radius: var(--r); background: var(--bg-card); border: 1px solid var(--border);
  display: grid; place-items: center; flex: none; position: relative; color: var(--text-primary); }
.square:hover { background: var(--bg-tertiary); }
.square svg { width: 26px; height: 26px; }
.square .badge { position: absolute; top: -6px; right: -6px; background: var(--danger); color: #fff; font-size: 11px;
  font-weight: 800; border-radius: 999px; padding: 2px 6px; }
.live { width: 10px; height: 10px; border-radius: 50%; background: var(--text-muted); display: inline-block; margin-right: 6px; }
.live.on { background: var(--success); box-shadow: 0 0 0 4px rgba(34, 197, 94, .2); }

.board { display: grid; gap: 12px; padding: 12px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
@media (max-width: 1100px) { .board { --cols: 2 !important; } }
@media (max-width: 560px) { .board { --cols: 1 !important; } }

.pcard {
  --player: #888; --player-text: #fff;
  position: relative; background: var(--bg-card); border: 2px solid #2a2a2a; border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column; min-height: 300px;
  transition: border-color 200ms, box-shadow 200ms, transform calc(200ms * var(--anim));
}
.pcard.turn { border-color: var(--player); box-shadow: 0 0 0 1px var(--player), 0 0 28px -6px var(--player); }
.pcard.me { outline: 2px dashed rgba(255, 255, 255, .15); outline-offset: 3px; }
.pcard.rot180 { transform: rotate(180deg); }
.pcard-head {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: linear-gradient(100deg, var(--player) 0%, color-mix(in srgb, var(--player) 45%, #1a1a1a) 65%, #1a1a1a 100%);
  color: var(--player-text);
}
.pcard-head .avatar { border-color: rgba(255, 255, 255, .7); }
.pcard-head .nm { flex: 1; min-width: 0; }
.pcard-head .nm b { display: block; font-size: 20px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-head .nm small { opacity: .85; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.pcard-head .gear { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .35);
  display: grid; place-items: center; color: #fff; }
.pcard-body { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 8px 6px; }
.lvl-btn {
  height: 100%; min-height: 120px; border: 0; background: transparent; font-size: 44px; font-weight: 300; color: var(--text-muted);
  border-radius: var(--r-lg); transition: background 120ms, color 120ms;
}
.lvl-btn:hover { background: rgba(255, 255, 255, .04); color: var(--text-primary); }
.lvl-btn:active { background: rgba(255, 255, 255, .08); }
.lvl-btn[disabled] { opacity: .25; }
.medal { text-align: center; position: relative; padding: 0 6px; user-select: none; }
.medal .num { font-size: clamp(72px, 9vw, 128px); font-weight: 800; line-height: .9; letter-spacing: -.04em;
  display: inline-block; font-variant-numeric: tabular-nums; }
.medal .cap { color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: .2em; }
.medal.up .num { animation: lvl-up calc(520ms * var(--anim)) cubic-bezier(.2, 1.6, .4, 1); color: var(--success); }
.medal.down .num { animation: lvl-down calc(420ms * var(--anim)) ease; color: var(--danger); }
.medal.max .num { color: var(--warning); text-shadow: 0 0 24px rgba(245, 158, 11, .6); }
@keyframes lvl-up { 0% { transform: scale(1); } 35% { transform: scale(calc(1 + .35 * var(--anim))); } 100% { transform: scale(1); } }
@keyframes lvl-down {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(calc(-8px * var(--anim))); } 40% { transform: translateX(calc(8px * var(--anim))); }
  60% { transform: translateX(calc(-5px * var(--anim))); } 80% { transform: translateX(calc(5px * var(--anim))); }
}
.spark { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--player); pointer-events: none;
  left: 50%; top: 45%; animation: spark calc(700ms * var(--anim)) ease-out forwards; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

.track { display: flex; gap: 4px; padding: 0 16px; }
.track i { flex: 1; height: 6px; border-radius: 3px; background: #2c2c2c; transition: background 250ms; }
.track i.on { background: var(--player); }
.track.hot i.on { animation: pulse calc(1.2s * var(--anim)) ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.pcard-foot { display: flex; align-items: center; gap: 8px; padding: 12px 14px; flex-wrap: wrap; }
.strength { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; padding: 4px 12px;
  border-radius: 999px; background: var(--bg-primary); border: 1px solid var(--border); }
.strength svg { color: var(--warning); }
.pcard.dead { filter: grayscale(.85); opacity: .75; }

.turnbar {
  position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 16px;
  background: var(--bg-primary); border-top: 1px solid #1d1d1d;
}
@media (max-width: 760px) { .turnbar { bottom: 64px; } }
.turnbar .who { display: flex; align-items: center; gap: 10px; }
.turnbar .who small { display: block; color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: .12em; white-space: nowrap; }
.turnbar .who b { white-space: nowrap; }
.turnbar .who b { font-size: 22px; font-weight: 800; }
.turnbar .num { background: var(--bg-tertiary); padding: 8px 14px; border-radius: 999px; color: var(--text-secondary); white-space: nowrap; }
.turnbar .btn { white-space: nowrap; }
@media (max-width: 560px) {
  .turnbar { gap: 10px; padding: 10px 12px; }
  .turnbar .num { display: none; }
  .turnbar .who b { font-size: 18px; }
  .turnbar .btn.big { min-height: 52px; font-size: 17px; padding: 0 18px; }
  .table-top { gap: 6px; padding: 10px; }
  .table-top .square { width: 44px; height: 44px; }
  .table-top .ttl b { font-size: 17px; }
}

/* dado */
.die { width: 120px; height: 120px; border-radius: 24px; background: #f5f5f4; color: #111; display: grid; place-items: center;
  font-size: 64px; font-weight: 800; margin: 8px auto 16px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15), var(--shadow-lg); }
.die.rolling { animation: roll calc(600ms * var(--anim)) ease-out; }
@keyframes roll { 0% { transform: rotate(0) scale(.6); } 60% { transform: rotate(calc(540deg * var(--anim))) scale(1.1); } 100% { transform: rotate(calc(720deg * var(--anim))) scale(1); } }

/* vitória */
.victory { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.coin { position: absolute; top: -40px; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fde68a, #f59e0b 60%, #b45309); box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .15);
  animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.banner { position: fixed; z-index: 91; left: 50%; top: 40%; transform: translate(-50%, -50%); text-align: center;
  background: var(--bg-card); border: 2px solid var(--warning); border-radius: 24px; padding: 28px 40px; box-shadow: 0 0 60px rgba(245, 158, 11, .35); }
.banner h2 { margin: 0; font-size: 40px; font-weight: 800; }

/* ------------------------------------------------------------ combate */
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
@media (max-width: 820px) { .versus { grid-template-columns: 1fr; } }
.side { border-radius: var(--r-lg); padding: 18px; border: 2px solid var(--border); background: var(--bg-card); }
.side.heroes { border-color: rgba(34, 197, 94, .45); }
.side.monsters { border-color: rgba(239, 68, 68, .45); }
.side h3 { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.total { font-size: 64px; font-weight: 800; line-height: 1; }
.vs-mid { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; text-align: center; min-width: 180px; }
.verdict { font-size: 26px; font-weight: 800; padding: 10px 18px; border-radius: var(--r-lg); }
.verdict.win { background: rgba(34, 197, 94, .15); color: var(--success); }
.verdict.lose { background: rgba(239, 68, 68, .15); color: var(--danger); }
.verdict.tie { background: rgba(245, 158, 11, .15); color: var(--warning); }
.mod { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--r-sm); background: var(--bg-tertiary); margin-top: 6px; }
.mod .v { font-weight: 800; }
.mod .v.pos { color: var(--success); }
.mod .v.neg { color: var(--danger); }

/* ------------------------------------------------------------ histórico */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid #1f1f1f; align-items: flex-start; }
.timeline .stripe { width: 4px; align-self: stretch; border-radius: 2px; background: var(--player, #444); flex: none; }
.timeline .ev { flex: 1; min-width: 0; }
.timeline .ev b { font-weight: 600; }
.timeline .ev small { display: block; color: var(--text-muted); }
.timeline li.reverted .ev b { text-decoration: line-through; color: var(--text-muted); }
.timeline li.correction .ev b { color: var(--warning); }

/* ------------------------------------------------------------ estatísticas */
.rank { display: grid; grid-template-columns: 36px 1fr repeat(4, minmax(56px, auto)); align-items: center; gap: 10px;
  padding: 10px 6px; border-bottom: 1px solid #1f1f1f; }
.rank.head { color: var(--text-muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.rank .pos { font-weight: 800; font-size: 20px; text-align: center; }
.rank .num { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .rank { grid-template-columns: 28px 1fr repeat(2, auto); } .rank .hide-sm { display: none; } }
.bar { height: 10px; border-radius: 5px; background: var(--bg-tertiary); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--bg-card-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; }
.kpi small { color: var(--text-muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.kpi b { display: block; font-size: 32px; font-weight: 800; margin-top: 4px; }

/* ------------------------------------------------------------ home / landing */
.hero { text-align: center; padding: 40px 12px 28px; }
.hero svg.logo { width: 96px; height: 96px; color: var(--accent); }
.hero h1 { font-size: clamp(34px, 6vw, 56px); margin: 12px 0 8px; font-weight: 800; letter-spacing: -.03em; }
.hero p { color: var(--text-secondary); font-size: 18px; max-width: 620px; margin: 0 auto; }
.code-box { display: flex; gap: 10px; max-width: 520px; margin: 28px auto 0; }
.code-box .input { flex: 1; }
.bigcode { font-size: clamp(44px, 9vw, 84px); font-weight: 800; letter-spacing: .18em; text-align: center; color: var(--accent); }
#qr { background: #fff; padding: 12px; border-radius: var(--r); width: max-content; margin: 0 auto; }
#qr img, #qr canvas { display: block; }

@media (max-width: 760px) {
  .panel { padding: 16px; }
  .faces { grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; }
  .face .avatar { width: 60px; height: 60px; }
}

/* ---- v2: o card mede PODER (o nível vira parcela) ---- */
.toast { display: flex; align-items: center; gap: 12px; }
.toast > span { flex: 1; }
.toast-action { border: 0; background: rgba(255, 255, 255, .1); color: var(--text-primary); font-weight: 800; border-radius: 8px;
  padding: 8px 12px; cursor: pointer; }
.pcard { position: relative; }
.medal.power { background: none; border: 0; color: inherit; cursor: pointer; font: inherit; }
.medal.power .num { font-size: clamp(84px, 11vw, 150px); color: var(--text-primary); }
.medal.power .cap { color: var(--player); letter-spacing: .3em; font-size: 14px; }
.medal.power.up .num { color: var(--success); }
.medal.power.down .num { color: var(--danger); }
.top-badge { position: absolute; top: 72px; right: 14px; z-index: 2; background: var(--warning); color: #111; font-weight: 800; font-size: 11px;
  text-transform: uppercase; letter-spacing: .06em; padding: 3px 8px; border-radius: 999px; }
.power-parts { display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 0 12px 6px;
  color: var(--text-muted); font-weight: 600; }
.power-parts b { color: var(--text-primary); }
.lvl-mini { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, .05); border-radius: 999px; padding: 2px; }
.lvl-mini button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .08); color: var(--text-primary);
  font-size: 18px; font-weight: 800; cursor: pointer; }
.lvl-mini button[disabled] { opacity: .3; }
.to-win { text-align: center; font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 6px 12px 10px; }
.quick-chips.static { padding: 0; justify-content: flex-start; }
.chip-btn { min-width: 56px; height: 48px; border-radius: 12px; border: 1px solid var(--border); background: #1f1f1f; color: var(--text-primary);
  font-size: 18px; font-weight: 800; cursor: pointer; }
.chip-btn.good { border-color: rgba(34, 197, 94, .5); }
.chip-btn.bad { border-color: rgba(239, 68, 68, .5); }
.power-big { font-size: 72px; font-weight: 800; text-align: center; line-height: 1; }
.power-big.gold { color: var(--warning); }
.breakdown { display: flex; flex-direction: column; gap: 10px; background: rgba(255, 255, 255, .03); border-radius: var(--r); padding: 12px; }
button.chip { cursor: pointer; border: 0; font: inherit; }

/* Avisos no topo e compactos (embaixo ficam a barra da vez e os botões da mesa). */
.toasts { top: 76px; bottom: auto; }
@media (max-width: 760px) { .toasts { top: 70px; bottom: auto; } }
.toast { padding: 8px 8px 8px 14px; font-size: 15px; }
.toast-action { padding: 6px 10px; }
@media (max-width: 760px) {
  .medal.power .num { font-size: 88px; }
  .pcard-body { padding: 2px 6px; }
  .pcard-head { padding-top: 10px; padding-bottom: 10px; }
  .pcard-head .avatar { width: 48px; height: 48px; }
}

/* Botões da mesa nunca param atrás da barra da vez + menu inferior ao rolar até eles. */
.board button, .board a { scroll-margin-bottom: 180px; scroll-margin-top: 90px; }


/* ---- v2: combate poder × poder ---- */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 16px;
  border-radius: var(--r-lg, 18px); background: #161616; border: 2px solid var(--border); }
.scoreboard .side { text-align: center; min-width: 0; }
.scoreboard .side-label { font-size: 13px; font-weight: 800; letter-spacing: .25em; color: var(--text-muted); }
.scoreboard .total { font-size: clamp(64px, 14vw, 140px); font-weight: 800; line-height: 1; }
.scoreboard .names { color: var(--text-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scoreboard .verdict { text-align: center; display: flex; flex-direction: column; gap: 4px; max-width: 140px; }
.scoreboard .verdict b { font-size: 18px; font-weight: 800; }
.scoreboard .verdict small { color: var(--text-muted); }
.scoreboard.winning { border-color: var(--success); box-shadow: 0 0 32px -10px var(--success); }
.scoreboard.winning .heroes .total, .scoreboard.winning .verdict b { color: var(--success); }
.scoreboard.losing { border-color: var(--danger); box-shadow: 0 0 32px -10px var(--danger); }
.scoreboard.losing .monsters .total, .scoreboard.losing .verdict b { color: var(--danger); }
.scoreboard.tie { border-color: var(--warning); }
.scoreboard.tie .verdict b { color: var(--warning); }
.big-stepper { display: flex; align-items: center; gap: 6px; }
.big-stepper button { min-width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--border); background: #1f1f1f;
  color: var(--text-primary); font-size: 18px; font-weight: 800; cursor: pointer; }
.big-stepper output { min-width: 80px; text-align: center; font-size: 44px; font-weight: 800; }
.big-stepper.sm button { min-width: 44px; height: 44px; }
.big-stepper.sm output { font-size: 32px; min-width: 60px; }
.monster-row { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.hero-power { font-size: 28px; font-weight: 800; }
.combat-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 16px 0 40px; }
.run-box { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.chip .x { border: 0; background: none; color: inherit; font-weight: 800; cursor: pointer; margin-left: 4px; }
.bad-stuff { border-color: var(--danger); margin-bottom: 12px; }
@media (max-width: 560px) {
  .scoreboard { padding: 12px 8px; }
  .scoreboard .verdict { max-width: 96px; }
  .scoreboard .verdict b { font-size: 14px; }
}
.scoreboard .verdict small { font-size: 13px; font-weight: 600; line-height: 1.2; }


/* ---- v2: revisão do que a IA leu ---- */
.measure-row { gap: 8px; padding: 6px; border-radius: 10px; }
.measure-row.low { background: rgba(245, 158, 11, .12); outline: 1px dashed var(--warning); }
.measure-row input[type=checkbox] { width: 22px; height: 22px; }
.warn-text { color: var(--warning); margin: 0; font-weight: 600; }
.power-big .good { color: var(--success); }

/* ---- v2: turno guiado ---- */
.phases { display: inline-flex; gap: 4px; background: var(--bg-tertiary); border-radius: 999px; padding: 3px; }
.phases button { border: 0; background: none; color: var(--text-muted); font-weight: 700; font-size: 13px; border-radius: 999px;
  padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.phases button.on { background: var(--player, var(--accent)); color: #fff; }
@media (max-width: 560px) { .phases button { padding: 6px 7px; font-size: 12px; } }
