/* Smartphone shell. Shared window, surface and button roles supply GoM art.
   Layout selection lives in uiMode.js; there are no competing width gates. */
#compactNavigation, #compactPlayerButton, #compactMenuButton { display: none; }
html.gom-compact { --material-leather: var(--mg-surface-panel); --material-leather-hover: var(--mg-surface-chrome); --ui-user-scale: 1 !important; --ui-auto-scale: 1 !important; --ui-scale: 1 !important; --compact-nav-height: 52px; --compact-activity-height: 0px; }
html.gom-compact.gom-compact-activity { --compact-activity-height: 44px; }
html.gom-compact, html.gom-compact body { width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
html.gom-compact body { background: var(--mg-surface-window); font-size: 15px; }
html.gom-compact body::before, html.gom-compact body::after { display: none; }
html.gom-compact #gameViewport, html.gom-compact #uiCanvas { width: 100% !important; height: var(--compact-viewport-height, 100dvh) !important; top: var(--compact-viewport-top, 0px) !important; transform: none !important; }
html.gom-compact #uiCanvas { top: 0 !important; }
html.gom-compact #app { display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto auto; width: 100%; height: 100%; min-width: 0; min-height: 0; }
html.gom-compact #app.app-hidden { display: none; }
html.gom-compact #sidebar { display: none; }
html.gom-compact #topBar { grid-area: 1/1; display: grid; grid-template-columns: minmax(0,1fr) 48px; gap: 0 8px; padding: max(4px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) 6px max(10px,env(safe-area-inset-left)); height: auto; min-height: 80px; overflow: visible; z-index: 100; font-size: 13px; background: var(--mg-surface-chrome); }
html.gom-compact #compactPlayerButton { display: flex; grid-area: 1/1; justify-content: flex-start; gap: 8px; min-width: 0; height: 44px; margin: 0; padding: 2px 0; text-align: left; }
html.gom-compact #compactPlayerButton img { width: 38px; height: 38px; object-fit: contain; }
html.gom-compact #compactPlayerButton span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 19px Georgia,serif; }
html.gom-compact #compactMenuButton { display: inline-grid; grid-area: 1/2; place-items: center; font-size: 25px; min-width: 44px; min-height: 44px; padding: 0; margin: 0; }
html.gom-compact #compactMenuButton.has-unread::after { content: '•'; position: absolute; color: #ebc579; top: 2px; right: 2px; }
html.gom-compact #topBar .topbar-zone--left { grid-area: 2/1/3/3; display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 8px; min-width: 0; width: 100%; padding: 0; overflow: visible; }
html.gom-compact #topBar :is(#playerLocation,#worldMapBtn,.topbar-world-info,.topbar-zone--right) { display: none; }
html.gom-compact #playerHealth { min-width: 0; max-width: 60%; font-size: 12px; }
html.gom-compact #playerCoins { flex: 0 1 auto; min-width: 0; font-size: 13px; }
html.gom-compact .topbar-health-wrap { gap: 4px; }
html.gom-compact #main { grid-area: 2/1; display: block; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior-y: contain; padding: 0; background: var(--mg-surface-window); touch-action: pan-y; }
html.gom-compact #skillView { display: block; min-height: 100%; height: auto; padding: 0 0 12px; overflow: visible; position: relative; }
html.gom-compact #bottomBar { grid-area: 3/1; position: relative; height: var(--compact-activity-height); min-height: 0; width: 100%; min-width: 0; max-width: 100%; padding: 0 8px; border: 0 !important; box-sizing: border-box; overflow: visible; background: var(--mg-surface-chrome); z-index: 150; }
html.gom-compact #bottomBar .bottom-bar-shell { display: block; height: var(--compact-activity-height); width: 100%; min-width: 0; overflow: visible; }
html.gom-compact #bottomBar:not(.has-compact-activity) :is(.bottom-bar-info-strip, .bottom-bar-actions, .mg-frame-art) { display: none; }
html.gom-compact #bottomBar .bottom-bar-info-strip { display: block; min-width: 0; width: 100%; height: var(--compact-activity-height); overflow: visible; }
html.gom-compact #bottomBar .bottom-bar-zone--left, html.gom-compact #bottomBar .bottom-bar-scene-actions, html.gom-compact #bottomBar [data-bottom-extra-actions] { display: none; }
html.gom-compact #bottomBar .bottom-bar-zone--middle { display: flex; width: 100%; height: var(--compact-activity-height); min-width: 0; overflow: visible; }
html.gom-compact #bottomBar .bottom-info-xp { width: 100%; min-width: 0; max-width: none; flex: 1 1 auto; height: 44px; min-height: 44px !important; margin: 0; padding: 0 6px; box-sizing: border-box; }
html.gom-compact .bottom-info-xp .bottom-info-icon { width: 28px; height: 28px; }
html.gom-compact .bottom-info-xp .bottom-info-title { font-size: 13px; line-height: 1.2; }
html.gom-compact .bottom-info-xp [data-bottom-loadout-summary] { display: none; }
html.gom-compact #bottomBar .bottom-info-activity-stop { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; padding-block: 0; box-sizing: border-box; }
html.gom-compact #bottomBar .bottom-bar-actions { display: none; }
html.gom-compact #bottomBarChatToggle { width: 44px; min-height: 44px; }
html.gom-compact #compactNavigation { grid-area: 4/1; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); width: 100%; height: calc(var(--compact-nav-height) + env(safe-area-inset-bottom)); min-height: calc(var(--compact-nav-height) + env(safe-area-inset-bottom)); padding: 3px env(safe-area-inset-right) calc(3px + env(safe-area-inset-bottom)) env(safe-area-inset-left); box-sizing: border-box; background: var(--mg-surface-chrome); border-top: 1px solid #77613f; z-index: 160; }
html.gom-compact #compactNavigation[hidden] { display: none; }
html.gom-compact #compactNavigation button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 0; min-height: 44px; padding: 2px; margin: 0; font: 11px/1.2 Georgia,serif; border-radius: 0; }
html.gom-compact #compactNavigation img { width: 30px; height: 30px; object-fit: contain; }
html.gom-compact :is(button,input,select,textarea,summary) { touch-action: manipulation; }
html.gom-compact :is(input,select,textarea) { font-size: 16px; max-width: 100%; box-sizing: border-box; }
html.gom-compact button { -webkit-tap-highlight-color: transparent; }
html.gom-compact .ui-btn { min-height: 42px; }
html.gom-compact :is(.compact-city-header,.location-compact-header) { position: relative; margin: 0 0 12px; padding: 0 0 10px; background: var(--mg-surface-window); border-bottom: 1px solid #77613f; }
html.gom-compact :is(.compact-city-header h2,.compact-city-header p,.location-compact-heading) { margin: 6px 14px; }
html.gom-compact :is(.compact-city-header h2,.location-compact-heading h2) { font: 23px/1.25 Georgia,serif; color: var(--ui-text,#e9dfcb); }
html.gom-compact :is(.compact-city-districts,.compact-city-section,.compact-city-outskirts,.compact-city-notice-board,.location-compact-actions,.location-compact-travel) { margin: 12px; }
html.gom-compact .compact-city-districts { display: flex; flex-wrap: wrap; gap: 6px; }
html.gom-compact .compact-city-districts button { flex: 1 1 130px; white-space: normal; }
html.gom-compact .compact-city-districts [aria-current=page] { color: #f0cf8e; }
html.gom-compact :is(.compact-city-list,.location-compact-action-list) { display: grid; gap: 10px; }
html.gom-compact :is(.compact-city-card,.location-compact-action) { display: flex; position: relative; align-items: center; gap: 12px; width: 100%; min-width: 0; min-height: 82px; height: auto; padding: 10px 12px; margin: 0; box-sizing: border-box; text-align: left; white-space: normal; border: 1px solid #77613f; border-radius: 2px; color: var(--ui-text,#e9dfcb); background: var(--mg-surface-panel); }
html.gom-compact :is(.compact-city-card-art,.location-compact-action img) { display: flex; flex: 0 0 56px; width: 56px; height: 56px; max-height: 64px; object-fit: contain; }
html.gom-compact .compact-city-card-art.is-location-image { width: 76px; flex-basis: 76px; height: 62px; border: 1px solid #655034; }
html.gom-compact :is(.compact-city-card-copy,.location-compact-action .location-scene-node-content) { display: flex; flex: 1 1 auto; flex-direction: column; gap: 5px; min-width: 0; }
html.gom-compact .compact-city-card-copy strong { font: 19px/1.2 Georgia,serif; }
html.gom-compact :is(.city-scene-node-meta,.city-scene-node-note,.location-scene-node-meta) { display: block; white-space: normal; font-size: 12px; line-height: 1.4; opacity: .85; }
html.gom-compact .city-scene-skill-icons { display: flex; gap: 3px; }
html.gom-compact .city-scene-skill-icons img { width: 22px; height: 22px; object-fit: contain; }
html.gom-compact .compact-city-card-arrow { margin-left: auto; font-size: 24px; }
html.gom-compact .compact-city-section h3, html.gom-compact .location-compact-action-group h3 { font: 17px Georgia,serif; margin: 18px 0 9px; color: #d6be89; }
html.gom-compact .location-compact-screen { display: block; position: relative; inset: auto; width: 100%; max-width: none; min-width: 0; height: auto; max-height: none; padding: 0; margin: 0; overflow: visible; transform: none; zoom: 1; background: transparent; }
html.gom-compact .location-compact-overlay { position: relative; inset: auto; height: auto; min-width: 0; overflow: visible; }
html.gom-compact .location-compact-action { inset: auto !important; transform: none !important; max-width: none; pointer-events: auto; }
html.gom-compact .location-compact-action :is(.location-scene-node-icon,.location-scene-node-portrait) { position: static; inset: auto; flex: 0 0 50px; width: 50px; height: 50px; margin: 0; transform: none; }
html.gom-compact .location-compact-action .location-scene-node-label { position: static; display: block; max-width: none; white-space: normal; font: 17px/1.35 Georgia,serif; transform: none; }
html.gom-compact .location-compact-action .location-scene-node-copy { min-width: 0; flex: 1; }
html.gom-compact .location-compact-action .city-scene-node-card { display: flex; position: static; flex: 1; flex-direction: column; align-items: flex-start; gap: 5px; width: auto; min-width: 0; max-width: none; padding: 0; border: 0; background: transparent; box-shadow: none; opacity: 1; visibility: visible; transform: none; pointer-events: auto; white-space: normal; }
html.gom-compact .location-compact-action .city-scene-node-card strong { font: 18px/1.25 Georgia,serif; }
html.gom-compact .location-compact-action .city-scene-node-card :is(span,small) { white-space: normal; line-height: 1.4; }
html.gom-compact .location-compact-action-group h2 { font: 17px Georgia,serif; margin: 18px 0 9px; color: #d6be89; }
html.gom-compact .location-compact-travel summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
html.gom-compact .location-compact-travel [data-role=location-return-menu] { position: static !important; display: flex !important; flex-direction: column; opacity: 1; visibility: visible; transform: none; width: 100%; max-height: none; }
html.gom-compact .location-compact-travel button { white-space: normal; min-height: 44px; }
/* Shared dialogs and workstations retain their original content and actions. */
html.gom-compact .overlay:not(.hidden) { position: fixed; inset: 0; width: 100%; height: var(--compact-viewport-height,100dvh); padding: max(6px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) calc(var(--compact-nav-height) + env(safe-area-inset-bottom) + 6px) max(6px,env(safe-area-inset-left)); box-sizing: border-box; align-items: stretch; justify-content: stretch; overflow: auto; }
html.gom-compact :is(.overlay > *, .overlay .game-window, .overlay .overlay-content) { min-width: 0 !important; max-width: 100% !important; max-height: 100% !important; box-sizing: border-box; zoom: 1 !important; }
html.gom-compact :is(.overlay .game-window,.overlay .overlay-content,#inventoryContent,#bankContent,#characterContent,#journalContent,#worldMapContent,#settingsContent) { width: 100% !important; left: auto !important; right: auto !important; top: auto !important; bottom: auto !important; transform: none !important; margin: 0 !important; }
html.gom-compact #skillOverlay .skill-overview-window { width: 100% !important; height: 100% !important; max-height: none !important; padding: 18px 14px; }
html.gom-compact .location-scene-drawer { position: fixed !important; inset: max(5px,env(safe-area-inset-top)) max(5px,env(safe-area-inset-right)) calc(var(--compact-nav-height) + env(safe-area-inset-bottom) + 5px) max(5px,env(safe-area-inset-left)) !important; min-width: 0 !important; width: auto !important; max-width: none !important; max-height: none !important; height: auto !important; margin: 0 !important; padding: 16px !important; transform: none !important; zoom: 1 !important; overflow: auto; z-index: 700; }
html.gom-compact .location-scene-drawer :is(.game-window,.processing-window,.skill-panel) { min-width: 0 !important; max-width: 100% !important; width: 100% !important; margin: 0 !important; box-sizing: border-box; }
html.gom-compact .location-scene-drawer :is(.processing-layout,.crafting-layout,.skill-layout,.station-layout) { grid-template-columns: minmax(0,1fr); }
html.gom-compact #bottomChatWindowHost .bottom-chat-panel[data-chat-window-mode=compact] { position: fixed; inset: max(6px,env(safe-area-inset-top)) 6px calc(var(--compact-nav-height) + env(safe-area-inset-bottom) + 6px); width: auto !important; height: auto !important; max-height: none !important; min-width: 0; zoom: 1; box-sizing: border-box; }
html.gom-compact .bottom-chat-panel .bottom-chat-header { flex-wrap: wrap; }
html.gom-compact .bottom-chat-input { font-size: 16px; min-height: 42px; }
html.gom-compact .bottom-info-panel { position: fixed; left: 6px !important; right: 6px !important; bottom: calc(var(--compact-nav-height) + var(--compact-activity-height) + env(safe-area-inset-bottom)) !important; top: auto; width: auto !important; max-height: calc(var(--compact-viewport-height,100dvh) - 190px); overflow: clip; box-sizing: border-box; zoom: 1; }
html.gom-compact #rightHudOverlayStack { display: none; }
html.gom-compact :is(#weatherEffectLayer,#solarBlendLayer,#locationWaterScene,.gathering-loot-drop-layer,.processing-material-animation-layer) { display: none !important; }
html.gom-compact .travel-panel { position: relative; inset: auto; width: 100%; min-width: 0; padding: 14px; box-sizing: border-box; }
html.gom-compact .travel-route { flex-wrap: wrap; font-size: 18px; }
html.gom-compact .travel-event-overlay { position: fixed; inset: 8px 6px calc(var(--compact-nav-height) + 8px); overflow: auto; }
html.gom-compact .travel-event-card { min-width: 0; width: 100%; padding: 18px; box-sizing: border-box; }
html.gom-compact .runtime-notice-stack { top: 6px; left: 6px; right: 6px; width: auto; }
.compact-dialog {
  position: fixed;
  inset: var(--compact-viewport-top, 0px) 0 auto;
  width: 100%;
  height: var(--compact-viewport-height, 100dvh);
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  zoom: 1;
}
.compact-dialog > .compact-dialog-card {
  display: block;
  flex: 0 0 auto;
  width: min(480px, 100%);
  max-height: none;
  margin-block: auto;
  padding: 26px 22px;
  box-sizing: border-box;
  color: var(--ui-text, #e9dfcb);
  background: var(--mg-surface-window);
  border: 1px solid #8d7247;
}
.compact-dialog::backdrop { background: rgba(0,0,0,.78); }
.compact-dialog h2 { font: 23px Georgia,serif; margin: 4px 0 16px; }
.compact-dialog p { line-height: 1.55; }
.compact-dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; margin-top: 22px; }
.compact-dialog-actions button { min-height: 44px; }
.compact-menu-list { display: grid; gap: 6px; }
.compact-menu-entry { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; min-height: 48px; }
.compact-menu-entry img { width: 30px; height: 30px; object-fit: contain; }
.compact-menu-entry small { margin-left: auto; }
.compact-effects p { display: flex; justify-content: space-between; gap: 8px; }
html.gom-keyboard-open #compactNavigation { display: none; }
html.gom-keyboard-open #bottomChatWindowHost .bottom-chat-panel[data-chat-window-mode=compact] { bottom: 6px; }
html.gom-keyboard-open .overlay:not(.hidden) { padding-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .compact-city-card, .location-compact-action { transition: none; } }

/* Keep the persistent navigation above shared windows in both orientations. */
html.gom-compact #app { isolation: auto; }
html.gom-compact #app::before { display: none; }
html.gom-compact #compactNavigation { position: relative; z-index: 15000; }
html.gom-compact .overlay .game-window { position: relative !important; }
html.gom-compact :is(#inventoryContent,#bankContent,#characterContent,#journalContent,#worldMapContent,#settingsContent) { position: relative; min-height: 0; }
html.gom-compact .location-compact-heading h1 { font: 23px/1.25 Georgia,serif; margin: 6px 0; }
html.gom-compact .location-compact-header #returnBtn { margin: 4px 14px; }
html.gom-compact .bank-compact-action-sheet { position: fixed !important; inset: auto 8px calc(var(--compact-nav-height) + env(safe-area-inset-bottom) + 8px) !important; width: auto !important; min-width: 0 !important; max-width: none !important; max-height: min(64dvh,520px) !important; overflow: auto; box-sizing: border-box; padding: 12px; z-index: 12000; }
html.gom-compact .bank-compact-action-sheet :is(button,input,select) { min-height: 44px; font-size: 16px; }
dialog.compact-dialog:not([open]) { display: none !important; }
html.gom-compact #topBar .topbar-zone--left { display: grid; grid-template-columns: minmax(0,1fr) auto; }
html.gom-compact #playerHealth { width: 100%; max-width: none; }
html.gom-compact #topbarHealthButton { display: grid; grid-template-columns: minmax(0,1fr) 6px; width: 100%; min-width: 0; gap: 3px 6px; padding: 2px 0; }
html.gom-compact .topbar-health-copy { grid-area: 1/1; display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
html.gom-compact .topbar-health-bar { grid-area: 2/1/3/3; width: 100%; min-width: 0; }
html.gom-compact .topbar-health-config-dot { grid-area: 1/2; }
html.gom-compact .topbar-coins-wrap { gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
html.gom-compact .topbar-coin-icon { width: 18px; height: 18px; }
html.gom-compact .topbar-coin-value { max-width: 9ch; overflow-wrap: anywhere; white-space: normal; }
html.gom-compact #compactNavigation .has-unread::after { content: "•"; position: absolute; top: 0; right: 8px; color: #ebc579; } .compact-world-info { font-size: 12px; opacity: .8; }
/* Short landscape screens keep the same compact mode with less chrome. */
@media (min-width: 600px) and (max-height: 500px) {
  html.gom-compact #topBar { grid-template-columns: minmax(0,1fr) minmax(280px,1.4fr) 44px; min-height: 52px; gap: 0 10px; }
  html.gom-compact #compactPlayerButton { grid-area: 1/1; }
  html.gom-compact #compactPlayerButton span { font-size: 17px; }
  html.gom-compact #topBar .topbar-zone--left { grid-area: 1/2; }
  html.gom-compact #compactMenuButton { grid-area: 1/3; }
  html.gom-compact #compactNavigation button { min-height: 44px; }
  html.gom-compact #compactNavigation img { width: 30px; height: 30px; }
  html.gom-compact :is(.location-compact-header,.compact-city-header).has-art { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 4px 12px; padding: 8px 12px; align-items: center; }
  html.gom-compact .has-art [data-scene-image-preview] { grid-area: 1/1/3/2; max-block-size: min(var(--compact-scene-art-height, 96px), 96px); margin: 0; justify-self: center; }
  html.gom-compact .compact-city-header.has-art :is(h2,p) { grid-column: 2; margin: 0; }
  html.gom-compact .location-compact-header.has-art .location-compact-heading { grid-area: 1/2; margin: 0; }
  html.gom-compact .location-compact-header.has-art #returnBtn { grid-area: 2/2; justify-self: start; margin: 0; }
  html.gom-compact .location-compact-heading h1 { font-size: 20px; }
}

/* Compact chrome uses full-size icons, never scaled primary/secondary artwork.
   Primary actions inside windows keep their established Mountgate controls. */
html.gom-compact :is(#compactNavigation button,#compactPlayerButton,#compactMenuButton,#bottomBarChatToggle,.compact-menu-entry),
html.gom-compact :is(#compactNavigation button,#compactPlayerButton,#compactMenuButton,#bottomBarChatToggle,.compact-menu-entry):is(:hover,:focus-visible,:active,.is-selected,.active) {
  appearance: none; background: transparent !important; background-image: none !important;
  border: 0 !important; border-image: none !important; border-radius: 0;
  box-shadow: none !important; text-shadow: none; transform: none !important;
  color: var(--mg-text-main); cursor: pointer;
}
html.gom-compact :is(#compactNavigation button,#compactPlayerButton,#compactMenuButton,#bottomBarChatToggle,.compact-menu-entry)::before,
html.gom-compact :is(#compactNavigation button,#compactPlayerButton,#compactMenuButton,#bottomBarChatToggle,.compact-menu-entry)::after {
  content: none !important; background: none !important; background-image: none !important;
  border: 0 !important; box-shadow: none !important; animation: none !important;
}
html.gom-compact #compactNavigation button { min-height: 44px; border-bottom: 2px solid transparent !important; }
html.gom-compact #compactNavigation button.is-selected { border-bottom-color: var(--mg-amber) !important; }
html.gom-compact #compactNavigation button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
html.gom-compact :is(#compactNavigation button,#compactPlayerButton,#compactMenuButton,#bottomBarChatToggle,.compact-menu-entry):focus-visible { outline: 2px solid var(--mg-amber); outline-offset: -3px; }
html.gom-compact #compactNavigation button:is(:hover,:focus-visible,.is-selected) img { filter: brightness(1.18); }
html.gom-compact :is(#compactMenuButton,#bottomBarChatToggle,[data-compact-tab]).has-unread { overflow: visible; }
html.gom-compact :is(#compactMenuButton,#bottomBarChatToggle,[data-compact-tab]).has-unread::after {
  content: '' !important; display: block; position: absolute; inset: 4px 6px auto auto;
  width: 6px; height: 6px; border-radius: 50%; background: var(--mg-amber) !important;
  background-image: none !important; opacity: 1; transform: none; pointer-events: none;
}
html.gom-compact .compact-menu-entry { padding: 8px 4px; border-bottom: 1px solid var(--mg-border-muted) !important; }
html.gom-compact .compact-city-card:is(:hover,:focus-visible),
html.gom-compact .location-compact-action:is(:hover,:focus-visible) { background: var(--mg-surface-panel); border-color: var(--mg-amber); }
