/* Desktop controls retain their existing markup, geometry and stylesheet. */
.mobileExperienceOnly { display: none !important; }
@media (max-width: 640px), (hover: none) and (pointer: coarse), (orientation: landscape) and (max-width: 920px) and (max-height: 520px) {
  html.mobileExperience .mobileExperienceOnly:not([hidden]) { display: block !important; }
  html.mobileExperience .lobby:not(.roomLobbyView) .brand { display: none; }
  html.mobileExperience .lobby:not(.roomLobbyView) { padding: 14px; }
  html.mobileExperience .lobby:not(.roomLobbyView) .setup { padding: 0; border: 0; background: transparent; }
  html.mobileExperience #mainLobbyControls { display: flex; flex-direction: column; gap: 12px; }
  html.mobileExperience #mobileHome { order: -2; padding: 8px 0 4px; }
  html.mobileExperience #mobileHome h1 { margin: 0 0 6px; font-size: 30px; line-height: 1.1; }
  html.mobileExperience #mobileHome p { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
  html.mobileExperience #mobileHome .mobileHomeActions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  html.mobileExperience #mobileHome button { min-height: 48px; font-size: 16px; }
  html.mobileExperience #mobileContinue { width: 100%; text-align: left; margin-bottom: 12px; }
  html.mobileExperience #mobileContinue small { display: block; font-size: 13px; font-weight: 400; }
  html.mobileExperience #mobileConnection { min-height: 20px; margin-top: 10px; font-size: 13px; color: var(--muted); }
  html.mobileExperience #mainLobbyControls > .helpLabel:has(#nameInput) { order: -1; }
  html.mobileExperience #mainLobbyControls > .firstCommandLobbyCard,
  html.mobileExperience #mainLobbyControls > .customCampaignDivider,
  html.mobileExperience #mainLobbyControls > #tutorialButton,
  html.mobileExperience #mainLobbyControls > #instructionsButton { display: none; }
  html.mobileExperience #mainLobbyControls:not(.mobileCustomOpen) > .helpLabel:not(:has(#nameInput)),
  html.mobileExperience #mainLobbyControls:not(.mobileCustomOpen) > #createRoomButton { display: none; }
  html.mobileExperience #mobileCustomToggle { width: 100%; min-height: 44px; }
  html.mobileExperience #lobby.mainLobbyView .leaderboardPanel,
  html.mobileExperience #lobby.mainLobbyView .breadboardGeniusBanner,
  html.mobileExperience #lobby.mainLobbyView .siteNavigation > strong,
  html.mobileExperience #lobby.mainLobbyView .siteNavigationLinks a:nth-child(n+5) { display: none !important; }
  html.mobileExperience #lobby.mainLobbyView .siteNavigationLinks { grid-template-columns: 1fr 1fr; }
  html.mobileExperience #lobby.mainLobbyView .siteNavigationLinks a { padding: 12px 4px; min-height: 44px; }
  html.mobileExperience #mainLobbyControls .externalLinks { display: flex; flex-wrap: wrap; gap: 8px; }
  html.mobileExperience #mainLobbyControls .externalLinks > * { min-height: 44px; flex: 1; }
  html.mobileExperience .roomLobbyControls input, html.mobileExperience .roomLobbyControls select { min-height: 44px; }
  html.mobileExperience .roomLobbyControls .campaignSetupActions { position: sticky; top: 0; z-index: 10; background: #171e18; padding: 8px 0; }
  html.mobileExperience .roomLobbyControls .campaignSetupActions button { min-height: 44px; }
  html.mobileExperience .roomLobbyControls .campaignSetupCard p:nth-of-type(2) { display: none; }
  html.mobileExperience .game, html.mobileExperience .game.grandMasterHud { --mobile-turn-actions-height: calc(190px + env(safe-area-inset-bottom, 0px)); }
  html.mobileExperience .game .topbar, html.mobileExperience .game.grandMasterHud .topbar { grid-template-columns: 1fr; grid-template-areas: 'resources'; }
  html.mobileExperience .game .resourceBar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html.mobileExperience .mobileTurnActions { grid-template-rows: 60px 24px 46px 44px; gap: 3px; padding: 4px 8px max(3px, env(safe-area-inset-bottom, 0px)); background: #141d1b; }
  html.mobileExperience .mobileCommandContext.mobileExperienceOnly:not([hidden]) { display: flex !important; min-width: 0; align-items: center; gap: 8px; }
  html.mobileExperience .mobileCommandText { min-width: 0; flex: 1; display: grid; gap: 3px; }
  html.mobileExperience .mobileCommandText strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.mobileExperience .mobileCommandText span { font-size: 12px; line-height: 1.35; color: var(--muted); }
  html.mobileExperience .mobileCommandContext.isAtRisk .mobileCommandText span { color: #ffd795; }
  html.mobileExperience .mobileContextLinks { display: flex; gap: 4px; }
  html.mobileExperience .mobileContextLinks button { min-height: 44px; padding: 0 7px; font-size: 12px; }
  html.mobileExperience .mobileTurnHint { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html.mobileExperience .mobileTurnButtons { gap: 6px; overflow-x: auto; }
  html.mobileExperience .mobileTurnButtons button { flex: 1; min-width: 0; min-height: 46px; padding: 0 8px; font-size: 14px; }
  html.mobileExperience #mobileTurnActions > .mobileTopActions { grid-area: auto; display: flex; width: 100%; gap: 6px; }
  html.mobileExperience #mobileTurnActions > .mobileTopActions button { flex: 1; min-height: 44px; height: 44px; font-size: 14px; }
  html.mobileExperience #mobileTurnActions > .mobileTopActions .mobileGameMenuButton { flex: 0 0 48px; font-size: 22px; }
  html.mobileExperience #mobileTurnActions > .mobileTopActions [data-mobile-static='end-turn'] { flex: 2; }
  html.mobileExperience .mobileCountryIntel:not(.compactNotice) { display: none !important; }
  html.mobileExperience .mobileDrawerPanel { width: min(520px, 100%); }
  html.mobileExperience .mobileCountryChoices { display: grid; gap: 8px; }
  html.mobileExperience .mobileCountryChoices button { min-height: 56px; text-align: left; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; }
  html.mobileExperience .mobileCountryChoices button span { color: var(--muted); font-size: 13px; }
  html.mobileExperience .mobileCountryChoices button[aria-pressed='true'] { border-color: var(--gold); }
  html.mobileExperience #liveTutorialOverlay .liveTutorialPortrait, html.mobileExperience #liveTutorialOverlay .tutorialKicker,
  html.mobileExperience #liveTutorialOverlay #liveTutorialHint, html.mobileExperience #liveTutorialOverlay .firstCommandProgress,
  html.mobileExperience #liveTutorialOverlay .firstCommandFacts { display: none !important; }
  html.mobileExperience #liveTutorialOverlay .liveTutorialCard { width: min(420px, calc(100vw - 20px)); padding: 10px; }
  html.mobileExperience #liveTutorialOverlay .liveTutorialCard h2 { font-size: 15px; margin: 0 0 6px; }
  html.mobileExperience #liveTutorialOverlay .liveTutorialCard p { font-size: 14px; line-height: 1.4; margin: 4px 0; }
  html.mobileExperience #liveTutorialOverlay .liveTutorialHeader { gap: 6px; }
  html.mobileExperience #liveTutorialOverlay .liveTutorialDisable { font-size: 12px; min-height: 34px; }
  html.mobileExperience #liveTutorialOverlay .liveTutorialActions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
  html.mobileExperience #liveTutorialOverlay .liveTutorialActions button { min-height: 40px; padding: 5px 9px; font-size: 13px; }
  html.mobileExperience #liveTutorialOverlay.firstCommandPractice .liveTutorialCard { max-height: min(230px, 35dvh) !important; }
  html.mobileExperience #liveTutorialOverlay.firstCommandPractice:not(.mobilePracticeRecovery) [data-live-tutorial-action='retry'] { display: none; }
  html.mobileExperience #liveTutorialOverlay.firstCommandPractice [data-live-tutorial-action='close'] { display: none; }
  html.mobileExperience #liveTutorialOverlay.firstCommandPractice [data-live-tutorial-action='continue'] { flex: 2; }
  html.mobileExperience .mobileAmount .armyAmountStepper { display: grid; grid-template-columns: 1fr 112px; gap: 8px; }
  html.mobileExperience .mobileAmount .armyAmountStepControls { display: flex; gap: 6px; }
  html.mobileExperience .mobileAmount .armyAmountStep { width: 52px; height: 52px; font-size: 26px; }
  html.mobileExperience .mobileAmount .armyAmountInput { min-height: 52px; font-size: 22px; text-align: center; }
  html.mobileExperience .mobileArmyPresets { display: flex; gap: 8px; margin-top: 14px; }
  html.mobileExperience .mobileArmyPresets button { flex: 1; min-height: 44px; }
  html.mobileExperience .mobileAmount .armyAmountActions button { min-height: 48px; }
}
@media (orientation: landscape) and (max-height: 520px) and (max-width: 920px), (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  html.mobileExperience .game, html.mobileExperience .game.grandMasterHud { --mobile-turn-actions-height: 0px; --mobile-command-width: 264px; }
  html.mobileExperience #battlefield, html.mobileExperience #battlefieldGpu { width: calc(100% - var(--mobile-command-width)); right: var(--mobile-command-width); bottom: env(safe-area-inset-bottom, 0px); }
  html.mobileExperience #mobileTurnActions { left: auto; right: 0; top: var(--game-playfield-top); bottom: 0; width: var(--mobile-command-width); height: auto; grid-template-rows: 72px 32px 48px 48px; align-content: end; border-left: 1px solid var(--line); padding-bottom: max(6px, env(safe-area-inset-bottom, 0px)); }
  html.mobileExperience .mobileContextLinks { flex-direction: column; gap: 2px; }
  html.mobileExperience .mobileContextLinks button { min-height: 34px; }
  html.mobileExperience .mobileTurnHint { white-space: normal; line-height: 16px; }
  html.mobileExperience .mobileTurnButtons button { font-size: 12px; padding: 0 4px; }
  html.mobileExperience #liveTutorialOverlay.firstCommandPractice .liveTutorialCard { max-height: 46dvh !important; }
  html.mobileExperience .floatingChat { max-width: calc(100% - 280px); }
}
