* { box-sizing: border-box; }
:root { --gold: #c9a24e; --gold2: #e2b863; --ink: #e9dcc0; --dim: #9c8459; --red: #a8281c; --panel: rgba(18,14,11,.88); --line: #5a4528; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #060504; color: var(--ink); font-family: 'EB Garamond', Garamond, serif; font-size: 15px; }
canvas#map { position: fixed; inset: 0; display: block; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }
#game { pointer-events: none; }
#game > * { pointer-events: auto; }
button { font-family: inherit; }
.panel { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #2a2016, 0 8px 30px #000a; border-radius: 6px; backdrop-filter: blur(2px); }
.panel h3, h3 { font-family: Cinzel, serif; font-size: 12px; letter-spacing: .14em; color: var(--gold); margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid #3a2c1c; text-transform: uppercase; }
.btn { font-family: Cinzel, serif; font-weight: 700; font-size: 12px; letter-spacing: .1em; padding: 9px 14px; border-radius: 4px; border: 1px solid var(--gold); color: #f3e2b8; background: linear-gradient(#5a3a1a, #2a1a0c); cursor: pointer; text-align: center; }
.btn:hover { filter: brightness(1.25); box-shadow: 0 0 12px #c9a24e55; }
.btn:disabled { opacity: .35; cursor: default; filter: none; box-shadow: none; }
.btn.sec { border-color: #6d5a3c; background: #15100c; color: var(--gold); }
.btn.big { font-size: 15px; padding: 13px 26px; }
.btn.mini { font-size: 10px; padding: 5px 8px; }
.btn small { display: block; font-size: 9px; font-weight: 400; color: #e0a070; letter-spacing: .04em; }
.btn.on { box-shadow: 0 0 0 2px var(--gold2), 0 0 16px #e2b86388; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.btn-row.col { flex-direction: column; }
select, input { background: #15100c; color: var(--ink); border: 1px solid #6d5a3c; border-radius: 3px; padding: 4px 6px; font-family: inherit; font-size: 14px; }
kbd { border: 1px solid #6d5a3c; border-radius: 3px; padding: 0 4px; font-size: 12px; }

/* Portada */
#title { overflow: auto; z-index: 5; }
.title-bg { position: fixed; inset: 0; background: #0b0807 url(../assets/portada.jpg) center bottom / cover no-repeat; filter: brightness(.55); }
.title-box { position: relative; max-width: 980px; margin: 4vh auto; padding: 26px 34px 30px; text-align: center; background: linear-gradient(rgba(14,10,8,.92), rgba(14,10,8,.8)); border: 1px solid var(--line); border-radius: 8px; }
.title-box .pre { font-family: Cinzel; letter-spacing: .3em; font-size: 11px; color: var(--dim); text-transform: uppercase; margin: 0; }
.title-box h1 { font-family: 'Uncial Antiqua', serif; font-weight: 400; font-size: 54px; line-height: 1; color: var(--gold2); margin: 10px 0 4px; }
.title-box h1 span { font-size: .55em; color: #cdb488; }
.title-box .sub { font-family: Cinzel; font-size: 16px; letter-spacing: .12em; color: #e9d9b6; margin: 4px 0 18px; }
.title-box h3 { border: none; text-align: center; margin-top: 10px; }
.title-box h3 small { text-transform: none; letter-spacing: 0; color: var(--dim); font-family: 'EB Garamond'; font-size: 13px; }
.hero-pick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.hp-card { border: 1px solid #3a2c1c; border-radius: 6px; padding: 10px 8px; background: #0f0c0a; cursor: pointer; text-align: center; transition: .15s; position: relative; }
.hp-card:hover { border-color: var(--gold); }
.hp-card.sel { border-color: var(--gold2); box-shadow: 0 0 14px #c9a24e66, inset 0 0 18px #c9a24e22; }
.hp-card .por { margin: 0 auto 6px; }
.hp-card .n { font-family: Cinzel; font-weight: 700; font-size: 13px; color: #f0d9a8; }
.hp-card .c { font-style: italic; color: var(--dim); font-size: 13px; }
.hp-card .s { font-size: 12px; color: #cdbb98; margin-top: 4px; }
.hp-card .num { position: absolute; top: 6px; right: 8px; font-family: Cinzel; color: var(--gold2); font-weight: 700; }
.opts { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 16px; align-items: center; }
.hint { color: var(--dim); font-size: 13px; margin-top: 14px; }
.por { width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--gold); background: radial-gradient(circle at 40% 35%, #6b3a24, #2a140b) center/cover; display: flex; align-items: center; justify-content: center; font-family: Cinzel; font-weight: 700; font-size: 24px; color: #f3e2b8; flex: none; }

/* Barra superior */
.topbar { position: fixed; left: 0; right: 0; top: 0; height: 58px; border-radius: 0; display: flex; align-items: center; padding: 0 18px; gap: 22px; }
.logo { font-family: 'Uncial Antiqua'; font-size: 22px; color: var(--gold2); white-space: nowrap; }
.logo small { display: block; font-family: Cinzel; font-size: 9px; letter-spacing: .25em; color: var(--dim); }
.fat { display: flex; align-items: center; gap: 8px; }
.fat label, .stat label { font-family: Cinzel; font-size: 10px; letter-spacing: .15em; color: var(--dim); }
.track { display: flex; gap: 2px; }
.track i { width: 22px; height: 24px; border: 1px solid #4a3a26; background: #1a1410; font-style: normal; font-family: Cinzel; font-size: 9px; display: flex; align-items: center; justify-content: center; color: #8a7556; }
.track i.on { background: linear-gradient(#7a1f12, #4a120a); border-color: var(--red); color: #f0d9a8; }
.track i.ev { border-color: var(--gold); }
.track i.end { background: #2a0b07; border-color: #d8432f; color: #ff8a6a; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat b { font-family: Cinzel; font-size: 18px; color: #f0d9a8; }
.mode { margin-left: auto; font-family: Cinzel; font-size: 11px; letter-spacing: .2em; padding: 5px 10px; border-radius: 3px; border: 1px solid #4a6a8a; color: #9ac0e8; background: #0c1520; }
.mode.combat { color: #ff8a6a; border-color: var(--red); background: #2a0b07; }
.tb-btns { display: flex; gap: 8px; align-items: center; }
.speed { font-family: Cinzel; font-size: 10px; color: var(--dim); letter-spacing: .1em; }
.ico { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 4px; background: #15100c; color: var(--gold); font-size: 16px; cursor: pointer; }
.ico.off { opacity: .4; }

/* Paneles laterales */
.side { position: fixed; top: 70px; width: 300px; padding: 10px; max-height: calc(100vh - 340px); overflow: auto; }
.side.left { left: 10px; }
.side.right { right: 10px; max-height: calc(100vh - 82px); }
.hero { display: flex; gap: 9px; padding: 8px; border: 1px solid #2e241a; border-radius: 5px; margin-bottom: 7px; background: #0f0c0a; cursor: pointer; }
.hero.active { border-color: var(--gold); box-shadow: 0 0 14px #c9a24e55, inset 0 0 12px #c9a24e22; }
.hero.ko { opacity: .45; }
.hero .por { width: 50px; height: 50px; font-size: 20px; }
.hb { flex: 1; min-width: 0; }
.hn { font-family: Cinzel; font-weight: 700; font-size: 13px; color: #f0d9a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc { font-size: 12px; color: var(--dim); font-style: italic; margin-top: -2px; }
.bar { position: relative; height: 14px; background: #000; border: 1px solid #3a2c1c; border-radius: 3px; margin: 4px 0; }
.bar span { position: absolute; top: 1px; bottom: 1px; left: 1px; border-radius: 2px; }
.bar em { position: absolute; inset: 0; text-align: center; font-style: normal; font-size: 10px; line-height: 12px; font-family: Cinzel; color: #fff; }
.row { display: flex; align-items: center; gap: 8px; font-family: Cinzel; font-size: 11px; color: #d9c7a0; flex-wrap: wrap; }
.pips i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid #6d5a3c; display: inline-block; margin-right: 1px; }
.pips i.on { background: #c97a2a; border-color: #e09a4a; }
.res b { width: 10px; height: 10px; border: 1px solid #6d5a3c; background: #1a1410; transform: rotate(45deg); margin: 0 2px; display: inline-block; }
.res b.on { background: #4a8ad8; border-color: #8ab8ff; box-shadow: 0 0 5px #4a8ad8; }
.tag { font-size: 9px; padding: 0 5px; border-radius: 8px; border: 1px solid; letter-spacing: .03em; }
.items { font-size: 11px; color: #cdbb98; font-family: 'EB Garamond'; }
.init { list-style: none; margin: 0 0 10px; padding: 0; }
.init li { display: flex; align-items: center; gap: 7px; padding: 4px 7px; font-family: Cinzel; font-size: 12px; border-left: 3px solid transparent; }
.init li .dot { width: 10px; height: 10px; border-radius: 50%; }
.init li em { margin-left: auto; font-style: normal; color: var(--dim); }
.init li.done { opacity: .35; }
.init li.now { background: linear-gradient(90deg, #c9a24e33, transparent); border-left-color: var(--gold); color: #f3e2b8; }
.lord { border: 1px solid #4a1a12; background: radial-gradient(circle at 30% 0, #3a0e09, #120a08); border-radius: 5px; padding: 9px; margin-bottom: 10px; }
.lord .t { font-family: Cinzel; font-size: 13px; color: #ff8a6a; letter-spacing: .08em; margin-bottom: 6px; }
.lord .t span { font-size: 10px; color: #a07060; }
.am { display: flex; gap: 2px; margin: 3px 0 7px; }
.am i { flex: 1; height: 10px; background: #1a0d0a; border: 1px solid #4a1a12; }
.am i.on { background: linear-gradient(#d8432f, #7a1f12); }
.lrow { display: flex; justify-content: space-between; align-items: center; font-family: Cinzel; font-size: 11px; color: #d9a890; margin-top: 3px; }
.ord i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid #d8432f; margin-left: 3px; }
.ord i.on { background: #d8432f; }
.hand span { display: inline-block; width: 16px; height: 22px; border-radius: 2px; border: 1px solid #7a1f12; background: repeating-linear-gradient(45deg,#2a0b07 0 3px,#3a120b 3px 6px); margin-left: 3px; }
.log { list-style: none; margin: 0; padding: 0; font-size: 13px; line-height: 1.28; max-height: 34vh; overflow: auto; }
.log li { padding: 3px 0; border-bottom: 1px solid #241b13; color: #cdbb98; }
.log li.r { font-family: Cinzel; color: var(--gold); font-size: 11px; letter-spacing: .14em; }
.log li.m { color: #e59b85; } .log li.g { color: #ffd36b; } .log li.b { color: #9ac0e8; }

/* Cartas */
.hand-area { position: fixed; left: 320px; right: 320px; bottom: 8px; display: flex; align-items: flex-end; justify-content: center; gap: 14px; }
.who { position: absolute; left: 50%; transform: translateX(-50%); top: -32px; font-family: Cinzel; font-size: 12px; letter-spacing: .18em; color: var(--gold); background: #0d0a08e0; padding: 4px 14px; border: 1px solid var(--line); border-radius: 3px; white-space: nowrap; }
.cards { display: flex; gap: 14px; align-items: flex-end; }
.card { position: relative; width: 200px; background: linear-gradient(#efe0bc, #d9c494); border-radius: 9px; border: 3px solid #6e3b1f; box-shadow: 0 10px 25px #000c; color: #2b1a0e; padding: 6px; display: flex; flex-direction: column; transition: transform .15s; }
.card:hover { transform: translateY(-10px); }
.card.used { transform: rotate(-7deg) translateY(16px); filter: grayscale(.7) brightness(.5); }
.card.used.esf { filter: none; transform: rotate(-4deg) translateY(6px); box-shadow: 0 0 0 2px #ff9a4a, 0 0 18px #ff9a4a88; }
.face { border-radius: 5px; padding: 5px 7px; cursor: pointer; min-height: 62px; border: 1px solid transparent; }
.face:hover { background: #fff6dd; border-color: var(--gold); }
.face.sel { background: #fff3cc; box-shadow: inset 0 0 0 2px var(--gold); }
.face.blocked { opacity: .45; }
.face.chosen { background: #e8f2d8; }
.ft { display: flex; align-items: center; gap: 5px; font-family: Cinzel; font-weight: 700; font-size: 12.5px; color: #7a1f12; }
.ft .leaf { color: #356b2a; }
.face p { margin: 3px 0 0; font-size: 12.5px; line-height: 1.18; }
.or { text-align: center; font-family: Cinzel; font-size: 10px; color: #8a6a3a; margin: 0; }
.slots { margin-left: auto; font-size: 10px; color: #6e3b1f; }
.stamp { position: absolute; top: 44%; left: 50%; transform: translate(-50%,-50%) rotate(-12deg); font-family: Cinzel; font-weight: 700; font-size: 18px; color: #d8432f; border: 3px solid #d8432f; padding: 1px 10px; letter-spacing: .12em; pointer-events: none; }
.actions { display: flex; flex-direction: column; gap: 6px; margin-left: 8px; align-self: center; }
.basic { display: flex; gap: 4px; }

/* Dados y banner */
.dice { position: fixed; right: 320px; bottom: 270px; width: 330px; padding: 10px 12px; }
.dice .t { font-family: Cinzel; font-size: 12px; color: #f0d9a8; }
.dice .s { font-size: 13px; color: var(--dim); font-style: italic; margin-bottom: 6px; }
.dr { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.die { position: relative; width: 44px; height: 44px; animation: roll .45s ease-out; }
@keyframes roll { 0% { transform: rotate(-200deg) scale(.4); opacity: 0; } 70% { transform: rotate(15deg) scale(1.1); opacity: 1; } 100% { transform: rotate(0) scale(1); } }
.die svg { position: absolute; inset: 0; }
.die polygon { fill: #2b2219; stroke: #8a7556; stroke-width: 2; }
.die span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: Cinzel; font-weight: 700; font-size: 16px; color: #cdbb98; }
.die.ok polygon { fill: #5a3d10; stroke: var(--gold2); } .die.ok span { color: #ffe39a; }
.die.crit polygon { fill: #7a4a0a; stroke: #ffd36b; stroke-width: 3; } .die.crit { filter: drop-shadow(0 0 8px #ffb347); } .die.crit span { color: #fff3c4; }
.die.ko { opacity: .45; }
.arr { color: #ffd36b; font-size: 14px; }
.res-line { margin-top: 6px; font-family: Cinzel; font-size: 14px; color: #ffd36b; }
.banner { position: fixed; top: 76px; left: 50%; transform: translateX(-50%); font-family: Cinzel; font-size: 15px; letter-spacing: .15em; padding: 8px 20px; border: 1px solid var(--line); background: #0d0a08e8; color: #f0d9a8; border-radius: 4px; }
.banner.lord { color: #ff8a6a; border-color: var(--red); }
.tooltip { position: fixed; z-index: 30; max-width: 280px; padding: 8px 10px; background: #0d0a08f2; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; pointer-events: none; }
.tooltip b { font-family: Cinzel; color: var(--gold2); }

/* Modales */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.72); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-box { width: min(760px, 92vw); max-height: 90vh; overflow: auto; background: linear-gradient(#efe0bc, #dcc797); color: #2b1a0e; border: 3px solid #6e3b1f; border-radius: 8px; padding: 22px 30px; box-shadow: 0 20px 60px #000; font-size: 16px; }
.modal-box.small { width: 380px; }
.modal-box h2 { font-family: Cinzel; color: #7a1f12; margin: 0 0 10px; font-size: 22px; }
.modal-box em { color: #3a2313; }
.modal-box p { line-height: 1.4; }
.modal-box .num { display: inline-flex; width: 38px; height: 38px; border-radius: 50%; background: #7a1f12; color: #f6ead0; font-family: Cinzel; font-weight: 700; align-items: center; justify-content: center; margin-right: 10px; }
.modal-img img { width: 100%; border: 2px solid #6e3b1f; border-radius: 4px; margin-bottom: 10px; max-height: 300px; object-fit: cover; }
.modal-box .btn { color: #f3e2b8; }
.modal-box .choice { display: block; width: 100%; margin: 6px 0; text-align: left; font-family: 'EB Garamond'; font-weight: 400; font-size: 15px; letter-spacing: 0; }
.modal-box table { border-collapse: collapse; width: 100%; font-size: 14px; }
.modal-box td, .modal-box th { padding: 4px 6px; border-bottom: 1px solid #a8885a; text-align: left; }
.modal-box th { background: #6e3b1f; color: #f3e6c6; font-family: Cinzel; font-size: 11px; }

/* Simulación */
#sim { background: #0b0807 url(../assets/parte2.jpg) center/cover; overflow: auto; z-index: 6; }
.sim-box { max-width: 1000px; margin: 5vh auto; padding: 20px 28px; }
.sim-box h2 { font-family: Cinzel; color: var(--gold2); }
.prog { height: 6px; background: #1a1410; border-radius: 3px; margin: 14px 0; overflow: hidden; }
.prog span { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
#simOut table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0 18px; }
#simOut th { font-family: Cinzel; font-size: 11px; color: #f3e6c6; background: #3a2414; padding: 5px 6px; text-align: left; }
#simOut td { padding: 4px 6px; border-bottom: 1px solid #2e241a; }
.big-num { font-family: Cinzel; font-size: 40px; color: var(--gold2); }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.kpi { background: #0f0c0a; border: 1px solid #2e241a; border-radius: 5px; padding: 10px; text-align: center; }
.kpi label { display: block; font-family: Cinzel; font-size: 10px; letter-spacing: .12em; color: var(--dim); }
.kpi b { font-family: Cinzel; font-size: 22px; color: #f0d9a8; }
@media (max-width: 1400px) { .side { width: 260px; } .hand-area { left: 270px; right: 270px; } .card { width: 175px; } .dice { right: 280px; } }
