/* Reino de Brasaverde · diseño móvil y táctil. Solo presentación: se activa con html.mob (pantalla pequeña o tableta táctil) y html.touchui (último puntero = dedo).
   El escritorio con ratón no cambia. Zonas táctiles de al menos 44 px, texto de 12 px o más, sin dependencia de hover. */
button,[data-a]{touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.press{transform:scale(.96);filter:brightness(1.3)}
html.touchui #tip{display:none!important}
html.touchui button.sq kbd,html.touchui .help kbd{display:none}

/* elementos nuevos (comunes a todos los diseños) */
#ctx{position:absolute;left:8px;right:8px;bottom:8px;z-index:6;display:flex;flex-direction:column;gap:6px;padding:8px 10px;max-height:56%;overflow-y:auto;background:rgba(9,14,20,.96);border:1px solid var(--edge);border-radius:8px;box-shadow:0 6px 24px rgba(0,0,0,.65);font-size:13px}
#ctx.top{bottom:auto;top:60px}
#ctx .cx b{color:var(--hi);font-size:14px}#ctx .cx small{display:block;color:#b4c2d0;font-size:12px}#ctx .cx h4{margin:0 0 3px;font-size:13px;color:var(--ice)}#ctx .cx p{margin:0 0 4px;color:#b4c2d0}#ctx .cx dl{display:grid;grid-template-columns:auto 1fr;gap:1px 8px;margin:0}#ctx .cx dt{color:var(--mut)}#ctx .cx dd{margin:0}
#ctx .cx .stt.ok{color:#9ff0c0}#ctx .cx .stt.no{color:var(--bad)}
#ctx .bar{margin:4px 0 2px}
#ctx .cb{display:flex;gap:6px;flex-wrap:wrap}
#ctx .cb button{flex:1 1 84px;min-height:46px;text-align:center;font-size:14px}
#ctx .cb button small{display:block;font-size:11px;color:#b4c2d0;margin-top:1px}
#ctx .cb .go{background:linear-gradient(180deg,#1f6a44,#134a2e);border-color:#6fe39c;color:#eafff2}
#ctx .cb .go small{color:#cdeedd}
#ctx .cb button.nr{border-style:dashed;border-color:#e0a82a;color:#ffd9a0}
#ctx .cb button.off{opacity:.55;filter:saturate(.4)}
#zoomc{position:absolute;right:8px;top:8px;z-index:5;display:flex;flex-direction:column;gap:6px}
#zoomc button{width:44px;height:44px;padding:0;display:flex;align-items:center;justify-content:center;border-radius:50%;background:rgba(9,14,20,.82)}
/* escritorio: los mismos botones, arriba a la izquierda y en fila (a la derecha se abren la mochila y el tablón) */
html:not(.mob) #zoomc{right:auto;left:8px;top:8px;flex-direction:row}
html:not(.mob) #zoomc button{width:34px;height:34px}
#toast{position:absolute;left:50%;top:62px;transform:translateX(-50%);z-index:9;max-width:min(92%,420px);padding:8px 12px;background:rgba(5,8,12,.94);border:1px solid var(--edge);border-radius:8px;font-size:13px;line-height:1.3;text-align:center;pointer-events:none;box-shadow:0 4px 16px rgba(0,0,0,.6);transition:opacity .35s}
#toast.fade{opacity:0}
html:not(.mob) #toast{display:none}
#net{position:fixed;left:0;right:0;top:var(--vvt,0px);z-index:60;padding:calc(6px + env(safe-area-inset-top)) 10px 6px;background:#7a2a2a;color:#fff;text-align:center;font-size:13px}
#shbg{position:fixed;inset:0;z-index:40;background:rgba(3,6,9,.6)}
#msheet{position:fixed;left:0;right:0;bottom:0;z-index:41;max-height:calc(var(--vvh,100vh) * .82);display:flex;flex-direction:column;padding:0 0 env(safe-area-inset-bottom);background:linear-gradient(180deg,var(--panel),var(--panel2));border:1px solid var(--edge);border-bottom:0;border-radius:14px 14px 0 0;box-shadow:0 -8px 30px rgba(0,0,0,.6)}
#msheet .shh{display:flex;align-items:center;justify-content:space-between;padding:8px 12px 4px;flex:none}#msheet .shh h3{margin:0}#msheet .shh button{width:44px;height:44px;padding:0;font-size:24px;text-align:center}
#msheet .shb{overflow-y:auto;padding:4px 12px 12px;-webkit-overflow-scrolling:touch}
#msheet .mgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:8px}#msheet .mgrid button{min-height:48px;text-align:center}#msheet .mgrid button svg{width:20px;height:20px;flex:none}#msheet .mgrid button{display:flex;align-items:center;justify-content:center;gap:8px}
#msheet .hl{margin:0;padding-left:18px}#msheet .hl li{margin:6px 0}
#msheet .cm{padding:3px 0;border-bottom:1px solid rgba(37,56,74,.45)}
#msheet .qc{padding:6px 8px;margin:5px 0;background:rgba(166,232,255,.05);border:1px solid var(--edge-d);border-radius:3px}#msheet .qc.act{border-color:var(--ice)}#msheet .qc.lock{opacity:.9;border-style:dashed}#msheet .lvl-lock{margin:3px 0 5px;padding:4px 6px;border-left:3px solid #f2c94c;background:rgba(242,201,76,.08)}#msheet .lvl-lock b{color:#f2c94c;display:block}

/* ================= DISEÑO MÓVIL ================= */
html.mob,html.mob body{overscroll-behavior:none}
html.mob body{font-size:15px}
html.mob body.ingame{overflow:hidden}
html.mob #app{max-width:none;padding:0}
html.mob #game{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100%);display:flex;flex-direction:column;background:var(--bg);padding:env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);-webkit-user-select:none;user-select:none}
html.mob #game input,html.mob #chlog{-webkit-user-select:text;user-select:text}
html.mob #top{flex:none;display:flex;flex-wrap:nowrap;align-items:center;gap:6px;min-height:46px;padding:2px 6px;border-radius:0;border-width:0 0 1px}
html.mob #top .loc{flex:1;min-width:0;white-space:normal;overflow-wrap:anywhere;line-height:1.15;font-size:13px}   /* v2.82.0: el nombre del lugar baja de línea en vez de cortarse con «…» */
html.mob #top .res{flex:0 1 auto;max-width:112px;white-space:normal;line-height:1.15;font-size:11px;color:var(--mut);font-weight:500}
html.mob #top button{margin:0;width:44px;height:40px;padding:0;display:flex;align-items:center;justify-content:center;flex:none}
html.mob #stage{flex:1;min-height:0;position:relative;overflow:hidden}
html.mob canvas#c{width:100%;height:100%;border:0;border-radius:0;display:block}
/* ficha del héroe sobre el mapa */
html.mob #herobox.ov{position:absolute;left:6px;top:6px;z-index:5;width:min(54%,230px);padding:5px 8px;gap:0;background:rgba(9,14,20,.82);pointer-events:none}
html.mob #herobox.ov #portrait{display:none}
html.mob #herobox.ov .hname{font-size:13px;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
html.mob #herobox.ov .bar{margin:3px 0 1px;height:6px}
html.mob #herobox.ov small{font-size:12px;line-height:1.2}
html.mob #herobox.ov .xp,html.mob #herobox.ov .attrs,html.mob #herobox.ov .tut{display:none}
html.mob #herobox.ov .bar.xp{display:block;height:3px;margin-top:2px}html.mob #herobox.ov .bar.xp+small{display:none}
/* panel inferior */
html.mob #hud,html.mob #hud.cb{flex:none;display:block;margin:0;grid-template-columns:none}
html.mob #acts{border-radius:0;border-width:1px 0 0;box-shadow:none;padding:6px 6px calc(6px + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(auto-fit,minmax(76px,1fr));gap:6px;align-content:start}
html.mob #acts>button{min-height:50px;text-align:center;font-size:13px;padding:4px 6px}
html.mob #acts>button.dk{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;position:relative}
html.mob #acts>button.dk b{font-weight:600;font-size:12px;line-height:1.1}
html.mob .dkb{position:absolute;top:2px;right:6px;min-width:18px;padding:1px 5px;border-radius:9px;background:var(--ice);color:#04121a;font:700 11px/1.2 system-ui,sans-serif;text-align:center;font-style:normal}
html.mob #acts .dep{grid-column:1/-1;font-size:13px}
html.mob #acts>small{grid-column:1/-1}
/* combate */
html.mob #acts .cbar{grid-column:1/-1;flex-direction:column;align-items:stretch;gap:6px}
html.mob .cbar .sqs{display:grid;grid-template-columns:repeat(auto-fit,minmax(48px,1fr));gap:6px;width:100%}
html.mob .cbar button.sq{width:100%;max-width:64px;height:auto;aspect-ratio:1;min-height:48px;justify-self:center}
html.mob .cbar button.sq .ic{inset:8px 8px 14px 8px}
html.mob .cbar button.sq .co{font-size:11px;right:4px;bottom:3px}
html.mob .cbar button.sq .cdn{font-size:18px}
html.mob .cbar .st{font-size:12px;color:var(--mut);font-weight:500}
button.sq.off{opacity:.5;filter:grayscale(.6)}
button.sq.nr{border-style:dashed;border-color:#e0a82a}button.sq.nr .co{color:#ffb070}
html.mob #hud.cb #herobox{padding:5px 8px}
/* hojas: inventario y tablón/comerciantes */
html.mob #inv,html.mob #npc{position:absolute;left:0;right:0;top:8px;bottom:0;width:auto;max-height:none;border-radius:14px 14px 0 0;padding:6px 10px calc(10px + env(safe-area-inset-bottom));display:flex;flex-direction:column;z-index:8;overflow-y:auto;-webkit-overflow-scrolling:touch;background:rgba(9,14,20,.98)}
html.mob #npc .sc{overflow:visible;flex:none}html.mob #npc{overflow-y:auto}
html.mob #npc>button[data-a="npc:x"],html.mob #inv>button[data-a="inv"]:last-child{order:-1;align-self:flex-end;min-width:96px;min-height:44px;text-align:center}
html.mob #npc button,html.mob #inv button{min-height:44px;padding:6px 12px}
html.mob #inv .slot,html.mob #npc .qc{padding:8px}
html.mob #npc .tabs button{min-height:46px;text-align:center}
html.mob #npc .shop{grid-template-columns:repeat(2,1fr)}
html.mob #inv h3,html.mob #npc h3{font-size:16px}
/* chat: hoja inferior sobre el teclado */
html.mob #foot{position:absolute;left:0;right:0;bottom:0;z-index:30;display:block;margin:0;padding:0 env(safe-area-inset-right) 0 env(safe-area-inset-left)}
html.mob #log{display:none}
html.mob #chat{height:clamp(170px,calc(var(--vvh,600px) * .46),360px);border-radius:14px 14px 0 0;border-bottom:0}
html.mob #chat.min{display:none}
html.mob #chat header{padding:4px 6px 4px 12px}html.mob #chat .ct{font-size:12px}
html.mob #chtg{width:48px;height:40px;font-size:20px;text-align:center}
html.mob #chlog{flex:1;height:auto;min-height:60px;font-size:14px}
html.mob #chf{padding:6px calc(6px + env(safe-area-inset-bottom)) calc(6px + env(safe-area-inset-bottom)) 6px}
html.mob #chin{font-size:16px;min-height:44px}
html.mob #chf button{min-width:76px;min-height:44px;text-align:center}
/* ventanas emergentes y acceso */
html.mob #modal,html.mob #auth{left:0;right:0;top:var(--vvt,0px);bottom:auto;height:var(--vvh,100%);overflow-y:auto;align-items:flex-start;padding:10px}
html.mob #modal .box,html.mob #auth .box{margin:auto;width:min(440px,100%);padding:16px;max-height:none}
html.mob #modal .row,html.mob #auth .row{flex-wrap:wrap}
html.mob #modal button,html.mob #auth button{min-height:48px;flex:1 1 120px;text-align:center}
html.mob #auth input,html.mob #modal input,html.mob #cn{font-size:16px;min-height:46px}
/* selección y creación de personajes */
html.mob .screen{padding:8px 10px calc(16px + env(safe-area-inset-bottom))}
html.mob h1{font-size:18px}
html.mob #slots{grid-template-columns:1fr;gap:8px}
html.mob .slotc{min-height:0;display:grid;grid-template-columns:96px 1fr;grid-template-areas:"img n" "img c" "img b";gap:2px 12px;text-align:left;align-items:center;justify-items:start}
html.mob .slotc img{grid-area:img;width:96px;height:106px}
html.mob .slotc .n{grid-area:n}html.mob .slotc>span:not(.n){grid-area:c}html.mob .slotc .btns{grid-area:b;width:100%}
html.mob .slotc .btns button{flex:1;min-height:46px;text-align:center}
html.mob .slotc.empty{display:flex;min-height:76px;flex-direction:row;justify-content:space-between;padding:10px 14px}
html.mob .slotc.empty button{min-height:46px}
html.mob .opt{min-height:44px;padding:6px 12px}
html.mob .sw{width:42px;height:42px}
html.mob #chars .row button{min-height:48px}
/* v2.82.0: la selección de personajes se desplaza si no cabe (teléfonos bajos o apaisados); en horizontal, dos columnas */
html.mob #chars:not([hidden]){height:100%;max-height:100%;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
html.mob.land #slots{grid-template-columns:1fr 1fr}

/* ================= APAISADO (móvil girado): el panel de acciones pasa a un lado ================= */
html.mob.land #game{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:auto minmax(0,1fr)}
html.mob.land #top{grid-column:1/-1;min-height:40px}
html.mob.land #stage{grid-row:2;grid-column:1}
html.mob.land #hud,html.mob.land #hud.cb{grid-row:2;grid-column:2;width:min(236px,34vw);overflow-y:auto;border-left:1px solid var(--edge-d);background:var(--panel)}
html.mob.land #acts{grid-template-columns:repeat(2,1fr);padding:6px 6px 6px}
html.mob.land .cbar .sqs{grid-template-columns:repeat(3,1fr)}
html.mob.land #foot{right:min(236px,34vw)}
html.mob.land #ctx{bottom:6px;max-height:70%}
html.mob.land #ctx.top{top:56px}
html.mob.land #chat{height:clamp(108px,calc(var(--vvh,360px) * .5),210px)}   /* v2.82.0: antes .7 (cubría casi todo el mapa en horizontal) */
html.mob.land #herobox.ov{width:min(40%,210px)}
@media (max-height:420px){html.mob #ctx .cx small{font-size:11px}html.mob #acts>button{min-height:44px}}
#msheet .tut.story button,#msheet .qc button{float:none;display:block;min-height:44px;padding:0 12px;margin-top:6px}

html.mob .cstat{font-size:12px}html.mob .cchip{font-size:12px;padding:1px 7px}

/* ---- v2.10.0: barra de habilidades desplazable y evolución en móvil ---- */
html.mob .cbar .skw{max-width:100%;width:100%}
html.mob .cbar .sks{display:flex;grid-template-columns:none;width:auto;flex:1;min-width:0;gap:6px}
html.mob .cbar .sks button.sq{width:54px;max-width:none;min-height:54px;aspect-ratio:auto;height:54px;flex:none}
html.mob .cbar .sknav{width:32px;height:54px}
html.mob .cbar .fix{display:grid;grid-template-columns:repeat(auto-fit,minmax(48px,1fr));width:100%;gap:6px}
html.mob.land .cbar .fix{grid-template-columns:repeat(3,1fr)}
html.mob #evo{left:0;right:0;top:8px;bottom:0;transform:none;width:auto;max-height:none;border-radius:14px 14px 0 0;padding:8px 10px calc(10px + env(safe-area-inset-bottom));-webkit-overflow-scrolling:touch}
html.mob #evo .evocs{grid-template-columns:1fr}
html.mob #evo .evoc{flex-direction:row;flex-wrap:wrap;text-align:left;align-items:flex-start}
html.mob #evo .evoc img{width:84px;height:92px}
html.mob #evo button{min-height:44px}
html.mob #evo .evof{position:sticky;bottom:0;background:rgba(9,14,20,.97);padding-top:6px}
html.mob #evo .evof button{width:100%}
html.mob #evo .evoc ul{columns:1}
html.mob #evo .evof{margin:10px -10px calc(-10px - env(safe-area-inset-bottom));padding:8px 10px calc(10px + env(safe-area-inset-bottom))}
html.mob #evo .evoc img{width:84px;height:92px}
html.mob #evo{background:#090e14}

/* creación de personaje en móvil (v2.14.0): una sola columna con desplazamiento; personaje arriba, clase y apariencia debajo, nombre y «Crear» fijos abajo */
html.mob #create:not([hidden]){display:flex;flex-direction:column;gap:8px;padding:8px 10px 0;overflow-y:auto;-webkit-overflow-scrolling:touch}
html.mob #cmid{display:contents}html.mob .ctitle,html.mob #cfig{order:1;flex:none}html.mob .ctitle{margin:0 44px;justify-content:center;gap:10px}html.mob #ccancel{position:fixed;top:8px;left:8px;z-index:6;width:38px;height:38px;padding:0;background:rgba(9,16,23,.9)}html.mob #cleft .chead{margin:0;padding:0;border:0;height:0}html.mob #cleft .chead>div{display:none}html.mob #cbar label{font-size:11px}
html.mob #cleft{order:2;flex:none}html.mob #cright{order:3;flex:none;margin-bottom:8px}
html.mob .cpanel{overflow:visible;backdrop-filter:none}
html.mob #cname{font-size:26px}html.mob .arr{width:46px;height:46px}
html.mob #cfig{flex:none}html.mob #cpv{height:min(36vh,300px)}
html.mob #cstage .glow{top:24%;width:120vw;height:50vh}
html.mob #cbar{position:sticky;bottom:0;z-index:3;order:4;width:auto;margin:0 -10px;border-radius:12px 12px 0 0;padding:8px 12px calc(8px + env(safe-area-inset-bottom));display:grid;grid-template-columns:1fr auto;gap:2px 8px;align-items:end}
html.mob #cbar label{grid-column:1;margin:0}html.mob #cbar .err{grid-column:1/-1;order:3;min-height:0;margin:0}html.mob #cbar .go{grid-column:2;grid-row:1;width:auto;padding:0 16px;min-height:50px;font-size:15px}
html.mob #ccls{grid-template-columns:repeat(2,1fr)}html.mob #ccls .cc{min-height:48px}
html.mob .sw{width:42px;height:42px}html.mob #cinfo{font-size:12px}

/* ===== v2.82.0: textos completos y controles táctiles (auditoría tools/audit-movil.js) ===== */
html.mob #chflt{flex-wrap:wrap;overflow:visible}   /* los filtros del chat bajan de línea en vez de salirse de la pantalla */
html.mob .arr{flex:none;min-width:46px}   /* flechas de clase: no se aplastan */
html.mob #evo .evor .sw{width:34px;height:34px;flex:none}
html.mob #herobox.ov .hname,html.mob #hud.cb .hname{white-space:normal;overflow:visible;text-overflow:clip;line-height:1.15;overflow-wrap:anywhere}
html.mob #herobox.ov .hname small,html.mob #hud.cb .hname small{display:block}
html.mob #chin::placeholder{font-size:13px}

/* ===== v2.147.0: auditoría móvil (tools/audit-movil-paneles.js) · zonas táctiles de 44 px y desplazamiento contenido. TODO bajo html.mob: el escritorio no cambia ===== */
html.mob #top button,html.mob #top .sfxbtn{min-width:44px;min-height:44px}
html.mob #acts>button.dk,html.mob #acts>button.dk.go{min-height:50px}
html.mob #msheet .qsub,html.mob #msheet button.qsub{min-height:44px}
html.mob #npc summary,html.mob #inv summary,html.mob #msheet summary{min-height:44px;display:flex;align-items:center}
html.mob #chsz,html.mob #chtg,html.mob #chch{min-height:44px;min-width:48px}
html.mob #chat label{min-height:44px;display:inline-flex;align-items:center;gap:6px;padding:0 6px}
html.mob #chat input[type=checkbox],html.mob #chat input[type=radio]{width:22px;height:22px;flex:none}
html.mob #inv,html.mob #npc,html.mob #evo,html.mob #skl,html.mob #msheet .shb,html.mob #modal,html.mob #chlog{overscroll-behavior:contain}
html.mob #acts>button.dk.go[data-a]{min-height:48px}   /* ui.css (cargado después) lo dejaba en 38 px */
html.mob #npc button[data-a],html.mob #inv button[data-a]{min-height:44px}
html.mob .rnkt button[role=tab]{min-height:44px}
