:root {
  --fondo: #07090d;
  --panel: rgba(12, 16, 22, 0.92);
  --borde: #262d3b;
  --oro: #ff9f43;
  --oro2: #ffd6a8;
  --texto: #e8ebf1;
  --tenue: #8f98aa;
  --azul: #3fa9ff;
  --rojo: #ff4d5a;
  --verde: #58e36f;
  --mana: #4f8dff;
  --display: 'Saira Condensed', 'Arial Narrow', sans-serif;
  --acero: #c9d2e0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--fondo); color: var(--texto); font-family: Inter, system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
canvas#lienzo, canvas#capa { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
canvas#capa { pointer-events: none; }
#vineta { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(4, 8, 6, 0.55) 100%); }
.oculto { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Selección ---------- */
.pantalla { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; padding: 16px; overflow: auto;
  background:
    radial-gradient(ellipse 60% 70% at 0% 20%, rgba(40, 120, 220, 0.30), transparent 70%),
    radial-gradient(ellipse 60% 70% at 100% 20%, rgba(220, 50, 50, 0.28), transparent 70%),
    linear-gradient(180deg, rgba(10, 13, 19, 0.6), rgba(4, 5, 8, 0.98)), #07090d; }
#pausa, #final { background: rgba(4, 6, 9, 0.78); backdrop-filter: blur(4px); }
.sel-caja { width: min(1080px, 100%); display: flex; flex-direction: column; gap: 22px; }
.sel-caja.chica { width: min(560px, 100%); align-items: center; text-align: center; padding: 34px 28px; background: var(--panel); border: 1px solid var(--borde); border-radius: 14px; }
.marca { text-align: center; }
.marca h1 { margin: 0; line-height: 0.9; font-family: var(--display); font-weight: 800; font-size: clamp(64px, 12vw, 132px); letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 0.06em; transform: skewX(-9deg); filter: drop-shadow(0 10px 34px rgba(0, 0, 0, 0.6)); }
.marca h1 .wa { background: linear-gradient(180deg, #f2f9ff 8%, #6cc1ff 48%, #1f5fb8 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(63, 169, 255, 0.35)); }
.marca h1 .rr { background: linear-gradient(180deg, #fff1e6 8%, #ff7a52 48%, #a3122a 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(255, 77, 90, 0.35)); }
.marca h1 .tajo { width: 0.07em; height: 1.02em; border-radius: 2px; transform: rotate(14deg); background: linear-gradient(180deg, transparent, #fff 30%, #ffb15c 70%, transparent);
  box-shadow: 0 0 18px rgba(255, 190, 120, 0.9), 0 0 50px rgba(255, 159, 67, 0.45); }
.marca-sub { display: block; margin-top: 10px; font-family: var(--display); font-weight: 600; letter-spacing: 0.42em; text-transform: uppercase; color: var(--acero); font-size: clamp(12px, 1.6vw, 16px); }
.marca-sub i { font-style: normal; color: var(--oro); padding: 0 0.5em; }
.marca p { color: var(--tenue); margin: 10px 0 0; }
h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; color: var(--oro2); letter-spacing: 0.08em; margin: 0 0 8px; }

.heroes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.heroe { position: relative; border: 1px solid var(--borde); border-radius: 12px; padding: 16px 12px 14px; text-align: left; background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(0,0,0,0.25)); transition: transform .15s, border-color .15s, box-shadow .15s; }
.heroe:hover { transform: translateY(-3px); border-color: #5a6478; }
.heroe.activo { border-color: var(--oro); box-shadow: 0 0 0 1px var(--oro), 0 10px 40px rgba(255,159,67,0.18); }
.heroe .emblema { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 24px; color: #0b0b0b; margin-bottom: 10px; box-shadow: inset 0 -6px 12px rgba(0,0,0,0.3); }
.heroe b { display: block; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: 0.03em; color: var(--oro2); }
.heroe small { color: var(--tenue); display: block; }
.heroe .rol { position: absolute; top: 12px; right: 12px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 3px 7px; border-radius: 99px; background: rgba(255,255,255,0.06); color: var(--tenue); }
.detalle { min-height: 150px; border: 1px solid var(--borde); border-radius: 12px; padding: 16px 18px; background: var(--panel); display: grid; grid-template-columns: 1.1fr 2fr; gap: 18px; }
.detalle p { margin: 4px 0 0; color: #c8cfdb; }
.detalle .lista-habs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; }
.detalle .lista-habs div { font-size: 13px; color: #c3cad6; }
.detalle .lista-habs b { color: var(--oro2); }
.tecla { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 4px; background: #1c212c; border: 1px solid #4a5468; color: var(--oro2); font-size: 11px; font-weight: 700; margin-right: 6px; }
.sel-pie { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dificultad { display: flex; align-items: center; gap: 6px; color: var(--tenue); }
.dificultad span { margin-right: 6px; }
.dificultad button, .boton { background: rgba(255,255,255,0.05); border: 1px solid var(--borde); border-radius: 8px; padding: 9px 14px; }
.dificultad button.activo { border-color: var(--oro); color: var(--oro2); background: rgba(255,159,67,0.12); }
.boton-grande { font-family: var(--display); font-weight: 800; text-transform: uppercase; letter-spacing: 0.14em; font-size: 20px; padding: 13px 36px; border-radius: 4px; clip-path: polygon(12px 0, 100% 0, calc(100% - 12px) 100%, 0 100%); border: 1px solid #ffd6a8;
  background: linear-gradient(180deg, #ffb15c, #e0611c); color: #1a0b02; box-shadow: 0 8px 30px rgba(255,159,67,0.25); }
.boton-grande:hover { filter: brightness(1.08); }
.controles { color: var(--tenue); font-size: 14px; }
.controles summary { cursor: pointer; color: var(--oro); }
.controles ul { columns: 2; margin: 10px 0 0; padding-left: 18px; }
.controles b { color: var(--texto); }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#hud .arriba, #hud .feed, #hud .anuncio, #hud .aviso, #hud .canal, #hud .muerte { pointer-events: none; }
.arriba { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); }
.marcador { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--borde); border-radius: 0 0 12px 12px; padding: 6px 18px; font-weight: 800; font-size: 20px; }
.marcador .az { color: var(--azul); } .marcador .ro { color: var(--rojo); }
.marcador .reloj { font-size: 14px; color: var(--tenue); font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.feed { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.feed div { background: rgba(10,14,18,0.82); border: 1px solid #2a2a2a; border-radius: 6px; padding: 4px 10px; font-size: 13px; animation: entra .25s ease-out; }
@keyframes entra { from { transform: translateX(20px); opacity: 0; } }
.anuncio { position: absolute; top: 18%; left: 50%; transform: translateX(-50%); font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: .05em; text-shadow: 0 3px 16px rgba(0,0,0,0.9); white-space: nowrap; transition: opacity .3s; }
.aviso { position: absolute; bottom: 190px; left: 50%; transform: translateX(-50%); color: #ffd0d0; background: rgba(60,10,14,0.75); border: 1px solid #6a2228; padding: 6px 14px; border-radius: 8px; font-size: 14px; opacity: 0; transition: opacity .2s; }

.panel { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: flex-end; background: var(--panel); border: 1px solid var(--borde); border-radius: 14px; padding: 10px 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.retrato { position: relative; width: 84px; height: 84px; border-radius: 50%; border: 2px solid var(--oro); display: grid; place-items: center; font-family: var(--display); font-size: 34px; font-weight: 800; color: #111; flex: none; }
.retrato #nivel { position: absolute; bottom: -6px; right: -4px; background: #10141c; color: var(--oro2); border: 1px solid var(--oro); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; font-size: 13px; font-family: Inter, sans-serif; }
.retrato .xp { position: absolute; left: 6px; right: 6px; bottom: -10px; height: 4px; background: #222; border-radius: 3px; overflow: hidden; }
.retrato .xp i { display: block; height: 100%; background: #b77dff; width: 0; }
.centro { display: flex; flex-direction: column; gap: 8px; }
.habs { display: flex; gap: 8px; }
.hab { position: relative; width: 60px; height: 60px; border-radius: 10px; border: 1px solid #3a4252; overflow: hidden; display: grid; place-items: center; text-align: center; font-size: 10px; font-weight: 700; line-height: 1.1; color: #fff; text-shadow: 0 1px 2px #000; }
.hab .nom { padding: 0 3px; }
.hab .tk { position: absolute; top: 2px; left: 4px; font-size: 11px; color: var(--oro2); }
.hab .cd { position: absolute; inset: 0; background: rgba(0,0,0,0.68); display: grid; place-items: center; font-size: 18px; font-weight: 800; }
.hab .sinmana { position: absolute; inset: 0; background: rgba(20,40,120,0.55); }
.hab.bloqueada { filter: grayscale(1) brightness(0.45); }
.hab .rangos { position: absolute; bottom: 3px; left: 0; right: 0; display: flex; justify-content: center; gap: 2px; }
.hab .rangos i { width: 6px; height: 3px; background: #444; border-radius: 1px; }
.hab .rangos i.on { background: var(--oro2); }
.hab .mas { position: absolute; top: -1px; right: -1px; width: 20px; height: 20px; border-radius: 0 0 0 8px; background: #ffb15c; color: #1a0b02; border: none; font-weight: 900; font-size: 15px; line-height: 1; padding: 0; }
.barras { display: flex; flex-direction: column; gap: 4px; }
.b-hp, .b-mana { position: relative; height: 16px; background: #1b1d20; border-radius: 4px; overflow: hidden; border: 1px solid #2c2c2c; }
.b-mana { height: 12px; }
.b-hp i, .b-mana i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #6cf083, #2fa548); }
.b-mana i { background: linear-gradient(180deg, #78a5ff, #3361d6); }
.b-hp span, .b-mana span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.b-mana span { font-size: 9px; }
.lado { display: flex; flex-direction: column; gap: 6px; width: 168px; }
.objetos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.objetos div { height: 34px; border-radius: 6px; border: 1px solid #2a3140; background: rgba(255,255,255,0.03); display: grid; place-items: center; font-size: 19px; }
.oro { display: flex; align-items: center; gap: 6px; color: #ffd24a; font-weight: 800; }
.oro b { flex: 1; font-variant-numeric: tabular-nums; }
.oro button { background: linear-gradient(180deg, #ffb15c, #e0611c); color: #1a0b02; border: none; border-radius: 6px; padding: 4px 10px; font-weight: 800; font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px 6px; font-size: 11px; color: var(--tenue); }
.stats b { color: var(--texto); font-weight: 600; }

.canal { position: absolute; bottom: 200px; left: 50%; transform: translateX(-50%); width: 260px; text-align: center; font-size: 13px; color: #bfe6ff; }
.canal div { height: 8px; background: #111; border: 1px solid #335; border-radius: 4px; margin-top: 4px; overflow: hidden; }
.canal i { display: block; height: 100%; background: linear-gradient(90deg, #4fb4ff, #bfe6ff); }
.muerte { position: absolute; top: 34%; left: 50%; transform: translateX(-50%); text-align: center; font-family: var(--display); }
.muerte b { display: block; font-size: 40px; color: #ff8b8b; text-shadow: 0 3px 20px #000; }
.muerte span { font-size: 18px; color: #f2d6d6; }
body.muerto canvas#lienzo { filter: grayscale(0.85) brightness(0.8); }

.mini { position: absolute; right: 10px; bottom: 10px; background: var(--panel); border: 1px solid var(--borde); border-radius: 10px; padding: 6px; }
.mini canvas { display: block; width: 220px; height: 220px; border-radius: 6px; cursor: pointer; }
.mini button { position: absolute; top: -28px; right: 0; background: var(--panel); border: 1px solid var(--borde); border-radius: 6px; font-size: 11px; padding: 3px 8px; }

.tooltip { position: fixed; z-index: 30; max-width: 280px; background: rgba(8,10,14,0.97); border: 1px solid var(--oro); border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #d3d8e2; pointer-events: none; }
.tooltip b { color: var(--oro2); display: block; margin-bottom: 4px; }
.tooltip small { color: var(--tenue); display: block; margin-top: 6px; }

/* ---------- Tienda ---------- */
.tienda { position: fixed; z-index: 15; left: 50%; top: 50%; transform: translate(-50%, -55%); width: min(700px, calc(100% - 32px)); max-height: 80vh; overflow: auto; background: rgba(12,15,20,0.97); border: 1px solid var(--oro); border-radius: 14px; padding: 16px 18px 18px; box-shadow: 0 30px 80px rgba(0,0,0,0.7); }
.tienda header { display: flex; align-items: center; gap: 14px; }
.tienda header h2 { margin: 0; flex: 1; }
.tienda header span { color: #ffd24a; font-weight: 800; }
.tienda header button { background: none; border: 1px solid var(--borde); border-radius: 6px; width: 30px; height: 30px; }
.tienda .nota { color: var(--tenue); font-size: 13px; margin: 6px 0 12px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.item { text-align: left; border: 1px solid #2a3140; border-radius: 10px; padding: 10px; background: rgba(255,255,255,0.03); display: grid; grid-template-columns: 34px 1fr; gap: 2px 8px; align-items: center; }
.item:hover { border-color: var(--oro); }
.item .ic { grid-row: span 4; font-size: 26px; }
.item b { font-size: 13px; color: var(--oro2); }
.item small { font-size: 11px; color: var(--tenue); }
.item .precio { font-size: 12px; color: #ffd24a; font-weight: 700; }
.item.caro { opacity: 0.5; }
.item { position: relative; }
.item .nv { grid-column: 2; position: relative; height: 14px; border-radius: 99px; background: rgba(255,255,255,0.06); overflow: hidden; display: none; }
.item.mejora .nv { display: block; }
.item .nv i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #a8400f, #ffd24a); }
.item .nv em { position: relative; font-style: normal; font-size: 10px; font-weight: 700; color: #fff1e2; padding-left: 6px; line-height: 14px; text-shadow: 0 0 3px #000, 0 0 2px #000; }
.item.mejora { border-color: #5a6478; }
.item.max { border-color: var(--oro); }
.item.max .precio { color: var(--oro2); }
.objetos div { position: relative; }
.objetos .nvobj { position: absolute; right: 2px; bottom: 1px; font-size: 10px; font-weight: 800; color: #ffd24a; text-shadow: 0 0 3px #000, 0 0 2px #000; line-height: 1; }
.tabla sub, table sub { font-size: 9px; color: #ffd24a; }

/* ---------- Marcador (Tab) ---------- */
.tabla { position: fixed; z-index: 14; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(760px, calc(100% - 32px)); background: rgba(10,13,18,0.96); border: 1px solid var(--borde); border-radius: 12px; padding: 14px; }
.tabla table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; color: var(--tenue); font-weight: 500; padding: 4px 6px; font-size: 12px; }
.tabla td { padding: 5px 6px; border-top: 1px solid #1f2328; }
.tabla .eq0 td:first-child { border-left: 3px solid var(--azul); }
.tabla .eq1 td:first-child { border-left: 3px solid var(--rojo); }
.tabla tr.yo td { background: rgba(255,159,67,0.1); }
.tabla h3 { margin: 10px 0 4px; font-family: var(--display); }

.cargando { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: #07090d; font-family: var(--display); font-size: 22px; color: var(--oro); letter-spacing: .1em; }

@media (max-width: 900px) {
  .heroes { grid-template-columns: repeat(2, 1fr); }
  .detalle { grid-template-columns: 1fr; }
  .detalle .lista-habs { grid-template-columns: 1fr; }
  .controles ul { columns: 1; }
  .mini canvas { width: 140px; height: 140px; }
  .lado { display: none; }
}

/* ---------- Celular (controles táctiles, horizontal) ---------- */
body.tactil { touch-action: none; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body.tactil .pantalla { touch-action: pan-y; }
#tactil { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#tactil > * { pointer-events: auto; }
#tactil button { touch-action: none; -webkit-user-select: none; user-select: none; }
body.tactil .panel, body.tactil .feed, body.tactil #btnCam, body.tactil #tooltip { display: none !important; }
body.tactil .mini { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); bottom: auto; padding: 4px; }
body.tactil .mini canvas { width: 118px; height: 118px; }
body.tactil .arriba { top: 4px; }
body.tactil .marcador { font-size: 16px; padding: 4px 12px; border-radius: 10px; }
body.tactil .aviso { bottom: auto; top: 58px; font-size: 13px; }
body.tactil .anuncio { font-size: 24px; top: 22%; }
body.tactil .canal { bottom: auto; top: 38%; }
body.tactil .muerte { top: 26%; }
body.tactil .muerte b { font-size: 30px; }
body.tactil .tienda { max-height: 88vh; padding: 12px 14px; top: 50%; transform: translate(-50%, -50%); }
body.tactil .items { grid-template-columns: repeat(4, 1fr); gap: 6px; }
body.tactil .item { padding: 7px; grid-template-columns: 26px 1fr; }
body.tactil .item .ic { font-size: 20px; }
body.tactil .item.mejora .nv { height: 12px; }
body.tactil .item small { display: none; }
body.tactil .tabla { max-height: 88vh; overflow: auto; padding: 10px; }
body.tactil .tabla table { font-size: 12px; }

.t-estado { position: absolute; top: max(8px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); display: flex; gap: 8px; align-items: center; background: var(--panel); border: 1px solid var(--borde); border-radius: 12px; padding: 6px 10px 6px 6px; }
.t-retrato { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--oro); display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 20px; color: #111; }
.t-nivel { position: absolute; right: -6px; bottom: -6px; width: 20px; height: 20px; border-radius: 50%; background: #10141c; color: var(--oro2); border: 1px solid var(--oro); display: grid; place-items: center; font: 700 10px Inter, sans-serif; }
.t-barras { width: 150px; display: flex; flex-direction: column; gap: 3px; }
.t-hp, .t-mana { position: relative; height: 12px; background: #1b1d20; border-radius: 4px; overflow: hidden; }
.t-mana { height: 6px; }
.t-hp i, .t-mana i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(180deg, #6cf083, #2fa548); }
.t-mana i { background: linear-gradient(180deg, #78a5ff, #3361d6); }
.t-hp span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 9px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.t-oro { font-size: 12px; color: #ffd24a; font-weight: 800; }
.t-botones { position: absolute; top: calc(max(8px, env(safe-area-inset-top)) + 64px); left: max(8px, env(safe-area-inset-left)); display: flex; gap: 6px; }
.t-botones button { width: 40px; height: 40px; border-radius: 10px; background: var(--panel); border: 1px solid var(--borde); font-size: 18px; }

.t-zona-joy { position: absolute; left: 0; bottom: 0; width: 42vw; height: 62vh; }
.t-joy { position: absolute; left: 110px; top: calc(100% - 110px); width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.08), rgba(255,255,255,0.03)); border: 2px solid rgba(255,159,67,0.35); opacity: 0.55; transition: opacity .15s; }
.t-joy.activo { opacity: 1; }
.t-palanca { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffd6a8, #e0611c); box-shadow: 0 4px 14px rgba(0,0,0,0.5); }

.t-acciones { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 250px; height: 200px; }
.t-atq { position: absolute; right: 0; bottom: 0; width: 88px; height: 88px; border-radius: 50%; font-size: 34px; color: #1a0b02; border: 2px solid #ffd6a8; background: radial-gradient(circle at 40% 35%, #ffd6a8, #e0611c); box-shadow: 0 6px 20px rgba(0,0,0,0.5); }
.t-atq:active { transform: scale(0.94); }
.t-hab { position: absolute; width: 62px; height: 62px; border-radius: 50%; border: 2px solid #5a6478; color: #fff; font-size: 9px; font-weight: 700; line-height: 1.05; text-shadow: 0 1px 2px #000; padding: 4px; overflow: visible; box-shadow: 0 4px 14px rgba(0,0,0,0.45); }
.t-hab .nom { display: block; pointer-events: none; }
.t-hab.apuntando { border-color: #8fd3ff; transform: scale(1.08); }
.t-hab.bloqueada { filter: grayscale(1) brightness(0.5); }
.t-hab.sinmana { box-shadow: inset 0 0 0 40px rgba(20,40,120,0.5); }
.t-hab .cd { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.65); display: none; place-items: center; font-style: normal; font-size: 18px; font-weight: 800; pointer-events: none; }
.t-hab .cd.on { display: grid; }
.t-hab .mas { position: absolute; top: -8px; right: -8px; width: 26px; height: 26px; border-radius: 50%; background: #ffb15c; color: #1a0b02; font-style: normal; font-size: 18px; font-weight: 900; display: none; place-items: center; border: 2px solid #10141c; }
.t-hab .mas.on { display: grid; }
.t-h0 { right: 104px; bottom: 0; }
.t-h1 { right: 96px; bottom: 80px; }
.t-h2 { right: 22px; bottom: 106px; }
.t-h3 { right: 176px; bottom: 52px; width: 66px; height: 66px; border-color: #ff9f43; }

.girar { display: none; position: fixed; inset: 0; z-index: 50; background: #07090d; place-items: center; text-align: center; color: var(--oro2); }
.girar span { display: block; font-size: 54px; margin-bottom: 10px; }
.girar b { font-family: var(--display); font-size: 24px; display: block; }
.girar p { color: var(--tenue); }
@media (orientation: portrait) { body.tactil.en-partida .girar { display: grid; } }

/* Selección en pantallas bajas (celular en horizontal). */
@media (max-height: 520px) {
  .pantalla { place-items: start center; padding: 10px 16px; }
  .sel-caja { gap: 10px; }
  .marca h1 { font-size: 40px; }
  .marca-sub { font-size: 10px; }
  .marca p { display: none; }
  .heroes { grid-template-columns: repeat(8, 1fr); gap: 5px; }
  .heroe { padding: 6px 3px; text-align: center; }
  .heroe .emblema { width: 30px; height: 30px; font-size: 14px; margin: 0 auto 3px; }
  .heroe b { font-size: 12px; }
  .heroe small, .heroe .rol { display: none; }
  .detalle { min-height: 0; padding: 8px 12px; grid-template-columns: 1fr; }
  .detalle h2 { font-size: 18px; margin: 0; }
  .detalle .lista-habs, .detalle p:last-child { display: none; }
  .detalle p { font-size: 13px; }
  .boton-grande { font-size: 15px; padding: 11px 22px; }
  .dificultad button { padding: 6px 10px; font-size: 13px; }
  .controles { display: none; }
}

/* Aviso de error visible (celulares sin consola). */
.falla { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 60; width: min(420px, calc(100% - 32px)); background: rgba(40, 8, 12, 0.96); border: 1px solid #ff6b6b; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; text-align: center; color: #ffd6d6; font-size: 13px; }
.falla b { color: #fff; font-size: 15px; }
.falla button { align-self: center; margin-top: 4px; background: #ff6b6b; color: #1a0406; border: none; border-radius: 8px; padding: 8px 18px; font-weight: 800; }

/* Objetos completos (100 % + 20 %): brillan en rojo. */
@keyframes brilloRojo { 0%, 100% { box-shadow: 0 0 4px #ff2a1a, inset 0 0 6px rgba(255,42,26,0.4); } 50% { box-shadow: 0 0 14px #ff2a1a, inset 0 0 12px rgba(255,42,26,0.7); } }
.objetos div.completo { animation: brilloRojo 1.2s ease-in-out infinite; }
.item.max { animation: brilloRojo 1.6s ease-in-out infinite; border-color: #ff2a1a; }
.tienda h2 .juego { font-family: system-ui, sans-serif; font-size: 12px; letter-spacing: 0.04em; color: var(--tenue); margin-left: 8px; text-transform: none; }

/* Pasivas de nivel 20, 30, 40 y 50. */
.stats .pasivas { display: inline-flex; gap: 3px; }
.pasivas i { font-style: normal; font-size: 13px; filter: grayscale(1) opacity(0.35); }
.pasivas i.si { filter: none; text-shadow: 0 0 6px rgba(255,200,90,0.8); }
.pasivas-sel { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; font-size: 12px; color: var(--tenue); }
.pasivas-sel b { color: var(--oro2); }

/* Caras de los héroes (retratos sacados de los modelos del juego). */
.emblema.cara { overflow: hidden; position: relative; }
.emblema.cara img { width: 118%; height: 118%; object-fit: cover; margin-top: 6%; display: block; }
.heroe .emblema.cara { width: 76px; height: 76px; }
#retrato img.cara { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 30%; pointer-events: none; }
@media (max-height: 520px) { .heroe .emblema.cara { width: 40px; height: 40px; } }

/* ---------- Activas de nivel 20, 30, 40 y 50 (D, F, G, H) ---------- */
.habs { align-items: flex-end; }
.sep-activas { width: 1px; align-self: stretch; margin: 4px 2px; background: linear-gradient(transparent, #5a6478, transparent); }
.activa { position: relative; width: 46px; height: 46px; border-radius: 10px; border: 1px solid var(--c); display: grid; place-items: center; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 55%, transparent), #12100c 78%); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 35%, transparent), inset 0 -6px 10px rgba(0,0,0,0.4); }
.activa .ico { font-size: 22px; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.8)); }
.activa .tk { position: absolute; top: 1px; left: 4px; font-size: 10px; font-weight: 800; color: var(--oro2); }
.activa .req { display: none; position: absolute; bottom: 1px; left: 0; right: 0; text-align: center; font-size: 9px; font-weight: 700; color: #d8d0bc; }
.activa .cd { position: absolute; inset: 0; border-radius: 9px; background: rgba(0,0,0,0.68); display: grid; place-items: center; font-size: 15px; font-weight: 800; color: #fff; }
.activa.bloqueada { filter: grayscale(1) brightness(0.5); box-shadow: none; }
.activa.bloqueada .req { display: block; }
.activa.bloqueada .ico { opacity: 0.5; }
.activa.recien { animation: activaNueva 1s ease-in-out infinite; }
@keyframes activaNueva { 0%, 100% { box-shadow: 0 0 6px var(--c); transform: translateY(0); } 50% { box-shadow: 0 0 22px var(--c), 0 0 4px #fff; transform: translateY(-4px); } }

/* Tarjeta que aparece al desbloquear una activa. */
.desbloqueo { position: absolute; top: 15%; left: 50%; width: min(520px, calc(100% - 32px)); transform: translateX(-50%); display: flex; gap: 18px; align-items: center; padding: 18px 22px 18px 18px;
  border-radius: 18px; border: 1px solid var(--c); overflow: hidden; pointer-events: none; z-index: 5;
  background: linear-gradient(120deg, rgba(14,12,9,0.94), color-mix(in srgb, var(--c) 22%, rgba(14,12,9,0.94)));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 0 40px color-mix(in srgb, var(--c) 45%, transparent), 0 20px 60px rgba(0,0,0,0.6); }
.desbloqueo.entra { animation: dzEntra .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.desbloqueo.sale { animation: dzSale .5s ease-in both; }
@keyframes dzEntra { 0% { opacity: 0; transform: translateX(-50%) scale(0.5); filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } 100% { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes dzSale { to { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(0.92); } }
.dz-icono { position: relative; flex: none; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-size: 44px;
  background: radial-gradient(circle at 40% 35%, color-mix(in srgb, var(--c) 70%, #fff 10%), #15110a 75%); border: 2px solid var(--c); box-shadow: 0 0 26px var(--c); }
.dz-icono::before { content: ''; position: absolute; inset: -10px; border-radius: 50%; background: conic-gradient(from 0deg, transparent, var(--c), transparent 35%, var(--c) 60%, transparent 75%); filter: blur(4px); opacity: .8; animation: dzGira 1.6s linear infinite; z-index: -1; }
.dz-icono span { animation: dzLate 1.1s ease-in-out infinite; }
@keyframes dzGira { to { transform: rotate(360deg); } }
@keyframes dzLate { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
.dz-texto { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dz-texto small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--c); font-weight: 800; animation: dzSube .5s .15s both; }
.dz-texto b { font-family: var(--display); font-size: 28px; color: #fff1e2; text-shadow: 0 0 18px var(--c); line-height: 1.05; animation: dzSube .5s .25s both; }
.dz-texto p { margin: 2px 0 0; font-size: 13px; color: #e6dcc6; line-height: 1.35; animation: dzSube .5s .35s both; }
.dz-texto em { font-style: normal; font-size: 12px; color: var(--tenue); margin-top: 4px; animation: dzSube .5s .45s both; }
.dz-texto kbd { display: inline-block; min-width: 22px; padding: 2px 7px; margin-left: 4px; border-radius: 6px; border: 1px solid var(--c); background: #0e0c08; color: #fff; font: 800 13px Inter, sans-serif; text-align: center; box-shadow: 0 2px 0 color-mix(in srgb, var(--c) 60%, #000); }
@keyframes dzSube { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.dz-brillo { position: absolute; top: 0; bottom: 0; width: 40%; left: -50%; background: linear-gradient(100deg, transparent, rgba(255,255,255,0.28), transparent); animation: dzBrillo 1.6s .4s ease-in-out 2; }
@keyframes dzBrillo { to { left: 120%; } }
.dz-rayos { position: absolute; left: -60px; top: 50%; width: 260px; height: 260px; margin-top: -130px; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--c) 25%, transparent) 0 6deg, transparent 6deg 18deg); border-radius: 50%; animation: dzGira 9s linear infinite; opacity: .5; }
body.tactil .desbloqueo { top: 36%; padding: 10px 14px 10px 10px; gap: 12px; width: min(440px, calc(100% - 32px)); }
body.tactil .dz-icono { width: 58px; height: 58px; font-size: 30px; }
body.tactil .dz-texto b { font-size: 20px; }
body.tactil .dz-texto p { font-size: 11px; }
body.tactil .dz-texto em { display: none; }

/* Activas en el celular: fila sobre los botones de habilidad. */
.t-activas { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: calc(max(14px, env(safe-area-inset-bottom)) + 212px); display: flex; gap: 8px; }
.t-act { position: relative; width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--c); display: grid; place-items: center; padding: 0;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--c) 60%, transparent), #12100c 78%); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 40%, transparent); }
.t-act span { font-size: 19px; line-height: 1; }
.t-act small { display: none; position: absolute; bottom: -2px; right: -4px; background: #10141c; border: 1px solid #5a6478; border-radius: 8px; padding: 0 4px; font-size: 9px; font-weight: 800; color: #d8d0bc; }
.t-act.bloqueada { filter: grayscale(1) brightness(0.5); box-shadow: none; }
.t-act.bloqueada small { display: block; }
.t-act .cd { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,0.65); display: none; place-items: center; font-style: normal; font-size: 14px; font-weight: 800; color: #fff; }
.t-act .cd.on { display: grid; }
.t-act:active { transform: scale(0.92); }
@media (max-height: 380px) { .t-activas { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 196px); } .t-act { width: 36px; height: 36px; } .t-act span { font-size: 16px; } }

/* ---------- Objetos: brillo del color de la mejora y diez segmentos verde → rojo ---------- */
.objetos div { overflow: hidden; border-color: var(--c, #2a3140); transition: border-color .3s, box-shadow .3s; }
.objetos div.lleno { background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 38%, transparent), rgba(10,9,7,0.85) 72%); box-shadow: inset 0 0 8px color-mix(in srgb, var(--c) 45%, transparent), 0 0 6px color-mix(in srgb, var(--c) 30%, transparent); }
.objetos .icobj { font-size: 18px; line-height: 1; transform: translateY(-3px); filter: drop-shadow(0 1px 2px rgba(0,0,0,0.9)); }
.objetos .nvobj { top: 1px; right: 3px; bottom: auto; font-size: 9px; color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000, 0 0 6px var(--c); }
.objetos .segs { position: absolute; left: 3px; right: 3px; bottom: 2px; display: flex; gap: 1px; height: 3px; }
.objetos .segs i { flex: 1; border-radius: 1px; background: rgba(255,255,255,0.12); }
.item .nv i { background: linear-gradient(90deg, #19f036, #90f010 18%, #d3ed0f 32%, #e8c40f 42%, #e48b0f 54%, #e05b0e 66%, #db360e 78%, #d30d0d); background-repeat: no-repeat; }
.item.mejora { border-color: var(--c); box-shadow: inset 3px 0 0 var(--c); }

.t-retrato { position: relative; }
.t-retrato .t-cara { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: 50% 30%; pointer-events: none; }
.t-retrato .t-nivel { z-index: 1; }
@media (max-width: 1180px) { .activa { width: 40px; height: 40px; } .activa .ico { font-size: 18px; } .hab { width: 54px; height: 54px; } }

/* Forja de fusión (en la tienda) */
.forja { margin-top: 16px; border-top: 1px solid #2a3140; padding-top: 12px; }
.forja h3 { margin: 0 0 2px; color: #ffcf4a; font-size: 16px; }
.forja-sel { display: flex; flex-wrap: wrap; gap: 8px; min-height: 20px; }
.forja-sel .vacio { color: var(--tenue); font-size: 13px; }
.forja-sel button { border: 1px solid #5a4a26; background: rgba(255,207,74,0.05); border-radius: 10px; padding: 7px 10px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: inherit; }
.forja-sel button.si { border-color: #ffcf4a; background: rgba(255,207,74,0.2); box-shadow: 0 0 12px rgba(255,190,60,0.35); }
.forja-sel button span { font-size: 18px; }
.forja-pie { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.forja-pie span { flex: 1; font-size: 13px; color: #ffd6a8; }
#btnFusionar { padding: 8px 16px; background: linear-gradient(180deg, #ffd76a, #b8862a); color: #1a0b02; border: none; font-weight: 800; }
#btnFusionar:disabled { opacity: 0.4; cursor: default; }
.objetos .fusion .icobj { font-size: 12px; letter-spacing: -2px; line-height: 1; word-break: break-all; display: flex; align-items: center; justify-content: center; text-align: center; }
.objetos .fusion { box-shadow: inset 0 0 0 2px #ffcf4a, 0 0 12px rgba(255,190,60,0.5); }
/* Menú del teletransportador */
.portal-menu { position: absolute; left: 50%; bottom: 230px; transform: translateX(-50%); z-index: 6; pointer-events: auto; min-width: 230px; max-width: 92vw; padding: 10px 12px 12px; border-radius: 12px; background: rgba(10,22,12,0.88); border: 1px solid #4f8a3a; box-shadow: 0 6px 24px rgba(0,0,0,.5); color: #e9ffe0; text-align: center; }
.portal-menu b { display: block; color: #9dff7a; font-size: 14px; letter-spacing: .02em; }
.portal-menu small { display: block; opacity: .75; font-size: 11px; margin: 2px 0 8px; }
.portal-menu .pm-lista { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.portal-menu button { font: 600 12px Inter, system-ui, sans-serif; color: #eaffdf; background: #1f3a1a; border: 1px solid #5c9a45; border-radius: 8px; padding: 7px 10px; cursor: pointer; }
.portal-menu button:hover, .portal-menu button.sel { background: #3d7a2c; border-color: #9dff7a; }
.portal-menu em { font-size: 12px; opacity: .85; }
.portal-menu::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 5px; height: 3px; border-radius: 2px; background: #9dff7a; transform-origin: left; transform: scaleX(var(--p, 0)); }
body.tactil .portal-menu { bottom: auto; top: 96px; }

/* Sonido: botón junto al minimapa y volumen en la pausa. */
.mini .btn-sonido { right: auto; left: 0; font-size: 13px; padding: 2px 8px; }
body.tactil .mini .btn-sonido { top: auto; bottom: -32px; font-size: 15px; padding: 3px 10px; }
.volumen { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; color: var(--tenue); font-size: 13px; }
.volumen input { flex: 1; accent-color: #ff9f43; }
.volumen .btn-sonido { background: var(--panel); border: 1px solid var(--borde); border-radius: 6px; padding: 3px 8px; font-size: 14px; }

/* ---------- Multijugador ---------- */
.multi { background: var(--panel); border: 1px solid var(--borde); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.multi-cab { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.multi-cab b { font-family: var(--display); color: var(--oro2); font-size: 18px; letter-spacing: 0.06em; display: block; }
.multi-cab small { color: var(--tenue); font-size: 13px; }
.multi-nombre { display: flex; align-items: center; gap: 8px; color: var(--tenue); font-size: 13px; }
.multi input { background: rgba(0,0,0,0.35); border: 1px solid var(--borde); border-radius: 8px; padding: 9px 12px; color: #eef1f6; font: inherit; min-width: 0; }
.multi input:focus { outline: none; border-color: var(--oro); }
.multi-nombre input { width: 150px; }
.multi-fila { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.multi-unir { display: flex; gap: 6px; }
.multi-unir input { width: 112px; text-transform: uppercase; letter-spacing: 0.2em; font-weight: 700; text-align: center; }
.multi-sala header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.multi-sala header b { font-family: var(--display); color: var(--oro2); font-size: 17px; margin-right: auto; }
.multi-cod { font-family: var(--display); font-weight: 800; letter-spacing: 0.3em; font-size: 22px; color: #fff; background: rgba(255,159,67,0.14); border: 1px solid var(--oro); border-radius: 8px; padding: 4px 12px 4px 16px; }
.multi-cod:empty { display: none; }
.multi-equipos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.multi-equipos h4 { margin: 0 0 6px; font-family: var(--display); letter-spacing: 0.08em; font-size: 14px; }
.mp-fila { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.04); border: 1px solid transparent; margin-bottom: 4px; min-height: 40px; font-size: 14px; }
.mp-fila.yo { border-color: var(--oro); background: rgba(255,159,67,0.09); }
.mp-fila.bot { color: var(--tenue); font-style: italic; background: rgba(255,255,255,0.015); }
.mp-fila img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #222; flex: none; }
.mp-fila small { color: var(--tenue); margin-left: auto; text-align: right; }
.multi-estado { margin: 10px 0 4px; color: #d3d8e2; font-size: 14px; }
.multi-acciones { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.multi-aviso { margin: 0; color: #ffcf8a; font-size: 14px; min-height: 0; }
.multi-aviso:empty { display: none; }
body.en-sala #mpOpciones, body.en-sala #jugar, body.en-sala #dificultad { display: none; }
body.en-sala .multi { border-color: var(--oro); box-shadow: 0 0 0 1px rgba(255,159,67,0.35), 0 16px 50px rgba(0,0,0,0.35); }
.nota-red { color: #ffcf8a; font-size: 13px; margin: 0; }
@media (max-width: 640px) {
  .multi-equipos { grid-template-columns: 1fr; }
  .multi-nombre input { width: 120px; }
}
