* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; background: #0d0d14; color: #f0eef5;
  font-family: "Barlow Semi Condensed", "Segoe UI", sans-serif; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font-family: inherit; cursor: pointer; }

.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center;
  justify-content: center; padding: calc(16px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right))
    calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: radial-gradient(ellipse at 50% 20%, #232338 0%, #101018 55%, #0a0a10 100%); }
.screen.active { display: flex; }

h1 { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 800;
  font-size: 74px; line-height: .88; letter-spacing: 10px; margin-left: 10px; /* compensa el tracking */
  background: linear-gradient(180deg, #ff6a56 0%, #e03424 48%, #a01717 82%, #7c0f0f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #000) drop-shadow(0 5px 10px rgba(0,0,0,.65)) drop-shadow(0 0 26px rgba(255,60,40,.28));
  text-align: center; }
h2 { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 700;
  letter-spacing: 3px; text-transform: uppercase; margin-bottom: 10px;
  color: #d8b25a; text-shadow: 0 2px 0 #000, 0 4px 10px rgba(0,0,0,.6); }
@keyframes sway { 0%,100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.04); } }

/* --- MENU PRINCIPAL (rediseño) --- */
.title-content { display: flex; flex-direction: column; align-items: center; gap: 0;
  max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 8px 0 40px; }
.title-emblem { position: relative; width: 86px; height: 86px; margin-bottom: 14px;
  animation: sway 3.2s ease-in-out infinite; }
.title-emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 3px solid #d8b25a; box-shadow: 0 0 0 3px #0a0a10, 0 0 26px rgba(216,178,90,.45), 0 8px 18px rgba(0,0,0,.7);
  filter: saturate(1.05) contrast(1.05); }
.emblem-ring { position: absolute; inset: -9px; border-radius: 50%; pointer-events: none;
  border: 1.5px dashed rgba(216,178,90,.45); animation: spin 36s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.emblem-tag { position: absolute; right: -10px; bottom: -4px; background: linear-gradient(180deg,#e8433a,#a02015);
  color: #fff; font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 11px;
  letter-spacing: 1.5px; padding: 2px 8px 1px;
  border: 1.5px solid #000; border-radius: 6px; box-shadow: 0 2px 0 #000; transform: rotate(4deg); }
.kupele-logo { width: 54px; margin: 10px 0 0; opacity: .92;
  filter: drop-shadow(0 0 8px rgba(120,255,130,.35)) drop-shadow(0 3px 5px rgba(0,0,0,.7));
  animation: sway 4.5s ease-in-out infinite; }
.tagline { display: block; text-align: center; color: #b9b4a8; max-width: 340px;
  margin: 12px 0 26px; font-weight: 500; font-size: 12.5px; letter-spacing: 2.8px; text-transform: uppercase;
  text-shadow: 0 1px 0 #000, 0 2px 6px rgba(0,0,0,.7); line-height: 2; }
.tagline span:last-of-type { display: block; }
.tagline i { color: #d8b25a; font-style: normal; padding: 0 2px; }
.foot { position: absolute; bottom: 12px; font-weight: 500; font-size: 10.5px; color: #6f6e80;
  letter-spacing: 1.8px; text-transform: uppercase; text-shadow: 0 1px 0 #000; }

.menu { display: flex; flex-direction: column; gap: 10px; width: min(340px, 92vw); }
.menu-split { display: flex; gap: 10px; }
.menu-split .big { flex: 1; }
button.big { position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 19px; font-weight: 700; letter-spacing: 2.6px; text-transform: uppercase;
  border: 1px solid rgba(0,0,0,.85); border-radius: 10px;
  background: linear-gradient(180deg, #2e2e40 0%, #1c1c29 100%); color: #f4f2fa;
  box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255,255,255,.10), inset 0 -8px 14px rgba(0,0,0,.28);
  text-shadow: 0 1px 0 #000; text-align: left; overflow: hidden; }
button.big::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: linear-gradient(180deg, #5a5a72, #3c3c4e); }
button.big .m-ico { display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; font-size: 17px; border-radius: 8px;
  background: rgba(0,0,0,.42); border: 1px solid rgba(255,255,255,.12);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
button.big .m-txt { flex: 1; padding-top: 2px; }
button.big .m-arrow { font-size: 24px; font-weight: 400; color: rgba(255,255,255,.4); margin-top: -2px; }
button.big:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
button.big.primary { background: linear-gradient(180deg, #f04a38 0%, #c1271a 55%, #9c1d13 100%);
  box-shadow: 0 3px 0 #000, inset 0 1px 0 rgba(255,255,255,.28), inset 0 -10px 16px rgba(0,0,0,.22),
    0 0 24px rgba(232,67,58,.32); }
button.big.primary::before { background: linear-gradient(180deg, #ffd23e, #e8a920); }
button.big.primary .m-ico { background: rgba(0,0,0,.30); border-color: rgba(255,255,255,.22); }
button.big.primary .m-arrow { color: rgba(255,255,255,.8); }
button.big.daily::before { background: linear-gradient(180deg, #e3bd63, #b98f3a); }
button.big.continue::before { background: linear-gradient(180deg, #93c25c, #6a9440); }
button.big.ghost { background: linear-gradient(180deg, rgba(34,34,48,.85) 0%, rgba(22,22,32,.85) 100%);
  border-color: rgba(255,255,255,.14); font-size: 14px; letter-spacing: 1.6px;
  padding: 10px 12px; gap: 8px; white-space: nowrap; box-shadow: 0 3px 0 rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.07); }
button.big.ghost .m-ico { width: 28px; height: 28px; font-size: 14px; }
button.big:disabled { background: #26262e; color: #7a7a86; box-shadow: 0 3px 0 #000; }
button.big:disabled::before { background: #38383f; }

.rules-body { max-width: 480px; max-height: 62vh; overflow-y: auto; overscroll-behavior: contain; margin-bottom: 16px;
  background: rgba(255,255,255,.04); border: 2px solid #2c2c40; border-radius: 14px; padding: 14px; }
.rules-body p { margin: 10px 0; line-height: 1.45; font-size: 15px; }
.rules-body b { color: #d8b25a; }

#squad-grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: calc((min(560px, 96vw) - 22px) * 0.33); gap: 10px; overflow-y: auto; overscroll-behavior: contain; width: min(560px, 96vw); padding: 6px; }
.card { position: relative; border-radius: 14px; overflow: hidden; border: 3px solid #2e2e42;
  box-shadow: 0 3px 10px rgba(0,0,0,.5); transition: transform .08s; }
.card svg { display: block; width: 100%; height: 100%; }
.card.locked > div { height: 100%; }
.card:active { transform: scale(.97); }
.card.sel { border-color: #d8b25a; box-shadow: 0 0 18px rgba(216,178,90,.4); }
.card .pick { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%;
  background: #d8b25a; color: #111; font-weight: bold; display: none; align-items: center; justify-content: center;
  border: 2px solid #111; box-shadow: 0 0 8px rgba(216,178,90,.7); }
.card.sel .pick { display: flex; }
.hint { color: #a49fb8; font-size: 13px; margin-bottom: 8px; }
.row { display: flex; gap: 10px; margin-top: 10px; }
#squad-count { color: #d8b25a; font-size: 16px; }

/* PARTIDA */
#screen-game { padding: 0; justify-content: flex-start; }
#screen-game #topbar { padding-top: calc(8px + env(safe-area-inset-top)); }
#topbar { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 8px 10px; background: linear-gradient(180deg, #22223a 0%, #191926 100%);
  border-bottom: 2px solid #000; font-size: 13px; font-weight: bold; }
#hud-mode { color: #d8b25a; flex: 1; text-align: center; text-shadow: 1px 1px 0 #000; }
#board-wrap { position: relative; flex: 1; width: 100%; overflow: hidden; }
#board { width: 100%; height: 100%; display: block; touch-action: none; }
#weather { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
#btn-tools { width: 30px; height: 30px; border-radius: 9px; border: 2px solid #000; font-size: 14px;
  background: linear-gradient(180deg, #34344a 0%, #262636 100%); color: #fff; flex-shrink: 0; }
#board-tools { display: flex; flex-direction: row; justify-content: flex-end; gap: 6px; width: 100%;
  padding: 6px; background: linear-gradient(180deg, #1c1c2c 0%, #16161f 100%); border-bottom: 2px solid #000; }
#board-tools.folded { display: none; }
#board-tools button { width: 38px; height: 38px; border-radius: 12px; border: 2px solid #000;
  background: rgba(32,32,50,.88); color: #fff; font-size: 19px; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
#log { position: absolute; left: 8px; right: 60px; bottom: 8px; max-height: 40%; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(12,12,20,.93); border: 2px solid #000; border-radius: 12px; padding: 8px;
  font-size: 12px; display: none; }
#log.open { display: block; }
#log div { margin: 2px 0; color: #cfcadb; }
#toast { position: absolute; left: 50%; top: 12px; transform: translateX(-50%);
  background: linear-gradient(180deg, #e8433a 0%, #b02718 100%);
  border: 2px solid #000; color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: bold;
  font-size: 14px; max-width: 90%; text-align: center; opacity: 0; pointer-events: none; transition: opacity .25s;
  box-shadow: 0 4px 14px rgba(0,0,0,.6); text-shadow: 1px 1px 0 #000; }
#toast.show { opacity: 1; }
#chips { width: 100%; display: flex; gap: 6px; padding: 6px; overflow-x: auto;
  background: linear-gradient(180deg, #1a1a28 0%, #14141e 100%); }
.chip { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border: 2px solid #33334a;
  border-radius: 14px; background: #20202f; flex-shrink: 0; }
.chip.sel { border-color: #fff; background: #2c2c42; box-shadow: 0 0 10px rgba(255,255,255,.25); }
.chip.dead { opacity: .4; }
.chip-info { display: flex; flex-direction: column; font-size: 11px; line-height: 1.25; }
.chip-info .hp { color: #3ddc74; } .chip-info .ap { color: #d8b25a; } .chip-info .kl { color: #ff4d4d; }
.chip-info .gear { font-size: 11px; letter-spacing: 1.5px; min-height: 13px; color: #cfcfe0; }
.chip-info .gear i { font-style: normal; font-size: 8px; color: #d8b25a; vertical-align: super; }
#actions { width: 100%; display: flex; gap: 6px; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); overflow-x: auto;
  background: #12121c; border-top: 2px solid #000; }
#actions button { flex-shrink: 0; padding: 12px 14px; font-size: 14px; font-weight: bold; border-radius: 12px;
  border: 2px solid #000; background: linear-gradient(180deg, #34344a 0%, #282838 100%); color: #fff; }
#actions button.active { background: linear-gradient(180deg, #e8433a 0%, #b02718 100%); box-shadow: 0 0 12px rgba(232,67,58,.5); }
#actions button:disabled { opacity: .35; }

#end-stats { max-width: 420px; margin: 10px 0 24px; }
.end-row { margin: 6px 0; font-size: 15px; }

#card-overlay { position: fixed; inset: 0; background: rgba(5,5,10,.88); display: none; align-items: center; justify-content: center; z-index: 50; }
#card-overlay.show { display: flex; }

/* ventana de hallazgo */
#found-pop { position: fixed; top: 62px; left: 50%; transform: translateX(-50%) scale(.85); z-index: 95; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
#found-pop.show { opacity: 1; transform: translateX(-50%) scale(1); pointer-events: auto; }
.found-box { display: flex; gap: 12px; align-items: center; width: min(430px, 92vw); background: rgba(16,16,26,.96); border: 2px solid #d8b25a; border-radius: 14px; padding: 10px 16px 10px 12px; box-shadow: 0 10px 34px rgba(0,0,0,.75); }
.found-tx { flex: 1; min-width: 0; }
.found-box.trap { border-color: #e8433a; }
.found-box.nada { border-color: #55556a; }
.found-ic { font-size: 46px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(0,0,0,.6)); }
.found-tx b { display: block; font-size: 15px; color: #fff; }
.found-tx span { display: block; font-size: 12px; color: #d8b25a; }
.found-tx em { display: block; font-style: normal; font-size: 12px; color: #aaaac0; margin-top: 2px; }
.found-x { flex: none; align-self: flex-start; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; width: 30px; height: 30px; font-size: 15px; line-height: 1; cursor: pointer; }

/* briefing de mision al empezar la partida */
#mission-pop { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(4,4,8,.55); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
#mission-pop.show { opacity: 1; pointer-events: auto; }
.mission-box { position: relative; width: min(420px, 90vw); background: rgba(16,16,26,.97); border: 2px solid #d8b25a; border-radius: 14px; padding: 18px 20px 20px; box-shadow: 0 12px 40px rgba(0,0,0,.8); text-align: center; }
.mission-h { font-size: 17px; font-weight: 700; letter-spacing: 1px; color: #d8b25a; margin-bottom: 8px; }
.mission-d { font-size: 14px; line-height: 1.45; color: #e8e8f0; }
.mission-x { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 8px; width: 30px; height: 30px; font-size: 15px; line-height: 1; cursor: pointer; }
.mission-x:active { background: rgba(255,255,255,.2); }

/* confirmacion de salida */
#exit-pop { position: fixed; inset: 0; z-index: 65; display: flex; align-items: center; justify-content: center; background: rgba(4,4,8,.6); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
#exit-pop.show { opacity: 1; pointer-events: auto; }
.exit-btns { display: flex; gap: 10px; justify-content: center; margin-top: 14px; }
.exit-btns button { border-radius: 10px; padding: 10px 18px; font-size: 15px; font-weight: 700; cursor: pointer; border: 1px solid rgba(255,255,255,.2); }
.exit-yes { background: #a83226; color: #fff; }
.exit-no { background: rgba(255,255,255,.1); color: #fff; }
.found-x:active { background: rgba(255,255,255,.2); }

/* inventario */
#inv-overlay { position: fixed; inset: 0; background: rgba(5,5,10,.88); display: none; align-items: center; justify-content: center; z-index: 50; }
#inv-overlay.show { display: flex; }
.inv-box { width: min(520px, 94vw); max-height: 88vh; overflow-y: auto; background: #171722; border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 14px 14px 16px; }
.inv-box h3 { margin: 2px 0 10px; font-size: 20px; letter-spacing: 3px; color: #d8b25a; text-align: center; text-shadow: 2px 2px 0 #000; }
.inv-row { padding: 8px; border-radius: 10px; background: rgba(255,255,255,.03); border: 1px solid rgba(255,255,255,.06); margin-bottom: 8px; }
.inv-row.dead { opacity: .4; }
.inv-head { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.inv-head b { font-size: 14px; }
.inv-head span { display: block; font-size: 11px; color: #9a9ab0; }
.inv-weapon, .inv-item { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 8px; }
.inv-weapon { background: rgba(216,178,90,.07); border: 1px solid rgba(216,178,90,.18); margin: 2px 0; }
.inv-ic { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.inv-tx b { font-size: 13px; }
.inv-tx span { display: block; font-size: 11px; color: #aaaac0; line-height: 1.3; }
.inv-empty { font-size: 12px; color: #8888a0; font-style: italic; padding: 2px 6px; }
.inv-box button.big { width: 100%; margin-top: 6px; padding: 12px; font-size: 15px; font-weight: bold; border-radius: 10px; border: 2px solid #000; background: linear-gradient(180deg, #34344a 0%, #282838 100%); color: #fff; }
.card-big { width: min(480px, 94vw); max-height: 92vh; overflow-y: auto; }
.card-big svg { filter: drop-shadow(0 10px 30px rgba(0,0,0,.8)); }
.card-big svg { width: 100%; height: auto; }
.card-big .perks { font-size: 13px; line-height: 1.7; margin: 10px 4px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.09); border-radius: 10px; padding: 10px 12px; }

/* evolucion cinematografica */
#evo-overlay { position: fixed; inset: 0; background: rgba(3,3,8,.92); display: none; align-items: center; justify-content: center; z-index: 100; }
#evo-overlay.show { display: flex; }
.evo-box { position: relative; width: min(440px, 92vw); text-align: center; padding: 18px 10px; }
.evo-box h2 { font-size: 34px; letter-spacing: 4px; color: #d8b25a; text-shadow: 0 0 24px rgba(216,178,90,.8), 2px 2px 0 #000; margin: 0 0 10px; animation: evoPulse 1.2s ease-in-out infinite; }
.evo-card { width: 100%; animation: evoIn .45s ease-out; }
.evo-perk { font-size: 14px; line-height: 1.6; background: rgba(216,178,90,.08); border: 1px solid rgba(216,178,90,.3); border-radius: 10px; padding: 10px; margin: 12px 4px; }
.evo-flash { position: absolute; inset: -40px; background: radial-gradient(circle, rgba(216,178,90,.22), transparent 65%); pointer-events: none; animation: evoPulse 1.2s ease-in-out infinite; }
@keyframes evoIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes evoPulse { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }

/* barrido de turno */
#turn-sweep { position: fixed; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(2,2,8,.85) 50%, transparent 70%); transform: translateX(-100%); pointer-events: none; z-index: 40; }
#turn-sweep.go { animation: sweepGo .55s ease-in-out; }
@keyframes sweepGo { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* fin de partida cinematografico */
#screen-end { background: radial-gradient(ellipse at 50% 30%, #16121c, #050508 75%); }
#screen-end.end-win { background: radial-gradient(ellipse at 50% 30%, #12200f, #050508 75%); }
#screen-end.end-lose { background: radial-gradient(ellipse at 50% 30%, #230d0d, #050508 75%); }
#screen-end h2 { font-size: 34px; letter-spacing: 3px; text-shadow: 0 0 26px rgba(255,60,40,.55), 2px 2px 0 #000; animation: evoIn .5s ease-out; }
#screen-end.end-win h2 { color: #6fdc8c; text-shadow: 0 0 26px rgba(80,220,120,.5), 2px 2px 0 #000; }
#screen-end.end-lose h2 { color: #ff5546; }
.end-mode { color: #9a9ab0; font-size: 13px; letter-spacing: 1px; }
.end-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(400px, 90vw); margin: 10px 0 16px; }
.end-row { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 10px; padding: 6px 8px; }
.end-row.dead { opacity: .45; filter: grayscale(.8); }
.end-row b { font-size: 12px; display: block; }
.end-row span { font-size: 11px; color: #b0b0c8; }

/* titulo ambiental: niebla y zombis a la deriva */
#screen-title { overflow: hidden; }
.title-rain { position: absolute; inset: -60% 0; pointer-events: none; z-index: 0; opacity: .5;
  background:
    repeating-linear-gradient(105deg, transparent 0 46px, rgba(190,205,225,.13) 46px 47.5px, transparent 47.5px 90px),
    repeating-linear-gradient(100deg, transparent 0 70px, rgba(190,205,225,.08) 70px 72px, transparent 72px 130px);
  background-size: 200% 200%;
  animation: rainFall 1.1s linear infinite; }
@keyframes rainFall { from { background-position: 0 -30%, 0 -30%; } to { background-position: -6% 30%, -4% 30%; } }
.title-mist { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.title-mist::before, .title-mist::after {
  content: ""; position: absolute; width: 160%; height: 60%; left: -30%;
  background: radial-gradient(ellipse at center, rgba(130,140,150,.16), transparent 70%);
  filter: blur(6px);
}
.title-mist::before { top: 8%; animation: mistA 26s ease-in-out infinite alternate; }
.title-mist::after { bottom: 4%; animation: mistB 34s ease-in-out infinite alternate; }
@keyframes mistA { from { transform: translateX(-6%); opacity: .7; } to { transform: translateX(6%); opacity: 1; } }
@keyframes mistB { from { transform: translateX(5%); opacity: 1; } to { transform: translateX(-5%); opacity: .6; } }
.title-walker { position: absolute; top: 20%; opacity: 0; animation: walkerDrift 46s linear infinite; filter: brightness(0) blur(.4px) drop-shadow(0 0 5px rgba(190,60,50,.4)); }
.title-walker svg { display: block; }
@keyframes walkerDrift {
  0%   { left: -12%; opacity: 0; }
  8%   { opacity: .55; }
  50%  { opacity: .4; }
  92%  { opacity: .55; }
  100% { left: 108%; opacity: 0; }
}

.screen.bg-art { background-size: cover; background-position: center 25%; }
#screen-title > *:not(.title-mist):not(.title-rain) { position: relative; z-index: 1; }

#diff-row { display: flex; gap: 8px; margin: 10px 0 4px; }
#diff-row button { flex: 1; padding: 10px 4px; font-size: 13px; font-weight: bold; border-radius: 12px;
  border: 2px solid #2c2c40; background: #1c1c2c; color: #a49fb8; }
#diff-row button.on { border-color: #d8b25a; color: #ffd23e; background: #2a2416;
  box-shadow: 0 0 10px rgba(216,178,90,.3); }

/* escritorio: controles comodos para raton */
@media (min-width: 900px) {
  /* en desktop el iframe queda bajo la cabecera de la pagina envolvente;
     reservamos espacio abajo para que la barra de acciones quede visible sin scroll */
  #screen-game { bottom: 100px; }
  #board-tools button { width: 46px; height: 46px; font-size: 18px; }
  #actions button { min-height: 46px; font-size: 15px; padding: 8px 14px; }
  #chips .chip { min-width: 92px; }
  #board { cursor: crosshair; }
}

/* Manual */
.rules-body h3 { color: #d8b25a; font-size: 16px; margin: 18px 0 4px; text-shadow: 1px 1px 0 #000;
  border-bottom: 1px solid #3a3a52; padding-bottom: 3px; }
.rules-body h3:first-child { margin-top: 4px; }
table.zt { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 14px; }
table.zt td { padding: 5px 6px; border-bottom: 1px solid #2c2c40; vertical-align: top; line-height: 1.35; }
table.zt td:first-child { white-space: nowrap; font-weight: bold; color: #d8b25a; }

/* --- medidor de ruido en el HUD --- */
#hud-noise { font-weight: 700; text-shadow: 1px 1px 0 #000; white-space: nowrap; }
#hud-noise.nz-0 { color: #9fd6a8; }
#hud-noise.nz-1 { color: #ffd76a; }
#hud-noise.nz-2 { color: #ff9d4d; }
#hud-noise.nz-3 { color: #ff5f5f; animation: nzblink 0.8s infinite; }
@keyframes nzblink { 50% { opacity: .45; } }

/* --- barra de info de la casilla marcada por el puntero --- */
#cell-info {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%);
  max-width: 94%; padding: 6px 8px 6px 12px; border-radius: 12px;
  background: rgba(10, 14, 20, .9); border: 1px solid rgba(140, 230, 255, .45);
  color: #dff2ff; font-size: 13px; line-height: 1.25;
  display: flex; align-items: center; gap: 8px;
  opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 6;
}
#cell-info.show { opacity: 1; pointer-events: auto; }
#cell-info .ci-desc { flex: 1; text-align: left; }
#cell-info .ci-hint { display: block; font-size: 11px; color: #8fc7dd; }
#cell-info .ci-btns { display: flex; gap: 6px; flex: none; }
#cell-info .ci-btns button { width: 34px; height: 34px; border-radius: 10px; font-size: 17px; font-weight: bold;
  border: 2px solid #000; color: #fff; background: linear-gradient(180deg,#3f5d46,#2a4030);
  box-shadow: 0 2px 0 #000; }
#cell-info .ci-btns button#ci-x { background: linear-gradient(180deg,#4a4a5e,#33333f); font-size: 14px; }
#cell-info .ci-btns button:active { transform: translateY(2px); box-shadow: none; }

/* --- bestiario --- */
#best-overlay {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(4, 6, 10, .82); backdrop-filter: blur(3px);
  align-items: center; justify-content: center;
}
#best-overlay.show { display: flex; }
.best-box {
  width: min(430px, 94vw); max-height: 88vh; overflow-y: auto;
  background: #131a14; border: 2px solid #8fae4b; border-radius: 14px;
  padding: 14px; text-align: center;
}
.best-box h2 { margin: 2px 0 10px; color: #d8b25a; }
.best-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.best-row {
  display: flex; gap: 10px; align-items: center; text-align: left;
  background: rgba(255, 255, 255, .04); border-radius: 10px; padding: 8px;
}
.best-row img, .best-row .best-emoji {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  object-fit: cover; border: 2px solid #111; font-size: 34px; line-height: 54px; text-align: center;
}
.best-row b { display: block; font-size: 15px; }
.best-row .best-stats { display: block; font-size: 12px; color: #ffd76a; }
.best-row p { margin: 2px 0 0; font-size: 12px; color: #b9c7b2; }

/* --- ilustraciones del bestiario en el manual --- */
.zico { display: inline-block; width: 40px; height: 40px; vertical-align: middle; margin-right: 6px; font-size: 26px; line-height: 40px; text-align: center; }
.zico img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid #111; vertical-align: middle; }
.rules-note { font-size: 13px; color: #9fb79a; }
.story{margin:2px 0 6px;font-size:12.5px;line-height:1.45;color:#cfd6c2;font-style:italic;max-height:96px;overflow-y:auto}
.btn-ficha{position:absolute;bottom:4px;right:4px;z-index:3;background:rgba(10,12,10,.85);color:#e8e2c8;border:1px solid #8a8256;border-radius:6px;font-size:10px;font-weight:700;padding:3px 6px;letter-spacing:.4px}
#screen-squad { justify-content: flex-start; }
#screen-squad #squad-grid { flex: 1; min-height: 0; align-content: start; }
/* ---------- colección ---------- */
#screen-collec { justify-content: flex-start; }
#collec-body { flex: 1; min-height: 0; overflow-y: auto; width: min(560px, 96vw); padding: 4px; }
.collec-wild { font-size: 12px; color: #d8cf9a; margin: 2px 0 8px; text-align: center; }
.collec-block { font-size: 15px; margin: 12px 0 6px; color: #e8c96a; letter-spacing: 1px; }
.collec-block span { font-size: 11px; color: #9a9578; letter-spacing: 0; }
.collec-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.collec-card { background: rgba(20,22,26,.88); border: 2px solid #3a3a48; border-radius: 10px; padding: 8px; cursor: pointer; }
.collec-card.done { border-color: #d8b25a; box-shadow: 0 0 12px rgba(216,178,90,.35); }
.collec-card.soon { opacity: .55; }
.cc-head { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-head b { font-size: 12px; }
.cc-head i { font-size: 10px; color: #aaa; margin-left: 5px; }
.cc-pieces { display: grid; gap: 3px; margin: 6px 0; aspect-ratio: 3/4; grid-auto-rows: 1fr; }
.cc-p { background: #17181d; border: 1px dashed #3a3a48; border-radius: 4px; min-height: 0; text-align: center; font-size: 10px; background-repeat: no-repeat; }
.cc-p.on { background: #3a4d2e; border: 1px solid #7a9a4a; }
.cc-p.img { background-color: #0c0d11; }
.cc-p.img.on { border-style: solid; }
.cc-pieces.full { gap: 0; }
.cc-pieces.full .cc-p { border: none; border-radius: 0; min-height: 0; filter: none !important; }
.cc-pieces.full .cc-p:first-child { border-radius: 6px 0 0 0; }
.cc-pieces.full .cc-p:last-child { border-radius: 0 0 6px 0; }
.cd-full { aspect-ratio: 3/4; border-radius: 10px; background-size: cover; background-position: center; margin: 8px 0 12px; border: 2px solid #d8b25a; box-shadow: 0 0 16px rgba(216,178,90,.4); }
.cc-foot { font-size: 10px; color: #c8c2a0; text-align: right; }
.cc-ficha { display: block; width: 100%; margin-top: 5px; padding: 5px 0; font-size: 11px; font-weight: 700; color: #e8c96a; background: rgba(232,201,106,.08); border: 1px solid #8a8256; border-radius: 7px; cursor: pointer; }
.cc-ficha:active { background: rgba(232,201,106,.22); }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.75); display: none; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.overlay.show { display: flex; }
.collec-detail { background: #14161c; border: 2px solid #8a8256; border-radius: 14px; padding: 16px; width: min(360px, 92vw); text-align: center; max-height: 90vh; overflow-y: auto; }
.collec-detail h3 { margin: 0 0 10px; color: #e8c96a; }
.collec-detail h3 i { font-size: 12px; color: #aaa; display: block; }
.cd-card { display: grid; gap: 4px; margin: 8px 0 12px; aspect-ratio: 3/4; grid-auto-rows: 1fr; }
.cd-p { min-height: 0; background: #101116; border: 1px dashed #3a3a48; border-radius: 6px; background-repeat: no-repeat; }
.cd-p.on { border: 1px solid #7a9a4a; border-style: solid; }
.end-pieces { margin-top: 10px; border-top: 1px solid #3a3a48; padding-top: 8px; }
.end-pieces h3 { margin: 0 0 4px; font-size: 14px; color: #e8c96a; }
.end-pieces p { margin: 0; font-size: 12px; }

/* PANEL DE DADOS (rojos con puntos blancos, giro animado) */
.dice-overlay { position: fixed; inset: 0; z-index: 75; display: flex; align-items: center; justify-content: center; background: rgba(5,5,10,.45); animation: dice-fadein .18s ease-out; }
.dice-overlay.out { opacity: 0; transition: opacity .25s; pointer-events: none; }
@keyframes dice-fadein { from { opacity: 0; } to { opacity: 1; } }
.dice-box { background: rgba(16,14,20,.96); border: 2px solid #d8b25a; border-radius: 16px; padding: 14px 18px 12px; text-align: center; box-shadow: 0 8px 40px rgba(0,0,0,.7); max-width: 92vw; }
.dice-title { font-size: 13px; font-weight: 800; letter-spacing: .5px; color: #e8c96a; margin-bottom: 10px; }
.dice-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.die { width: 54px; height: 54px; border-radius: 10px; background: linear-gradient(145deg, #d43a2a 0%, #a01e12 55%, #6d1008 100%);
  box-shadow: inset 0 2px 3px rgba(255,255,255,.35), inset 0 -3px 5px rgba(0,0,0,.45), 0 4px 8px rgba(0,0,0,.6);
  display: grid; grid-template: repeat(3,1fr) / repeat(3,1fr); padding: 7px; box-sizing: border-box;
  animation: die-tumble .8s cubic-bezier(.25,.6,.3,1) both; }
.die .pip { width: 76%; aspect-ratio: 1; border-radius: 50%; background: #fff; place-self: center; opacity: 0;
  box-shadow: inset 0 -1px 2px rgba(0,0,0,.4); }
.die .pip.on { opacity: 1; }
@keyframes die-tumble {
  0%   { transform: translateY(-46px) rotate(0deg) scale(.6); opacity: 0; }
  25%  { opacity: 1; }
  55%  { transform: translateY(6px) rotate(480deg) scale(1.08); }
  75%  { transform: translateY(-8px) rotate(640deg) scale(.98); }
  100% { transform: translateY(0) rotate(720deg) scale(1); }
}
.die.hit { box-shadow: inset 0 2px 3px rgba(255,255,255,.35), inset 0 -3px 5px rgba(0,0,0,.45), 0 0 16px rgba(255,210,62,.85), 0 4px 8px rgba(0,0,0,.6); }
.die.miss { filter: brightness(.55) saturate(.7); }
.dice-result { font-size: 15px; font-weight: 800; color: #fff; min-height: 20px; opacity: 0; transform: scale(.7); transition: all .22s ease-out; }
.dice-result.show { opacity: 1; transform: scale(1); }
.dice-result .hits { color: #ffd23e; }
.dice-result .fail { color: #ff7a6b; }

/* r53: banner de racha de bajas */
#streak-banner{position:fixed;top:24%;left:50%;transform:translate(-50%,-50%) scale(.4);z-index:950;pointer-events:none;font-family:inherit;font-weight:900;font-size:30px;letter-spacing:1px;color:#ffd23e;text-shadow:0 0 18px rgba(255,60,30,.9),0 2px 6px #000;opacity:0;white-space:nowrap}
#streak-banner.pop{animation:streakpop 1.45s cubic-bezier(.2,1.4,.4,1) forwards}
@keyframes streakpop{0%{opacity:0;transform:translate(-50%,-50%) scale(.35) rotate(-6deg)}14%{opacity:1;transform:translate(-50%,-50%) scale(1.18) rotate(2deg)}28%{transform:translate(-50%,-50%) scale(1) rotate(0)}78%{opacity:1}100%{opacity:0;transform:translate(-50%,-62%) scale(1.04)}}

/* ===== ZONA MUERTA 3D (beta) ===== */
#zm3d{position:fixed;inset:0;background:#070a14;overflow:hidden;font-family:inherit}
#z3-wrap{position:absolute;inset:0}
#z3-wrap canvas{display:block}
#z3-wrap::after{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(ellipse at 50% 42%, transparent 50%, rgba(2,3,8,.52) 100%)}
#z3-hud{position:absolute;top:0;left:0;right:0;display:flex;align-items:center;gap:8px;padding:8px 10px;background:linear-gradient(180deg,rgba(5,8,16,.92),rgba(5,8,16,.55) 80%,transparent);color:#e8e4da;font-size:13px;z-index:20}
#z3-turn{font-weight:800}
#z3-mode{color:#ffd23e;font-weight:700;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#z3-hud button{background:rgba(20,26,40,.8);border:1px solid rgba(255,255,255,.14);color:#fff;border-radius:10px;font-size:16px;padding:5px 8px}
#z3-actions{position:absolute;left:0;right:0;bottom:0;padding:10px;background:linear-gradient(0deg,rgba(5,8,16,.94),rgba(5,8,16,.5) 75%,transparent);z-index:20;display:flex;flex-direction:column;gap:8px}
#z3-card{display:flex;align-items:center;gap:10px;background:rgba(16,20,32,.85);border:1px solid rgba(255,210,62,.35);border-radius:12px;padding:6px 10px;width:fit-content;max-width:100%}
#z3-card img{width:44px;height:44px;border-radius:10px;object-fit:cover}
.z3-card-tx{display:flex;flex-direction:column;font-size:13px;color:#eee}
.z3-card-tx b{color:#ffd23e}
#z3-btns{display:flex;gap:8px}
#z3-btns button{background:rgba(20,26,40,.9);border:1px solid rgba(255,255,255,.16);color:#fff;border-radius:12px;font-size:17px;padding:10px 14px}
#z3-b-end{flex:1;background:linear-gradient(180deg,#c0392b,#8e2318);border-color:#ff8a70;font-weight:800;letter-spacing:.5px}
#z3-b-end:disabled{opacity:.45}
#z3-toast{position:absolute;top:52px;left:50%;transform:translateX(-50%);background:rgba(10,14,24,.92);border:1px solid rgba(255,210,62,.4);color:#ffe9b0;padding:8px 14px;border-radius:12px;font-size:13px;max-width:88%;text-align:center;opacity:0;transition:opacity .25s;z-index:40;pointer-events:none}
#z3-toast.show{opacity:1}
#z3-dice{position:absolute;top:34%;left:0;right:0;display:flex;justify-content:center;z-index:45;pointer-events:none;opacity:0;transition:opacity .2s}
#z3-dice.show{opacity:1}
.z3-dice-box{background:rgba(8,10,18,.92);border:2px solid #c0392b;border-radius:16px;padding:12px 18px;text-align:center;box-shadow:0 6px 30px rgba(0,0,0,.6)}
.z3-dice-title{color:#ffd23e;font-weight:800;font-size:14px;margin-bottom:6px}
.z3-dice-rolls{font-size:38px;letter-spacing:6px}
.z3-dice-rolls .hit{color:#fff;text-shadow:0 0 12px #ff4030}
.z3-dice-rolls .miss{color:#5a5f6e}
.z3-dice-res{color:#ffe9b0;font-weight:700;margin-top:4px}
#z3-streak{position:fixed;top:22%;left:50%;transform:translate(-50%,-50%) scale(.4);z-index:60;pointer-events:none;font-weight:900;font-size:30px;color:#ffd23e;text-shadow:0 0 18px rgba(255,60,30,.9),0 2px 6px #000;opacity:0;white-space:nowrap}
#z3-streak.pop{animation:streakpop 1.45s cubic-bezier(.2,1.4,.4,1) forwards}
#z3-floats{position:absolute;inset:0;pointer-events:none;z-index:30}
.z3-float{position:absolute;transform:translate(-50%,-50%);color:#ff6b5e;font-weight:900;font-size:20px;text-shadow:0 1px 4px #000;animation:z3float .9s ease-out forwards}
.z3-float.crit{color:#ffd23e;font-size:26px}
@keyframes z3float{0%{opacity:0;margin-top:0}15%{opacity:1}100%{opacity:0;margin-top:-46px}}
.z3-pop{position:absolute;inset:0;display:none;align-items:center;justify-content:center;background:rgba(3,5,10,.55);z-index:50}
.z3-pop.show{display:flex}
.z3-pop-box{position:relative;background:linear-gradient(180deg,#12172a,#0b0f1c);border:1px solid rgba(255,210,62,.45);border-radius:18px;padding:20px;max-width:86%;text-align:center;color:#e8e4da;box-shadow:0 10px 44px rgba(0,0,0,.7)}
.z3-pop-box b{font-size:18px;color:#ffd23e}
.z3-pop-box p{font-size:14px;line-height:1.45;margin:10px 0}
.z3-close{position:absolute;top:8px;right:10px;background:none;border:none;color:#aaa;font-size:18px}
.z3-pop-btns{display:flex;gap:10px;justify-content:center;margin-top:12px}
.z3-pop-btns button,.z3-pop-box>button{border-radius:12px;padding:10px 16px;font-size:15px;font-weight:700;border:1px solid rgba(255,255,255,.2);background:rgba(20,26,40,.9);color:#fff}
.z3-pop-btns .danger,.z3-pop-box>button.danger{background:linear-gradient(180deg,#c0392b,#8e2318);border-color:#ff8a70}
.z3-hint{font-size:11.5px!important;opacity:.75}
.z3-title{font-size:34px;font-weight:900;color:#e33;letter-spacing:2px;text-shadow:0 0 22px rgba(255,40,30,.5)}
.z3-title span{color:#ffd23e}
.z3-beta{display:inline-block;background:#ffd23e;color:#111;font-weight:800;font-size:11px;border-radius:8px;padding:2px 8px;margin-top:6px;letter-spacing:1px}
.z3-loading{margin-top:12px;color:#9aa;font-size:13px}
#z3-b-play{margin-top:14px;width:100%}
#z3-b-2d2{margin-top:10px;width:100%}

/* selector de escuadron 3D */
#z3-squad{display:grid;grid-template-columns:repeat(4,1fr);gap:8px;margin:12px 0 4px}
.z3-pick{display:flex;flex-direction:column;align-items:center;gap:3px;cursor:pointer;opacity:.55;transition:transform .12s,opacity .12s}
.z3-pick img{width:56px;height:56px;border-radius:12px;object-fit:cover;border:2px solid transparent}
.z3-pick span{font-size:11px;color:#ddd}
.z3-pick.sel{opacity:1;transform:scale(1.07)}
.z3-pick.sel img{border:3px solid #ffd23e;box-shadow:0 0 14px rgba(255,210,62,.7)}
.z3-pick .z3-check{position:absolute;bottom:20px;right:4px;background:#ffd23e;color:#111;border-radius:50%;width:17px;height:17px;font-size:11px;line-height:17px;text-align:center;font-weight:900;display:none;box-shadow:0 1px 4px rgba(0,0,0,.6)}
.z3-pick.sel .z3-check{display:block}
#z3-squad-count{font-size:12px;color:#9aa;margin-bottom:8px}

/* --- 3D bloque 1: selector completo --- */
#z3-squad{max-height:34vh;overflow-y:auto;padding-right:2px}
.z3-pick{position:relative}
.z3-pick.lock{opacity:.4;filter:grayscale(.7)}
.z3-pick.lock img{border-color:#555}
.z3-pick .z3-lock{position:absolute;top:2px;left:4px;font-size:12px;filter:drop-shadow(0 1px 2px #000)}
.z3-pick .z3-info{position:absolute;top:0;right:0;background:rgba(10,14,24,.85);border:1px solid rgba(255,255,255,.25);color:#cfe;font-size:9px;border-radius:6px;padding:1px 4px}
.z3-rowlabel{font-size:11px;color:#9aa;text-align:left;margin:8px 0 3px;font-weight:700;letter-spacing:.5px}
.z3-chips{display:flex;gap:5px;flex-wrap:wrap;justify-content:center;margin-bottom:2px}
.z3-chip{background:rgba(20,26,40,.9);border:1px solid rgba(255,255,255,.16);color:#ddd;border-radius:10px;font-size:11px;padding:5px 8px;font-weight:700}
.z3-chip.on{border-color:#ffd23e;color:#ffd23e;box-shadow:0 0 8px rgba(255,210,62,.35)}
#z3-b-continue{margin-top:10px;width:100%}
.z3-start-box{max-height:92vh;overflow-y:auto}
.z3-defcard-box{max-height:88vh;overflow-y:auto;text-align:center}
.z3-defcard-box img{width:120px;height:120px;border-radius:16px;object-fit:cover;border:2px solid rgba(255,210,62,.5)}
.z3-defcard-box h3{margin:8px 0 2px;color:#ffd23e;font-size:20px}
.z3-defcard-box .z3-alias{color:#9aa;font-size:12px;margin-bottom:8px}
.z3-defcard-box .z3-perks{font-size:12.5px;line-height:1.5;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12);border-radius:10px;padding:7px 9px;margin:7px 0;text-align:left}
.z3-defcard-box .z3-story{font-size:12px;opacity:.85;font-style:italic;text-align:left}
.z3-defcard-box .z3-locknote{border:1px solid #8a8256;border-radius:8px;padding:5px 7px;font-size:12px}
/* 3D: las pantallas de menu (coleccion, records, reglas) van por encima del popup de inicio */
#zm3d .screen.active { z-index: 70; }
#zm3d .overlay { z-index: 90; }

.zm-red-die{display:inline-grid;place-items:center;width:1.15em;height:1.15em;border-radius:22%;background:linear-gradient(145deg,#ef4b55,#bc1023 48%,#650411);color:#fff!important;box-shadow:inset 1px 1px 2px #ffffff99,inset -1px -2px 2px #31000a,1px 2px 3px #0009;font-weight:bold;line-height:1;vertical-align:middle;text-shadow:0 1px 1px #60101a}

#z3-supply-choice{z-index:90!important;position:absolute;inset:0;display:flex;align-items:center;justify-content:center;background:#050a13c9;padding:14px;box-sizing:border-box}#z3-supply-choice .z3-supply-box{width:min(470px,100%);max-height:calc(100dvh - 32px);overflow:auto;padding:24px;box-sizing:border-box;background:#111b2af5;border:1px solid #d6b967;border-radius:18px;box-shadow:0 18px 80px #000a;text-align:left;color:#f4f0e5;font:15px/1.5 sans-serif}#z3-supply-choice h2{font-size:24px;line-height:1.2;margin:10px 0 18px;color:#ffe399}#z3-supply-choice p{margin:12px 0}#z3-supply-choice .z3-supply-kicker{font-size:11px;letter-spacing:.12em;color:#cbb77f}#z3-supply-choice .z3-supply-note{font-size:13px;color:#bac4d4}#z3-supply-choice button{width:100%;display:block;min-height:48px;margin-top:12px;padding:11px 12px;border-radius:10px;border:1px solid #dfbd70;background:#966d20;color:#fff;font:bold 14px/1.4 sans-serif}#z3-supply-choice button[data-supply=stop]{background:#243145;border-color:#64758d}#z3-supply-choice button:focus-visible{outline:3px solid white;outline-offset:3px}@media(max-height:500px){#z3-supply-choice .z3-supply-box{padding:16px}#z3-supply-choice h2{font-size:20px;margin:8px 0}#z3-supply-choice p{margin:8px 0}}

#z3-inventory .z3-inventory-box{max-height:calc(100dvh - 26px);overflow-y:auto}#z3-inventory details{margin:7px 0;color:#cbd6e8;font:13px/1.5 sans-serif}#z3-inventory summary{cursor:pointer;color:#e4c77e;min-height:30px;line-height:30px}#z3-inventory .z3-inv-help{font:12px/1.5 sans-serif;color:#bbc6d8}#z3-inventory .z3-inv-buttons{display:flex;flex-wrap:wrap;gap:6px}#z3-inventory .z3-inv-buttons button{margin:0;flex:1 1 auto;font-size:12px}#z3-inventory .z3-transfer-panel:not(:empty){padding:12px;background:#101a2c;border:1px solid #d2b568;border-radius:12px;margin-top:16px}#z3-inventory .z3-transfer-panel p{font:13px/1.5 sans-serif}#z3-inventory .z3-transfer-panel button{min-height:44px;padding:8px 12px;margin:4px;border:1px solid #8b9bb1;border-radius:8px;background:#29394d;color:white}

#z3-inventory .z3-gear-name{display:flex;align-items:center;gap:11px;text-align:left;font-size:16px!important}#z3-inventory .z3-gear-icon{display:block;width:48px;height:48px;flex:none;border:1px solid #5a6a7d;border-radius:10px}#z3-inventory .z3-gear-emoji{display:inline-flex;width:40px;justify-content:center;font-size:24px}#found-pop .z3-found-use{display:block;margin-top:9px;padding:10px 12px;border:1px solid #d7b560;border-radius:8px;background:#8a6622;color:#fff;font:bold 13px sans-serif;min-height:44px}#found-pop .z3-found-use:disabled{opacity:.45}

/* gen118 - compact tactical header, all options in one disclosure */
#zm3d #z3-hud{display:flex;justify-content:space-between;align-items:flex-start;gap:10px;grid-template-columns:none;padding:8px 10px;background:linear-gradient(180deg,rgba(5,8,16,.7),transparent);pointer-events:none;z-index:25;min-height:60px;box-sizing:border-box}
#zm3d #z3-turn{flex:none;grid-column:auto;font:700 12px/1 sans-serif;letter-spacing:.08em;text-transform:uppercase;background:rgba(10,17,29,.88);padding:12px 14px;border:1px solid #ffffff20;border-radius:11px;color:#d6dfeb;margin-top:4px}
#zm3d #z3-game-menu{pointer-events:auto;position:relative;max-width:calc(100vw - 20px);color:#ecedf0;font-family:sans-serif}
#zm3d #z3-game-menu>summary{display:flex;align-items:center;gap:9px;list-style:none;cursor:pointer;min-height:44px;box-sizing:border-box;padding:10px 15px;background:linear-gradient(180deg,#223247,#121e30);border:1px solid #c7ad6c80;border-radius:11px;font-size:13px;font-weight:700;user-select:none;box-shadow:0 4px 20px #0005}
#z3-game-menu>summary::-webkit-details-marker{display:none}#z3-game-menu .z3-menu-lines{color:#eacb81;font-size:18px}#z3-game-menu .z3-menu-chevron{font-size:20px;transition:transform .16s}#z3-game-menu[open] .z3-menu-chevron{transform:rotate(180deg)}
#zm3d #z3-menu-panel{position:absolute;top:calc(100% + 8px);right:0;width:min(350px,calc(100vw - 20px));box-sizing:border-box;max-height:calc(100dvh - 80px);overflow-y:auto;overscroll-behavior:contain;padding:16px;border:1px solid #c7ad6c80;border-radius:16px;background:linear-gradient(155deg,#192538fa,#0b1423fc);box-shadow:0 15px 65px #000a;backdrop-filter:blur(15px);text-align:left}
#zm3d #z3-menu-panel button{font-family:sans-serif;font-size:13px;font-weight:600;min-height:46px;line-height:1.35;white-space:normal;grid-column:auto;padding:11px;text-align:left;color:#eef1f5;border:1px solid #ffffff25;background:#ffffff08;border-radius:9px;cursor:pointer}
#zm3d #z3-menu-panel button:hover{background:#ffffff16;border-color:#e3c67790}#zm3d #z3-menu-panel button:focus-visible,#zm3d #z3-game-menu>summary:focus-visible{outline:2px solid #ffe1a0;outline-offset:3px}
#zm3d .z3-menu-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;color:#a9b9cd;font-size:10px;font-weight:700;letter-spacing:.14em}#zm3d #z3-menu-close{min-height:36px;width:36px;padding:6px;text-align:center;background:transparent;border:0}
#zm3d #z3-menu-mission{display:flex;flex-direction:column;align-items:flex-start;gap:7px;width:100%;border-color:#b69a5c60;background:#c2a5650c;padding:14px}
#zm3d #z3-mode{display:block;grid-column:auto;white-space:normal;overflow:visible;color:#f0cd76;font:700 19px/1.25 sans-serif;flex:none}
#zm3d .z3-menu-label{color:#a9b9cd;font-size:10px;letter-spacing:.12em}#zm3d .z3-menu-sub{color:#c5ced9;font-size:12px;font-weight:400}
#zm3d .z3-menu-status{display:flex;gap:8px;align-items:center;flex-wrap:wrap;padding:12px 0;margin-bottom:10px;border-bottom:1px solid #ffffff1c}#zm3d #z3-z{flex:1;grid-column:auto;min-height:44px;font-size:13px;padding:9px 8px;background:#ffffff08;border:1px solid #ffffff25;text-decoration:none;text-align:center;white-space:nowrap}#zm3d #z3-noise{flex:1;grid-column:auto;font-size:12px;line-height:1.4;text-align:center;color:#c9d3df;min-width:110px}
#zm3d .z3-menu-tools{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}#zm3d #z3-btn-exit{color:#f4b7a9;border-color:#b66b583f;order:6}#zm3d #z3-btn-mute{order:4}#zm3d #z3-btn-2d{order:5}
@media(max-height:480px){#zm3d #z3-menu-panel{width:min(490px,calc(100vw - 20px));padding:12px;max-height:calc(100dvh - 72px)}#zm3d .z3-menu-heading{margin-bottom:5px}#zm3d .z3-menu-tools{grid-template-columns:repeat(3,minmax(0,1fr))}#zm3d #z3-menu-mission{gap:4px;padding:10px}#zm3d .z3-menu-status{margin-bottom:5px;padding:7px 0}}
@media(prefers-reduced-motion:reduce){#z3-game-menu .z3-menu-chevron{transition:none}}

#zm3d #z3-loot-choice{z-index:85;background:#030810aa}#zm3d .z3-loot-box{box-sizing:border-box;width:min(500px,calc(100vw - 24px));max-height:calc(100dvh - 28px);overflow-y:auto;background:linear-gradient(150deg,#1a2638,#0d1524);border:1px solid #d5ba79;border-radius:18px;padding:20px;color:#e6ebf3;text-align:left;box-shadow:0 12px 70px #000b}#zm3d .z3-loot-box>small{font:700 10px/1.4 sans-serif;letter-spacing:.11em;color:#b5c5d7}#zm3d .z3-loot-box h2{margin:8px 0 14px;font-size:26px;color:#f0d38c}#zm3d .z3-loot-box p{font:14px/1.45 sans-serif}#zm3d .z3-loot-box .z3-loot-cost{font:12px/1.4 sans-serif;color:#b9c7d8}#zm3d .z3-loot-new{display:flex;gap:12px;align-items:center;padding:12px;border:1px solid #b59a5b77;border-radius:10px;background:#b59a5b0c}#zm3d .z3-loot-new small{display:block;font:10px sans-serif;color:#b5c5d7;margin-bottom:5px}#zm3d .z3-loot-new b{font-size:17px;color:#ffe0a0}#zm3d .z3-loot-box .z3-gear-icon{width:44px;height:44px;flex:none;border-radius:8px}#zm3d .z3-loot-box .z3-gear-emoji{display:inline-flex;align-items:center;justify-content:center;width:44px;flex:none;font-size:24px}#zm3d .z3-loot-options{display:flex;flex-direction:column;gap:7px;margin:15px 0}#zm3d .z3-loot-options button{display:flex;gap:12px;align-items:center;box-sizing:border-box;width:100%;border:1px solid #ffffff25;border-radius:10px;background:#ffffff05;color:#f1f1f1;padding:9px 10px;text-align:left;cursor:pointer;min-height:56px}#zm3d .z3-loot-options button>span:nth-child(2){flex:1}#zm3d .z3-loot-options b{display:block;font:600 14px sans-serif}#zm3d .z3-loot-options small{display:block;margin-top:5px;font:11px sans-serif;color:#bbcadb}#zm3d .z3-loot-options button:hover{background:#ffffff14;border-color:#e5ca88}#zm3d .z3-leave-found{width:100%;min-height:46px;border:1px solid #c1b49280;border-radius:10px;background:#293549;color:#fff;font:600 13px sans-serif;padding:10px;cursor:pointer}#zm3d .z3-loot-box button:focus-visible{outline:2px solid #ffe0a0;outline-offset:2px}#zm3d .z3-capacity{font:600 12px sans-serif;letter-spacing:0;background:#d2b87524;color:#f0d38c;padding:5px 8px;border-radius:7px;vertical-align:middle}
/* Keep a found item inside the actual game panel, including short mobile views. */
#zm3d #found-pop{position:absolute;top:62px;max-height:calc(100% - 78px);overflow-y:auto;max-width:calc(100% - 24px)}
#zm3d #found-pop .found-box{max-width:100%;box-sizing:border-box}
/* House encounter: six physical cards with one irrevocable reveal. */
#z3-house-cards{position:absolute;inset:0;z-index:180;background:rgba(3,7,13,.93);display:flex;align-items:center;justify-content:center;padding:16px;overflow:auto;backdrop-filter:blur(7px);box-sizing:border-box}
#zm3d .z3-house-box{width:min(700px,100%);text-align:center;margin:auto;color:#f5eddb}
#zm3d .z3-house-eyebrow{font-size:10px;letter-spacing:.22em;color:#c7aa6a;font-weight:800}
#zm3d .z3-house-box h2{font-size:clamp(23px,5vw,36px);margin:8px 0;font-family:Barlow,Arial,sans-serif;text-transform:uppercase}
#zm3d .z3-house-hint,#zm3d .z3-house-result{font-size:12px;color:#c5cbd2;margin:10px 0;line-height:1.4;min-height:2.8em}
#zm3d .z3-house-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:18px auto;max-width:590px}
#zm3d .z3-house-card{padding:0;border:0;background:transparent;perspective:900px;aspect-ratio: .75;min-height:0;border-radius:9px;cursor:pointer;color:inherit}
#zm3d .z3-house-flipper{display:block;width:100%;height:100%;position:relative;transform-style:preserve-3d;transition:transform 1.15s cubic-bezier(.3,.1,.2,1)}
#zm3d .z3-house-card.chosen .z3-house-flipper{transform:rotateY(180deg)}
#zm3d .z3-house-back,#zm3d .z3-house-front{position:absolute;inset:0;backface-visibility:hidden;-webkit-backface-visibility:hidden;border:1px solid #b89b5d;border-radius:9px;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center;box-shadow:0 8px 20px #0009;box-sizing:border-box}
#zm3d .z3-house-back{background:repeating-linear-gradient(45deg,#15202a 0 7px,#1c2932 7px 9px);outline:1px solid #786b4f;outline-offset:-7px}
#zm3d .z3-house-back>span{font-weight:900;color:#cbb979;font-size:13px;letter-spacing:.2em}
#zm3d .z3-house-back>b{font-size:clamp(36px,8vw,72px);color:#b84436;text-shadow:0 3px 0 #000;margin:6px}
#zm3d .z3-house-back>small{font-size:9px;letter-spacing:.16em;color:#b8af92}
#zm3d .z3-house-front{transform:rotateY(180deg);background:#101a23;justify-content:flex-start;padding:5px}
#zm3d .z3-house-front img{width:100%;height:65%;object-fit:cover;border-radius:5px;filter:contrast(1.1)}
#zm3d .z3-house-front b{font-size:clamp(10px,1.7vw,17px);line-height:1.1;margin:6px 0 3px;color:#f1ce7b}
#zm3d .z3-house-front small{font-size:clamp(8px,1.15vw,12px);line-height:1.2;color:#d2d6db}
#zm3d .has-choice .z3-house-card:not(.chosen){opacity:.22;filter:grayscale(1)}
#zm3d .z3-house-card.chosen{filter:drop-shadow(0 0 14px #c39b4780);z-index:2}
#zm3d .z3-house-continue{padding:13px 20px;border-radius:8px;background:#aa3427;color:white;border:1px solid #e06b43;font-weight:900;font-size:12px}
#zm3d .z3-house-continue[hidden]{display:none}
@media(max-height:700px){#zm3d .z3-house-grid{max-width:370px;gap:8px;margin:10px auto}#zm3d .z3-house-card{aspect-ratio:.88}#zm3d .z3-house-box h2{font-size:22px}#zm3d .z3-house-hint,#zm3d .z3-house-result{font-size:10px;margin:6px 0}#zm3d .z3-house-eyebrow{font-size:8px}}
@media(prefers-reduced-motion:reduce){#zm3d .z3-house-flipper{transition-duration:.1s}}
#zm3d .z3-house-front .z3-house-quantity{position:absolute;top:10px;right:10px;border:1px solid #e8c266;border-radius:6px;background:#0b111ded;font-size:clamp(20px,4vw,34px);font-weight:900;padding:1px 7px;color:#f2d18a;text-shadow:0 2px 3px #000;line-height:1.2}

/* Dialogs must cover the per-cell figure picker. */
#zm3d .z3-pop{z-index:100}
#zm3d #z3-end .end-grid{width:100%;max-width:100%;min-width:0;box-sizing:border-box;grid-template-columns:repeat(2,minmax(0,1fr))}
#zm3d #z3-end .end-card{min-width:0;box-sizing:border-box}

#zm3d #z3-dice{z-index:120}

.z3-save-status{font:11px/1.45 system-ui,sans-serif;color:#d3d8e0;max-width:340px;margin:8px auto;text-align:center;white-space:normal;text-wrap:balance}#z3-menu-panel .z3-save-status{padding:0 8px}
#z3-low-life{position:absolute;top:max(52px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);z-index:45;max-width:85%;padding:8px 14px;border:2px solid #ffba83;border-radius:9px;background:#681719f0;color:#fff6e8;font:700 13px system-ui;pointer-events:none;box-shadow:0 0 15px #f3363655}#z3-low-life[hidden]{display:none}

#evo-overlay .evo-box{max-height:92dvh;overflow:auto;padding:14px 12px;background:#101722f5;border:1px solid #b79751;border-radius:14px}#evo-overlay .evo-box h2{font-size:26px;letter-spacing:2px}#evo-overlay .evo-card img{width:100px;height:135px;object-fit:contain;border-radius:7px}#evo-overlay .evo-box>p{font-size:13px;line-height:1.4}.zm-settings input[type=checkbox]{width:24px;height:24px;flex:0 0 24px;margin:0}@media(max-height:500px){#evo-overlay .evo-card{display:none}#evo-overlay .evo-box{padding:10px}#evo-overlay .evo-box h2{font-size:21px}}

/* Private 3D HUD: explicit hero inventory, shared visual language, reversible actions. */
#zm3d .z3-hero-card{position:relative;min-width:0;background:#172336;border:1px solid #586a80;border-radius:8px}
#zm3d #z3-card .z3-hero-tab{width:100%;height:100%;min-height:68px;margin:0;padding:7px 29px 7px 6px;border:0;border-radius:8px;background:transparent;grid-template-columns:32px minmax(0,1fr);box-shadow:none}
#zm3d #z3-card .z3-hero-tab.active{background:#3b331c;outline:2px solid #70d6ff;outline-offset:-1px}
#zm3d .z3-card-inventory{position:absolute;right:3px;bottom:4px;width:26px;min-height:30px;padding:2px;margin:0;background:#253449;border:1px solid #6f7d8e;border-radius:6px;color:#eee}
#zm3d #z3-card{max-width:700px;gap:6px;margin:auto}
#zm3d #z3-card .z3-hero-tab img{width:32px;height:44px;grid-row:span 3}
#zm3d #z3-card .z3-hero-tab small{margin:0;font-size:9px}
#zm3d .z3-pick .z3-info{width:27px;min-height:27px;margin:3px;padding:2px;font-size:12px;line-height:1}
.zm-direct-actions #zm3d #z3-b-search,.zm-direct-actions #zm3d #z3-b-door,.zm-direct-actions #zm3d #z3-b-item,.zm-direct-actions #zm3d #z3-b-push,.zm-direct-actions #zm3d #z3-b-gen,.zm-direct-actions #zm3d #z3-b-corpse{display:none!important}
.zm-direct-actions #zm3d #z3-action-scroll{scroll-snap-type:none;flex-wrap:wrap;overflow:visible}
.zm-direct-actions #zm3d #z3-action-scroll button{flex:0 0 auto!important;min-width:0;max-width:none;padding:7px 10px}
.zm-direct-actions #zm3d .z3-action-arrow{display:none!important}
@media(max-width:500px){#zm3d #z3-card .z3-hero-tab{display:flex;flex-direction:column;padding:5px 2px 30px;text-align:center;gap:2px}#zm3d #z3-card .z3-hero-tab img{height:37px;width:29px}#zm3d #z3-card .z3-hero-tab b{font-size:10px}#zm3d .z3-card-inventory{left:calc(50% - 13px);right:auto}#zm3d #z3-card .z3-hero-tab span{font-size:9px}}

#zm3d #z3-b-item{display:none!important}
