/* The private entrance preview has a title-only header, during assembly and play. */
.paper-objective { display: none !important; }
.paper-header { min-height: 60px; row-gap: 0; }
.paper-route { top: 72px; }
@media (pointer: coarse), (max-width: 600px) {
  .paper-header { min-height: 48px; }
  .paper-route { top: 56px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .paper-header { min-height: 45px; }
  .paper-route { top: 55px; }
}

/* The article-style lead keeps its text beside the infobox, not below its float. */
#uiContainer .masonry-overview { display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: start; gap: 24px; margin-top: 12px; }
#uiContainer .masonry-overview-copy { min-width: 0; }
#uiContainer #overviewText { clear: none; margin-bottom: 0; }
#uiContainer .masonry-overview .logo-container { float: none; width: 100%; margin: 0; box-sizing: border-box; }
#uiContainer .masonry-overview #gameLogo { width: 100%; }
@media (max-width: 760px) {
  #uiContainer .masonry-overview { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  #uiContainer .masonry-overview .logo-container { width: min(100%, 250px); justify-self: center; }
}
/* Let the start field shrink inside very narrow viewports without clipping its button. */
#uiContainer #wikiPageInput { min-width: 0; }

/* Menus retain browser zoom; only the live play surface captures gestures. */
html, body, canvas { touch-action: auto; }
body.masonry-active-play #gameCanvas,
body.masonry-active-play #mobileControls { touch-action: none; }
#masonryControlHint { position: fixed; z-index: 12; bottom: 118px; left: 50%; transform: translateX(-50%); max-width: min(600px, calc(100vw - 32px)); box-sizing: border-box; padding: 7px 12px; color: #202122; background: #fffffff0; border: 1px solid #a2a9b1; border-radius: 3px; font: 12px/1.45 sans-serif; text-align: center; pointer-events: none; }
#masonryControlHint[hidden], #masonryControlHint:empty { display: none; }
.masonry-controls-help { margin: 12px 0; text-align: left; font: 13px/1.5 sans-serif; }
.masonry-controls-help summary { cursor: pointer; font-weight: bold; }
.masonry-death-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.masonry-death-actions button { min-height: 44px; }
@media (pointer: coarse) and (orientation: portrait) { #masonryControlHint { bottom: 263px; } }
@media (max-height: 480px) { #masonryControlHint { bottom: 74px; font-size: 11px; padding: 4px 8px; } }

/* Concept A: one quiet status rail, only for the active touch control mode. */
.compact-rail { display: contents; }
.paper-map { display: none; }
:root { --hud-left: max(16px, env(safe-area-inset-left)); --hud-right: max(16px, env(safe-area-inset-right)); --hud-bottom: max(29px, env(safe-area-inset-bottom)); --hud-top: max(8px, env(safe-area-inset-top)); }
.paper-compact .compact-rail { position: absolute; top: var(--hud-top); left: var(--hud-left); right: var(--hud-right); display: grid; grid-template-columns: minmax(54px, 1fr) auto auto minmax(100px, 1fr) 44px 52px; align-items: center; gap: 12px; min-height: 44px; padding: 0 6px 0 12px; background: #fffffff2; border: 1px solid #a2a9b1; border-radius: 5px; box-shadow: 0 2px 5px #0002; }
.paper-compact .paper-header { display: contents; }
.paper-compact .paper-heading, .paper-compact .paper-level, .paper-compact .paper-card { grid-row: 1; }
.paper-compact .paper-heading { grid-column: 1; min-width: 0; }
.paper-compact .paper-brand, .paper-compact .paper-slash,
.paper-compact .paper-route, .paper-compact .paper-objective,
.paper-compact .paper-track, .paper-compact .paper-switch { display: none !important; }
.paper-compact .paper-title { font: 20px/1.15 Georgia, serif; }
.paper-compact .paper-level { grid-column: 2; font-size: 9px; color: #54595d; }
.paper-compact .paper-card { position: static; margin: 0; padding: 0; min-width: 0; background: none; border: 0; }
.paper-compact .paper-vitals { grid-column: 3; display: flex; gap: 14px; padding: 0 14px; border-left: 1px solid #c8ccd1; border-right: 1px solid #c8ccd1; }
.paper-compact .paper-metric { display: flex; align-items: baseline; min-width: 0; gap: 4px; white-space: nowrap; }
.paper-compact .paper-metric .paper-value { order: -1; }
.paper-compact .paper-value { font: bold 18px/1.25 Arial, sans-serif; font-variant-numeric: tabular-nums; }
.paper-compact .paper-label { font: 10px/1.3 Arial, sans-serif; }
.paper-compact .paper-weapon { grid-column: 4; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 5px; }
.paper-compact .paper-weapon > .paper-label { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-compact .paper-ammo-line { gap: 3px; }
.paper-compact .paper-reserve { font-size: 12px; }
.paper-compact .paper-reload { display: none; }
.paper-compact .is-reloading .paper-ammo-line { opacity: .55; }
.paper-compact .is-reloading > .paper-label { color: #36c; }
.paper-compact .is-low-health .paper-metric:first-child .paper-value,
.paper-compact .is-low-ammo .paper-value { color: #b32424; }
.paper-compact .paper-map { grid-column: 5; display: block; }
.paper-compact .paper-pause { grid-column: 6; }
.paper-compact .paper-map, .paper-compact .paper-pause { grid-row: 1; min-width: 44px; min-height: 44px; padding: 0 4px; font-size: 11px; font-weight: 600; color: #343b43; background: transparent; border: 0; }
.paper-compact .paper-map[aria-pressed="true"] { color: #36c; background: #eaf3ff; }

/* Safe, reachable touch targets. Transparent empty space never blocks the world. */
body.masonry-touch #mobileControls { position: fixed; inset: 0; width: 100%; height: 100%; margin: 0; pointer-events: none; z-index: 14; }
body.masonry-touch .joystick { width: 104px; height: 104px; box-sizing: border-box; background: #20212226; border: 1px solid #ffffffa6; }
body.masonry-touch .joystick .stick { width: 46px; height: 46px; background: #ffffffe0; border: 1px solid #ffffffb3; }
.joystick-label { position: absolute; bottom: 6px; left: 0; width: 100%; font: bold 9px/1 Arial, sans-serif; text-align: center; text-transform: uppercase; color: white; text-shadow: 0 1px 3px #000; pointer-events: none; }
body.masonry-touch #mobileControls #leftJoystick { position: absolute; left: var(--hud-left); bottom: var(--hud-bottom); }
body.masonry-touch #mobileControls #rightControls { position: absolute; right: var(--hud-right); bottom: var(--hud-bottom); width: 232px; height: 160px; pointer-events: none; }
body.masonry-touch #rightJoystick { right: 0; bottom: 0; }
body.masonry-touch .control-btn { min-width: 48px; min-height: 48px; width: 48px; height: 48px; flex-direction: column; gap: 2px; border: 1px solid #a2a9b1; background: #fffffff2; border-radius: 10px; color: #343b43; box-shadow: 0 1px 4px #0003; touch-action: none; }
body.masonry-touch .control-btn:active { background: #eaf3ff; border-color: #36c; }
body.masonry-touch .control-btn:focus-visible { outline: 2px solid #36c; outline-offset: 3px; }
.control-icon { font: 28px/1 Arial, sans-serif; pointer-events: none; }
.control-label { font: bold 10px/1 Arial, sans-serif; pointer-events: none; }
body.masonry-touch #shootButton { left: auto; right: 116px; bottom: 8px; width: 56px; height: 56px; border-radius: 50%; }
body.masonry-touch #reloadButton { left: auto; right: 120px; bottom: 80px; }
body.masonry-touch #switchButton { left: auto; right: 184px; bottom: 8px; }
body.masonry-touch #level-switch { min-height: 48px; max-width: calc(100vw - 32px); bottom: max(30px, env(safe-area-inset-bottom)) !important; padding: 10px 14px !important; font: bold 12px/1.25 Arial, sans-serif !important; }
body.masonry-touch #masonryControlHint { bottom: max(155px, calc(env(safe-area-inset-bottom) + 135px)); max-width: min(430px, calc(100vw - 64px)); font-size: 11px; }
@media (orientation: landscape) {
  :root { --hud-left: max(44px, env(safe-area-inset-left)); --hud-right: max(44px, env(safe-area-inset-right)); }
}
@media (max-width: 740px) and (orientation: landscape) {
  body.masonry-touch #level-switch { bottom: max(150px, calc(env(safe-area-inset-bottom) + 130px)) !important; }
  .paper-compact .compact-rail { grid-template-columns: minmax(48px, 1fr) auto minmax(80px, 1fr) 44px 48px; gap: 6px; padding-left: 8px; }
  .paper-compact .paper-level { display: none; }
  .paper-compact .paper-vitals { grid-column: 2; gap: 8px; padding: 0 8px; }
  .paper-compact .paper-weapon { grid-column: 3; }
  .paper-compact .paper-map { grid-column: 4; }
  .paper-compact .paper-pause { grid-column: 5; }
  .paper-compact .paper-title { font-size: 16px; }
  .paper-compact .paper-label { font-size: 9px; }
  .paper-compact .paper-value { font-size: 16px; }
}
@media (orientation: portrait) {
  .paper-compact .compact-rail { grid-template-columns: minmax(0, 1fr) auto 44px 52px; grid-template-rows: 44px 36px; gap: 0 8px; padding: 0 8px; }
  .paper-compact .paper-heading { grid-row: 1; grid-column: 1 / 3; }
  .paper-compact .paper-level { display: none; }
  .paper-compact .paper-map { grid-column: 3; }
  .paper-compact .paper-pause { grid-column: 4; }
  .paper-compact .paper-vitals { grid-column: 1 / 3; grid-row: 2; padding: 0; border: 0; }
  .paper-compact .paper-weapon { grid-column: 3 / 5; grid-row: 2; justify-content: flex-end; }
  .paper-compact .paper-weapon > .paper-label { max-width: 75px; font-size: 9px; }
  .paper-compact .paper-value { font-size: 16px; }
  body.masonry-touch #mobileControls #rightControls { width: calc(100% - var(--hud-left) - var(--hud-right)); height: 188px; }
  body.masonry-touch #shootButton { right: 56px; bottom: 124px; }
  body.masonry-touch #reloadButton { right: 120px; bottom: 128px; }
  body.masonry-touch #switchButton { right: 176px; bottom: 128px; }
  body.masonry-touch #level-switch { bottom: max(220px, calc(env(safe-area-inset-bottom) + 200px)) !important; }
  body.masonry-touch #masonryControlHint { bottom: max(280px, calc(env(safe-area-inset-bottom) + 260px)); }
}
