/* =========================================================
   ARCVEL V40 — LANDSCAPE-ONLY TOUCH LAYOUT (Mobile Legends style)
   - Touch phones play in landscape; portrait shows a "rotate your phone" prompt.
   - Canvas fills the screen, HUD + controls float on top of it.
   - Menu buttons (SFX/Inventory/Heroes/Tutorial/Home) move into a ☰ pause menu.
   - Desktop / mouse devices are NOT affected (everything is behind pointer:coarse).
   Loaded last from game.html.
   ========================================================= */

/* ---------- defaults (desktop & anything not matched below) ---------- */
#rotatePrompt, .mobMenuBtn, #mobPauseMenu .mobHome { display: none; }

/* ---------- PORTRAIT TOUCH PHONES: rotate prompt ---------- */
@media (pointer: coarse) and (orientation: portrait) and (max-width: 768px) {
  html, body { overflow: hidden !important; height: 100% !important; }
  #rotatePrompt {
    position: fixed; inset: 0; z-index: 99999;
    display: grid; place-items: center; text-align: center;
    background: radial-gradient(circle at 50% 40%, #16245a 0%, #0a0f2b 60%, #050818 100%);
    color: #eaf4ff; padding: 24px;
    font-family: "Pixelify Sans", "Silkscreen", system-ui, sans-serif;
  }
  .rotateBox { display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .rotateBox strong { font-size: 22px; letter-spacing: 2px; color: #ffd77a; text-shadow: 0 2px 0 #3a2a00; }
  .rotateBox span { font-size: 13px; letter-spacing: 3px; color: #9ceaff; }
  .rotateBox small { font-size: 11px; color: #8198b6; letter-spacing: 1px; }
  .rotatePhone {
    width: 46px; height: 84px; border: 4px solid #9ceaff; border-radius: 9px;
    position: relative; margin-bottom: 8px;
    animation: arcvelRotate 2.4s ease-in-out infinite;
  }
  .rotatePhone::after {
    content: ""; position: absolute; left: 50%; bottom: 5px; width: 12px; height: 3px;
    margin-left: -6px; background: #9ceaff; border-radius: 2px;
  }
  @keyframes arcvelRotate {
    0%, 20% { transform: rotate(0deg); }
    55%, 80% { transform: rotate(-90deg); }
    100% { transform: rotate(0deg); }
  }
  /* Nothing else should be tappable/visible behind the prompt. */
  .mobileControls, #gameShell, .pxSky { visibility: hidden !important; }
}

/* ---------- LANDSCAPE TOUCH PHONES: fullscreen game ---------- */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  :root {
    --cw: min(100vw, calc(100dvh * 16 / 9));   /* rendered canvas width */
    --u: 1dvh;                                  /* scale unit for touch controls */
  }
  html, body {
    width: 100% !important; height: 100% !important;
    overflow: hidden !important; background: #05070f !important;
    overscroll-behavior: none; touch-action: manipulation;
  }
  .pxSky { display: none !important; }

  html body #gameShell#gameShell {
    position: fixed !important; inset: 0 !important;
    width: 100% !important; max-width: none !important; height: 100dvh !important;
    padding: 0 !important; margin: 0 !important; display: block !important;
    background: #05070f !important; overflow: hidden !important;
  }
  /* hide the old top bar, objective strip and skill hints */
  html body #gameShell#gameShell > header,
  html body #gameShell#gameShell .under { display: none !important; }

  html body #gameShell#gameShell main {
    position: absolute !important; inset: 0 !important;
    display: grid !important; place-items: center !important;
    margin: 0 !important; padding: 0 !important; gap: 0 !important;
  }
  html body #gameShell#gameShell canvas#game {
    width: var(--cw) !important; height: auto !important;
    max-width: 100vw !important; max-height: 100dvh !important;
    aspect-ratio: 16 / 9 !important; object-fit: contain !important;
    border: 0 !important; border-radius: 0 !important; margin: 0 !important;
    box-shadow: none !important;
  }

  /* ----- HUD floats on top of the canvas ----- */
  html body #gameShell#gameShell .hud {
    position: absolute !important; top: max(18px, calc(env(safe-area-inset-top) + 10px)) !important;
    left: 50% !important; right: auto !important; bottom: auto !important;
    transform: translateX(-50%) !important;
    width: calc(var(--cw) - 90px) !important; max-width: calc(100vw - 260px) !important;
    display: grid !important; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
    align-items: start !important; gap: 10px !important;
    margin: 0 !important; padding: 0 !important; height: auto !important;
    background: none !important; border: 0 !important; border-radius: 0 !important;
    box-shadow: none !important; backdrop-filter: none !important; outline: 0 !important;
    animation: none !important; z-index: 3 !important; pointer-events: none !important;
  }
  html body #gameShell#gameShell .hud::before,
  html body #gameShell#gameShell .hud::after { display: none !important; content: none !important; }
  html body #gameShell#gameShell .hud > div {
    padding: 0 !important; margin: 0 !important; min-width: 0 !important;
    background: none !important; border: 0 !important; box-shadow: none !important;
  }
  html body #gameShell#gameShell .hud > div:first-child { text-align: left !important; }
  html body #gameShell#gameShell .hud > div:last-child { text-align: right !important; }
  html body #gameShell#gameShell .hud span,
  html body #gameShell#gameShell .hud small {
    display: block !important; font-size: 8px !important; line-height: 1 !important;
    margin: 0 0 3px !important; letter-spacing: .5px !important;
    text-shadow: 0 1px 0 #000, 0 0 3px #000;
  }
  html body #gameShell#gameShell .hud > div:nth-child(2) {
    display: flex !important; flex-direction: column !important; align-items: center !important;
    gap: 2px !important; order: 0 !important; grid-column: auto !important;
  }
  html body #gameShell#gameShell .hud > div:nth-child(2) > span { font-size: 8px !important; }
  html body #gameShell#gameShell .hud b#heroStats,
  html body #gameShell#gameShell .hud > div:nth-child(2) > b {
    font-size: 9px !important; line-height: 1 !important; text-shadow: 0 1px 0 #000, 0 0 3px #000 !important;
  }
  html body #gameShell#gameShell .hud .bar {
    height: 9px !important; margin: 0 !important; width: 100% !important;
    background: rgba(5, 8, 20, .65) !important;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .55), 0 0 0 3px rgba(0, 0, 0, .7) !important;
  }
  html body #gameShell#gameShell #shieldStatus {
    display: inline-flex !important; gap: 4px !important; align-items: center !important;
    padding: 2px 7px !important; margin: 2px 0 0 !important; width: auto !important;
    border-radius: 4px !important; border: 1px solid rgba(255, 255, 255, .45) !important;
    background: rgba(8, 25, 40, .7) !important; box-shadow: none !important; opacity: .95;
  }
  html body #gameShell#gameShell #shieldStatus b,
  html body #gameShell#gameShell #shieldStatus span {
    font-size: 7px !important; margin: 0 !important; line-height: 1 !important; text-shadow: none !important;
  }

  /* ----- ☰ pause button, top-right of the screen ----- */
  .mobMenuBtn {
    display: grid !important; place-items: center;
    position: fixed; z-index: 4;
    top: max(16px, calc(env(safe-area-inset-top) + 8px)); right: max(28px, calc(env(safe-area-inset-right) + 16px));
    width: 48px; height: 44px; padding: 0; font-size: 26px; line-height: 1;
    color: #eaf4ff; background: rgba(8, 15, 42, .55);
    border: 2px solid rgba(255, 255, 255, .35); border-radius: 8px;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  }
  .mobMenuBtn:active { background: rgba(60, 90, 150, .7); }

  /* ----- pause menu panel ----- */
  #mobPauseMenu { padding: 8px !important; }
  .mobPausePanel { max-width: 420px !important; padding: 12px 14px !important; text-align: center; }
  .mobPausePanel .eyebrow { margin: 0 0 8px !important; font-size: 10px !important; }
  .mobPauseGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .mobPauseGrid button, .mobPauseGrid .mobHome {
    display: flex !important; align-items: center; justify-content: center;
    min-height: 38px; padding: 4px 6px; font-size: 10px; letter-spacing: .5px;
    text-decoration: none; color: #eaf4ff; background: #182842;
    border: 1px solid #47617d; border-radius: 8px; font-weight: 700;
  }
  .mobPauseGrid .primaryAction { grid-column: 1 / -1; }
  .mobPauseGrid .mobHome { grid-column: span 2; background: #2e3a8c !important; border: 3px solid #4b43e8 !important; border-radius: 0 !important; font-size: 10px; }

  /* other modals: compact so they fit in a ~360px tall screen */

  /* ----- touch controls: transparent, floating over the playfield ----- */
  html body .mobileControls {
    position: fixed !important; inset: 0 !important;
    width: auto !important; min-height: 0 !important; padding: 0 !important; gap: 0 !important;
    display: block !important; background: none !important; border: 0 !important;
    box-shadow: none !important; backdrop-filter: none !important;
    pointer-events: none !important; z-index: 35 !important;
    touch-action: none; user-select: none; -webkit-user-select: none;
  }
  html body .mobileControls { opacity: var(--ctlOp, 1) !important; }
  /* hide controls while any popup / tutorial / menu is open */
  body:has(.modal:not(.hidden)) .mobileControls,
  body:has(.guideOverlay:not(.hidden)) .mobileControls { visibility: hidden !important; }

  /* joystick (bottom-left) */
  html body .joystickWrap {
    position: absolute !important; pointer-events: none !important;
    left: max(20px, calc(env(safe-area-inset-left) + 12px)) !important;
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px)) !important;
    width: calc(var(--u) * 33 * var(--joyS, 1)) !important; flex: none !important; display: block !important;
    transform: translate(var(--joyX, 0px), var(--joyY, 0px));
  }
  html body .joystickBase {
    position: relative !important; pointer-events: auto !important; overflow: hidden !important;
    width: calc(var(--u) * 33 * var(--joyS, 1)) !important; height: calc(var(--u) * 33 * var(--joyS, 1)) !important;
    border-radius: 50% !important; touch-action: none;
    background: radial-gradient(circle, rgba(20, 35, 80, .3) 0%, rgba(10, 18, 50, .5) 100%) !important;
    border: 2px solid rgba(255, 255, 255, .35) !important; box-shadow: none !important; opacity: .9;
  }
  html body .joystickBase::after {
    content: ""; position: absolute; inset: 14%; border: 1px dashed rgba(255, 255, 255, .25);
    border-radius: 50%; pointer-events: none;
  }
  html body .joystickKnob {
    position: absolute !important; left: 50% !important; top: 50% !important;
    width: 44% !important; height: 44% !important; margin: -22% 0 0 -22% !important;
    border-radius: 50% !important; pointer-events: none; will-change: transform;
    border: 2px solid rgba(255, 255, 255, .8) !important;
    background: radial-gradient(circle at 35% 30%, #cfeaff, #4b86c4 70%) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .35) !important; opacity: .95;
  }
  html body .joystickDirection {
    position: absolute; top: 50%; transform: translateY(-50%);
    font-size: 11px !important; color: #fff; opacity: .5; pointer-events: none;
  }
  html body .joystickDirection.left { left: 8% !important; }
  html body .joystickDirection.right { right: 8% !important; }
  html body .stickLabel { display: none !important; }

  /* action buttons (bottom-right): big Attack, other four on an arc around it */
  html body .actionDiamond {
    position: absolute !important; inset: 0 !important; display: block !important;
    pointer-events: none !important; margin: 0 !important; padding: 0 !important;
    --u: calc(1dvh * var(--btnS, 1));        /* V43: button size slider */
    transform: translate(var(--btnX, 0px), var(--btnY, 0px));
    --a: calc(var(--u) * 19);              /* attack diameter */
    --b: calc(var(--u) * 12.6);            /* satellite diameter */
    --cr: max(calc(var(--u) * 14), calc(env(safe-area-inset-right) + var(--u) * 12));  /* attack centre from right edge */
    --cb: max(calc(var(--u) * 15), calc(env(safe-area-inset-bottom) + var(--u) * 12)); /* attack centre from bottom edge */
  }
  html body .mobileControls .actionDiamond button {
    position: absolute !important; pointer-events: auto !important;
    margin: 0 !important; padding: 0 !important; min-height: 0 !important;
    width: var(--b) !important; height: var(--b) !important;
    border-radius: 50% !important;
    display: flex !important; flex-direction: column; align-items: center; justify-content: center;
    font-size: calc(var(--u) * 5.2) !important; line-height: 1;
    background: rgba(10, 20, 55, .5) !important;
    border: 2px solid rgba(255, 255, 255, .38) !important;
    box-shadow: 0 2px 0 rgba(0, 0, 0, .35) !important;
    -webkit-tap-highlight-color: transparent;
    grid-area: auto !important;
  }
  html body .mobileControls .actionDiamond button small { display: none !important; }
  html body .mobileControls .actionDiamond button:active {
    background: rgba(90, 140, 220, .7) !important; transform: scale(.94) !important;
  }
  html body .mobileControls .actionDiamond button.cooldown { opacity: .4 !important; }

  html body .mobileControls .actionDiamond .actCenter {
    width: var(--a) !important; height: var(--a) !important;
    right: calc(var(--cr) - var(--a) / 2) !important;
    bottom: calc(var(--cb) - var(--a) / 2) !important;
    font-size: calc(var(--u) * 8.5) !important;
    background: rgba(160, 50, 40, .55) !important;
    border-color: rgba(255, 200, 160, .6) !important;
  }
  /* centre of each satellite = attack centre + R * (cos θ, sin θ), R = 23.5 units */
  html body .mobileControls .actionDiamond .actBottom { /* Jump · 180° */
    right: calc(var(--cr) + var(--u) * 23.5 - var(--b) / 2) !important;
    bottom: calc(var(--cb) - var(--b) / 2) !important;
  }
  html body .mobileControls .actionDiamond .actLeft {   /* Shield · 146° */
    right: calc(var(--cr) + var(--u) * 19.5 - var(--b) / 2) !important;
    bottom: calc(var(--cb) + var(--u) * 13.1 - var(--b) / 2) !important;
  }
  html body .mobileControls .actionDiamond .actTop {    /* Skill 1 · 112° */
    right: calc(var(--cr) + var(--u) * 8.8 - var(--b) / 2) !important;
    bottom: calc(var(--cb) + var(--u) * 21.8 - var(--b) / 2) !important;
  }
  html body .mobileControls .actionDiamond .actRight {  /* Skill 2 · 78° */
    right: calc(var(--cr) - var(--u) * 4.9 - var(--b) / 2) !important;
    bottom: calc(var(--cb) + var(--u) * 23 - var(--b) / 2) !important;
  }
}

/* ---------- V41: popups on short landscape screens ---------- */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  .modal { padding: 4px !important; align-items: center; }
  .modal .panel, .guideCard, .diceRollStage, .diceRevealCard { margin: 0 auto; }
  .mobPauseGrid { grid-template-columns: repeat(3, 1fr); }
  .mobPauseGrid .mobHome { grid-column: span 2; }
}

/* V41: compact start menu (2 columns, no keyboard hints) */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body #startMenu .startPanel .startFoxCrest { display: none !important; }
  html body #startMenu .startPanel .menuFooter { display: none !important; }
  html body #startMenu .startPanel .startSubtitle { margin: 2px 0 6px !important; }
  html body #startMenu .startPanel h1 { margin: 2px 0 !important; }
  html body #startMenu .startPanel .eyebrow { margin: 0 !important; }
  html body #startMenu .startMenuActions {
    display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 6px !important; margin-top: 6px !important;
  }
  html body #startMenu .startMenuActions .primaryAction { grid-column: 1 / -1 !important; }
  html body #startMenu .startMenuActions button { margin: 0 !important; width: auto !important; }
}

/* V41: interactive tutorial card (fixed 0.6 scale, scrolls if still too tall) */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body .guideOverlay { padding: 4px !important; }
  html body .guideCard {
    zoom: .6 !important;
    width: calc((var(--avw, 100vw) - 12px) / .6) !important;
    max-height: calc((var(--avh, 100vh) - 8px) / .6) !important;
  }
  html body .guideBubble {
    max-height: calc((var(--avh, 100vh) - 8px) / .6 - 6px) !important;
    overflow: auto !important;
  }
}

/* V41b: tiny labels inside the (scaled-down) Heroes / Inventory popups must stay readable */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body .heroInfo h3 em { display: inline-block; white-space: nowrap; font-size: 20px !important; line-height: 1 !important; padding: 3px 8px 2px !important; margin-left: 8px !important; letter-spacing: .5px !important; font-family: inherit !important; }
  html body .heroTag { font-size: 20px !important; letter-spacing: .5px !important; }
  html body .heroRow span { font-size: 13px !important; padding: 3px 8px !important; min-width: 74px; text-align: center; letter-spacing: .5px !important; }
  html body .hlChip { font-size: 16px !important; }
  html body .hlChip em { font-size: 13px !important; }
  html body .armoryTab small, html body .rarityBar span, html body .invSummary * { font-size: 14px !important; }
  html body .soulBadge { font-size: 14px !important; }
}

/* V41c: item lists fill the whole popup (no nested short scroll box + empty space below) */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body #inventory .armoryPanel {
    display: flex !important; flex-direction: column !important; overflow: hidden !important;
  }
  html body #inventory .armoryPanel > * { flex: 0 0 auto; }
  html body #inventory .armoryPanel > #armoryGrid:not(.hidden),
  html body #inventory .armoryPanel > #invSoulPane:not(.hidden) {
    flex: 1 1 0 !important; min-height: 0 !important; max-height: none !important; overflow-y: auto !important;
  }
  /* Heroes: no inner scroll box; the whole panel scrolls as one page */
  html body #heroesMenu .heroesPanel { overflow-y: auto !important; }
  html body #heroGearGrid { max-height: none !important; overflow: visible !important; }
}

/* V41c: cards keep their natural height inside the list (no squashed / overlapping text) */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body #armoryGrid, html body #heroGearGrid {
    align-content: start !important; grid-auto-rows: max-content !important;
  }
  html body #armoryGrid .gearCard, html body #heroGearGrid .gearCard { height: auto !important; min-height: 0 !important; overflow: visible !important; }
}

/* ---------- V42: drawn icons on the touch buttons ---------- */
.mobileControls .tIcon { display: none; }
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body .mobileControls .actionDiamond button {
    font-size: 0 !important;                       /* hides the old emoji text node */
    --c: #ffffff;
    background:
      radial-gradient(circle at 34% 28%, rgba(255,255,255,.28), rgba(255,255,255,0) 46%),
      color-mix(in srgb, var(--c) 30%, rgba(8, 14, 44, .62)) !important;
    border: 2.5px solid color-mix(in srgb, var(--c) 75%, #ffffff) !important;
    box-shadow: 0 2px 0 rgba(0,0,0,.4), 0 0 10px color-mix(in srgb, var(--c) 45%, transparent) !important;
  }
  html body .mobileControls .actionDiamond .actCenter {
    background:
      radial-gradient(circle at 34% 28%, rgba(255,255,255,.3), rgba(255,255,255,0) 48%),
      color-mix(in srgb, var(--c) 42%, rgba(30, 8, 20, .66)) !important;
  }
  html body .mobileControls .tIcon {
    display: block; width: 66%; height: 66%; pointer-events: none;
    filter: drop-shadow(0 1.5px 0 rgba(0,0,0,.45));
  }
  html body .mobileControls .actCenter .tIcon { width: 70%; height: 70%; }
  html body .mobileControls .tIcon svg { width: 100%; height: 100%; display: block; overflow: visible; }
  html body .mobileControls .actionDiamond button:active .tIcon { transform: scale(.92); }
  html body .mobileControls .actionDiamond button.cooldown .tIcon { filter: grayscale(.85) brightness(.8); }
}
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body .mobileControls .actionDiamond .actCenter { font-size: 0 !important; }
}

/* ---------- V43: Controls Layout editor (size + drag to move) ---------- */
.ctlBar {
  position: fixed; z-index: 90; top: max(6px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 10px;
  max-width: calc(100vw - 24px); padding: 5px 10px;
  background: rgba(10, 16, 52, .92); border: 3px solid #4b43e8; border-radius: 10px;
  color: #eaf4ff; font: 700 11px/1 "Pixelify Sans", "Silkscreen", system-ui, sans-serif; letter-spacing: .5px;
  box-shadow: 0 4px 0 rgba(0,0,0,.4);
}
.ctlBar b { color: #ffd77a; font-size: 11px; letter-spacing: 1px; }
.ctlBar label { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.ctlBar input[type=range] { width: 64px; margin: 0; accent-color: #ffd77a; }
.ctlBar button {
  min-height: 26px; padding: 3px 10px; font: inherit; color: #eaf4ff; background: #182842;
  border: 2px solid #47617d; border-radius: 6px;
}
.ctlBar button.ctlDone { background: #ffd77a; color: #2a1d00; border-color: #fff2b8; }
.ctlHandle {
  position: fixed; z-index: 85; box-sizing: border-box; touch-action: none; cursor: grab;
  border: 3px dashed #ffd77a; background: rgba(255, 215, 122, .12); border-radius: 14px;
  display: grid; place-items: end center; color: #ffd77a; font: 700 10px/1 "Pixelify Sans", system-ui, sans-serif;
  padding-bottom: 3px; text-shadow: 0 1px 0 #000;
}
.ctlHandle.round { border-radius: 50%; }
.ctlHandle:active { background: rgba(255, 215, 122, .25); }

/* V43: empty skill slot */
html body .mobileControls .actionDiamond button.slotEmpty { opacity: .45 !important; }

/* V48: compact popups + "chapter cleared" banner on short landscape phones */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  /* banner: small single row near the top so it never covers the boss, the hero or the boss's last words */
  html body .chapterRewardToast.chapterRewardToast {
    top: 17% !important; min-width: 0 !important; width: auto !important; max-width: 72vw !important;
    padding: 3px 12px !important; gap: 0 10px !important;
    grid-auto-flow: column !important; align-items: center !important; white-space: nowrap;
    border-width: 2px !important; border-radius: 8px !important;
    box-shadow: 0 3px 0 #0b0f2e !important; clip-path: none !important;
  }
  html body .chapterRewardToast.chapterRewardToast .rewardToastKicker { display: none !important; }
  html body .chapterRewardToast.chapterRewardToast strong { font-size: 12px !important; line-height: 1.2 !important; }
  html body .chapterRewardToast.chapterRewardToast .rewardToastSoul { font-size: 11px !important; line-height: 1.2 !important; }
  html body .chapterRewardToast.chapterRewardToast small { font-size: 8px !important; letter-spacing: 1px !important; }
  html body .chapterRewardToast.chapterRewardToast small b { font-size: 10px !important; }
  /* chapter intro + victory: tighter spacing inside the (already scaled) card */
  html body #chapterIntro .panel, html body #victoryModal .panel { padding: 16px 18px !important; }
  /* an older rule pinned every popup to the top of the short screen; center these two */
  html body #chapterIntro, html body #victoryModal { align-items: center !important; justify-content: center !important; padding: 4px !important; }
  /* lore text: readable size, centered block (keep auto side margins) */
  html body #chapterIntro .chapterLore { font-size: 20px !important; line-height: 1.45 !important; margin: 6px auto !important; max-width: 100% !important; text-align: center !important; }
  html body #chapterIntro .chapterHint { font-size: 17px !important; margin: 4px auto !important; text-align: center !important; }
  html body #victoryModal .panel p:not(.eyebrow) { font-size: 20px !important; line-height: 1.4 !important; }
  html body #chapterIntro .panel h3, html body #victoryModal .panel h2 { margin-bottom: 8px !important; }
}

/* V48: Soul count lives inside the SOULS badge ("SOULS 4") instead of a big number underneath */
html body .soulText .soulBadge { display: inline-flex !important; align-items: baseline; gap: 8px; }
html body .soulText .soulBadge b { font-size: 1.35em !important; line-height: 1 !important; color: #ffc94d !important; text-shadow: none !important; }

/* ---------- V51: landscape phones: animated night sky + clouds in the empty side bars (same backdrop PC players see) ---------- */
.pxSky .side { display: none; }
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body .pxSky { display: block !important; }
  html body .pxSky .side { display: block; }
  html body { background: radial-gradient(ellipse at 50% -10%, #1b2480 0, transparent 55%), linear-gradient(180deg, #070a33 0%, #0b0f4a 55%, #10135e 100%) !important; }
  html body #gameShell#gameShell { background: transparent !important; }
  /* pixel clouds hugging the left / right edge, sized to the side bar (nothing shows when the screen is exactly 16:9) */
  html::before, html::after {
    display: block !important; bottom: 0; height: auto !important;
    width: max(0px, calc((100vw - var(--cw)) / 2)) !important; aspect-ratio: 46 / 72; max-height: 62dvh;
    background-size: 100% 100% !important; z-index: 0 !important; opacity: .85;
  }
}

/* ---------- V61: slightly larger center HUD (chapter / ATK-DEF / shield) on mobile landscape ----------
   Only the marked center group grows (~20-25%). HP bars, buttons and everything else unchanged. */
@media (pointer: coarse) and (orientation: landscape) and (max-height: 520px) {
  html body #gameShell#gameShell .hud > div:nth-child(2) { gap: 3px !important; }
  html body #gameShell#gameShell .hud > div:nth-child(2) > span {
    font-size: 10px !important; margin-bottom: 2px !important; letter-spacing: .6px !important;
  }
  html body #gameShell#gameShell .hud b#heroStats,
  html body #gameShell#gameShell .hud > div:nth-child(2) > b {
    font-size: 11px !important;
  }
  html body #gameShell#gameShell #shieldStatus {
    padding: 3px 9px !important; margin-top: 3px !important; gap: 5px !important;
  }
  html body #gameShell#gameShell #shieldStatus b,
  html body #gameShell#gameShell #shieldStatus span {
    font-size: 9px !important;
  }
}
