/* ═══════════════════════════════════════════════════════════════
   Reforma 1517 · El Tablero de Europa — sistema visual
   1 Tokens · 2 Base · 3 Controles · 4 Entrada · 5 Sala · 6 HUD · 7 Mapa
   8 Panel lateral · 9 Diálogos · 10 Avisos · 11 Movimiento · 12 Adaptación
   ═══════════════════════════════════════════════════════════════ */

/* 1 ── Tokens ─────────────────────────────────────────────────── */
:root {
  --obsidian: #06060A;
  --obsidian-2: #111016;
  --gold: #C9A84C;
  --gold-soft: #dcc483;
  --gold-deep: #8f7431;
  --parchment: #E9E0CC;
  --parchment-2: #ddd2b8;
  --ivory: #F4EDDD;
  --paper: #f7f1e3;
  --ink: #24231F;
  --ink-2: #3a352b;
  --muted: #655c4c;
  --muted-light: #aba18c;
  --line: rgba(36, 35, 31, .12);
  --line-strong: rgba(36, 35, 31, .24);
  --red: #A84646;
  --blue: #607FA8;
  --green: #587F5D;
  --red-ink: #8a3a32;
  --blue-ink: #3f5878;
  --ok: #4a7a4e;
  --warn: #a7772c;
  --err: #a2443c;

  --f-title: "Cinzel", "Trajan Pro", Georgia, serif;
  --f-serif: "EB Garamond", Garamond, "Times New Roman", serif;
  --f-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r-sm: 4px;
  --r: 6px;
  --shadow-1: 0 1px 2px rgba(20, 14, 4, .10), 0 6px 18px rgba(20, 14, 4, .08);
  --shadow-2: 0 22px 60px rgba(6, 6, 10, .38), 0 2px 8px rgba(6, 6, 10, .2);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  /* Duraciones del sistema de movimiento */
  --t-hover: 160ms;
  --t-panel: 280ms;
  --t-select: 300ms;
  --t-toast: 320ms;
  --t-card: 520ms;
  --ease-soft: cubic-bezier(.33, 1, .68, 1);
  --hud-h: 60px;
  --side-w: 388px;
}

/* 2 ── Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--obsidian); color: var(--ink); font: 400 14px/1.5 var(--f-ui); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--gold); color: var(--obsidian); padding: 8px 12px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
#sprite { position: absolute; }
.icon { width: 18px; height: 18px; flex: none; }
.eyebrow { margin: 0; font: 600 10.5px/1.2 var(--f-ui); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.eyebrow.gold { color: var(--gold); }
.hint { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.boot { position: fixed; inset: 0; display: grid; place-content: center; text-align: center; background: var(--obsidian); color: var(--muted-light); z-index: 90; transition: opacity .5s var(--ease); }
.boot-mark { font: 700 34px var(--f-title); color: var(--ivory); border: 1px solid var(--gold-deep); padding: 12px 14px; letter-spacing: -1px; margin: 0 auto 14px; animation: breathe 2.4s var(--ease) infinite; }
.boot-mark span { color: var(--gold); }
.boot p { font: italic 16px var(--f-serif); margin: 0; }
body:not(.booting) .boot { opacity: 0; pointer-events: none; }

/* 3 ── Controles ──────────────────────────────────────────────── */
.btn { --bg: transparent; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: var(--r-sm); border: 1px solid transparent; background: var(--bg); font-weight: 600; font-size: 13.5px; letter-spacing: .01em; transition: transform var(--t-hover) var(--ease), background-color var(--t-hover), border-color var(--t-hover), box-shadow var(--t-hover), color var(--t-hover), opacity var(--t-hover); user-select: none; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.985); transition-duration: 60ms; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { --bg: var(--ink); color: var(--ivory); border-color: var(--ink); }
.btn-primary:hover:not(:disabled) { --bg: #35312a; box-shadow: inset 0 0 0 1px rgba(201,168,76,.5), 0 6px 16px rgba(20,14,4,.18); }
.btn-gold { --bg: var(--gold); color: var(--obsidian); border-color: #b8963f; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.btn-gold:hover:not(:disabled) { --bg: var(--gold-soft); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 8px 22px rgba(201,168,76,.28); }
.btn-secondary { color: var(--ink); border-color: var(--line-strong); --bg: rgba(255,255,255,.4); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink-2); --bg: rgba(255,255,255,.7); }
.btn-ghost { color: var(--muted); padding-inline: 10px; }
.btn-ghost:hover:not(:disabled) { color: var(--ink); background: rgba(36,35,31,.05); }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid; border-color: var(--gold) transparent var(--gold) transparent; animation: spin .8s linear infinite; }
.btn.is-done { animation: done-pop .5s var(--ease-out); }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: rgba(244,237,221,.92); color: var(--ink-2); transition: background var(--t-hover), color var(--t-hover), transform var(--t-hover) var(--ease); }
.icon-btn:hover { background: var(--ivory); color: var(--ink); }
.link-btn { display: inline-flex; align-items: center; gap: 8px; padding: 8px 0; background: none; border: 0; color: var(--parchment); font-size: 13px; letter-spacing: .02em; border-bottom: 1px solid transparent; transition: color var(--t-hover), border-color var(--t-hover); }
.link-btn:hover { color: var(--gold-soft); border-color: rgba(201,168,76,.5); }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field.grow { flex: 1; }
.field-label { font: 600 10.5px var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 0; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: rgba(255,255,255,.55); color: var(--ink); outline: none; transition: border-color var(--t-hover), box-shadow var(--t-hover), background var(--t-hover); }
input:focus, select:focus { border-color: var(--gold-deep); background: #fffdf7; box-shadow: 0 0 0 3px rgba(201,168,76,.22); }
#home-code { text-transform: uppercase; letter-spacing: .3em; font-weight: 600; }
.form-msg { margin: 0; min-height: 20px; font-size: 13px; color: var(--err); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(36,35,31,.07); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip .icon { width: 13px; height: 13px; }
.tag-ai, .tag-you { display: inline-block; padding: 1px 6px; border-radius: 3px; font: 700 10px/1.5 var(--f-ui); letter-spacing: .08em; }
.tag-ai { background: rgba(96,127,168,.16); color: var(--blue-ink); }
.tag-you { background: rgba(201,168,76,.24); color: #6d5620; }
.emblem { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fbf6e8; box-shadow: inset 0 0 0 2px rgba(255,255,255,.22), 0 1px 2px rgba(0,0,0,.25); flex: none; }
.emblem .icon { width: 20px; height: 20px; }
.emblem.lg { width: 52px; height: 52px; }
.emblem.lg .icon { width: 30px; height: 30px; }
.emblem.sm { width: 26px; height: 26px; }
.emblem.sm .icon { width: 15px; height: 15px; }

/* 4 ── Entrada ────────────────────────────────────────────────── */
.screen { min-height: 100vh; min-height: 100dvh; animation: screen-in .5s var(--ease-out); }
.screen-home { position: relative; display: grid; grid-template-rows: 1fr auto; background: var(--obsidian); color: var(--ivory); overflow: hidden; isolation: isolate; }
.home-map { position: absolute; inset: 0; z-index: -2; opacity: .55; filter: sepia(.25) saturate(.85) brightness(.95); }
.home-map svg { width: 100%; height: 100%; }
.home-shade { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, var(--obsidian) 18%, rgba(6,6,10,.84) 42%, rgba(6,6,10,.35) 72%, rgba(6,6,10,.62) 100%), linear-gradient(0deg, var(--obsidian) 0, transparent 24%); }
.home-inner { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(340px, 470px); gap: clamp(24px, 5vw, 80px); align-items: center; max-width: 1280px; width: 100%; margin: 0 auto; padding: clamp(28px, 6vh, 72px) clamp(16px, 4vw, 56px); }
.home-title { margin: 18px 0 4px; font: 700 clamp(48px, 7.4vw, 104px)/.95 var(--f-title); letter-spacing: .02em; color: var(--ivory); }
.home-title .ht-y { color: var(--gold); display: inline-block; }
.home-sub { margin: 6px 0 22px; font: 500 clamp(18px, 2.2vw, 26px) var(--f-title); letter-spacing: .32em; text-transform: uppercase; color: var(--parchment); }
.home-lede { max-width: 520px; margin: 0 0 22px; font: 400 clamp(17px, 1.6vw, 20px)/1.6 var(--f-serif); color: #d2c9b5; }
.home-links { display: flex; flex-wrap: wrap; gap: 6px 26px; }
.home-card { position: relative; display: flex; flex-direction: column; gap: 18px; padding: 28px; background: var(--ivory); color: var(--ink); border-radius: var(--r); box-shadow: var(--shadow-2); }
.home-card::before, .modal::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(143,116,49,.32); border-radius: 3px; pointer-events: none; }
.home-actions { display: flex; flex-direction: column; gap: 14px; }
.create-row, .join-row { display: flex; gap: 10px; align-items: flex-end; }
.create-row .field { flex: 1; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.home-foot { padding: 14px; text-align: center; font-size: 12px; color: #938a78; letter-spacing: .02em; }
.faction-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fpick { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: center; padding: 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: rgba(255,255,255,.4); text-align: left; transition: border-color var(--t-hover), background var(--t-hover), transform var(--t-hover) var(--ease), box-shadow var(--t-hover); }
.fpick:hover { transform: translateY(-1px); border-color: var(--c); }
.fpick[aria-checked="true"] { border-color: var(--c); background: #fffdf6; box-shadow: inset 3px 0 0 var(--c), 0 4px 14px rgba(20,14,4,.08); }
.fpick .emblem { grid-row: span 2; }
.fpick strong { font: 600 13px var(--f-title); letter-spacing: .02em; }
.fpick small { font-size: 12px; color: var(--muted); line-height: 1.3; }

/* 5 ── Sala de espera ─────────────────────────────────────────── */
.screen-lobby { background: radial-gradient(ellipse at 30% 0%, #f3ead6 0, transparent 60%), var(--parchment); padding: clamp(18px, 4vw, 48px) clamp(16px, 4vw, 48px); }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; max-width: 1280px; margin: 0 auto 24px; }
.lobby-title { margin: 6px 0 0; font: 600 clamp(28px, 4vw, 44px) var(--f-title); }
.code-box { display: grid; grid-template-columns: auto auto; align-items: center; gap: 2px 14px; padding: 14px 18px; background: var(--obsidian); color: var(--ivory); border-radius: var(--r); box-shadow: var(--shadow-1); }
.code-label { grid-column: 1 / -1; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--muted-light); }
.code { font: 700 32px var(--f-title); letter-spacing: .24em; color: var(--gold); }
.code-box .btn-ghost { color: var(--parchment); }
.code-box .btn-ghost:hover { background: rgba(244,237,221,.08); color: var(--gold-soft); }
.lobby-grid { display: grid; grid-template-columns: 1fr 1.4fr .9fr; gap: 16px; max-width: 1280px; margin: 0 auto; align-items: start; }
.panel { background: var(--ivory); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1); }
.panel-title { display: flex; justify-content: space-between; align-items: baseline; margin: 0; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); font: 600 11px var(--f-ui); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.lobby-players, .lobby-factions { padding-bottom: 16px; }
.lobby-controls { display: flex; flex-direction: column; gap: 12px; padding: 0 0 16px; }
.lobby-controls > :not(.panel-title) { margin: 0 18px; }
.seat-list { list-style: none; margin: 0; padding: 8px 10px; }
.seat { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 8px; border-radius: var(--r-sm); animation: rise .35s var(--ease-out) both; }
.seat + .seat { border-top: 1px solid var(--line); }
.seat-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.seat-name .icon { width: 15px; height: 15px; color: var(--gold-deep); }
.seat-sub { font-size: 12px; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: rgba(36,35,31,.07); color: var(--muted); white-space: nowrap; }
.status-pill .icon { width: 14px; height: 14px; }
.status-pill.ready { background: rgba(79,122,82,.14); color: var(--ok); }
.status-pill.off { background: rgba(162,68,60,.12); color: var(--err); }
.status-pill.bot { background: rgba(96,127,168,.15); color: var(--blue-ink); }
.seat.empty { color: var(--muted-light); font-style: italic; font-family: var(--f-serif); font-size: 15px; }
.lobby-players .hint { margin: 4px 18px 0; }
.faction-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 16px 0; }
.fcard { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 14px; text-align: left; border: 1px solid var(--line-strong); border-radius: var(--r); background: linear-gradient(180deg, rgba(255,255,255,.5), rgba(255,255,255,.15)); transition: box-shadow var(--t-hover), border-color var(--t-hover); overflow: hidden; }
.fcard::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--c); }
.fcard:hover { box-shadow: var(--shadow-1); border-color: var(--c); }
.fcard.mine { border-color: var(--c); box-shadow: 0 0 0 1px var(--c), var(--shadow-1); background: #fffdf7; }
.fcard.taken { opacity: .72; }
.fcard-head { display: flex; gap: 10px; align-items: center; }
.fcard-head strong { font: 600 15px var(--f-title); }
.fcard-head small { display: block; font-size: 12px; color: var(--muted); }
.fcard p { margin: 0; font: 400 14.5px/1.45 var(--f-serif); color: var(--ink-2); }
.fcard dl { margin: 0; display: grid; gap: 6px; font-size: 12.5px; }
.fcard dt { font-weight: 700; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.fcard dd { margin: 0; line-height: 1.4; }
.fcard-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.fcard-actions .icon { width: 15px; height: 15px; }

/* 6 ── HUD ────────────────────────────────────────────────────── */
.screen-game { display: grid; grid-template-rows: var(--hud-h) minmax(0, 1fr); height: 100vh; height: 100dvh; background: var(--obsidian); }
.game-body { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); min-height: 0; }
.hud { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; align-items: center; gap: 20px; padding: 0 14px 0 16px; background: linear-gradient(180deg, #0c0b10, var(--obsidian)); color: var(--ivory); border-bottom: 1px solid rgba(201,168,76,.26); position: relative; z-index: 6; }
.hud-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-brand .mark { font: 700 16px var(--f-title); border: 1px solid var(--gold-deep); padding: 4px 6px; letter-spacing: -1px; line-height: 1; }
.hud-brand .mark span { color: var(--gold); }
.hud-brand .title { display: flex; flex-direction: column; line-height: 1.15; }
.hud-brand .title b { font: 600 14px var(--f-title); letter-spacing: .08em; }
.hud-brand .title small { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-light); }
.hud-time { display: flex; align-items: center; gap: 14px; padding-left: 20px; border-left: 1px solid rgba(244,237,221,.1); }
.hud-year { display: flex; flex-direction: column; line-height: 1; }
.hud-year .yr { font: 700 25px var(--f-title); color: var(--gold); letter-spacing: .04em; }
.hud-year .yr.tick { animation: year-tick .9s var(--ease-out); }
.hud-year .rd { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-light); margin-top: 4px; }
.timeline { display: flex; align-items: center; gap: 3px; list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; width: 13px; height: 4px; border-radius: 2px; background: rgba(244,237,221,.14); transition: background .4s; }
.timeline li.past { background: rgba(201,168,76,.5); }
.timeline li.now { background: var(--gold); box-shadow: 0 0 8px rgba(201,168,76,.55); }
.timeline li:hover::after { content: attr(data-year); position: absolute; top: 9px; left: 50%; transform: translateX(-50%); font-size: 10.5px; color: var(--parchment); white-space: nowrap; }
.hud-turn { display: flex; align-items: center; gap: 10px; min-width: 0; justify-self: center; padding: 5px 14px 5px 6px; border-radius: 99px; background: rgba(244,237,221,.05); border: 1px solid rgba(244,237,221,.08); transition: background var(--t-panel), border-color var(--t-panel); }
.hud-turn:empty { display: none; }
.hud-turn .who { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; }
.hud-turn strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.hud-turn .ring { width: 28px; height: 28px; transform: rotate(-90deg); flex: none; }
.hud-turn .ring circle { fill: none; stroke-width: 3; }
.hud-turn .ring .bg { stroke: rgba(244,237,221,.12); }
.hud-turn .ring .fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.hud-turn.mine { background: rgba(201,168,76,.12); border-color: rgba(201,168,76,.4); }
.hud-turn .yours { color: var(--gold-soft); font-weight: 600; letter-spacing: .02em; }
.hud-res { display: flex; gap: 4px; }
.res { position: relative; display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: var(--r-sm); transition: background var(--t-hover); }
.res:hover { background: rgba(244,237,221,.06); }
.res .icon { width: 16px; height: 16px; }
.res b { font: 600 15px var(--f-ui); font-variant-numeric: tabular-nums; min-width: 1.2em; }
.res small { display: none; }
.res-gold .icon { color: #dcb95b; }
.res-influence .icon { color: #a4bbdb; }
.res-fervor .icon { color: #e08b77; }
.res-legacy .icon { color: #e8d9a9; }
.res.bump { animation: bump .6s var(--ease-out); }
.res.bump.down { animation: bump-down .6s var(--ease-out); }
.float-delta { position: absolute; left: 50%; top: -2px; transform: translateX(-50%); font: 700 13px var(--f-ui); pointer-events: none; animation: float-up 1.3s var(--ease-out) forwards; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.5); z-index: 2; }
.float-delta.pos { color: #b9e0a5; }
.float-delta.neg { color: #f0a493; }
.pl-res .float-delta { text-shadow: none; }
.pl-res .float-delta.pos { color: var(--ok); }
.pl-res .float-delta.neg { color: var(--err); }
.hud-tools { display: flex; align-items: center; gap: 6px; }
.hud-tools .icon-btn { background: transparent; color: var(--parchment); border-color: rgba(244,237,221,.16); }
.hud-tools .icon-btn:hover { background: rgba(244,237,221,.08); color: var(--gold-soft); }
.conn { display: inline-flex; align-items: center; gap: 6px; padding-left: 6px; font-size: 12px; color: var(--muted-light); }
.conn i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px rgba(111,170,114,.7); }
.conn.off i { background: var(--err); box-shadow: 0 0 8px rgba(200,80,70,.7); animation: blink 1s infinite; }

/* 7 ── Mapa ───────────────────────────────────────────────────── */
.map-wrap { position: relative; min-height: 0; overflow: hidden; background: #c4c8b7; isolation: isolate; }
.map-stage { position: absolute; inset: 0; }
/* Textura de papel y viñeta como capas fijas: se rasterizan una vez y no penalizan el zoom. */
.map-stage::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background-image:
    radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(58,40,14,.30) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .23 0 0 0 0 .12 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply; opacity: .6; }
.map-wrap::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(76,62,38,.45); box-shadow: inset 0 0 0 3px rgba(242,234,214,.25), inset 0 0 0 4px rgba(76,62,38,.25); pointer-events: none; z-index: 2; }
.atlas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; outline: none; }
.atlas.dragging { cursor: grabbing; }
.atlas:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
.atlas .sea { fill: #c4c8b7; }
.atlas .graticule line { stroke: #6e6650; stroke-width: .6; opacity: .22; vector-effect: non-scaling-stroke; }
.atlas .waterlines polygon { fill: none; stroke: #4c6463; stroke-linejoin: round; }
.atlas .land { fill: #ece1c6; }
.atlas .coast { fill: none; stroke: #463d2e; stroke-width: 1.1; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }
.atlas .lake { fill: #c4c8b7; stroke: #463d2e; stroke-width: .8; vector-effect: non-scaling-stroke; }
.atlas .river { fill: none; stroke: #6c888b; stroke-width: 1.3; stroke-linecap: round; opacity: .85; vector-effect: non-scaling-stroke; }
.atlas .mount { fill: none; stroke: #8b7653; stroke-width: 1.1; stroke-linecap: round; stroke-linejoin: round; opacity: .7; }
.atlas .label { pointer-events: none; text-anchor: middle; }
.atlas .label-sea { font: italic 400 14px var(--f-serif); fill: #45595a; letter-spacing: .14em; opacity: .85; }
.atlas .label-realm { font: 600 11px var(--f-title); fill: #574630; letter-spacing: .5em; opacity: .4; }
.atlas .label-relief { font: italic 400 13px var(--f-serif); fill: #6a583b; letter-spacing: .3em; opacity: .7; }
.atlas .region { fill: var(--region); fill-opacity: .28; stroke: #5d4d33; stroke-opacity: .5; stroke-width: 1; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill-opacity var(--t-hover) var(--ease), stroke var(--t-hover), stroke-width var(--t-hover), stroke-opacity var(--t-hover); }
.atlas .region.controlled { fill: color-mix(in srgb, var(--controller) 42%, var(--region)); fill-opacity: .45; }
.atlas .region:hover { fill-opacity: .5; stroke: var(--gold-deep); stroke-opacity: .95; stroke-width: 1.6; }
.atlas .region.selected { stroke: var(--gold-deep); stroke-opacity: 1; stroke-width: 2.2; stroke-dasharray: 7 4; fill-opacity: .5; animation: march 1.4s linear infinite; }
.atlas .route .leg-bed { fill: none; stroke: #f6eedb; stroke-width: 7; stroke-linecap: round; opacity: .55; }
.atlas .route .leg-bed.sea { stroke: #dfe3d5; opacity: .45; }
.atlas .route .leg { fill: none; stroke: #5f4a2c; stroke-width: 2.2; stroke-dasharray: .5 5.5; stroke-linecap: round; opacity: .9; }
.atlas .route .leg-sea { stroke: #46605f; stroke-dasharray: 6 5; stroke-width: 1.4; }
.atlas .route .chevron { fill: none; stroke: #5f4a2c; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }

/* Tablero */
.atlas .board-dim { fill: #2c2416; opacity: .2; pointer-events: none; }
.atlas .board-glow { fill: rgba(255, 249, 232, .14); stroke: rgba(255, 249, 232, .5); stroke-width: 10; pointer-events: none; }
.atlas .board-frame { fill: none; stroke: #3a3022; stroke-width: 2.4; vector-effect: non-scaling-stroke; pointer-events: none; }
.atlas .board-frame.inner { stroke: var(--gold-deep); stroke-width: 1; }
.atlas .board-corner path { fill: var(--gold-deep); stroke: #3a3022; stroke-width: .8; }
.atlas .board-corner circle { fill: #3a3022; }
.atlas .board-plaque path { fill: #f4ecd8; stroke: #3a3022; stroke-width: 1.3; filter: drop-shadow(0 2px 3px rgba(40, 28, 10, .3)); }
.atlas .plaque-title { font: 700 11.5px var(--f-title); letter-spacing: .32em; fill: #2a2318; text-anchor: middle; }
.atlas .plaque-sub { font: italic 400 9.5px var(--f-serif); letter-spacing: .14em; fill: #6a583b; text-anchor: middle; }

.space { cursor: pointer; outline: none; }
.space .hit { fill: transparent; }
.space .space-body { transform-box: fill-box; transform-origin: center; transition: transform var(--t-hover) var(--ease); }
.space:hover .space-body, .space:focus-visible .space-body { transform: scale(1.1); }
.space .halo { fill: none; stroke: var(--gold); stroke-width: 2.2; opacity: 0; transform-box: fill-box; transform-origin: center; transition: opacity var(--t-hover); }
.space:hover .halo, .space:focus-visible .halo { opacity: .65; }
.space.selected .halo { opacity: 1; stroke-dasharray: 5 3.5; animation: select-in var(--t-select) var(--ease-out), spin-slow 7s linear var(--t-select) infinite; }
.space.active-here .halo { opacity: 1; animation: pulse-ring 1.8s var(--ease) infinite; }
.space .owner-ring { fill: none; stroke: transparent; stroke-width: 4; transition: stroke .4s; }
.space.owned .owner-ring { stroke: var(--owner); }
.space .city-core { fill: #f8f2df; stroke: #2e281d; stroke-width: 1.5; transition: fill .4s; }
.space.owned .city-core { fill: color-mix(in srgb, var(--owner) 16%, #f8f2df); }
.space .city-glyph { fill: #2e281d; }
.space.owned .city-glyph { fill: color-mix(in srgb, var(--owner) 75%, #1c170f); }
.space .tile { fill: #f3ead4; stroke: #5c4c33; stroke-width: 1.2; }
.space .tile-icon { color: #4a3d29; pointer-events: none; }
.space-quiz .tile-icon, .space-institution .tile-icon { color: var(--blue-ink); }
.space-event .tile { fill: #f0e1c8; }
.space-event .tile-icon { color: var(--red-ink); }
.space-fair .tile-icon { color: #4d6b4f; }
.space-conflict .tile-icon { color: #6b3a2a; }
.space .medal { fill: var(--gold); stroke: #4a3a17; stroke-width: 1.4; }
.space .medal-inner { fill: none; stroke: #4a3a17; stroke-width: .8; stroke-dasharray: 1.5 1.5; }
.space .medal-text { font: 700 8px var(--f-title); fill: #2b220f; text-anchor: middle; pointer-events: none; }
.space-name { font: 600 calc(10.5px * (1 + .3 * (var(--zoom, 1) - 1)) / var(--zoom, 1)) var(--f-title); fill: #211b12; paint-order: stroke; stroke: rgba(244,236,216,.94); stroke-width: 3.2px; stroke-linejoin: round; letter-spacing: .03em; pointer-events: none; }
.space-name.minor { font: 600 calc(7.5px * (1 + .3 * (var(--zoom, 1) - 1)) / var(--zoom, 1)) var(--f-ui); letter-spacing: .12em; text-transform: uppercase; fill: #574a34; opacity: 0; transition: opacity var(--t-hover); }
.space-sub { font: 500 calc(8.5px * (1 + .3 * (var(--zoom, 1) - 1)) / var(--zoom, 1)) var(--f-ui); fill: #574a34; paint-order: stroke; stroke: rgba(244,236,216,.9); stroke-width: 2.6px; pointer-events: none; opacity: 0; transition: opacity var(--t-hover); }
.atlas.zoomed-in .space-name.minor, .atlas.zoomed-in .space-sub, .space:hover .space-name.minor, .space:hover .space-sub, .space.selected .space-sub, .space.selected .space-name.minor { opacity: 1; }
.space.owned .space-sub { fill: color-mix(in srgb, var(--owner) 70%, #211b12); }
.space .bld circle { fill: #2b251b; stroke: #f2ead6; stroke-width: 1.2; }
.space .bld use { color: #f2ead6; }
.space .bld, .space .idea { transform-box: fill-box; transform-origin: center; animation: pop-in .5s var(--ease-out) both; }
.space .idea { fill: var(--c); stroke: #f8f2df; stroke-width: 1.1; }
.space.landed .space-body { animation: land .55s var(--ease-out); }
.space.flash .halo { opacity: 1; animation: flash 1.4s var(--ease-out); }
.ripple circle { fill: none; stroke: var(--c); stroke-width: 2.5; transform-box: fill-box; transform-origin: center; animation: ripple 1.5s var(--ease-out) forwards; }
.ripple circle.late { animation-delay: .25s; opacity: 0; }
.ripple-build circle { stroke: var(--gold); stroke-width: 3; }
.token { transition: transform .5s var(--ease-soft); pointer-events: none; }
.token.hop .token-figure { animation: hop var(--hop, 320ms) var(--ease) both; }
.token.hop .token-shadow { animation: hop-shadow var(--hop, 320ms) var(--ease) both; transform-box: fill-box; transform-origin: center; }
.token .token-shadow { fill: #000; opacity: .3; }
.token .token-base { fill: #2b2418; stroke: color-mix(in srgb, var(--c) 60%, #000); stroke-width: 1; }
.token .token-pole { stroke: #2b2418; stroke-width: 1.7; stroke-linecap: round; }
.token .token-cloth { fill: var(--c); stroke: color-mix(in srgb, var(--c) 45%, #000); stroke-width: .9; stroke-linejoin: round; filter: drop-shadow(0 1px 1.2px rgba(30, 20, 5, .35)); }
.token .token-emblem { color: #fbf6e8; }
.token .token-finial { fill: #e8dfc6; stroke: #2b2418; stroke-width: .8; }
.token.me .token-finial { fill: var(--gold); r: 2.3; }
.token .token-flag { transform-box: fill-box; transform-origin: 0% 50%; }
.token .token-glow { fill: none; stroke: var(--c); stroke-width: 1.6; opacity: 0; transform-box: fill-box; transform-origin: center; }
.token.current .token-flag { animation: wave 2.4s ease-in-out infinite; }
.token.current .token-glow { opacity: 1; animation: base-pulse 1.8s var(--ease) infinite; }
.token.offline { opacity: .45; filter: grayscale(.8); }

/* Mobiliario del mapa */
.map-toolbar { position: absolute; right: 18px; top: 18px; z-index: 4; display: flex; flex-direction: column; padding: 4px; gap: 2px; background: rgba(247,241,227,.95); border: 1px solid rgba(76,62,38,.28); border-radius: var(--r); box-shadow: var(--shadow-1); }
.tool-btn { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-2); transition: background var(--t-hover), color var(--t-hover); }
.tool-btn:hover { background: rgba(36,35,31,.07); color: var(--ink); }
.tool-btn[aria-expanded="true"] { background: var(--ink); color: var(--ivory); }
.tool-sep { height: 1px; margin: 2px 6px; background: var(--line-strong); }
.legend { position: absolute; right: 64px; top: 18px; z-index: 4; display: grid; grid-template-columns: auto auto; gap: 7px 18px; padding: 12px 14px; background: rgba(247,241,227,.97); border: 1px solid rgba(76,62,38,.28); border-radius: var(--r); box-shadow: var(--shadow-1); font-size: 12px; color: var(--ink-2); animation: panel-in var(--t-panel) var(--ease-out); }
.legend h3 { grid-column: 1 / -1; margin: 0; font: 600 10.5px var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.legend h3:not(:first-child) { margin-top: 4px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1.5px rgba(36,35,31,.3); flex: none; }
.legend .icon { width: 15px; height: 15px; color: var(--ink-2); }
.legend .lg-route { width: 18px; height: 0; border-top: 2px dotted #5f4a2c; }
.legend .lg-sea { width: 18px; height: 0; border-top: 2px dashed #46605f; }
.legend .lg-region { width: 16px; height: 11px; border: 1px dashed #5d4d33; background: rgba(185,162,122,.4); border-radius: 2px; }
.map-furniture { position: absolute; left: 22px; bottom: 22px; z-index: 3; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; pointer-events: none; transition: opacity var(--t-panel); }
.map-wrap.has-card .map-furniture { opacity: 0; }
.cartouche { display: flex; flex-direction: column; align-items: center; padding: 8px 18px; background: rgba(244,236,216,.92); border: 1px solid #4c4334; box-shadow: inset 0 0 0 3px rgba(244,236,216,.9), inset 0 0 0 4px rgba(143,116,49,.6); }
.cartouche b { font: 700 15px var(--f-title); letter-spacing: .42em; color: #2c261b; padding-left: .42em; }
.cartouche span { font: italic 400 12px var(--f-serif); letter-spacing: .2em; color: #5c4b31; }
.scalebar { display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 3px; background: rgba(244,236,216,.75); font: 500 11px var(--f-ui); color: #3e3628; }
.scalebar i { display: block; height: 5px; width: var(--w, 60px); background: linear-gradient(90deg, #3e3628 50%, #f2ead6 50%); border: 1px solid #3e3628; transition: width var(--t-hover); }
.compass-rose { position: absolute; right: 22px; bottom: 22px; width: 62px; height: 66px; z-index: 3; pointer-events: none; opacity: .85; }
.compass-rose .c-ring { fill: rgba(244,236,216,.55); stroke: #463d2e; stroke-width: 1; }
.compass-rose .c-ring.thin { fill: none; stroke-width: .6; }
.compass-rose .c-dark { fill: #3e3628; }
.compass-rose .c-light { fill: #f2ead6; stroke: #3e3628; stroke-width: .6; }
.compass-rose .c-n { font: 700 11px var(--f-title); fill: #3e3628; text-anchor: middle; }

/* Banda de cambio de turno */
.turn-banner { position: absolute; top: 18px; left: 50%; z-index: 5; transform: translate(-50%, -140%); display: flex; align-items: center; gap: 12px; padding: 7px 20px 7px 7px; border-radius: 99px; background: rgba(6,6,10,.9); color: var(--ivory); border: 1px solid color-mix(in srgb, var(--c, var(--gold)) 70%, transparent); box-shadow: 0 10px 30px rgba(6,6,10,.35), 0 0 0 4px color-mix(in srgb, var(--c, var(--gold)) 18%, transparent); pointer-events: none; opacity: 0; white-space: nowrap; }
.turn-banner.show { animation: banner 2.8s var(--ease-soft) forwards; }
.turn-banner small { display: block; font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-light); }
.turn-banner strong { font: 600 16px var(--f-title); letter-spacing: .04em; }

/* Tarjeta contextual */
.context-card { position: absolute; left: 18px; bottom: 18px; width: min(360px, calc(100% - 100px)); max-height: calc(100% - 36px); overflow: auto; background: var(--paper); border: 1px solid rgba(76,62,38,.3); border-radius: var(--r); box-shadow: var(--shadow-2); z-index: 5; animation: card-in var(--t-panel) var(--ease-out); }
.context-card.leaving { animation: card-out 180ms var(--ease) forwards; }
.cc-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); position: relative; }
.cc-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c, var(--gold)); }
.cc-head h3 { margin: 3px 0 2px; font: 600 20px var(--f-title); }
.cc-head .close { margin-left: auto; flex: none; }
.cc-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.cc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { padding: 7px 10px; border-radius: var(--r-sm); background: rgba(36,35,31,.045); }
.stat small { display: block; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.cc-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.cc-actions { display: flex; flex-direction: column; gap: 8px; }
.why { font-size: 12px; color: var(--muted); margin: -3px 0 0; }

/* Tooltip */
.tooltip { position: fixed; left: 0; top: 0; transform: translate(var(--x, 0), var(--y, 0)); z-index: 60; max-width: 290px; padding: 10px 12px; background: rgba(9,8,12,.95); color: var(--ivory); border: 1px solid rgba(201,168,76,.35); border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.45; pointer-events: none; box-shadow: var(--shadow-2); animation: tip-in 120ms var(--ease-out); }
.tooltip h4 { margin: 0 0 2px; font: 600 14px var(--f-title); color: var(--gold-soft); }
.tooltip .t-sub { color: var(--muted-light); font-size: 12px; margin-bottom: 6px; }
.tooltip dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; }
.tooltip dt { color: var(--muted-light); }
.tooltip dd { margin: 0; }
.tooltip i.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 5px; }

/* 8 ── Panel lateral ──────────────────────────────────────────── */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--parchment); border-left: 1px solid rgba(201,168,76,.3); box-shadow: -8px 0 24px rgba(6,6,10,.18); position: relative; z-index: 4; }
.turn-panel { background: var(--paper); border-bottom: 1px solid var(--line-strong); }
.turn-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; position: relative; overflow: hidden; }
.turn-head::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--gold)) 22%, transparent), transparent 75%); }
.turn-head > * { position: relative; }
.turn-head .who { min-width: 0; flex: 1; }
.turn-head .who strong { display: flex; align-items: center; gap: 6px; font: 600 15px var(--f-title); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turn-head .who small { display: block; font-size: 12px; color: var(--muted); }
.turn-head .clock { display: inline-flex; align-items: center; gap: 4px; font: 600 13px var(--f-ui); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.turn-head .clock .icon { width: 15px; height: 15px; color: var(--muted); }
.turn-head .clock.low { color: var(--err); }
.turn-head.changed { animation: head-in var(--t-panel) var(--ease-out); }
.phases { display: grid; grid-template-columns: repeat(4, 1fr); list-style: none; margin: 0; padding: 0 16px; gap: 4px; }
.phases li { position: relative; padding-top: 9px; font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #9a907b; text-align: center; transition: color .3s; }
.phases li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 2px; background: rgba(36,35,31,.1); transition: background .4s, box-shadow .4s; }
.phases li.done { color: var(--muted); }
.phases li.done::before { background: var(--gold-deep); }
.phases li.now { color: var(--ink); }
.phases li.now::before { background: var(--gold); box-shadow: 0 0 8px rgba(201,168,76,.6); }
.turn-timer { height: 2px; margin: 10px 16px 0; background: rgba(36,35,31,.08); overflow: hidden; border-radius: 2px; }
.turn-timer i { display: block; height: 100%; width: 100%; background: var(--gold-deep); transform-origin: 0 50%; transition: transform 1s linear, background .3s; }
.turn-timer.low i { background: var(--err); }
.turn-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; }
.turn-body.swap { animation: fade-in var(--t-panel) var(--ease); }
.turn-title { margin: 0; font: 600 17px var(--f-title); display: flex; align-items: center; gap: 8px; }
.turn-help { margin: 0; font: 400 15.5px/1.45 var(--f-serif); color: var(--ink-2); }
.action-row { display: flex; gap: 8px; }
.action-row .btn { flex: 1; }
.waiting { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(36,35,31,.05); border-radius: var(--r-sm); font-size: 13px; color: var(--ink-2); }
.waiting .dots { margin-left: auto; white-space: nowrap; }
.waiting .dots i { display: inline-block; width: 4px; height: 4px; margin: 0 1px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite; }
.waiting .dots i:nth-child(2) { animation-delay: .15s; }
.waiting .dots i:nth-child(3) { animation-delay: .3s; }
.ticker { padding: 8px 16px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); background: rgba(36,35,31,.03); }
.ticker:empty { display: none; }
.ticker p { margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker p.new { animation: tick-in var(--t-toast) var(--ease-out); }
.ticker p:nth-child(2) { color: var(--muted); }
.ticker .y { font: 600 11px var(--f-title); color: var(--gold-deep); margin-right: 6px; }
.tabs { display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line-strong); }
.tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 6px 10px; border: 0; background: none; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--t-hover), border-color var(--t-hover); position: relative; }
.tab .icon { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-color: var(--gold-deep); }
.tab .badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font-size: 10.5px; line-height: 17px; animation: pop-in .4s var(--ease-out); }
.tab-panel { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.tab-panel.swap { animation: fade-in var(--t-panel) var(--ease); }

/* Consejo */
.pl { display: grid; grid-template-columns: 3px 1fr auto; gap: 0 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); transition: background var(--t-panel); }
.pl:last-child { border-bottom: 0; }
.pl::before { content: ""; grid-row: span 3; background: var(--c); border-radius: 2px; }
.pl.me { background: rgba(255,255,255,.35); }
.pl.active { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 14%, transparent), transparent 80%); }
.pl-name { display: flex; align-items: center; gap: 6px; font-weight: 600; min-width: 0; }
.pl-name > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-name .icon { width: 14px; height: 14px; color: var(--gold-deep); }
.pl-fac { font-size: 12px; color: var(--muted); grid-column: 2; }
.pl-score { grid-row: span 2; align-self: center; text-align: right; }
.pl-score b { display: block; font: 700 22px/1 var(--f-title); color: var(--ink); font-variant-numeric: tabular-nums; }
.pl-score small { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.pl-res { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 3px 11px; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.pl-res span { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; position: relative; }
.pl-res .icon { width: 13px; height: 13px; color: var(--muted); }
.pl-res .sep { width: 1px; height: 12px; background: var(--line-strong); }
.pl .offline-tag { font-size: 10.5px; color: var(--err); font-weight: 600; }
.pl.eliminated { opacity: .55; filter: grayscale(.7); }
.token.eliminated { display: none; }
.pl-detail { grid-column: 2 / 4; margin-top: 6px; font-size: 12.5px; }
.pl-detail summary { cursor: pointer; color: var(--muted); font-size: 12px; list-style: none; display: inline-flex; align-items: center; gap: 5px; }
.pl-detail summary::-webkit-details-marker { display: none; }
.pl-detail summary::before { content: "›"; display: inline-block; transition: transform var(--t-hover); }
.pl-detail[open] summary::before { transform: rotate(90deg); }
.pl-detail p { margin: 6px 0 0; line-height: 1.45; }
.score-items { list-style: none; margin: 6px 0 0; padding: 0; }
.score-items li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.score-items li b { font-variant-numeric: tabular-nums; }

/* Diplomacia */
.dip { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.dip h4 { margin: 0; font: 600 11px var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.offer { border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 12px; background: rgba(255,255,255,.4); display: flex; flex-direction: column; gap: 8px; animation: rise .3s var(--ease-out); }
.offer.incoming { border-color: var(--gold-deep); box-shadow: 0 0 0 1px rgba(201,168,76,.4); }
.offer p { margin: 0; font-size: 13px; }
.offer .exp { font-size: 12px; color: var(--muted); }
.compose { display: grid; gap: 10px; }
.compose-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compose fieldset { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; margin: 0; min-width: 0; }
.compose legend { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 4px; }
.stepper { display: grid; grid-template-columns: 18px 1fr 26px 28px 26px; align-items: center; gap: 4px; margin: 4px 0; font-size: 12.5px; }
.stepper .icon { width: 15px; height: 15px; color: var(--muted); }
.stepper button { width: 26px; height: 26px; border: 1px solid var(--line-strong); border-radius: 3px; background: rgba(255,255,255,.5); display: grid; place-items: center; padding: 0; transition: background var(--t-hover); }
.stepper button:hover { background: #fff; }
.stepper button .icon { width: 13px; height: 13px; }
.stepper output { text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.city-checks { display: flex; flex-direction: column; gap: 2px; max-height: 110px; overflow: auto; margin-top: 4px; }
.city-checks label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; }
.city-checks input, .check input { width: 16px; min-height: 16px; height: 16px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; text-align: center; color: var(--muted); }
.empty-state .icon { width: 28px; height: 28px; color: var(--muted-light); }
.empty-state p { margin: 0; font: italic 15px var(--f-serif); }

/* Crónica */
.chron-filter { display: flex; gap: 4px; padding: 12px 16px 0; flex-wrap: wrap; }
.chron-filter button { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-strong); background: none; font-size: 12px; color: var(--muted); transition: background var(--t-hover), color var(--t-hover); }
.chron-filter button:hover { color: var(--ink); }
.chron-filter button[aria-pressed="true"] { background: var(--ink); color: var(--ivory); border-color: var(--ink); }
.log { list-style: none; margin: 0; padding: 8px 16px 14px; }
.log li { display: grid; grid-template-columns: 42px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.log li .y { font: 600 11px var(--f-title); color: var(--gold-deep); padding-top: 1px; }
.log li.k-event { color: var(--ink); }
.log li.k-event .y { color: var(--red-ink); }
.log li.k-turn, .log li.k-round { color: var(--muted); font-style: italic; }
.log li.k-end { font-weight: 600; color: var(--ink); }
.log li.k-diplomacy .y { color: var(--blue-ink); }
.last-event { margin: 12px 16px 0; }

/* 9 ── Diálogos ───────────────────────────────────────────────── */
.modal-root { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(6,6,10,.55); backdrop-filter: blur(2px); pointer-events: auto; animation: fade-in var(--t-panel) var(--ease); display: grid; place-items: center; padding: 16px; }
.modal-backdrop.soft { background: rgba(6,6,10,.3); backdrop-filter: none; }
.modal { position: relative; width: min(520px, 100%); max-height: calc(100dvh - 32px); overflow: auto; background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow-2); animation: modal-in 420ms var(--ease-soft); }
.modal.leaving { animation: modal-out 240ms var(--ease) forwards; }
.modal-head { padding: 22px 26px 8px; text-align: center; }
.modal-head .eyebrow { color: var(--gold-deep); }
.modal-head h2 { margin: 6px 0 0; font: 600 24px/1.2 var(--f-title); }
.modal-body { padding: 8px 26px 18px; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 0 26px 24px; display: flex; flex-direction: column; gap: 8px; }
.modal-timer { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 12px; color: var(--muted); }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.prose { font: 400 16.5px/1.55 var(--f-serif); color: var(--ink-2); margin: 0; }
.prose-sm { font: 400 15px/1.5 var(--f-serif); color: var(--ink-2); margin: 0; }
.note { display: flex; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); background: rgba(36,35,31,.05); font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.note .icon { width: 16px; height: 16px; color: var(--muted); flex: none; margin-top: 1px; }
.note.interp { background: rgba(96,127,168,.1); }
.note.mech { background: rgba(201,168,76,.14); }
.note strong { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.ref { font-size: 12px; color: var(--muted); }
.review { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 99px; background: rgba(167,119,44,.14); color: #8a6224; }
.review.na { background: rgba(36,35,31,.07); color: var(--muted); }
.answers { display: flex; flex-direction: column; gap: 8px; }
.answer { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; text-align: left; padding: 11px 14px; min-height: 48px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: rgba(255,255,255,.55); font: 400 16px/1.35 var(--f-serif); transition: border-color var(--t-hover), background var(--t-hover), transform var(--t-hover) var(--ease); }
.answer:hover:not(:disabled) { border-color: var(--gold-deep); background: #fffdf6; transform: translateX(2px); }
.answer .letter { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-strong); font: 600 12px var(--f-title); transition: background var(--t-hover), color var(--t-hover); }
.answer.chosen { border-color: var(--gold-deep); background: #fffaf0; }
.answer.right { border-color: var(--ok); background: rgba(79,122,82,.12); animation: answer-ok .5s var(--ease-out); }
.answer.right .letter { background: var(--ok); color: #fff; border-color: var(--ok); }
.answer.wrong { border-color: var(--err); background: rgba(162,68,60,.1); animation: answer-ko .4s var(--ease); }
.answer.wrong .letter { background: var(--err); color: #fff; border-color: var(--err); }
.answer:disabled { cursor: default; }
.verdict { display: flex; align-items: center; gap: 10px; justify-content: center; font: 600 18px var(--f-title); animation: pop-in .45s var(--ease-out); }
.verdict.ok { color: var(--ok); }
.verdict.ko { color: var(--err); }
.verdict .icon { width: 24px; height: 24px; }
.ring-timer { width: 46px; height: 46px; margin: 0 auto; position: relative; }
.ring-timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-timer circle { fill: none; stroke-width: 3; }
.ring-timer .bg { stroke: rgba(36,35,31,.1); }
.ring-timer .fg { stroke: var(--gold-deep); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke .3s; }
.ring-timer.low .fg { stroke: var(--err); }
.ring-timer span { position: absolute; inset: 0; display: grid; place-items: center; font: 600 13px var(--f-ui); font-variant-numeric: tabular-nums; }
.options { display: flex; flex-direction: column; gap: 8px; }
.option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: rgba(255,255,255,.55); transition: border-color var(--t-hover), background var(--t-hover), transform var(--t-hover) var(--ease); }
.option:hover:not(:disabled) { border-color: var(--gold-deep); background: #fffdf6; transform: translateX(2px); }
.option strong { font-size: 14px; }
.option span { font-size: 12.5px; color: var(--muted); }
.option:disabled { opacity: .55; cursor: not-allowed; }
.option .why { margin: 2px 0 0; color: var(--err); }
.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; animation: rise var(--t-panel) var(--ease-out); }
.targets button { text-align: left; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: rgba(255,255,255,.55); font-size: 12.5px; transition: border-color var(--t-hover); }
.targets button:hover { border-color: var(--gold-deep); }

/* Debate interactivo */
.debate { width: min(560px, 100%); }
.debate-stage { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 22px 26px 0; }
.debater { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); animation: rise .45s var(--ease-out) both; }
.debater.rival { animation-delay: .12s; }
.emblem.doctor { --c: #4a3f2f; }
.debate.answered .debater:first-child .emblem { animation: debater-speak .6s var(--ease-out); }
.vs { display: flex; flex-direction: column; align-items: center; font: 600 11px var(--f-title); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-deep); }
.vs small { font: italic 400 12px var(--f-serif); letter-spacing: .05em; text-transform: none; color: var(--muted); }
.debate .modal-head { padding-top: 10px; }
.argument { position: relative; padding: 14px 16px; border-radius: var(--r); background: #fffdf7; border: 1px solid var(--line-strong); box-shadow: inset 3px 0 0 #4a3f2f; }
.argument::before { content: ""; position: absolute; top: -7px; right: 22%; width: 12px; height: 12px; background: #fffdf7; border-left: 1px solid var(--line-strong); border-top: 1px solid var(--line-strong); transform: rotate(45deg); }
.argument-who { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.argument-text { margin: 0; min-height: 3em; font: 400 17px/1.5 var(--f-serif); color: var(--ink); }
.answers.pending-reveal .answer { opacity: 0; transform: translateY(8px); pointer-events: none; }
.answers .answer { transition: opacity .35s var(--ease-out), transform .35s var(--ease-out), border-color var(--t-hover), background var(--t-hover); }
.answers .answer:nth-child(2) { transition-delay: .08s; }
.answers .answer:nth-child(3) { transition-delay: .16s; }
.answers .answer:nth-child(4) { transition-delay: .24s; }
.answer.struck { opacity: .45; text-decoration: line-through; text-decoration-color: var(--err); }
.answers.compact .answer { min-height: 38px; padding: 7px 10px; font-size: 14.5px; }
.debate-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tool { position: relative; display: flex; align-items: flex-start; gap: 8px; text-align: left; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: rgba(255,255,255,.45); transition: border-color var(--t-hover), background var(--t-hover), opacity var(--t-hover); }
.tool:hover:not(:disabled) { border-color: var(--gold-deep); background: #fffdf6; }
.tool:disabled { opacity: .5; cursor: not-allowed; }
.tool.used { opacity: .55; }
.tool .icon { width: 18px; height: 18px; color: var(--gold-deep); margin-top: 1px; }
.tool b { display: block; font-size: 13px; }
.tool small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.tool.toggle { grid-column: 1 / -1; padding-right: 58px; }
.tool.toggle .icon { color: var(--red-ink); }
.switch { position: absolute; right: 12px; top: 50%; width: 36px; height: 20px; margin-top: -10px; border-radius: 10px; background: rgba(36,35,31,.2); transition: background var(--t-hover); }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform var(--t-hover) var(--ease); }
.tool.toggle[aria-checked="true"] { border-color: var(--red-ink); background: rgba(168,70,70,.08); }
.tool.toggle[aria-checked="true"] .switch { background: var(--red-ink); }
.tool.toggle[aria-checked="true"] .switch::after { transform: translateX(16px); }
.debate.convinced .argument { box-shadow: inset 3px 0 0 var(--red-ink); }
.crowd { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.crowd-label { font: italic 400 15px var(--f-serif); color: var(--ink-2); }
.crowd-bar { position: relative; width: min(260px, 80%); height: 6px; border-radius: 3px; background: rgba(36,35,31,.1); overflow: hidden; }
.crowd-bar i { position: absolute; inset: 0 auto 0 0; width: var(--to); border-radius: 3px; background: var(--ok); animation: crowd 1.1s var(--ease-out) both .2s; }
.crowd.ko .crowd-bar i { background: var(--err); }
.delta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.delta-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; animation: pop-in .45s var(--ease-out) both .35s; }
.delta-chip .icon { width: 14px; height: 14px; }
.delta-chip.pos { background: rgba(79,122,82,.14); color: var(--ok); }
.delta-chip.neg { background: rgba(162,68,60,.12); color: var(--err); }
.spectate { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: rgba(255,255,255,.35); }

/* Monedas en vuelo */
#coin-layer { position: fixed; inset: 0; pointer-events: none; z-index: 65; }
.coin { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #f6e2a0, #c9a84c 55%, #8f7431); box-shadow: 0 2px 6px rgba(40,28,10,.45), inset 0 0 0 1.5px rgba(255,248,220,.6); color: #5a4417; will-change: transform; }
.coin .icon { width: 13px; height: 13px; }
.coin.res-influence { background: radial-gradient(circle at 35% 30%, #dbe6f4, #7f9cc4 55%, #3f5878); color: #1f2f45; }
.coin.res-fervor { background: radial-gradient(circle at 35% 30%, #f6d0c6, #c9665a 55%, #8a3a32); color: #3d120e; }
.coin-label { position: absolute; left: 0; top: 0; transform: translate(calc(var(--x) - 50%), calc(var(--y) - 30px)); font: 700 15px var(--f-ui); padding: 1px 8px; border-radius: 99px; background: rgba(9,8,12,.85); animation: coin-label 1.5s var(--ease-out) forwards; white-space: nowrap; }
.coin-label.pos { color: #c9e7b5; }
.coin-label.neg { color: #f2a99a; }
.token.received .token-figure { animation: received .6s var(--ease-out); }

/* Cinemática de construcción */
.construction { width: min(560px, 100%); }
.cine-stage { position: relative; aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid rgba(76,62,38,.3); background: #e9dfc6; }
.cine-stage video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Los vídeos generados llevan la marca de la herramienta arriba a la derecha: se amplía el encuadre
   desde la esquina inferior izquierda para dejarla fuera. Quitar si se usan vídeos sin marca. */
.cine-stage video.crop-mark { transform: scale(1.2); transform-origin: 0% 100%; }
.cine-svg { width: 100%; height: 100%; display: block; }
.cine-svg .c-sky { fill: #efe5cc; }
.cine-svg .c-hatch line { stroke: rgba(76,62,38,.08); stroke-width: 1; }
.cine-svg .c-sun { fill: rgba(201,168,76,.35); stroke: rgba(143,116,49,.5); }
.cine-svg .c-hill { fill: #ddd0b0; stroke: #6a583b; stroke-width: 1; }
.cine-svg .c-ground { fill: #cfbf9a; }
.cine-svg .c-ink { stroke: #3a3022; stroke-width: 1.5; }
.cine-svg .c-scaffold line { stroke: #7a5f3a; stroke-width: 3; stroke-linecap: round; stroke-dasharray: 160; stroke-dashoffset: 160; animation: c-draw .9s var(--ease-out) forwards, c-fade .8s var(--ease) 2.6s forwards; }
.cine-svg .c-wall { fill: #f4ecd8; stroke: #3a3022; stroke-width: 2; }
.cine-svg .c-found { fill: #b9a77f; stroke: #3a3022; stroke-width: 1.5; }
.cine-svg .c-beams line { stroke: #6b4f2c; stroke-width: 3; }
.cine-svg .c-roof { fill: #8a3a32; stroke: #3a3022; stroke-width: 2; stroke-linejoin: round; }
.construction-catedral .cine-svg .c-roof { fill: #5d6b78; }
.cine-svg .c-door { fill: #4a3a26; stroke: #3a3022; stroke-width: 1.5; }
.cine-svg .c-window { fill: #c9a84c; stroke: #3a3022; stroke-width: 1.2; }
.cine-svg .c-sign rect { fill: #3a3022; }
.cine-svg .c-sign text { font: 700 9px var(--f-title); letter-spacing: .14em; fill: #f4ecd8; text-anchor: middle; }
.cine-svg .c-press rect { fill: #6b4f2c; stroke: #2b2418; stroke-width: 1.5; }
.cine-svg .c-handle line { stroke: #2b2418; stroke-width: 4; stroke-linecap: round; }
.cine-svg .c-handle circle { fill: #c9a84c; stroke: #2b2418; }
.cine-svg .c-handle { transform-box: fill-box; transform-origin: center; animation: c-turn .9s ease-in-out 2.5s 2 both; }
.cine-svg .c-platen { fill: #3a3022; transform-box: fill-box; animation: c-stamp .9s ease-in-out 2.5s 2 both; }
.cine-svg .c-sheet rect { fill: #fffaf0; stroke: #3a3022; stroke-width: 1; }
.cine-svg .c-sheet line { stroke: #3a3022; stroke-width: 1.4; }
.cine-svg .c-sheet { opacity: 0; animation: c-sheet 1s var(--ease-out) 4.2s forwards; }
.cine-svg .c-rose circle { fill: #c9a84c; stroke: #3a3022; stroke-width: 1.5; }
.cine-svg .c-rose line { stroke: #3a3022; stroke-width: 1; }
.cine-svg .c-spire { fill: #5d6b78; stroke: #3a3022; stroke-width: 1.5; }
.cine-svg .c-cross line { stroke: #8f7431; stroke-width: 3; stroke-linecap: round; }
.cine-svg .c-rays line { stroke: var(--gold); stroke-width: 2; stroke-linecap: round; opacity: 0; animation: c-rays 1.6s var(--ease-out) 3.3s infinite; }
.cine-svg .rise { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); animation: c-rise .8s var(--ease-out) var(--d, 0s) forwards; }
.cine-svg .grow { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); animation: c-rise 1s cubic-bezier(.34,1.3,.5,1) var(--d, 0s) forwards; }
.cine-svg .drop { transform-box: fill-box; transform-origin: 50% 100%; opacity: 0; transform: translateY(-40px); animation: c-drop .7s cubic-bezier(.34,1.4,.5,1) var(--d, 0s) forwards; }
.cine-svg .pop { transform-box: fill-box; transform-origin: center; opacity: 0; transform: scale(.4); animation: c-pop .55s var(--ease-out) var(--d, 0s) forwards; }
.cine-svg .c-dust circle { fill: rgba(122,100,64,.35); opacity: 0; animation: c-dust 1.4s var(--ease-out) var(--d) 2 both; }
.cine-svg.static * { animation: none !important; opacity: 1 !important; transform: none !important; stroke-dashoffset: 0 !important; }
.cine-svg.static .c-dust, .cine-svg.static .c-scaffold { display: none; }
.cine-effects { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cine-effects li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); opacity: 0; animation: rise .45s var(--ease-out) var(--d) forwards; }
.cine-effects .icon { width: 16px; height: 16px; color: var(--ok); }
@keyframes c-draw { to { stroke-dashoffset: 0; } }
@keyframes c-fade { to { opacity: .25; } }
@keyframes c-rise { to { transform: scaleY(1); } }
@keyframes c-drop { to { opacity: 1; transform: none; } }
@keyframes c-pop { to { opacity: 1; transform: none; } }
@keyframes c-turn { 50% { transform: rotate(180deg); } 100% { transform: rotate(360deg); } }
@keyframes c-stamp { 50% { transform: translateY(26px); } }
@keyframes c-sheet { 0% { opacity: 0; transform: translateX(-30px); } 100% { opacity: 1; transform: none; } }
@keyframes c-rays { 0% { opacity: 0; } 30% { opacity: .9; } 100% { opacity: 0; } }
@keyframes c-dust { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--dx), -26px) scale(1.6); } }

/* Carta de acontecimiento ilustrada */
.event-card { width: min(480px, 100%); animation: card-flip var(--t-card) var(--ease-out); }
.event-card::before { border-color: rgba(138,58,50,.32); z-index: 1; }
.event-art { position: relative; height: 128px; display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid rgba(76,62,38,.25);
  background: repeating-linear-gradient(-35deg, rgba(76,62,38,.09) 0 1px, transparent 1px 5px), radial-gradient(ellipse at 50% 120%, rgba(138,58,50,.18), transparent 70%), linear-gradient(180deg, #efe3c8, #e6d6b6); }
.event-art .art-icon { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 1px solid #4c4334; box-shadow: 0 0 0 5px rgba(247,241,227,.7), 0 0 0 6px rgba(76,62,38,.35), 0 8px 20px rgba(40,28,10,.25); color: var(--red-ink); animation: seal-in .6s var(--ease-out) .1s both; }
.event-art .art-icon .icon { width: 40px; height: 40px; }
.event-art.generic .art-icon { color: var(--ink-2); }
.event-art .year { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); padding: 2px 16px; background: var(--red-ink); color: #f6e6d8; font: 700 13px var(--f-title); letter-spacing: .12em; clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%); animation: rise .4s var(--ease-out) .25s both; }
.event-art.generic .year { background: var(--ink-2); }
.event-card .modal-head h2 { font-size: 25px; }
.decisive .event-art .art-icon { box-shadow: 0 0 0 5px rgba(247,241,227,.7), 0 0 0 6px rgba(201,168,76,.7), 0 0 32px rgba(201,168,76,.55); color: var(--gold-deep); }

/* Fin de partida */
.final { width: min(720px, 100%); }
.final-hero { position: relative; display: grid; place-items: center; height: 116px; overflow: hidden; }
.final-hero .rays { position: absolute; width: 380px; height: 380px; border-radius: 50%; background: repeating-conic-gradient(rgba(201,168,76,.24) 0 6deg, transparent 6deg 18deg); -webkit-mask-image: radial-gradient(circle, #000 18%, transparent 62%); mask-image: radial-gradient(circle, #000 18%, transparent 62%); animation: spin-slow 40s linear infinite; }
.final.defeat .final-hero .rays { display: none; }
.final .crown { position: relative; width: 58px; height: 58px; color: var(--gold); animation: seal-in .8s var(--ease-out) both; }
.final.defeat .crown { color: var(--muted-light); }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank > li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: var(--r-sm); background: rgba(255,255,255,.45); animation: rise .45s var(--ease-out) both; }
.rank > li:nth-child(2) { animation-delay: .08s; }
.rank > li:nth-child(3) { animation-delay: .16s; }
.rank > li:nth-child(4) { animation-delay: .24s; }
.rank > li.win { border-color: var(--gold-deep); border-left-color: var(--c); background: linear-gradient(90deg, rgba(201,168,76,.18), rgba(255,255,255,.4)); }
.rank > li.me { box-shadow: inset 0 0 0 1px var(--ink-2); }
.rank .pos { font: 700 20px var(--f-title); color: var(--gold-deep); text-align: center; }
.rank .tot { font: 700 26px var(--f-title); font-variant-numeric: tabular-nums; }
.rank details { grid-column: 2 / 4; font-size: 12.5px; }
.rank summary { cursor: pointer; color: var(--muted); }

/* Panel deslizante (enciclopedia, reglas) */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); z-index: 50; background: var(--paper); box-shadow: var(--shadow-2); display: flex; flex-direction: column; animation: drawer-in 280ms var(--ease-out); }
.drawer.leaving { animation: drawer-out 220ms var(--ease) forwards; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid rgba(201,168,76,.3); background: var(--obsidian); color: var(--ivory); }
.drawer-head h2 { margin: 0; font: 600 20px var(--f-title); flex: 1; }
.drawer-head .icon-btn { background: transparent; color: var(--parchment); border-color: rgba(244,237,221,.2); }
.drawer-body { flex: 1; overflow: auto; padding: 18px 20px 30px; }
.drawer-body h3 { font: 600 17px var(--f-title); margin: 22px 0 8px; }
.drawer-body h3:first-child { margin-top: 0; }
.drawer-body p, .drawer-body li { font: 400 16px/1.55 var(--f-serif); color: var(--ink-2); }
.drawer-body ul { padding-left: 20px; }
.ency-search { margin-bottom: 12px; }
.ency-list { list-style: none; margin: 0; padding: 0; }
.ency-list li button { width: 100%; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 10px 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; transition: background var(--t-hover), padding var(--t-hover); }
.ency-list li button:hover { background: rgba(201,168,76,.1); padding-left: 10px; }
.ency-list strong { font: 600 14.5px var(--f-title); }
.ency-list small { color: var(--muted); font-size: 12px; }
.ency-group { margin: 16px 0 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-deep); }
.ency-entry .period { font: italic 15px var(--f-serif); color: var(--muted); margin: 0 0 12px; }
.back { margin-bottom: 10px; }

/* 10 ── Avisos ────────────────────────────────────────────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: flex; flex-direction: column-reverse; gap: 8px; width: min(380px, calc(100% - 32px)); pointer-events: none; }
/* En partida, los avisos viven sobre el mapa (abajo, centrados) y nunca tapan el panel de acciones. */
body[data-screen="game"] .toasts { right: auto; left: calc((100vw - var(--side-w)) / 2); transform: translateX(-50%); bottom: 24px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; background: rgba(9,8,12,.95); color: var(--ivory); border: 1px solid rgba(201,168,76,.28); border-left: 3px solid var(--c, var(--gold)); border-radius: var(--r-sm); box-shadow: var(--shadow-2); font-size: 13px; line-height: 1.45; pointer-events: auto; animation: toast-in var(--t-toast) var(--ease-out); }
.toast.leaving { animation: toast-out 220ms var(--ease) forwards; }
.toast .icon { width: 18px; height: 18px; color: var(--c, var(--gold)); flex: none; margin-top: 1px; }
.toast.err { --c: #d36a5d; }
.toast.ok { --c: #8bbd8d; }
.toast.high { border-color: rgba(201,168,76,.6); box-shadow: var(--shadow-2), 0 0 0 3px rgba(201,168,76,.15); }
.toast strong { display: block; font-weight: 600; }
.banner { position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 80; margin-top: 10px; padding: 10px 18px; border-radius: 99px; background: var(--err); color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-2); animation: drop-in .35s var(--ease-out); display: flex; align-items: center; gap: 8px; }
.banner.info { background: var(--obsidian); border: 1px solid rgba(201,168,76,.4); }
.round-card { position: fixed; inset: 0; display: grid; place-items: center; z-index: 35; pointer-events: none; }
.round-card div { text-align: center; padding: 20px 44px; background: rgba(6,6,10,.88); color: var(--ivory); border: 1px solid rgba(201,168,76,.4); border-radius: var(--r); animation: round-in 3s var(--ease-soft) forwards; }
.round-card small { display: block; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted-light); }
.round-card strong { display: block; font: 700 54px var(--f-title); color: var(--gold); letter-spacing: .06em; line-height: 1.1; }
.dice-stage { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 14px; pointer-events: none; z-index: 6; }
.die { width: 60px; height: 60px; border-radius: 12px; background: linear-gradient(145deg, #fbf6e9, #e2d6bb); border: 1px solid #8a7653; box-shadow: 0 14px 28px rgba(20,14,4,.36), inset 0 -3px 0 rgba(0,0,0,.08), inset 0 2px 0 rgba(255,255,255,.6); display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); padding: 9px; animation: die-tumble 1.35s cubic-bezier(.22,.9,.3,1) both; }
.die:nth-child(2) { animation-duration: 1.25s; animation-delay: .08s; }
.die.settled { animation: die-tumble 1.35s cubic-bezier(.22,.9,.3,1) both, die-settle .5s var(--ease-out) both; }
.die i { transition: opacity 90ms; }
.die i { width: 9px; height: 9px; border-radius: 50%; background: #2a241a; place-self: center; opacity: 0; }
.die i.on { opacity: 1; }
.dice-stage.leaving .die, .dice-stage.leaving .dice-sum { animation: die-out .6s var(--ease) forwards; }
.dice-sum { align-self: center; min-width: 46px; padding: 4px 12px; border-radius: var(--r-sm); background: rgba(247,241,227,.94); font: 700 26px var(--f-title); text-align: center; color: var(--ink); box-shadow: var(--shadow-1); opacity: 0; animation: sum-in .5s var(--ease-out) 1.3s both; }

/* 11 ── Movimiento ────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { border-color: var(--gold); box-shadow: 0 0 24px rgba(201,168,76,.25); } }
@keyframes screen-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(.4); } 70% { transform: scale(1.12); } 100% { opacity: 1; transform: scale(1); } }
@keyframes done-pop { 40% { transform: scale(1.03); box-shadow: 0 0 0 4px rgba(201,168,76,.3); } }
@keyframes bump { 30% { transform: translateY(-3px); background: rgba(185,224,165,.16); } }
@keyframes bump-down { 30% { transform: translateY(2px); background: rgba(240,164,147,.16); } }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, 4px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -26px); } }
@keyframes year-tick { 0% { transform: translateY(8px); opacity: 0; } 60% { transform: translateY(-2px); opacity: 1; text-shadow: 0 0 18px rgba(201,168,76,.8); } 100% { transform: none; } }
@keyframes blink { 50% { opacity: .3; } }
@keyframes dot { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
@keyframes march { to { stroke-dashoffset: -22; } }
@keyframes select-in { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse-ring { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes flash { 0% { opacity: 1; transform: scale(.6); stroke-width: 5; } 100% { opacity: 0; transform: scale(2); stroke-width: 1; } }
@keyframes ripple { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(3.2); } }
@keyframes land { 0% { transform: scale(1); } 35% { transform: scale(1.3); } 100% { transform: scale(1); } }
@keyframes bob { 50% { transform: translateY(-2.5px); } }
@keyframes card-in { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes card-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes panel-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes head-in { from { opacity: .3; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@keyframes tick-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes tip-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(.975); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(.985); } }
@keyframes card-flip { 0% { opacity: 0; transform: perspective(900px) rotateX(14deg) translateY(24px) scale(.96); } 100% { opacity: 1; transform: none; } }
@keyframes seal-in { 0% { opacity: 0; transform: scale(1.7) rotate(-18deg); } 60% { opacity: 1; transform: scale(.94) rotate(3deg); } 100% { transform: none; } }
@keyframes drawer-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes drawer-out { to { transform: translateX(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes drop-in { from { opacity: 0; transform: translate(-50%, -20px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes round-in { 0% { opacity: 0; transform: scale(.92); } 15% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.03); } }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -60%); } 16% { opacity: 1; transform: translate(-50%, 0); } 84% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -30%); } }
@keyframes answer-ok { 40% { transform: scale(1.02); } }
@keyframes crowd { from { width: 0; } }
@keyframes debater-speak { 40% { transform: scale(1.12); box-shadow: 0 0 0 6px rgba(201,168,76,.3); } }
@keyframes coin-label { 0% { opacity: 0; transform: translate(calc(var(--x) - 50%), calc(var(--y) - 20px)); } 15% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(calc(var(--x) - 50%), calc(var(--y) - 54px)); } }
@keyframes received { 35% { transform: translateY(-5px) scale(1.12); } }
@keyframes answer-ko { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes die-tumble { 0% { opacity: 0; transform: translate(-90px, -70px) rotate(-320deg) scale(.7); } 35% { opacity: 1; transform: translate(-20px, 8px) rotate(-90deg) scale(1.02); } 60% { transform: translate(6px, -6px) rotate(-20deg); } 80% { transform: translate(-2px, 2px) rotate(6deg); } 100% { transform: none; } }
@keyframes die-settle { 0% { transform: scale(1); } 40% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(201,168,76,.35), 0 14px 28px rgba(20,14,4,.36); } 100% { transform: scale(1); } }
@keyframes sum-in { from { opacity: 0; transform: translateX(-8px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes die-out { to { opacity: 0; transform: scale(.92) translateY(10px); } }
@keyframes hop { 0% { transform: translateY(0); } 45% { transform: translateY(-7px); } 100% { transform: translateY(0); } }
@keyframes wave { 0%, 100% { transform: skewY(0deg) scaleX(1); } 30% { transform: skewY(-4deg) scaleX(.94); } 65% { transform: skewY(3deg) scaleX(.98); } }
@keyframes base-pulse { 0% { transform: scale(.7); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
@keyframes hop-shadow { 0%, 100% { transform: scale(1); opacity: .28; } 45% { transform: scale(.7); opacity: .16; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .space.active-here .halo { opacity: 1; transform: none; }
}

/* 12 ── Adaptación ────────────────────────────────────────────── */
@media (max-width: 1380px) { .hud-brand .title { display: none; } }
@media (max-width: 1180px) {
  :root { --side-w: 344px; }
  .hud { gap: 14px; }
  .timeline { display: none; }
  .lobby-grid { grid-template-columns: 1fr 1fr; }
  .lobby-factions { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 980px) {
  .res { padding: 5px 6px; }
  .hud-brand { display: none; }
  .hud-time { padding-left: 0; border-left: 0; }
}
@media (max-width: 860px) {
  :root { --hud-h: auto; }
  .screen-game { height: auto; min-height: 100dvh; grid-template-rows: auto auto; }
  .hud { grid-template-columns: auto 1fr auto; grid-template-areas: "time turn tools" "res res res"; gap: 8px 12px; padding: 10px 12px; position: sticky; top: 0; }
  .hud-time { grid-area: time; }
  .hud-turn { grid-area: turn; justify-self: start; }
  .hud-tools { grid-area: tools; }
  .hud-res { grid-area: res; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); min-width: 0; }
  .hud > * { min-width: 0; }
  .res { justify-content: center; background: rgba(244,237,221,.05); min-width: 0; }
  .res small { display: inline; font-size: 10.5px; color: var(--muted-light); }
  .conn span { display: none; }
  .game-body { grid-template-columns: 1fr; }
  .map-wrap { height: min(70dvh, calc(100vw + 120px)); }
  .side { border-left: 0; border-top: 1px solid rgba(201,168,76,.3); box-shadow: none; }
  .tab-panel { overflow: visible; }
  .map-toolbar { right: 12px; top: 12px; flex-direction: row; }
  .tool-sep { width: 1px; height: auto; margin: 6px 2px; }
  .legend { right: 12px; top: 62px; max-width: calc(100% - 24px); }
  .compass-rose, .cartouche { display: none; }
  .map-furniture { left: 16px; bottom: 16px; }
  .context-card { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 75%; }
  body[data-screen="game"] .toasts { left: 50%; top: 12px; bottom: auto; flex-direction: column; width: calc(100% - 24px); }
  .home-inner { grid-template-columns: 1fr; padding-top: 32px; }
  .home-map { opacity: .32; }
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-factions { grid-row: auto; }
}
@media (max-width: 520px) {
  body { font-size: 15px; }
  .home-card { padding: 20px 16px; }
  .faction-picker { grid-template-columns: 1fr; }
  .create-row, .join-row { flex-direction: column; align-items: stretch; }
  .faction-grid { grid-template-columns: 1fr; }
  .code { font-size: 26px; }
  .hud-year .yr { font-size: 22px; }
  .hud-turn strong { max-width: 120px; }
  .modal-head { padding: 20px 18px 6px; }
  .modal-body { padding: 6px 18px 16px; }
  .modal-foot { padding: 0 18px 20px; }
  .compose-cols { grid-template-columns: 1fr; }
  .targets { grid-template-columns: 1fr; }
  .dice-stage .die { width: 48px; height: 48px; padding: 7px; }
  .debate-tools { grid-template-columns: 1fr; }
  .debate-stage { padding: 18px 16px 0; }
  .res small { display: none; }
  .hud-turn { padding-right: 10px; }
  .hud-tools .icon-btn { width: 34px; height: 34px; }
}

/* Instalación como aplicación */
.install-btn { color: var(--gold-soft); }
.install-steps { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 8px; line-height: 1.5; }

/* Reto teológico */
.reto-btn { display: flex; align-items: center; gap: 10px; text-align: left; }
.reto-btn > span { display: grid; gap: 1px; }
.reto-btn small { font-weight: 500; font-size: 11.5px; opacity: .75; }
.reto-options { display: grid; gap: 8px; }
.reto-option { display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 12px 14px; border: 1px solid rgba(76,62,38,.22); border-radius: var(--r-sm); background: rgba(255,255,255,.55); color: var(--ink); font: inherit; cursor: pointer; transition: border-color var(--t-hover), background var(--t-hover), transform var(--t-hover); }
.reto-option:hover { border-color: var(--gold); background: #fff; transform: translateY(-1px); }
.reto-option > span:last-child { display: grid; gap: 3px; line-height: 1.4; }
.reto-option small { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.reto-pot { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 12px; border-radius: var(--r-sm); background: rgba(201,168,76,.14); color: var(--ink); font-size: 13.5px; }
.reto-pot .icon { color: #a8862f; width: 22px; height: 22px; flex: none; }
.reto-players { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.reto-players li { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid rgba(76,62,38,.18); font-size: 12.5px; color: var(--ink-2); }
.reto-players li.done { border-color: var(--c); color: var(--ink); }
.reto-players li.done .icon { color: var(--ok, #3d7a4a); width: 14px; height: 14px; }
.reto-players li.miss { opacity: .7; }
.reto-players.result li { padding-right: 12px; }
.reto-pay { font-weight: 700; margin-left: 4px; }
.reto-players li.done .reto-pay { color: #8a6d22; }
.reto-players .dots i { display: inline-block; width: 4px; height: 4px; margin: 0 1px; border-radius: 50%; background: var(--muted); animation: dot 1.2s infinite; }
.reto-players .dots i:nth-child(2) { animation-delay: .15s; }
.reto-players .dots i:nth-child(3) { animation-delay: .3s; }
.answer.picked { border-color: var(--gold); background: rgba(201,168,76,.18); }

/* Intro cinematográfica (opcional: public/assets/video/intro.mp4) */
.intro { position: fixed; inset: 0; z-index: 1000; background: #000; display: grid; place-items: center; animation: introIn .6s ease both; }
.intro.leaving { animation: introOut .9s ease both; }
.intro-video { width: 100%; height: 100%; object-fit: cover; }
@media (max-aspect-ratio: 1/1) { .intro-video { object-fit: contain; } }
.intro-bar { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: flex; gap: 10px; }
.intro-btn { display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(227,203,134,.55); background: rgba(6,6,10,.55); color: #F3EBDD; font: 600 14px/1 Inter, system-ui, sans-serif; letter-spacing: .04em; cursor: pointer; backdrop-filter: blur(6px); transition: background .16s, border-color .16s; }
.intro-btn:hover { background: rgba(201,168,76,.25); border-color: #E3CB86; }
.intro-sound { width: 44px; padding: 0; justify-content: center; }
.intro-sound .icon { width: 20px; height: 20px; }
@keyframes introIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes introOut { to { opacity: 0; transform: scale(1.04); filter: blur(4px); } }

.home-foot a { color: var(--gold-soft); text-decoration: none; border-bottom: 1px solid rgba(227,203,134,.35); }
.home-foot a:hover { color: var(--gold); }
