:root {
  --navy: #071522;
  --navy-2: #0e2a44;
  --steel: #29465f;
  --cream: #f6f1e8;
  --orange: #f4932c;
  --orange-2: #ffb34f;
  --green: #4fd06d;
  --red: #ef5b57;
  --blue: #4da9f7;
  --text: #eaf4ff;
  --muted: #a8bdd0;
  --panel: rgba(7, 22, 38, .97);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; width: 100%; min-height: 100%; background: #050e17; color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overscroll-behavior: none; }
body { min-height: 100dvh; overflow-x: hidden; user-select: none; }
body.game-running, body.is-fullscreen { overflow: hidden; }
button, input { font: inherit; }
button { color: inherit; }

#app {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(8px, var(--safe-top)) max(8px, var(--safe-right)) max(8px, var(--safe-bottom)) max(8px, var(--safe-left));
  background:
    radial-gradient(circle at 20% 10%, rgba(48, 92, 125, .3), transparent 34%),
    radial-gradient(circle at 90% 90%, rgba(244, 147, 44, .12), transparent 30%),
    #050e17;
}

#gameShell { position: relative; width: min(1540px, 100%); display: flex; flex-direction: column; gap: 8px; }
.topbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 7px 5px 10px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(8, 27, 46, .92);
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
  backdrop-filter: blur(10px);
  z-index: 45;
}
.brand { appearance: none; border: 0; background: transparent; display: flex; align-items: center; gap: 9px; cursor: pointer; min-width: 0; padding: 0; text-align: left; }
.brand img { width: 45px; height: 45px; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 4px 5px rgba(0,0,0,.35)); }
.brand span { display: grid; line-height: 1; }
.brand strong { font-size: clamp(.84rem, 1.6vw, 1.05rem); letter-spacing: .075em; white-space: nowrap; }
.brand small { margin-top: 5px; color: var(--orange-2); font-size: .58rem; letter-spacing: .14em; white-space: nowrap; }
.profileStrip { display: flex; gap: 8px; margin-left: auto; }
.profileStrip > span { min-width: 92px; display: grid; place-items: center; padding: 5px 10px; border-radius: 11px; background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.08); }
.profileStrip b { color: var(--orange-2); font-size: .92rem; line-height: 1.05; }
.profileStrip small { margin-top: 3px; color: var(--muted); font-size: .52rem; font-weight: 800; letter-spacing: .08em; }
.topActions { display: flex; gap: 7px; }
.iconButton { width: 40px; height: 40px; border-radius: 12px; border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.07); cursor: pointer; font-size: 1.08rem; display: grid; place-items: center; transition: .18s ease; }
.iconButton:hover, .iconButton:focus-visible { background: rgba(255,255,255,.14); transform: translateY(-1px); outline: 2px solid var(--orange); outline-offset: 2px; }
#pauseButton { display: none; }
body.game-running #pauseButton { display: grid; }

#stage {
  position: relative;
  width: 100%;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.12);
  background: #0b2238;
  box-shadow: 0 24px 60px rgba(0,0,0,.42);
  isolation: isolate;
}
#gameCanvas { display: block; width: 100%; height: 100%; background: #10253a; touch-action: none; }

body.game-running #gameShell,
body.is-fullscreen #gameShell {
  width: min(100vw, calc(100dvh * 21 / 9));
  max-width: none;
  gap: 0;
}
body.game-running #stage,
body.is-fullscreen #stage { border-radius: 0; border: 0; box-shadow: none; }
body.game-running .topbar {
  position: absolute;
  top: calc(7px + var(--safe-top));
  right: calc(8px + var(--safe-right));
  min-height: 0;
  width: auto;
  padding: 4px;
  border-radius: 14px;
  background: rgba(4,16,27,.72);
  z-index: 55;
}
body.game-running .topbar .brand,
body.game-running .profileStrip { display: none; }
body.game-running .iconButton { width: 36px; height: 36px; background: rgba(18,45,65,.78); }
body.game-running .desktopControls { display: none; }
body.is-fullscreen #app,
body.game-running #app { padding: 0; background: #000; place-items: center; }

.screen { position: absolute; inset: 0; z-index: 20; display: none; overflow: hidden; }
.screen.active { display: flex; }
#loadingScreen { align-items: center; justify-content: center; background: linear-gradient(145deg, #0b2035, #06131f); z-index: 60; }
.loadingCard { width: min(360px, 82%); display: grid; place-items: center; text-align: center; }
.loadingCard img { width: 120px; height: 135px; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 12px 14px rgba(0,0,0,.45)); animation: idleBob 1.8s ease-in-out infinite; }
.loadingCard h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.5rem); text-transform: uppercase; letter-spacing: .05em; }
.loadingCard p { margin: 8px 0 18px; color: var(--muted); }
.loadingBar { width: 100%; height: 10px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.loadingBar span { display: block; height: 100%; width: 4%; border-radius: inherit; background: linear-gradient(90deg, var(--orange), #ffd06b); transition: width .25s ease; }

.menuScreen { align-items: stretch; justify-content: flex-start; background-image: url("assets/maps/example-scenario.png"); background-size: cover; background-position: center 35%; }
.menuShade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(4,14,25,.98) 0%, rgba(4,14,25,.9) 39%, rgba(4,14,25,.28) 77%, rgba(4,14,25,.54) 100%); }
.menuContent { position: relative; z-index: 1; width: min(620px, 60%); height: 100%; padding: clamp(24px, 4.8vw, 70px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.eyebrow { color: var(--orange-2); font-size: clamp(.6rem, 1.25vw, .8rem); font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.menuContent h1 { margin: 6px 0 0; font-size: clamp(2.1rem, 5vw, 4.9rem); line-height: .91; letter-spacing: -.035em; text-transform: uppercase; text-shadow: 0 5px 18px rgba(0,0,0,.5); }
.menuContent h2 { margin: 7px 0 10px; font-size: clamp(1rem, 2.5vw, 2rem); color: var(--orange-2); letter-spacing: .06em; text-transform: uppercase; }
.menuContent p { max-width: 560px; margin: 0 0 16px; color: #d4e3ef; font-size: clamp(.72rem, 1.4vw, .96rem); line-height: 1.48; }
.menuButtons { display: grid; grid-template-columns: 1fr 1fr; width: min(560px, 100%); gap: 8px; }
.primaryButton, .secondaryButton, .textButton { min-height: 43px; border-radius: 12px; padding: 9px 15px; font-weight: 800; cursor: pointer; transition: transform .16s ease, filter .16s ease, background .16s ease; }
.primaryButton { border: 0; background: linear-gradient(135deg, var(--orange), #ffb447); color: #15202b; box-shadow: 0 8px 20px rgba(244,147,44,.27); }
.secondaryButton { border: 1px solid rgba(255,255,255,.17); background: rgba(255,255,255,.08); color: white; }
.textButton { border: 0; background: transparent; color: var(--muted); }
.primaryButton:hover, .secondaryButton:hover, .textButton:hover, .primaryButton:focus-visible, .secondaryButton:focus-visible, .textButton:focus-visible { transform: translateY(-1px); filter: brightness(1.08); outline: 2px solid rgba(255,255,255,.75); outline-offset: 2px; }
.menuButtons .primaryButton { grid-column: 1 / -1; min-height: 49px; font-size: 1rem; }
.menuBadges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.menuBadges span { padding: 5px 8px; font-size: .64rem; color: #c9d9e8; border: 1px solid rgba(255,255,255,.11); border-radius: 999px; background: rgba(0,0,0,.24); }

.panelScreen { flex-direction: column; background: rgba(5,17,29,.975); overflow-y: auto; overscroll-behavior: contain; }
.panelHeader { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: clamp(13px, 2.2vw, 22px) clamp(15px, 3vw, 30px); border-bottom: 1px solid rgba(255,255,255,.1); background: rgba(8,27,46,.97); z-index: 2; }
.panelHeader h2 { margin: 3px 0 0; font-size: clamp(1.35rem, 3vw, 2.4rem); }
.stickyHeader { position: sticky; top: 0; }
.closeScreenButton { width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.08); font-size: 1.8rem; line-height: 1; cursor: pointer; }
.closeScreenButton:hover, .closeScreenButton:focus-visible { background: rgba(255,255,255,.15); outline: 2px solid var(--orange); }
.panelWallet { margin-left: auto; padding: 8px 13px; border-radius: 11px; background: rgba(244,147,44,.13); border: 1px solid rgba(244,147,44,.3); color: #ffd083; font-weight: 900; }

.levelGrid { padding: clamp(13px, 2.4vw, 25px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.levelCard { position: relative; min-height: 180px; border: 1px solid rgba(255,255,255,.12); border-radius: 15px; overflow: hidden; padding: 0; background: #102c45; cursor: pointer; text-align: left; box-shadow: 0 10px 25px rgba(0,0,0,.25); transition: .18s ease; }
.levelCard:hover:not(:disabled), .levelCard:focus-visible:not(:disabled) { transform: translateY(-3px); border-color: var(--orange); outline: 0; box-shadow: 0 14px 28px rgba(0,0,0,.35); }
.levelCard:disabled { cursor: not-allowed; filter: grayscale(.82) brightness(.55); }
.levelCard img { width: 100%; height: 104px; object-fit: cover; display: block; }
.levelCardBody { padding: 8px 10px 11px; }
.levelCardNumber { display: flex; justify-content: space-between; color: var(--orange-2); font-size: .62rem; font-weight: 900; letter-spacing: .1em; }
.levelCard h3 { margin: 3px 0 4px; font-size: .86rem; line-height: 1.18; }
.levelCard p { margin: 0; color: var(--muted); font-size: .64rem; line-height: 1.3; }
.levelLock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2rem; background: rgba(7,20,33,.28); }
.levelStatus { position: absolute; top: 7px; right: 7px; padding: 4px 7px; border-radius: 999px; font-weight: 900; font-size: .56rem; color: #082016; background: var(--green); box-shadow: 0 2px 8px rgba(0,0,0,.3); }

.briefingBody { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 20px; padding: clamp(15px, 3vw, 30px); min-height: 0; }
.briefingBody > img { width: 100%; min-height: 0; max-height: 100%; aspect-ratio: 21/9; object-fit: cover; border-radius: 15px; border: 1px solid rgba(255,255,255,.13); box-shadow: 0 15px 35px rgba(0,0,0,.3); }
.briefingInfo { display: flex; flex-direction: column; min-width: 0; }
.briefingInfo > p { margin: 0 0 10px; color: #c8d9e8; line-height: 1.48; font-size: .92rem; }
.briefingInfo h3 { margin: 4px 0 6px; }
.briefingInfo ol { margin: 0 0 10px; padding-left: 1.35em; color: #e4eef7; line-height: 1.45; font-size: .86rem; }
.briefingTips { display: grid; gap: 4px; margin: auto 0 10px; color: var(--muted); font-size: .71rem; }
.chapterTag { align-self: flex-start; margin-bottom: 8px; padding: 5px 9px; border-radius: 999px; color: #bfe7ff; background: rgba(77,169,247,.13); border: 1px solid rgba(77,169,247,.25); font-size: .64rem; font-weight: 800; }
.unlockHint, .unlockSummary { display: none; margin: 3px 0 10px; padding: 8px 10px; border-radius: 10px; color: #ffe4a9; background: rgba(244,147,44,.12); border: 1px solid rgba(244,147,44,.25); font-size: .75rem; }
.unlockHint.show, .unlockSummary.show { display: block; }

.upgradeIntro { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 12px clamp(15px,3vw,30px) 0; color: var(--muted); font-size: .78rem; }
.upgradeIntro p { margin: 0; }
.dangerMiniButton { flex: 0 0 auto; min-height: 34px; padding: 6px 10px; border-radius: 9px; border: 1px solid rgba(239,91,87,.35); background: rgba(239,91,87,.1); color: #ffc2c0; cursor: pointer; font-size: .68rem; font-weight: 800; }
.upgradeGrid { padding: clamp(13px, 2.4vw, 25px); display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.upgradeCard { display: flex; flex-direction: column; min-height: 190px; padding: 14px; border-radius: 15px; border: 1px solid rgba(255,255,255,.1); background: linear-gradient(155deg, rgba(27,61,87,.9), rgba(8,25,41,.95)); box-shadow: 0 10px 23px rgba(0,0,0,.2); }
.upgradeCard .upgradeIcon { font-size: 2rem; }
.upgradeCard h3 { margin: 7px 0 4px; font-size: .96rem; }
.upgradeCard p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.4; }
.upgradeLevel { display: flex; gap: 5px; margin: 10px 0; }
.upgradeLevel i { width: 27px; height: 7px; border-radius: 999px; background: rgba(255,255,255,.1); }
.upgradeLevel i.active { background: linear-gradient(90deg,var(--orange),#ffd06b); }
.upgradeCard button { margin-top: auto; min-height: 38px; border-radius: 10px; border: 0; background: rgba(244,147,44,.18); color: #ffd79b; font-weight: 900; cursor: pointer; }
.upgradeCard button:not(:disabled):hover { background: rgba(244,147,44,.28); }
.upgradeCard button:disabled { color: #71818d; cursor: not-allowed; }

.helpGrid { padding: clamp(15px, 3vw, 30px); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.helpGrid article { padding: 12px; border: 1px solid rgba(255,255,255,.1); border-radius: 13px; background: rgba(255,255,255,.05); }
.helpGrid h3 { margin: 5px 0 4px; font-size: .87rem; }
.helpGrid p { margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.4; }
.helpIcon { color: var(--orange-2); font-size: 1.35rem; font-weight: 900; }
.keyboardHint { margin: 0 clamp(15px,3vw,30px) 20px; padding: 9px 11px; border-radius: 11px; background: rgba(77,169,247,.1); color: #cfe8ff; text-align: center; font-size: .68rem; }

.galleryBody { padding: clamp(15px, 3vw, 30px); display: grid; gap: 22px; }
.galleryBody figure { margin: 0; border-radius: 15px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.04); }
.galleryBody img { display: block; width: 100%; height: auto; }
.galleryBody figcaption { padding: 9px 13px; color: #d4e2ef; font-size: .73rem; }

.compactScreen { align-items: center; justify-content: center; padding: 16px; background: rgba(3,12,21,.84); backdrop-filter: blur(8px); z-index: 50; }
.modalCard { width: min(420px, 92%); max-height: 94%; overflow-y: auto; display: grid; gap: 9px; padding: 22px; border: 1px solid rgba(255,255,255,.14); border-radius: 18px; background: linear-gradient(150deg, rgba(15,46,72,.98), rgba(6,20,34,.98)); box-shadow: 0 24px 65px rgba(0,0,0,.55); text-align: center; }
.modalCard h2 { margin: 0; font-size: 1.9rem; }
.modalCard p { margin: 0 0 3px; color: var(--muted); line-height: 1.45; font-size: .86rem; }
.successSeal, .dangerSeal { width: 59px; height: 59px; border-radius: 50%; margin: 0 auto 2px; display: grid; place-items: center; font-size: 1.9rem; font-weight: 950; }
.successSeal { background: var(--green); color: #062315; box-shadow: 0 0 0 8px rgba(79,208,109,.14); }
.dangerSeal { background: var(--red); color: #300b0b; box-shadow: 0 0 0 8px rgba(239,91,87,.14); }
.completeStats { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; }
.completeStats div { padding: 8px 3px; border-radius: 10px; background: rgba(255,255,255,.06); }
.completeStats strong { display: block; font-size: .97rem; color: var(--orange-2); }
.completeStats span { color: var(--muted); font-size: .54rem; }

.dialogueScreen { align-items: flex-end; justify-content: center; padding: 0 7% 6%; background: linear-gradient(transparent 35%,rgba(2,9,16,.78)); z-index: 48; }
.dialogueCard { width: min(960px, 94%); min-height: 112px; display: grid; grid-template-columns: 92px 1fr 52px; gap: 13px; align-items: center; padding: 12px 14px; border-radius: 17px; border: 1px solid rgba(255,255,255,.18); background: rgba(5,18,31,.95); box-shadow: 0 18px 45px rgba(0,0,0,.5); }
.dialogueAvatar { width: 82px; height: 88px; overflow: hidden; border-radius: 13px; background: linear-gradient(145deg,#224866,#0b2338); border: 1px solid rgba(255,255,255,.12); display: grid; place-items: end center; }
.dialogueAvatar img { width: 90px; height: 100px; object-fit: contain; object-position: bottom; }
.dialogueAvatar.emoji { font-size: 3.2rem; place-items: center; }
.dialogueCopy p { margin: 4px 0 5px; color: white; line-height: 1.42; font-size: clamp(.78rem,1.5vw,1rem); }
.dialogueCopy small { color: #7f98aa; font-size: .62rem; }
.dialogueNext { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--orange); color: #18222b; font-size: 2rem; cursor: pointer; animation: actionPulse 1.2s ease-in-out infinite; }

#toast { position: absolute; z-index: 65; left: 50%; bottom: 17px; max-width: min(650px, 84%); transform: translate(-50%, 16px); opacity: 0; pointer-events: none; padding: 9px 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 11px; background: rgba(5,17,29,.95); color: white; font-size: .76rem; text-align: center; box-shadow: 0 10px 25px rgba(0,0,0,.4); transition: .22s ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#mobileControls { display: none; position: absolute; inset: 0; z-index: 16; pointer-events: none; touch-action: none; }
body.game-running #mobileControls { display: none; }
.dpad { position: absolute; left: calc(11px + var(--safe-left)); bottom: calc(9px + var(--safe-bottom)); width: 160px; height: 118px; pointer-events: none; }
.controlButton, .miniControl { border: 1px solid rgba(255,255,255,.14); background: linear-gradient(145deg, rgba(34,71,99,.82), rgba(10,31,50,.86)); color: white; box-shadow: 0 8px 18px rgba(0,0,0,.28), inset 0 1px rgba(255,255,255,.08); touch-action: none; cursor: pointer; pointer-events: auto; backdrop-filter: blur(3px); }
.controlButton.active, .miniControl.active, .controlButton:active, .miniControl:active { transform: scale(.93); filter: brightness(1.25); border-color: var(--orange); }
.dpad .controlButton { position: absolute; width: 50px; height: 50px; border-radius: 15px; font-size: 1.1rem; }
.dpad .up { left: 53px; top: 0; }
.dpad .left { left: 0; top: 52px; }
.dpad .down { left: 53px; top: 52px; }
.dpad .right { left: 106px; top: 52px; }
.actionPad { position: absolute; right: calc(10px + var(--safe-right)); bottom: calc(8px + var(--safe-bottom)); width: 235px; height: 128px; pointer-events: none; }
.actionPad .controlButton { position: absolute; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 1px; }
.actionPad .controlButton span, .miniControl span { font-size: 1.3rem; line-height: 1; }
.actionPad .controlButton small, .miniControl small { font-size: .5rem; font-weight: 900; letter-spacing: .05em; }
.actionPad .action { left: 0; top: 40px; }
.actionPad .attack { left: 77px; top: 3px; background: linear-gradient(145deg, rgba(127,55,40,.9), rgba(64,22,20,.9)); }
.actionPad .jump { right: 0; top: 35px; background: linear-gradient(145deg, rgba(223,132,41,.92), rgba(143,71,20,.92)); }
.actionPad .action.hint { animation: actionPulse 1s ease-in-out infinite; border-color: #9be8ff; }
.utilityPad { position: absolute; right: calc(250px + var(--safe-right)); bottom: calc(12px + var(--safe-bottom)); display: flex; gap: 7px; pointer-events: none; }
.miniControl { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; align-content: center; gap: 1px; }
.miniControl.dash { background: linear-gradient(145deg,rgba(70,103,132,.9),rgba(17,42,63,.9)); }

.desktopControls { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 14px; padding: 5px; color: var(--muted); font-size: .65rem; }
kbd { display: inline-grid; place-items: center; min-width: 21px; height: 20px; margin: 0 1px; padding: 0 4px; border: 1px solid rgba(255,255,255,.2); border-bottom-width: 2px; border-radius: 5px; background: rgba(255,255,255,.06); color: white; font: inherit; }

#orientationHint { position: fixed; z-index: 100; top: calc(7px + var(--safe-top)); left: 50%; transform: translate(-50%,-150%); opacity: 0; pointer-events: none; padding: 7px 11px; border-radius: 999px; background: rgba(7,24,40,.96); border: 1px solid rgba(255,255,255,.14); font-size: .67rem; box-shadow: 0 8px 20px rgba(0,0,0,.3); transition: .25s ease; white-space: nowrap; }
#orientationHint span { color: var(--orange-2); font-size: 1rem; margin-right: 4px; }

@keyframes idleBob { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-5px) } }
@keyframes actionPulse { 0%,100% { box-shadow: 0 8px 18px rgba(0,0,0,.3), 0 0 0 0 rgba(77,169,247,.35) } 50% { box-shadow: 0 8px 18px rgba(0,0,0,.3), 0 0 0 9px rgba(77,169,247,0) } }

@media (hover: none), (pointer: coarse) {
  body.game-running #mobileControls { display: block; }
  .desktopControls { display: none; }
  #gameShell { gap: 5px; }
  .topbar { min-height: 46px; }
  .brand img { width: 38px; height: 38px; }
  .iconButton { width: 36px; height: 36px; border-radius: 10px; }
}

@media (max-width: 1050px) {
  .profileStrip > span { min-width: 75px; padding: 5px 7px; }
  .levelGrid, .upgradeGrid { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .helpGrid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 820px) {
  #app { place-items: start center; padding-left: 4px; padding-right: 4px; }
  .profileStrip { display: none; }
  .levelGrid, .upgradeGrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .briefingBody { grid-template-columns: 1fr; }
  .briefingBody > img { max-height: none; }
  .helpGrid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .menuContent { width: 72%; }
}

@media (max-width: 600px) {
  .topbar { border-radius: 12px; }
  #stage { border-radius: 12px; }
  .menuContent { width: 85%; padding: 18px 16px; }
  .menuShade { background: linear-gradient(90deg, rgba(4,14,25,.98), rgba(4,14,25,.72)); }
  .menuButtons { grid-template-columns: 1fr 1fr; gap: 6px; }
  .primaryButton, .secondaryButton { padding: 7px 9px; min-height: 38px; font-size: .7rem; }
  .menuButtons .primaryButton { min-height: 43px; }
  .menuBadges { display: none; }
  .panelHeader { padding: 10px 13px; }
  .levelGrid, .upgradeGrid { padding: 9px; gap: 8px; }
  .levelCard { min-height: 148px; }
  .levelCard img { height: 82px; }
  .levelCardBody { padding: 6px 7px 8px; }
  .levelCard h3 { font-size: .73rem; }
  .levelCard p { display: none; }
  .helpGrid { grid-template-columns: 1fr; padding: 10px; }
  .helpGrid article { padding: 9px; }
  .galleryBody { padding: 9px; gap: 11px; }
  .upgradeIntro { padding: 9px 10px 0; }
}

@media (orientation: portrait) and (max-width: 850px) {
  #orientationHint { transform: translate(-50%,0); opacity: 1; }
  .menuContent h1 { font-size: clamp(1.9rem, 9vw, 3.3rem); }
}

@media (max-height: 620px) and (orientation: landscape) {
  #app { padding: 0; place-items: center; }
  #gameShell { width: min(100vw, calc(100dvh * 21 / 9)); }
  .topbar { position: absolute; top: calc(5px + var(--safe-top)); right: calc(6px + var(--safe-right)); z-index: 56; width: auto; min-height: 0; padding: 3px; border-radius: 12px; background: rgba(4,16,27,.72); }
  .topbar .brand, .topbar .profileStrip { display: none; }
  .iconButton { width: 32px; height: 32px; }
  #stage { border-radius: 0; border: 0; box-shadow: none; }
  .desktopControls { display: none; }
  .dpad { transform: scale(.78); transform-origin: left bottom; }
  .actionPad { transform: scale(.78); transform-origin: right bottom; }
  .utilityPad { transform: scale(.78); transform-origin: right bottom; right: calc(200px + var(--safe-right)); }
  .dialogueScreen { padding-bottom: 3%; }
  .dialogueCard { min-height: 90px; grid-template-columns: 70px 1fr 42px; padding: 8px 10px; }
  .dialogueAvatar { width: 62px; height: 66px; }
  .dialogueAvatar img { width: 72px; height: 78px; }
}
