/* NAGAYAMA ☆LAB historical-figure games — one-screen layout (2026-11-11).
   Layout only: nothing here touches scenario, saves or drawing. fg.js sizes the stage so everything fits the window. */
html{background:#eaf6ff;height:100%;overflow:hidden}
body{height:100vh;height:100dvh;overflow:hidden!important;padding:0!important;margin:0!important;display:flex;flex-direction:column;box-sizing:border-box}
body::before{display:none!important}
main.wrap{flex:1 1 auto;min-height:0;width:100%;max-width:1200px!important;margin:0 auto!important;box-sizing:border-box;display:flex;flex-direction:column;gap:6px;
 padding:max(6px,env(safe-area-inset-top,0px)) max(12px,env(safe-area-inset-right,0px)) max(8px,env(safe-area-inset-bottom,0px)) max(12px,env(safe-area-inset-left,0px))}
.wrap>.head{flex:none;margin:0!important;padding:2px 0 5px!important;flex-wrap:nowrap!important;align-items:center!important;gap:8px!important}
.head .brandlock{flex:1 1 auto!important;min-width:0}
.head .brand-eyebrow{font-size:9px!important;line-height:1.2}
.head h1{font-size:clamp(13px,2.4vh,17px)!important;line-height:1.25;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.head .sub{flex:0 1 auto!important;max-width:38%!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;font-size:11px!important;text-align:right!important;margin:0!important}
.fg-read{flex:none;height:32px;padding:0 11px;border-radius:999px;border:1px solid #ebca91;background:#ebca9122;color:#f7dfae;font:700 12px/1 system-ui,sans-serif;cursor:pointer;white-space:nowrap}
.wrap>.warn{flex:none;margin:0!important;font-size:10.5px!important;line-height:1.3!important;padding:3px 8px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wrap>.warn:empty{display:none!important}
.stick{position:static!important;flex:none;min-height:0;display:flex;flex-direction:column;gap:6px;padding:0!important;background:none!important;top:auto!important}
.stick>.tool{flex:none;padding:1px 1px 2px!important;flex-wrap:nowrap!important}
.stick>.prog{flex:none;margin:0!important}
.stick>.stage{flex:none;width:var(--fg-sw,100%)!important;max-width:calc(100% - 8px);margin:4px auto 2px!important}
.stick>.tmenu{flex:none;margin:0 auto!important;gap:7px!important;width:min(100%,760px)!important}
.stick>.hud{flex:none;margin:2px 0 0!important}
.tmenu .tcap:empty{display:none}
.tmenu .tstart{min-height:clamp(42px,7vh,56px)!important}
.tmenu .tfacts{margin:0!important}
/* everything below the stage lives in .fg-side (wrapped by fg.js; ids and listeners are untouched) */
.fg-side{flex:1 1 0;min-height:0;min-width:0;display:flex;flex-direction:column;overflow:hidden}
.fg-side>*{flex:none}
.fg-side>.dlg{margin:6px 5px 0!important;min-height:clamp(96px,18vh,150px)!important}
.fg-side>.dlg,.fg-side>.medbox,.fg-side>#choices{flex:0 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.fg-side>#choices{margin:0!important;padding:2px 5px 4px}
.fg-side>.medbox{margin:8px 5px 0!important}
.fg-side>.srcrow{margin:6px 5px 0!important}
.fg-side>#kn{margin:5px 5px 0!important}
.fg-side>.mgbar{margin:8px 5px 0!important}
.fg-side>.cast,.fg-side>#trnote2,.fg-side>.note,.wrap>.cast,.wrap>#trnote2,.wrap>.note,body>.nlab-reading,body>.nag-copyright,a.nlab-sns-entry{display:none!important}
#choices .q{margin:6px 0 6px!important;padding:8px 12px!important}
#choices .choices{margin:6px 0 0!important;gap:7px!important}
#choices.choices{gap:7px!important}
#choices .opt{padding:9px 13px!important;min-height:0!important;display:flex!important;flex-wrap:wrap;align-items:center;justify-content:flex-start!important;gap:1px 12px;text-align:left!important}
#choices .opt em{margin:0 0 0 auto!important}
#choices .opt>span:not(:first-child):last-child,#choices .opt>b+span{flex:1 1 auto;text-align:left}
.dlg .pt.none{display:none!important}
/* while choosing on a phone: drop the progress bar and note, keep stats in one compact row */
@media (orientation:portrait){
 body:has(#choices .opt) .wrap>.warn,body:has(#choices .opt) .stick>.prog{display:none!important}
 body:has(#choices .opt) .hud{grid-template-columns:repeat(7,minmax(0,1fr))!important;gap:3px!important}
 body:has(#choices .opt) .hud .chip{padding:3px 3px 4px!important}
 body:has(#choices .opt) .hud .chip span{font-size:10px!important;gap:1px!important;flex-direction:column;align-items:flex-start!important;line-height:1.15}
 body:has(#choices .opt) .fg-side>.dlg{min-height:0!important;padding:8px 10px!important}
 body:has(#choices .opt) #tx{min-height:0!important;font-size:14.5px!important;line-height:1.6!important}
}
/* fallbacks, set by fg.js step by step only while something still does not fit */
body[data-fg-tight] .fg-side>.srcrow{flex-wrap:nowrap!important;overflow:hidden;white-space:nowrap;font-size:11px!important}
body[data-fg-tight] .fg-side>.srcrow>*{flex:0 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-top:2px!important;padding-bottom:2px!important}
body[data-fg-tight] .fg-side>.dlg{min-height:0!important;padding:7px 10px!important}
body[data-fg-tight] #tx,body[data-fg-tight] .medbox p{font-size:13.5px!important;line-height:1.55!important;min-height:0!important}
body[data-fg-tight] .medbox{padding:7px 10px!important}
body[data-fg-tight] #choices .q{padding:5px 10px!important;margin:3px 0!important;font-size:13.5px!important}
body[data-fg-tight] #choices .opt{padding:6px 11px!important;font-size:14px!important}
@media (orientation:portrait){
 body[data-fg-tight] .stick>.hud{display:none!important}
 body[data-fg-tight="2"] .wrap>.head,body[data-fg-tight="3"] .wrap>.head,body[data-fg-tight="4"] .wrap>.head{display:none!important}
 body[data-fg-tight="3"] .fg-side>.srcrow,body[data-fg-tight="4"] .fg-side>.srcrow{display:none!important}
 body[data-fg-tight="4"] .stick>.stage{display:none!important}
}
@media (orientation:landscape){
 body[data-fg-tight="2"] .wrap>.head,body[data-fg-tight="3"] .wrap>.head,body[data-fg-tight="4"] .wrap>.head{display:none!important}
 body[data-fg-tight="3"] .fg-side>.srcrow,body[data-fg-tight="4"] .fg-side>.srcrow{display:none!important}
 body[data-fg-tight="4"] #choices .opt em{display:none!important}
}
@media (max-height:700px){.tmenu .tfacts{display:none!important}.tmenu .tcap{display:-webkit-box!important;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}}
@media (max-height:600px){.tmenu .tcap,.tmenu .tver{display:none!important}.tmenu .tstart{min-height:44px!important}.tmenu .tbtn{min-height:40px!important}}
@media (max-height:440px){.tmenu .nlab-title-share-v4{display:none!important}.wrap>.warn{display:none!important}.tb{min-height:32px!important;padding:3px 9px!important}.hud .chip{padding:2px 4px 3px!important}}
@media (orientation:portrait) and (max-height:600px){
 .hud{grid-template-columns:repeat(7,minmax(0,1fr))!important;gap:3px!important}
 .hud .chip{padding:3px 2px 4px!important}.hud .chip span{font-size:9px!important;gap:1px!important}
 .fg-side>.dlg{min-height:88px!important;padding:8px 9px!important}
}
/* wide windows: stage on the left, text and choices (or the title menu) on the right */
@media (orientation:landscape) and (min-width:640px){
 main.wrap{display:grid;grid-template-columns:minmax(0,1.32fr) minmax(300px,1fr);grid-template-rows:auto auto minmax(0,1fr);gap:6px 18px}
 .wrap>.head{grid-column:1/-1;grid-row:1}
 .wrap>.warn{grid-column:1/-1;grid-row:2}
 .wrap>.stick{grid-column:1;grid-row:3;min-height:0}
 .wrap>.fg-side{grid-column:2;grid-row:3;padding-top:4px}
 body.intitle .wrap>.fg-side{display:none}
 body.intitle .wrap>.stick{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1.32fr) minmax(300px,1fr);grid-template-rows:auto minmax(0,1fr);gap:6px 18px}
 body.intitle .stick>.tool{grid-column:1/-1}
 body.intitle .stick>.stage{grid-column:1;grid-row:2;align-self:center;justify-self:center}
 body.intitle .stick>.tmenu{grid-column:2;grid-row:2;align-self:center;width:100%!important;gap:10px!important}
}
@media (orientation:landscape) and (min-width:640px) and (max-height:480px){main.wrap{grid-template-columns:minmax(0,1fr) minmax(300px,1.25fr)}}
/* paged reader (no scrolling: ◀ ▶ turn pages) */
.fgr{position:fixed;inset:0;z-index:900;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);background:#0b1322;color:#f0ebdb;font:15px/1.85 system-ui,-apple-system,"Hiragino Kaku Gothic ProN","Yu Gothic UI",Meiryo,sans-serif}
.fgr[hidden]{display:none}
.fgr-h{display:flex;align-items:center;gap:8px;padding:max(8px,env(safe-area-inset-top,0px)) 12px 8px 16px;border-bottom:1px solid #6d829680}
.fgr-h b{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#f5cc82;font-size:15px}
.fgr-h button{flex:none;width:40px;height:40px;border-radius:50%;border:1px solid #ebca91;background:#ebca9122;color:#f7dfae;font:700 14px/1 system-ui,sans-serif;cursor:pointer}
.fgr-h button:disabled{opacity:.3}
.fgr-h span{min-width:3.6em;text-align:center;font-weight:700;font-variant-numeric:tabular-nums;font-size:13px}
.fgr{overflow:hidden;contain:strict}
.fgr-b{min-height:0;min-width:0;padding:16px max(18px,calc((100% - 1000px)/2)) max(16px,env(safe-area-inset-bottom,0px))}
.fgr-clip{height:100%;width:100%;overflow:hidden;contain:paint}
.fgr-h{min-width:0}
.fgr-flow{height:100%;column-fill:auto;transition:transform .28s ease;max-width:none!important;margin:0!important;padding:0!important;display:block!important}
.fgr-flow h2{font-size:19px;line-height:1.5;margin:0 0 10px;color:#f5cc82}
.fgr-flow h3{font-size:16px;margin:16px 0 6px;color:#9fd8d6;break-after:avoid}
.fgr-flow p,.fgr-flow li,.fgr-flow dd{margin:0 0 8px;font-size:14.5px;line-height:1.85;color:#e6e2d6}
.fgr-flow ul{margin:0 0 8px;padding-left:1.2em}.fgr-flow li{break-inside:avoid}
.fgr-flow dl{margin:0}.fgr-flow dt{font-weight:700;color:#f7dfae;break-after:avoid;margin-top:6px}.fgr-flow dd{margin-left:0;break-inside:avoid}
.fgr-flow a{color:#9fd8d6}
@media (prefers-reduced-motion:reduce){.fgr-flow{transition:none}}
