/* The arena keeps a 1920 × 1080 backing canvas. Only its CSS box is fitted. */
#mobileTools[hidden], #joystick[hidden], #rotatePhone[hidden] { display:none; }
#joystick, .mobile-tools, .mobile-only { display:none; }
#desktopQuality { min-height:36px; font-size:11px; }
.rotate-phone[open] {
  position:fixed; inset:0; z-index:40; margin:0; width:100%; max-width:none; height:100%;
  max-height:none; border:0; padding:24px max(24px,env(safe-area-inset-right)) 24px max(24px,env(safe-area-inset-left));
  display:flex; flex-direction:column; justify-content:center; align-items:center; text-align:center;
  background:#252621; color:#f1e8cd; gap:12px;
}
.rotate-phone::backdrop { background:#252621; }
.rotate-phone p { max-width:30ch; color:#d4ccb6; margin:0 0 8px; }
.rotate-phone button { min-height:44px; }
.turn-icon {
  border:2px solid #d8db93; border-radius:16px; color:#d8db93; width:64px; height:76px;
  display:grid; place-items:center; font-size:43px; line-height:1;
}
[data-ui-mode=portrait], [data-ui-mode=landscape] { background:#141714; min-height:100%; }
[data-ui-mode=portrait] body, [data-ui-mode=landscape] body {
  margin:0; overflow:hidden; min-height:100%; background:#141714; overscroll-behavior:none;
}
[data-ui-mode=landscape] {
  --safe-left:max(5px, env(safe-area-inset-left));
  --safe-right:max(5px, env(safe-area-inset-right));
  --safe-top:max(4px, env(safe-area-inset-top));
  --safe-bottom:max(5px, env(safe-area-inset-bottom));
  --usable-width:calc(var(--mobile-vw,100vw) - var(--safe-left) - var(--safe-right));
  --usable-height:calc(var(--mobile-vh,100dvh) - var(--safe-top) - var(--safe-bottom));
  --arena-width:min(var(--usable-width), calc(var(--usable-height) * 16 / 9));
}
[data-ui-mode=landscape] .main {
  display:grid; place-items:center; grid-template:minmax(0,1fr) / minmax(0,1fr);
  width:100%; max-width:none; height:var(--mobile-vh,100vh); height:max(100vh,var(--mobile-vh,100vh)); min-height:100vh; margin:0; box-sizing:border-box;
  padding:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left); overflow:hidden;
  background:repeating-linear-gradient(145deg,#272b26 0 2px,#222620 2px 24px);
}
[data-ui-mode=landscape] .main > :not(.arena-wrap), [data-ui-mode=landscape] .arena-foot,
[data-ui-mode=landscape] #testArenaInfo { display:none; }
[data-ui-mode=landscape] :is(dialog,.main > dialog)[open] { display:block; }
[data-ui-mode=landscape] .arena-wrap {
  width:var(--arena-width); max-width:100%; border:0; overflow:visible;
}
[data-ui-mode=landscape] .canvas-holder { width:100%; aspect-ratio:16 / 9; }
[data-ui-mode=landscape] #arena { width:100%; height:100%; display:block; }
[data-ui-mode=landscape][data-immersive=true] .main { background:#141714; }
[data-ui-mode=landscape] .mobile-only { display:revert; }
[data-ui-mode=landscape] :is(button,select,summary):focus-visible { outline:2px solid #e0e69b; outline-offset:2px; }
[data-ui-mode=landscape] .mobile-tools {
  position:absolute; right:5px; top:5px; z-index:12; display:flex; gap:4px; align-items:start;
}
[data-ui-mode=landscape] .mobile-tools :is(button,summary,select) {
  min-height:44px; min-width:44px; padding:5px 7px; font-size:11px; box-sizing:border-box;
}
.mobile-tools summary {
  cursor:pointer; list-style:none; display:grid; place-items:center;
  color:#e9e4d2; background:#34362f; border:2px solid #97947e; border-radius:3px;
}
.mobile-tools summary::-webkit-details-marker { display:none; }
.mobile-settings {
  position:absolute; z-index:1; right:0; top:calc(100% + 5px); width:min(270px, 74vw);
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px; padding:7px;
  border:2px solid #858771; background:#242620; box-shadow:0 4px 0 #171713;
  max-height:calc(var(--usable-height) - 60px); overflow:auto;
}
.mobile-settings button { overflow-wrap:anywhere; }

[data-ui-mode=landscape] #joystick:not([hidden]) {
  --stick-size:clamp(104px,28vh,114px);
  display:grid; place-items:center; position:absolute; right:4px; bottom:4px; z-index:4;
  width:min(33%,204px); height:min(53%,182px); min-width:var(--stick-size); min-height:var(--stick-size);
  border:0; border-radius:0; background:none; touch-action:none; user-select:none; -webkit-touch-callout:none;
}
#joystickPad {
  width:var(--stick-size,108px); height:var(--stick-size,108px); box-sizing:border-box;
  display:grid; place-items:center; pointer-events:none; border-radius:50%; opacity:.33;
  border:2px solid #eee8c6; background:#1d2624aa;
}
#joystick.engaged #joystickPad { opacity:.59; }
#joystick .thumb { width:40px; height:40px; background:#ede6bf; border-color:#262b24; }
[data-ui-mode=landscape] .character-hud { top:54px; right:7px; max-width:30%; font-size:9px; }
[data-ui-mode=landscape] .character-hud img { width:19px; height:19px; }
[data-ui-mode=landscape] .party-hud { right:8px; top:80px; max-width:32%; font-size:9px; }
[data-ui-mode=landscape] .companion-hud {
  width:max-content; max-width:40%; overflow:visible; gap:3px; align-content:start; grid-template-columns:auto;
}
[data-ui-mode=landscape] .companion-hud:has(.review-hud:not([hidden])) { grid-template-columns:auto auto; }
[data-ui-mode=landscape] .review-hud {
  grid-row:1 / span 3; padding:2px; --review-size:clamp(20px, calc(var(--companion-height) / 11), 29px);
}
[data-ui-mode=landscape] .review-skills { gap:0; }
[data-ui-mode=landscape] .review-skills button { width:var(--review-size); height:var(--review-size); min-width:0; min-height:0; }
[data-ui-mode=landscape] .review-help { max-width:min(220px,36vw); font-size:11px; z-index:3; }
[data-ui-mode=landscape] .review-status span, [data-ui-mode=landscape] #reviewFeedback { font-size:9px; }
[data-ui-mode=landscape] :is(.turret-hud,.you7n-hud,.field-companion-hud) { width:min(169px,28vw); font-size:10px; padding:4px 6px; }
[data-ui-mode=landscape] #deployTurret { min-height:44px; width:100%; font-size:12px; }
[data-ui-mode=landscape] #you7nAllGains[open] #you7nTotals { max-height:min(68px,20vh); }
[data-ui-mode=landscape] #kevinHud { left:8px; right:auto; top:auto; bottom:5px; max-width:44%; font-size:10px; }

[data-ui-mode=landscape] .modal-layer, [data-ui-mode=landscape] .modal-layer:has(.with-stats) {
  position:fixed; inset:calc(var(--safe-top) + 2px) var(--safe-right) var(--safe-bottom) var(--safe-left);
  z-index:10; padding:0; background:#20211ee8; align-items:start;
  overflow:hidden;
}
[data-ui-mode=landscape] .modal-layer .modal {
  width:min(100%,920px); max-height:100%; min-width:0; padding:47px 12px 9px;
  border:0; border-radius:3px; overflow:auto; overscroll-behavior:contain;
  box-shadow:none; overflow-wrap:anywhere;
}
[data-ui-mode=landscape] .modal-layer .modal.with-stats { display:flex; flex-direction:column; gap:8px; }
[data-ui-mode=landscape] .modal h2 { font-size:clamp(18px,4.5vh,24px); margin:0 0 5px; }
[data-ui-mode=landscape] .modal p { margin:3px 0 8px; font-size:12px; }
[data-ui-mode=landscape] .modal :is(button,select), [data-ui-mode=landscape] dialog:not(.rotate-phone) button { min-height:44px; }
[data-ui-mode=landscape] .modal-main, [data-ui-mode=landscape] .stats-panel { min-width:0; flex-shrink:0; }
[data-ui-mode=landscape] .stats-panel { order:0; position:static; max-height:none; width:100%; }
[data-ui-mode=landscape] .stats-summary { display:flex; align-items:center; min-height:44px; gap:6px; }
[data-ui-mode=landscape] .stats-disclosure:not([open]) > .stats-content { display:none; }
[data-ui-mode=landscape] :is(.stats-content,.weapon-detail-scroll,.profession-list,.starter-options,.owned-items-list,.inventory-list) {
  max-height:none; overflow:visible;
}
[data-ui-mode=landscape] .stats-core { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:5px; margin:4px 0 8px; }
[data-ui-mode=landscape] .stats-core span { background:#292b26; border-radius:3px; padding:5px; font-size:10px; }
.stats-core b { display:block; color:#e2deae; font-size:12px; }
.stats-phone-group > summary, .phone-subdetails > summary { cursor:pointer; color:#d8dc98; }
[data-ui-mode=landscape] .stats-phone-group > summary { min-height:44px; display:flex; align-items:center; }

[data-ui-mode=landscape] .offer-grid, [data-ui-mode=landscape] .upgrade-grid {
  grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; width:100%;
}
[data-ui-mode=landscape] .offer { min-height:0; min-width:0; padding:6px; display:flex; gap:4px; }
[data-ui-mode=landscape] .offer-top { margin:0; gap:2px; }
[data-ui-mode=landscape] .offer > strong { font-size:13px; }
[data-ui-mode=landscape] .offer-icon, [data-ui-mode=landscape] .offer-icon img { height:33px; width:40px; }
[data-ui-mode=landscape] .offer-actions { margin:0; display:grid; grid-template-columns:1fr; gap:2px; margin-top:auto; }
[data-ui-mode=landscape] .offer-actions button, [data-ui-mode=landscape] .weapon-info-toggle { padding:4px 3px; font-size:11px; min-width:0; }
[data-ui-mode=landscape] .offer-class, [data-ui-mode=landscape] .offer .weapon-class-tags { display:none; }
[data-ui-mode=landscape] .offer-values { display:flex; gap:4px; flex-wrap:wrap; }
[data-ui-mode=landscape] .decision-stat { display:block; font-size:11px; line-height:1.35; }
[data-ui-mode=landscape] .phone-subdetails { font-size:11px; margin:2px 0; }
[data-ui-mode=landscape] .desktop-detail { display:none; }
[data-ui-mode=landscape] .shop-top { display:flex; gap:8px; margin-bottom:7px; }
[data-ui-mode=landscape] .shop-top > .reroll { margin-left:auto; min-width:90px; padding:4px; }
[data-ui-mode=landscape] .shop-wallet>b { font-size:20px; }
[data-ui-mode=landscape] .shop-bottom { display:none; }
[data-ui-mode=landscape] .shop-front-next { margin:6px 0; display:flex; justify-content:flex-end; }
[data-ui-mode=landscape] .shop-front-next button { min-width:140px; }
[data-ui-mode=landscape] .gear-grid { grid-template-columns:repeat(8,minmax(0,1fr)); gap:4px; }
[data-ui-mode=landscape] .gear-slot { min-width:0; }
[data-ui-mode=landscape] .gear-slot button { height:58px; min-height:44px; padding:3px; }
[data-ui-mode=landscape] .gear-slot button .weapon-icon { width:30px; height:27px; }
[data-ui-mode=landscape] .gear-slot button span, [data-ui-mode=landscape] .gear-classes { display:none; }
[data-ui-mode=landscape] .equipment-heading { margin-top:9px; }
[data-ui-mode=landscape] .upgrade { min-height:0; padding:7px; gap:4px; }
[data-ui-mode=landscape] .upgrade strong { font-size:13px; }
[data-ui-mode=landscape] .weapon-detail.inline, [data-ui-mode=landscape] .weapon-detail:has(>.weapon-detail-scroll) {
  width:100%; max-height:none; overflow:visible; box-shadow:none; padding:7px;
}
[data-ui-mode=landscape] .weapon-detail .info-close { min-width:44px; }
[data-ui-mode=landscape] .event-grid, [data-ui-mode=landscape] .bonus-grid { gap:6px; }
[data-ui-mode=landscape] .event-card { min-height:0; padding:6px; }
[data-ui-mode=landscape] .event-card img { max-height:60px; object-fit:contain; }
[data-ui-mode=landscape] .event-card p, [data-ui-mode=landscape] .event-card small { font-size:11px; }
[data-ui-mode=landscape] dialog:not(.rotate-phone) {
  width:min(860px, var(--usable-width)); max-width:var(--usable-width); max-height:var(--usable-height);
  overflow:auto; overscroll-behavior:contain; box-sizing:border-box;
}
@media(max-width:710px) {
  [data-ui-mode=landscape] .offer-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  [data-ui-mode=landscape] .upgrade-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  [data-ui-mode=landscape] .offer-actions { grid-template-columns:repeat(2,minmax(0,1fr)); }
  [data-ui-mode=landscape] .offer-actions .weapon-info-toggle { grid-column:1/-1; }
}

/* V0.9.10.13: mobile ordinary-size layout is removed. Desktop retains both modes. */
[data-ui-mode=landscape] .header .brand img { width:21px; height:21px; }
[data-ui-mode=landscape] .header .brand h1 { font-size:13px; }
[data-ui-mode=landscape] .header .brand p { font-size:8px; }
[data-ui-mode=landscape] .header .tools { display:none; }
[data-ui-mode=landscape] #kevinHud { position:static; width:min(168px,27vw); max-width:none; overflow-wrap:anywhere; }
[data-ui-mode=landscape] .modal-layer[hidden] { display:none; }
[data-ui-mode=landscape] .offer-preview summary, [data-ui-mode=landscape] .owned-items summary,
[data-ui-mode=landscape] .phone-subdetails summary { padding-block:5px; }

[data-ui-mode=landscape] .weapon-essentials { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:6px; }
[data-ui-mode=landscape] .weapon-essentials > div { display:grid; padding:4px 6px; background:#2c2e27; }
[data-ui-mode=landscape] .weapon-essentials dd { margin:0; font-weight:700; }
[data-ui-mode=landscape] .weapon-detail :is(.phone-subdetails,.weapon-tier-comparison) > summary {
  min-height:44px; display:flex; align-items:center;
}
[data-ui-mode=landscape] .event-confirm { position:sticky; bottom:0; padding:5px; background:#292b25; z-index:1; }

[data-ui-mode=landscape] .shop-front-next { margin:0; }
[data-ui-mode=landscape] .shop-front-next button { min-width:0; padding-inline:9px; }
[data-ui-mode=landscape] .phone-offer { gap:5px; }
.phone-offer-title { display:grid; grid-template-columns:38px minmax(0,1fr); align-items:center; gap:4px; }
.phone-offer-title strong, .phone-offer-title small { display:block; }
.phone-offer-title small { font-size:10px; color:#dfd5b0; }
.phone-offer-title strong { font-size:13px; overflow-wrap:anywhere; }
.phone-offer-readout { min-height:34px; flex:1; }
.phone-offer-actions { display:flex; gap:3px; }
.phone-offer-actions button { flex:1 0 44px; min-width:44px; padding:3px; font-size:11px; }
.phone-offer-actions [aria-pressed=true] { border-color:#dfd58b; color:#f5e49e; }
[data-ui-mode=landscape] .phone-offer .offer-preview { margin:0; }

/* Immersive layout is independent of the browser fullscreen API. */
[data-immersive=true]:not([data-ui-mode=portrait]) {
  --safe-left:env(safe-area-inset-left,0px);
  --safe-right:env(safe-area-inset-right,0px);
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
  --usable-width:calc(var(--mobile-vw,100vw) - var(--safe-left) - var(--safe-right));
  --usable-height:calc(var(--mobile-vh,100dvh) - var(--safe-top) - var(--safe-bottom));
  --arena-width:min(var(--usable-width),calc(var(--usable-height) * 16 / 9));
}
[data-immersive=true]:not([data-ui-mode=portrait]) body { overflow:hidden; }
[data-immersive=true]:not([data-ui-mode=portrait]) .main {
  position:fixed; inset:auto; left:var(--mobile-left,0px); top:var(--mobile-top,0px);
  width:var(--mobile-vw,100vw); height:var(--mobile-vh,100vh); min-height:0; max-width:none; margin:0;
  padding:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  display:grid; place-items:center; grid-template:minmax(0,1fr) / minmax(0,1fr);
  overflow:hidden; background:#141714;
}
[data-immersive=true]:not([data-ui-mode=portrait]) .main > :not(.arena-wrap,dialog),
[data-immersive=true]:not([data-ui-mode=portrait]) :is(.arena-foot,#testArenaInfo) { display:none; }
[data-immersive=true]:not([data-ui-mode=portrait]) .arena-wrap { width:var(--arena-width); border:0; overflow:visible; }
[data-immersive=true]:not([data-ui-mode=portrait]) .canvas-holder { width:100%; aspect-ratio:16 / 9; }
[data-immersive=true]:not([data-ui-mode=portrait]) #arena { display:block; width:100%; height:100%; }
[data-ui-mode=desktop][data-immersive=true] .modal-layer:has(.with-stats) { inset:0; }
[data-ui-mode=desktop][data-immersive=true] .mobile-tools:not([hidden]) {
  position:absolute; top:5px; right:5px; z-index:12; display:flex; gap:4px;
}
[data-ui-mode=desktop] #stickMode { display:none; }
#mobileFullscreen,#fullscreenStatus { grid-column:1/-1; }
#fullscreenStatus { font-size:11px; color:#e3cc94; }
#gameRoot:fullscreen { max-width:none; }

[data-compact-hud=true] .arena-wrap {
  --hud-edge:6px;
  --hud-gap:3px;
  --hud-font:14px;
  --hud-bar-h:23px;
  --hud-xp-h:11px;
  --hud-top:6px;
  --control-hit-target:44px;
}
[data-compact-hud=true] .hud {
  inset:var(--hud-top) var(--hud-edge) auto; height:auto; min-height:48px;
}
[data-compact-hud=true] .hud-resources {
  position:absolute; left:0; top:0; width:clamp(94px,24%,182px);
  display:grid; gap:var(--hud-gap);
}
[data-compact-hud=true] .hud-resources .metric {
  position:relative; width:100%; height:auto; inset:auto; max-width:none; transform:none;
}
[data-compact-hud=true] .hud-resources .health { height:var(--hud-bar-h); }
[data-compact-hud=true] :is(.health progress,.health strong) { height:var(--hud-bar-h); line-height:var(--hud-bar-h); }
[data-compact-hud=true] .health strong { top:0; font-size:var(--hud-font); }
[data-compact-hud=true] .hud-resources .experience { height:var(--hud-xp-h); }
[data-compact-hud=true] :is(.experience progress,.experience .label) { height:var(--hud-xp-h); line-height:var(--hud-xp-h); }
[data-compact-hud=true] .experience .label { font-size:9px; }
[data-compact-hud=true] .paper .label { font-size:0; }
[data-compact-hud=true] .paper .label::after { content:'Log Paper'; font-size:9px; }
[data-compact-hud=true] .paper strong { font-size:15px; line-height:1.1; }
[data-compact-hud=true] .paper strong::before { font-size:13px; }
[data-compact-hud=true] #wave { font-size:clamp(13px,2.2vw,21px); line-height:1.1; }
[data-compact-hud=true] .metric.timer { top:21px; }
[data-compact-hud=true] #timer { font-size:clamp(22px,3.15vw,30px); line-height:1.1; }
[data-compact-hud=true] .mobile-tools :is(button,summary) {
  min-width:var(--control-hit-target); min-height:var(--control-hit-target);
  padding:3px; display:grid; place-items:center; box-sizing:border-box;
}
[data-compact-hud=true] :is(#mobilePause,#mobileMax,#mobileOptionsLabel) { width:44px; height:44px; font-size:20px; }
[data-compact-hud=true] .character-hud { top:51px; right:6px; max-width:32%; gap:3px; font-size:9px; }
[data-compact-hud=true] .character-hud img { width:17px; height:17px; }
[data-compact-hud=true] .character-hud .test-badge { font-size:7px; white-space:nowrap; }
[data-compact-hud=true] .party-hud { top:71px; right:6px; font-size:9px; padding:2px 5px; }
[data-compact-hud=true] .boss-hud { left:34%; right:34%; bottom:6px; gap:5px; }
[data-compact-hud=true] .boss-hud progress { height:8px; }

[data-immersive=true] .companion-hud, [data-ui-mode=landscape] .companion-hud {
  width:max-content; max-width:calc(50% - 8px); align-content:start; justify-items:start; gap:3px;
}
[data-immersive=true] .companion-hud:has(.review-hud:not([hidden])),
[data-ui-mode=landscape] .companion-hud:has(.review-hud:not([hidden])) { grid-template-columns:max-content; }
:is([data-immersive=true],[data-ui-mode=landscape]) .companion-hud:has(.review-hud:not([hidden])):has(> :not(.review-hud):not([hidden])) {
  grid-template-columns:max-content minmax(0,max-content);
}
:is([data-immersive=true],[data-ui-mode=landscape]) .review-hud {
  grid-column:1; grid-row:1 / span 4; padding:0; justify-self:start;
}
[data-ui-mode=landscape] .review-hud { --review-size:clamp(13px,calc(var(--companion-height) / 10),29px); }
:is([data-immersive=true],[data-ui-mode=landscape]) .review-skills { justify-content:start; gap:1px; }
[data-compact-hud=true] :is(#reviewStatus,#reviewFeedback) { display:none; }
[data-compact-hud=true] .review-readout {
  z-index:1; left:calc(100% + 3px); display:flex; align-items:center; gap:3px;
}
[data-compact-hud=true] #reviewDetails { min-width:44px; min-height:44px; padding:0; pointer-events:auto; font-size:16px; }
.review-compact-status { padding:2px 4px; border-radius:3px; color:#fcf4d3; background:#222f29eb; font-size:10px; white-space:nowrap; }
[data-compact-hud=true] .companion-hud:has(.review-hud:not([hidden])) > :nth-child(1 of :not(.review-hud):not([hidden])) {
  margin-top:47px;
}
[data-compact-hud=true] .review-help { z-index:2; max-width:min(180px,36vw); }
[data-compact-hud=true] #kevinHud { position:static; max-width:100%; font-size:10px; }
#reviewDialog { max-height:min(85dvh,600px); overflow:auto; }
#reviewDialog li { margin:6px 0; }
@media(max-width:470px) {
  [data-compact-hud=true] .mobile-tools { gap:2px; }
  [data-compact-hud=true] .metric.timer { top:48px; }
  [data-compact-hud=true] .hud > .metric:first-child { top:29px; }
}

/* V0.9.10.11: only handset landscape uses the new HUD and full-description shop. */
html[data-ui-mode="landscape"][data-compact-hud="true"] .arena-wrap {
  --hud-bar-h:18px; --hud-xp-h:9px; --hud-font:11px; --hud-gap:2px;
  --hud-edge:5px; --hud-top:4px;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] .hud-resources {
  width:clamp(86px,19%,144px);
}
html[data-ui-mode="landscape"][data-compact-hud="true"] .health strong { font-size:11px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] .experience .label { font-size:8px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] .paper strong { font-size:12px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] .paper .label::after { font-size:8px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] #wave { font-size:clamp(12px,1.9vw,17px); }
html[data-ui-mode="landscape"][data-compact-hud="true"] #timer { font-size:clamp(18px,2.65vw,24px); }
html[data-ui-mode="landscape"][data-compact-hud="true"] .metric.timer { top:17px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] :is(#mobilePause,#mobileMax,#mobileOptionsLabel) {
  font-size:17px; min-width:44px; min-height:44px; /* Never shrink the hit target. */
}
html[data-ui-mode="landscape"][data-compact-hud="true"] .character-hud { top:48px; font-size:8px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] .party-hud { top:64px; font-size:8px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] .review-hud { --review-size:clamp(17px,calc(var(--companion-height) / 10),24px); }
html[data-ui-mode="landscape"][data-compact-hud="true"] .review-skill {
  padding:0; border-color:#91ac99a8; background:rgba(25,40,32,.40);
}
html[data-ui-mode="landscape"][data-compact-hud="true"] .review-skill[data-state=used] {
  background:rgba(35,45,43,.36);
}
html[data-ui-mode="landscape"][data-compact-hud="true"] .review-compact-status {
  background:rgba(24,40,31,.48); font-size:9px; padding:2px 3px;
  text-shadow:0 1px 2px #000;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] :is(.turret-hud,.field-companion-hud,.you7n-hud,#kevinHud) {
  background:rgba(28,42,34,.42); backdrop-filter:none; box-shadow:0 1px 3px #0004;
  border-color:#a4b7a06e; font-size:9px; padding:3px 4px;
  color:#fff3d6; text-shadow:0 1px 2px #000a;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] :is(.turret-hud,.field-companion-hud,.you7n-hud) {
  width:min(144px,25vw);
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #deployTurret {
  min-height:44px; width:100%; font-size:11px;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] .review-readout { gap:2px; }
html[data-ui-mode="landscape"][data-compact-hud="true"] #reviewDetails {
  min-height:44px; min-width:44px;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] .review-help { background:rgba(29,43,32,.72); }
/* One scroll area: the existing modal; no scrolling inside individual offer cards. */
html[data-ui-mode="landscape"] .offer-grid {
  grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; gap:8px;
}
html[data-ui-mode="landscape"] .phone-offer {
  height:auto; max-height:none; overflow:visible; padding:7px; gap:7px;
}
html[data-ui-mode="landscape"] .phone-offer-readout {
  height:auto; max-height:none; overflow:visible; min-height:0; flex:1 0 auto;
  white-space:normal; overflow-wrap:anywhere;
}
html[data-ui-mode="landscape"] .phone-offer-effects {
  display:grid; gap:4px; list-style:none; padding:0; margin:0; min-width:0;
  font-size:11px; line-height:1.4;
}
html[data-ui-mode="landscape"] .phone-offer-effects li {
  display:block; min-width:0; white-space:normal; overflow-wrap:anywhere;
}
html[data-ui-mode="landscape"] .phone-offer-effects .gain { color:#acdfa0; }
html[data-ui-mode="landscape"] .phone-offer-effects .loss { color:#f0aa97; }
html[data-ui-mode="landscape"] .phone-offer-effects :is(.item-effect-special,.phone-effect-special) {
  color:#f3e3b5;
}
html[data-ui-mode="landscape"] .phone-offer-effects .phone-effect-kind { color:#b9c9d0; }
html[data-ui-mode="landscape"] .phone-offer-effects .phone-effect-core { color:#e4ead6; font-weight:600; }
html[data-ui-mode="landscape"] .phone-item-limit { font-size:10px; color:#d9c89d; overflow-wrap:anywhere; }
html[data-ui-mode="landscape"] .phone-offer-actions { margin-top:auto; align-items:stretch; }
html[data-ui-mode="landscape"] .phone-offer .offer-preview { max-height:none; overflow:visible; }
html[data-ui-mode="landscape"] .phone-offer .offer-preview:not([open]) > :not(summary) { display:none; }
@media(max-width:740px) {
  html[data-ui-mode="landscape"] .offer-grid { grid-template-columns:1fr; }
}
/* Lock glyph is the *only* visible shop lock state on both platforms. */
.offer-lock-button { display:grid!important; place-items:center; padding:4px!important; min-height:44px!important; min-width:44px!important; }
.offer-lock-icon { width:22px; height:22px; display:block; flex:none; }
.offer-lock-button[aria-pressed="true"] .offer-lock-icon { color:#f3d67c; }
.offer-lock-button:focus-visible { outline:2px solid #ebea9a; outline-offset:-2px; }


/* V0.9.10.11.1 · KafkaCC handset-only HUD hotfix.
   Compact two-row layout, translucent backdrop; preserve a 44px deployment target.
   Never apply to desktop (including desktop immersive and narrow desktop windows). */
html[data-ui-mode="landscape"][data-compact-hud="true"] #turretHud.turret-hud:not([hidden]) {
  display:grid;
  grid-template-columns:minmax(0,1fr) 44px;
  width:min(126px,24vw);
  max-width:calc(100% - 2px);
  gap:2px 3px;
  align-items:center;
  padding:2px 3px;
  border:1px solid rgba(202,194,132,.32);
  border-radius:5px;
  background:rgba(25,38,30,.26);
  box-shadow:none;
  color:#fff3cd;
  font-size:9px;
  line-height:1.16;
  text-shadow:0 1px 2px #000;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #turretHud .turret-heading {
  grid-column:1/-1;
  display:flex;
  min-width:0;
  align-items:center;
  justify-content:space-between;
  gap:2px;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #turretTitle {
  flex:1;
  min-width:0;
  font-size:9px;
  font-weight:700;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #turretCount {
  flex:0 0 auto;
  font-size:12px;
  line-height:1;
  color:#fff0a3;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #turretHud .turret-next {
  grid-column:1;
  min-width:0;
  gap:2px;
  overflow-wrap:anywhere;
  font-size:9px;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #nextTurretIcon {
  flex:0 0 16px;
  width:16px;
  height:16px;
  object-fit:contain;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #nextTurret {
  min-width:0;
  overflow-wrap:anywhere;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #deployTurret {
  grid-column:2;
  grid-row:2;
  min-width:44px;
  width:44px;
  min-height:44px;
  height:44px;
  padding:2px;
  font-size:10px;
  line-height:1.15;
  white-space:normal;
  touch-action:manipulation;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #turretFeedback {
  grid-column:1/-1;
  font-size:9px;
  line-height:1.2;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusHud.dectopus-hud:not([hidden]) {
  width:min(142px,27vw);max-width:calc(100% - 2px);gap:2px;padding:2px 4px;
  border-color:rgba(110,166,170,.38);border-radius:5px;
  background:rgba(5,20,27,.30);box-shadow:none;
  color:#f0f5eb;font-size:9px;line-height:1.15;text-shadow:0 1px 2px #001;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusHud .dectopus-heading {gap:3px}
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusHud .dectopus-heading img {width:17px;height:17px}
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusHud .dectopus-heading strong {font-size:9px}
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusHud .dectopus-hud button,
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusSummon {
  min-height:44px;height:44px;width:100%;padding:2px 4px;
  border-color:rgba(132,183,184,.46);background:rgba(17,57,63,.34);
  font-size:10px;line-height:1.1;text-shadow:0 1px 2px #001;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusStatus {font-size:9px;line-height:1.15}
html[data-ui-mode="landscape"][data-compact-hud="true"] #dectopusProgress {height:3px}

/* V0.9.10.13: phone immersive only; the shared exit button remains for desktop. */
#mobileMax[hidden], #mobilePwaGuide[hidden], #iphonePwaGuide[hidden] { display:none !important; }
html[data-ui-mode="landscape"] #mobileMax { display:none !important; }
html[data-ui-mode="desktop"] #iphonePwaGuide { display:none !important; }
html[data-ui-mode="landscape"] .iphone-pwa-guide {
  position:fixed;
  left:calc(var(--mobile-left,0px) + var(--safe-left,0px) + 7px);
  bottom:calc(var(--safe-bottom,0px) + 7px);
  z-index:20;
  width:min(344px,calc(var(--usable-width) - 14px));
  max-height:min(265px,calc(var(--usable-height) - 14px));
  overflow:auto;
  box-sizing:border-box;
  border:1px solid #b8b68a;
  border-radius:7px;
  padding:8px 10px;
  color:#f9f4dc;
  background:rgba(27,38,30,.97);
  box-shadow:0 4px 12px #0009;
  font-size:11px;
  line-height:1.35;
  overscroll-behavior:contain;
}
html[data-ui-mode="landscape"] .iphone-pwa-heading {
  display:flex; align-items:center; justify-content:space-between; gap:8px;
}
html[data-ui-mode="landscape"] .iphone-pwa-heading strong { font-size:13px; }
html[data-ui-mode="landscape"] #iphonePwaClose {
  flex:0 0 auto; min-width:54px; min-height:44px; padding:3px 7px;
  font-size:12px; touch-action:manipulation;
}
html[data-ui-mode="landscape"] .iphone-pwa-guide p { margin:3px 0 5px; }
html[data-ui-mode="landscape"] .iphone-pwa-guide ol { margin:0 0 4px; padding-left:19px; }
html[data-ui-mode="landscape"] .iphone-pwa-guide li { padding:1px 0; }
html[data-ui-mode="landscape"] .iphone-pwa-guide small { display:block; color:#d0ccab; font-size:10px; }
html[data-ui-mode="landscape"] #mobilePwaGuide:not([hidden]) { grid-column:1/-1; }

/* V0.9.10.14 mobile icon sizing, without altering the touch target or camera. */
html[data-ui-mode="landscape"] .upgrade-icon-wrap{width:25px;height:25px;flex-basis:25px}
html[data-ui-mode="landscape"] .upgrade-icon-wrap .stat-icon{width:24px;height:24px}
html[data-ui-mode="landscape"] .shop-wallet .logpaper-icon{width:20px;height:20px}
html[data-ui-mode="landscape"][data-compact-hud="true"] .paper .logpaper-icon{width:14px;height:14px}


/* V0.9.10.15: match level-up title sizing on compact landscape. */
html[data-ui-mode="landscape"] .upgrade > strong.upgrade-title > .upgrade-icon-wrap {
  width:25px; height:25px; flex-basis:25px; margin:0;
}
html[data-ui-mode="landscape"] .upgrade > strong.upgrade-title > .upgrade-icon-wrap .stat-icon {
  width:24px; height:24px;
}

/* V0.9.10.20: distinct TB mission row, below compact wave/timer.
   Numeric task progress always stays visible when the objective is long. */
[data-compact-hud=true] .tb-hud {
  top:76px;left:50%;right:auto;transform:translateX(-50%);
  max-width:min(340px,35%);padding:4px 6px;gap:5px;
  line-height:1.2;font-size:10px;
}
[data-compact-hud=true] .tb-hud-count {font-size:10px}
@media(max-width:470px) {
  [data-compact-hud=true] .tb-hud {top:106px;max-width:46%}
}


/* V0.9.10.27: phone language switch stays beside the Settings control. */
[data-ui-mode=landscape] .mobile-tools .language-switch{min-width:50px;padding-inline:5px;font-weight:800}
[data-ui-mode=landscape] .mobile-tools #mobileOptions{margin:0}
[data-ui-mode=landscape] .mobile-tools #mobileOptionsLabel{font-size:17px}

/* V0.9.10.27.3: Settings uses the same game-button treatment as the compact HUD. */
.mobile-tools summary{border:3px solid var(--black);background:#4c4b47;color:var(--text);box-shadow:0 2px 0 #151514;border-radius:3px}
.mobile-tools summary:hover,.mobile-tools details[open]>summary{background:#65635c;border-color:#e6dfc8}

/* V0.9.10.27.5 — desktop immersive is pinned to the top of the content viewport. */
html[data-ui-mode=desktop][data-immersive=true] .main{top:0;}


/* V0.9.10.27.5 — PC immersive toolbar: every top control uses one shared button size and skin. */
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools {
  display:flex;
  align-items:center;
  gap:6px;
  top:6px;
  right:6px;
}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > button,
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > details > summary {
  display:grid;
  place-items:center;
  box-sizing:border-box;
  width:44px;
  min-width:44px;
  height:44px;
  min-height:44px;
  padding:0;
  border:3px solid var(--black);
  border-radius:3px;
  background:#4c4b47;
  color:var(--text);
  box-shadow:0 2px 0 #151514;
  font-size:20px;
  line-height:1;
}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > button:hover,
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > details > summary:hover,
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > details[open] > summary {
  background:#65635c;
  border-color:#e6dfc8;
}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] #mobileLanguage {
  font-size:11px;
  font-weight:900;
}

/* PC immersive HUD only: increase readability without changing standard desktop or phone HUDs. */
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .hud {
  inset:12px 20px auto;
  min-height:150px;
}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .hud-resources {
  width:clamp(220px,22vw,360px);
  gap:6px;
}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .arena-wrap {
  --hud-bar-h:44px;
  --hud-xp-h:22px;
  --hud-font:20px;
  --hud-gap:6px;
  --hud-top:12px;
  --hud-edge:20px;
}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .health strong {font-size:20px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .experience .label {font-size:13px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .paper .label {display:block;font-size:12px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .paper .label::after {content:none;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .paper strong {font-size:26px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .paper .logpaper-icon {width:28px;height:28px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] #wave {font-size:clamp(25px,2vw,34px);}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .metric.timer {top:38px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] #timer {font-size:clamp(40px,3.2vw,52px);}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .character-hud {top:66px;right:16px;gap:8px;font-size:14px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .character-hud img {width:32px;height:32px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .character-hud .test-badge {font-size:11px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .party-hud {top:106px;right:16px;font-size:14px;padding:5px 10px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .tb-hud {top:146px;max-width:min(560px,45%);padding:7px 12px;gap:10px;font-size:14px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .tb-hud-count {font-size:14px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .boss-hud {left:30%;right:30%;bottom:18px;gap:12px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .boss-hud progress {height:16px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .companion-hud {gap:8px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] :is(.turret-hud,.field-companion-hud,.you7n-hud,#kevinHud,#dectopusHud) {
  font-size:14px;
  line-height:1.4;
  padding:8px 10px;
}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .review-skills {--review-size:48px;gap:4px;}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] #deployTurret,
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] #dectopusSummon {min-height:48px;font-size:14px;}

/* Desktop Event Cache: add breathing room around the title, four companion cards and confirmation row. */
@media (min-width:801px) {
  .modal:has(.event-heading) .event-heading {
    display:grid;
    justify-items:center;
    gap:8px;
    margin:0 0 14px;
  }
  .modal:has(.event-heading) .event-heading .eyebrow,
  .modal:has(.event-heading) .event-heading h2,
  .modal:has(.event-heading) .event-heading p {margin:0;}
  .modal:has(.event-heading) .event-icon {width:76px;height:76px;margin:2px 0;}
  .modal:has(.event-heading) .event-grid {margin-top:14px;gap:14px;}
  .modal:has(.event-heading) .event-card {padding:14px 10px;gap:10px;}
  .modal:has(.event-heading) .event-card>img {width:88px;height:88px;}
  .modal:has(.event-heading) .event-confirm {margin-top:22px;gap:14px;}
}


/* V0.9.10.27.9 — iOS Home Screen Web App: let the 16:9 arena extend
   through the bottom safe area while keeping touch controls above the home indicator. */
html[data-ui-mode=landscape][data-immersive=true][data-ios-standalone=true] {
  --usable-height:calc(var(--mobile-vh,100dvh) - var(--safe-top));
  --arena-width:min(var(--usable-width),calc(var(--usable-height) * 16 / 9));
}
html[data-ui-mode=landscape][data-immersive=true][data-ios-standalone=true] .main {
  padding-bottom:0;
}
html[data-ui-mode=landscape][data-immersive=true][data-ios-standalone=true] .mobile-tools {
  top:max(5px,env(safe-area-inset-top,0px));
  right:max(5px,env(safe-area-inset-right,0px));
}
html[data-ui-mode=landscape][data-immersive=true][data-ios-standalone=true] #joystick {
  right:max(4px,env(safe-area-inset-right,0px));
  bottom:max(4px,env(safe-area-inset-bottom,0px));
}
html[data-ui-mode=landscape][data-immersive=true][data-ios-standalone=true] #kevinHud {
  left:max(8px,env(safe-area-inset-left,0px));
  bottom:max(5px,env(safe-area-inset-bottom,0px));
}
html[data-ui-mode=landscape][data-immersive=true][data-ios-standalone=true] .boss-hud {
  bottom:max(6px,env(safe-area-inset-bottom,0px));
}

[data-ui-mode=landscape] #zauHud {
  width: min(160px, 28vw);
  padding: 4px 6px;
  font-size: 10px;
}
[data-ui-mode=landscape] #zauSkill { min-height: 44px; padding: 4px 6px; touch-action: manipulation; }

[data-compact-hud=true] .hud-resources.has-zau-shield .health { height:auto; }
[data-ui-mode=landscape] .hud-resources { --zau-shield-height:13px; }
[data-ui-mode=landscape] .zau-shield-hud span { font-size:9px; }

/* Venus uses the shared companion-skill HUD, including landscape touch controls. */
html[data-ui-mode="landscape"][data-compact-hud="true"] #venusHud.venus-hud:not([hidden]) {
  width:min(142px,27vw);max-width:calc(100% - 2px);padding:3px 4px;gap:3px;
  border-color:#c1a18c88;background:rgba(46,29,48,.53);font-size:9px;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #venusHud .venus-heading img{width:18px;height:18px}
html[data-ui-mode="landscape"][data-compact-hud="true"] #venusHud .venus-heading strong{font-size:9px}
html[data-ui-mode="landscape"][data-compact-hud="true"] #venusSkill{min-height:44px;padding:2px 3px;line-height:1.15;white-space:normal}

/* V0.9.10.66.5: desktop toolbar uses the same skin and height in menu and battle. */
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools:not([hidden]){align-items:center;gap:6px;top:6px;right:6px}
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools > button,
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools > details > summary{display:grid;place-items:center;box-sizing:border-box;width:auto;min-width:44px;height:44px;min-height:44px;padding:0 10px;border:3px solid var(--black);border-radius:3px;background:#4c4b47;color:var(--text);box-shadow:0 2px 0 #151514;font-size:14px;font-weight:800;line-height:1;white-space:nowrap}
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools > details{margin:0;align-self:center}
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools > :is(button,details)>summary:hover,
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools > button:hover{background:#65635c;border-color:#e6dfc8}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > :is(#mobileMax,#mobileFullscreen){width:auto;padding:0 10px;font-size:13px}
html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > details > summary{width:44px;padding:0;font-size:20px}
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools > details[open] > summary{background:#65635c;border-color:#e6dfc8}
html[data-ui-mode=desktop][data-immersive=true] .mobile-tools > button:disabled{opacity:.45}
#fullscreenStatus:not([hidden]){position:absolute;right:0;top:calc(100% + 5px);padding:5px;background:#242620;white-space:nowrap}
#desktopFullscreenStatus:not([hidden]){color:#e3cc94;font-size:11px}
#fullscreenStatus[hidden],#desktopFullscreenStatus[hidden]{display:none!important}

/* V0.9.10.66.7 — quality control and phone-only controls */
#mobileOptionsLabel,#mobileExtrasLabel{width:auto;min-width:44px;font-size:13px!important;white-space:nowrap;padding:0 10px;height:44px;min-height:44px;box-sizing:border-box}
#mobileOptions .mobile-settings{grid-template-columns:1fr;width:min(190px,74vw)}
#mobileExtras[hidden]{display:none!important}

html[data-ui-mode=desktop][data-immersive=true][data-compact-hud=true] .mobile-tools > details > #mobileOptionsLabel{width:auto;min-width:44px;padding:0 10px;font-size:13px!important}


/* V1.0 mobile polish: smaller translucent handset controls, no phone fullscreen button,
   tighter non-Kafka companion HUD, and cleaner pause-stat layout. */
html[data-ui-mode="landscape"] #mobileFullscreen,
html[data-ui-mode="landscape"] #fullscreenStatus { display:none !important; }
html[data-ui-mode="landscape"] .mobile-tools {
  gap:3px;
}
html[data-ui-mode="landscape"] .mobile-tools > button,
html[data-ui-mode="landscape"] .mobile-tools > details > summary {
  min-width:40px;
  min-height:40px;
  padding:0 6px;
  border-width:2px;
  border-color:rgba(31,31,27,.78);
  background:rgba(58,60,54,.54);
  box-shadow:none;
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
  color:#f3efde;
}
html[data-ui-mode="landscape"] .mobile-tools > button:hover,
html[data-ui-mode="landscape"] .mobile-tools > details[open] > summary,
html[data-ui-mode="landscape"] .mobile-tools > details > summary:hover {
  background:rgba(86,89,80,.72);
  border-color:rgba(230,223,200,.82);
}
html[data-ui-mode="landscape"] .mobile-tools .language-switch {
  min-width:46px;
  font-size:13px;
}
html[data-ui-mode="landscape"] #mobileOptionsLabel,
html[data-ui-mode="landscape"] #mobilePause,
html[data-ui-mode="landscape"] #mobileLanguage {
  font-size:13px !important;
}
html[data-ui-mode="landscape"][data-compact-hud=true] .mobile-tools > button,
html[data-ui-mode="landscape"][data-compact-hud=true] .mobile-tools > details > summary {
  min-width:38px;
  min-height:38px;
}
html[data-ui-mode="landscape"] :is(.field-companion-hud,.you7n-hud,.dectopus-hud,#kevinHud):not(#turretHud) {
  width:min(128px,23vw);
  padding:3px 4px;
  font-size:9px;
  line-height:1.18;
  border-radius:5px;
  background:rgba(24,38,30,.32);
  border-color:rgba(173,183,160,.34);
  box-shadow:none;
  text-shadow:0 1px 2px rgba(0,0,0,.75);
}
html[data-ui-mode="landscape"] .dectopus-hud button,
html[data-ui-mode="landscape"] #deployTurret {
  min-height:40px;
  font-size:10px;
}
html[data-ui-mode="landscape"] .dectopus-heading img {
  width:18px;
  height:18px;
}
html[data-ui-mode="landscape"] .pause-overview,
html[data-ui-mode="landscape"] .stats-content section {
  gap:6px;
}
html[data-ui-mode="landscape"] .stats-panel {
  padding:8px 10px;
}
html[data-ui-mode="landscape"] .stat-row {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:8px;
  min-height:30px;
}
html[data-ui-mode="landscape"] .stat-row > span {
  min-width:0;
}
html[data-ui-mode="landscape"] .stat-row strong {
  min-width:3ch;
  text-align:right;
  justify-self:end;
}
html[data-ui-mode="landscape"] .stats-content h3,
html[data-ui-mode="landscape"] .stats-content h4 {
  margin-top:0;
}


/* V1.0 mobile-only Scheme B: Pause + Settings + Language. Desktop toolbar is untouched. */
html[data-ui-mode="landscape"] #mobileOptions,
html[data-ui-mode="landscape"] #mobileExtras { display:none !important; }
html[data-ui-mode="landscape"] #mobileSettings[hidden] { display:none !important; }
html[data-ui-mode="landscape"] .mobile-tools {
  top:max(6px,env(safe-area-inset-top,0px));
  right:max(6px,env(safe-area-inset-right,0px));
  align-items:center;
  gap:5px;
}
html[data-ui-mode="landscape"] .mobile-tools > #mobilePause,
html[data-ui-mode="landscape"] .mobile-tools > #mobileLanguage,
html[data-ui-mode="landscape"] .mobile-tools > #mobileSettings > summary {
  display:grid;
  place-items:center;
  box-sizing:border-box;
  width:44px;
  min-width:44px;
  height:44px;
  min-height:44px;
  padding:0;
  border:1px solid rgba(226,239,225,.30);
  border-radius:13px;
  background:rgba(27,43,34,.43);
  color:#f5f4e9;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.16),0 2px 8px rgba(0,0,0,.10);
  backdrop-filter:blur(8px) saturate(125%);
  -webkit-backdrop-filter:blur(8px) saturate(125%);
  font-size:17px;
  font-weight:750;
  line-height:1;
}
html[data-ui-mode="landscape"] .mobile-tools > #mobilePause:disabled { opacity:.55; }
html[data-ui-mode="landscape"] .mobile-tools > #mobileLanguage { font-size:12px; letter-spacing:.2px; }
html[data-ui-mode="landscape"] #mobileSettings { position:relative; margin:0; align-self:center; }
html[data-ui-mode="landscape"] #mobileSettings > summary { cursor:pointer; list-style:none; }
html[data-ui-mode="landscape"] #mobileSettings > summary::-webkit-details-marker { display:none; }
html[data-ui-mode="landscape"] #mobileSettings > summary svg { display:block; width:19px; height:19px; }
html[data-ui-mode="landscape"] #mobileSettings[open] > summary {
  border-color:rgba(191,225,190,.62);
  background:rgba(16,91,54,.62);
}
html[data-ui-mode="landscape"] #mobileSettings .mobile-settings-panel {
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  z-index:20;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:11px;
  width:min(236px,78vw);
  box-sizing:border-box;
  padding:12px;
  border:1px solid rgba(219,236,216,.30);
  border-radius:14px;
  background:rgba(22,36,29,.90);
  color:#f2f0e5;
  box-shadow:0 9px 24px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.10);
  backdrop-filter:blur(14px) saturate(125%);
  -webkit-backdrop-filter:blur(14px) saturate(125%);
}
html[data-ui-mode="landscape"] .mobile-setting-row {
  display:grid;
  grid-template-columns:58px minmax(0,1fr);
  align-items:center;
  gap:9px;
  min-width:0;
  color:rgba(245,244,233,.86);
  font-size:12px;
  font-weight:700;
}
html[data-ui-mode="landscape"] .mobile-setting-row select {
  width:100%;
  min-width:0;
  min-height:38px;
  box-sizing:border-box;
  padding:4px 9px;
  border:1px solid rgba(228,239,225,.25);
  border-radius:9px;
  background:rgba(255,255,255,.09);
  color:#f7f5e9;
  font-size:12px;
  color-scheme:dark;
}
html[data-ui-mode="landscape"] .mobile-setting-row select option { background:#26382d; color:#f7f5e9; }
html[data-ui-mode="landscape"] #mobileSettingsPwaGuide {
  width:100%;
  min-height:38px;
  border:1px solid rgba(228,239,225,.25);
  border-radius:9px;
  background:rgba(255,255,255,.08);
  color:#f7f5e9;
  font-size:12px;
}
html[data-ui-mode="landscape"] #mobileSettingsPwaGuide[hidden] { display:none !important; }

/* Phone-only handedness: move the hit region and the full skill HUD together. */
html[data-ui-mode="landscape"] .mobile-control-settings{border:0;padding:0;margin:0;min-width:0;display:grid;gap:9px}
html[data-ui-mode="landscape"] .mobile-control-settings legend{padding:0;margin:0 0 7px;font-size:12px;font-weight:700;color:#f2f0e5}
html[data-ui-mode="landscape"][data-joystick-side="left"] #joystick:not([hidden]){left:max(4px,env(safe-area-inset-left,0px));right:auto;bottom:max(4px,env(safe-area-inset-bottom,0px))}
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud{left:auto;right:max(8px,env(safe-area-inset-right,0px));justify-items:end}
html[data-ui-mode="landscape"][data-joystick-side="left"] :is(.review-readout,.review-help){left:auto;right:calc(100% + 6px)}

/* Tablets use touch controls with readable menus and the actual visible viewport.
   Keep the arena's 16:9 world and the existing phone/desktop layouts. */
html[data-device-class="tablet"][data-ui-mode="landscape"] #joystick:not([hidden]) {
  --stick-size:clamp(120px,18vh,148px);
  width:min(30%,240px); height:min(48%,220px);
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .mobile-tools :is(button,summary,select) {
  min-width:48px; min-height:48px; font-size:14px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"]:has(.modal-layer:not([hidden])) .mobile-tools {
  position:fixed;
  top:calc(var(--mobile-top,0px) + var(--safe-top) + 4px);
  right:calc(var(--safe-right) + 4px);
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .mobile-settings {
  width:min(340px,70vw); gap:8px; padding:10px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .modal-layer {
  justify-items:center; padding-top:56px; box-sizing:border-box;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .modal-layer .modal {
  width:min(100%,1100px); padding:12px 20px 18px; font-size:15px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .modal :is(p,li,.phone-offer-effects,.phone-subdetails) {
  font-size:14px; line-height:1.5;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .modal :is(button,select,summary) {
  min-height:44px; font-size:14px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .offer-grid {
  grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .phone-offer {
  padding:12px; gap:10px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .offer-icon,
html[data-device-class="tablet"][data-ui-mode="landscape"] .offer-icon img {
  width:48px; height:48px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"][data-compact-hud="true"] .review-hud {
  --review-size:44px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .review-skills {
  grid-template-columns:repeat(2,44px); gap:3px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"] .review-skills button {
  width:44px; height:44px; min-width:44px; min-height:44px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"][data-compact-hud="true"] :is(.field-companion-hud,.you7n-hud) {
  width:min(190px,25vw); font-size:12px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"][data-compact-hud="true"] #turretHud.turret-hud:not([hidden]) {
  width:min(184px,25vw); font-size:12px; padding:4px 6px;
}
html[data-device-class="tablet"][data-ui-mode="landscape"][data-compact-hud="true"] :is(#turretTitle,#turretHud .turret-next,#deployTurret) {
  font-size:12px;
}

/* Skill touches are independent of the joystick's captured pointer. */
html[data-ui-mode="landscape"] :is(#deployTurret,#dectopusSummon,#venusSkill,#zauSkill) {
  touch-action:none; user-select:none; -webkit-touch-callout:none;
}

/* The negative difficulty uses the same tile dimensions as Danger 0–5. */
.danger-beginner.is-locked { filter:grayscale(1); opacity:.45; }

/* 101046: align visible skill cards, including single-companion offers, to the
   arena edge on phones and tablets. Melos occupies the inward, left column. */
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud {
  left:auto; right:max(4px,env(safe-area-inset-right,0px)); width:max-content;
  justify-items:end; justify-content:end; grid-template-columns:minmax(0,max-content);
}
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud > :not([hidden]) {
  grid-column:1; grid-row:auto; justify-self:end; margin-top:0;
}
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud:has(.review-hud:not([hidden])):has(> :not(.review-hud):not([hidden])) {grid-template-columns:max-content minmax(0,max-content);}
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud:has(.review-hud:not([hidden])) > :not(.review-hud):not([hidden]) {grid-column:2;margin-top:0;}
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud .review-hud:not([hidden]) {grid-column:1;grid-row:1 / span 8;justify-self:start;}
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud .review-skills {justify-content:start;}

/* Fade only surfaces; text, icons, counters and touch targets stay legible. */
html[data-ui-mode="landscape"][data-compact-hud="true"] #companionHud > :is(.turret-hud,.field-companion-hud,.you7n-hud,.dectopus-hud,#kevinHud):not([hidden]) {
  background:rgba(24,38,30,.18);box-shadow:none;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #companionHud :is(#deployTurret,#dectopusSummon,#zauSkill,#venusSkill,.review-skill,#reviewDetails) {
  background:rgba(17,57,63,.20);text-shadow:0 1px 2px #001;
}
html[data-ui-mode="landscape"][data-compact-hud="true"] #companionHud .review-skill[data-state="used"] {background:rgba(35,45,43,.18);}
html[data-ui-mode="landscape"][data-compact-hud="true"] #companionHud .review-skill[data-state="casting"] {background:rgba(70,83,59,.30);}

/* 101049: ownership is its own row; keep the currency glyph and price horizontal. */
html[data-ui-mode="landscape"] .phone-offer-actions:has(.shop-item-ownership) { flex-wrap:wrap; }
html[data-ui-mode="landscape"] .phone-offer-actions:has(.shop-item-ownership) [data-action="buy"] { flex:1 0 auto; white-space:nowrap; overflow-wrap:normal; word-break:normal; }
html[data-ui-mode="landscape"] .phone-offer-actions:has(.shop-item-ownership) .offer-lock-button { flex:0 0 44px; }
html[data-ui-mode="landscape"] .phone-offer-actions .offer-price-amount { flex:none; white-space:nowrap; overflow-wrap:normal; word-break:normal; }
html[data-ui-mode="landscape"] .phone-offer-actions .shop-item-ownership { min-width:0; box-sizing:border-box; }

/* 101051 Android-only visible viewport, scroll and app controls. */
html[data-android-ui=true][data-ui-mode=landscape] {
  --android-toolbar:56px;
  --android-brand:0px;
  --safe-left:max(5px,env(safe-area-inset-left,0px));
  --safe-right:max(5px,env(safe-area-inset-right,0px));
  --safe-top:max(4px,env(safe-area-inset-top,0px));
  --safe-bottom:max(5px,env(safe-area-inset-bottom,0px));
  --usable-width:max(0px,calc(var(--mobile-vw,100vw) - var(--safe-left) - var(--safe-right)));
  --usable-height:max(0px,calc(var(--mobile-vh,100dvh) - var(--safe-top) - var(--safe-bottom)));
  --arena-width:min(var(--usable-width),calc(max(0px,var(--usable-height) - var(--android-brand)) * 16 / 9));
}
html[data-android-ui=true][data-ui-mode=landscape][data-immersive=false] { --android-brand:34px; }
html[data-android-ui=true][data-ui-mode=landscape] body { height:100dvh; min-height:0; overflow:hidden; }
html[data-android-ui=true][data-ui-mode=landscape] #gameRoot {
  position:fixed; inset:auto; top:var(--mobile-top,0px); left:var(--mobile-left,0px);
  width:var(--mobile-vw,100vw); height:var(--mobile-vh,100dvh); min-height:0; max-height:var(--mobile-vh,100dvh);
  max-width:none; margin:0; box-sizing:border-box;
  grid-template-rows:var(--android-brand) minmax(0,1fr);
  grid-template-columns:minmax(0,1fr); gap:0; overflow:hidden;
}
html[data-android-ui=true][data-ui-mode=landscape] #gameRoot > .arena-wrap { grid-row:2; grid-column:1; min-height:0; min-width:0; }
html[data-android-ui=true][data-ui-mode=landscape][data-immersive=false] #gameRoot > .header {
  display:flex; width:100%; height:34px; min-height:0; box-sizing:border-box;
  grid-row:1; grid-column:1; margin:0; padding:0 8px; overflow:hidden;
}
html[data-android-ui=true][data-ui-mode=landscape][data-immersive=false] #gameRoot > .header .brand { gap:6px; }
html[data-android-ui=true][data-ui-mode=landscape] #gameRoot:has(#modalLayer:not([hidden])) #mobileTools {
  position:fixed; top:calc(var(--mobile-top,0px) + var(--safe-top) + 4px);
  right:auto; left:calc(var(--mobile-left,0px) + var(--mobile-vw,100vw) - var(--safe-right) - 4px);
  transform:translateX(-100%); z-index:12;
}
/* A single constrained scroller for menu pages; toolbar has its own reserved strip. */
html[data-android-ui=true][data-ui-mode=landscape] #modalLayer:not([hidden]) {
  position:fixed; inset:auto; left:calc(var(--mobile-left,0px) + var(--safe-left));
  top:calc(var(--mobile-top,0px) + var(--safe-top) + var(--android-toolbar));
  width:var(--usable-width); height:max(0px,calc(var(--usable-height) - var(--android-toolbar)));
  max-height:none; min-height:0; padding:0; box-sizing:border-box;
  display:grid; grid-template: minmax(0,1fr) / minmax(0,1fr);
  align-items:start; justify-items:center; overflow:hidden; touch-action:pan-y;
}
html[data-android-ui=true][data-ui-mode=landscape] #modalLayer:not([hidden]) #modal {
  width:min(100%,1100px); max-width:100%; min-width:0; min-height:0; max-height:100%;
  box-sizing:border-box; margin:0; padding:10px 12px 16px;
  overflow-x:hidden; overflow-y:auto; overscroll-behavior-y:contain; touch-action:pan-y;
}
html[data-android-ui=true][data-ui-mode=landscape] #modalLayer #modal :is(.profession-list,.starter-options,.weapon-detail-scroll,.stats-content,.owned-items-list,.inventory-list) {
  min-height:0; max-height:none; overflow:visible;
}
html[data-android-ui=true][data-ui-mode=landscape] #modalLayer #modal :is(.profession-layout,.starter-layout,.danger-layout,.modal-main,.stats-panel) {min-width:0;}
html[data-android-ui=true][data-ui-mode=landscape] #modalLayer #modal .danger-layout > section {
  min-height:0;max-height:none;overflow:visible;overscroll-behavior:auto;
}
html[data-android-ui=true][data-ui-mode=landscape][data-device-class=phone] #modalLayer #modal :is(.profession-layout,.starter-layout,.danger-layout) {
  grid-template-columns:minmax(0,1fr);
}
html[data-android-ui=true][data-ui-mode=landscape] #mobileSettings .mobile-settings-panel {
  max-height:var(--android-settings-room,max(0px,calc(var(--usable-height) - 112px)));
  overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; min-width:0;
  width:min(280px,calc(var(--usable-width) - 12px));
}
html[data-android-ui=true][data-ui-mode=landscape] #androidDisplaySettings {border:0;padding:0;margin:0;min-width:0;display:grid;gap:6px;}
html[data-android-ui=true][data-ui-mode=landscape] #androidDisplaySettings[hidden] {display:none;}
html[data-android-ui=true][data-ui-mode=landscape] #androidDisplaySettings legend {font-size:12px;font-weight:700;margin-bottom:5px;}
html[data-android-ui=true][data-ui-mode=landscape] #androidDisplaySettings button {
  min-height:44px;width:100%;white-space:normal;border:1px solid rgba(228,239,225,.25);
  border-radius:9px;background:rgba(255,255,255,.08);color:#f7f5e9;font-size:12px;
}
html[data-android-ui=true][data-ui-mode=landscape] #androidDisplaySettings button[aria-pressed=true] {border-color:#91ce9e;background:#265a3f;}
html[data-android-ui=true][data-ui-mode=landscape] #androidFullscreenStatus {font-size:11px;color:#e3cc94;overflow-wrap:anywhere;}
html[data-android-ui=true][data-ui-mode=landscape] #androidAppGuide[open] {
  width:min(600px,var(--usable-width));max-width:var(--usable-width);max-height:var(--usable-height);
  padding:16px;box-sizing:border-box;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;
  background:#26382d;color:#f7f5e9;border:1px solid #90aa91;border-radius:12px;
}
html[data-android-ui=true][data-ui-mode=landscape] #androidAppGuide h3 {font-size:15px;margin:10px 0 4px;}
html[data-android-ui=true][data-ui-mode=landscape] #androidAppGuide li {margin:4px 0;}
html[data-android-ui=true][data-ui-mode=landscape] #androidAppGuide::backdrop {background:#101910df;}

/* 101060: the arena already excludes the device safe area. */
html[data-ui-mode="landscape"][data-joystick-side="left"] #companionHud {right:4px;}
html[data-ui-mode="landscape"] #mobileTools {right:6px;}
/* Confirmation belongs to the Event content flow, after all companion cards. */
html[data-ui-mode="landscape"] .modal-layer[data-mode="event"] .event-confirm {
  position:static;top:auto;right:auto;bottom:auto;left:auto;z-index:auto;
  background:transparent;box-shadow:none;margin-top:14px;
}

/* 101065: use a quarter of the visible phone viewport, bounded by the arena. */
html[data-device-class="phone"][data-ui-mode="landscape"] #joystick:not([hidden]) {
  width:calc(var(--mobile-vw,100vw) / 2 - 8px);
  height:calc(var(--mobile-vh,100dvh) / 2 - 8px);
  max-width:calc(100% - 8px); max-height:calc(100% - 8px);
}

html[data-ui-mode=desktop] #mobileOptionsLabel{height:44px;min-height:44px;width:44px;min-width:44px;font-size:22px!important;padding:0}

/* 101077: menu controls are full-width text controls, not compact toolbar icons. */
html[data-ui-mode=desktop] #mobileOptions .mobile-settings {
 width:min(240px,calc(100vw - 24px));box-sizing:border-box;grid-template-columns:minmax(0,1fr);gap:8px;padding:9px;
}
html[data-ui-mode=desktop] #mobileOptions .mobile-settings :is(#mobileMax,#mobileFullscreen,#mobileQuality) {
 width:100%;min-width:0;max-width:100%;height:auto;min-height:44px;margin:0;padding:8px 10px;box-sizing:border-box;
 font-size:14px;line-height:1.3;white-space:nowrap;overflow-wrap:normal;
}
html[data-ui-mode=desktop] #mobileOptions .mobile-settings button:not([hidden]) {display:flex;align-items:center;justify-content:center;}
