:root {
  --bg: #0f1420;
  --panel: #161d2c;
  --panel-2: #1d2638;
  --line: #2a3550;
  --text: #e6ebf5;
  --muted: #8d99b3;
  --accent: #ffcb05;
  --accent-2: #3d7dca;
  --good: #4cc38a;
  --bad: #e5534b;
  --warn: #f0a93b;
  --radius: 10px;
  --side-w: 400px;
  --top-h: 52px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --pixel: 'Press Start 2P', monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: #8fc1ff; }
.hidden { display: none !important; }

#app { display: grid; grid-template-columns: 1fr var(--side-w); grid-template-rows: var(--top-h) 1fr; height: 100vh; height: 100dvh; }
#topbar { grid-column: 1 / 3; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: linear-gradient(180deg, #1a2336, #141b2a); border-bottom: 1px solid var(--line); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--pixel); font-size: 12px; white-space: nowrap; color: var(--accent); text-shadow: 0 2px 0 #7a5d00; }
.logo { font-size: 20px; color: #ff5b5b; text-shadow: none; }
.pill { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; white-space: nowrap; color: var(--muted); }
.pill b { color: var(--text); }
.pill.warn { background: #4a3210; color: var(--warn); border-color: #6b4a18; font-weight: 700; }
#clock { color: var(--text); font-variant-numeric: tabular-nums; display: flex; gap: 8px; }
#season { color: var(--accent); }
.stats-inline { display: flex; gap: 8px; min-width: 0; overflow: hidden; }
.live .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #ff4d4d; margin-right: 6px; box-shadow: 0 0 6px #ff4d4d; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.top-actions { margin-left: auto; display: flex; gap: 6px; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 8px; padding: 5px 10px; color: var(--text); }
.ghost:hover { background: var(--panel-2); }
.book-link { text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; color: #f3d77a; border-color: #574d1c; }
.only-mobile { display: none; }

#stage { position: relative; overflow: hidden; background: #0b2340; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; image-rendering: pixelated; touch-action: none; }
#map.dragging { cursor: grabbing; }
#minimap { position: absolute; left: 12px; bottom: 12px; border: 2px solid var(--line); border-radius: 8px; background: #0b2340; box-shadow: 0 6px 20px rgba(0,0,0,.45); cursor: crosshair; image-rendering: pixelated; }
.popover { position: absolute; top: 10px; right: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; z-index: 20; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: 340px; }
.popover label { display: block; padding: 4px 0; cursor: pointer; }
.popover h4 { margin: 0 0 6px; }
.popover p { margin: 6px 0; color: var(--muted); line-height: 1.45; }
.tip { position: absolute; pointer-events: none; background: rgba(12,17,28,.92); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 12px; z-index: 15; max-width: 260px; }
.tip b { color: var(--accent); }

#toasts { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 18; pointer-events: none; width: min(560px, 90%); }
.toast { background: rgba(22,29,44,.96); border: 1px solid #4a5a82; border-left: 4px solid var(--accent); border-radius: 10px; padding: 10px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); animation: toastIn .35s ease-out; pointer-events: auto; cursor: pointer; line-height: 1.4; }
.toast.out { animation: toastOut .5s ease-in forwards; }
@keyframes toastIn { from { transform: translateY(-10px); opacity: 0; } }
@keyframes toastOut { to { transform: translateY(-10px); opacity: 0; } }

/* Ficha */
#card { position: absolute; top: 12px; left: 12px; bottom: 176px; width: min(430px, calc(100% - 24px)); background: rgba(22,29,44,.98); border: 1px solid var(--line); border-radius: 14px; z-index: 16; overflow: auto; box-shadow: 0 14px 40px rgba(0,0,0,.55); }
#card .close { position: sticky; top: 8px; float: right; margin: 8px 8px 0 0; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); font-size: 18px; line-height: 1; z-index: 2; }
#cardBody { padding: 14px 16px 18px; }
.card-head { display: flex; gap: 12px; align-items: center; }
.card-head .portrait { width: 88px; height: 88px; flex: none; background: radial-gradient(circle at 50% 60%, #2b3a5c, #18203a); border-radius: 12px; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); }
.card-head .portrait img { max-width: 100%; max-height: 100%; image-rendering: pixelated; }
.card-head h2 { margin: 0; font-size: 18px; line-height: 1.2; }
.card-head .epithet { color: var(--accent); font-style: italic; font-size: 13px; }
.sub { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.dead-banner { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #2a1c24; border: 1px solid #5a2f3b; color: #f2b8c3; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 12px 0; }
.kv div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.kv span { display: block; font-size: 11px; color: var(--muted); }
.kv b { font-size: 14px; font-variant-numeric: tabular-nums; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.btn { background: var(--accent-2); border: 0; color: white; border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 12.5px; }
.btn.alt { background: var(--panel-2); border: 1px solid var(--line); color: var(--text); }
.btn.danger { background: #8b2c2c; }
.subtabs { display: flex; gap: 4px; margin: 12px 0 8px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.subtabs button { background: none; border: 0; padding: 6px 8px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-size: 13px; }
.subtabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.titles { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #2b2a1a; color: #f3d77a; border: 1px solid #574d1c; }
.tag.blue { background: #1a2640; color: #9cc3ff; border-color: #2c4470; }
.tag.red { background: #3a1b1b; color: #ff9d9d; border-color: #6b2c2c; }
.said { margin-top: 10px; padding: 8px 10px; background: #f6f1e0; color: #222; border-radius: 12px; position: relative; font-size: 13px; }
.said::before { content: ''; position: absolute; top: -8px; left: 22px; border: 8px solid transparent; border-bottom-color: #f6f1e0; border-top: 0; }

.team { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.mon { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; position: relative; }
.mon.fainted { opacity: .55; }
.mon .spr { height: 76px; display: grid; place-items: center; }
.mon .spr img { max-height: 76px; max-width: 100%; image-rendering: pixelated; }
.mon .nm { font-weight: 700; font-size: 13px; display: flex; justify-content: space-between; gap: 4px; }
.mon .lv { color: var(--muted); font-weight: 500; }
.mon .moves { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.hp { height: 5px; background: #2e364c; border-radius: 4px; overflow: hidden; margin: 5px 0; }
.hp i { display: block; height: 100%; background: var(--good); }
.types { display: flex; gap: 3px; margin-top: 3px; flex-wrap: wrap; }
.type { font-size: 10px; padding: 1px 6px; border-radius: 4px; color: white; text-shadow: 0 1px 1px rgba(0,0,0,.4); font-weight: 600; }
.shiny { color: #ffd84d; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); position: relative; font-size: 13px; line-height: 1.4; }
.timeline li::before { content: ''; position: absolute; left: -5px; top: 11px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
.timeline .d { font-size: 11px; color: var(--muted); display: block; }

.bars div { display: grid; grid-template-columns: 96px 1fr 34px; align-items: center; gap: 8px; font-size: 12.5px; margin: 4px 0; }
.bar { height: 7px; background: #2e364c; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent-2); }
.bar.pos i { background: var(--good); }
.bar.neg i { background: var(--bad); }

.people-mini { display: flex; flex-direction: column; gap: 4px; }
.pm { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.pm:hover { background: var(--panel-2); }
.pm img { width: 32px; height: 32px; object-fit: contain; image-rendering: pixelated; }
.pm .n { font-weight: 600; font-size: 13px; }
.pm .j { color: var(--muted); font-size: 11.5px; }
.pm.dead .n { text-decoration: line-through; color: var(--muted); }
.link { color: #8fc1ff; cursor: pointer; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* Barra lateral */
#side { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
#tabs { display: flex; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
#tabs button { flex: 1; background: none; border: 0; padding: 12px 3px; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; font-size: 11.5px; white-space: nowrap; }
#tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab { display: none; flex: 1; overflow: auto; min-height: 0; flex-direction: column; }
.tab.active { display: flex; }
.pad { padding: 12px 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.chips button { background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--muted); }
.chips button.on { background: #2b3b5e; color: var(--text); border-color: #3d5486; }

#feed { list-style: none; margin: 0; padding: 0; }
#feed li { padding: 9px 14px; border-bottom: 1px solid #1f283b; line-height: 1.45; font-size: 13px; animation: feedIn .4s ease-out; }
#feed li.l0 { color: var(--muted); font-size: 12.5px; }
#feed li.l2 { background: rgba(61,125,202,.06); }
#feed li.l3 { background: rgba(255,203,5,.07); border-left: 3px solid var(--accent); font-weight: 500; }
#feed li .d { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
#feed li .acts { margin-top: 4px; display: flex; gap: 10px; font-size: 12px; }
@keyframes feedIn { from { background: rgba(255,203,5,.18); } }

.controls input[type=search], .controls select { width: 100%; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.controls .row { display: flex; gap: 6px; margin-top: 6px; }
.controls .row select { flex: 1; min-width: 0; }
.check { display: block; margin-top: 8px; color: var(--muted); font-size: 12.5px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-bottom: 1px solid #1f283b; cursor: pointer; }
.list li:hover { background: var(--panel-2); }
.list li img.tr { width: 40px; height: 40px; object-fit: contain; image-rendering: pixelated; flex: none; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { color: var(--muted); font-size: 12px; }
.list .r { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.badge-live { background: #c0392b; color: white; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; margin-right: 6px; animation: pulse 1.4s infinite; }
.icon-mon { width: 40px; height: 30px; background-repeat: no-repeat; image-rendering: pixelated; flex: none; }

.region-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; background: var(--panel-2); border-top: 4px solid var(--c); }
.region-card h3 { margin: 0 0 4px; display: flex; justify-content: space-between; align-items: baseline; }
.region-card h3 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.region-card .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12.5px; margin-top: 6px; }
.region-card .grid span { color: var(--muted); }
.meter { height: 6px; border-radius: 4px; background: #2e364c; overflow: hidden; margin-top: 3px; }
.meter i { display: block; height: 100%; }
.war-card { border: 1px solid #6b2c2c; background: #2a1618; border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.war-card.over { border-color: var(--line); background: var(--panel-2); opacity: .8; }
.rel-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.rel-table td, .rel-table th { padding: 4px; text-align: center; border: 1px solid var(--line); }
h3.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.legend-item { padding: 10px 12px; border: 1px solid #574d1c; background: #221f12; border-radius: 10px; margin-bottom: 8px; line-height: 1.45; }
.legend-item .d { font-size: 11px; color: #bba969; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-grid div { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; }
.stat-grid b { display: block; font-size: 20px; }
.stat-grid span { color: var(--muted); font-size: 11.5px; }
canvas.chart { width: 100%; height: 200px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; margin-top: 6px; }
.legend-row i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.admin-box { margin-top: 14px; padding: 10px; border: 1px dashed #8b2c2c; border-radius: 10px; }
.admin-box h4 { margin: 0 0 6px; color: #ff9d9d; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.admin-box input, .admin-box select { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; width: 90px; }

@media (max-width: 900px) {
  :root { --side-w: 100%; }
  #app { grid-template-columns: 1fr; grid-template-rows: var(--top-h) 1fr; }
  #side { position: fixed; top: var(--top-h); right: 0; bottom: 0; width: min(420px, 100%); z-index: 30; transform: translateX(100%); transition: transform .25s; }
  #side.open { transform: none; }
  .only-mobile { display: inline-block; }
  .stats-inline .pill:not(.live) { display: none; }
  .brand #worldName { display: none; }
  #minimap { width: 150px; height: 102px; }
  #card { bottom: 124px; }
  #topbar { padding: 0 10px; gap: 8px; }
}

/* Resumen del personaje */
.now { margin: 10px 0 8px; padding: 8px 10px; background: rgba(120,180,255,.10); border-left: 3px solid var(--accent-2); border-radius: 6px; font-size: 13px; line-height: 1.4; }
.now span { display: block; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.bio p { margin: 0 0 9px; font-size: 13.5px; line-height: 1.55; font-family: Georgia, 'Times New Roman', serif; }
.bio-team { display: flex; flex-wrap: wrap; gap: 2px; margin: 2px 0 6px; }
.bio-team .icon-mon.fainted { filter: grayscale(1); opacity: .5; }
/* Retrato sacado del charset del mapa (NPC sin retrato propio): primer fotograma, mirando al frente */
.chp { display: inline-block; aspect-ratio: 2 / 3; height: 32px; background-size: 400% 400%; background-position: 0 0; background-repeat: no-repeat; image-rendering: pixelated; flex: none; }
.card-head .portrait .chp { height: 80px; }
.list li .chp.tr { height: 40px; }
/* Vida interior en la ficha */
.inner { display: grid; gap: 3px; margin: 8px 0; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; }
.inner div { display: flex; gap: 8px; align-items: baseline; }
.inner span:first-child { flex: none; width: 108px; color: var(--muted); font-size: 11.5px; }
.inner small { color: var(--muted); }

/* ---------------------------------------------------------------- espectador */
.hide-m { }
#topbar .ghost.on { background: #3b3417; border-color: var(--accent); }
.follow-box { border-bottom: 1px solid var(--line); }
.follow-box summary { cursor: pointer; color: var(--muted); font-size: 12.5px; font-weight: 600; }
/* Personaje del jugador */
.mc-in { width: min(720px, 100%); }
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px 10px; }
.mc-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.mc-sp { width: 64px; height: 72px; display: grid; place-items: center; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; cursor: pointer; padding: 2px; }
.mc-sp.on { border-color: var(--accent); background: #2a2f1a; }
.mc-sp .chp { height: 60px; }
.mc-sp img { max-height: 64px; max-width: 60px; image-rendering: pixelated; }
.tag.gold { background: #3b3417; border-color: var(--accent); color: var(--accent); }
/* Mi equipo */
.tm-mode { display: flex; gap: 16px; margin: 4px 0 6px; font-size: 14px; }
.tm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 55vh; overflow: auto; }
.tm-mon { position: relative; display: flex; align-items: center; gap: 6px; text-align: left; padding: 6px 8px; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; color: var(--text); cursor: pointer; }
.tm-mon.on { border-color: var(--accent); background: #2a2f1a; }
.tm-mon:disabled { cursor: default; opacity: .75; }
.tm-mon.dis { opacity: .4; }
.tm-mon .tm-t { display: flex; flex-direction: column; min-width: 0; }
.tm-mon .tm-t b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-mon .tm-t small { color: var(--muted); font-size: 11px; }
.tm-n { position: absolute; top: -7px; left: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #1a1400; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
/* Empresas */
.companies { display: grid; gap: 6px; }
.company { padding: 7px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 9px; font-size: 13px; }
.company summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 2px 6px; align-items: baseline; }
.company summary .sub { flex-basis: 100%; }
.company .staff { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; }
/* Necesidades */
.nbar { display: inline-block; width: 80px; height: 7px; border-radius: 4px; background: #1b2336; overflow: hidden; vertical-align: middle; }
.nbar i { display: block; height: 100%; }
/* Leyes de cada región */
.laws { display: flex; flex-wrap: wrap; gap: 4px; }
.law { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: #22304a; border: 1px solid #34466b; text-decoration: none !important; white-space: nowrap; }
/* Tier de Smogon */
.tier { display: inline-block; font-size: 10.5px; font-weight: 700; padding: 0 6px; border-radius: 4px; background: #2a3550; border: 1px solid #3c4d74; cursor: help; }
/* Explicaciones (por qué la aprobación/estabilidad...) */
.why { cursor: help; }
span.why { text-decoration: underline dotted rgba(255,255,255,.35); text-underline-offset: 3px; }
#tipBox { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(520px, calc(100vw - 24px)); max-height: 60vh; overflow: auto; z-index: 100; white-space: pre-line; background: rgba(22,29,44,.98); border: 1px solid #4a5a82; border-left: 4px solid var(--accent-2); border-radius: 12px; padding: 12px 14px; font-size: 13.5px; line-height: 1.45; box-shadow: 0 14px 40px rgba(0,0,0,.6); cursor: pointer; }
/* Rasgos de personalidad */
.quirks { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 2px; }
.quirk { font-size: 12px; padding: 3px 8px; border-radius: 999px; background: #22304a; border: 1px solid #34466b; cursor: help; white-space: nowrap; }
.quirk:hover { background: #2c3d5e; border-color: var(--accent-2); }
.ed-quirks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 10px; }
.ed-q { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: help; padding: 2px 0; }
/* Editor de admin */
.edit-in { width: min(820px, 100%); }
.ed-h { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 10px; }
.ed-f { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.ed-f.wide { grid-column: 1 / -1; }
.ed-f input, .ed-f select, .ed-stats input { background: var(--panel-2); border: 1px solid var(--line); border-radius: 7px; padding: 6px 8px; color: var(--text); font-size: 13px; min-width: 0; width: 100%; }
.ed-mon { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: var(--panel-2); }
.ed-mon summary { cursor: pointer; font-size: 13.5px; }
.ed-mon[open] summary { margin-bottom: 8px; }
.ed-mon .ed-f input, .ed-mon .ed-f select, .ed-mon .ed-stats input { background: var(--panel); }
.ed-stats { display: grid; grid-template-columns: 120px repeat(6, 1fr); gap: 6px; align-items: end; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.ed-stats label { display: flex; flex-direction: column; gap: 2px; }
.ed-del { margin-top: 8px; font-size: 12.5px; }
.ed-foot { position: sticky; bottom: -12px; display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 10px 0 4px; background: var(--panel); border-top: 1px solid var(--line); margin-top: 10px; }
.ed-foot #edMsg { margin-right: auto; }
@media (max-width: 600px) { .ed-stats { grid-template-columns: repeat(3, 1fr); } .ed-stats > span { grid-column: 1 / -1; } .ed-grid { grid-template-columns: 1fr 1fr; } }
.nl-box { margin-top: 10px; padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.nl-box .nl-h { font-weight: 700; margin-bottom: 3px; }
.nl-box a.sub { display: inline-block; margin-top: 6px; color: var(--muted); }
.nl-form { display: flex; gap: 6px; margin-top: 8px; }
.nl-form input { flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; color: var(--text); }
#nlMsg { margin-top: 6px; }
.tree-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
svg.tree .tl { fill: none; stroke: #4a5a82; stroke-width: 1.5; }
svg.tree .tp { stroke: #d86a9a; stroke-width: 2; stroke-dasharray: 4 3; }
svg.tree .tn { cursor: pointer; }
svg.tree .tn rect { fill: #1d2638; stroke: #3a4a6e; }
svg.tree .tn.f rect { stroke: #b0608a; }
svg.tree .tn.root rect { stroke: var(--accent); stroke-width: 2; }
svg.tree .tn.dead rect { fill: #221c24; }
svg.tree .tn:hover rect { fill: #2b3a5c; }
svg.tree text { fill: var(--text); font-size: 11px; font-family: var(--font); }
svg.tree .nm { font-weight: 700; font-size: 12px; }
svg.tree .jb, svg.tree .dt { fill: var(--muted); }
.modal { position: absolute; inset: 0; background: rgba(5,8,14,.72); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal-in { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; width: min(940px, 100%); max-height: 100%; overflow: auto; }
.modal-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.modal-head .close { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel-2); font-size: 18px; }
#histCanvas { width: 100%; height: auto; border-radius: 10px; background: #10345e; image-rendering: pixelated; }
.hist-ctrl { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.hist-ctrl input { flex: 1; }
#cineCap { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 19; max-width: min(760px, 92%); background: rgba(10,14,22,.82); border: 1px solid #3b4a6b; border-radius: 12px; padding: 10px 16px; font-size: 15px; line-height: 1.4; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
#app.cinema { grid-template-columns: 1fr 0; }
#app.cinema #side, #app.cinema #card, #app.cinema #minimap, #app.cinema .stats-inline { display: none !important; }
.bet-me { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; }
.bet-me b { font-size: 22px; color: var(--accent); }
.bet-me input { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; width: 150px; margin-left: 6px; }
.bet { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--panel-2); }
.bet.closed { opacity: .8; }
.bet h4 { margin: 0 0 4px; font-size: 13.5px; }
.bet-opt { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid #25304a; font-size: 13px; }
.bet-opt span:first-child { flex: 1; }
.bet-opt.win span:first-child { color: var(--good); font-weight: 700; }
.bet-opt .btn { padding: 3px 9px; }
ol.board { margin: 0; padding-left: 20px; }
ol.board li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #1f283b; font-size: 13px; cursor: pointer; }
ol.board li b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Móvil: ficha como hoja inferior, botones más grandes */
@media (max-width: 900px) {
  .hide-m { display: none; }
  #card { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 62vh; border-radius: 16px 16px 0 0; }
  #card .close { width: 36px; height: 36px; }
  .btn, .subtabs button, .chips button { min-height: 34px; }
  #tabs button { padding: 12px 10px; }
  .top-actions { gap: 4px; }
  .top-actions .ghost { padding: 5px 7px; }
  .team { grid-template-columns: 1fr 1fr; }
  #cineCap { bottom: 14px; font-size: 13px; }
  .modal { padding: 6px; }
  /* Barra superior: iconos; el panel (☰) primero y siempre a la vista; el resto se desliza si no cabe */
  #topbar { gap: 6px; padding: 0 8px; }
  .top-actions { min-width: 0; overflow-x: auto; scrollbar-width: none; flex: 0 1 auto; }
  .top-actions::-webkit-scrollbar { display: none; }
  .top-actions > * { flex: none; }
  #btnPanel { order: -1; background: var(--accent); color: #1a1400; border-color: var(--accent); font-weight: 700; }
  #clock { gap: 6px; font-size: 12.5px; padding: 4px 8px; }
  #userPill { max-width: 36px; overflow: hidden; white-space: nowrap; padding: 4px 8px; flex: none; }
}
@media (max-width: 480px) {
  #season, .stats-inline .live, .brand { display: none; }
  #btnHelp { display: none; }
  /* pestañas del panel en dos filas en vez de una tira que se sale de la pantalla */
  #tabs { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; }
  #tabs button { padding: 10px 2px; font-size: 12px; }
  /* filtros de personas: región y oficio a lo ancho, orden debajo */
  #tab-people .controls .row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  #tab-people .controls .row select:last-child { grid-column: 1 / 3; }
  #tab-people .controls select { min-width: 0; width: 100%; }
}
