:root {
  color-scheme: dark;
  --bg: #0f0b09;
  --surface: #1a1412;
  --surface-2: #231b17;
  --surface-3: #2e231d;
  --line: #3a2c24;
  --text: #f5ecd6;
  --text-2: #cdbd9e;
  --muted: #988870;
  --gold: #f2c94c;
  --gold-2: #c99a2e;
  --red: #b3241b;
  --fire: #ff7a2f;
  --ok: #4fc47a;
  --warn: #fab219;
  /* Series de gráficos (paleta validada para superficie oscura) */
  --series-base: #3987e5;
  --series-bonus: #d95926;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Cinzel", Georgia, serif;
  --hanzi: "Ma Shan Zheng", "Noto Serif SC", "KaiTi", serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; font: 15px/1.55 var(--font); color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(179, 36, 27, .22), transparent 60%),
    radial-gradient(900px 500px at -10% 20%, rgba(242, 201, 76, .07), transparent 60%),
    var(--bg);
  min-height: 100vh; overflow-x: hidden;
}
body.noscroll { overflow: hidden; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: .02em; margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h2 { font-size: 1.3rem; color: var(--gold); }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; color: var(--text-2); margin-top: 1em; }
p { margin: .4em 0 .8em; }
code { background: var(--surface-3); padding: .1em .35em; border-radius: 4px; }
.small { font-size: .86rem; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--gold); color: #000; padding: 6px 10px; border-radius: 8px; }
svg.art { display: block; width: 100%; height: auto; }

/* ---------- Barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: rgba(15, 11, 9, .88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex-shrink: 0; }
.brand-seal { font-family: var(--hanzi); background: var(--red); color: #fff6ea; border-radius: 8px; padding: 2px 8px; font-size: 1.35rem; box-shadow: inset 0 0 0 2px rgba(255, 220, 200, .35); }
.brand-text { font-family: var(--display); font-weight: 800; line-height: 1.05; }
.brand-text small { display: block; font-size: .7rem; color: var(--gold); letter-spacing: .14em; text-transform: uppercase; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--text-2); padding: 6px 10px; border-radius: 999px; font-size: .88rem; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--gold); color: #1a1209; font-weight: 700; }
.nav a.hot:not(.active) { color: var(--gold); }
.search input { width: 220px; }
.menu-btn { display: none; margin-left: auto; background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font-size: 1.2rem; padding: 4px 12px; cursor: pointer; }
@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; }
  .menu-btn { display: block; }
  .nav { display: none; order: 3; flex-basis: 100%; }
  .nav.open { display: flex; }
  .search { order: 2; flex: 1; }
  .search input { width: 100%; }
}

input[type="search"], select {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; font: inherit; min-height: 38px; max-width: 100%;
}
input[type="search"]:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 40px; }
@media (max-width: 640px) { main { padding: 16px; } .topbar { padding: 10px 16px; } }
.loading { padding: 80px 0; text-align: center; color: var(--muted); font-family: var(--display); }

/* ---------- Hero ---------- */
.hero { position: relative; border-radius: 22px; overflow: hidden; min-height: 380px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 5, 4, .7), rgba(10, 5, 4, .25) 55%, transparent 80%); pointer-events: none; }
.hero-text { position: relative; z-index: 1; padding: 48px 44px; max-width: 640px; }
.hero-text h1 { font-size: clamp(2rem, 5vw, 3.4rem); text-shadow: 0 3px 18px rgba(0, 0, 0, .7); }
.hero-text h1 span { color: var(--gold); font-size: .62em; }
.eyebrow { font-family: var(--display); color: var(--gold); letter-spacing: .18em; text-transform: uppercase; font-size: .78rem; }
.lead { font-size: 1.05rem; color: #fff3dc; text-shadow: 0 2px 10px rgba(0, 0, 0, .8); }
@media (max-width: 640px) { .hero-text { padding: 28px 20px; } .hero { min-height: 420px; } }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--gold-2);
  background: rgba(26, 20, 18, .8); color: var(--gold); font: 600 .9rem var(--font); cursor: pointer; text-decoration: none !important;
}
.btn:hover { background: var(--surface-3); }
.btn.primary { background: linear-gradient(180deg, #f6d36b, #d9a531); color: #1a1209; border-color: #f6d36b; }
.btn.small { padding: 6px 12px; font-size: .82rem; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }

/* ---------- Tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 18px 0; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none !important; transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--gold-2); }
.tile-n { display: block; font: 800 1.9rem var(--display); color: var(--gold); }
.tile-l { color: var(--text-2); font-size: .85rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2 > .panel { margin: 0; }
.grid-2.tight { gap: 8px; }
section.grid-2 { margin: 16px 0; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

ul.ticks, ul.crosses, ol.steps { padding-left: 0; list-style: none; margin: .4em 0; }
ul.ticks li, ul.crosses li { position: relative; padding-left: 22px; margin: 5px 0; }
ul.ticks li::before { content: "◆"; position: absolute; left: 2px; color: var(--gold); font-size: .75em; top: .25em; }
ul.crosses li::before { content: "✕"; position: absolute; left: 2px; color: #ef6a52; font-size: .8em; }
ol.steps { counter-reset: s; }
ol.steps li { counter-increment: s; position: relative; padding-left: 36px; margin: 8px 0; }
ol.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--red); color: #fff; font: 700 .8rem/26px var(--font); text-align: center; }

.kingdoms { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 860px) { .kingdoms { grid-template-columns: repeat(2, 1fr); } }
.kingdom-card { position: relative; display: flex; flex-direction: column; padding: 16px; border-radius: var(--radius); overflow: hidden; color: #fff; text-decoration: none !important; min-height: 170px; border: 1px solid rgba(255, 255, 255, .12); }
.kc-hanzi { font: 3.4rem/1 var(--hanzi); opacity: .9; }
.kc-name { font: 800 1.2rem var(--display); }
.kc-n { font-size: .85rem; opacity: .85; }
.kc-faces { display: flex; margin-top: auto; padding-top: 10px; }
.kc-faces .face { width: 40px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255, 255, 255, .5); margin-right: -10px; aspect-ratio: 1; }
.kc-faces .face svg { transform: scale(1.7) translateY(4%); }
.k-Wei.kingdom-card { background: linear-gradient(140deg, #2a5cb3, #0c1a3a); }
.k-Shu.kingdom-card { background: linear-gradient(140deg, #2b8a4c, #0b2a17); }
.k-Wu.kingdom-card { background: linear-gradient(140deg, #bf3a2a, #3d0f09); }
.k-Other.kingdom-card { background: linear-gradient(140deg, #7a49b6, #21103b); }

/* ---------- Encabezados y filtros ---------- */
.sec-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 14px; }
.sec-head p { color: var(--text-2); margin: 0; }
.sec-head h1 { margin: 0 0 4px; }
.sec-hanzi { font: 3rem/1 var(--hanzi); color: #fff6ea; background: var(--red); border-radius: 12px; padding: 6px 12px; box-shadow: inset 0 0 0 2px rgba(255, 220, 200, .3); flex-shrink: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 10px 0 16px; }
.toolbar input[type="search"] { flex: 1; min-width: 180px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font: 500 .85rem var(--font); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--text); border-color: var(--gold-2); }
.chip.on { background: var(--gold); color: #1a1209; border-color: var(--gold); font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Tarjetas ---------- */
.grid { display: grid; gap: 14px; }
.grid.chars { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.grid.weapons, .grid.secrets, .grid.builds { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid.items { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.grid.orbs, .grid.powers, .grid.horses, .grid.guards, .grid.stages, .grid.duos { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.grid.mini { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
@media (max-width: 400px) { .grid.weapons, .grid.secrets, .grid.builds { grid-template-columns: 1fr; } .grid.chars { grid-template-columns: repeat(2, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); text-align: left; font: inherit; position: relative; transition: transform .15s, border-color .15s, box-shadow .15s; }
button.card { cursor: pointer; padding: 0; }
button.card:hover, .card.build:hover { transform: translateY(-3px); border-color: var(--gold-2); box-shadow: var(--shadow); }
.card.pad, .card .pad { padding: 16px; }
.card.done { border-color: rgba(79, 196, 122, .55); }
.card.done::after { content: "✓"; position: absolute; top: 8px; right: 10px; background: var(--ok); color: #071a0e; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.card-body { padding: 10px 12px 12px; }
.card-title { font: 700 1rem var(--display); margin-bottom: 4px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 8px; }
.card-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; }
.char-card .card-art { border-bottom: 3px solid var(--k); }
.pill { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-3); color: var(--text-2); border-radius: 999px; padding: 2px 9px; font-size: .75rem; border: 1px solid var(--line); }
.pill.k-Wei { background: #13264d; color: #cfe0ff; border-color: #2a5cb3; }
.pill.k-Shu { background: #0f3320; color: #c8f5d6; border-color: #2b8a4c; }
.pill.k-Wu { background: #4a120c; color: #ffd6cc; border-color: #bf3a2a; }
.pill.k-Other { background: #2a1446; color: #ead9ff; border-color: #7a49b6; }
.pill.gold { background: #3a2c0c; color: var(--gold); border-color: var(--gold-2); }
.pill.fire { background: #4a1a08; color: #ffb38a; border-color: var(--fire); }
.pill.el-fuego { background: #4a1a08; color: #ffb38a; border-color: #ff5a2a; }
.pill.el-rayo { background: #3a3006; color: #ffe27a; border-color: #ffd23a; }
.pill.el-vorpal { background: #2e0b45; color: #e4c2ff; border-color: #c05cff; }
.pill.el-viento { background: #0f3a2c; color: #bff5dc; border-color: #9be3c0; }
.pill.el-hielo { background: #0b2f45; color: #c6efff; border-color: #71d6ff; }
.pill.cat { background: color-mix(in srgb, var(--c, #888) 22%, #1a1412); border-color: var(--c, #888); color: #fff; }
.tag { font-size: .72rem; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--line); }
.tag.ok { background: #0f2f1a; color: #9ff0b8; border-color: #2b8a4c; }
.tag.lock { background: #2a1d14; color: var(--text-2); }
.tag.warn { background: #3a2a06; color: #ffd27a; border-color: #8a6a12; }
.tag.gold { background: #3a2c0c; color: var(--gold); border-color: var(--gold-2); }
.tier { font: 800 .8rem var(--display); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-3); }
.tier-S { background: linear-gradient(180deg, #ffd65a, #c9881a); color: #1a1209; }
.tier-A { background: #b3241b; color: #fff; }
.tier-B { background: #2a5cb3; color: #fff; }
.tier-C { background: #4a4038; color: #fff; }

.wcard { padding: 14px; }
.wcard-top { display: flex; gap: 12px; align-items: flex-start; }
.wcard-icon { width: 76px; flex-shrink: 0; background: radial-gradient(circle, var(--surface-3), var(--surface)); border-radius: 12px; border: 1px solid var(--line); }
.linklike { background: none; border: 0; color: var(--gold); font: inherit; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.linklike:hover { text-decoration: underline; }
.mini-face { width: 26px; height: 26px; border-radius: 50%; overflow: hidden; display: inline-block; flex-shrink: 0; border: 1px solid var(--line); vertical-align: middle; }
.mini-face svg { transform: scale(1.8) translateY(6%); }
dl.kv { display: grid; grid-template-columns: 92px 1fr; gap: 4px 10px; margin: 10px 0; font-size: .88rem; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.check { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; font-size: .85rem; color: var(--text-2); }
.check input { accent-color: var(--ok); width: 18px; height: 18px; }

.icard { display: flex; gap: 10px; padding: 10px; align-items: flex-start; }
.icard-icon { width: 70px; flex-shrink: 0; }
.icard .card-body { padding: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0; color: var(--text-2); }

.orb-art { width: 110px; margin: 0 auto 8px; }
.power .glyph, .secret .glyph { margin-bottom: 8px; }
.horse svg { border-bottom: 1px solid var(--line); }
.guard svg { border-bottom: 1px solid var(--line); max-height: 180px; }
.stage svg { border-bottom: 1px solid var(--line); }
.callout { background: var(--surface-2); border-left: 3px solid var(--gold); border-radius: 8px; padding: 10px 12px; margin: 10px 0; }
.callout.fire { border-left-color: var(--fire); }
.progress-line { display: flex; align-items: center; gap: 10px; margin: 6px 0 14px; color: var(--text-2); }
.pbar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; max-width: 420px; }
.pbar span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
details.rules summary, details.sources summary { cursor: pointer; color: var(--gold); font-weight: 600; }
details.rules { padding: 14px 20px; }
details.sources { margin-top: 12px; font-size: .8rem; }
details.sources ul { padding-left: 18px; margin: 6px 0; word-break: break-all; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--gold); font-family: var(--display); font-size: .82rem; font-variant-numeric: tabular-nums; }
.mtx { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }

.ach-list { display: grid; gap: 8px; }
.ach { display: grid; grid-template-columns: 62px 1fr auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.ach.done { border-color: rgba(79, 196, 122, .55); background: linear-gradient(90deg, rgba(79, 196, 122, .08), var(--surface)); }
.ach h3 { margin: 0 0 2px; }
.ach p { margin: 0; }
.mode { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mode:last-child { border-bottom: 0; }
.mode h4 { margin: 0 0 2px; color: var(--text); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(5, 3, 2, .78); display: grid; place-items: center; padding: 20px; backdrop-filter: blur(4px); }
.modal[hidden] { display: none; }
.modal-card { position: relative; background: var(--surface); border: 1px solid var(--gold-2); border-radius: 18px; max-width: 980px; width: 100%; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal-close { position: sticky; top: 10px; float: right; margin: 10px 10px 0 0; z-index: 2; background: var(--surface-3); color: var(--text); border: 1px solid var(--line); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 1rem; }
.detail { display: grid; grid-template-columns: 300px 1fr; gap: 22px; padding: 22px; }
.detail-art { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); align-self: start; position: sticky; top: 0; }
.detail-art.square { padding: 24px; background: radial-gradient(circle, var(--surface-3), var(--surface)); }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; padding: 16px; } .detail-art { position: static; max-width: 280px; margin: 0 auto; } .modal { padding: 8px; } }
.weapon-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.wcell { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px; text-align: center; font-size: .78rem; }
.wcell b { display: block; color: var(--gold); }

/* ---------- Gráficos de barras ---------- */
.bars { display: grid; gap: 7px; margin: 8px 0 14px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 40px; gap: 10px; align-items: center; font-size: .86rem; }
@media (max-width: 520px) { .bar-row { grid-template-columns: 96px 1fr 34px; } }
.bar-label { color: var(--text-2); }
.bar-track { height: 12px; background: #241c18; border-radius: 4px; display: flex; gap: 2px; overflow: hidden; cursor: default; }
.bar-fill { display: block; height: 100%; background: var(--series-base); border-radius: 0 4px 4px 0; }
.seg { display: block; height: 100%; }
.seg-base { background: var(--series-base); }
.seg-bonus { background: var(--series-bonus); border-radius: 0 4px 4px 0; }
.seg-base:last-child { border-radius: 0 4px 4px 0; }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.bar-row.best .bar-label { color: var(--gold); font-weight: 700; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: .82rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.sw-base { background: var(--series-base); }
.sw-bonus { background: var(--series-bonus); }
.tip { position: absolute; z-index: 60; background: #fff7e6; color: #1a1209; padding: 6px 10px; border-radius: 8px; font-size: .8rem; pointer-events: none; max-width: 280px; box-shadow: var(--shadow); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 70; background: var(--gold); color: #1a1209; padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100% - 32px); }

/* ---------- Forja ---------- */
.forge { display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 920px) { .forge { grid-template-columns: 1fr; } }
.forge .panel { margin: 0; }
.forge-form { display: grid; gap: 12px; }
.forge-form label { display: grid; gap: 4px; font-size: .85rem; color: var(--text-2); }
.forge-form fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0; min-width: 0; }
.forge-form legend { color: var(--text-2); font-size: .85rem; padding: 0 4px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.slots select { width: 100%; }
.tiers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tier-opt { cursor: pointer; text-align: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 4px; font-size: .68rem !important; line-height: 1.2; display: block !important; }
.tier-opt input { position: absolute; opacity: 0; }
.tier-opt.on { border-color: var(--gold); background: #3a2c0c; color: var(--gold); }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.build-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.build-face { width: 92px; flex-shrink: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.equip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.equip-row > svg, .equip-row > span, .equip-row > .eq { width: 46px; flex-shrink: 0; }
.eq { background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- Combinaciones ---------- */
.objectives { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-bottom: 8px; }
.obj { display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; gap: 2px 10px; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; color: var(--text); cursor: pointer; font: inherit; }
.obj svg { grid-row: span 2; }
.obj span { font-size: .78rem; color: var(--muted); }
.obj.on { border-color: var(--gold); background: linear-gradient(180deg, #3a2c0c, var(--surface)); }
.obj:hover { border-color: var(--gold-2); }
.h2-line { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.h2-line::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--gold-2), transparent); }
.card.build { padding: 14px; }
.rank { position: absolute; top: 10px; right: 12px; font: 800 1.3rem var(--display); color: var(--gold); }
.build-top { display: flex; gap: 12px; align-items: center; }
.build-top .build-face { width: 78px; }
.kv-list { list-style: none; padding: 0; margin: 6px 0; }
.kv-list li { margin: 2px 0; }
.duo-faces { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.duo-faces .build-face { width: 70px; }
.plus { font: 800 1.6rem var(--display); color: var(--gold); }
.recipe { border-left: 3px solid var(--fire); }

/* ---------- Galería ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.gallery:has(.horse) { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.gal-item { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.gal-img { display: block; width: 100%; border: 0; padding: 0; background: radial-gradient(circle at 50% 40%, var(--surface-3), var(--surface)); cursor: pointer; }
.gal-item:not(.char):not(.horse) .gal-img { padding: 22px; }
.gal-item figcaption { display: grid; grid-template-columns: 1fr auto; padding: 8px 10px; gap: 0 8px; align-items: center; }
.gal-item figcaption b { font-family: var(--display); font-size: .9rem; }
.gal-item figcaption span { grid-column: 1; color: var(--muted); font-size: .75rem; }
.dl { grid-row: 1 / span 2; grid-column: 2; background: var(--surface-3); color: var(--gold); border: 1px solid var(--line); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; }
.dl:hover { border-color: var(--gold); }

/* ---------- Búsqueda ---------- */
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.res { display: grid; grid-template-columns: 36px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; color: var(--text); text-align: left; font: inherit; cursor: pointer; text-decoration: none !important; }
.res > svg, .res > .mini-face { grid-row: span 2; width: 36px; height: 36px; }
.res small { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.empty { text-align: center; color: var(--muted); padding: 30px; border: 1px dashed var(--line); border-radius: var(--radius); grid-column: 1 / -1; }
.empty svg { margin: 0 auto 8px; }

.prose { max-width: 900px; }
.prose pre { background: #0b0807; border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; white-space: pre-wrap; }
.prose blockquote { border-left: 3px solid var(--gold); margin: 10px 0; padding: 4px 14px; color: var(--text-2); }
.prose ul { padding-left: 20px; }

.footer { max-width: 1320px; margin: 0 auto; padding: 20px 20px 40px; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }
@media (max-width: 640px) { .footer { padding: 16px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .seg-bonus { background-image: repeating-linear-gradient(45deg, CanvasText 0 2px, transparent 2px 6px); } }

/* ---------- Ajustes móviles ---------- */
@media (max-width: 640px) {
  .search { flex-basis: 100%; order: 4; }
  .nav { order: 3; }
  .sec-head { align-items: flex-start; gap: 12px; }
  .sec-hanzi { font-size: 2rem; padding: 4px 9px; }
  .objectives { grid-template-columns: 1fr 1fr; gap: 8px; }
  .obj { grid-template-columns: 26px 1fr; padding: 8px; }
  .obj svg { width: 26px; height: 26px; }
  .obj span { display: none; }
  .obj b { font-size: .85rem; }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .tile-n { font-size: 1.5rem; }
}
