:root {
  --night: #1b1424; --night2: #2a1f3d; --night3: #3d2c5c;
  --panel: #1e1a2b; --panel2: #262036; --panel3: #2e2742; --border: #3a3150; --border2: #4f4370;
  --gold: #e8b85a; --gold2: #ffd27a; --gold3: #fff1c1; --text: #efe6d6; --muted: #a99fb8; --dim: #7d7393;
  --parch: #f3e3c3; --parch2: #e0c497; --parch3: #b8925a; --ink: #2a1d14;
  --cyan: #7af0ff; --violet: #b48cff; --pink: #ff7ad9; --green: #7cba5a; --red: #ff6a3d; --orange: #ff9d4a;
  --serif: Georgia, 'Palatino Linotype', 'Book Antiqua', serif;
  --sans: system-ui, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .8 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --paper: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.035' numOctaves='4' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .38 0 0 0 0 .18 0 0 0 .32 -.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  --shadow: 0 1px 0 rgba(255, 241, 193, .06) inset, 0 0 0 1px rgba(27, 20, 36, .7) inset, 0 22px 50px -18px rgba(12, 6, 20, .95), 0 8px 18px -8px rgba(61, 44, 92, .55);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans); color: var(--text); background: var(--night);
  font-size: 14px; line-height: 1.45; overflow-x: clip; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
#bg { position: fixed; inset: 0; width: 100%; height: 100%; filter: blur(3.5px) saturate(1.1) brightness(.95); transform: scale(1.05); z-index: -3; }
#embers { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
.vignette { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, rgba(27, 20, 36, .08) 0%, rgba(27, 20, 36, .45) 60%, rgba(18, 12, 26, .88) 100%), linear-gradient(180deg, rgba(27, 20, 36, .55), rgba(27, 20, 36, 0) 20%); }
#err { display: none; position: fixed; z-index: 999; left: 8px; bottom: 8px; max-width: 90vw; background: #8c3b3b; color: #fff; padding: 8px 12px; border-radius: 8px; font: 12px var(--mono); white-space: pre-wrap; }

.ico { display: inline-grid; place-items: center; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.help { color: var(--dim); cursor: help; width: 18px; height: 18px; border-radius: 50%; transition: color .2s, transform .2s; }
.help:hover, .help:focus-visible { color: var(--gold); transform: scale(1.1); }
:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }

/* ---------- Barra superior */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  padding: 10px clamp(12px, 2vw, 28px);
  background: linear-gradient(180deg, rgba(30, 26, 43, .96), rgba(30, 26, 43, .86)), var(--noise);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(232, 184, 90, .18), 0 14px 30px -14px rgba(10, 5, 18, .9);
  backdrop-filter: blur(8px);
}
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(232, 184, 90, .55), transparent); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; padding: 6px 10px 6px 6px; border-radius: 999px; border: 1px solid var(--border); background: rgba(27, 20, 36, .5); transition: .2s; }
.back:hover { color: var(--gold2); border-color: var(--gold); box-shadow: 0 0 14px -2px rgba(232, 184, 90, .45); }
.crest { display: flex; align-items: center; gap: 12px; min-width: 0; }
.crest-svg { width: 40px; height: 46px; filter: drop-shadow(0 4px 8px rgba(255, 157, 74, .35)); flex: none; }
.crest-glow { animation: breathe 3.2s ease-in-out infinite; transform-origin: 24px 30px; }
@keyframes breathe { 50% { opacity: .55; transform: scale(.85); } }
.crest-txt h1 { margin: 0; font: 600 19px/1.1 var(--serif); letter-spacing: .06em; color: var(--gold3); text-shadow: 0 2px 0 rgba(27, 20, 36, .8), 0 0 18px rgba(255, 210, 122, .25); white-space: nowrap; }
.crest-txt span { font-size: 11.5px; color: var(--muted); letter-spacing: .14em; text-transform: uppercase; }
.crest-txt b { color: var(--gold); font-weight: 600; cursor: help; }
.dot { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--border2); vertical-align: middle; margin: 0 4px; }
.resources { display: flex; gap: 8px; margin: 0 0 0 auto; padding: 0; list-style: none; }
.res {
  display: flex; align-items: center; gap: 9px; padding: 5px 14px 5px 6px; border-radius: 999px; cursor: help;
  background: linear-gradient(180deg, #2a2340, #1b1626); border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 241, 193, .08), inset 0 -2px 0 rgba(0, 0, 0, .25), 0 4px 10px -4px rgba(10, 5, 18, .8);
  transition: transform .2s, border-color .2s, box-shadow .2s; position: relative;
}
.res:hover, .res:focus-visible { transform: translateY(-2px); border-color: var(--border2); box-shadow: inset 0 1px 0 rgba(255, 241, 193, .1), 0 8px 18px -6px rgba(232, 184, 90, .3); }
.res .ri { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #3d3358, #1b1424); box-shadow: inset 0 0 0 1px rgba(232, 184, 90, .25), 0 0 12px -3px var(--rc, rgba(232, 184, 90, .5)); }
.res .ri svg { width: 22px; height: 22px; }
.res .rv { font: 600 16px/1 var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.res .rl { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); display: block; margin-top: 2px; }
.res .delta { position: absolute; right: 8px; top: -6px; font: 700 13px var(--mono); pointer-events: none; animation: floatUp 1.4s ease-out forwards; }
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-26px); } }

/* ---------- Layout */
.layout {
  display: grid; gap: 18px; padding: 18px clamp(12px, 2vw, 28px) 32px; max-width: 1760px; margin: 0 auto;
  grid-template-columns: 300px minmax(0, 1fr) 370px; grid-template-areas: 'chron roster side'; align-items: start;
}
.roster-panel { grid-area: roster; }
.panel.side-panel { grid-area: side; position: sticky; top: 86px; }
.panel.chron-panel { grid-area: chron; position: sticky; top: 86px; height: calc(100vh - 106px); min-height: 480px; display: flex; flex-direction: column; }

.panel {
  position: relative; border-radius: var(--radius); padding: 16px;
  background: linear-gradient(180deg, rgba(42, 35, 62, .8), rgba(30, 26, 43, .8) 30%, rgba(27, 22, 39, .86)), var(--noise);
  border: 1px solid var(--border); box-shadow: var(--shadow); backdrop-filter: blur(10px) saturate(1.2);
}
.panel::before, .panel::after { content: ''; position: absolute; width: 9px; height: 9px; background: var(--gold); transform: rotate(45deg); box-shadow: 0 0 8px rgba(232, 184, 90, .6); top: -5px; }
.panel::before { left: 22px; } .panel::after { right: 22px; }
.panel-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h2, .tab { font: 600 15px var(--serif); letter-spacing: .16em; text-transform: uppercase; color: var(--gold); margin: 0; text-shadow: 0 1px 0 #000; }
.panel-head h2 { display: flex; align-items: baseline; gap: 8px; flex: 1; }
.panel-head h2::after { content: ''; flex: 1; height: 1px; margin-left: 6px; align-self: center; background: linear-gradient(90deg, rgba(232, 184, 90, .5), transparent); }
.count { font: 600 12px var(--mono); color: var(--muted); letter-spacing: 0; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter { border: 1px solid var(--border); background: rgba(27, 20, 36, .6); padding: 4px 11px; border-radius: 999px; font-size: 12px; color: var(--muted); cursor: pointer; transition: .2s; }
.filter:hover { color: var(--text); border-color: var(--border2); }
.filter[aria-selected="true"] { color: var(--ink); background: linear-gradient(180deg, var(--gold2), var(--gold)); border-color: var(--gold); box-shadow: 0 0 12px -2px rgba(232, 184, 90, .6); font-weight: 600; }

/* ---------- Tarjetas de miembros */
.roster { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.mcard {
  position: relative; display: grid; grid-template-columns: 78px 1fr; gap: 6px 13px; padding: 13px 13px 12px; border-radius: 12px; cursor: pointer; text-align: left;
  background: linear-gradient(160deg, rgba(58, 49, 80, .55), rgba(30, 26, 43, .7) 45%, rgba(27, 20, 36, .85)), var(--noise);
  border: 1px solid var(--border); width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 241, 193, .07), inset 0 -1px 0 rgba(0, 0, 0, .4), 0 10px 22px -12px rgba(10, 5, 18, .95);
  transition: transform .25s cubic-bezier(.2, .8, .3, 1.3), border-color .25s, box-shadow .25s;
  animation: cardIn .6s cubic-bezier(.2, .8, .3, 1) both; animation-delay: calc(var(--i, 0) * 60ms);
}
.mcard::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(120% 70% at 0% 0%, var(--cc, #e8b85a) 0%, transparent 45%); opacity: .12; transition: opacity .3s; }
.mcard:hover, .mcard:focus-visible { transform: translateY(-4px); border-color: rgba(232, 184, 90, .6); box-shadow: inset 0 1px 0 rgba(255, 241, 193, .1), 0 18px 30px -14px rgba(10, 5, 18, .95), 0 0 0 1px rgba(232, 184, 90, .15), 0 0 26px -8px rgba(232, 184, 90, .45); outline: none; }
.mcard:hover::before { opacity: .22; }
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.mcard.is-new { animation: newMember 1.3s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes newMember { 0% { opacity: 0; transform: scale(.7); box-shadow: 0 0 0 0 rgba(255, 210, 122, .9); } 40% { opacity: 1; transform: scale(1.04); box-shadow: 0 0 0 10px rgba(255, 210, 122, 0), 0 0 60px rgba(255, 210, 122, .7); } 100% { transform: scale(1); } }
.mcard[data-status="fue"] { filter: saturate(.25) brightness(.8); }
.mcard[data-status="fue"]:hover { filter: saturate(.5) brightness(.9); }
.pframe { position: relative; grid-row: span 3; width: 78px; height: 78px; padding: 3px; border-radius: 10px;
  background: linear-gradient(150deg, var(--gold2), #9c6236 40%, #4a2a1d 70%, var(--gold) 100%);
  box-shadow: 0 6px 14px -4px rgba(10, 5, 18, .9), 0 0 0 1px rgba(27, 20, 36, .9); transition: box-shadow .3s; }
.mcard:hover .pframe { box-shadow: 0 6px 14px -4px rgba(10, 5, 18, .9), 0 0 18px -2px var(--cc); }
.pframe canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; border-radius: 7px; box-shadow: inset 0 0 0 1px #000; }
.lvl { position: absolute; left: -6px; bottom: -6px; min-width: 26px; height: 26px; padding: 0 4px; display: grid; place-items: center; font: 700 12px var(--mono); color: var(--ink);
  background: linear-gradient(180deg, var(--gold3), var(--gold) 55%, #b8803a); border-radius: 7px; transform: rotate(-4deg); box-shadow: 0 2px 0 #6b3f2a, 0 4px 8px rgba(10, 5, 18, .7); border: 1px solid #fff1c1; }
.mname { font: 600 16px/1.15 var(--serif); color: var(--text); letter-spacing: .02em; padding-right: 38px; }
.msub { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.cls { color: var(--cc); font-weight: 600; letter-spacing: .04em; }
.crystal { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; display: block; cursor: help; --glow: rgba(122, 240, 255, .7); animation: pulse var(--ps, 3s) ease-in-out infinite; filter: drop-shadow(0 0 6px var(--glow)); transition: transform .3s; }
.crystal:hover, .crystal:focus-visible { transform: scale(1.18) rotate(-6deg); }
.crystal svg { width: 100%; height: 100%; overflow: visible; }
@keyframes pulse { 50% { filter: drop-shadow(0 0 2px var(--glow)) brightness(.85); } }
.crystal.dim { animation: none; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .5)) grayscale(.4); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; grid-column: 1 / -1; margin-top: 4px; }
.chip { font-size: 11.5px; padding: 2px 9px 2px 7px; border-radius: 6px; cursor: help; display: inline-flex; align-items: center; gap: 5px; border: 1px solid; transition: transform .15s, box-shadow .2s; white-space: nowrap; }
.chip::before { content: ''; width: 6px; height: 6px; transform: rotate(45deg); background: currentColor; border-radius: 1px; }
.chip:hover, .chip:focus-visible { transform: translateY(-1px); box-shadow: 0 0 12px -3px currentColor; }
.chip.bueno { color: #b8e08a; border-color: rgba(124, 186, 90, .4); background: rgba(47, 90, 58, .35); }
.chip.malo { color: #ff9f80; border-color: rgba(255, 106, 61, .38); background: rgba(140, 59, 59, .3); }
.chip.mixto { color: #cdb4ff; border-color: rgba(180, 140, 255, .38); background: rgba(61, 44, 92, .45); }

.bars { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 4px; }
.barrow { display: grid; grid-template-columns: 46px 1fr 54px; align-items: center; gap: 8px; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .1em; }
.barrow .num { font: 600 11.5px var(--mono); color: var(--muted); text-align: right; letter-spacing: 0; text-transform: none; }
.bar { display: block; position: relative; height: 9px; border-radius: 5px; background: #120d1a; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .8), 0 1px 0 rgba(255, 241, 193, .06); overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 5px; transition: width 1.1s cubic-bezier(.2, .8, .2, 1); }
.bar > i::after { content: ''; position: absolute; inset: 1px 2px auto 2px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .35); }
.bar.hp > i { background: linear-gradient(90deg, #8c3b3b, #ff6a3d 70%, #ff9d4a); box-shadow: 0 0 10px rgba(255, 106, 61, .55); }
.bar.mo > i { background: linear-gradient(90deg, #3d2c5c, #b48cff 55%, #e8b85a); box-shadow: 0 0 10px rgba(232, 184, 90, .45); }
.bar.mo.low > i { background: linear-gradient(90deg, #2a1f3d, #5a5470 60%, #8a8299); box-shadow: none; }
.bar.hp.low > i { animation: lowhp 1.2s ease-in-out infinite; }
@keyframes lowhp { 50% { filter: brightness(1.5); } }
.bar .ticks { position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 1px), rgba(18, 13, 26, .7) calc(10% - 1px) 10%); pointer-events: none; }

.status { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; margin-top: 6px; padding-top: 9px; border-top: 1px dashed rgba(79, 67, 112, .6); font-size: 12px; color: var(--muted); cursor: help; }
.status .sd { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 22%, transparent), 0 0 10px var(--sc); flex: none; }
.status[data-s="incursion"] .sd, .status[data-s="herido"] .sd { animation: blinkdot 1.6s infinite; }
@keyframes blinkdot { 50% { box-shadow: 0 0 0 6px transparent, 0 0 4px var(--sc); } }
.status b { color: var(--text); font-weight: 600; }
.status .ico { width: 15px; height: 15px; margin-left: auto; color: var(--dim); }

/* ---------- Tabs y taberna */
.tabs { display: flex; align-items: center; gap: 4px; margin: -4px -4px 14px; padding: 4px; border-radius: 10px; background: rgba(18, 13, 26, .55); box-shadow: inset 0 1px 3px rgba(0, 0, 0, .6); }
.tab { flex: 1; font-size: 12.5px; letter-spacing: .1em; padding: 9px 8px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; color: var(--dim); text-shadow: none; transition: .25s; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--gold2); background: linear-gradient(180deg, #3a3150, #2a2340); box-shadow: inset 0 1px 0 rgba(255, 241, 193, .12), 0 3px 8px rgba(10, 5, 18, .7); }
.tabs .help { margin: 0 6px; }
.tavern-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mood { flex: 1; font: italic 13px var(--serif); color: var(--muted); }
.mood b { color: var(--gold2); font-style: normal; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 9px; cursor: pointer; font-weight: 700; letter-spacing: .06em;
  border: 1px solid #fff1c1; color: var(--ink); padding: 9px 16px; font-size: 13px; position: relative; overflow: hidden;
  background: linear-gradient(180deg, #fff1c1, var(--gold2) 30%, var(--gold) 65%, #b8803a);
  box-shadow: 0 3px 0 #7a4a1d, 0 6px 14px -4px rgba(232, 184, 90, .6), inset 0 1px 0 rgba(255, 255, 255, .7);
  transition: transform .12s, box-shadow .12s, filter .2s; text-shadow: 0 1px 0 rgba(255, 241, 193, .6);
}
.btn::after { content: ''; position: absolute; top: 0; bottom: 0; width: 40%; left: -60%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .65), transparent); transform: skewX(-20deg); }
.btn:hover::after { animation: shine .8s ease-out; }
@keyframes shine { to { left: 130%; } }
.btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #7a4a1d, 0 2px 6px -2px rgba(232, 184, 90, .6), inset 0 1px 0 rgba(255, 255, 255, .7); }
.btn[disabled] { filter: grayscale(.8) brightness(.7); cursor: not-allowed; }
.btn.ghost { background: rgba(27, 20, 36, .6); color: var(--gold2); border-color: var(--border2); box-shadow: inset 0 1px 0 rgba(255, 241, 193, .06); text-shadow: none; font-weight: 600; }
.btn.ghost:hover { border-color: var(--gold); }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn .ico { width: 15px; height: 15px; }
.btn.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.candidates { display: grid; gap: 12px; }
.cand {
  position: relative; display: grid; grid-template-columns: 64px 1fr auto; gap: 4px 12px; align-items: center; padding: 12px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(243, 227, 195, .08), rgba(243, 227, 195, .02)), linear-gradient(160deg, #2c2440, #1d1829);
  border: 1px solid var(--border); box-shadow: inset 0 1px 0 rgba(255, 241, 193, .08), 0 10px 20px -12px rgba(10, 5, 18, .95);
  transition: transform .25s, border-color .25s, box-shadow .25s; animation: candIn .55s cubic-bezier(.2, .8, .3, 1.2) both; animation-delay: calc(var(--i, 0) * 90ms);
}
.cand:hover { transform: translateX(-3px); border-color: rgba(232, 184, 90, .5); box-shadow: inset 0 1px 0 rgba(255, 241, 193, .1), 0 14px 26px -12px rgba(10, 5, 18, .95), 0 0 22px -10px rgba(232, 184, 90, .6); }
@keyframes candIn { from { opacity: 0; transform: rotateX(70deg) translateY(-10px); } }
.cand .pframe { width: 64px; height: 64px; grid-row: span 2; }
.cand .cname { font: 600 15px var(--serif); }
.cand .cmeta { font-size: 12px; color: var(--muted); }
.cand .quote { grid-column: 2 / -1; font: italic 12px var(--serif); color: var(--parch3); }
.cand .chips { grid-column: 1 / -1; margin: 2px 0 0; }
.cand .buy { grid-row: 1 / span 2; grid-column: 3; display: grid; justify-items: end; gap: 6px; }
.price { display: inline-flex; align-items: center; gap: 4px; font: 700 14px var(--mono); color: var(--gold2); }
.price svg { width: 18px; height: 18px; }
.cand.hired { pointer-events: none; animation: hired 1s ease-in forwards; }
@keyframes hired { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 122, .9); } 30% { transform: scale(1.04); border-color: var(--gold2); box-shadow: 0 0 0 8px rgba(255, 210, 122, 0), 0 0 50px rgba(255, 210, 122, .8); } 100% { transform: scale(.9) translateY(-10px); opacity: 0; } }
.cand.empty { display: grid; place-items: center; min-height: 104px; grid-template-columns: 1fr; color: var(--dim); font: italic 13px var(--serif); border-style: dashed; }

/* misiones */
.missions { display: grid; gap: 12px; }
.mission { position: relative; padding: 14px 14px 12px; border-radius: 10px; color: var(--ink); overflow: hidden;
  background: radial-gradient(130% 120% at 50% 40%, var(--parch) 55%, var(--parch2) 90%, var(--parch3)), var(--paper); background-blend-mode: multiply;
  box-shadow: inset 0 0 18px rgba(184, 146, 90, .55), 0 10px 20px -10px rgba(10, 5, 18, .9); transform: rotate(var(--rot, 0deg)); transition: transform .25s; }
.mission:hover { transform: rotate(0) translateY(-2px); }
.mission::before { content: ''; position: absolute; top: 7px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff9d4a, #8c3b3b); box-shadow: 0 2px 3px rgba(0, 0, 0, .5); }
.mission h3 { margin: 6px 0 2px; font: 700 15px var(--serif); }
.mission .zone { font-size: 11.5px; color: #6b4a2a; letter-spacing: .08em; text-transform: uppercase; }
.mrow { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; font: 600 12.5px var(--mono); }
.skulls { display: inline-flex; gap: 1px; color: #8c3b3b; cursor: help; }
.skulls .ico { width: 15px; height: 15px; }
.skulls .off { color: rgba(42, 29, 20, .2); }
.mrow .ico.c { width: 15px; height: 15px; color: #6b4a2a; }
.mrow .loot { width: 26px; height: 26px; image-rendering: pixelated; padding: 2px; border-radius: 5px; background: rgba(42, 29, 20, .12); }
.mission .btn { margin-left: auto; }
.stamp { position: absolute; right: 18px; top: 18px; font: 800 18px var(--serif); letter-spacing: .15em; color: #8c3b3b; border: 3px solid #8c3b3b; padding: 2px 10px; border-radius: 6px; transform: rotate(-14deg); opacity: .85; mix-blend-mode: multiply; animation: stamp .35s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp { from { transform: rotate(-14deg) scale(2.6); opacity: 0; } }

/* ---------- Crónica: pergamino */
.chron-panel .scroll { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.roller { height: 16px; margin: 0 -8px; border-radius: 8px; position: relative; z-index: 2; flex: none;
  background: linear-gradient(180deg, #c98d4f, #9c6236 40%, #4a2a1d); box-shadow: 0 4px 8px rgba(10, 5, 18, .7), inset 0 1px 0 rgba(255, 241, 193, .4); }
.roller::before, .roller::after { content: ''; position: absolute; top: -3px; width: 10px; height: 22px; border-radius: 4px; background: linear-gradient(180deg, var(--gold2), #8c5a1d); }
.roller::before { left: -4px; } .roller::after { right: -4px; }
.parchment { flex: 1; overflow-y: auto; min-height: 0; padding: 16px 14px 18px 12px; color: var(--ink);
  background: radial-gradient(140% 100% at 50% 50%, var(--parch) 50%, var(--parch2) 88%, var(--parch3)), var(--paper); background-blend-mode: multiply;
  box-shadow: inset 0 10px 14px -8px rgba(74, 42, 29, .6), inset 0 -10px 14px -8px rgba(74, 42, 29, .6), inset 10px 0 20px -12px rgba(107, 63, 42, .7), inset -10px 0 20px -12px rgba(107, 63, 42, .7);
  scrollbar-width: thin; scrollbar-color: var(--parch3) transparent; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: repeating-linear-gradient(180deg, rgba(42, 29, 20, .45) 0 6px, transparent 6px 10px); }
.ev { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 0 0 14px; animation: evIn .5s ease both; }
@keyframes evIn { from { opacity: 0; transform: translateX(-8px); } }
.ev .badge { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff8e6, var(--bc) 75%); border: 2px solid var(--ink); box-shadow: 0 2px 0 rgba(42, 29, 20, .35), 0 0 0 3px var(--parch); z-index: 1; }
.ev .badge svg { width: 18px; height: 18px; }
.ev .day { font: 700 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #8c5a2d; }
.ev p { margin: 1px 0 0; font: 14px/1.35 var(--serif); }
.ev .nm { font-weight: 700; color: #6b2a1d; cursor: pointer; text-decoration: underline; text-decoration-color: rgba(107, 42, 29, .3); text-underline-offset: 2px; }
.ev .nm.dead { cursor: default; color: #4a4460; text-decoration: line-through; text-decoration-color: rgba(74, 68, 96, .5); }
.ev.fresh { animation: evFresh 2.2s ease both; }
.ev.fresh p { background: linear-gradient(90deg, rgba(255, 210, 122, .7), transparent); border-radius: 4px; }
@keyframes evFresh { 0% { opacity: 0; transform: translateY(-14px) scale(.96); } 20% { opacity: 1; transform: none; } }
.ev[data-type="muerte"] p { font-style: italic; }

/* ---------- Ficha (modal) */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: radial-gradient(circle at 50% 40%, rgba(42, 31, 61, .55), rgba(18, 12, 26, .88)); backdrop-filter: blur(5px); animation: fade .3s ease both; }
@keyframes fade { from { opacity: 0; } }
.dialog { background: linear-gradient(180deg, rgba(42, 35, 62, .97), rgba(27, 22, 39, .98)), var(--noise); position: relative; width: min(1120px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 0; display: grid; grid-template-columns: 310px 1fr; animation: pop .4s cubic-bezier(.2, .9, .3, 1.15) both; scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }
.dialog::before, .dialog::after { z-index: 3; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.f-side { position: relative; padding: 26px 22px 22px; text-align: center; border-right: 1px solid var(--border);
  background: radial-gradient(90% 50% at 50% 26%, color-mix(in srgb, var(--cc) 25%, transparent), transparent 70%), linear-gradient(180deg, rgba(61, 44, 92, .35), rgba(27, 20, 36, .4)); border-radius: var(--radius) 0 0 var(--radius); }
.f-portrait { width: 196px; height: 196px; margin: 4px auto 0; padding: 6px; border-radius: 16px; position: relative;
  background: linear-gradient(150deg, var(--gold3), var(--gold) 25%, #9c6236 50%, #4a2a1d 75%, var(--gold) 100%);
  box-shadow: 0 18px 40px -12px rgba(10, 5, 18, 1), 0 0 50px -10px var(--cc), inset 0 0 0 1px rgba(255, 255, 255, .3); }
.f-portrait canvas { width: 100%; height: 100%; image-rendering: pixelated; border-radius: 11px; display: block; box-shadow: inset 0 0 0 2px #1b1424; }
.f-portrait .lvl { width: 40px; height: 40px; font-size: 16px; left: -10px; bottom: -10px; border-radius: 10px; }
.f-portrait .crystal { width: 54px; height: 54px; top: auto; bottom: -16px; right: -16px; }
.f-name { margin: 22px 0 2px; font: 600 24px/1.15 var(--serif); letter-spacing: .03em; color: var(--gold3); text-shadow: 0 2px 0 #000; }
.f-cls { font-size: 13px; color: var(--muted); letter-spacing: .08em; }
.f-cls .cls { text-transform: uppercase; letter-spacing: .14em; }
.xp { margin: 14px auto 0; max-width: 220px; }
.xp .bar > i { background: linear-gradient(90deg, #2b4f7a, #79c3e0 70%, #c6ecf5); box-shadow: 0 0 10px rgba(121, 195, 224, .6); }
.xp small { display: flex; justify-content: space-between; font: 600 11px var(--mono); color: var(--dim); margin-top: 4px; }
.bond { margin-top: 18px; padding: 12px; border-radius: 10px; background: rgba(18, 13, 26, .5); border: 1px solid var(--border); text-align: left; display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; }
.bond .crystal { position: static; width: 44px; height: 44px; }
.bond b { font: 600 14px var(--serif); color: var(--text); display: block; }
.bond span { font-size: 12px; color: var(--muted); }
.f-side .status { justify-content: center; border: 0; margin-top: 14px; }
.f-side .bars { margin-top: 14px; text-align: left; }
.f-main { padding: 22px 24px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 22px; align-content: start; }
.f-sec { min-width: 0; }
.f-sec.wide { grid-column: 1 / -1; }
.f-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 600 12.5px var(--serif); letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.f-sec h3::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(232, 184, 90, .45), transparent); }
.f-sec h3 .help { order: 2; }
.stats { display: grid; gap: 8px; }
.stat { display: grid; grid-template-columns: 82px 1fr 28px; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); cursor: help; }
.stat .num { font: 700 13px var(--mono); color: var(--text); text-align: right; }
.stat .bar { height: 10px; }
.stat .bar > i { background: linear-gradient(90deg, #6b3f2a, var(--gold) 70%, var(--gold3)); box-shadow: 0 0 8px rgba(232, 184, 90, .4); }
.stat .bar .ticks { background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 1px), rgba(18, 13, 26, .75) calc(5% - 1px) 5%); }
.memories { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.memory { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: start; padding: 9px 12px; border-radius: 8px; color: var(--ink); font: italic 13.5px/1.35 var(--serif);
  background: radial-gradient(140% 140% at 30% 30%, var(--parch), var(--parch2) 85%), var(--paper); background-blend-mode: multiply; box-shadow: inset 0 0 12px rgba(184, 146, 90, .5), 0 4px 10px -6px rgba(0, 0, 0, .8); }
.memory .mi { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 13px; color: var(--parch); background: #6b2a1d; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .3); }
.memory .nm { font-weight: 700; font-style: normal; }
.memory .nm.dead { text-decoration: line-through; }
.relations svg { width: 100%; height: auto; display: block; overflow: visible; }
.relations .legend { display: flex; gap: 14px; justify-content: center; font-size: 11.5px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.relations .legend i { display: inline-block; width: 18px; height: 0; border-top: 3px solid; vertical-align: middle; margin-right: 5px; border-radius: 2px; }
.rnode { cursor: pointer; transition: transform .2s; }
.rnode:hover, .rnode:focus-visible { outline: none; }
.rnode:hover circle.ring, .rnode:focus-visible circle.ring { stroke: var(--gold2); stroke-width: 3; }
.redge { stroke-linecap: round; animation: dash 1.2s ease-out both; }
@keyframes dash { from { stroke-dashoffset: 200; } }
.gear { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.slot { position: relative; aspect-ratio: 1; border-radius: 10px; display: grid; place-items: center; cursor: help;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--rc, #3a3150) 28%, #1e1a2b), #14101d 80%);
  border: 2px solid var(--rc, #3a3150); box-shadow: inset 0 0 0 2px rgba(18, 13, 26, .9), inset 0 -6px 12px rgba(0, 0, 0, .45), 0 6px 14px -8px rgba(0, 0, 0, .9), 0 0 16px -8px var(--rc, transparent); transition: transform .2s, box-shadow .2s; }
.slot:hover, .slot:focus-visible { transform: translateY(-3px); box-shadow: inset 0 0 0 2px rgba(18, 13, 26, .9), 0 10px 18px -8px rgba(0, 0, 0, .9), 0 0 22px -4px var(--rc); }
.slot img { width: 66%; height: 66%; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .45)); }
.slot.empty { border-style: dashed; border-color: #3a3150; background: rgba(18, 13, 26, .5); }
.slot .sl { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.slot.empty::after { content: '+'; color: #4f4370; font: 300 22px var(--sans); }
.slot[data-r="legendario"] { animation: legend 2.4s ease-in-out infinite; }
@keyframes legend { 50% { box-shadow: inset 0 0 0 2px rgba(18, 13, 26, .9), 0 0 26px -2px var(--rc); } }
.gear-wrap { padding-bottom: 18px; }
.f-close, .f-nav { position: absolute; z-index: 4; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border2); background: rgba(27, 20, 36, .8); color: var(--muted); cursor: pointer; transition: .2s; }
.f-close { top: 12px; right: 12px; }
.f-close:hover, .f-nav:hover { color: var(--gold2); border-color: var(--gold); transform: scale(1.06); box-shadow: 0 0 14px -2px rgba(232, 184, 90, .5); }
.f-close svg, .f-nav svg { width: 18px; height: 18px; }
.f-navs { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; z-index: 4; }
.f-navs .f-nav { position: static; width: 32px; height: 32px; }

/* ---------- Tooltip, toasts y efectos */
#tip { position: fixed; z-index: 100; max-width: 260px; padding: 9px 12px; border-radius: 9px; pointer-events: none; font-size: 12.5px; line-height: 1.4; color: var(--text);
  background: linear-gradient(180deg, #332a4a, #221c33); border: 1px solid var(--border2); box-shadow: 0 12px 26px -8px rgba(10, 5, 18, .95), 0 0 0 1px rgba(232, 184, 90, .12), inset 0 1px 0 rgba(255, 241, 193, .1);
  opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; }
#tip.on { opacity: 1; transform: none; }
#tip b { color: var(--gold2); font-family: var(--serif); font-size: 13.5px; display: block; margin-bottom: 2px; }
#tip .rar { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
#toasts { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 18px 10px 10px; border-radius: 999px; font: 600 14px var(--serif); color: var(--gold3);
  background: linear-gradient(180deg, #3a3150, #221c33); border: 1px solid var(--gold); box-shadow: 0 14px 30px -10px rgba(10, 5, 18, 1), 0 0 30px -8px rgba(232, 184, 90, .7); animation: toast 3.4s ease both; }
.toast canvas { width: 34px; height: 34px; image-rendering: pixelated; border-radius: 50%; border: 2px solid var(--gold); }
@keyframes toast { 0% { opacity: 0; transform: translateY(20px) scale(.9); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 80; }
.spark { position: absolute; width: 8px; height: 8px; margin: -4px; background: var(--c, #ffd27a); transform: rotate(45deg); border-radius: 1px; box-shadow: 0 0 10px var(--c, #ffd27a); animation: spark var(--d, .9s) cubic-bezier(.1, .7, .3, 1) forwards; }
.spark.coin { width: 10px; height: 10px; border-radius: 50%; transform: none; background: radial-gradient(circle at 35% 30%, #fff1c1, #e8b85a 60%, #8c5a1d); }
@keyframes spark { to { transform: translate(var(--x), var(--y)) rotate(200deg) scale(.2); opacity: 0; } }
.flyer { position: fixed; z-index: 85; border-radius: 10px; overflow: hidden; box-shadow: 0 0 30px rgba(255, 210, 122, .9); transition: transform .85s cubic-bezier(.5, -0.3, .3, 1), opacity .85s; }
.flyer canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }

/* ---------- Responsive */
@media (max-width: 1380px) {
  .layout { grid-template-columns: minmax(0, 1fr) 360px; grid-template-areas: 'roster side' 'roster chron'; }
  .panel.chron-panel { position: relative; top: 0; height: 560px; }
  .panel.side-panel { position: relative; top: 0; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'roster' 'side' 'chron'; gap: 16px; padding-top: 14px; }
  .topbar { flex-wrap: wrap; gap: 10px 12px; padding-bottom: 8px; }
  .resources { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .resources::-webkit-scrollbar { display: none; }
  .res { padding-right: 11px; flex: none; }
  .crest-txt h1 { font-size: 17px; }
  .back-txt { display: none; }
  .back { padding: 6px; }
  .panel.side-panel, .panel.chron-panel { position: relative; top: 0; }
  .panel.chron-panel { height: 520px; }
  .dialog { grid-template-columns: 1fr; max-height: none; height: 100%; border-radius: 0; align-content: start; }
  .modal { padding: 0; }
  .f-side { border-right: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding-top: 56px; }
  .f-main { grid-template-columns: 1fr; padding: 18px 16px 28px; }
  .gear { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 26px; }
}
@media (max-width: 480px) {
  body { font-size: 13.5px; }
  .roster { grid-template-columns: 1fr; }
  .panel { padding: 13px; }
  .crest-svg { width: 32px; height: 38px; }
  .crest-txt span { font-size: 10px; }
  .res .rl { display: none; }
  .res .ri { width: 26px; height: 26px; }
  .res .rv { font-size: 14px; }
  .cand { grid-template-columns: 56px 1fr auto; }
  .cand .pframe { width: 56px; height: 56px; }
  .f-portrait { width: 168px; height: 168px; }
  .panel-head { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

.only-scene .topbar, .only-scene .layout { opacity: 0; }
.snap *, .snap *::before, .snap *::after { animation-delay: 0s !important; animation-duration: 0s !important; transition-duration: 0s !important; }
