/* Oddmile · alfa. Pergamino cálido de día, chocolate de noche. Sombras con tinte de la paleta. */
:root {
  --bg: #efdfbf;
  --bg-2: #e6d1a8;
  --paper: #fbf3e2;
  --paper-2: #f5e8cf;
  --ink: #2a1d14;
  --ink-2: #5b4633;
  --muted: #86705a;
  --line: #dcc59c;
  --line-2: #c9ac7c;
  --accent: #9c4a1f;       /* tinta de lacre */
  --accent-2: #c2410c;
  --accent-ink: #fff6e8;
  --gold: #b9811f;
  --wood: #8a5a32;
  --hide: #9a6b4f;
  --fame: #c58a12;
  --good: #3f7a3a;
  --good-bg: #e3edd3;
  --warn: #a8670f;
  --warn-bg: #f8e5bf;
  --bad: #a3321f;
  --bad-bg: #f5d9cc;
  --info: #3b5c8c;
  --shadow: 74, 42, 29;
  --sh-1: 0 1px 2px rgba(var(--shadow), .16), 0 2px 6px rgba(var(--shadow), .10);
  --sh-2: 0 2px 4px rgba(var(--shadow), .14), 0 10px 24px rgba(var(--shadow), .16);
  --sh-3: 0 12px 40px rgba(var(--shadow), .30);
  --map-ground: #f3e6c8;
  --map-woods: #cfd7a6;
  --map-river: #8fbfd6;
  --map-road: #d9bd8a;
  --map-route: #a17b4c;
  --radius: 12px;
  --font-head: "Palatino Linotype", "Book Antiqua", Palatino, "Iowan Old Style", Georgia, serif;
  --font-body: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .22 0 0 0 0 .12 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #23160e; --bg-2: #2c1c12; --paper: #34231a; --paper-2: #3c2a1e;
    --ink: #f1e6d4; --ink-2: #d8c4a6; --muted: #a88e70; --line: #4d3726; --line-2: #6a4c34;
    --accent: #e38a4b; --accent-2: #f0a35e; --accent-ink: #2a1408;
    --gold: #e8b85a; --wood: #c98d4f; --hide: #c79b7d; --fame: #f0c45a;
    --good: #8fc27a; --good-bg: #2d3a22; --warn: #e7b259; --warn-bg: #43301a; --bad: #ef8d72; --bad-bg: #4a2219; --info: #8db3e6;
    --shadow: 10, 4, 1;
    --map-ground: #3a281b; --map-woods: #3c4628; --map-river: #2f5370; --map-road: #6b4c31; --map-route: #b8905f;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .85 0 0 0 0 .6 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #23160e; --bg-2: #2c1c12; --paper: #34231a; --paper-2: #3c2a1e;
  --ink: #f1e6d4; --ink-2: #d8c4a6; --muted: #a88e70; --line: #4d3726; --line-2: #6a4c34;
  --accent: #e38a4b; --accent-2: #f0a35e; --accent-ink: #2a1408;
  --gold: #e8b85a; --wood: #c98d4f; --hide: #c79b7d; --fame: #f0c45a;
  --good: #8fc27a; --good-bg: #2d3a22; --warn: #e7b259; --warn-bg: #43301a; --bad: #ef8d72; --bad-bg: #4a2219; --info: #8db3e6;
  --shadow: 10, 4, 1;
  --map-ground: #3a281b; --map-woods: #3c4628; --map-river: #2f5370; --map-road: #6b4c31; --map-route: #b8905f;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .85 0 0 0 0 .6 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.45 var(--font-body);
  color: var(--ink);
  background-color: var(--bg);
  background-image: var(--grain), radial-gradient(1200px 700px at 15% -10%, var(--paper-2), transparent 60%), radial-gradient(900px 600px at 110% 110%, var(--bg-2), transparent 60%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: .01em; margin: 0; }
p { margin: .35em 0; }
.ico { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.2em; }
.c-gold { color: var(--gold); } .c-wood { color: var(--wood); } .c-hide { color: var(--hide); } .c-fame { color: var(--fame); }
.role-ranged { color: var(--good); } .role-support { color: var(--info); } .role-vanguard { color: var(--accent); }
.muted { color: var(--muted); } .small { font-size: .86em; } .bad { color: var(--bad); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.app { max-width: 1440px; margin: 0 auto; padding: 12px 16px 8px; min-height: 100%; display: flex; flex-direction: column; gap: 10px; }

/* Encabezado */
.header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  border: 1px solid var(--line); border-radius: 16px; padding: 8px 12px; box-shadow: var(--sh-2);
  position: sticky; top: 8px; z-index: 20;
}
.hd-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crest { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--accent-ink); background: linear-gradient(160deg, var(--accent-2), var(--accent)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), var(--sh-1); }
.crest .ico { width: 22px; height: 22px; }
.hd-title { display: flex; flex-direction: column; min-width: 0; }
.hd-title strong { font-family: var(--font-head); font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-title span { font-size: .8rem; color: var(--muted); }
.hd-clock { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.hd-clock .sun { color: var(--fame); } .hd-clock .moon { color: var(--info); }
.hd-clock .day { color: var(--ink-2); font-size: .85rem; }
.hd-clock .time { font-weight: 700; font-size: 1.05rem; min-width: 3.1em; }
.hd-speed { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.hd-speed button { border: 0; background: none; padding: 6px 10px; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink-2); min-width: 40px; min-height: 36px; }
.hd-speed button + button { border-left: 1px solid var(--line); }
.hd-speed button.on { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); }
.hd-res { list-style: none; display: flex; gap: 6px; margin: 0; padding: 0; flex-wrap: wrap; }
.hd-res li { display: flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.hd-res li.debt { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.hd-threat { margin-left: auto; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--warn-bg); color: var(--ink); border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: .9rem; }
.hd-threat.urgent { background: var(--bad-bg); color: var(--bad); border-color: transparent; animation: throb 2.4s ease-in-out infinite; }
.hd-threat b { font-variant-numeric: tabular-nums; }
@keyframes throb { 50% { box-shadow: 0 0 0 4px rgba(163, 50, 31, .14); } }
.hd-icon { border: 1px solid var(--line); background: var(--bg); width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); flex: none; }
.header .hd-icon:last-child { margin-left: 0; }
.header > .hd-threat ~ .hd-icon, .header > .hd-res ~ .hd-icon { }

/* Avisos */
.alerts { display: flex; flex-direction: column; gap: 6px; }
.alerts:empty { display: none; }
.alert { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; font-size: .92rem; box-shadow: var(--sh-1); }
.alert.warn { background: var(--warn-bg); color: var(--ink); border-left: 4px solid var(--warn); }
.alert.bad { background: var(--bad-bg); color: var(--ink); border-left: 4px solid var(--bad); }
.alert .ico { color: var(--warn); } .alert.bad .ico { color: var(--bad); }
.alert .link { margin-left: auto; border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Disposición */
.main { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px; flex: 1; min-height: 0; }
.map-wrap { position: sticky; top: 84px; align-self: start; }
.map { border-radius: 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--sh-2); padding: 8px; }
.map-svg { display: block; width: 100%; height: auto; }
.panel { display: flex; flex-direction: column; min-width: 0; background: linear-gradient(180deg, var(--paper), var(--paper-2)); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--sh-2); overflow: hidden; }
.nav { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); background: var(--bg); }
.nav button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 6px; border: 0; border-radius: 10px; background: none; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: .9rem; position: relative; min-height: 42px; }
.nav button.on { background: var(--paper); color: var(--accent); box-shadow: var(--sh-1); }
.nav .badge { position: absolute; top: 3px; right: 6px; font-style: normal; font-size: .7rem; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.view { padding: 12px 14px 18px; overflow: auto; max-height: calc(100vh - 170px); }
.foot { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0 8px; user-select: none; }

/* Secciones y tarjetas */
.view-sec + .view-sec { margin-top: 18px; }
.sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.sec-head h2 { font-size: 1.15rem; }
.sec-head .count { font-family: var(--font-body); font-size: .8rem; color: var(--muted); background: var(--bg); border: 1px solid var(--line); padding: 1px 8px; border-radius: 999px; margin-left: 4px; vertical-align: 2px; }
.sec-head > .btn, .sec-head > .seg, .sec-head > .muted { margin-left: auto; }
.help { border: 0; background: none; color: var(--muted); cursor: help; padding: 2px; border-radius: 50%; display: inline-grid; place-items: center; }
.empty { color: var(--muted); font-style: italic; padding: 10px 2px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--sh-1); position: relative; }
.card h3 { font-size: 1.02rem; display: flex; align-items: center; gap: 6px; }
.card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.card footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.card .desc { color: var(--ink-2); font-size: .9rem; }
.card .sub { color: var(--muted); font-size: .86rem; }
.tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--accent); }
.zone { font-size: .8rem; color: var(--muted); }
.quest { border-top: 3px solid var(--line-2); }
.quest.src-threat { border-top-color: var(--bad); }
.quest.src-rebuild { border-top-color: var(--warn); }
.quest.src-applicant { border-top-color: var(--info); }
.effect { display: flex; gap: 6px; align-items: flex-start; font-size: .86rem; color: var(--good); background: var(--good-bg); padding: 5px 8px; border-radius: 8px; }
.effect .ico { margin-top: 2px; }
.meta, .chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-size: .82rem; font-variant-numeric: tabular-nums; }
.chip.cost { color: var(--warn); }
.chip.trait { background: var(--paper-2); }
.why { color: var(--warn); font-size: .85rem; margin-right: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; min-height: 40px; box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, var(--sh-1); transition: transform .08s ease, filter .15s; }
.btn:hover:not([disabled]) { filter: brightness(1.04); }
.btn:active:not([disabled]) { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { padding: 5px 10px; min-height: 34px; font-size: .88rem; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.primary.danger { background: var(--bad); color: #fff; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.name-link { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font: inherit; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; display: inline-flex; gap: 4px; align-items: center; }

/* Grupos afuera */
.parties { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.party.good { border-color: color-mix(in srgb, var(--good) 40%, var(--line)); }
.party.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
.party .eta { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.stages { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 0; margin: 8px 0 6px; }
.stages li { font-size: .72rem; text-align: center; padding: 4px 2px; border-radius: 6px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); line-height: 1.2; }
.stages li.done { color: var(--ink-2); background: var(--paper-2); }
.stages li.now { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; }
.bar { height: 6px; border-radius: 4px; background: var(--bg); overflow: hidden; border: 1px solid var(--line); }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; }
.who { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: .9rem; }
.trail { list-style: none; padding: 0; margin: 6px 0 0; font-size: .82rem; color: var(--ink-2); }
.trail li { display: flex; gap: 8px; }
.trail time { color: var(--muted); font-variant-numeric: tabular-nums; }

/* Plantel */
.roster { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.card.hero { display: grid; grid-template-columns: 40px 1fr auto; grid-template-rows: auto auto auto; column-gap: 10px; text-align: left; cursor: pointer; padding: 10px; }
.card.hero:hover { box-shadow: var(--sh-2); }
.portrait { grid-row: 1 / span 3; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--paper-2); border: 1px solid var(--line); box-shadow: inset 0 -6px 12px rgba(var(--shadow), .08); }
.portrait.p-ferrin { background: linear-gradient(160deg, #e9d9a8, #d6b97c); }
.portrait.p-brask { background: linear-gradient(160deg, #cfc6d6, #a99cb5); }
.portrait.p-lissan { background: linear-gradient(160deg, #cfe4e6, #9ec2c8); }
.portrait .ico { width: 22px; height: 22px; }
.portrait.big { width: 56px; height: 56px; border-radius: 16px; }
.portrait.big .ico { width: 30px; height: 30px; }
.hn { font-weight: 700; } .hr { font-size: .82rem; color: var(--muted); } .hs { font-size: .8rem; color: var(--ink-2); }
.hp { grid-row: 1 / span 2; grid-column: 3; align-self: center; font-family: var(--font-head); font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.hero.st-injured .hs { color: var(--bad); }
.hero.st-out .hs { color: var(--info); }

/* Pueblo */
.checklist { list-style: none; padding: 0; margin: 4px 0; display: grid; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.checklist li.ok { color: var(--good); }
.pop { display: flex; gap: 14px; flex-wrap: wrap; font-size: .92rem; }
.pop span { display: inline-flex; gap: 5px; align-items: center; }
.plots { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.plot { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line-2); background: transparent; cursor: pointer; font-size: .85rem; text-align: left; min-height: 40px; }
.plot.open { border-style: solid; background: var(--paper); }
.plot.built { border-style: solid; background: var(--paper-2); cursor: default; color: var(--ink-2); }
.neighbors { display: flex; flex-wrap: wrap; gap: 6px; }
.nb { border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: .85rem; }
.nb.homeless { border-color: var(--bad); color: var(--bad); }
.opp { border-left: 4px solid var(--fame); margin-bottom: 8px; }
.counter { font-family: var(--font-head); font-style: italic; color: var(--ink-2); }
.business.st-damaged, .business.st-vacant { border-color: var(--bad); }

/* Defensa */
.forecast { border-left: 5px solid var(--line-2); }
.forecast.r-brilliant, .forecast.r-victory { border-left-color: var(--good); }
.forecast.r-damaged { border-left-color: var(--warn); }
.forecast.r-defeat, .forecast.r-rout { border-left-color: var(--bad); }
.vs { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 10px 0; }
.vs > div { text-align: center; display: flex; flex-direction: column; }
.vs small { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.vs b { font-family: var(--font-head); font-size: 1.9rem; line-height: 1.1; }
.vs > span { color: var(--muted); font-style: italic; }
.vs.small b { font-size: 1.4rem; }
.verdict { text-align: center; font-weight: 600; }
.others { list-style: none; padding: 0; margin: 8px 0 0; font-size: .88rem; color: var(--ink-2); display: grid; gap: 4px; }
.others li { display: flex; gap: 6px; align-items: center; }
.post-legend { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.post-legend li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.post-legend li span { color: var(--muted); font-variant-numeric: tabular-nums; }
.post-rows { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.post-row { display: grid; grid-template-columns: 1fr auto minmax(120px, 160px); align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.post-row .pn { display: flex; gap: 6px; align-items: center; font-weight: 600; min-width: 0; }
.post-row .pv { font-family: var(--font-head); font-weight: 700; color: var(--accent); }
.post-row select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--paper-2); min-height: 36px; width: 100%; }
.post-row.st-out { opacity: .6; }
.exam { margin-top: 8px; border-top: 1px dashed var(--line); padding-top: 6px; }

/* Crónica */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg); }
.seg.wrap { flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 10px; cursor: pointer; font-size: .84rem; color: var(--ink-2); min-height: 34px; }
.seg button.on { background: var(--paper); color: var(--accent); font-weight: 700; box-shadow: var(--sh-1); }
.chronicle { list-style: none; padding: 0; margin: 0; }
.chronicle .day-sep { font-family: var(--font-head); color: var(--muted); font-size: .85rem; margin: 12px 0 4px; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.entry { display: grid; grid-template-columns: 46px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.entry time { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.entry p { margin: 0; }
.entry.k-chronicle p { font-family: var(--font-head); font-size: 1.02rem; }
.entry.k-threat p { color: var(--bad); }
.entry.k-town p { color: var(--good); }
.pager { margin-top: 10px; display: flex; align-items: center; gap: 10px; }

/* Mapa */
.map-ground { fill: var(--map-ground); }
.map-woods { fill: var(--map-woods); opacity: .7; }
.map-river { fill: none; stroke: var(--map-river); stroke-width: 14; stroke-linecap: round; opacity: .8; }
.map-road { fill: none; stroke: var(--map-road); stroke-width: 12; stroke-linecap: round; }
.map-road-label { font: italic 10px var(--font-head); fill: var(--muted); }
.map-route { fill: none; stroke: var(--map-route); stroke-width: 1.6; stroke-dasharray: 2 5; stroke-linecap: round; }
.map-march { fill: none; stroke: var(--bad); stroke-width: 2; stroke-dasharray: 4 5; opacity: .75; }
.map-stone circle { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1.4; }
.map-stone text { font: 700 7px var(--font-body); fill: var(--ink); text-anchor: middle; }
.hatch-line { stroke: var(--line-2); stroke-width: 2; }
.map-shadow { flood-color: rgb(var(--shadow)); }
.map-plot rect { fill: transparent; stroke: var(--line-2); stroke-width: 1.4; stroke-dasharray: 3 3; cursor: pointer; }
.map-plot.open rect { stroke-dasharray: none; fill: var(--paper); }
.map-plot.use-home rect { fill: color-mix(in srgb, var(--paper) 80%, var(--good-bg)); }
.map-plot.use-shop rect { fill: color-mix(in srgb, var(--paper) 70%, var(--warn-bg)); }
.map-plot.use-field rect { fill: color-mix(in srgb, var(--paper) 60%, var(--map-woods)); }
.map-plot:hover rect, .map-plot:focus rect { stroke: var(--accent); }
.plot-plus { stroke: var(--line-2); stroke-width: 1.6; stroke-linecap: round; }
.plot-label, .b-label { font: 600 8.5px var(--font-body); fill: var(--ink-2); text-anchor: middle; }
.map-b { cursor: default; }
.map-b[role="button"] { cursor: pointer; }
.map-b .b-body { fill: var(--paper); stroke: var(--ink-2); stroke-width: 1.3; }
.map-b .b-roof { fill: #b5523b; stroke: var(--ink-2); stroke-width: 1.1; }
.map-b .b-door { fill: var(--wood); }
.map-b .b-glyph { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.map-b.b-guild .b-body { fill: var(--accent); } .map-b.b-guild .b-glyph { stroke: var(--accent-ink); }
.map-b.b-tavern .b-body { fill: color-mix(in srgb, var(--paper) 70%, var(--fame)); }
.map-b.b-sawmill .b-body { fill: color-mix(in srgb, var(--paper) 65%, var(--wood)); }
.map-b .b-site { fill: url(#hatch); stroke: var(--line-2); stroke-width: 1.3; stroke-dasharray: 4 2; }
.map-b .b-progress { fill: var(--accent); }
.map-b.st-ruined, .map-b.st-broken { opacity: .55; }
.map-b.st-ruined .b-body, .map-b.st-ruined .b-roof { stroke-dasharray: 3 2; fill: transparent; }
.map-b.st-burned .b-body, .map-b.st-burned .b-roof { fill: #6a4a3a; }
.map-b.st-vacant { opacity: .7; }
.map-b .b-scar { stroke: var(--bad); stroke-width: 2; stroke-linecap: round; }
.map-b .b-wheel circle { fill: none; stroke: var(--ink-2); stroke-width: 1.4; }
.map-b .b-wheel path { stroke: var(--ink-2); stroke-width: 1.2; }
.map-b .b-wheel.spin { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.map-homeless circle { fill: var(--bad); }
.map-zone .zone-disc { fill: var(--paper); stroke: var(--line-2); stroke-width: 1.4; }
.map-zone .zone-ring-bg { fill: none; stroke: var(--line); stroke-width: 5; }
.map-zone .zone-ring { fill: none; stroke: var(--warn); stroke-width: 5; stroke-linecap: round; }
.map-zone.hot .zone-ring { stroke: var(--bad); }
.map-zone .zone-name { font: 600 11px var(--font-head); fill: var(--ink); text-anchor: middle; }
.map-zone .zone-p { font: 700 13px var(--font-body); fill: var(--ink-2); text-anchor: middle; }
.map-zone .zone-p.muted { fill: var(--muted); }
.map-attack circle { fill: var(--bad); stroke: var(--paper); stroke-width: 2; }
.map-attack text { font: 700 9.5px var(--font-body); fill: var(--bad); text-anchor: middle; }
.map-party circle { fill: var(--info); stroke: var(--paper); stroke-width: 2; }
.map-party.stage-engage circle { fill: var(--accent-2); }
.map-party.stage-back circle { fill: var(--good); }
.map-party.bad circle { fill: var(--bad); }
.map-party text { font: 700 9px var(--font-body); fill: #fff; text-anchor: middle; pointer-events: none; }

/* Informe de la noche */
.report { position: fixed; right: 16px; bottom: 16px; width: min(340px, calc(100vw - 32px)); background: linear-gradient(180deg, var(--paper), var(--paper-2)); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--sh-3); padding: 12px 14px; z-index: 30; animation: rise .35s ease; }
.report header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.report h2 { font-size: 1.05rem; }
.report ul { margin: 0; padding-left: 18px; font-size: .9rem; }
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }

/* Ventanas */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(var(--shadow), .45); backdrop-filter: blur(2px); }
.modal-box { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); background-image: var(--grain); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--sh-3); padding: 16px 18px; animation: rise .25s ease; }
.modal-box.m-story { width: min(620px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.modal-head h2 { font-size: 1.35rem; }
.who-head { display: flex; gap: 12px; align-items: center; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.picks { display: grid; gap: 6px; margin: 12px 0; }
.pick { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper-2); cursor: pointer; min-height: 48px; }
.pick > .ico { grid-row: 1 / span 2; }
.pick .pn { font-weight: 700; } .pick .pr { font-size: .8rem; color: var(--muted); grid-column: 2; }
.pick .pp { grid-row: 1 / span 2; grid-column: 3; font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; color: var(--accent); }
.pick .ps { grid-column: 2; font-size: .78rem; color: var(--bad); }
.pick.on { border-color: var(--accent); background: color-mix(in srgb, var(--paper) 80%, var(--accent)); box-shadow: inset 0 0 0 1px var(--accent); }
.pick[disabled] { opacity: .5; cursor: not-allowed; }
.reaction { padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.reaction strong { font-family: var(--font-head); font-size: 1.1rem; }
.reaction span { font-size: .88rem; color: var(--ink-2); }
.r-scared { background: var(--bad-bg); border-color: transparent; } .r-scared strong { color: var(--bad); }
.r-doubtful { background: var(--warn-bg); border-color: transparent; } .r-doubtful strong { color: var(--warn); }
.r-alert strong { color: var(--info); }
.r-confident { background: var(--good-bg); border-color: transparent; } .r-confident strong { color: var(--good); }
.r-cocky { background: var(--good-bg); border-color: transparent; } .r-cocky strong { color: var(--good); }
.defense-note { display: flex; gap: 6px; font-size: .88rem; margin-top: 8px; color: var(--ink-2); }
.defense-note.bad { color: var(--bad); }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.facts div { background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; }
.facts dt { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.facts dd { margin: 0; font-weight: 700; }
.intro { font-family: var(--font-head); font-size: 1.05rem; }
.quirk { color: var(--ink-2); }
.state-line { font-style: italic; color: var(--muted); }
.mini { font-size: .95rem; margin: 12px 0 4px; display: flex; align-items: center; gap: 4px; }
.mini-log { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--ink-2); }
.uses { display: grid; gap: 8px; margin: 12px 0; }
.use-btn { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper-2); cursor: pointer; }
.use-btn .ico { grid-row: 1 / span 2; width: 22px; height: 22px; color: var(--accent); align-self: center; }
.use-btn span { font-size: .85rem; color: var(--muted); }
.use-btn.on { border-color: var(--accent); }
.use-btn[disabled] { opacity: .5; cursor: not-allowed; }
.story { padding: 6px 4px; }
.story .kicker { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--accent); font-weight: 700; margin: 0; }
.story h2 { font-size: 1.7rem; margin: 2px 0 10px; }
.story-text p { font-family: var(--font-head); font-size: 1.06rem; line-height: 1.6; }
.arrival { display: grid; gap: 10px; margin-top: 14px; }
.arrival label { display: grid; gap: 4px; font-size: .85rem; color: var(--ink-2); }
.arrival input { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--paper-2); min-height: 42px; }
.res-brilliant, .res-victory { color: var(--good); } .res-damaged { color: var(--warn); } .res-defeat, .res-rout { color: var(--bad); }
.chron { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--line-2); font-family: var(--font-head); font-size: 1.04rem; color: var(--ink-2); }
.dres { padding-left: 18px; margin: 6px 0; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px dotted var(--line); flex-wrap: wrap; }
.set-row > span { display: inline-flex; gap: 6px; align-items: center; }
.set-row.col { flex-direction: column; align-items: flex-start; }
.set-row .inline { display: inline-flex; gap: 6px; align-items: center; }
.set-row input[type="number"] { width: 72px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--paper-2); }
.toggles { display: grid; gap: 6px; }
.toggle { display: flex; align-items: center; gap: 8px; font-size: .92rem; }
.toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

/* Tooltips y toasts */
#tip { position: fixed; z-index: 80; max-width: 280px; padding: 7px 10px; border-radius: 9px; background: var(--ink); color: var(--paper); font-size: .84rem; line-height: 1.35; box-shadow: var(--sh-2); pointer-events: none; }
#tip[hidden] { display: none; }
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 6px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--paper); border: 1px solid var(--line-2); border-left: 4px solid var(--info); border-radius: 10px; padding: 9px 12px; box-shadow: var(--sh-2); font-size: .9rem; animation: rise .25s ease; transition: opacity .5s; }
.toast.good { border-left-color: var(--good); } .toast.bad { border-left-color: var(--bad); }
.toast.out { opacity: 0; }
.boot { position: fixed; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-size: 1.4rem; color: var(--muted); background: var(--bg); z-index: 100; }

/* Tablet */
@media (max-width: 1020px) {
  .main { grid-template-columns: 1fr; }
  .map-wrap { position: static; }
  .map { max-width: 760px; margin: 0 auto; }
  .view { max-height: none; overflow: visible; }
  .hd-threat { margin-left: 0; }
}
/* Celular */
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .app { padding: 8px 10px 76px; gap: 8px; }
  .header { gap: 6px 8px; padding: 6px 8px; top: 4px; }
  .crest { display: none; }
  .hd-left { flex: 1 1 auto; order: 1; }
  .hd-clock { order: 2; padding: 4px 8px; }
  .header > .hd-icon { order: 3; }
  .hd-speed { order: 4; flex: 1 1 auto; }
  .hd-speed button { flex: 1; min-width: 0; padding: 5px 4px; }
  .hd-res { order: 5; flex: 1 1 100%; gap: 4px; }
  .hd-res li { padding: 3px 7px; font-size: .86rem; }
  .hd-threat { order: 6; flex: 1 1 100%; justify-content: center; padding: 5px 8px; }
  .map { padding: 4px; border-radius: 14px; }
  .panel { border-radius: 14px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; border-top: 1px solid var(--line); border-bottom: 0; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(var(--shadow), .18); }
  .nav button { flex-direction: column; gap: 1px; font-size: .68rem; padding: 6px 2px; }
  .nav button .ico { width: 20px; height: 20px; }
  .view { padding: 10px; }
  .cards, .parties, .roster { grid-template-columns: 1fr; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .post-row { grid-template-columns: 1fr auto; }
  .post-row select { grid-column: 1 / -1; }
  .modal { padding: 8px; align-items: end; }
  .modal-box { max-height: calc(100vh - 16px); border-radius: 16px 16px 12px 12px; padding: 14px; }
  .report { right: 8px; left: 8px; width: auto; bottom: 70px; }
  #toasts { bottom: 72px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.center { text-align: center; }
