:root {
  --bg: #16110e;
  --ink: #f3e8d4;
  --ink-soft: #d8c8ad;
  --panel: rgba(22, 16, 13, 0.72);
  --panel-solid: #221a15;
  --line: rgba(243, 232, 212, 0.18);
  --gold: #f2b23a;
  --gold-ink: #241708;
  --hp: #d8483a;
  --vigor: #8fc25a;
  --danger: #ff6a4a;
  --radius: 14px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#scene, #ui { position: fixed; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#ui { pointer-events: none; }
#ui > * { pointer-events: auto; }
#ui .hud, #ui .objective, #ui .banner, #ui .toasts, #ui .debug, #ui .fade, #ui .touch, #ui .tbtns { pointer-events: none; }
#ui .stick, #ui .tbtn, #ui .hud-portrait { pointer-events: auto; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* HUD */
.hud { position: absolute; top: calc(10px + var(--safe-t)); left: calc(12px + var(--safe-l)); }
.hud-card {
  display: flex; gap: 10px; align-items: center; padding: 8px 12px 8px 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.hud-portrait {
  --c: #7a352c; width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 70%, white), var(--c));
  border: 2px solid var(--gold); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.hud-portrait { padding: 0; cursor: default; }
.hud-portrait.can-switch { cursor: pointer; box-shadow: 0 0 0 3px rgba(242, 178, 58, 0.35); }
.hud-portrait.can-switch::after {
  content: "⇄"; position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--gold); color: var(--gold-ink); font-size: 12px; line-height: 18px; text-align: center;
}
.hud-portrait { position: relative; }
.hud-info { display: grid; gap: 4px; min-width: 150px; }
.hud-name { font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.bar { position: relative; height: 12px; border-radius: 6px; background: rgba(0, 0, 0, 0.5); overflow: hidden; }
.bar-vigor { height: 6px; }
.bar-fill { position: absolute; inset: 0; transform-origin: left center; transition: transform 0.15s linear; }
.bar-hp .bar-fill { background: linear-gradient(90deg, #b8322a, var(--hp)); }
.bar-hp.low .bar-fill { animation: pulse 0.8s ease-in-out infinite alternate; }
.bar-vigor .bar-fill { background: var(--vigor); }
.bar-vigor.tired .bar-fill { background: #8a8a6a; }
.bar-text { position: absolute; inset: 0; font-size: 10px; line-height: 12px; text-align: center; font-weight: 700; text-shadow: 0 1px 1px #000; }
.hud-chapas { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.hud-chapas.pop { animation: pop 0.3s var(--ease); }
.chapa-icon {
  width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe08a, #c8902a 70%);
  box-shadow: 0 0 0 2px #8a5a1a inset, 0 0 0 1px rgba(0, 0, 0, 0.4);
  -webkit-mask: radial-gradient(circle, #000 62%, transparent 63%), conic-gradient(#000 0 0);
}
@keyframes pop { 50% { transform: scale(1.18); } }
@keyframes pulse { to { opacity: 0.55; } }

.objective {
  position: absolute; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%);
  max-width: min(46vw, 420px); padding: 8px 14px 8px 32px; border-radius: 999px;
  background: var(--panel); border: 1px solid rgba(242, 178, 58, 0.55); font-size: 14px; font-weight: 600;
}
.objective::before {
  content: ""; position: absolute; left: 12px; top: 50%; width: 10px; height: 10px; margin-top: -5px;
  background: var(--gold); transform: rotate(45deg); border-radius: 2px;
}

.banner {
  position: absolute; top: 22%; left: 50%; transform: translate(-50%, -8px); text-align: center;
  opacity: 0; transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}
.banner.show { opacity: 1; transform: translate(-50%, 0); }
.banner-title { font-size: clamp(22px, 4vw, 34px); font-weight: 800; letter-spacing: 0.04em; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7); }
.banner-sub { margin-top: 2px; font-size: 13px; color: var(--ink-soft); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); text-transform: uppercase; letter-spacing: 0.14em; }

.toasts { position: absolute; top: 64px; right: calc(12px + var(--safe-r)); display: grid; gap: 6px; justify-items: end; }
.toast {
  padding: 8px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; max-width: 280px; animation: toastIn 0.25s var(--ease) backwards; transition: opacity 0.35s, transform 0.35s;
}
.toast.out { opacity: 0; transform: translateX(10px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } }

/* Mandos táctiles */
.touch { position: absolute; inset: 0; }
.stick {
  position: absolute; left: calc(26px + var(--safe-l)); bottom: calc(22px + var(--safe-b));
  width: 132px; height: 132px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.16));
  border: 2px solid rgba(255, 255, 255, 0.28); touch-action: none;
}
.stick.on { border-color: rgba(242, 178, 58, 0.7); }
.knob {
  position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.42); border: 2px solid rgba(255, 255, 255, 0.6); transition: transform 0.08s;
}
.stick.on .knob { transition: none; background: rgba(242, 178, 58, 0.6); }
.tbtns { position: absolute; right: calc(22px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); width: 200px; height: 170px; }
.tbtn {
  position: absolute; display: grid; place-items: center; border-radius: 50%; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.45); background: rgba(20, 14, 10, 0.38); color: #fff;
  font-weight: 800; touch-action: none; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); transition: transform 0.15s var(--ease), background 0.15s;
}
.tbtn.on { transform: scale(0.94); background: rgba(242, 178, 58, 0.55); }
.tbtn-a { right: 0; bottom: 0; width: 92px; height: 92px; font-size: 30px; background: rgba(140, 50, 30, 0.45); border-color: rgba(255, 200, 150, 0.6); }
.tbtn-a.talk { font-size: 15px; background: rgba(242, 178, 58, 0.45); }
.tbtn-run { right: 104px; bottom: 4px; width: 66px; height: 66px; font-size: 12px; }
.tbtn-b { right: 16px; bottom: 108px; width: 62px; height: 62px; font-size: 20px; background: rgba(60, 90, 40, 0.45); }
.tbtn-b .cooldown { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); transform-origin: bottom; transform: scaleY(0); pointer-events: none; }
.tbtn-b.ready { border-color: rgba(200, 240, 140, 0.8); }

/* Diálogo */
.dialog {
  position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  width: min(760px, calc(100% - 24px - var(--safe-l) - var(--safe-r))); display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border-radius: var(--radius); background: rgba(22, 16, 13, 0.92); border: 1px solid rgba(242, 178, 58, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: dlgIn 0.25s var(--ease) backwards;
}
@keyframes dlgIn { from { opacity: 0; transform: translate(-50%, 16px); } }
.dialog-portrait {
  --c: #6a5a48; flex: none; width: 56px; height: 56px; border-radius: 12px; display: grid; place-items: center;
  font-size: 26px; font-weight: 800; background: var(--c); border: 2px solid var(--gold);
}
.dialog-body { flex: 1; min-width: 0; }
.dialog.phone { border-color: rgba(120, 200, 140, 0.7); background: rgba(14, 26, 18, 0.94); }
.dialog.phone .dialog-speaker::after { content: " · " attr(data-channel); color: #8fd0a0; font-weight: 600; }
.dialog-speaker { font-weight: 800; color: var(--gold); font-size: 14px; letter-spacing: 0.04em; margin-bottom: 4px; }
.dialog-text { font-size: 16px; line-height: 1.45; min-height: 2.9em; }
.dialog-options { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.dialog-option, .dialog-next, .end-btn {
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0; cursor: pointer; font-weight: 700;
  background: var(--gold); color: var(--gold-ink); transition: transform 0.15s var(--ease);
}
.dialog-option { background: rgba(242, 178, 58, 0.16); color: var(--ink); border: 1px solid rgba(242, 178, 58, 0.6); }
.dialog-next { align-self: flex-end; flex: none; }
.dialog-option:active, .dialog-next:active, .end-btn:active { transform: scale(0.97); }
#ui.talking .touch, #ui.talking .objective { opacity: 0.25; }

/* Pantallas */
.screen { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 10px; padding: 24px; }
.loading { background: radial-gradient(circle at 50% 40%, #3a2416, var(--bg) 70%); transition: opacity 0.35s; z-index: 5; }
.loading.out { opacity: 0; }
.loading-title { font-size: clamp(24px, 5vw, 42px); font-weight: 800; letter-spacing: 0.03em; color: var(--gold); }
.loading-sub { color: var(--ink-soft); }
.rotate { background: var(--bg); z-index: 10; }
.rotate-icon {
  width: 46px; height: 78px; margin: 0 auto 10px; border: 4px solid var(--ink); border-radius: 10px;
  animation: turn 1.6s var(--ease) infinite;
}
@keyframes turn { 40%, 100% { transform: rotate(-90deg); } }
.rotate-text { font-size: 18px; font-weight: 700; }
.death { background: rgba(40, 6, 4, 0.55); z-index: 4; animation: fadeIn 0.6s backwards; }
.death-title { font-size: clamp(30px, 6vw, 52px); font-weight: 900; color: #ffb09a; text-shadow: 0 2px 12px #000; }
.death-sub { font-size: 16px; color: var(--ink); }
.end { background: rgba(16, 11, 8, 0.92); z-index: 6; }
.end-title { font-size: clamp(28px, 5vw, 46px); font-weight: 900; color: var(--gold); }
.end-text { font-size: 17px; margin-bottom: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
.fade { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 0.3s; z-index: 3; }
.fade.on { opacity: 1; }
.debug {
  position: absolute; left: 50%; bottom: 6px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px;
  background: rgba(0, 0, 0, 0.55); font: 11px/1.3 ui-monospace, monospace; color: #cfe8a0; white-space: nowrap;
}

@media (max-height: 420px) {
  .hud-card { padding: 6px 10px 6px 6px; }
  .hud-portrait { width: 38px; height: 38px; font-size: 17px; }
  .hud-info { min-width: 130px; gap: 3px; }
  .stick { width: 116px; height: 116px; left: calc(18px + var(--safe-l)); bottom: calc(14px + var(--safe-b)); }
  .tbtns { bottom: calc(12px + var(--safe-b)); right: calc(16px + var(--safe-r)); }
  .tbtn-a { width: 82px; height: 82px; }
  .tbtn-b { bottom: 96px; }
  .dialog { padding: 10px 12px; }
  .dialog-text { font-size: 15px; min-height: 2.6em; }
  .dialog-portrait { width: 46px; height: 46px; }
  .toasts { top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Portada y selección */
.title {
  z-index: 8; background: radial-gradient(circle at 50% 35%, #4a2a16, var(--bg) 72%);
  align-content: center; justify-items: center; text-align: center;
}
.title-kicker { letter-spacing: 0.4em; text-transform: uppercase; font-size: 13px; color: var(--ink-soft); }
.title-name { margin: 4px 0 6px; font-size: clamp(30px, 6vw, 58px); line-height: 1.05; font-weight: 900; color: var(--gold); text-shadow: 0 4px 24px rgba(242, 120, 40, 0.35); }
.title-sub { margin: 0 0 18px; max-width: 520px; color: var(--ink-soft); font-size: 15px; }
.title-actions { display: grid; gap: 10px; min-width: min(320px, 80vw); }
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1px solid rgba(242, 178, 58, 0.6); cursor: pointer;
  background: rgba(242, 178, 58, 0.12); color: var(--ink); font-weight: 800; font-size: 16px;
  display: grid; place-content: center; transition: transform 0.15s var(--ease), background 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); }
.btn-note { display: block; font-size: 12px; font-weight: 600; opacity: 0.75; }
.btn-round { width: 52px; min-height: 52px; padding: 0; border-radius: 50%; font-size: 28px; line-height: 1; }
.btn-wide { width: 100%; margin-top: 10px; }
@media (hover: hover) { .btn:hover { background: rgba(242, 178, 58, 0.25); } .btn-primary:hover { background: #ffc64e; } }

.select { position: absolute; inset: 0; z-index: 7; pointer-events: none; }
.select > * { pointer-events: auto; }
.select-head { position: absolute; top: calc(12px + var(--safe-t)); left: calc(16px + var(--safe-l)); }
.select-title { font-size: 20px; font-weight: 900; color: var(--gold); text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.select-nav { position: absolute; left: calc(16px + var(--safe-l)); bottom: calc(16px + var(--safe-b)); display: flex; gap: 12px; }
.select-panel {
  position: absolute; top: calc(12px + var(--safe-t)); right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b));
  width: min(380px, 44vw); overflow-y: auto; padding: 16px; border-radius: var(--radius);
  background: rgba(22, 16, 13, 0.86); border: 1px solid var(--line); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; gap: 8px;
}
.select-name { font-size: 28px; font-weight: 900; line-height: 1; }
.select-role { color: var(--gold); font-weight: 700; font-size: 14px; }
.select-legend { margin: 2px 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.select-stats { display: grid; gap: 6px; }
.stat { display: grid; grid-template-columns: 82px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.stat-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.stat-fill { display: block; height: 100%; background: var(--gold); transform-origin: left; }
.select-ability { font-size: 14px; font-weight: 700; }
.select-note { font-size: 12px; color: #ffb09a; }
.select-panel .btn-wide { margin-top: auto; }
@media (max-width: 700px) and (orientation: portrait) {
  .select-panel { top: auto; left: 12px; right: 12px; width: auto; max-height: 52vh; }
}
@media (max-height: 420px) {
  .select-panel { padding: 10px 12px; gap: 5px; width: min(360px, 46vw); }
  .select-name { font-size: 22px; }
  .select-legend { font-size: 12px; }
  .stat { font-size: 12px; }
  .title-name { font-size: 32px; }
  .title-sub { margin-bottom: 10px; }
}

#ui.menu .hud, #ui.menu .touch, #ui.menu .objective, #ui.menu .toasts { display: none; }

/* Pantalla de final */
.end { align-content: center; justify-items: center; gap: 8px; animation: fadeIn 0.6s backwards; }
.end-kicker { letter-spacing: 0.3em; text-transform: uppercase; font-size: 12px; color: var(--ink-soft); }
.end-text { max-width: 560px; line-height: 1.5; color: var(--ink); }
.end-details { display: grid; gap: 4px; margin: 6px 0 10px; min-width: min(300px, 80vw); }
.end-row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); font-size: 14px; }
.end-k { color: var(--ink-soft); }
.end-v { font-weight: 800; font-variant-numeric: tabular-nums; }
@media (max-height: 420px) { .end-title { font-size: 28px; } .end-text { font-size: 14px; } .end-details { margin: 2px 0 6px; } }

/* Tienda */
.shop { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(10, 6, 4, 0.55); padding: 12px; }
.shop-panel {
  width: min(560px, 100%); max-height: calc(100% - 8px); overflow: hidden; display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border-radius: var(--radius); background: rgba(26, 18, 13, 0.97); border: 1px solid rgba(242, 178, 58, 0.5);
}
.shop-head { display: flex; align-items: center; gap: 10px; }
.shop-title { flex: 1; font-size: 20px; font-weight: 900; color: var(--gold); }
.shop-wallet { font-weight: 800; font-variant-numeric: tabular-nums; }
.shop-close { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 18px; }
.shop-tagline { font-size: 13px; color: var(--ink-soft); }
.shop-tabs { display: flex; gap: 6px; }
.shop-tab { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-weight: 700; }
.shop-tab.on { background: rgba(242, 178, 58, 0.2); border-color: var(--gold); }
.shop-list { overflow-y: auto; display: grid; gap: 6px; }
.shop-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); }
.shop-txt { flex: 1; min-width: 0; }
.shop-name { font-weight: 800; }
.shop-desc { font-size: 12px; color: var(--ink-soft); }
.shop-buy { min-height: 44px; font-size: 14px; white-space: nowrap; }
.shop-buy:disabled { opacity: 0.45; cursor: default; }
.shop-empty { padding: 12px; color: var(--ink-soft); }
@media (max-height: 420px) { .shop-panel { padding: 10px; gap: 6px; } .shop-title { font-size: 17px; } }

/* Ambientes */
.ambient-tint { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s; }
.ambient-tint.heat { opacity: 1; background: radial-gradient(ellipse at 50% 40%, rgba(255, 210, 140, 0) 40%, rgba(255, 170, 70, 0.28) 100%); animation: heatwave 3s ease-in-out infinite alternate; }
.ambient-tint.night { opacity: 1; background: radial-gradient(ellipse at 50% 50%, rgba(10, 14, 30, 0) 45%, rgba(6, 8, 20, 0.4) 100%); }
@keyframes heatwave { to { opacity: 0.6; } }
#ui .ambient-tint { pointer-events: none; }
.heat-chip {
  position: absolute; top: calc(98px + var(--safe-t)); left: calc(12px + var(--safe-l)); padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; background: rgba(40, 70, 50, 0.85); border: 1px solid rgba(140, 220, 160, 0.6); pointer-events: none;
}
.heat-chip.sun { background: rgba(140, 50, 20, 0.85); border-color: rgba(255, 170, 90, 0.8); animation: pulse 0.6s ease-in-out infinite alternate; }
@media (max-height: 420px) { .heat-chip { top: calc(84px + var(--safe-t)); } }

/* Barra de progreso (sabotaje) */
.hud-progress { position: absolute; left: 50%; bottom: calc(120px + var(--safe-b)); width: min(240px, 50vw); height: 10px; transform: translateX(-50%); border-radius: 999px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.35); overflow: hidden; pointer-events: none; }
.hud-progress-fill { height: 100%; background: linear-gradient(90deg, #7aff3a, #e8ff8a); transform-origin: left; transform: scaleX(0); }

/* Destello de cinemática */
.flash { position: absolute; inset: 0; pointer-events: none; z-index: 7; animation: flashOut ease-out forwards; mix-blend-mode: screen; }
@keyframes flashOut { from { opacity: 0.9; } to { opacity: 0; } }

/* Pantalla de decisión */
.decision {
  position: absolute; inset: 0; z-index: 6; display: grid; align-content: center; justify-items: center; gap: 14px;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: radial-gradient(ellipse at 50% 45%, rgba(40, 20, 10, 0.82), rgba(6, 4, 3, 0.96)); animation: fadeIn 0.5s backwards; text-align: center;
}
.decision[hidden] { display: none; }
.decision-kicker { letter-spacing: 0.4em; text-transform: uppercase; font-size: 12px; color: var(--gold); }
.decision-title { font-size: clamp(20px, 3.4vw, 32px); font-weight: 900; max-width: 720px; line-height: 1.2; }
.decision-options { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; margin-top: 6px; }
.decision-option {
  display: grid; gap: 6px; width: min(300px, 42vw); min-height: 110px; padding: 16px; border-radius: 16px; cursor: pointer; text-align: left;
  color: var(--ink); font: inherit; border: 2px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.06);
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.decision-option:hover, .decision-option:focus-visible { transform: translateY(-3px); outline: none; }
.decision-option.tone-a { border-color: rgba(120, 220, 140, 0.6); }
.decision-option.tone-a:hover, .decision-option.tone-a:focus-visible { background: rgba(60, 140, 80, 0.3); border-color: #8ef0a0; }
.decision-option.tone-b { border-color: rgba(240, 110, 80, 0.6); }
.decision-option.tone-b:hover, .decision-option.tone-b:focus-visible { background: rgba(160, 50, 30, 0.3); border-color: #ff9a7a; }
.decision-name { font-size: 18px; font-weight: 900; }
.decision-desc { font-size: 14px; color: var(--ink-soft); line-height: 1.4; }
@media (max-height: 420px) { .decision-option { min-height: 80px; padding: 10px 12px; } .decision-title { font-size: 20px; } }

/* Finales */
.end-sky { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 46%; z-index: -1; }
.end[class*='end-'] { isolation: isolate; overflow: hidden; }
.end-heroico { background: linear-gradient(180deg, #2a3a6a 0%, #c86a4a 55%, #f0b060 100%); }
.end-heroico .sky-sun { fill: #ffe08a; } .end-heroico .sky-city { fill: #3a2418; } .end-heroico .sky-front { fill: #24160e; }
.end-heroico .end-title { color: #fff2c0; text-shadow: 0 2px 18px rgba(255, 200, 90, 0.7); }
.end-reconciliacion { background: linear-gradient(180deg, #3a2030 0%, #a85a3a 60%, #e89a5a 100%); }
.end-reconciliacion .sky-sun { fill: #ffb070; } .end-reconciliacion .sky-city { fill: #3a1e1a; } .end-reconciliacion .sky-front { fill: #261210; }
.end-reconciliacion .end-title { color: #ffd2a0; }
.end-oscuro { background: linear-gradient(180deg, #050806 0%, #0e2210 55%, #1e4a14 100%); }
.end-oscuro .sky-sun { fill: #7aff3a; filter: drop-shadow(0 0 24px #7aff3a); } .end-oscuro .sky-city { fill: #020402; } .end-oscuro .sky-front { fill: #000; }
.end-oscuro .end-title { color: #9aff6a; text-shadow: 0 0 22px rgba(120, 255, 60, 0.6); }
.end-secreto { background: linear-gradient(180deg, #1a120c 0%, #5a3418 60%, #a8682a 100%); }
.end-secreto .sky-sun { fill: #ffcf5a; opacity: 0.85; } .end-secreto .sky-city { fill: #2a1a0e; } .end-secreto .sky-front { fill: #180e06; }
.end-secreto .end-title { color: #ffe0a0; }
.end-alberto_gana { background: linear-gradient(180deg, #0a0a06 0%, #3a3010 60%, #7a6a20 100%); }
.end-alberto_gana .sky-sun { fill: #d9ff5a; } .end-alberto_gana .sky-city, .end-alberto_gana .sky-front { fill: #0a0804; }
.end-alberto_pierde, .end-muerte { background: linear-gradient(180deg, #101018 0%, #2a2230 70%, #3a2a2a 100%); }
.end-alberto_pierde .sky-sun, .end-muerte .sky-sun { fill: #8a8aa0; opacity: 0.4; } .end-alberto_pierde .sky-city, .end-muerte .sky-city, .end-alberto_pierde .sky-front, .end-muerte .sky-front { fill: #08080c; }
.end[class*='end-'] .end-details { background: rgba(0, 0, 0, 0.25); border-radius: 10px; padding: 4px; }
@media (prefers-reduced-motion: reduce) { .decision, .flash { animation: none; } }

/* Retratos de arte (§14.4): si hay imagen, sustituye a la inicial */
.has-img, .select-portrait.has-img, .hud-portrait.has-img, .dialog-portrait.has-img {
  background-color: var(--c); background-size: cover; background-position: center top; background-repeat: no-repeat;
}
.select-who { display: flex; align-items: center; gap: 12px; }
.select-portrait {
  width: 56px; height: 56px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 900;
  background: var(--c, #6a5a48); color: #fff; border: 2px solid rgba(255, 255, 255, 0.35);
}
@media (max-height: 420px) { .select-portrait { width: 42px; height: 42px; font-size: 20px; } }
.title.has-key-art { background: linear-gradient(180deg, rgba(16, 10, 6, 0.25), rgba(16, 10, 6, 0.85)), var(--key-art) center / cover no-repeat; }

/* Minimapa y mapa grande */
.minimap {
  position: absolute; top: calc(10px + var(--safe-t)); right: calc(12px + var(--safe-r)); width: 104px; height: 104px; padding: 0;
  border-radius: 50%; overflow: hidden; cursor: pointer; pointer-events: auto; background: #16110d;
  border: 2px solid rgba(242, 178, 58, 0.7); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}
.minimap-canvas { width: 100%; height: 100%; display: block; }
.minimap-n { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 900; color: var(--gold); text-shadow: 0 1px 2px #000; }
.minimap:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.toasts { top: calc(124px + var(--safe-t)); }
.bigmap {
  position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; background: rgba(8, 5, 3, 0.78); pointer-events: auto;
  padding: calc(8px + var(--safe-t)) calc(8px + var(--safe-r)) calc(8px + var(--safe-b)) calc(8px + var(--safe-l)); animation: fadeIn 0.2s backwards;
}
.bigmap[hidden] { display: none; }
.bigmap-panel { display: grid; gap: 8px; max-width: 100%; max-height: 100%; padding: 12px 14px; border-radius: 16px; background: var(--panel); border: 1px solid rgba(242, 178, 58, 0.5); }
.bigmap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bigmap-title { font-size: 18px; font-weight: 900; color: var(--gold); }
.bigmap-close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.08); color: var(--ink); font-size: 18px; cursor: pointer; }
.bigmap-goal { font-size: 14px; color: var(--ink); max-width: 760px; }
.bigmap-body { display: flex; gap: 14px; align-items: stretch; justify-content: center; min-height: 0; }
.bigmap-local { image-rendering: pixelated; border-radius: 10px; max-height: 62vh; max-width: 46vw; border: 1px solid rgba(255, 255, 255, 0.15); }
.bigmap-city { display: grid; gap: 6px; align-content: start; width: min(44vw, 62vh); }
.bigmap-city svg { width: 100%; aspect-ratio: 1; border-radius: 10px; background: #1e1712; }
.bigmap-city .river { fill: none; stroke: #3a5a6a; stroke-width: 0.32; stroke-linecap: round; }
.bigmap-city line { stroke: rgba(240, 224, 192, 0.25); stroke-width: 0.06; }
.bigmap-city line.on { stroke: #ffd24a; stroke-width: 0.14; stroke-dasharray: 0.2 0.12; }
.bigmap-city .node circle { fill: #4a3a2c; stroke: rgba(240, 224, 192, 0.5); stroke-width: 0.05; }
.bigmap-city .node text { fill: #e8dcc8; font-size: 0.34px; font-weight: 700; text-anchor: middle; paint-order: stroke; stroke: #120c08; stroke-width: 0.08px; }
.bigmap-city .node.route circle { fill: #7a5a24; stroke: #ffd24a; }
.bigmap-city .node.goal circle { fill: #ffd24a; stroke: #fff2a8; stroke-width: 0.1; }
.bigmap-city .node.here circle { fill: #ffffff; stroke: var(--gold); stroke-width: 0.12; }
.bigmap-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.bigmap-legend .lg::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 50%; vertical-align: -1px; }
.lg.here::before { background: #fff; } .lg.goal::before { background: #ffd24a; } .lg.route::before { background: #7a5a24; border: 1px solid #ffd24a; }
@media (max-height: 420px) {
  .minimap { width: 84px; height: 84px; }
  .toasts { top: calc(100px + var(--safe-t)); }
  .bigmap-panel { padding: 8px 10px; gap: 6px; }
  .bigmap-title { font-size: 15px; }
  .bigmap-goal { font-size: 12px; }
  .bigmap-local { max-height: 70vh; }
  .bigmap-city { width: min(40vw, 70vh); }
  .bigmap-legend { display: none; }
}
.bigmap-sound { margin-left: auto; min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(242, 178, 58, 0.5); background: rgba(242, 178, 58, 0.1); color: var(--ink); font-weight: 800; font-size: 13px; cursor: pointer; }

/* El objetivo va centrado en el hueco entre la ficha del personaje y el minimapa */
.objective {
  left: calc(222px + var(--safe-l)); right: calc(130px + var(--safe-r)); transform: none;
  width: max-content; max-width: none; margin-inline: auto;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-height: 420px) {
  .objective { left: calc(214px + var(--safe-l)); right: calc(108px + var(--safe-r)); font-size: 13px; padding: 6px 12px 6px 28px; }
}
