:root {
  --bg: #050912;
  --panel: rgba(12, 18, 34, 0.86);
  --panel-border: rgba(255, 215, 120, 0.25);
  --text: #e8e6df;
  --muted: #9aa3b5;
  --gold: #ffd27a;
  --gold-dim: #b08a3a;
  --danger: #ff6b6b;
  --ok: #7ad67a;
  --blue: #5aa9ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: "Segoe UI", system-ui, sans-serif; overflow: hidden; user-select: none; }
#app { position: fixed; inset: 0; }
canvas#globe, canvas#surface, canvas#surface3d { position: absolute; inset: 0; width: 100%; height: 100%; display: block; transition: opacity .4s ease; }
canvas#surface { background: transparent; }
canvas#surface { image-rendering: auto; }
.hidden { display: none !important; }
.faded { opacity: 0 !important; pointer-events: none !important; }

.hud { position: absolute; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: 8px 12px; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
#hud-top { top: 0; justify-content: space-between; }
#hud-bottom { bottom: 0; align-items: flex-end; justify-content: space-between; }
.pill { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 6px 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; backdrop-filter: blur(4px); }
#clock { font-variant-numeric: tabular-nums; min-width: 320px; }
#counters span { margin-right: 10px; }
button { background: #1b2540; color: var(--text); border: 1px solid #334066; border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 13px; }
button:hover { background: #26335a; border-color: var(--gold-dim); }
button.active { background: #3a2f12; border-color: var(--gold); color: var(--gold); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: #3a2f12; border-color: var(--gold); color: var(--gold); font-weight: 600; }

#genesis-hint { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--gold); color: var(--gold); padding: 10px 18px; border-radius: 12px; z-index: 6; font-size: 15px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,210,122,.4);} 50% { box-shadow: 0 0 20px 4px rgba(255,210,122,.25);} }

.panel { position: absolute; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px 12px; font-size: 13px; z-index: 5; backdrop-filter: blur(4px); overflow: hidden auto; }
.panel h3 { margin: 0 0 8px; font-size: 14px; color: var(--gold); display: flex; justify-content: space-between; align-items: center; }
.panel h3 .close { cursor: pointer; color: var(--muted); font-weight: normal; }
#inspector { left: 12px; top: 56px; width: 300px; max-height: calc(100% - 200px); }
#prayers { right: 12px; top: 56px; width: 280px; max-height: 38%; }
#log { right: 12px; top: calc(38% + 70px); width: 280px; max-height: calc(62% - 200px); }
#log-list div, #prayer-list div { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,.06); cursor: pointer; line-height: 1.3; }
#log-list div:hover, #prayer-list div:hover { color: var(--gold); }
#log-list .t { color: var(--muted); font-size: 11px; margin-right: 4px; }
.ev-birth { color: #9fe09f; } .ev-death { color: #ff9c9c; } .ev-god { color: var(--gold); } .ev-build { color: #9fc8ff; } .ev-tech { color: #e0b0ff; } .ev-weather { color: #a9d8ff; }
.prayer { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.prayer .urg3 { color: var(--danger); font-weight: 600; }
.prayer button { padding: 2px 6px; font-size: 11px; }

.bar { height: 8px; background: #1a2238; border-radius: 4px; overflow: hidden; margin: 2px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar.red > i { background: var(--danger); }
.bar.gold > i { background: var(--gold); }
.bar.blue > i { background: var(--blue); }
.row { display: flex; justify-content: space-between; gap: 6px; }
.muted { color: var(--muted); }
.insp-name { font-size: 16px; font-weight: 600; color: var(--gold); }
.thought { font-style: italic; color: #cbd3e6; margin: 6px 0; padding: 6px; background: rgba(255,255,255,.05); border-radius: 8px; }
.link { color: var(--blue); cursor: pointer; }
.chip { display: inline-block; background: #1e2a4a; border-radius: 6px; padding: 1px 6px; margin: 1px; font-size: 11px; }

#bottom-center { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
#mana-wrap { position: relative; width: 420px; height: 18px; background: #1a1a2a; border: 1px solid var(--gold-dim); border-radius: 9px; overflow: hidden; }
#mana-bar { height: 100%; width: 50%; background: linear-gradient(90deg, #b08a3a, #ffd27a); transition: width .3s; }
#mana-bar.flash { animation: flashred .4s 2; }
@keyframes flashred { 0%,100% { filter: none; } 50% { filter: hue-rotate(-60deg) brightness(1.4); } }
#mana-text { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 16px; color: #fff; text-shadow: 0 1px 2px #000; }
#sin-wrap { position: relative; width: 420px; height: 14px; background: #1a1212; border: 1px solid #6a2a2a; border-radius: 7px; overflow: hidden; cursor: pointer; }
#sin-bar { height: 100%; width: 0%; background: linear-gradient(90deg, #5a1010, #c0302a); transition: width .3s; }
#sin-wrap.full #sin-bar { animation: sinpulse 1.2s infinite; }
#sin-wrap.owed { border-color: #c0502a; box-shadow: 0 0 8px rgba(220,80,40,.35); }
#sin-wrap.flash { animation: flashred .4s 3; }
@keyframes sinpulse { 0%,100% { filter: none; } 50% { filter: brightness(1.6); } }
#sin-text { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 13px; color: #ffd8d0; text-shadow: 0 1px 2px #000; pointer-events: none; }
@media (max-width: 760px) { #sin-wrap, #mana-wrap, #strength-wrap { width: 100% !important; } .pt-grid { grid-template-rows: repeat(7, 30px) 6px repeat(2, 30px); } .pt-el b { font-size: 10px; } .pt-el small { display: none; } }
#powers { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; min-height: 58px; }
#power-tabs { display: flex; gap: 4px; justify-content: center; }
#power-tabs .tab { padding: 3px 10px; font-size: 12px; border-radius: 8px 8px 0 0; }
#power-tabs .tab .ct { font-size: 10px; color: var(--muted); margin-left: 4px; }
#powers button { display: flex; flex-direction: column; align-items: center; min-width: 64px; padding: 4px 6px; line-height: 1.15; }
#powers button .ico { font-size: 20px; }
#powers button .nm { font-size: 11px; }
#powers button .ct { font-size: 10px; color: var(--muted); }
#powers button.active .ct { color: var(--gold); }
#minimap { border: 1px solid var(--panel-border); border-radius: 8px; background: #000; cursor: pointer; }
#perf { font-size: 11px; color: var(--muted); min-width: 120px; justify-content: flex-end; }
.manaplus { position: absolute; color: var(--gold); font-weight: 700; pointer-events: none; animation: rise 1.2s forwards; z-index: 7; }
@keyframes rise { from { transform: translateY(0); opacity: 1; } to { transform: translateY(-40px); opacity: 0; } }

#toasts { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 8; pointer-events: none; }
.toast { background: var(--panel); border: 1px solid var(--panel-border); border-left: 4px solid var(--gold); padding: 8px 14px; border-radius: 8px; font-size: 13px; animation: toastin .3s ease; pointer-events: auto; cursor: pointer; max-width: 520px; }
.toast.death { border-left-color: var(--danger); } .toast.birth { border-left-color: var(--ok); } .toast.tech { border-left-color: #c58cff; } .toast.pray { border-left-color: #5aa9ff; }
@keyframes toastin { from { transform: translateY(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

#tooltip { position: absolute; background: var(--panel); border: 1px solid var(--panel-border); padding: 6px 10px; border-radius: 8px; font-size: 12px; pointer-events: none; z-index: 20; max-width: 260px; }
#tooltip b { color: var(--gold); }
#fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .4s; z-index: 4; }

#intro { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; background: radial-gradient(ellipse at center, rgba(5,9,18,.35), rgba(5,9,18,.9)); }
.intro-box { background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 16px; padding: 28px 34px; width: 520px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.intro-box h1 { margin: 0; font-size: 46px; letter-spacing: 8px; color: var(--gold); font-weight: 300; }
.subtitle { color: var(--muted); margin: 4px 0 20px; }
.intro-grid { display: flex; flex-direction: column; gap: 10px; text-align: left; font-size: 13px; }
.intro-grid label { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.intro-grid input[type=text], .intro-grid select { background: #0f1628; color: var(--text); border: 1px solid #334066; border-radius: 6px; padding: 4px 8px; width: 200px; }
.intro-grid input[type=range] { width: 160px; }
.intro-grid span { width: 50px; color: var(--muted); text-align: right; }
.intro-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.intro-btns button { padding: 10px 16px; font-size: 14px; }
#intro-status { color: var(--muted); min-height: 18px; font-size: 12px; margin: 14px 0 0; }

#modal { position: absolute; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal-box { background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 14px; padding: 20px 24px; width: min(760px, 92vw); max-height: 86vh; overflow: auto; font-size: 13px; line-height: 1.5; }
.modal-box h2 { color: var(--gold); margin-top: 0; }
.modal-box table { border-collapse: collapse; width: 100%; }
.modal-box td, .modal-box th { border-bottom: 1px solid rgba(255,255,255,.08); padding: 4px 6px; text-align: left; }
.modal-box kbd { background: #1b2540; border: 1px solid #334066; border-radius: 4px; padding: 0 5px; font-family: inherit; }
#modal-close { margin-top: 14px; }
.statchart { width: 100%; height: 120px; background: #0b1020; border-radius: 8px; display: block; margin: 6px 0 12px; }
.sparkline { width: 100%; height: 40px; background: #0b1020; border-radius: 6px; display: block; margin: 4px 0 8px; }
.slot { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.cursor-power canvas { cursor: crosshair; }
.cursor-grab canvas { cursor: grab; }

/* Transición de nubes entre órbita y superficie */
#cloudfx { position: absolute; inset: -25%; z-index: 4; pointer-events: none; opacity: 0; transform: scale(1); background-size: 50% 50%; filter: blur(6px); }
#cloudfx.pre-leave { transform: scale(2.4); }
#cloudfx.in { opacity: 1; transform: scale(1.6); transition: opacity .4s ease-in, transform .42s ease-in; }
#cloudfx.out { opacity: 0; transform: scale(2.6); transition: opacity .8s ease-out, transform .9s ease-out; }
#cloudfx.out-leave { opacity: 0; transform: scale(1); transition: opacity .8s ease-out, transform .9s ease-out; }

/* Modo foto */
body.photo .hud, body.photo .panel, body.photo #toasts, body.photo #tooltip { display: none !important; }
#photo-bar { white-space: nowrap; position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 6; display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 6px 10px; font-size: 12px; opacity: .35; transition: opacity .2s; }
#photo-bar:hover { opacity: 1; }
.influence button { font-size: 12px; padding: 4px 7px; }

/* Reloj con hora solar local y selector de hora */
#clock { display: flex; gap: 10px; align-items: center; white-space: nowrap; min-width: 0; }
#clock .clock-time b { font-size: 15px; color: var(--gold); }
#clock:hover { border-color: var(--gold-dim); }
#time-pop { position: absolute; top: 52px; left: 12px; width: 330px; z-index: 7; font-size: 13px; }
#time-pop button { font-size: 12px; padding: 4px 7px; }
#clock { max-width: 380px; overflow: hidden; }
#clock > .muted { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#clock .clock-time { flex: none; }

/* Árbol de tecnología (js/techtree.js) */
#techtree { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
#techtree.hidden { display: none; }
#techtree .tt-box { background: var(--panel); border: 1px solid var(--gold-dim); border-radius: 14px; width: min(1260px, calc(100vw - 20px)); height: min(680px, calc(100vh - 20px)); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6); backdrop-filter: blur(6px); font-size: 13px; overflow: hidden; }
#techtree .tt-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px 6px; flex-wrap: wrap; }
#techtree .tt-head h2 { margin: 0; font-size: 18px; color: var(--gold); font-weight: 600; white-space: nowrap; }
#techtree .tt-sel { color: var(--muted); display: flex; gap: 6px; align-items: center; }
#techtree select { background: #0f1628; color: var(--text); border: 1px solid #334066; border-radius: 6px; padding: 3px 6px; max-width: 260px; }
#techtree .tt-sum { flex: 1; min-width: 300px; font-size: 12px; line-height: 1.4; }
#techtree .tt-sum b { color: var(--gold); }
#techtree .tt-legend { display: flex; gap: 14px; padding: 0 14px 6px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
#techtree .tt-legend .lg { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid; }
#techtree .lg.done { background: #3a2f12; border-color: var(--gold); } #techtree .lg.research { background: #12284a; border-color: var(--blue); }
#techtree .lg.avail { background: #1b2540; border-color: #6b7ba8; } #techtree .lg.locked { background: #10141f; border-color: #2a3046; }
#techtree .tt-scroll { flex: 1; overflow: auto; margin: 0 8px; border-radius: 10px; background: rgba(5, 9, 18, .55); border: 1px solid rgba(255,255,255,.05); }
#techtree .tt-grid { position: relative; }
#techtree .tt-col { position: absolute; top: 0; border-right: 1px dashed rgba(255,255,255,.06); }
#techtree .tt-col.cur { background: linear-gradient(180deg, rgba(255,210,122,.09), rgba(255,210,122,.02)); }
#techtree .tt-colh { position: absolute; top: 6px; left: 0; right: 0; text-align: center; line-height: 1.15; }
#techtree .tt-colh b { display: block; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
#techtree .tt-colh span { font-size: 13px; color: var(--text); }
#techtree .tt-col.cur .tt-colh span { color: var(--gold); font-weight: 600; }
#techtree .tt-lines { position: absolute; left: 0; top: 0; pointer-events: none; }
#techtree .tt-lines path { fill: none; stroke: #2c3552; stroke-width: 1.6; }
#techtree .tt-lines path.open { stroke: #6b7ba8; }
#techtree .tt-lines path.done { stroke: var(--gold-dim); stroke-width: 2; }
#techtree .tt-node { position: absolute; box-sizing: border-box; display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 0 4px; padding: 3px 7px 6px 5px; border-radius: 9px; border: 1px solid #2a3046; background: #10141f; cursor: pointer; color: var(--muted); transition: border-color .15s, transform .15s, background .15s; overflow: hidden; }
#techtree .tt-node:hover { transform: translateY(-1px); border-color: var(--gold); z-index: 2; }
#techtree .tt-node .ico { font-size: 20px; text-align: center; filter: grayscale(.8); opacity: .6; }
#techtree .tt-node .nm { font-size: 12px; line-height: 1.15; }
#techtree .tt-node .key { color: var(--gold); font-style: normal; font-size: 11px; }
#techtree .tt-node .cost { font-size: 10px; color: #6b7590; align-self: start; padding-top: 2px; }
#techtree .tt-node .pb { position: absolute; left: 6px; right: 6px; bottom: 4px; height: 3px; border-radius: 2px; background: rgba(255,255,255,.06); overflow: hidden; display: none; }
#techtree .tt-node .pb b { display: block; height: 100%; background: var(--blue); width: 0; transition: width .5s; }
#techtree .tt-node.avail { background: #1b2540; border-color: #4a5a88; color: var(--text); }
#techtree .tt-node.avail .ico, #techtree .tt-node.research .ico, #techtree .tt-node.done .ico { filter: none; opacity: 1; }
#techtree .tt-node.research { background: #12284a; border-color: var(--blue); color: var(--text); box-shadow: 0 0 10px rgba(90,169,255,.35); }
#techtree .tt-node.research .pb { display: block; }
#techtree .tt-node.done { background: #2e2610; border-color: var(--gold-dim); color: var(--gold); }
#techtree .tt-node.locked.future { opacity: .55; }
#techtree .tt-node.sel { outline: 2px solid var(--gold); outline-offset: 1px; }
#techtree .tt-info { min-height: 92px; max-height: 128px; overflow: auto; margin: 8px 8px 10px; padding: 8px 12px; border-radius: 10px; background: #0b1020; border: 1px solid rgba(255,255,255,.06); line-height: 1.45; }
#techtree .tt-ititle { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
#techtree .tt-ititle .ico { font-size: 20px; } #techtree .tt-ititle b { color: var(--gold); font-size: 14px; }
#techtree .tt-ititle .key { color: var(--gold); font-size: 11px; }
#techtree .tt-st { margin-left: auto; font-size: 12px; } #techtree .tt-st.done { color: var(--gold); } #techtree .tt-st.research { color: var(--blue); } #techtree .tt-st.avail { color: var(--ok); } #techtree .tt-st.locked { color: var(--muted); }
#techtree .tt-reveal { background: #3a2f12; border-color: var(--gold); color: var(--gold); padding: 3px 9px; }
#techtree .tt-fx { margin: 3px 0; } #techtree .chip.fx { background: #1e3a2a; } #techtree .chip.ok { background: #3a2f12; color: var(--gold); }

/* Panel de población */
#counters span[data-pop] { border-radius: 6px; padding: 1px 4px; }
#counters span[data-pop]:hover { background: rgba(255,210,122,.15); }
.pop-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.pop-tabs button.active { border-color: var(--gold); color: var(--gold); }
.pop-filters { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.pop-filters input, .pop-filters select { background: #0f1830; color: var(--text); border: 1px solid #334066; border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.pop-filters input { flex: 1; min-width: 140px; }
.pop-table tr[data-h], .pop-table tr[data-t] { cursor: pointer; }
.pop-table tr[data-h]:hover, .pop-table tr[data-t]:hover { background: rgba(255,210,122,.08); }
.pop-table .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.pop-table .mini { width: 60px; height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.pop-table .mini i { display: block; height: 100%; background: var(--ok); }
.pop-table .mini.red i { background: var(--danger); }
.modal-box:has(.pop-table) { width: min(960px, 94vw); }

/* =====================================================================================================
   Rediseño de la interfaz (nov 2026): cristal oscuro con filo dorado, tipografía con jerarquía, consola
   divina agrupada, poderes como tarjetas, pestañas tipo selector y paneles nuevos (tabla periódica, leyes)
   ===================================================================================================== */
:root {
  --panel: linear-gradient(180deg, rgba(20, 26, 46, .88), rgba(10, 14, 28, .9));
  --panel-solid: #0e1424;
  --panel-border: rgba(255, 215, 120, .22);
  --line: rgba(255, 255, 255, .07);
  --glow: 0 10px 34px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
  --title: "Cinzel", "Trajan Pro", Georgia, serif;
  --ui: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
}
html, body { font-family: var(--ui); letter-spacing: .1px; }
.pill, .panel, .toast, #tooltip, .modal-box, .intro-box, #photo-bar { background: var(--panel); border: 1px solid var(--panel-border); box-shadow: var(--glow); backdrop-filter: blur(10px) saturate(1.2); }
.pill { border-radius: 12px; }
.panel { border-radius: 14px; padding: 12px 14px; }
.panel h3 { font-family: var(--title); font-weight: 600; letter-spacing: 1px; font-size: 14px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.modal-box h2, .intro-box h1, .insp-name, #techtree .tt-head h2 { font-family: var(--title); letter-spacing: 1.5px; }
.modal-box h2 { font-weight: 600; font-size: 22px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.modal-box h3 { color: var(--gold); font-family: var(--title); font-size: 15px; letter-spacing: 1px; margin: 14px 0 6px; }
#modal { background: rgba(2, 4, 10, .55); backdrop-filter: blur(3px); }
.modal-box { border-radius: 18px; padding: 22px 26px; animation: modalin .22s ease; }
@keyframes modalin { from { transform: translateY(8px) scale(.985); opacity: 0; } to { transform: none; opacity: 1; } }

/* Botones */
button { background: linear-gradient(180deg, #223056, #18213d); border: 1px solid #36457a; border-radius: 9px; transition: transform .12s, border-color .15s, background .15s, box-shadow .15s; }
button:hover:not(:disabled) { background: linear-gradient(180deg, #2b3c6c, #1e2a4d); border-color: var(--gold-dim); transform: translateY(-1px); }
button:active:not(:disabled) { transform: translateY(0); }
button.active, button.primary { background: linear-gradient(180deg, #4a3b14, #2e250c); border-color: var(--gold); color: var(--gold); box-shadow: 0 0 12px rgba(255, 210, 122, .22); }

/* Consola divina: poder, pecado y fuerza en una sola tarjeta */
#bottom-center { gap: 6px; }
#mana-wrap, #sin-wrap, #strength-wrap { width: 460px; }
#mana-wrap { height: 20px; border-radius: 10px; border-color: rgba(255, 210, 122, .45); background: #121524; box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
#mana-bar { background: linear-gradient(90deg, #8a6420, #e8b850 60%, #fff0b8); box-shadow: 0 0 12px rgba(255, 210, 122, .45); }
#mana-text { line-height: 18px; font-weight: 600; }
#sin-wrap { height: 16px; border-radius: 8px; background: #160c0e; box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
#sin-bar { background: linear-gradient(90deg, #3e0a0e, #9a1e22 60%, #e0503a); }
#sin-text { line-height: 14px; font-weight: 600; }
#strength-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; padding: 2px 10px; }
#strength-wrap input { flex: 1; }
#strength-wrap b { color: var(--gold); min-width: 38px; text-align: right; }
input[type=range] { accent-color: #e8b850; cursor: pointer; }

/* Pestañas de poderes: selector segmentado; «Observar» con su propio estado */
#power-tabs { gap: 2px; background: rgba(8, 12, 24, .7); border: 1px solid var(--panel-border); border-radius: 12px; padding: 3px; }
#power-tabs .tab { border-radius: 9px; border-color: transparent; background: transparent; padding: 4px 11px; }
#power-tabs .tab:hover { background: rgba(255, 255, 255, .06); }
#power-tabs .tab.active { background: linear-gradient(180deg, #4a3b14, #2e250c); border-color: var(--gold-dim); }
#power-tabs .tab.observing { background: linear-gradient(180deg, #183a5c, #10263e); border-color: var(--blue); color: #bfe0ff; box-shadow: 0 0 10px rgba(90, 169, 255, .3); }
/* Poderes como tarjetas */
#powers { gap: 6px; }
#powers button { min-width: 74px; padding: 6px 8px 5px; border-radius: 12px; background: linear-gradient(180deg, rgba(34, 46, 84, .92), rgba(20, 27, 52, .92)); }
#powers button .ico { font-size: 22px; width: 34px; height: 34px; line-height: 34px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, rgba(255,255,255,.12), rgba(0,0,0,.25)); margin-bottom: 2px; }
#powers button.active .ico { background: radial-gradient(circle at 40% 35%, rgba(255,230,160,.45), rgba(120,80,10,.4)); box-shadow: 0 0 14px rgba(255, 210, 122, .5); }
#powers button .nm { font-weight: 600; }

/* Avisos */
.toast { border-left-width: 4px; border-radius: 10px; box-shadow: 0 8px 26px rgba(0,0,0,.45); }
#log-list div { border-bottom-color: var(--line); }
.chip { background: rgba(60, 80, 140, .35); border: 1px solid rgba(120, 150, 220, .2); border-radius: 7px; }

/* Barras de desplazamiento */
* { scrollbar-width: thin; scrollbar-color: #3a4670 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #3a4670; border-radius: 4px; } ::-webkit-scrollbar-track { background: transparent; }

/* Tabla periódica */
.modal-box:has(.pt-grid) { width: min(1100px, 96vw); }
.pt-grid { display: grid; grid-template-columns: repeat(18, minmax(0, 1fr)); grid-template-rows: repeat(7, 46px) 10px repeat(2, 46px); gap: 3px; margin: 10px 0; }
.pt-el { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; border-radius: 6px; background: color-mix(in srgb, var(--c) 22%, #0e1424); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); color: #fff; min-width: 0; }
.pt-el small { font-size: 9px; opacity: .65; line-height: 1; }
.pt-el b { font-size: 14px; line-height: 1.1; }
.pt-el:hover:not(:disabled) { background: color-mix(in srgb, var(--c) 45%, #0e1424); transform: translateY(-1px) scale(1.06); z-index: 2; }
.pt-el.on { outline: 2px solid var(--gold); background: color-mix(in srgb, var(--c) 60%, #0e1424); }
.pt-detail { display: flex; gap: 16px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.pt-big { flex: none; width: 92px; height: 92px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: color-mix(in srgb, var(--c) 35%, #0e1424); border: 2px solid var(--c); }
.pt-big b { font-size: 34px; line-height: 1; } .pt-big small { opacity: .7; } .pt-big span { font-size: 11px; }
.pt-detail p { margin: 4px 0; }

.pt-el.has::after { content: ''; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px #fff; }
.pt-el { position: relative; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 11px; color: var(--muted); }
.pt-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.pt-leg i.dotw { width: 6px; height: 6px; border-radius: 50%; background: #fff; box-shadow: 0 0 4px #fff; vertical-align: 1px; }
.pt-info { flex: 1; min-width: 0; }
.chip.el { background: color-mix(in srgb, var(--c) 30%, #0e1424); border-color: color-mix(in srgb, var(--c) 60%, transparent); font-weight: 600; }
.chip.good { background: rgba(232, 184, 80, .16); border-color: rgba(232, 184, 80, .45); color: #ffe2a0; }

/* Leyes de la naturaleza: leyes a la izquierda, consecuencias en vivo a la derecha */
.modal-box:has(.law-cols) { width: min(1080px, 96vw); }
.law-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 10px; }
.law-presets button { font-size: 12px; padding: 4px 9px; }
.law-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.law-grp { background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 8px; margin-bottom: 10px; }
.law-grp h3, .law-right h3 { margin: 8px 0 4px; }
.law { padding: 6px 0; border-bottom: 1px solid var(--line); }
.law:last-child { border-bottom: 0; }
.law label { display: flex; justify-content: space-between; align-items: baseline; }
.law input[type=range] { width: 100%; margin: 3px 0 0; }
.law-d { font-size: 11px; color: var(--muted); line-height: 1.3; }
.law-v { color: var(--gold); font-weight: 700; font-variant-numeric: tabular-nums; }
.law-right { position: sticky; top: 0; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px 8px; }
.cons { display: grid; grid-template-columns: 22px 1fr auto; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 7px; margin: 2px 0; border-left: 3px solid #4a9a5a; background: rgba(90, 170, 110, .07); }
.cons b { font-variant-numeric: tabular-nums; }
.cons.warn { border-left-color: #e8b850; background: rgba(232, 184, 80, .1); } .cons.warn b { color: #ffd27a; }
.cons.bad { border-left-color: #e0503a; background: rgba(224, 80, 58, .13); } .cons.bad b { color: #ff9c8c; }
@media (max-width: 760px) { .law-cols { grid-template-columns: 1fr; } .law-right { position: static; } }

/* Indicador del estado físico del mundo (arriba) */
#world-pill { cursor: pointer; gap: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#world-pill:hover { border-color: var(--gold-dim); }
#world-pill .warn { color: #ffd27a; } #world-pill .bad { color: #ff8c7a; font-weight: 700; }
@media (max-width: 1100px) { #world-pill { display: none; } }

/* Ficha: secciones y paneles plegables */
.insp-sec { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.insp-h { font-family: var(--title); font-size: 12px; letter-spacing: 1px; color: var(--gold); margin-bottom: 3px; }
.panel.collapsed > :not(h3) { display: none; }
.panel.collapsed { max-height: none !important; }
.panel.collapsed h3 { border-bottom: 0; margin: 0; padding: 0; }
.panel h3::after { content: '▾'; color: var(--muted); font-size: 11px; margin-left: 6px; }
#inspector h3::after, .panel.collapsed h3::after { content: none; }
.panel.collapsed h3::before { content: '▸ '; color: var(--muted); }
#log.collapsed { top: 104px !important; }
#inspector .bar { height: 7px; border-radius: 4px; }
#inspector .row { padding: 1px 0; }
#sysbtns button { min-width: 30px; }

/* ===== Móvil / pantallas estrechas ===== */
#btn-panels { display: none; }
@media (max-width: 760px) {
  .hud { padding: 6px 6px; gap: 6px; }
  #hud-top { flex-wrap: wrap; align-items: flex-start; }
  #clock { order: 1; flex: 1 1 auto; min-width: 0; max-width: none; font-size: 12px; padding: 5px 8px; }
  #clock > .muted { display: none; }
  #counters { order: 2; font-size: 12px; padding: 5px 6px; }
  #counters span { margin-right: 4px; }
  #sysbtns { order: 3; padding: 4px; gap: 3px; }
  #sysbtns button { padding: 4px 6px; font-size: 12px; }
  #speeds { order: 4; flex: 1 1 100%; overflow-x: auto; flex-wrap: nowrap; padding: 4px; gap: 4px; scrollbar-width: none; }
  #speeds::-webkit-scrollbar { display: none; }
  #speeds button { flex: none; padding: 4px 8px; }
  #btn-panels { display: inline-block; }
  #prayers, #log { display: none; }
  body.mob-panels #prayers, body.mob-panels #log { display: block; left: 8px; right: 8px; width: auto; }
  body.mob-panels #prayers { top: 112px; max-height: 26%; }
  body.mob-panels #log { top: calc(26% + 124px); max-height: calc(74% - 330px); }
  #inspector { left: 8px; right: 8px; width: auto; top: auto; bottom: 168px; max-height: 46%; z-index: 9; }
  #toasts { top: 112px; width: 94vw; }
  #toasts > * { font-size: 12px; }
  #hud-bottom { flex-wrap: wrap; justify-content: center; }
  #minimap { width: 120px; height: 60px; position: absolute; left: 6px; bottom: 150px; }
  #perf { display: none !important; }
  #bottom-center { flex: 1 1 100%; min-width: 0; }
  #mana-wrap { width: 100%; }
  #power-tabs, #powers { width: 100%; overflow-x: auto; flex-wrap: nowrap; justify-content: flex-start; scrollbar-width: none; }
  #power-tabs::-webkit-scrollbar, #powers::-webkit-scrollbar { display: none; }
  #power-tabs .tab, #powers button { flex: none; }
  #powers { min-height: 0; }
  #powers button { min-width: 58px; }
  #time-pop { left: 8px; right: 8px; width: auto; top: 108px; }
  .modal-box { width: 96vw !important; max-height: 90vh; padding: 14px; }
  .pop-table td:nth-child(4), .pop-table th:nth-child(4), .pop-table td:nth-child(6), .pop-table th:nth-child(6) { display: none; }
  #photo-bar { white-space: normal; flex-wrap: wrap; width: 94vw; opacity: .7; }
  #photo-bar .muted { display: none; }
}
