.progression-root,.activities-root,.adventure-next{scroll-margin-top:16px}
/* web/layout.css — structural overrides loaded after style.css and gameplay.css.
   2026-11-16 pixel revision: the game frame is content-driven (no fixed/viewport height, no nested
   scrolling of the play panel); the document scrolls.  Only chat lists and the wide lane board keep
   their own explicit scroll.  Nothing here hides content. */

/* 1. Frame and play panel never clip or nest-scroll gameplay / story. */
.game-screen .game-frame{height:auto;min-height:0}
.game-screen .gs-panels{height:auto;max-height:none;overflow:visible}
.game-screen .gs-panels:has(.gp-sec[data-sec=brain]:not([hidden])){height:auto;min-height:0;max-height:none}

/* 2. Scene controls: the gframe now reserves --gclear above the diorama, so the crest never reaches
      the viewport and the controls sit at the viewport's own top edge. */
.menu-art .pixel-scene-controls{top:8px}

/* 2b. Pixel scale cascade.  :root sets --ux:2; this is loaded LAST so any body-level --ux (inline,
      data-game theme block, or a future rule) is overridden on phones/tablets.  1x ≤780px, 2x above. */
@media(max-width:780px){:root,body,body[data-game]{--ux:1!important}}

/* 3. Focus is never obscured: no sticky tabs over the board; every control keeps scroll margin so
      keyboard/scrollIntoView lands clear of panel edges and the masthead. */
.gp-tabs{position:static}
button,[role=tab],.choice,textarea,input,select,summary{scroll-margin-top:72px;scroll-margin-bottom:24px}
html{scroll-padding-top:72px;scroll-padding-bottom:24px}

/* 4. Tab strip may wrap when the centre column is narrow. */
.game-screen .gs-tabs{flex-wrap:wrap}

/* 5. Wide lane board: dedicated horizontal scroll, never page overflow. */
.gp-board-scroll{overflow-x:auto;overflow-y:hidden;max-width:100%}
.gs-center,.gs-panel,.gameplay-panel{min-width:0;max-width:100%}
/* A narrow diagram must scroll rather than put different synapses under the same finger. */
.gp-brain-scroll{overflow-x:auto;max-width:100%;padding:0 32px;scroll-padding-inline:32px}
.gp-brain-scroll .gp-brain-map{width:560px;min-width:560px;max-width:none}
.gp-brain-scroll:focus-visible{outline:3px solid var(--focus);outline-offset:-3px}
.scene-expanded .pxs-expand{display:none}

/* Captions have their own row on phones: long Korean titles must not sit behind
   the camera toolbar. Full camera controls remain in the expanded scene. */
@media(max-width:780px){
 .scene-banner{height:auto}
 .scene-stage{position:relative;inset:auto;height:160px}
 .scene-caption{position:relative;left:auto;bottom:auto;max-width:none;margin:8px}
 .scene-art .pixel-scene-controls .pxs-btn:not(.pxs-expand){display:none}
 .scene-art .pxs-expand{display:flex;align-items:center;gap:8px;padding:0 10px}
 .scene-art .pxs-expand::after{content:'장면 보기';font:14px/1.5 var(--px)}
 .gs-center{display:flex;flex-direction:column;gap:12px}
 .gs-center:has(#panel-guide:not([hidden])) .scene-banner{order:2}
}

/* 6. Phone order (≤780px): the game column (scene, tabs, play/story/adventures) comes BEFORE the
      side column so the board is reachable without scrolling past ~900px of portrait/shared record.
      Side (portrait, stats, edit, upload, shared record) still renders in full after the play area;
      PL/IC chats stay separate below.  Nothing is hidden. */
@media(max-width:780px){
 .game-screen .game-frame{grid-template-columns:minmax(0,1fr);grid-template-areas:"top" "notice" "center" "side" "chat"}
 .game-screen .gs-side{flex-direction:column}
 .game-screen .gs-dialogue{grid-template-columns:1fr}
 .game-screen .gs-tabs{flex-wrap:wrap;gap:3px}
 .game-screen .gs-tabs [role=tab]{flex:1 1 auto;min-height:44px;padding:6px 16px;white-space:normal}
 /* Masthead: brand + account bar may wrap onto a second row; logout never splits, short names stay
    on one line, long names wrap inside the bar instead of overflowing the page. */
 .masthead{flex-wrap:wrap;row-gap:4px;column-gap:12px}
 .masthead .brand{min-width:0;flex:1 1 auto}
 #account-bar{flex:0 1 auto;max-width:100%;min-width:0;margin-left:auto;gap:8px;justify-content:flex-end}
 /* short names (≤ ~12 chars) fit on one line once the bar may use the full row; longer names wrap
    inside the bar (anywhere) rather than widening the page. */
 #player-name{min-width:0;max-width:calc(100vw - 140px);white-space:normal;overflow-wrap:anywhere;word-break:keep-all;text-align:right}
 #account-bar button,#logout{white-space:nowrap;min-height:44px;flex:0 0 auto}
}
