/* NOCTURNE / experimental art direction — all overrides isolated from V8.26. */
:root{--gold:#dcc38e;--mist:#99c7c6;--panel:#14252b;--ink:#f0eee1}
body{background:#071117;color:var(--ink)}
button,input,select{font-family:'Segoe UI',Arial,sans-serif}button{transition:background .18s,border-color .18s,box-shadow .18s,transform .18s}
.overlay{background:rgba(3,10,15,.76);backdrop-filter:blur(10px)}
.panel{border:1px solid #b9a67766;border-radius:6px;background:linear-gradient(140deg,#172b32f5,#08141df7);box-shadow:0 25px 100px #000b,inset 0 0 0 4px #080f1555;max-height:92dvh}
.panel h1{font-family:Georgia,'Times New Roman',serif;font-weight:400;color:#eddbb3;letter-spacing:3px}
.panel .sub{line-height:1.65;color:#a8bcc0}.btn-primary{border:1px solid #e9d3a1;border-radius:3px;background:linear-gradient(110deg,#ead8ae,#b89c65);color:#122126;box-shadow:0 4px 18px #0005;font-weight:700;letter-spacing:1.6px}
.btn-primary:hover:not(:disabled){background:linear-gradient(110deg,#faecca,#ceb77e);box-shadow:0 0 25px #ddc08733;transform:translateY(-1px)}
.btn-primary:disabled{opacity:.45}.card,.shop-item,.academy-card,.forge-section{border-radius:5px;border:1px solid #809c9944;background:linear-gradient(135deg,#20383b,#101f28);box-shadow:inset 0 1px #f4e7c411}
.card:hover,.shop-item:not(.disabled):hover{border-color:#cdb886;transform:translateY(-2px)}
#selectOverlay{background:linear-gradient(90deg,#041017c9 0%,#08141a77 48%,#07111711 100%),url('../assets/ui/nocturne-pixel/title.png') center/cover no-repeat;backdrop-filter:none;align-items:flex-start;overflow:auto;padding:0;touch-action:pan-y}
#selectOverlay::before{content:'';position:fixed;inset:0;pointer-events:none;background:linear-gradient(0deg,#050d14f5,transparent 64%);z-index:0}
#selectOverlay>.panel{position:relative;z-index:1;box-shadow:none;border:0;background:none;width:min(1560px,100%);max-width:none;max-height:none;overflow:visible;margin:auto;padding:36px clamp(20px,4vw,64px) 26px;border-radius:0;text-align:left}
.edition-line{display:flex;align-items:center;gap:16px;color:#ddc492;font-size:10px;letter-spacing:3px;margin-bottom:27px;text-transform:uppercase}
.edition-line::before{content:'';width:36px;height:1px;background:#d6bd85}.edition-line a{color:#bdc9c7;letter-spacing:1px;margin-left:auto;text-decoration:none;padding:7px 10px;border:1px solid #acc7c033;border-radius:2px}
.edition-line a:hover{color:#fff;border-color:#d7bd87}
#selectOverlay h1{font-family:Georgia,'Times New Roman',serif;font-size:clamp(34px,4.2vw,66px);font-weight:400;line-height:1.08;letter-spacing:4px;max-width:710px;text-shadow:0 4px 30px #000a;margin:0 0 15px;color:#efdfb9}
#selectOverlay>.panel>.sub{max-width:500px;text-align:left;font-size:12px;line-height:1.7;color:#bdcdc9;margin:0 0 14px}
.edition-tagline{font-family:Georgia,serif;font-style:italic;font-size:18px;color:#bad2ce;margin-bottom:15px}
#checkpointNote{margin:5px 0 8px;max-width:500px;font-size:11px;min-height:0;color:#9fc7c7}
#checkpointNote:empty{display:none}#continueRunBtn{margin:12px 0;width:240px;font-size:11px;padding:12px 20px}
#selectOverlay .stars-info{display:inline-block;font-size:11px;color:#d6c490;margin:0 20px 12px 0}
#selectOverlay .academy-btn{display:inline-block;width:auto;border:1px solid #acc2b655;background:#13292dad;color:#dec995;border-radius:3px;padding:9px 15px;font-size:10px;letter-spacing:1px;margin:0 0 12px;box-shadow:none}
.roster-heading{display:flex;align-items:center;gap:16px;font-size:10px;letter-spacing:2.4px;color:#a2bebd;margin:10px 0 13px}.roster-heading::after{content:'';height:1px;flex:1;background:linear-gradient(90deg,#8aa9a766,transparent)}
#selectOverlay .hero-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:10px;justify-content:stretch;margin:0}
#selectOverlay .hero-card{min-width:0;max-width:none;width:100%;padding:0 11px 13px;border:1px solid #849c944f;border-radius:4px;background:linear-gradient(180deg,#163039aa,#0c1b24ee 58%,#08151df5);box-shadow:0 12px 25px #0004;overflow:hidden;filter:none}
#selectOverlay .hero-card:hover{transform:translateY(-6px);border-color:#dfcc97;box-shadow:0 12px 28px #0008,0 0 20px #9fd9c31a}
#selectOverlay .hero-icon{height:137px;margin:0 -10px 9px;font-size:52px!important;display:flex;align-items:center;justify-content:center;background-size:400% 200%;background-repeat:no-repeat;filter:drop-shadow(0 4px 8px #0005);mask-image:linear-gradient(#000 78%,transparent)}
.art-portraits-ready #selectOverlay .hero-icon{font-size:0!important;background-image:none}
.hero-card[data-hero=warrior] .hero-icon{background-position:0 0}.hero-card[data-hero=archer] .hero-icon{background-position:33.333% 0}.hero-card[data-hero=healer] .hero-icon{background-position:66.666% 0}.hero-card[data-hero=bard] .hero-icon{background-position:100% 0}
.hero-card[data-hero=rogue] .hero-icon{background-position:0 100%}.hero-card[data-hero=pyromancer] .hero-icon{background-position:33.333% 100%}.hero-card[data-hero=mage] .hero-icon{background-position:66.666% 100%}
#selectOverlay .hero-card h2{font-family:Georgia,serif;font-size:13px;font-weight:400;letter-spacing:1.8px;color:#ead9b3;text-align:left;margin-bottom:8px}
#selectOverlay .hero-card p{font-size:10px;line-height:1.45;min-height:43px;color:#9db3b6;text-align:left}
#selectOverlay .hero-stats{margin:9px 0;padding:8px 0;border-top:1px solid #92b3ab22;border-bottom:1px solid #92b3ab22;font-size:10px;gap:3px}
#selectOverlay .hero-stats b{color:#d5dfd7}#selectOverlay .ult-card{border:0;border-radius:0;background:none;padding:0;margin-top:8px;box-shadow:none}
#selectOverlay .uc-label{font-size:8px;letter-spacing:1px;color:#8ca4a6}#selectOverlay .uc-name{font-size:10px;color:#cdbb91;line-height:1.45}#selectOverlay .uc-desc{font-size:9px;line-height:1.4;color:#859ca3}
#selectOverlay .hero-card.locked{border-style:solid;background:linear-gradient(180deg,#121d26bb,#08121dee)}
#selectOverlay .hero-card.locked .hero-icon{filter:grayscale(.6) brightness(.7)}#selectOverlay .hero-card.locked::after{display:none}
#selectOverlay .hero-card.locked .lock-badge{top:8px;right:7px;font-size:9px;border-radius:2px;padding:4px 6px;background:#17262eed;color:#d8c599;border:1px solid #ad9a6c77;box-shadow:0 2px 8px #0006}
.edition-footer{display:flex;justify-content:space-between;gap:16px;margin-top:20px;color:#7d989e;font-size:9px;letter-spacing:1px;line-height:1.6}
.portrait{border:1px solid #b7a172;border-radius:50%;box-shadow:0 0 0 3px #102329,0 0 0 4px #61797a55;background:radial-gradient(circle,#41606b,#111d2a)}
.hp-bar,.xp-bar{border-radius:2px;border-color:#b5b08b66;box-shadow:0 3px 12px #0007}.hp-fill{background:linear-gradient(90deg,#62302e,#b46750)!important}.xp-fill{background:linear-gradient(90deg,#347b80,#9ee4d5)!important}
.wave-box{border:1px solid #a8bfad55;border-radius:3px;background:linear-gradient(#142932ee,#09151dee);box-shadow:0 5px 25px #0005}
.skill{border:1px solid #bfa772;background:radial-gradient(circle at 40% 30%,#34545f,#101f2c 65%);box-shadow:0 0 0 4px #081820cc,0 0 0 5px #57717688,0 8px 25px #0009}
.skill.ult{border-color:#edd7a4;background:radial-gradient(circle at 40% 30%,#605b43,#172632 65%)}
#expeditionHud{background:linear-gradient(90deg,#091821f2,#10272dde);border:1px solid #96b2aa44;border-left:2px solid #c9b583;border-radius:3px;box-shadow:0 4px 24px #0005;padding:12px 16px}
#villageNav{background:#0a1b24ed;border:1px solid #9eaf9266;border-radius:4px;box-shadow:0 5px 25px #0007;padding:7px}
#villageNav button{border-radius:2px;border-color:#89aaa544;background:#142d34;color:#ccdbd4;font-size:10px}
#villageNav button.active{background:#cab686;color:#12242a;border-color:#f0dbab}
#tutorialCard{background:#0c2029f2;border:1px solid #b8ad7b88;border-radius:4px;box-shadow:0 12px 40px #0007}
#bossBar{border-color:#ab7879;background:#21171eee;box-shadow:0 4px 25px #0008}
.shop-coins{color:#ddc899}.shop-item .si-icon{background:#0b1e2788;border:1px solid #91b3ac33;border-radius:5px;padding:8px}.si-name{color:#e1d6bc}.si-desc{line-height:1.55}
#waveBanner .wbin{background:linear-gradient(90deg,transparent,#07141eee 25%,#07141eee 75%,transparent);border-top:1px solid #c3b18166;border-bottom:1px solid #c3b18166;border-radius:0;padding:20px 70px}
#waveBanner .wbn{font-family:Georgia,serif;color:#e3c990;text-shadow:0 0 22px #a8e9ec33}#waveBanner .wbth{font-family:Georgia,serif;letter-spacing:4px}
@media(min-width:1600px){#selectOverlay .hero-icon{height:175px}#selectOverlay>.panel{padding-top:45px}#selectOverlay .hero-card p{font-size:11px}}
@media(max-width:1000px){#selectOverlay .hero-grid{grid-template-columns:repeat(4,minmax(0,1fr))}#selectOverlay>.panel{padding:22px}#selectOverlay h1{max-width:600px}.edition-line{margin-bottom:20px}#selectOverlay .hero-icon{height:150px}#selectOverlay .hero-card p{min-height:30px}#selectOverlay .hero-stats{display:flex;flex-wrap:wrap;justify-content:space-between;gap:5px}#selectOverlay .hero-stats>div{flex:1 0 40%}}
@media(max-width:600px){#selectOverlay{background-position:62% center}#selectOverlay>.panel{padding:18px 14px}#selectOverlay h1{font-size:35px;letter-spacing:2px;max-width:340px}.edition-line{font-size:8px;letter-spacing:1.3px;gap:8px;margin-bottom:24px}.edition-line::before{width:16px}.edition-line a{font-size:8px;padding:6px}.edition-tagline{font-size:15px}#selectOverlay>.panel>.sub{font-size:11px;max-width:340px}#selectOverlay .hero-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}#selectOverlay .hero-icon{height:164px}#selectOverlay .hero-card h2{font-size:14px}.edition-footer{flex-direction:column;gap:5px}#villageNav{max-width:calc(100vw - 20px);overflow:auto}#villageNav button{padding:7px;font-size:9px}.panel{max-height:94dvh}.edition-footer{padding-bottom:env(safe-area-inset-bottom)}}
@media(prefers-reduced-motion:reduce){button{transition:none}#selectOverlay .hero-card:hover{transform:none}}
/* Animated starter looks and accurate equipment previews. */
#selectOverlay .hero-icon.animated-portrait{background-image:none!important;mask-image:linear-gradient(#000 92%,transparent)}
canvas.anim-look{position:static;inset:auto;width:112px;height:112px;display:block;max-width:100%;pointer-events:none}
#selectOverlay .hero-icon.animated-portrait canvas{width:auto;height:100%;max-width:none;aspect-ratio:1}
.shop-item .si-icon.gear-preview{padding:0;width:100px;min-width:100px;height:108px;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse,#2b434555,#0a171c99)}
.gear-appearance{font-size:10px;line-height:1.45;color:#a8c4c5;margin-top:6px;font-style:italic}
@media(max-width:600px){.shop-item .si-icon.gear-preview{width:72px;min-width:72px;height:90px}.gear-appearance{font-size:9px}}

/* Pixel art stays sharp in both the world and equipment previews. */
canvas,.anim-look{image-rendering:pixelated}

/* ========================================================================== 
   TOUCH PHONE UI v10
   Phone-only responsive layer. Desktop/non-touch layout is intentionally
   untouched. Uses body.is-touch set by runtime/bootstrap.js.
   ========================================================================== */
body.is-touch{
  --phone-safe-top:max(6px,env(safe-area-inset-top));
  --phone-safe-right:max(6px,env(safe-area-inset-right));
  --phone-safe-bottom:max(6px,env(safe-area-inset-bottom));
  --phone-safe-left:max(6px,env(safe-area-inset-left));
}

/* All modal screens: keep every action reachable on a phone. */
body.is-touch .overlay{
  padding:var(--phone-safe-top) var(--phone-safe-right) var(--phone-safe-bottom) var(--phone-safe-left);
  align-items:center;
  overflow:hidden;
}
body.is-touch .overlay>.panel{
  width:min(100%,980px);
  max-width:calc(100vw - var(--phone-safe-left) - var(--phone-safe-right));
  max-height:calc(100dvh - var(--phone-safe-top) - var(--phone-safe-bottom));
  overflow:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
  padding:12px;
  border-radius:12px;
}
body.is-touch .panel h1{font-size:clamp(19px,4.4vh,28px);line-height:1.05;margin-bottom:4px;letter-spacing:1.5px}
body.is-touch .panel .sub{font-size:10px;line-height:1.3;margin-bottom:8px}
body.is-touch .btn-primary,body.is-touch .btn-gold,body.is-touch .btn-secret{min-height:38px;padding:8px 14px;font-size:12px;border-radius:8px}
body.is-touch .hint{font-size:10px;margin-top:5px}

/* Hero selection: compact cards on landscape phones; full information still
   available on portrait/tablet layouts below. */
body.is-touch #selectOverlay{align-items:flex-start;overflow:auto;touch-action:pan-y;background-position:center}
body.is-touch #selectOverlay>.panel{
  width:100%;max-width:none;max-height:none;min-height:100dvh;overflow:visible;
  margin:0;padding:var(--phone-safe-top) var(--phone-safe-right) var(--phone-safe-bottom) var(--phone-safe-left);
}
body.is-touch #selectOverlay .edition-line{font-size:7px;letter-spacing:.8px;margin:0 0 4px;gap:5px}
body.is-touch #selectOverlay .edition-line::before{width:14px}
body.is-touch #selectOverlay .edition-line a{font-size:7px;padding:4px 6px}
body.is-touch #selectOverlay h1{font-size:clamp(25px,7.2vh,40px);line-height:.94;letter-spacing:2px;margin:0 0 3px;max-width:none}
body.is-touch #selectOverlay .edition-tagline{font-size:11px;margin-bottom:3px}
body.is-touch #selectOverlay>.panel>.sub{font-size:9px;line-height:1.25;max-width:620px;margin:0 0 5px}
body.is-touch #selectOverlay #continueRunBtn{min-height:32px;margin:4px 0;padding:6px 12px;font-size:10px;width:auto}
body.is-touch #selectOverlay #checkpointNote{font-size:9px;line-height:1.25;margin:3px 0 5px;max-width:560px}
body.is-touch #selectOverlay .stars-info{font-size:9px;margin:0 8px 5px 0}
body.is-touch #selectOverlay .academy-btn{font-size:9px;padding:5px 8px;margin:0 0 5px;min-width:0}
body.is-touch #selectOverlay .roster-heading{font-size:9px;letter-spacing:1.5px;margin:2px 0 4px}
body.is-touch #selectOverlay .hero-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:5px;width:100%}
body.is-touch #selectOverlay .hero-card{padding:0 5px 5px;border-radius:5px;min-width:0;max-width:none}
body.is-touch #selectOverlay .hero-icon{height:66px;margin:0 -4px 2px;mask-image:linear-gradient(#000 88%,transparent)}
body.is-touch #selectOverlay .hero-card h2{font-size:10px;line-height:1.05;letter-spacing:.7px;margin:0 0 3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.is-touch #selectOverlay .hero-card p{display:none}
body.is-touch #selectOverlay .hero-stats{display:grid!important;grid-template-columns:repeat(3,1fr);gap:2px;margin:2px 0;padding:3px 0;font-size:8px}
body.is-touch #selectOverlay .hero-stats>div{min-width:0;text-align:center}
body.is-touch #selectOverlay .hero-stats span{display:none}
body.is-touch #selectOverlay .hero-stats b{font-size:8px;white-space:nowrap}
body.is-touch #selectOverlay .ult-card{margin-top:2px!important;padding:0!important}
body.is-touch #selectOverlay .uc-label,body.is-touch #selectOverlay .uc-desc{display:none}
body.is-touch #selectOverlay .uc-name{font-size:8px;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.is-touch #selectOverlay .hero-card.locked .lock-badge{top:3px;right:3px;font-size:7px;padding:2px 4px}
body.is-touch #selectOverlay .edition-footer{display:none}

/* Skill pick / level-up: use the screen width instead of fixed 210 px cards. */
body.is-touch #skillSelectOverlay .cards,body.is-touch #skillUpgradeOverlay .cards{
  display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;width:100%;margin-top:4px;
}
body.is-touch #skillSelectOverlay .card,body.is-touch #skillUpgradeOverlay .card{
  width:auto;min-width:0;min-height:0;padding:8px 6px;border-radius:8px;
}
body.is-touch #skillSelectOverlay .card .ci,body.is-touch #skillUpgradeOverlay .card .ci{font-size:27px;line-height:1;margin-bottom:3px}
body.is-touch #skillSelectOverlay .card h3,body.is-touch #skillUpgradeOverlay .card h3{font-size:10px;line-height:1.15;margin-bottom:3px}
body.is-touch #skillSelectOverlay .card p,body.is-touch #skillUpgradeOverlay .card p{font-size:8px;line-height:1.2}
body.is-touch #skillSelectOverlay .card .lvl-badge,body.is-touch #skillUpgradeOverlay .card .lvl-badge{top:3px;right:3px;font-size:7px;padding:2px 4px}
body.is-touch #skillSelectOverlay .panel>div[style*="margin-top"],body.is-touch #skillUpgradeOverlay .panel>div[style*="margin-top"]{margin-top:7px!important}
body.is-touch #skillConfirmBtn{margin:0;min-height:34px;padding:6px 16px;font-size:11px}

/* Academy and developer screens. */
body.is-touch .academy-head{gap:8px;margin-bottom:4px}
body.is-touch .academy-stars{font-size:12px}
body.is-touch .academy-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;max-height:calc(100dvh - 128px)}
body.is-touch .academy-card{padding:7px;border-radius:7px}
body.is-touch .academy-card h3{font-size:10px;margin-bottom:2px}
body.is-touch .academy-card p{font-size:8px;line-height:1.2;margin-bottom:5px}
body.is-touch .academy-card .academy-lvl{font-size:8px;margin-bottom:2px}
body.is-touch .academy-card button{min-height:30px;padding:5px;font-size:9px}
body.is-touch .academy-note{font-size:8px;margin-top:5px}
body.is-touch #academyBackBtn{margin-top:6px!important}
body.is-touch #devList{gap:5px!important}
body.is-touch .dev-toggle{padding:7px 9px;margin-bottom:4px;border-radius:7px}
body.is-touch .dev-toggle .dl{font-size:10px}.is-touch .dev-toggle .dd{font-size:8px}
body.is-touch .dev-toggle .dsw{width:42px;height:23px;margin-left:7px}.is-touch .dev-toggle .dsw::after{width:17px;height:17px}.is-touch .dev-toggle.on .dsw::after{left:22px}

/* Shop/forge/potions/buyer share one compact mobile shell. */
body.is-touch #shopOverlay .panel,body.is-touch #forgeOverlay .panel{padding:10px}
body.is-touch #shopOverlay h1,body.is-touch #forgeOverlay h1{font-size:19px}
body.is-touch .shop-coins{font-size:11px;margin-bottom:5px}
body.is-touch .shop-tabs{gap:4px;margin-bottom:5px;flex-wrap:nowrap;overflow-x:auto;justify-content:flex-start;padding-bottom:2px}
body.is-touch .shop-tab{flex:0 0 auto;padding:5px 7px;font-size:9px;border-width:1px;min-height:30px}
body.is-touch .shop-grid,body.is-touch .forge-grid{max-height:calc(100dvh - 126px)}
body.is-touch .shop-item{gap:6px;padding:6px 7px}
body.is-touch .shop-item .si-icon{font-size:23px;width:31px;min-width:31px;padding:3px}
body.is-touch .shop-item .si-icon.gear-preview{width:54px;min-width:54px;height:62px}
body.is-touch .shop-item .si-name{font-size:10px}.is-touch .shop-item .si-desc{font-size:8px;line-height:1.15}.is-touch .shop-item .si-stats,.is-touch .shop-item .si-set{font-size:8px}
body.is-touch .shop-item .si-price{font-size:9px;min-width:54px}
body.is-touch #shopBackBtn,body.is-touch #forgeBackBtn{margin-top:6px!important}

/* Pause/settings: one scrollable surface; avoid the bottom settings button hiding
   inventory actions. */
body.is-touch .panel.pause-panel{width:100%;max-width:100%;max-height:calc(100dvh - var(--phone-safe-top) - var(--phone-safe-bottom));padding:9px;border-radius:10px}
body.is-touch .pause-layout{display:grid;grid-template-columns:minmax(220px,.8fr) minmax(0,1.2fr);gap:7px;margin-top:5px}
body.is-touch .pause-col-buttons{gap:5px}
body.is-touch .game-settings{padding:6px;gap:5px;margin-top:3px;font-size:9px}
body.is-touch .game-settings select{padding:3px;font-size:9px}.is-touch .game-settings input[type=range]{width:90px}
body.is-touch .pause-col-inv{min-height:0;overflow:auto;max-height:calc(100dvh - 82px)}
body.is-touch .inv-section{padding:6px;margin-bottom:5px}.is-touch .inv-section h3{font-size:9px;margin-bottom:4px}
body.is-touch .pause-equip-card{padding:6px;gap:4px}.is-touch .pec-icon{font-size:26px;width:34px}.is-touch .pec-name{font-size:10px}.is-touch .pec-lv{font-size:8px}
body.is-touch .pause-rune-slots .rune-slot-box{width:31px;height:31px;font-size:16px}
body.is-touch .pause-rune-card{padding:5px 6px;gap:5px}.is-touch .pause-rune-card .rr-icon{font-size:22px}.is-touch .pause-rune-card .rr-name{font-size:9px}.is-touch .pause-rune-card .rr-desc{font-size:8px}
body.is-touch #touchPauseSettingsBtn{right:var(--phone-safe-right);bottom:var(--phone-safe-bottom);width:44px;height:44px;font-size:20px}

/* In-game touch HUD. Remove scale hacks and lay out three independent zones. */
body.is-touch .hud-top{
  top:var(--phone-safe-top);left:var(--phone-safe-left);right:var(--phone-safe-right);padding:0;
  transform:none;width:auto;display:grid;grid-template-columns:minmax(220px,31vw) minmax(150px,20vw) minmax(105px,1fr);
  align-items:start;gap:5px;
}
body.is-touch .hud-top .hp-wrap{width:auto;max-width:none;gap:5px}
body.is-touch .hud-top .portrait{width:38px;height:38px;font-size:22px;border-width:2px}
body.is-touch .hud-top .hp-name{font-size:9px;margin-bottom:2px;gap:4px}.is-touch .hud-top .hp-name .lvbadge{font-size:8px;padding:1px 4px}
body.is-touch .hud-top .hp-bar-outer{height:20px;padding:2px}.is-touch .hud-top .hp-text{font-size:9px}
body.is-touch .hud-top .lvbar{height:8px;margin-top:2px;padding:1px}
body.is-touch .hud-top .equip-hud{gap:3px;margin-top:2px;flex-wrap:nowrap}.is-touch .hud-top .equip-chip{font-size:8px;padding:2px 4px;gap:2px}
body.is-touch .hud-top .rune-inv-hud{transform:none;gap:2px;margin-top:2px}.is-touch .hud-top .rune-inv-hud .ri-label{font-size:7px}.is-touch .hud-top .rune-inv-hud .ri-slot{width:19px;height:19px;font-size:10px;border-width:1px}
body.is-touch .hud-top .combo-hud{gap:3px;margin-top:2px;font-size:8px}.is-touch .hud-top .combo-hud .cb-label{font-size:7px}.is-touch .hud-top .combo-hud .cb-mult{font-size:9px;min-width:25px}.is-touch .hud-top .combo-hud .cb-bar{height:4px}
body.is-touch .wave-box{justify-self:center;min-width:0;width:100%;padding:4px 8px;border-width:1px}
body.is-touch .wave-box .wv{font-size:9px}.is-touch .wave-box .theme{font-size:7px}.is-touch .wave-box .tm{font-size:15px}.is-touch .wave-box .wprog{height:4px;margin-top:2px}.is-touch .wave-box .frag-row{margin-top:2px}.is-touch .wave-box .frag{width:7px;height:7px}
body.is-touch .stats{justify-self:end;gap:4px;font-size:9px}.is-touch .stats>span{gap:3px;padding:4px 7px;border-width:1px}.is-touch .stats>span .ic{font-size:12px}
body.is-touch #bossBar{top:78px;width:min(520px,62vw)}
body.is-touch #bossBar .bname{font-size:9px}.is-touch #bossBar .bouter{height:15px;padding:2px}.is-touch #bossBar .btext{font-size:8px}
body.is-touch #touchMenuBtn{top:calc(var(--phone-safe-top) + 77px);left:var(--phone-safe-left);width:38px;height:38px;font-size:18px;border-radius:9px}
body.is-touch #touchPotionBtn{right:calc(var(--phone-safe-right) + 2px);bottom:calc(var(--phone-safe-bottom) + 108px);width:48px;height:48px}.is-touch #touchPotionBtn .tp-icon{font-size:22px;line-height:22px}.is-touch #touchPotionBtn .tp-price{font-size:8px}
body.is-touch #expeditionHud{left:var(--phone-safe-left);top:calc(var(--phone-safe-top) + 78px);bottom:auto;max-width:min(38vw,330px);padding:6px 8px}
body.is-touch #expeditionObjective{font-size:9px}.is-touch #expeditionHint,.is-touch #activeBuffs{font-size:8px;margin-top:2px;line-height:1.25}
body.is-touch #tutorialCard{right:var(--phone-safe-right);bottom:calc(var(--phone-safe-bottom) + 72px)!important;top:auto!important;width:min(220px,30vw);padding:7px 9px;font-size:8px;line-height:1.3}

/* Village navigation and mobile coin visibility. */
body.is-touch.in-village #expeditionHud{top:var(--phone-safe-top);left:var(--phone-safe-left);max-width:min(48vw,390px)}
body.is-touch #villageNav{left:var(--phone-safe-left);right:var(--phone-safe-right);bottom:var(--phone-safe-bottom);transform:none;width:auto;max-width:none;display:flex;flex-wrap:nowrap;justify-content:flex-start;gap:3px;padding:4px;overflow-x:auto;scrollbar-width:none}
body.is-touch #villageNav::-webkit-scrollbar{display:none}
body.is-touch #villageNav button{flex:0 0 auto;min-height:29px;padding:5px 7px;font-size:8px;white-space:nowrap}

/* Toasts/banners must never span beyond the phone. */
body.is-touch #runeToast .rtin{min-width:0;width:min(92vw,480px);padding:7px 10px}.is-touch #runeToast .rticon{font-size:30px}
body.is-touch #waveBanner .wbin{padding:10px 24px}.is-touch #waveBanner .wbn{font-size:26px}.is-touch #waveBanner .wbth{font-size:10px}
body.is-touch #evoBanner .evn{font-size:23px}.is-touch #setBanner .sbn{font-size:20px}
body.is-touch .gostats{gap:6px;margin:8px 0 10px;font-size:10px}.is-touch .gostats div{padding:6px 9px}.is-touch .gostats b{font-size:15px}

/* Landscape phones are height-constrained even when CSS width is 800-1000px. */
@media (orientation:landscape) and (max-height:600px){
  body.is-touch #selectOverlay>.panel>.sub{display:none}
  body.is-touch #selectOverlay .edition-tagline{display:none}
  body.is-touch #selectOverlay h1{font-size:clamp(23px,7.5vh,34px)}
  body.is-touch #selectOverlay .hero-icon{height:clamp(54px,16vh,72px)}
  body.is-touch #selectOverlay .hero-card{padding-bottom:4px}
  body.is-touch #selectOverlay .hero-stats{padding:2px 0;margin:1px 0}
  body.is-touch #selectOverlay .roster-heading{margin:1px 0 3px}
  body.is-touch #skillSelectOverlay>.panel,body.is-touch #skillUpgradeOverlay>.panel{max-width:860px;padding:8px}
  body.is-touch #skillSelectOverlay .card,body.is-touch #skillUpgradeOverlay .card{padding:6px 5px}
  body.is-touch #skillSelectOverlay .card .ci,body.is-touch #skillUpgradeOverlay .card .ci{font-size:23px}
  body.is-touch #skillSelectOverlay .card p,body.is-touch #skillUpgradeOverlay .card p{max-height:30px;overflow:hidden}
  body.is-touch .academy-grid{max-height:calc(100dvh - 105px)}
  body.is-touch .panel.pause-panel h1{font-size:18px}.is-touch .panel.pause-panel .sub{display:none}
}

/* Portrait phones: two-column selection and vertical pause layout. */
@media (orientation:portrait), (max-width:650px){
  body.is-touch #selectOverlay .hero-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}
  body.is-touch #selectOverlay .hero-icon{height:100px}
  body.is-touch #selectOverlay .hero-card h2{font-size:12px}
  body.is-touch #selectOverlay .hero-card p{display:block;font-size:8px;min-height:0;max-height:30px;overflow:hidden}
  body.is-touch #skillSelectOverlay .cards,body.is-touch #skillUpgradeOverlay .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.is-touch .academy-grid{grid-template-columns:1fr}
  body.is-touch .pause-layout{display:flex;flex-direction:column}
  body.is-touch .pause-col-inv{max-height:none;overflow:visible}
  body.is-touch .hud-top{grid-template-columns:minmax(170px,1fr) 95px;grid-template-areas:'hp stats' 'wave wave';gap:3px}
  body.is-touch .hud-top .hp-wrap{grid-area:hp}.is-touch .hud-top .wave-box{grid-area:wave;width:150px;justify-self:center}.is-touch .hud-top .stats{grid-area:stats}
  body.is-touch #bossBar{top:calc(var(--phone-safe-top) + 180px);width:78vw}
  body.is-touch #touchMenuBtn{top:calc(var(--phone-safe-top) + 64px)}
  body.is-touch #expeditionHud{top:calc(var(--phone-safe-top) + 112px);max-width:48vw}
}


/* V16 mobile village controls: keep desktop navigation unchanged, use one F-style action button on touch devices. */
body.is-touch #villageNav:not([hidden]){
  position:fixed;
  display:block;
  left:auto;
  right:max(16px,env(safe-area-inset-right));
  bottom:max(18px,env(safe-area-inset-bottom));
  width:88px;
  height:88px;
  max-width:none;
  overflow:visible;
  padding:0;
  margin:0;
  transform:none;
  background:transparent;
  border:0;
  box-shadow:none;
  z-index:35;
}
body.is-touch #villageNav [data-village-target],
body.is-touch #villageNav #villageMenuBtn{display:none!important;}
body.is-touch #villageNav #villageInteractBtn{
  display:flex!important;
  position:absolute;
  inset:0;
  width:88px;
  height:88px;
  min-height:88px;
  padding:0;
  border-radius:50%;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:1px;
  border:2px solid #d5bd77;
  background:radial-gradient(circle at 40% 30%,#315467 0,#17303d 48%,#0b1d27 100%);
  box-shadow:0 0 0 4px rgba(12,29,39,.72),0 5px 18px #0009,inset 0 0 18px rgba(101,190,235,.18);
  color:#fff5cc;
  font-size:0;
  line-height:1;
  text-align:center;
  white-space:normal;
  touch-action:manipulation;
}
body.is-touch #villageNav #villageInteractBtn::before{
  content:'F';
  display:block;
  font:900 32px/31px Arial,sans-serif;
  color:#fff4bd;
  text-shadow:0 2px 3px #000,0 0 9px #e8c86c66;
}
body.is-touch #villageNav #villageInteractBtn::after{
  content:'ДЕЙСТВИЕ';
  display:block;
  margin-top:3px;
  font:800 8px/9px Arial,sans-serif;
  letter-spacing:.5px;
  color:#d9edf4;
}
body.is-touch #villageNav #villageInteractBtn:active{transform:scale(.94);filter:brightness(1.18);}
@media (max-height:520px){
  body.is-touch #villageNav:not([hidden]){width:76px;height:76px;right:max(12px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom));}
  body.is-touch #villageNav #villageInteractBtn{width:76px;height:76px;min-height:76px;}
  body.is-touch #villageNav #villageInteractBtn::before{font-size:28px;line-height:27px;}
  body.is-touch #villageNav #villageInteractBtn::after{font-size:7px;}
}

/* ========================================================================== 
   MOBILE UI v20 — orientation-aware combat layout
   Touch-only overrides. Desktop layout remains unchanged.
   ========================================================================== */
body.is-touch{
  --m-gap:6px;
  --m-chip-bg:rgba(7,15,27,.76);
  --m-chip-border:rgba(108,145,178,.52);
}
body.is-touch #ui{overflow:hidden}
body.is-touch #touchControls{inset:0;overflow:hidden}
body.is-touch .touch-btn,body.is-touch .joystick-base{will-change:transform,left,top}
body.is-touch .touch-btn{border-width:2px;box-shadow:0 3px 9px rgba(0,0,0,.46)}
body.is-touch .touch-btn.ult{border-width:2px;box-shadow:0 3px 10px rgba(0,0,0,.5),0 0 13px rgba(255,179,71,.38)}
body.is-touch .joystick-base{border-width:2px;background:radial-gradient(circle,rgba(30,50,90,.34),rgba(10,18,32,.48));box-shadow:inset 0 0 20px rgba(0,0,0,.38),0 0 12px rgba(106,200,255,.12)}
body.is-touch .joystick-stick{border-width:2px;box-shadow:0 3px 9px rgba(0,0,0,.42),0 0 12px rgba(106,200,255,.35)}
body.is-touch .touch-btn .tb-num{font-size:20px}
body.is-touch .touch-btn .tb-lvl{font-size:9px;padding:1px 5px;border-width:1px}

/* Compact common phone HUD. */
body.is-touch .hud-top{pointer-events:none}
body.is-touch .hud-top>*{pointer-events:none}
body.is-touch .hp-wrap,body.is-touch .wave-box,body.is-touch .stats>span{
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
body.is-touch .stats>span{background:var(--m-chip-bg);border-color:var(--m-chip-border)}
body.is-touch #touchMenuBtn{
  border-width:1px;background:rgba(25,38,52,.82);border-color:#8da0aa;
  box-shadow:0 3px 10px #0008;font-size:16px;
}
body.is-touch #touchPotionBtn{
  border-width:1px;background:radial-gradient(circle at 50% 35%,rgba(23,57,92,.88),rgba(8,21,34,.9));
  box-shadow:0 3px 10px #0008,0 0 10px #4aa8ff33;
}
body.is-touch #expeditionHud{
  background:rgba(7,19,24,.72);border-width:1px;box-shadow:none;border-radius:7px;
}
body.is-touch #tutorialCard{opacity:.9}

/* Landscape: keep the middle of the battlefield almost completely free. */
@media (orientation:landscape){
  body.is-touch .hud-top{
    top:var(--phone-safe-top);left:var(--phone-safe-left);right:var(--phone-safe-right);
    display:grid;grid-template-columns:minmax(205px,28vw) minmax(125px,18vw) minmax(105px,1fr);
    gap:5px;align-items:start;
  }
  body.is-touch .hud-top .portrait{width:34px;height:34px;font-size:19px;border-width:1px;border-radius:7px}
  body.is-touch .hud-top .hp-wrap{gap:4px}
  body.is-touch .hud-top .hp-name{font-size:8px;margin-bottom:1px}
  body.is-touch .hud-top .hp-name .lvbadge{font-size:7px;padding:1px 3px}
  body.is-touch .hud-top .hp-bar-outer{height:17px;padding:2px;border-radius:4px}
  body.is-touch .hud-top .hp-text{font-size:8px}
  body.is-touch .hud-top .lvbar{height:6px;margin-top:1px}
  body.is-touch .hud-top .equip-hud{margin-top:2px;gap:2px}
  body.is-touch .hud-top .equip-chip{font-size:7px;padding:1px 3px;border-width:1px;border-radius:4px}
  body.is-touch .hud-top .rune-inv-hud,body.is-touch .hud-top .combo-hud{display:none}
  body.is-touch .wave-box{padding:3px 6px;border-radius:5px;clip-path:none;background:rgba(8,18,31,.78)}
  body.is-touch .wave-box .wv{font-size:8px}.is-touch .wave-box .theme{font-size:6px}.is-touch .wave-box .tm{font-size:13px}
  body.is-touch .wave-box .frag-row{display:none}
  body.is-touch .stats{gap:3px;font-size:8px}
  body.is-touch .stats>span{padding:3px 6px;border-radius:6px}.is-touch .stats>span .ic{font-size:11px}
  body.is-touch #bossBar{top:calc(var(--phone-safe-top) + 48px);width:min(450px,48vw)}
  body.is-touch #bossBar .bouter{height:13px}.is-touch #bossBar .bname{font-size:8px}.is-touch #bossBar .btext{font-size:7px}
  body.is-touch #touchMenuBtn{top:calc(var(--phone-safe-top) + 47px);left:var(--phone-safe-left);width:34px;height:34px;border-radius:8px}
  body.is-touch #touchPotionBtn{right:calc(var(--phone-safe-right) + 8px);bottom:calc(var(--phone-safe-bottom) + 102px);width:42px;height:42px}
  body.is-touch #touchPotionBtn .tp-icon{font-size:19px;line-height:19px}.is-touch #touchPotionBtn .tp-price{font-size:7px;padding:1px 4px}
  body.is-touch #expeditionHud{top:calc(var(--phone-safe-top) + 47px);left:calc(var(--phone-safe-left) + 39px);max-width:min(245px,30vw);padding:4px 6px}
  body.is-touch #expeditionObjective{font-size:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.is-touch #expeditionHint{display:none}
  body.is-touch #activeBuffs{font-size:7px;line-height:1.1;margin-top:1px;max-height:18px;overflow:hidden}
  body.is-touch #tutorialCard{width:min(190px,25vw);right:var(--phone-safe-right);bottom:calc(var(--phone-safe-bottom) + 66px)!important;font-size:7px;padding:5px 6px}
  body.is-touch #villageNav:not([hidden]){width:68px;height:68px;right:max(12px,env(safe-area-inset-right));bottom:max(12px,env(safe-area-inset-bottom))}
  body.is-touch #villageNav #villageInteractBtn{width:68px;height:68px;min-height:68px}
  body.is-touch #villageNav #villageInteractBtn::before{font-size:25px;line-height:24px}
  body.is-touch #villageNav #villageInteractBtn::after{font-size:6px;margin-top:2px}
}

/* Portrait: a two-row top HUD and controls kept in the lower third. */
@media (orientation:portrait){
  body.is-touch .hud-top{
    top:var(--phone-safe-top);left:var(--phone-safe-left);right:var(--phone-safe-right);
    grid-template-columns:minmax(0,1fr) auto;
    grid-template-areas:'hp stats' 'wave wave';gap:3px;
  }
  body.is-touch .hud-top .hp-wrap{grid-area:hp;min-width:0}
  body.is-touch .hud-top .portrait{width:32px;height:32px;font-size:18px;border-width:1px;border-radius:6px}
  body.is-touch .hud-top .hp-name{font-size:8px;margin-bottom:1px}.is-touch .hud-top .hp-name .lvbadge{font-size:7px;padding:1px 3px}
  body.is-touch .hud-top .hp-bar-outer{height:17px;padding:2px}.is-touch .hud-top .hp-text{font-size:8px}
  body.is-touch .hud-top .lvbar{height:6px;margin-top:1px}
  body.is-touch .hud-top .equip-hud,body.is-touch .hud-top .rune-inv-hud,body.is-touch .hud-top .combo-hud{display:none}
  body.is-touch .hud-top .stats{grid-area:stats;gap:2px;font-size:8px}
  body.is-touch .hud-top .stats>span{padding:3px 5px;border-radius:5px}.is-touch .hud-top .stats>span .ic{font-size:10px}
  body.is-touch .hud-top .wave-box{grid-area:wave;width:138px;justify-self:center;padding:2px 5px;clip-path:none;border-radius:5px;background:rgba(8,18,31,.76)}
  body.is-touch .wave-box .wv{font-size:8px}.is-touch .wave-box .theme{font-size:6px}.is-touch .wave-box .tm{font-size:12px}.is-touch .wave-box .frag-row{display:none}
  body.is-touch #bossBar{top:calc(var(--phone-safe-top) + 78px);width:82vw}
  body.is-touch #touchMenuBtn{top:calc(var(--phone-safe-top) + 73px);left:var(--phone-safe-left);width:34px;height:34px;border-radius:8px}
  body.is-touch #expeditionHud{top:calc(var(--phone-safe-top) + 73px);left:calc(var(--phone-safe-left) + 39px);max-width:55vw;padding:4px 6px}
  body.is-touch #expeditionObjective{font-size:8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  body.is-touch #expeditionHint{display:none}
  body.is-touch #activeBuffs{font-size:7px;line-height:1.1;margin-top:1px;max-height:18px;overflow:hidden}
  body.is-touch #touchPotionBtn{right:calc(var(--phone-safe-right) + 7px);bottom:calc(var(--phone-safe-bottom) + 178px);width:42px;height:42px}
  body.is-touch #touchPotionBtn .tp-icon{font-size:19px;line-height:19px}.is-touch #touchPotionBtn .tp-price{font-size:7px;padding:1px 4px}
  body.is-touch #tutorialCard{width:min(170px,42vw);right:var(--phone-safe-right);bottom:calc(var(--phone-safe-bottom) + 110px)!important;font-size:7px;padding:5px 6px}
  body.is-touch #villageNav:not([hidden]){width:68px;height:68px;right:max(14px,env(safe-area-inset-right));bottom:max(24px,env(safe-area-inset-bottom))}
  body.is-touch #villageNav #villageInteractBtn{width:68px;height:68px;min-height:68px}
  body.is-touch #villageNav #villageInteractBtn::before{font-size:25px;line-height:24px}
  body.is-touch #villageNav #villageInteractBtn::after{font-size:6px;margin-top:2px}

  /* Mobile modal screens should use the whole narrow screen instead of desktop cards. */
  body.is-touch .overlay>.panel{border-radius:9px;padding:9px}
  body.is-touch #skillSelectOverlay .cards,body.is-touch #skillUpgradeOverlay .cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}
  body.is-touch #skillSelectOverlay .card,body.is-touch #skillUpgradeOverlay .card{padding:7px 5px}
  body.is-touch #skillSelectOverlay .card p,body.is-touch #skillUpgradeOverlay .card p{font-size:7.5px;line-height:1.15}
  body.is-touch .panel.pause-panel{padding:8px}
  body.is-touch .pause-layout{display:flex;flex-direction:column;gap:5px}
  body.is-touch .pause-col-buttons{gap:4px}
  body.is-touch .pause-col-inv{max-height:none;overflow:visible}
  body.is-touch .game-settings{grid-template-columns:1fr;padding:5px}
  body.is-touch #shopOverlay .panel,body.is-touch #forgeOverlay .panel{padding:8px}
  body.is-touch .shop-grid,body.is-touch .forge-grid{max-height:calc(100dvh - 112px)}
  body.is-touch .shop-item{padding:5px 6px}
}

/* Very short landscape screens: trade detail for maximum playfield. */
@media (orientation:landscape) and (max-height:430px){
  body.is-touch .hud-top .equip-hud{display:none}
  body.is-touch #expeditionHud{max-width:220px}
  body.is-touch #activeBuffs{display:none}
  body.is-touch #bossBar{top:calc(var(--phone-safe-top) + 42px)}
  body.is-touch #touchMenuBtn{top:calc(var(--phone-safe-top) + 41px)}
  body.is-touch #expeditionHud{top:calc(var(--phone-safe-top) + 41px)}
  body.is-touch #touchPotionBtn{bottom:calc(var(--phone-safe-bottom) + 82px)}
}

/* ========================================================================== 
   MOBILE / VILLAGE UX v21 — shops, backpack, rotation and cleaner HUD
   ========================================================================== */
.mobile-only-setting{display:none!important}
body.is-touch .mobile-only-setting{display:block!important;width:100%;min-height:34px;border-color:#6994ad;background:linear-gradient(180deg,#24485d,#132b39);color:#e9f7ff;font-weight:900;letter-spacing:.3px}
body.is-touch .hud-top .equip-hud,body.is-touch .hud-top .rune-inv-hud{display:none!important}

/* Backpack: runes only. */
.backpack-section{min-height:190px;background:linear-gradient(160deg,rgba(17,30,39,.96),rgba(9,17,24,.97));border-color:#526f78!important}
.backpack-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
.backpack-head h3{margin:0!important;color:#f0e2bd}
.backpack-count{padding:3px 8px;border:1px solid #6d7785;border-radius:999px;background:#0b151f;color:#d8e6ef;font:900 11px Arial}
.backpack-note{font-size:10px;line-height:1.35;color:#9eb4bd;margin:0 0 9px;padding:7px 9px;border:1px solid #334a55;border-radius:8px;background:rgba(6,13,19,.55)}
.backpack-grid{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:7px!important}
.backpack-potion-card{grid-column:1/-1;display:flex;align-items:center;gap:10px;min-height:64px;padding:8px 10px;border:1px solid #4b8da8;border-radius:10px;background:linear-gradient(145deg,rgba(18,47,61,.96),rgba(8,22,30,.96));box-shadow:inset 0 0 18px #45b9e322}
.backpack-potion-icon{flex:0 0 42px;width:42px;height:42px;display:flex;align-items:center;justify-content:center;border:1px solid #62c8ff;border-radius:10px;background:#091925;font-size:25px}
.backpack-potion-info{min-width:0;text-align:left}.backpack-potion-info b{display:block;color:#d9f4ff;font-size:11px}.backpack-potion-info span{display:block;color:#9fc5d6;font-size:9px;margin-top:2px}.backpack-potion-stock{margin-left:auto;color:#8eeaff;font:900 16px Arial;white-space:nowrap}
.backpack-rune-card{position:relative;display:flex;align-items:center;gap:9px;min-height:72px;padding:8px;border:1px solid color-mix(in srgb,var(--rr-color,#8294a6) 62%,#273641);border-radius:10px;background:linear-gradient(145deg,rgba(25,39,48,.96),rgba(10,18,25,.96));box-shadow:inset 0 0 20px var(--rr-glow,#ffffff12)}
.backpack-rune-card::after{content:'';position:absolute;inset:0;border-radius:inherit;pointer-events:none;background:linear-gradient(120deg,rgba(255,255,255,.05),transparent 35%)}
.backpack-rune-icon{flex:0 0 46px;width:46px;height:46px;display:flex;align-items:center;justify-content:center;border:1px solid var(--rr-color,#607080);border-radius:10px;background:#081119;font-size:29px;box-shadow:0 0 13px var(--rr-glow,#ffffff18)}
.backpack-rune-info{min-width:0;text-align:left}.backpack-rune-info .rr-rare{font-size:8px;color:var(--rr-color,#aab9c6);font-weight:900;letter-spacing:.5px}.backpack-rune-info .rr-name{font-size:11px;color:#f3e6c4;font-weight:900;margin-top:1px}.backpack-rune-info .rr-desc{font-size:9px;line-height:1.25;color:#aab9c7;margin-top:2px}.backpack-rune-value{font-size:8px;color:#d7b867;margin-top:3px}
.backpack-empty{grid-column:1/-1;min-height:150px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:5px;color:#8296a1;border:1px dashed #3d5661;border-radius:10px;background:rgba(5,12,17,.45)}
.backpack-empty-icon{font-size:38px;opacity:.72}.backpack-empty b{color:#d6e0e2;font-size:12px}.backpack-empty span{font-size:9px;max-width:300px;line-height:1.35}

/* Village service interiors: illustrated NPC on the left, functional UI on the right. */
#shopOverlay .village-shop-panel{width:min(1120px,96vw);max-width:1120px;max-height:min(760px,94dvh);padding:0;overflow:hidden;background:#0c151b;border:1px solid #6e6350;box-shadow:0 18px 70px #000c}
.vshop-layout{display:grid;grid-template-columns:minmax(260px,34%) minmax(0,66%);min-height:560px;max-height:min(760px,94dvh)}
.vshop-npc{position:relative;display:flex;flex-direction:column;justify-content:flex-end;overflow:hidden;min-width:0;background:linear-gradient(180deg,#342515,#0a1116);border-right:1px solid #665943}
.vshop-portrait-frame{position:absolute;inset:0;overflow:hidden}.vshop-portrait-frame::after{content:'';position:absolute;inset:0;background:linear-gradient(180deg,transparent 42%,rgba(8,12,14,.56) 68%,#091117 96%);pointer-events:none}
.vshop-portrait-frame img{width:100%;height:100%;display:block;object-fit:cover;object-position:center top;filter:saturate(.96) contrast(1.03)}
.vshop-npc-name,.vshop-npc-line{position:relative;z-index:1;margin-left:17px;margin-right:17px;text-shadow:0 2px 4px #000}
.vshop-npc-name{font:900 18px/1.1 Georgia,serif;color:#f1d89c;margin-bottom:6px}
.vshop-npc-line{font:600 11px/1.45 Arial;color:#d5d9d0;padding:9px 10px;margin-bottom:16px;border:1px solid rgba(204,176,116,.36);border-radius:9px;background:rgba(9,14,17,.78)}
.vshop-interface{min-width:0;display:flex;flex-direction:column;padding:16px;background:radial-gradient(circle at 40% 0,rgba(45,64,72,.28),transparent 42%),linear-gradient(145deg,#14222a,#0b141b)}
.vshop-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding-bottom:10px;border-bottom:1px solid #3c5158}.vshop-head h1{margin:0!important;font-size:23px;color:#ead8a8}.vshop-sub{margin-top:2px;font-size:9px;letter-spacing:1.1px;color:#8198a1;font-weight:900}.vshop-head .shop-coins{margin:0;padding:7px 11px;border:1px solid #8a6a2b;border-radius:999px;background:#17170f;color:#f2d37b;font-size:13px;white-space:nowrap}
.vshop-interface .shop-tabs{margin:9px 0 6px}.vshop-interface .shop-grid{flex:1;min-height:0;max-height:none!important;overflow:auto;padding-right:3px}.vshop-interface #shopBackBtn{margin-top:9px!important;flex:0 0 auto}
#shopOverlay .shop-item{background:linear-gradient(145deg,#1c2d35,#111d24);border-color:#425b63}
#shopOverlay .shop-item:not(.disabled):hover{border-color:#b99a5b}

/* Village mobile presentation: goal + action button, not a second HUD. */
body.is-touch.in-village #expeditionHud{max-width:min(250px,58vw);padding:6px 8px;background:rgba(7,16,20,.78);border-color:#4b6668}
body.is-touch.in-village #expeditionHint,body.is-touch.in-village #activeBuffs{display:none!important}
body.is-touch.in-village #expeditionObjective{font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

@media (orientation:landscape) and (max-height:650px){
  body.is-touch #shopOverlay .village-shop-panel{width:calc(100vw - var(--phone-safe-left) - var(--phone-safe-right) - 10px);height:calc(100dvh - var(--phone-safe-top) - var(--phone-safe-bottom) - 8px);max-height:none}
  body.is-touch .vshop-layout{grid-template-columns:minmax(190px,31%) minmax(0,69%);height:100%;min-height:0;max-height:none}
  body.is-touch .vshop-interface{padding:8px}.is-touch .vshop-head{padding-bottom:5px}.is-touch .vshop-head h1{font-size:17px}.is-touch .vshop-sub{font-size:7px}.is-touch .vshop-npc-name{font-size:14px;margin-left:10px;margin-right:10px}.is-touch .vshop-npc-line{font-size:8px;line-height:1.3;margin:0 10px 9px;padding:6px}.is-touch .vshop-interface .shop-tabs{margin:5px 0 3px}.is-touch .vshop-interface .shop-item{padding:5px 6px}.is-touch .vshop-interface #shopBackBtn{margin-top:4px!important;min-height:29px;padding:5px}
  body.is-touch .backpack-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.is-touch .backpack-rune-card{min-height:58px;padding:6px}.is-touch .backpack-rune-icon{width:38px;height:38px;flex-basis:38px;font-size:24px}
}

@media (orientation:portrait), (max-width:650px){
  body.is-touch #shopOverlay .village-shop-panel{width:calc(100vw - var(--phone-safe-left) - var(--phone-safe-right) - 10px);height:calc(100dvh - var(--phone-safe-top) - var(--phone-safe-bottom) - 10px);max-height:none}
  body.is-touch .vshop-layout{display:flex;flex-direction:column;height:100%;min-height:0;max-height:none}
  body.is-touch .vshop-npc{flex:0 0 138px;min-height:138px;border-right:0;border-bottom:1px solid #665943;justify-content:flex-end;padding-left:126px}
  body.is-touch .vshop-portrait-frame{right:auto;width:126px}.is-touch .vshop-portrait-frame::after{background:linear-gradient(90deg,transparent 58%,#0b1418 98%)}
  body.is-touch .vshop-npc-name{font-size:14px;margin:0 8px 4px}.is-touch .vshop-npc-line{font-size:8px;line-height:1.25;margin:0 8px 9px;padding:6px}
  body.is-touch .vshop-interface{flex:1;min-height:0;padding:8px}.is-touch .vshop-head{padding-bottom:5px}.is-touch .vshop-head h1{font-size:16px}.is-touch .vshop-sub{font-size:7px}.is-touch .vshop-head .shop-coins{font-size:10px;padding:5px 7px}
  body.is-touch .vshop-interface .shop-grid{min-height:0}.is-touch .vshop-interface #shopBackBtn{margin-top:4px!important;min-height:30px;padding:5px}
  body.is-touch .backpack-grid{grid-template-columns:1fr}.is-touch .backpack-note{font-size:8px}.is-touch .backpack-rune-card{min-height:62px}
}


/* ========================================================================== 
   MOBILE / VILLAGE UX v22 — shop scrolling, clean portraits, fixed exit
   ========================================================================== */
#shopOverlay{touch-action:pan-y;overscroll-behavior:contain}
#shopOverlay .village-shop-panel{position:relative}
.vshop-close{position:absolute;z-index:30;top:8px;right:8px;width:38px;height:38px;border:1px solid #9c7950;border-radius:10px;background:linear-gradient(180deg,#4a2c20,#241612);color:#ffe7bd;font:900 21px/1 Arial;cursor:pointer;box-shadow:0 4px 18px #0009;display:flex;align-items:center;justify-content:center}
.vshop-close:active{transform:scale(.96)}
.vshop-portrait-frame{display:flex;align-items:flex-end;justify-content:center;background:radial-gradient(circle at 50% 30%,#5b3922 0,#241a13 45%,#0b1115 100%)}
.vshop-portrait-frame img{width:100%;height:100%;display:block;object-fit:contain!important;object-position:center bottom!important;filter:saturate(.96) contrast(1.03);transform:none!important}
.vshop-interface{min-height:0}
.vshop-interface #shopBackBtn{position:sticky;bottom:0;z-index:12;background:linear-gradient(#325b72,#183244);box-shadow:0 -7px 18px rgba(5,12,17,.88);border-color:#6f9bb3}

body.is-touch #shopOverlay,
body.is-touch #shopOverlay .village-shop-panel,
body.is-touch #shopOverlay .vshop-layout,
body.is-touch #shopOverlay .vshop-interface,
body.is-touch #shopOverlay .shop-grid{touch-action:pan-y!important;-webkit-overflow-scrolling:touch;overscroll-behavior:contain}
body.is-touch #shopOverlay .vshop-interface{overflow-y:auto!important;overflow-x:hidden!important}
body.is-touch #shopOverlay .shop-grid{flex:0 0 auto!important;min-height:auto!important;max-height:none!important;overflow:visible!important;padding-bottom:6px}
body.is-touch #shopOverlay .shop-tabs{flex:0 0 auto}
body.is-touch #shopOverlay .vshop-head{flex:0 0 auto;padding-right:40px}
body.is-touch #shopOverlay #shopBackBtn{width:100%;min-height:40px!important;margin:8px 0 0!important;padding:9px 10px!important;font-size:12px!important}
body.is-touch #shopOverlay .vshop-close{width:40px;height:40px;top:6px;right:6px;font-size:22px}

@media (orientation:landscape) and (max-height:650px){
  body.is-touch #shopOverlay .village-shop-panel{height:calc(100dvh - var(--phone-safe-top) - var(--phone-safe-bottom) - 8px)!important;overflow:hidden!important}
  body.is-touch #shopOverlay .vshop-layout{height:100%!important;min-height:0!important}
  body.is-touch #shopOverlay .vshop-npc{min-height:0!important}
  body.is-touch #shopOverlay .vshop-portrait-frame img{object-fit:contain!important;object-position:center bottom!important;padding:4px 4px 0;box-sizing:border-box}
  body.is-touch #shopOverlay .vshop-interface{height:100%;padding:8px 8px 5px!important}
}

@media (orientation:portrait), (max-width:650px){
  body.is-touch #shopOverlay .village-shop-panel{height:calc(100dvh - var(--phone-safe-top) - var(--phone-safe-bottom) - 8px)!important;overflow:hidden!important}
  body.is-touch #shopOverlay .vshop-layout{height:100%!important;min-height:0!important}
  body.is-touch #shopOverlay .vshop-npc{flex:0 0 150px!important;min-height:150px!important;padding-left:144px!important}
  body.is-touch #shopOverlay .vshop-portrait-frame{right:auto!important;width:144px!important;inset-block:0!important;left:0!important}
  body.is-touch #shopOverlay .vshop-portrait-frame img{object-fit:contain!important;object-position:center bottom!important;padding:2px;box-sizing:border-box}
  body.is-touch #shopOverlay .vshop-interface{height:auto;flex:1 1 auto!important;min-height:0!important;overflow-y:auto!important;padding:7px!important}
  body.is-touch #shopOverlay .vshop-npc-name{margin-left:8px!important}
  body.is-touch #shopOverlay .vshop-npc-line{margin-left:8px!important}
}


/* ========================================================================== 
   MOBILE UI v24 — portrait alignment + compact village HUD
   ========================================================================== */
@media (orientation:portrait) and (max-width:760px){
  body.is-touch .hud-top{
    top:calc(var(--phone-safe-top) + 6px)!important;
    left:calc(var(--phone-safe-left) + 8px)!important;
    right:calc(var(--phone-safe-right) + 8px)!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-template-areas:'hp stats' 'wave wave'!important;
    column-gap:6px!important;row-gap:4px!important;
    align-items:start!important;
  }
  body.is-touch .hud-top .hp-wrap{grid-area:hp!important;gap:5px!important;min-width:0!important;align-items:flex-start!important}
  body.is-touch .hud-top .portrait{width:30px!important;height:30px!important;flex-basis:30px!important;font-size:16px!important;border-radius:7px!important}
  body.is-touch .hud-top .hp-stack{min-width:0!important;flex:1 1 auto!important}
  body.is-touch .hud-top .hp-name{font-size:7.5px!important;line-height:10px!important;margin:0 0 1px!important}
  body.is-touch .hud-top .hp-name .lvbadge{font-size:6.5px!important;padding:1px 3px!important;border-radius:4px!important}
  body.is-touch .hud-top .hp-bar-outer{height:14px!important;padding:1.5px!important;border-radius:4px!important}
  body.is-touch .hud-top .hp-text{font-size:7.5px!important;line-height:11px!important}
  body.is-touch .hud-top .lvbar{height:5px!important;margin-top:1px!important;padding:1px!important}
  body.is-touch .hud-top .stats{grid-area:stats!important;display:flex!important;gap:3px!important;align-items:flex-start!important;margin:0!important}
  body.is-touch .hud-top .stats>span{min-width:0!important;height:29px!important;box-sizing:border-box!important;padding:3px 6px!important;border-radius:8px!important;font-size:8px!important;gap:2px!important;box-shadow:0 2px 7px rgba(0,0,0,.32)!important}
  body.is-touch .hud-top .stats>span .ic{font-size:10px!important}
  body.is-touch .hud-top .wave-box{grid-area:wave!important;width:148px!important;min-width:148px!important;justify-self:center!important;margin-top:0!important;padding:3px 6px!important;border-radius:7px!important}
  body.is-touch .hud-top .wave-box .wv{font-size:7px!important;line-height:9px!important}
  body.is-touch .hud-top .wave-box .theme{font-size:6.5px!important;line-height:9px!important}
  body.is-touch .hud-top .wave-box .tm{font-size:14px!important;line-height:16px!important}
  body.is-touch #touchMenuBtn{top:calc(var(--phone-safe-top) + 74px)!important;left:calc(var(--phone-safe-left) + 9px)!important;width:34px!important;height:34px!important}
  body.is-touch #expeditionHud{top:calc(var(--phone-safe-top) + 74px)!important;left:calc(var(--phone-safe-left) + 48px)!important;max-width:calc(100vw - var(--phone-safe-left) - var(--phone-safe-right) - 102px)!important;padding:4px 6px!important}
  body.is-touch #bossBar{top:calc(var(--phone-safe-top) + 112px)!important;width:calc(100vw - var(--phone-safe-left) - var(--phone-safe-right) - 36px)!important;max-width:430px!important}
}

/* In the village, the world already draws a dedicated compact coin pill. Avoid
   a second coin/star cluster and battle-only biome box fighting for the same space. */
body.is-touch.in-village .hud-top .stats{display:none!important}
body.is-touch.in-village .hud-top .wave-box{display:none!important}
body.is-touch.in-village .hud-top{grid-template-columns:minmax(0,1fr)!important;grid-template-areas:'hp'!important;right:calc(var(--phone-safe-right) + 94px)!important}
@media (orientation:portrait){
  body.is-touch.in-village #touchMenuBtn{top:calc(var(--phone-safe-top) + 48px)!important}
  body.is-touch.in-village #expeditionHud{top:calc(var(--phone-safe-top) + 48px)!important;left:calc(var(--phone-safe-left) + 48px)!important;max-width:58vw!important}
}

/* V27.1: phone fixes verified at 360x640, 640x360, 390x844 and 844x390. */
body.is-touch.mobile-modal #touchMenuBtn,
body.is-touch.mobile-modal #touchPotionBtn,
body.is-touch.mobile-modal #touchControls,
body.is-touch.mobile-modal #villageNav {visibility:hidden!important;pointer-events:none!important}
body.is-touch.mobile-control-editor #touchControls {visibility:visible!important;pointer-events:auto!important}
body.is-touch #touchMenuBtn {width:44px;height:44px}
body.is-touch #touchPotionBtn {width:48px;height:48px}
body.is-touch .shop-tab,body.is-touch .mobile-only-setting {min-height:44px}
body.is-touch .pause-col-buttons>button {min-height:44px}
@media (orientation:landscape) and (max-height:650px){
 body.is-touch #shopOverlay .vshop-layout {display:grid!important;grid-template-columns:minmax(145px,29%) minmax(0,1fr)!important}
 body.is-touch #shopOverlay .vshop-npc {height:100%;min-height:0!important;padding:0!important;border-right:1px solid #665943;border-bottom:0;overflow:hidden}
 body.is-touch #shopOverlay .vshop-portrait-frame {width:100%!important;inset:0!important}
 body.is-touch #shopOverlay .vshop-npc-name {z-index:1;font-size:12px;margin:0 6px 6px!important;padding:5px;background:#0b1418cf}
 body.is-touch #shopOverlay .vshop-npc-line {display:none}
 body.is-touch #shopOverlay .vshop-interface {height:100%;min-width:0}
 body.is-touch #shopOverlay .vshop-head h1 {font-size:14px!important;overflow-wrap:anywhere}
}
body.is-touch #touchMenuBtn {width:44px!important;height:44px!important}
body.is-touch #expeditionHud {left:calc(var(--phone-safe-left) + 60px)}

/* V28: a hidden route bar must not leave its touch action off-screen in combat. */
body.is-touch #villageNav[hidden]{display:none!important}
