/* Layout: columna de expediente de 1180px — cabecera con controles, resumen, tarjetas, tabla y paneles */
:root {
  --ink: #0f1514;        /* fondo: tinta verdosa de bar clandestino */
  --panel: #161f1d;
  --panel-2: #1c2725;
  --line: #2a3835;
  --fg: #e6dfcf;         /* papel envejecido */
  --muted: #8f978f;
  --brass: #c9a35b;      /* latón art déco */
  --brass-dim: #7d6638;
  --win: #6fbf8a;
  --loss: #d0695c;
  --display: "Marcellus SC", "Trajan Pro", Georgia, serif;
  --body: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }
body {
  background: var(--ink);
  background-image: radial-gradient(ellipse at 50% -10%, #1f2d2a 0%, transparent 60%);
  background-attachment: fixed;
  color: var(--fg);
  font: 16px/1.45 var(--body);
  padding-inline: 16px;
  padding-block: 28px 64px;
  min-height: 100vh;
}
.wrap { max-width: 1180px; margin: 0 auto; display: grid; gap: 28px; }
main { display: grid; gap: 28px; min-width: 0; }
.wrap > *, main > * { min-width: 0; }
img { max-width: 100%; }
a { color: var(--brass); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 12px; }
.good { color: var(--win); }
.bad { color: var(--loss); }

/* Cabecera */
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 18px; position: relative; }
.top::after { content: ""; position: absolute; left: 0; bottom: -4px; width: 120px; height: 3px; background: repeating-linear-gradient(90deg, var(--brass) 0 18px, transparent 18px 24px); }
.brand { display: grid; gap: 4px; text-decoration: none; color: var(--fg); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
.title { font-family: var(--display); font-size: clamp(32px, 5.5vw, 52px); line-height: 1; letter-spacing: .02em; }
.controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.field { display: grid; gap: 4px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
select { background: var(--panel); border: 1px solid var(--line); padding: 8px 10px; border-radius: 2px; font-size: 15px; letter-spacing: 0; text-transform: none; }
.updated { font-family: var(--mono); font-size: 12px; color: var(--muted); padding-bottom: 10px; }
.btn { background: transparent; border: 1px solid var(--brass-dim); color: var(--brass); padding: 9px 16px; border-radius: 2px; cursor: pointer; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; }
.btn:hover { background: var(--brass); color: var(--ink); }
.btn:disabled { opacity: .5; cursor: progress; }
.notice { margin: 0; color: var(--loss); font-size: 14px; }

/* Secciones */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
h2 { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0; letter-spacing: .03em; text-wrap: balance; }
h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--brass); font-weight: 600; }
.section-head h3 { margin: 0; }
.section-head .muted { font-size: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); padding: 18px; min-width: 0; }

/* Resumen */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat { background: var(--panel); padding: 14px 16px; display: grid; gap: 2px; align-content: start; min-width: 0; }
.stat .k { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat .v { font-family: var(--display); font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .v small { font-family: var(--body); font-size: 14px; color: var(--muted); }
.stat .d { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tarjetas de jugador */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.card { display: grid; gap: 12px; align-content: start; background: var(--panel); border: 1px solid var(--line); padding: 14px; color: var(--fg); text-decoration: none; min-width: 0; }
.card:hover { border-color: var(--brass-dim); background: var(--panel-2); }
.card-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.card-name { min-width: 0; display: grid; }
.card-name b { font-size: 18px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-name > span { font-size: 13px; color: var(--muted); }
.card-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.card-stats > span { display: grid; }
.card-stats b { font-family: var(--mono); font-weight: 500; font-size: 15px; font-variant-numeric: tabular-nums; }
.card-stats small { font-size: 11px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.card-hero { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.card-hero img { width: 24px; height: 24px; border-radius: 2px; }
.avatar { width: 44px; height: 44px; border-radius: 2px; background: var(--line); flex: none; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; }
.avatar.lg { width: 84px; height: 84px; }
.rank { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rank img { width: 38px; height: 38px; object-fit: contain; flex: none; }
.rank b { font-weight: 600; display: block; white-space: nowrap; }
.rank span span { font-size: 12px; color: var(--muted); }
.form { display: flex; gap: 3px; flex-wrap: wrap; }
.pip { width: 10px; height: 18px; border-radius: 1px; background: var(--line); }
.pip.w { background: var(--win); }
.pip.l { background: var(--loss); }

/* Tablas */
.table-wrap { overflow-x: auto; min-width: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.r { text-align: right; }
.hcell { display: flex; align-items: center; gap: 8px; }
.hcell img { width: 26px; height: 26px; border-radius: 2px; }
.compare { background: var(--panel); border: 1px solid var(--line); }
.compare td, .compare th { font-family: var(--mono); font-size: 13px; }
.compare th { font-family: var(--body); font-size: 11px; }
.compare .sticky { position: sticky; left: 0; background: var(--panel); z-index: 1; border-right: 1px solid var(--line); font-family: var(--body); }
.compare .who { display: flex; align-items: center; gap: 8px; color: var(--fg); text-decoration: none; font-weight: 600; font-size: 15px; }
.compare .who:hover { color: var(--brass); }
.sortable { cursor: pointer; user-select: none; }
.sortable:hover, .sortable.on { color: var(--brass); }
td.lead { color: var(--brass); font-weight: 500; background: color-mix(in srgb, var(--brass) 10%, transparent); }
.res { font-family: var(--mono); font-weight: 500; font-size: 13px; padding: 2px 6px; border-radius: 2px; }
.res.w { color: var(--win); background: color-mix(in srgb, var(--win) 14%, transparent); }
.res.l { color: var(--loss); background: color-mix(in srgb, var(--loss) 14%, transparent); }
.tag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--brass); border: 1px solid var(--brass-dim); padding: 1px 5px; border-radius: 2px; font-family: var(--body); }

/* Partidas juntos */
.together { display: grid; gap: 6px; }
.tmatch { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); padding: 10px 14px; }
.tmatch .when { font-family: var(--mono); font-size: 12px; color: var(--muted); line-height: 1.3; }
.tmatch .mates { display: flex; gap: 6px 14px; flex-wrap: wrap; min-width: 0; }
.mate { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.mate img { width: 26px; height: 26px; border-radius: 2px; }
.mate .kda { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.vs { font-size: 11px; letter-spacing: .1em; color: var(--loss); text-transform: uppercase; }

/* Ficha de jugador */
.back { text-decoration: none; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; justify-self: start; }
.phead { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.phead-main { flex: 1 1 260px; min-width: 0; display: grid; gap: 8px; }
.phead h2 { font-size: clamp(30px, 5vw, 44px); line-height: 1; overflow-wrap: anywhere; }
.phead-meta { display: flex; gap: 8px 18px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.group { background: var(--panel); border: 1px solid var(--line); padding: 16px 18px; }
.group dl { margin: 0; display: grid; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.split > div { min-width: 0; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.sw.w { background: var(--win); }
.sw.l { background: var(--loss); }
.loading { color: var(--muted); font-family: var(--mono); font-size: 13px; margin: 0; }

/* Gráficos */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--muted); font: 11px var(--mono); }
.chart .line { fill: none; stroke: var(--brass); stroke-width: 2; stroke-linejoin: round; }
.chart .area { fill: color-mix(in srgb, var(--brass) 14%, transparent); }
.chart .dot-end { fill: var(--brass); stroke: var(--panel); stroke-width: 2; }
.chart .label-end { fill: var(--fg); font: 500 12px var(--mono); }
.chart .bar-w { fill: var(--win); }
.chart .bar-l { fill: var(--loss); }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .hit:hover { fill: color-mix(in srgb, var(--fg) 5%, transparent); }
.chart .crosshair { stroke: var(--muted); stroke-dasharray: 3 3; opacity: 0; }
.chart .crosshair.on { opacity: 1; }
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 160px) 1fr 56px; gap: 10px; align-items: center; font-size: 14px; }
.hbar-label { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 12px; background: var(--ink); border-radius: 2px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--brass); border-radius: 0 3px 3px 0; }
.hbar-val { font-family: var(--mono); font-size: 13px; text-align: right; }
.spread-cell { width: 34%; min-width: 140px; }
.spread { position: relative; display: block; height: 10px; background: var(--ink); border-radius: 2px; }
.spread-band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--brass) 45%, transparent); border-radius: 2px; }
.spread-med { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--fg); }
.tip { position: fixed; left: 0; top: 0; z-index: 10; pointer-events: none; background: var(--fg); color: var(--ink); padding: 8px 10px; border-radius: 2px; font-size: 13px; line-height: 1.35; max-width: 260px; box-shadow: 0 6px 20px rgb(0 0 0 / .4); }

/* Ítems y personas */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.item { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; background: var(--ink); border: 1px solid var(--line); padding: 8px; min-width: 0; }
.item img, .item-ph { grid-row: 1 / 3; width: 40px; height: 40px; object-fit: contain; background: var(--panel-2); border-radius: 2px; }
.item-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-meta { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.people { display: grid; gap: 4px; }
.person { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--ink); border: 1px solid var(--line); color: var(--fg); text-decoration: none; min-width: 0; }
a.person:hover { border-color: var(--brass-dim); }
.pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.pmeta { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

/* Vacío */
.empty { border: 1px dashed var(--line); padding: 32px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty b { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--fg); }
footer { color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); padding-top: 16px; max-width: 80ch; }

@media (max-width: 640px) {
  .tmatch { grid-template-columns: 1fr auto; }
  .tmatch .when { grid-column: 1 / 3; }
  .hbar { grid-template-columns: 100px 1fr 48px; }
  .avatar.lg { width: 64px; height: 64px; }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .person, .tmatch { transition: border-color .15s, background .15s; }
}

/* ===== Fondo del héroe principal ===== */
:root { --slot-weapon: #d08b3a; --slot-vitality: #6fae4f; --slot-spirit: #9b6fd0; }
.card.has-bg, .phead.has-bg { position: relative; isolation: isolate; overflow: hidden; }
.card.has-bg::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--hero-bg) right top / auto 135% no-repeat;
  opacity: .5;
  -webkit-mask-image: linear-gradient(90deg, transparent 15%, #000 85%);
  mask-image: linear-gradient(90deg, transparent 15%, #000 85%);
}
.card.has-bg::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, var(--panel) 0%, transparent 55%); }
.card.has-bg:hover::before { opacity: .65; }
.phead.has-bg { padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.phead.has-bg::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--hero-bg) center 30% / cover no-repeat;
  opacity: .35;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 70%);
}

/* ===== Tarjetas de partida ===== */
.mcards { display: grid; gap: 8px; }
.mcard {
  display: grid; grid-template-columns: 120px minmax(170px, 1fr) minmax(0, auto) minmax(220px, 1.3fr) 32px;
  gap: 16px; align-items: center; background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--loss); padding: 12px 0 12px 14px; min-width: 0;
}
.mcard.win { border-left-color: var(--win); }
.mc-res { display: grid; gap: 1px; font-size: 13px; }
.mc-res b { font-size: 16px; }
.mcard.win .mc-mode, .mcard.win .mc-res b { color: var(--win); }
.mcard.loss .mc-mode, .mcard.loss .mc-res b { color: var(--loss); }
.mc-mode { font-weight: 700; font-size: 14px; }
.mc-sep { height: 1px; background: var(--line); margin: 6px 0; }
.mc-hero { display: grid; grid-template-columns: 52px 1fr; gap: 4px 12px; align-items: center; min-width: 0; }
.mc-hero-img { width: 52px; height: 52px; border-radius: 2px; object-fit: cover; background: var(--line); }
.mc-kda { display: grid; }
.mc-kda b { font-size: 20px; font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.mc-kda span { font-size: 13px; }
.mc-line { grid-column: 1 / 3; display: flex; gap: 4px 12px; flex-wrap: wrap; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 6px; }
.mc-build { display: grid; gap: 8px; }
.build { display: grid; grid-template-columns: repeat(6, 30px); gap: 4px; }
.build.row { grid-template-columns: repeat(12, 26px); }
.ic { position: relative; width: 30px; height: 30px; border-radius: 3px; background: var(--ink); border: 1px solid var(--line); display: inline-grid; place-items: center; overflow: hidden; }
.build.row .ic { width: 26px; height: 26px; }
.ic img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }
.ic.vacant { border-style: dashed; background: transparent; }
.ic.slot-weapon { background: color-mix(in srgb, var(--slot-weapon) 35%, var(--ink)); border-color: color-mix(in srgb, var(--slot-weapon) 60%, transparent); }
.ic.slot-vitality { background: color-mix(in srgb, var(--slot-vitality) 35%, var(--ink)); border-color: color-mix(in srgb, var(--slot-vitality) 60%, transparent); }
.ic.slot-spirit { background: color-mix(in srgb, var(--slot-spirit) 35%, var(--ink)); border-color: color-mix(in srgb, var(--slot-spirit) 60%, transparent); }
.ic.sold { opacity: .35; }
.ic small { position: absolute; right: 1px; bottom: 0; font: 500 9px var(--mono); color: var(--fg); text-shadow: 0 0 3px #000, 0 0 3px #000; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 2px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.gold { color: var(--brass); border-color: var(--brass-dim); }
.mc-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; min-width: 0; font-size: 13px; }
.mc-teams > div { display: grid; gap: 2px; min-width: 0; }
.tp { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tp img { width: 16px; height: 16px; border-radius: 2px; flex: none; }
.pn { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pn:hover { color: var(--fg); text-decoration: underline; }
.pn.squad { color: var(--fg); }
.pn.self { color: var(--brass); font-weight: 600; }
.mc-open { align-self: stretch; display: grid; place-items: center; color: var(--muted); text-decoration: none; font-size: 26px; border-left: 1px solid var(--line); }
.mc-open:hover { color: var(--brass); background: var(--panel-2); }
.btn.more { justify-self: center; margin-top: 6px; }
a.tmatch { color: var(--fg); text-decoration: none; }
a.tmatch:hover { border-color: var(--brass-dim); }

@media (max-width: 1000px) {
  .mcard { grid-template-columns: 110px 1fr 32px; }
  .mc-build, .mc-teams { grid-column: 1 / 3; }
  .mc-open { grid-column: 3; grid-row: 1 / 4; }
}
@media (max-width: 560px) {
  .mcard { grid-template-columns: 1fr 32px; }
  .mc-res, .mc-hero, .mc-build, .mc-teams { grid-column: 1; }
  .mc-open { grid-column: 2; grid-row: 1 / 5; }
  .build { grid-template-columns: repeat(6, 1fr); }
  .build .ic { width: 100%; height: auto; aspect-ratio: 1; }
}

/* ===== Ficha de partida ===== */
.mhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.mhead > div:first-child { display: grid; gap: 4px; }
.mscore { display: flex; gap: 10px; flex-wrap: wrap; }
.mscore > div { display: grid; background: var(--panel); border: 1px solid var(--line); padding: 10px 14px; min-width: 150px; }
.mscore span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; }
.mscore b { font-family: var(--mono); font-size: 20px; color: var(--fg); font-weight: 500; }
.mscore small { font-size: 12px; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 16px; cursor: pointer; color: var(--muted); font-weight: 600; letter-spacing: .04em; white-space: nowrap; }
.tab:hover { color: var(--fg); }
.tab.on { color: var(--brass); border-bottom-color: var(--brass); }
.thead-team { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.thead-team b { font-family: var(--display); font-weight: 400; font-size: 20px; letter-spacing: .03em; }
.mtable td, .mtable th { font-size: 13px; }
.mtable td { font-family: var(--mono); }
.mtable .sticky { position: sticky; left: 0; background: var(--panel); z-index: 1; font-family: var(--body); max-width: 220px; }
.mtable .hcell .pn { max-width: 140px; }
.mtable small { font-size: 11px; }
.dbar { display: inline-block; width: 70px; height: 6px; background: var(--ink); border-radius: 2px; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.dbar span { display: block; height: 100%; background: var(--brass); }
.tag.bad { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 50%, transparent); }
.lanes { display: grid; gap: 10px; }
.lane-sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.lane-p { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.lane-p img { width: 26px; height: 26px; border-radius: 2px; }
.lane-p .mono { width: 100%; padding-left: 34px; color: var(--muted); }
.buys { display: grid; gap: 8px; }
.buy-row { display: grid; grid-template-columns: 190px 1fr; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.buy-row .hcell { min-width: 0; }
.buy-line { display: flex; flex-wrap: wrap; gap: 4px; }
.buy-line .ic { width: 34px; height: 34px; }
.chart .grid.zero { stroke: var(--muted); }
@media (max-width: 640px) { .buy-row { grid-template-columns: 1fr; } }

/* ===== Actividad ===== */
.heat { display: grid; gap: 3px; align-items: center; }
.heat-day { font-size: 11px; color: var(--muted); }
.heat-c { aspect-ratio: 1; border-radius: 2px; background: var(--ink); border: 1px solid var(--line); min-width: 0; }
.heat-c.w { background: var(--win); border-color: var(--win); }
.heat-c.l { background: var(--loss); border-color: var(--loss); }
.heat-c.e { background: var(--brass); border-color: var(--brass); }
.heat-c.future { opacity: .3; }
.sw.e { background: var(--brass); }
.people-split { grid-template-columns: 1fr; }

/* ===== Fondo: abanico art déco de latón sobre tinta, rombos tenues y viñeta ===== */
body { background: var(--ink); }
body::before, body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1; }
body::before {
  background:
    radial-gradient(ellipse 70% 45% at 50% -8%, rgb(201 163 91 / .22), transparent 70%),
    repeating-conic-gradient(from -90deg at 50% -12%, rgb(201 163 91 / .07) 0deg 1.2deg, transparent 1.2deg 7.5deg),
    radial-gradient(ellipse 90% 60% at 50% 115%, rgb(46 104 92 / .28), transparent 65%);
  -webkit-mask-image: linear-gradient(#000 0%, rgb(0 0 0 / .45) 55%, rgb(0 0 0 / .2) 100%);
  mask-image: linear-gradient(#000 0%, rgb(0 0 0 / .45) 55%, rgb(0 0 0 / .2) 100%);
}
body::after {
  background:
    radial-gradient(ellipse at 50% 40%, transparent 55%, rgb(0 0 0 / .55) 100%),
    linear-gradient(45deg, transparent 48.5%, rgb(201 163 91 / .045) 49.5% 50.5%, transparent 51.5%) 0 0 / 56px 56px,
    linear-gradient(-45deg, transparent 48.5%, rgb(201 163 91 / .045) 49.5% 50.5%, transparent 51.5%) 0 0 / 56px 56px;
}

/* ===== Navegación ===== */
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-top: -12px; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; font-size: 13px; padding: 8px 14px; border: 1px solid transparent; border-radius: 2px; }
.nav a:hover { color: var(--fg); border-color: var(--line); }
.nav a.on { color: var(--ink); background: var(--brass); border-color: var(--brass); }

/* ===== Casilleros de ítems: medidas fijas para que los vacíos no se estiren ===== */
.build { grid-template-columns: repeat(6, 30px); grid-auto-rows: 30px; align-content: start; }
.build > .ic { width: 30px; height: 30px; min-height: 0; }
.build-row { display: grid; grid-template-columns: repeat(6, 26px); grid-auto-rows: 26px; gap: 3px; width: max-content; }
.build-row .ic { width: 26px; height: 26px; }
.cell-chips { flex-wrap: wrap; width: 230px; white-space: normal; }
.mtable td:has(.build-row) { min-width: 180px; }
@media (max-width: 560px) {
  .build { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: auto; }
  .build > .ic { width: auto; height: auto; aspect-ratio: 1; }
}

/* ===== Equipos ===== */
.team0 { --team-c: #e3a23e; }
.team1 { --team-c: #6aa6ea; }
.team-logo { height: 30px; width: auto; max-width: 200px; object-fit: contain; filter: drop-shadow(0 0 8px var(--team-c)) drop-shadow(0 0 2px var(--team-c)); }
.team-logo.sm { height: 20px; max-width: 130px; }
.thead-team { align-items: center; }
.mscore > div { gap: 4px; border-top: 3px solid var(--team-c); }

/* ===== Destacados ===== */
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px; }
.award { display: grid; gap: 3px; background: var(--ink); border: 1px solid var(--line); padding: 8px 10px; min-width: 0; }
.award.squad { border-color: var(--brass-dim); background: color-mix(in srgb, var(--brass) 8%, var(--ink)); }
.award-k { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.award-p { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 14px; }
.award-p img { width: 20px; height: 20px; border-radius: 2px; }
.award b { font-family: var(--mono); font-weight: 500; font-size: 16px; }
.chip.rank1 { color: var(--ink); background: var(--brass); border-color: var(--brass); font-weight: 600; }
.chip.rank2 { color: var(--fg); border-color: #b9bcc0; }
.chip.rank3 { color: #d9a27a; border-color: #8a5a3a; }
.chips.nowrap { flex-wrap: nowrap; }

/* ===== Guía ===== */
.ghead { display: grid; gap: 4px; }
.ghead .sub { color: var(--muted); max-width: 70ch; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input { flex: 1 1 220px; min-width: 0; background: var(--panel); border: 1px solid var(--line); padding: 9px 12px; border-radius: 2px; }
.seg { display: flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 2px; overflow: hidden; }
.seg button, .seg a { background: var(--panel); border: 0; border-right: 1px solid var(--line); color: var(--muted); padding: 8px 12px; cursor: pointer; font-size: 14px; text-decoration: none; white-space: nowrap; }
.seg > :last-child { border-right: 0; }
.seg button:hover, .seg a:hover { color: var(--fg); }
.seg .on { background: var(--brass); color: var(--ink); font-weight: 600; }
.seg.wide { margin-bottom: 12px; }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.hcard { position: relative; isolation: isolate; overflow: hidden; display: grid; align-content: end; gap: 4px; min-height: 230px; padding: 12px; border: 1px solid var(--line); color: var(--fg); text-decoration: none; background: var(--panel); }
.hcard::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--hero-bg) center top / cover no-repeat; transition: transform .25s; }
.hcard::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(0deg, var(--ink) 18%, rgb(15 21 20 / .6) 45%, transparent 75%); }
.hcard:hover { border-color: var(--brass-dim); }
.hcard:hover::before { transform: scale(1.04); }
.hcard-top b { font-family: var(--display); font-weight: 400; font-size: 20px; display: block; line-height: 1.1; }
.hcard-top small { color: var(--muted); font-size: 12px; }
.hcard-type { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); }
.hcard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-family: var(--mono); font-size: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
.hcard-stats small { display: block; font-family: var(--body); font-size: 10px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.hhero { position: relative; isolation: isolate; overflow: hidden; display: flex; gap: 20px; align-items: flex-end; flex-wrap: wrap; padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.hhero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--hero-bg) center 25% / cover no-repeat; opacity: .35; -webkit-mask-image: linear-gradient(90deg, transparent, #000 60%); mask-image: linear-gradient(90deg, transparent, #000 60%); }
.hhero-card { width: 150px; max-width: 40%; border: 1px solid var(--brass-dim); }
.hhero-main { flex: 1 1 320px; min-width: 0; display: grid; gap: 6px; }
.hhero-main h2 { font-size: clamp(32px, 5vw, 48px); }
.hhero-main h2 small { font-family: var(--body); font-size: 18px; }
.hhero-main p { margin: 0; max-width: 70ch; }
.hhero-role { color: var(--brass); font-size: 18px; }
.kvgrid { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); column-gap: 20px; }
.abilities { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; }
.ability { background: var(--ink); border: 1px solid var(--line); padding: 14px; display: grid; gap: 8px; align-content: start; }
.ability-head { display: flex; gap: 10px; align-items: center; }
.ability-head img { width: 48px; height: 48px; border-radius: 4px; background: var(--panel-2); padding: 4px; }
.ability-head b { display: block; font-size: 18px; }
.ability p { margin: 0; font-size: 14px; color: var(--muted); }
.hl { color: var(--fg); font-weight: 600; }
.tiers { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 13px; }
.tiers li { display: flex; gap: 8px; align-items: baseline; }
.tier-n { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border: 1px solid var(--brass-dim); color: var(--brass); font: 500 11px var(--mono); border-radius: 50%; }
.aorder { display: grid; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.aorder:last-child { border-bottom: 0; }
.aorder-head { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.aorder-seq { display: flex; gap: 3px; flex-wrap: wrap; }
.aseq { position: relative; width: 30px; height: 30px; background: var(--ink); border: 1px solid var(--line); border-radius: 3px; }
.aseq img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.aseq small { position: absolute; right: 1px; bottom: -1px; font: 500 9px var(--mono); text-shadow: 0 0 3px #000; }
.callout { border-left: 3px solid var(--brass); padding: 8px 12px; background: color-mix(in srgb, var(--brass) 8%, transparent); margin: 0 0 12px; }
.gbuild { display: grid; gap: 14px; }
.gbuild-sum { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 14px; }
.slotpill { font-size: 12px; padding: 2px 8px; border-radius: 2px; border: 1px solid var(--slot-c); color: var(--slot-c); }
.slotpill.slot-weapon { --slot-c: var(--slot-weapon); }
.slotpill.slot-vitality { --slot-c: var(--slot-vitality); }
.slotpill.slot-spirit { --slot-c: var(--slot-spirit); }
.gphase { display: grid; gap: 8px; }
.gphase-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 14px; }
.gitems { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.bitem { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center; padding: 6px; background: var(--ink); border: 1px solid var(--line); border-left: 3px solid var(--slot-c, var(--line)); min-width: 0; }
.bitem.slot-weapon { --slot-c: var(--slot-weapon); }
.bitem.slot-vitality { --slot-c: var(--slot-vitality); }
.bitem.slot-spirit { --slot-c: var(--slot-spirit); }
.bitem img { grid-row: 1 / 3; width: 38px; height: 38px; object-fit: contain; border-radius: 3px; background: color-mix(in srgb, var(--slot-c) 30%, var(--ink)); padding: 3px; }
.bitem-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bitem-meta { font: 12px var(--mono); color: var(--muted); }
.tips { margin: 0; padding-left: 18px; display: grid; gap: 8px; }
.tips li::marker { color: var(--brass); }
.bad-tips li::marker { color: var(--loss); }
.prio { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.prio li::marker { color: var(--brass); font-family: var(--mono); }
h3.mt { margin-top: 18px; }
.split.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.cbuilds { display: grid; gap: 6px; }
.cbuild { border: 1px solid var(--line); background: var(--ink); }
.cbuild.open { border-color: var(--brass-dim); }
.cbuild-head { width: 100%; display: flex; gap: 12px; align-items: center; background: none; border: 0; padding: 10px 12px; cursor: pointer; text-align: left; }
.cbuild-n { font-family: var(--display); font-size: 20px; color: var(--brass); width: 24px; }
.cbuild-title { flex: 1; min-width: 0; display: grid; }
.cbuild-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cbuild-arrow { font-size: 20px; color: var(--muted); }
.cbuild-body { padding: 0 12px 14px; display: grid; gap: 12px; }
.cbuild-desc { margin: 0; font-size: 14px; color: var(--muted); max-width: 90ch; }
.igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; align-items: start; }
.icard { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--slot-c, var(--line)); }
.icard.slot-weapon { --slot-c: var(--slot-weapon); }
.icard.slot-vitality { --slot-c: var(--slot-vitality); }
.icard.slot-spirit { --slot-c: var(--slot-spirit); }
.icard.open { grid-column: span 2; }
@media (max-width: 640px) { .icard.open { grid-column: auto; } }
.icard-head { width: 100%; display: flex; gap: 10px; align-items: center; background: none; border: 0; padding: 10px; cursor: pointer; text-align: left; }
.icard-head img { width: 44px; height: 44px; object-fit: contain; border-radius: 4px; background: color-mix(in srgb, var(--slot-c) 30%, var(--ink)); padding: 4px; flex: none; }
.icard-title { flex: 1; min-width: 0; display: grid; }
.icard-title b { font-size: 16px; }
.icard-title small { color: var(--muted); font-size: 12px; }
.icard-wr { display: grid; text-align: right; font: 14px var(--mono); }
.icard-wr small { font-size: 11px; color: var(--muted); }
.istats { list-style: none; margin: 0; padding: 0 12px 10px; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.istats b { color: var(--fg); font-family: var(--mono); font-weight: 500; }
.icard-body { padding: 0 12px 12px; display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.ipart p { margin: 6px 0; font-size: 14px; color: var(--muted); }
.ipart .istats { padding: 0; }
/* Ramas lado a lado, cada una con su propio scroll (como la tienda del juego) */
.sticky-filters { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: color-mix(in srgb, var(--ink) 92%, transparent); padding-block: 10px; backdrop-filter: blur(6px); }
.icats { display: grid; gap: 12px; align-items: start; }
.icats.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.icats.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.icat { display: flex; flex-direction: column; min-width: 0; background: color-mix(in srgb, var(--panel) 70%, transparent); border: 1px solid var(--line); }
.icat-body { overflow-y: auto; max-height: calc(100vh - 230px); min-height: 360px; padding: 12px; display: grid; gap: 14px; align-content: start; overscroll-behavior: contain; }
.icats.cols-2 .igrid, .icats.cols-3 .igrid { grid-template-columns: minmax(0, 1fr); }
.icats.cols-2 .icard.open, .icats.cols-3 .icard.open { grid-column: auto; }
@media (max-width: 900px) {
  .icats.cols-2, .icats.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .icat-body { max-height: 65vh; }
}
.icat { gap: 0; }

/* ===== Colores por rol de héroe ===== */
:root { --role-marksman: #e6a03c; --role-mystic: #a985ea; --role-brawler: #e2604e; --role-assassin: #45c4b0; }
.role-marksman { --role-c: var(--role-marksman); }
.role-mystic { --role-c: var(--role-mystic); }
.role-brawler { --role-c: var(--role-brawler); }
.role-assassin { --role-c: var(--role-assassin); }
.hcard[class*="role-"] { border-bottom: 3px solid var(--role-c, var(--line)); }
.hcard[class*="role-"]::after { background: linear-gradient(0deg, color-mix(in srgb, var(--role-c, var(--ink)) 22%, var(--ink)) 12%, rgb(15 21 20 / .6) 45%, transparent 75%); }
.hcard[class*="role-"]:hover { border-color: var(--role-c); }
.hcard .hcard-type { color: var(--role-c, var(--brass)); }
.role-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--role-c); margin-right: 6px; vertical-align: 1px; }
.seg button[class*="role-"].on:not(.role-all) { background: var(--role-c); color: var(--ink); }
.seg button.on .role-dot { background: var(--ink); }
.hhero[class*="role-"] { border-left: 4px solid var(--role-c, var(--line)); }
.hhero .role-name { color: var(--role-c, var(--brass)); }

/* Tarjetas de partida: cada sección con ancho fijo para que todas queden alineadas */
.mcard { grid-template-columns: 110px 220px 236px minmax(0, 1fr) 32px; }
.mc-res, .mc-hero, .mc-build, .mc-teams { min-width: 0; max-width: 100%; }
.mc-build .chips { flex-wrap: wrap; max-width: 236px; }
.mc-build .chip { font-size: 11px; padding: 2px 6px; }
.mc-teams { grid-template-columns: repeat(2, minmax(0, 175px)); justify-content: start; }
@media (max-width: 1000px) {
  .mcard { grid-template-columns: 110px minmax(0, 1fr) 32px; }
  .mc-teams { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .mcard { grid-template-columns: minmax(0, 1fr) 32px; }
}
.icat.slot-weapon { --slot-c: var(--slot-weapon); }
.icat.slot-vitality { --slot-c: var(--slot-vitality); }
.icat.slot-spirit { --slot-c: var(--slot-spirit); }
.icat-head { display: flex; align-items: baseline; gap: 12px; padding: 10px 14px; border-left: 4px solid var(--slot-c); background: linear-gradient(90deg, color-mix(in srgb, var(--slot-c) 22%, transparent), transparent 70%); }
.icat-head h2 { color: var(--slot-c); }
.itier { display: grid; gap: 8px; }
.itier-head { display: flex; align-items: center; gap: 8px; font: 500 13px var(--mono); color: var(--fg); }
.itier-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.itier-head small { color: var(--muted); }
.lore summary { cursor: pointer; color: var(--brass); font-weight: 600; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; }
.lore p { color: var(--muted); max-width: 75ch; }

/* ===== Barras de scroll: el mismo estilo en toda la página ===== */
/* Color por defecto latón; las ramas de ítems usan el color de su rama (--sb-c). */
:root { --sb-c: var(--brass-dim); --sb-hover: var(--brass); }
.icat-body { --sb-c: color-mix(in srgb, var(--slot-c) 70%, transparent); --sb-hover: var(--slot-c); }
* { scrollbar-width: thin; scrollbar-color: var(--sb-c) transparent; }
*:hover { scrollbar-color: var(--sb-hover) transparent; }
@supports not (scrollbar-color: red blue) {
  ::-webkit-scrollbar { width: 8px; height: 8px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--sb-c); border-radius: 4px; border: 2px solid transparent; background-clip: padding-box; }
  ::-webkit-scrollbar-thumb:hover { background: var(--sb-hover); background-clip: padding-box; }
  ::-webkit-scrollbar-corner { background: transparent; }
}
.table-wrap { border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 85%, transparent); }
.panel .table-wrap { border: 0; background: none; }

/* Campos y selectores con el mismo aspecto */
input[type="search"], input[type="text"], select { background: var(--panel); border: 1px solid var(--line); border-radius: 2px; color: var(--fg); }
input[type="search"]:hover, input[type="text"]:hover, select:hover { border-color: var(--brass-dim); }
input[type="search"]:focus, input[type="text"]:focus, select:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass); }

/* Textos de habilidades e ítems */
.inl-ic { display: inline-block; height: 1.1em; width: auto; vertical-align: -0.2em; margin: 0 2px; }
.dim { color: var(--muted); font-style: italic; }
.attr { font-weight: 600; }
.ability p, .ipart p { line-height: 1.5; overflow-wrap: anywhere; }
.tiers li > span:last-child { min-width: 0; overflow-wrap: anywhere; }

/* Bloque de héroe favorito */
.tile-hero { display: inline-flex; align-items: center; gap: 8px; font-size: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tile-hero img { width: 30px; height: 30px; border-radius: 3px; flex: none; }
