/* Reinos de Soul — touch HUD and touch windows (frente P, 07/10/2026).
   Every rule hangs on html.is-touch (touch screen: phones and tablets) or html.is-phone (short side up to 540 px), set
   by the inline script in index.html and kept current by mobile.js. The PC (mouse, keyboard, pad) never sees these.
   Identity: docs/identidade-visual.md (ink + aged gold; Eagle Lake, Cinzel, Alegreya, Alegreya Sans).
   Denver's rule for the phone held sideways: the screen shows mainly the game; the HUD covers at most ~20 %.
   Always on screen: thin life and mana bars with the level (top-left), a small arrow chip for the quest, a small
   minimap and ONE menu button (top-right), a see-through stick that appears under the left thumb, and on the right
   only three buttons: the big attack (near = strike, far = shot or spell, hold = charge), dodge (hold = defend) and the
   chosen skill (hold = wheel of five). Only when useful: the ATB/limit ring around the attack (tap the ATB arc for the
   tactical commands), the limit button when it is full, a life potion under 40 % life, jump when the hero is stuck
   (a quick upward swipe on the scene also jumps), the interact pill, the target plate in a fight (tap it or tap a
   monster to lock the aim), notices in a thin strip. Everything else is in the menu; no keys, no text over the game.
   Positions: --x/--y = distance from the safe right/bottom edges to the centre of a button, --d = its diameter, in
   phone pixels, scaled by --k (smaller on 360 px tall screens, bigger on tablets). */

/* ---------- tokens ---------- */
.is-touch{--sl:max(14px,env(safe-area-inset-left));--sr:max(14px,env(safe-area-inset-right));--st:max(8px,env(safe-area-inset-top));--sb:max(10px,env(safe-area-inset-bottom));--k:1.3;--mini:84px}
.is-phone{--k:1;--mini:62px}
@media(max-height:400px){.is-phone{--k:.94;--mini:58px}}
@media(max-height:370px){.is-phone{--k:.86;--mini:56px}}
.is-touch body{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;overscroll-behavior:none}
.is-touch input,.is-touch textarea,.is-touch select{-webkit-user-select:text;user-select:text;font-size:16px!important}
.is-touch button{touch-action:manipulation}

/* ---------- "gire o celular" (the CSS part shows it before the scripts arrive; mobile.js then opens it as a modal) ---------- */
.rotate-overlay{display:none;position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:24px;border:0;place-items:center;text-align:center;color:var(--text,#f1e9d4);background:url(/assets/ui/frames/paper.webp) center/512px repeat,radial-gradient(ellipse at 50% 35%,#1b2a23,#060a09 75%);background-blend-mode:soft-light,normal}
.rotate-overlay[open]{display:grid;z-index:1000}
.rotate-overlay::backdrop{background:#060a09}
@media(orientation:portrait){.is-phone .rotate-overlay:not([open]):not([hidden]){display:grid;z-index:1000}}
.rotate-card{max-width:320px}
.rotate-card .eyebrow{justify-content:center;font:700 10px var(--f-caps);letter-spacing:.26em;color:var(--gold-400,#e2c47a)}
.rotate-card h2{margin:10px 0 8px;font:400 30px/1.15 var(--f-display);color:var(--gold-300,#f3dc9b);text-shadow:0 2px 0 #000}
.rotate-card p{margin:0;font:500 15px/1.6 var(--f-serif);color:var(--text-dim,#c5c7b2)}
.rotate-phone{position:relative;width:132px;height:132px;margin:0 auto 18px;border-radius:50%;background:radial-gradient(circle,#24352c,#0b1210 70%);border:1.5px solid var(--gold-600,#9a7638);box-shadow:inset 0 0 0 5px #0b1210,inset 0 0 0 6px #c9a35a44,0 10px 30px #000a}
.rotate-phone i{position:absolute;left:50%;top:50%;width:40px;height:70px;margin:-35px 0 0 -20px;border-radius:8px;border:3px solid var(--gold-300,#f3dc9b);background:linear-gradient(#22332b,#111b17);box-shadow:0 0 14px #e2c47a55;animation:rotatePhone 2.4s cubic-bezier(.6,0,.3,1) infinite}
.rotate-phone i::before{content:"";position:absolute;left:50%;top:5px;width:10px;height:3px;margin-left:-5px;border-radius:2px;background:var(--gold-500,#c9a35a)}
.rotate-phone::after{content:"";position:absolute;inset:16px;border-radius:50%;border:2px dashed #e2c47a55;border-left-color:transparent;border-bottom-color:transparent;transform:rotate(-20deg)}
@keyframes rotatePhone{0%,22%{transform:rotate(0)}48%,78%{transform:rotate(-90deg)}100%{transform:rotate(0)}}

/* ---------- what leaves the touch screen (the menu carries it): PC panels, top icons, keys, clock, status, online ---------- */
.is-touch .topbar nav,.is-touch .topbar .compass,.is-touch body.playing .brand,.is-touch .vitals,.is-touch .clock-hud,.is-touch .online-list,.is-touch .companion-vitals,.is-touch .location,.is-touch .controls-strip,.is-touch .status,.is-touch .map-caption,.is-touch .combat-divider,.is-touch .combat-bar button kbd,.is-touch .combat-bar button b,.is-touch #touchRun,.is-touch #touchInteract,.is-touch #blockButton,.is-touch #lockButton{display:none!important}
.is-touch body:not(.playing) .status{display:flex!important;bottom:calc(var(--sb) + 2px);left:var(--sl)}
.mobile-hud{display:none}
.is-touch .mobile-hud{display:block}

/* ---------- the single menu button (top-right, beside the minimap) ---------- */
.phone-menu-btn{display:none}
.is-touch .phone-menu-btn{position:fixed;z-index:9;top:calc(var(--st) + 2px);right:calc(var(--sr) + var(--mini)*1.24 + 8px);display:grid;place-content:center;gap:4px;width:calc(var(--k)*44px);height:calc(var(--k)*44px);padding:0;border-radius:50%;border:1.5px solid #c9a35acc;background:radial-gradient(circle,#1d2b25d9,#0b1210d9);box-shadow:0 3px 10px #0008}
.is-touch .phone-menu-btn i{display:block;width:calc(var(--k)*17px);height:2px;border-radius:2px;background:var(--gold-300,#f3dc9b);box-shadow:0 1px 2px #000}
.is-touch body:not(.playing) .phone-menu-btn{right:var(--sr)}
.is-touch .topbar{padding:calc(var(--st) + 4px) var(--sr) 0 var(--sl)}

/* ---------- thin life and mana with the level (top-left) ---------- */
.is-touch .m-vitals{position:fixed;z-index:6;left:var(--sl);top:calc(var(--st) + 4px);display:grid;grid-template-columns:auto auto auto;grid-template-rows:auto auto;align-items:center;column-gap:calc(var(--k)*7px);pointer-events:none;filter:drop-shadow(0 1px 2px #000c)}
.m-face{grid-row:1/3;position:relative;width:calc(var(--k)*30px);height:calc(var(--k)*30px);border-radius:50%;border:1.5px solid var(--gold-500,#c9a35a);background:radial-gradient(circle at 50% 35%,#4c6b5a,#14231c) center/cover;box-shadow:0 0 0 1.5px #0b1210}
body[data-hero=archer] .m-face{background-image:url(/assets/ui/portraits/archer-face.webp)}
body[data-hero=mage] .m-face{background-image:url(/assets/ui/portraits/mage-face.webp)}
body[data-hero=necromancer] .m-face{background-image:url(/assets/ui/portraits/necromancer-face.webp)}
body[data-hero=warrior] .m-face{background-image:url(/assets/ui/portraits/warrior-face.webp)}
body[data-hero=samurai] .m-face{background-image:url(/assets/ui/portraits/samurai-face.webp)}
.m-level{position:absolute;left:calc(var(--k)*20px);top:calc(var(--k)*19px);min-width:calc(var(--k)*17px);height:calc(var(--k)*15px);padding:0 3px;border-radius:999px;border:1px solid var(--gold-500,#c9a35a);background:#0b1210;font:800 calc(var(--k)*10px)/calc(var(--k)*13px) var(--f-ui);font-variant-numeric:lining-nums;text-align:center;color:var(--gold-300,#f3dc9b)}
.m-bars{display:flex;flex-direction:column;gap:calc(var(--k)*3px);width:calc(var(--k)*150px)}
.m-bar{position:relative;display:block;overflow:hidden;background:#050908c4;border:1px solid #c9a35a8c;border-radius:2px}
.m-bar>i{position:absolute;inset:0 auto 0 0;width:100%;transition:width .18s ease-out}
.m-bar.hp{height:calc(var(--k)*8px)}
.m-bar.hp #mHp{background:linear-gradient(180deg,#ff8a64,#e24a35 45%,#a3201f)}
.m-bar.hp .m-trail{background:#fff1cf;transition:width .6s cubic-bezier(.3,0,.25,1) .4s}
.m-bar.mp{height:calc(var(--k)*4px);border-color:#7fb6ff66}
.m-bar.mp #mMp{background:linear-gradient(180deg,#9ad8ff,#3f8fe6)}
.m-hp-text{font:800 calc(var(--k)*11px) var(--f-ui);font-variant-numeric:lining-nums tabular-nums;color:#fff6e4;text-shadow:0 1px 2px #000}
.m-status{grid-column:2/4;display:flex;gap:3px;min-height:0}
.m-status:empty{display:none}
.m-status i{width:calc(var(--k)*16px);height:calc(var(--k)*16px);margin-top:3px;background:var(--icon) center/contain no-repeat}
.m-vitals.low .m-bar.hp{border-color:#ff8f7a;animation:mLow 1s ease-in-out infinite}
@keyframes mLow{50%{box-shadow:0 0 10px #ff3b30d9}}

/* ---------- quest: only a chip with the arrow and the distance (tap = journal) ---------- */
.is-touch .quest.panel,.is-touch .quest{position:fixed;z-index:6;left:var(--sl);top:calc(var(--st) + var(--k)*42px);width:auto;max-width:min(44vw,300px);padding:calc(var(--k)*3px) calc(var(--k)*11px) calc(var(--k)*3px) calc(var(--k)*8px);border:1px solid #c9a35a55;border-radius:999px;background:#0b1210a6;backdrop-filter:none;pointer-events:auto;cursor:pointer}
.is-touch .quest::before,.is-touch .quest>.eyebrow,.is-touch .quest>h2,.is-touch .quest>p,.is-touch .quest .quest-progress{display:none}
.is-touch .quest:has(#objectiveNavigation[hidden]){display:none}
.is-touch #objectiveNavigation{min-width:0;margin:0;gap:5px;font:700 calc(var(--k)*12px)/1.3 var(--f-ui);color:var(--gold-300,#f3dc9b);white-space:nowrap}
.is-touch #objectiveArrow{flex-shrink:0;font-size:calc(var(--k)*14px)}
.is-touch #objectiveDistance{overflow:hidden;text-overflow:ellipsis}
.is-touch body.in-combat .quest{opacity:.55}
.is-touch.wheel-open .quest{opacity:.3}

/* ---------- target plate: only in a fight, small, top centre; tap it to lock the aim ---------- */
.is-touch .enemy-panel{top:calc(var(--st) + 2px);width:min(calc(var(--k)*230px),30vw);padding:calc(var(--k)*4px) calc(var(--k)*12px) calc(var(--k)*5px);pointer-events:auto;cursor:pointer}
.is-touch .enemy-panel::before{inset:-4px -14px;opacity:.82}
.is-touch .enemy-panel>div:first-child{gap:5px;margin-bottom:3px}
.is-touch #enemyName{font-size:calc(var(--k)*12px)}
.is-touch #enemyStrength{font-size:calc(var(--k)*7.5px);padding:0 5px}
.is-touch .enemy-panel .enemy-level{font-size:calc(var(--k)*9.5px)!important}
.is-touch .enemy-track{height:calc(var(--k)*6px)}
.is-touch .enemy-panel>small#enemyHp{display:none}
.is-touch .pressure-track{height:3px;margin-top:3px}
.is-touch #pressureLabel{display:none}
.is-touch .enemy-panel.staggered #pressureLabel{display:block;font-size:calc(var(--k)*8px);margin-top:2px}
.is-touch #enemyWarning{margin-top:3px;padding:1px 9px;font-size:0;white-space:nowrap}
.is-touch #enemyWarning::after{content:"Saia da área!";font:700 calc(var(--k)*8.5px) var(--f-caps);letter-spacing:.12em;text-transform:uppercase}
.is-touch .enemy-elements{display:none}
.is-touch .enemy-panel .status-chips{gap:3px;margin-top:3px}
.is-touch .enemy-panel .status-chip{font-size:0;padding:1px;gap:0}
.is-touch .enemy-panel .status-chip.ui-ico::before{width:13px;height:13px}
.is-touch .enemy-panel.locked::after{content:"";position:absolute;right:-6px;top:50%;width:calc(var(--k)*20px);height:calc(var(--k)*20px);transform:translateY(-50%);background:url(/assets/ui/icons/act-lock.webp) center/contain no-repeat;filter:drop-shadow(0 1px 2px #000)}

/* ---------- minimap: small, top-right; tap opens the full map ---------- */
.is-touch body[data-map] .map-corner,.is-touch .map-corner{--d:var(--mini);display:flex;top:calc(var(--st) + var(--mini)*.12 + 2px);right:calc(var(--sr) + var(--mini)*.12)}
.is-touch body.hide-minimap[data-map] .map-corner,.is-touch body.playing.immersive[data-map] .map-corner{display:none}

/* ---------- right thumb: three buttons always (attack, dodge, skills); limit, potion and jump only when useful ---------- */
.is-touch .combat-bar{position:fixed;inset:0;display:block;pointer-events:none}
.is-touch .combat-bar[hidden]{display:none}
.is-touch .bar-group{display:contents}
.is-touch .touch-actions{display:contents}
.is-touch .combat-bar button,.is-touch #touchJump,.is-touch #skillsBtn{--size:calc(var(--k)*var(--d));position:fixed;z-index:8;right:calc(var(--sr) + var(--k)*(var(--x) - var(--d)/2));bottom:calc(var(--sb) + var(--k)*(var(--y) - var(--d)/2));width:var(--size);height:var(--size);pointer-events:auto;-webkit-tap-highlight-color:transparent}
.is-touch .combat-bar button:hover{transform:none;filter:none}
.is-touch .combat-bar button:active,.is-touch #touchJump:active,.is-touch #skillsBtn:active{transform:scale(.92);filter:brightness(1.25)}
.is-touch .combat-bar button:not(#attackButton){background:radial-gradient(circle at 50% 38%,#2c3a33d9,#0d1411d9 72%);box-shadow:0 0 0 2px #0b100ebb,0 4px 12px #0008}
/* the attack: tap = combo (near) or shot/spell (far), hold = charge; a gold glow while the limit is full */
.is-touch #attackButton{--x:74px;--y:66px;--d:78px;border-width:2.5px;background:radial-gradient(circle at 50% 38%,#3a4a41e6,#0d1411e6 72%);box-shadow:0 0 0 2px #0b100ecc,0 6px 16px #0009}
.is-touch #attackButton::before{inset:17%}
.is-touch #attackButton.charging{box-shadow:0 0 0 2px #0b100ecc,0 0 24px #ffc35e}
.is-touch.limit-ready #attackButton{border-color:#ffe49a;box-shadow:0 0 0 2px #0b100ecc,0 0 22px #ffcf4ab3}
/* dodge: tap dodges, hold defends (the little shield says so) */
.is-touch #dodgeButton{--x:179px;--y:55px;--d:56px}
.is-touch #dodgeButton small{display:grid!important;inset:auto -3px -3px auto;width:calc(var(--k)*20px);height:calc(var(--k)*20px);border-radius:50%;border:1px solid var(--gold-600,#9a7638);background:url(/assets/ui/icons/act-block.webp) center/82% no-repeat,#0d1411;font-size:0}
/* skills: tap = the chosen skill (its icon, cooldown ring and seconds), hold = the wheel of five */
.is-touch #skillsBtn{--x:139px;--y:150px;--d:56px;--cd:0;display:block;padding:0;border-radius:50%;border:2px solid var(--gold-500,#c9a35a);background:var(--icon,url(/assets/ui/icons/atb.webp)) center/70% no-repeat,radial-gradient(circle at 50% 40%,#fbf3de,#e3d2a8 62%,#b49a66);box-shadow:0 0 0 2px #0b100ebb,0 4px 12px #0008;touch-action:none}
.is-touch #skillsBtn::after{content:"";position:absolute;inset:-2px;border-radius:50%;pointer-events:none;background:conic-gradient(#060a09d0 calc(var(--cd) * 360deg),transparent 0)}
.is-touch #skillsBtn.off{filter:saturate(.5) brightness(.85)}
.m-skills-cd{position:absolute;inset:0;z-index:2;display:none;place-items:center;font:900 calc(var(--k)*15px) var(--f-ui);font-variant-numeric:tabular-nums;color:#fff6dc;text-shadow:0 0 4px #000,0 2px 2px #000;pointer-events:none}
.is-touch #skillsBtn.cooling .m-skills-cd{display:grid}
.m-skills-more{position:absolute;left:50%;bottom:-7px;z-index:3;display:flex;gap:2px;padding:2px 4px;transform:translateX(-50%);border-radius:999px;border:1px solid var(--gold-600,#9a7638);background:#0d1411;pointer-events:none}
.m-skills-more i{width:3px;height:3px;border-radius:50%;background:var(--gold-300,#f3dc9b)}
.is-touch.wheel-open #skillsBtn{background:radial-gradient(circle at 50% 40%,#2c3a33,#0d1411 72%)}
.is-touch.wheel-open #skillsBtn .m-skills-more,.is-touch.wheel-open #skillsBtn .m-skills-cd{display:none}
.is-touch.wheel-open #skillsBtn::before,.is-touch.wheel-open #skillsBtn::after{content:"";position:absolute;left:50%;top:50%;inset:auto;width:44%;height:2.5px;border-radius:2px;background:var(--gold-300,#f3dc9b);transform:translate(-50%,-50%) rotate(45deg)}
.is-touch.wheel-open #skillsBtn::after{transform:translate(-50%,-50%) rotate(-45deg)}
/* the wheel: the five skills around the skills button (slide and lift, or tap) */
.is-touch #skill1{--x:139px;--y:260px;--d:52px}
.is-touch #skill2{--x:194px;--y:245px;--d:52px}
.is-touch #skill3{--x:234px;--y:205px;--d:52px}
.is-touch #skill4{--x:249px;--y:150px;--d:52px}
.is-touch #skill5{--x:234px;--y:95px;--d:52px}
.is-touch .skill-group button.wheel-hover{transform:scale(1.18);border-color:#fff2c2;box-shadow:0 0 0 2px #0b100ebb,0 0 18px #f3dc9b}
/* only when useful: the limit beside the attack, a life potion under 40 % life, jump when the hero is stuck */
.is-touch #limitButton{--x:56px;--y:160px;--d:46px}
.is-touch #potionHp{--x:252px;--y:96px;--d:48px}
.is-touch #touchJump{--x:60px;--y:228px;--d:48px}
.is-touch .skill-group button,.is-touch .command-group button,.is-touch .item-group button,.is-touch #shootButton,.is-touch #touchJump{display:none}
.is-touch.wheel-open .skill-group button:not([hidden]){display:block}
.is-touch.limit-ready:not(.wheel-open) #limitButton{display:block}
.is-touch.potion-hint:not(.wheel-open) #potionHp{display:block;animation:mPotion 1.1s ease-in-out infinite}
.is-touch.jump-hint:not(.wheel-open) #touchJump{display:block}
@keyframes mPotion{50%{box-shadow:0 0 0 2px #0b100ebb,0 0 16px #ff5a4a}}
.is-touch #limitButton:not(:disabled){border-color:#ffe49a;animation:limitBtn 1.1s ease-in-out infinite}
.is-touch .item-group button small{display:grid;inset:auto -5px -5px auto;min-width:19px;height:16px;font-size:10px}
.is-touch .combat-bar button small{font-size:calc(var(--k)*13px)}
.is-touch .combat-bar button.locked small{font-size:calc(var(--k)*8.5px)}
.is-touch #touchJump{padding:0;border-radius:50%;border:2px solid var(--gold-500,#c9a35a);background:radial-gradient(circle at 50% 38%,#2c3a33d9,#0d1411d9 72%);box-shadow:0 0 0 2px #0b100ebb,0 4px 12px #0008;font-size:0;color:transparent;touch-action:none}
.is-touch #touchJump::before{content:"";position:absolute;left:50%;top:56%;width:30%;height:30%;transform:translate(-50%,-50%) rotate(45deg);border-left:3px solid var(--gold-300,#f3dc9b);border-top:3px solid var(--gold-300,#f3dc9b)}
.is-touch #touchJump::after{content:"";position:absolute;left:50%;top:34%;width:20%;height:20%;transform:translate(-50%,-50%) rotate(45deg);border-left:2px solid #f3dc9b99;border-top:2px solid #f3dc9b99}
.wheel-veil{display:none}
.is-touch.wheel-open .wheel-veil{display:block;position:fixed;z-index:5;right:0;bottom:0;width:62%;height:100%;background:radial-gradient(circle at calc(100% - var(--sr) - var(--k)*139px) calc(100% - var(--sb) - var(--k)*150px),#060a09b8 0,#060a0980 calc(var(--k)*140px),#060a0900 calc(var(--k)*240px))}
/* ATB (two teal segments, left) and limit (gold, right) around the attack: only in a fight, while recharging or full.
   A tap on the ATB arc opens the tactical commands. */
.atk-ring{display:none}
.is-touch .atk-ring{display:block;position:fixed;z-index:9;right:calc(var(--sr) + var(--k)*20px);bottom:calc(var(--sb) + var(--k)*12px);width:calc(var(--k)*108px);height:calc(var(--k)*108px);pointer-events:none;opacity:0;transition:opacity .3s}
.is-touch .atk-ring.show{opacity:1}
.atk-ring circle{fill:none;stroke-width:5;stroke-linecap:round}
.atk-ring .ring-track{stroke:#0b1210b8;stroke-dasharray:61.02 289.03}
.atk-ring .ring-track.limit{stroke-dasharray:128.46 289.03}
.atk-ring .ring-fill{stroke-dasharray:0 289.03;transition:stroke-dasharray .2s}
.atk-ring .ring-fill.atb{stroke:#4fe0cf}
.atk-ring .ring-fill.limit{stroke:#f2bf3a}
.atk-ring .ring-hit{stroke:transparent;stroke-width:12;stroke-linecap:butt;stroke-dasharray:142.4 320.4;pointer-events:none}
.is-touch .atk-ring.show .ring-hit{pointer-events:stroke}
.atk-ring.full-atb .ring-fill.atb{stroke:#a8fff1}
.atk-ring.ready .ring-fill.limit{stroke:#fff0b0;animation:ringReady 1.1s ease-in-out infinite}
@keyframes ringReady{50%{stroke:#ffcf4a;filter:drop-shadow(0 0 4px #ffcf4a)}}

/* ---------- floating stick (left thumb): appears where the thumb lands; a faint hint until the first touch ---------- */
.is-touch #touch{display:block}
.is-touch .touch-move{position:fixed;z-index:4;left:0;bottom:0;top:32%;width:45%;touch-action:none}
.is-touch #joystick{--r:calc(var(--k)*46px);position:fixed;z-index:5;left:calc(var(--sl) + var(--r) + 24px);top:calc(100% - var(--sb) - var(--r) - 18px);bottom:auto;width:calc(var(--r)*2);height:calc(var(--r)*2);margin:0;transform:translate(-50%,-50%);border-radius:50%;border:1.5px solid #e2c47a59;background:radial-gradient(circle,#0b121026 0 55%,#0b121059 100%);pointer-events:none;opacity:.32;transition:opacity .25s}
.is-touch.stick-used #joystick{opacity:0}
.is-touch #joystick.active{opacity:.9;transition:none}
.is-touch #joystick i{position:absolute;pointer-events:none;left:50%;top:50%;width:calc(var(--r)*.82);height:calc(var(--r)*.82);margin:calc(var(--r)*-.41) 0 0 calc(var(--r)*-.41);border-radius:50%;background:radial-gradient(circle at 45% 40%,#fbf3dee6,#c9a35acc 80%);border:1.5px solid #c9a35acc;box-shadow:0 3px 8px #0009}
.is-touch body:not(.playing) #touch,.is-touch body:not(.playing) .mobile-hud{display:none}

/* ---------- prompts, notices (thin strip that fades), numbers ---------- */
.is-touch #interaction{position:fixed;left:auto;right:calc(var(--sr) + var(--k)*236px);bottom:calc(var(--sb) + var(--k)*132px);transform:none;z-index:7}
.is-touch #interactBtn{min-height:44px;padding:4px 16px 4px 5px;gap:8px;font-size:calc(var(--k)*12.5px);max-width:42vw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background:linear-gradient(#18241fd9,#0b1210d9)}
.is-touch #interactBtn kbd{width:calc(var(--k)*30px);height:calc(var(--k)*30px);flex-shrink:0;font-size:0}
.is-touch #interactBtn kbd::after{content:"";width:9px;height:12px;background:url(/assets/ui/frames/jewel.webp) center/contain no-repeat}
.is-touch #toast,.is-touch .combat-toast{top:calc(var(--st) + var(--k)*54px);max-width:min(460px,52vw);padding:4px 22px;font:600 calc(var(--k)*12.5px)/1.35 var(--f-serif)}
.is-touch #toast::before,.is-touch .combat-toast::before{inset:-3px -8px;opacity:.85}
.is-touch body.in-combat #toast,.is-touch body.in-combat .combat-toast{top:calc(var(--st) + var(--k)*72px)}
.is-touch #toast{background-size:100% 100%}
.is-touch .level-celebration{top:15%;width:min(calc(var(--k)*360px),60vw);padding:calc(var(--k)*10px) 14px}
.is-touch .level-celebration span{font-size:9px}
.is-touch .level-celebration strong{font-size:calc(var(--k)*28px);margin:2px}
.is-touch .level-celebration p{font-size:calc(var(--k)*12px);margin:0}
.is-touch .level-celebration small{font-size:11px}
.is-touch .damage-number b{font-size:calc(var(--k)*26px);-webkit-text-stroke:4px #160c06}
.is-touch .damage-number.critical b{font-size:calc(var(--k)*36px);-webkit-text-stroke:5px #2a1300}
.is-touch .damage-number.incoming b,.is-touch .damage-number.resisted b{font-size:calc(var(--k)*21px)}
.is-touch .damage-number small{font-size:calc(var(--k)*8px)}
.is-touch #debug{top:auto;bottom:calc(var(--sb) + 60px);right:auto;left:50%;transform:translateX(-50%)}

/* ---------- tactical commands: a sheet on the left ---------- */
.is-touch .tactical-panel{left:var(--sl);top:calc(var(--st) + 4px);bottom:calc(var(--sb) + 4px);width:min(calc(var(--k)*360px),48vw);max-height:none;padding:14px 16px;overflow:auto;overscroll-behavior:contain;z-index:46}
.is-touch .tactical-panel::before{width:54px;height:54px;top:6px;left:6px}
.is-touch .tactical-panel small#tacticalMode{padding-left:22px;font-size:9px}
.is-touch .tactical-panel h2{font-size:calc(var(--k)*20px);margin:6px 0 10px;padding-left:22px}
.is-touch .tactical-panel button{min-height:48px;margin-top:6px;padding:8px 12px 8px 60px;font-size:13px}
.is-touch .tactical-panel button::before{width:38px;height:38px}
.is-touch .tactical-panel #tacticalClose{min-height:46px}

/* ---------- death ---------- */
.is-touch .death-screen>div{padding:16px 24px;max-width:min(520px,80vw)}
.is-touch .death-screen h2{font-size:calc(var(--k)*34px);margin:8px 0}
.is-touch .death-screen p{font-size:14px;line-height:1.5;margin:0 0 16px}

/* ---------- title screen and login (phone) ---------- */
.is-phone #intro{position:fixed;left:calc(var(--sl) + 8px);top:0;bottom:0;transform:none;width:min(440px,58vw);overflow-y:auto;overscroll-behavior:contain;padding:max(14px,calc(50dvh - 168px)) 4px 16px 0;scrollbar-width:none}
.is-phone #intro::-webkit-scrollbar{display:none}
.is-phone #intro .intro-kicker,.is-phone #intro .intro-footer{display:none}
.is-phone #intro h1{margin:0 0 2px;font-size:clamp(38px,11.5dvh,50px);line-height:1;white-space:nowrap}
.is-phone #intro h1 br{display:none}
.is-phone #intro .ornament{width:190px;height:16px;margin:6px 0 8px}
.is-phone #intro h2{margin:0 0 6px;font-size:17px}
.is-phone #intro>p{max-width:none;margin:0 0 14px;font-size:13px;line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.is-phone #intro .primary{height:52px;min-width:min(280px,100%);padding:0 26px 0 30px;font-size:14px}
.is-phone #intro .intro-links{gap:4px 22px;margin-top:4px}
.is-phone #intro .intro-links .text-btn{min-height:44px;padding:8px 0}
.is-phone #intro.login-open>p,.is-phone .status,.is-phone body:not(.playing) .status{display:none!important}
.is-phone #intro.login-open h1{font-size:clamp(34px,10dvh,46px)!important;margin-bottom:2px}
.is-phone #intro.login-open .ornament,.is-phone #intro.login-open h2{display:none}
.is-phone .login-form{gap:8px;margin:6px 0 4px}
.is-phone .login-form input{height:44px}
.is-phone .login-error{min-height:0}
.is-phone .intro-scene-note{right:calc(var(--sr) + 6%);bottom:18%}
.is-phone .intro-scene-note p{font-size:19px}
.is-touch body:not(.playing) .topbar .brand{display:none}
.is-phone .loading-title{font-size:clamp(40px,12dvh,64px);margin:4px 0 10px}
.is-phone .loading-tip{min-height:0;padding:10px 8px 10px 4px;margin-bottom:12px;font-size:14px}
.is-phone .loading-content{margin-bottom:max(5dvh,16px)}

/* ---------- windows on a phone: full-screen sheets with a low header ---------- */
.is-phone dialog.modal{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;border-radius:0;border:0;padding:calc(var(--st) + 4px) var(--sr) calc(var(--sb) + 4px) var(--sl);overflow:auto;overscroll-behavior:contain;box-shadow:inset 0 0 0 4px #0b1210,inset 0 0 0 5px #c9a35a33,inset 0 0 60px #000a}
.is-phone dialog.modal .modal-head{position:sticky;top:calc(-4px - var(--st));z-index:4;align-items:center;gap:12px;margin:0 0 10px;padding:6px 0 8px;background:linear-gradient(#0d1613 75%,#0d161300)}
.is-phone dialog.modal .modal-head::after{left:0;right:auto;width:150px;height:10px;bottom:0;opacity:.6}
.is-phone dialog.modal .modal-head .eyebrow{display:none}
.is-phone dialog.modal .modal-head h2{margin:0;font-size:22px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.is-phone dialog.modal .close{width:46px;height:46px;font-size:28px}
.is-phone .head-actions{gap:8px}
.is-phone dialog::backdrop{backdrop-filter:none}

/* inventory, map, journal: tabs in a column on the left, content on the right */
.is-phone #mapModal[open]{display:grid;grid-template-columns:minmax(132px,19vw) minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);column-gap:16px;overflow:hidden}
.is-phone #mapModal .modal-head{grid-column:1/-1;position:static}
.is-phone #mapModal .inventory-tabs{grid-column:1;grid-row:2;align-self:start;flex-direction:column;gap:6px;margin:0;padding:0;border:0}
.is-phone #mapModal .inventory-tabs [role=tab]{position:relative;display:flex;align-items:center;gap:8px;width:100%;min-height:52px;padding:8px 10px 8px 46px;text-align:left;border:1px solid #c9a35a33;border-radius:8px;font-size:11px;line-height:1.25;letter-spacing:.08em;white-space:normal}
.is-phone #mapModal .inventory-tabs [role=tab]::before{content:"";position:absolute;left:8px;top:50%;width:30px;height:30px;transform:translateY(-50%);background:url(/assets/ui/icons/map.webp) center/contain no-repeat}
.is-phone #mapModal #inventoryItemsTab::before{background-image:url(/assets/ui/icons/bag.webp)}
.is-phone #mapModal #inventoryJournalTab::before{background-image:url(/assets/ui/icons/journal.webp)}
.is-phone #mapModal .inventory-tabs [aria-selected=true]{border-color:var(--gold-400,#e2c47a);background:linear-gradient(90deg,#c9a35a2e,#c9a35a0a)}
.is-phone #mapModal .inventory-tabs kbd{display:none}
.is-phone #mapModal [role=tabpanel]{grid-column:2;grid-row:2;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0 2px 8px 0}
.is-phone #mapModal .inventory-footnote,.is-phone #mapModal .inventory-map-heading,.is-phone #mapModal .inventory-legend,.is-phone #mapModal .map-bottom{display:none}
.is-phone #mapModal .map-zoom-controls{gap:8px;margin:0 0 8px}
.is-phone #mapModal .map-zoom-controls button{min-width:44px;min-height:44px}
.is-phone #mapModal .map-zoom-controls small{display:none}
.is-phone #mapModal .map-wrap canvas{height:calc(100dvh - var(--st) - var(--sb) - 136px);width:auto;max-width:100%}
.is-phone #mapModal .inventory-pouch,.is-phone #mapModal .inventory-journal{min-height:0;padding:0 2px 8px}
.is-phone .inventory-item{padding:12px 14px;gap:14px;max-width:none}
.is-phone .inventory-item-icon{width:52px;height:52px}
.is-phone .inventory-item h3{font-size:16px}
.is-phone .rpg-inventory{margin-top:14px;padding-top:12px}
.is-phone .inventory-section-title{font-size:20px;margin:4px 0 10px}
.is-phone .character-stats{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
.is-phone .character-stats>div{padding:8px 6px}
.is-phone .character-stats b{font-size:19px}
.is-phone .gear-item{min-width:0;width:calc(50% - 6px);min-height:64px;margin:0 6px 6px 0;padding:10px 10px 10px 64px}
.is-phone .gear-item.ui-ico::before{width:44px;height:44px}
.is-phone #skillJournal{grid-template-columns:1fr 1fr;gap:8px}
.is-phone .skill-entry{padding:10px 10px 10px 64px}
.is-phone .skill-entry.ui-ico::before{width:42px;height:42px;left:10px;top:10px}
.is-phone .skill-upgrade{min-height:40px}
.is-phone .inventory-journal #journalEntries{grid-template-columns:1fr}
.is-phone .journal-quest{padding:10px 12px 10px 60px}
.is-phone .journal-quest.ui-ico::before{width:38px;height:38px;left:10px;top:10px}

/* settings: two columns of sections */
.is-phone #settingsModal[open]{display:block}
.is-phone #settingsModal .settings-body{column-count:2;column-gap:28px}
.is-phone #settingsModal .settings-section{break-inside:avoid;margin:0 0 14px;padding:0 0 12px}
.is-phone #settingsModal .equipment-menu-entry,.is-phone #settingsModal .settings-note,.is-phone #settingsModal .settings-actions,.is-phone #settingsModal .settings-footer{column-span:all}
.is-phone #settingsModal .equipment-menu-entry{margin:0 0 10px;padding:12px 14px 12px 64px;font-size:15px;min-height:56px}
.is-phone #settingsModal .settings-actions{margin-top:8px}
.is-phone .preset-row button{min-height:48px}
.is-phone .setting-toggle input{width:24px;height:24px}
.is-phone .setting-range input{height:30px}
.is-phone .binding-row button{min-height:44px}
.setting-auto{margin:-8px 0 12px!important;font:500 12px/1.5 var(--f-ui,inherit)!important;color:var(--gold-400,#e2c47a)!important}
.is-touch #settingsModal .binding-list,.is-touch #settingsModal .binding-actions,.is-touch #settingsModal [data-binding-message]{display:none}
.is-touch #settingsModal .settings-section:has(#bindingList)>legend::after{content:" · teclado e controle"}
.is-touch #settingsModal .settings-section:has(#bindingList)::after{content:"No celular os comandos ficam na tela. As teclas valem para teclado e controle.";display:block;font:500 12px/1.5 var(--f-ui);color:var(--text-mute,#939c88)}

/* equipment: hero portrait on the left, slots on the right */
.is-phone #equipmentModal[open]{display:grid;grid-template-columns:minmax(150px,24vw) minmax(0,1fr);grid-template-rows:auto auto minmax(0,1fr);column-gap:16px;overflow:hidden}
.is-phone #equipmentModal .modal-head{grid-column:1/-1;position:static}
.is-phone #equipmentHero{grid-column:2;grid-row:2;margin:0 0 6px;font-size:12px!important}
.is-phone #equipmentModal .equipment-layout{display:contents}
.is-phone #equipmentModal .equipment-portrait{grid-column:1;grid-row:2/4;position:static;align-self:start;width:100%;margin:0;padding:6px 0 10px}
.is-phone #equipmentModal .equipment-portrait canvas{max-height:calc(100dvh - var(--st) - var(--sb) - 130px);width:auto;max-width:100%;margin:0 auto}
.is-phone #equipmentModal .equipment-portrait figcaption{font-size:18px}
.is-phone #equipmentModal .equipment-details{grid-column:2;grid-row:3;min-height:0;overflow:auto;overscroll-behavior:contain;padding-bottom:8px}
.is-phone .hero-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.is-phone .hero-stats div{padding:8px 10px}
.is-phone .hero-stats div.ui-ico{padding-left:46px}
.is-phone .hero-stats div.ui-ico::before{left:8px;width:28px;height:28px}
.is-phone .hero-stats b{font-size:18px}
.is-phone .equipment-slots{grid-template-columns:1fr 1fr;gap:10px}
.is-phone .equipment-slots section{padding:10px}
.is-phone .equipment-slots button{min-height:48px}

/* help: the touch controls */
.touch-guide{display:none}
.is-touch .help-modal .binding-grid,.is-touch .help-modal .touch-copy,.is-touch .help-modal>p[data-t=helpIntro]{display:none}
.is-touch .touch-guide{display:grid;grid-template-columns:1fr 1fr;gap:10px 18px;margin:10px 0 14px;padding:0;list-style:none}
.is-touch .touch-guide li{position:relative;min-height:52px;padding:4px 0 4px 56px;font:500 13px/1.45 var(--f-ui);color:var(--text-dim,#c5c7b2)}
.is-touch .touch-guide li::before{content:"";position:absolute;left:0;top:4px;width:44px;height:44px;border-radius:50%;border:2px solid var(--gold-500,#c9a35a);background:var(--icon) center/68% no-repeat,radial-gradient(circle,#fbf3de,#d8c393)}
.is-touch .touch-guide b{display:block;font:700 12px var(--f-caps);letter-spacing:.1em;color:var(--gold-300,#f3dc9b)}
.is-phone .help-modal .guide-art{display:none}
.is-phone .help-modal>p{margin:0}

/* book and exploration windows */
.is-phone .book-page{min-height:0;padding:16px 20px}
.is-phone .book-page p{font-size:17px}
.is-phone .expedition-modal section{padding:10px 0}

/* NPC conversation and shop: a bottom sheet, the world stays visible above */
.is-phone .dialogue{left:var(--sl);right:var(--sr);top:auto;bottom:0;width:auto;max-width:none;margin:0;max-height:min(80dvh,340px);padding:12px 18px calc(var(--sb) + 6px);border-radius:12px 12px 0 0;overflow:auto;overscroll-behavior:contain}
.is-phone .dialogue[open]{gap:14px}
.is-phone .dialogue::before{width:44px;height:44px;left:6px;top:6px}
.is-phone .dialogue-symbol{min-width:46px;width:46px;height:46px;margin-top:10px}
.is-phone .dialogue .eyebrow{font-size:9px}
.is-phone .dialogue h2{font-size:22px;margin:2px 0 6px}
.is-phone .dialogue p{font-size:15px;line-height:1.55}
.is-phone .dialogue #dialogueClose{min-height:46px;padding:8px 0 4px}
.is-phone .shop-offers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:10px 0 4px}
.is-phone .shop-offers p{grid-column:1/-1}
.is-phone .shop-offers button{min-height:50px;padding:6px 8px;font-size:12px;line-height:1.3}
.is-phone .shop-offers button.ui-ico{padding-left:44px}
.is-phone .shop-offers button.ui-ico::before{width:30px;height:30px;left:7px}

/* hero choice: header in one line, the five heroes side by side, a compact confirm button */
.is-phone .class-select{padding:calc(var(--st) + 2px) var(--sr) calc(var(--sb) + 2px) var(--sl)}
.is-phone .class-panel{width:100%;height:100%;max-height:none;padding:8px 12px 0;border-radius:10px}
.is-phone .class-panel header{display:flex;align-items:baseline;justify-content:center;gap:12px;margin:0 0 6px}
.is-phone .class-panel header .eyebrow{font-size:9px}
.is-phone .class-panel h2{margin:0;font-size:21px}
.is-phone .class-panel header::after,.is-phone .class-panel header p{display:none}
.is-phone .class-grid{gap:6px}
.is-phone .class-card{--art-h:clamp(96px,calc(100dvh - 230px),190px)}
.is-phone .class-card[aria-checked=true]{flex-grow:3.4;padding:10px 12px 8px 40%}
.is-phone .class-card[aria-checked=true]::before{width:40%}
.is-phone .class-card[aria-checked=true] .class-head b{font-size:17px}
.is-phone .class-head em{font-size:9px;letter-spacing:.08em}
.is-phone .class-card[aria-checked=true] .class-story{-webkit-line-clamp:2;font-size:12px;margin:4px 0}
.is-phone .class-card[aria-checked=true] .class-blurb{display:none}
.is-phone .class-stats{margin:4px 0 0;gap:5px}
.is-phone .class-stats span{padding:3px 7px}
.is-phone .class-stats strong{font-size:15px}
.is-phone .class-card[aria-checked=true] .class-skills-title{padding-top:5px;margin-bottom:4px;font-size:8px}
.is-phone .class-card[aria-checked=true] .class-skills{flex-direction:row;flex-wrap:wrap;gap:5px}
.is-phone .class-skills li{width:28px;height:28px;min-height:0;padding:0;font-size:0}
.is-phone .class-skills li b,.is-phone .class-skills li small{display:none!important}
.is-phone .class-skills li::before{width:26px;height:26px}
.is-phone .class-panel footer{margin:6px -12px 0;padding:6px 12px 8px;justify-content:center}
.is-phone .class-note{display:none}
.is-phone #classConfirm{width:auto;height:46px;min-width:min(320px,60vw);align-self:center}

/* menu: six big tiles plus full screen, install and title screen */
.phone-menu{width:min(620px,calc(100vw - 24px))}
.is-phone dialog.phone-menu,.is-phone dialog.install-guide{inset:0;width:min(620px,calc(100% - var(--sl) - var(--sr)));height:auto;max-height:calc(100% - var(--st) - var(--sb) - 8px);margin:auto;border:1px solid var(--gold-600,#9a7638);border-radius:12px;padding:12px 18px 16px}
.is-phone dialog.phone-menu .modal-head,.is-phone dialog.install-guide .modal-head{position:static;margin-bottom:8px}
.is-phone dialog.phone-menu{padding:8px 16px 12px}
/* eight tiles (four per row), then the potions with their counts, install and title screen, then the status line */
.phone-menu-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.phone-menu-grid button{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:5px;min-height:76px;padding:8px 4px;border:1px solid var(--gold-600,#9a7638);border-radius:10px;background:linear-gradient(#1b2923,#0e1613);color:var(--gold-300,#f3dc9b)}
.phone-menu-grid button::before{content:"";width:38px;height:38px;border-radius:50%;background:var(--icon) center/72% no-repeat,radial-gradient(circle,#2b3b33,#0c1411);border:1px solid var(--gold-600,#9a7638)}
#menuFullscreen::before{background-size:56%}
.phone-menu-grid b{font:700 11px var(--f-caps);letter-spacing:.06em;text-align:center}
@media(max-height:370px){.is-phone .phone-menu-grid button{min-height:64px;gap:3px}.is-phone .phone-menu-grid button::before{width:32px;height:32px}.is-phone dialog.phone-menu .modal-head{margin-bottom:4px;padding:2px 0 4px}}
.phone-menu-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-top:8px}
.menu-items{display:contents}
.menu-items::after{content:"";flex:1 1 0}
.menu-items button{display:flex;align-items:center;gap:6px;min-height:46px;padding:4px 10px 4px 4px;border:1px solid var(--gold-600,#9a7638);border-radius:10px;background:linear-gradient(#1b2923,#0e1613);color:var(--gold-300,#f3dc9b);font:700 11px var(--f-caps);letter-spacing:.06em}
.menu-items button::before{content:"";width:34px;height:34px;flex-shrink:0;border-radius:50%;background:var(--icon) center/76% no-repeat,radial-gradient(circle,#2b3b33,#0c1411);border:1px solid var(--gold-600,#9a7638)}
.menu-items button small{font:800 13px var(--f-ui);letter-spacing:0;color:var(--paper,#efe3c4)}
.menu-items button:disabled{opacity:.45}
.menu-status{margin:8px 2px 0!important;font:600 12px/1.5 var(--f-ui)!important;color:var(--text-dim,#c5c7b2)!important}
.menu-status:empty{display:none}
.phone-menu-row>button{flex:0 0 auto;min-height:46px;padding:8px 14px;border:1px solid var(--gold-600,#9a7638);border-radius:8px;background:#0e1613;font:700 11px var(--f-caps);letter-spacing:.1em;color:var(--paper,#efe3c4)}

/* iPhone: how to play full screen (home screen icon) */
.install-guide{width:min(560px,calc(100vw - 24px))}
.install-lead{margin:0 0 10px!important;font:500 14px/1.5 var(--f-ui)!important;color:var(--text,#f1e9d4)!important}
.install-steps{display:grid;gap:10px;margin:0 0 14px;padding:0;list-style:none;counter-reset:step}
.install-steps li{display:flex;align-items:center;gap:12px;font:500 14px/1.45 var(--f-ui);color:var(--text-dim,#c5c7b2)}
.install-steps b{color:var(--gold-300,#f3dc9b)}
.install-ico{display:grid;place-items:center;flex-shrink:0;width:44px;height:44px;border-radius:10px;border:1px solid var(--gold-600,#9a7638);background:#0b1210;color:#6cb4ff}
.install-ico svg{width:26px;height:26px}
.install-ico.app{overflow:hidden;padding:0;border-radius:10px}
.install-ico.app img{width:100%;height:100%;display:block}
.install-ok{margin:0 auto;min-width:220px;height:52px}
@media(min-width:620px){.install-steps{grid-template-columns:repeat(3,1fr)}.install-steps li{flex-direction:column;text-align:center}}

@media(prefers-reduced-motion:reduce){.rotate-phone i{animation:none;transform:rotate(-90deg)}}
