/* Illustrated Roman craft, generated originals in art-sources/roman-ui/.
   Pixel slices keep the laurel ends and stone corners fixed; only quiet edges
   stretch. All labels, icons, availability and focus remain live HTML.
   This final art layer does not change the landscape layout dimensions. */
:root{
 --roman-bronze:url('./public/assets/roman-bronze-command.webp');
 --roman-stone:url('./public/assets/roman-stone-panel.webp');
 --roman-inset:url('./public/assets/roman-inset.webp');
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,select,summary){
 --roman-edge-x:18px;
 --roman-edge-y:6px;
 --roman-fill:#1c2d26;
 min-width:44px;
 min-height:44px;
 border:1px solid #b99a61;
 border-radius:2px;
 border-image:var(--roman-bronze) 20 66 fill / var(--roman-edge-y) var(--roman-edge-x) / 0 stretch;
 color:#f3e6c8;
 text-shadow:0 1px 1px #060e0d;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) select{
 --roman-edge-x:10px;
 --roman-edge-y:5px;
 border-image-slice:20 66 fill;
 text-shadow:none;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) button.primary{
 --roman-fill:#1c2d26;
 border-image-slice:20 66 fill;
 color:#fff0ca;
 font-weight:400;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,summary):hover:not(:disabled){
 filter:brightness(1.16);
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,summary):active:not(:disabled){
 transform:translateY(1px);
 filter:brightness(.9);
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,select,summary):focus-visible{
 outline:3px solid #ffe3a5;
 /* The ring stays within the illustrated shape, including clipped corners. */
 outline-offset:-9px;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button.selected,button.on,button[aria-pressed="true"],button[aria-selected="true"]){
 --roman-fill:#51432a;
 border-image-slice:20 66 fill;
 color:#fff0ca;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) button:disabled{
 opacity:1;
 color:#b9baaa;
 --roman-fill:#25312b;
 border-image-slice:20 66 fill;
 filter:grayscale(.9);
 box-shadow:none;
 cursor:default;
 text-shadow:none;
}
/* Small icon buttons and roster rows need narrow edges clear of their content. */
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.sheet-close,.title-settings,.party-button,.prep-roster-unit,.map-controls button){
 --roman-edge-x:9px;
 --roman-edge-y:5px;
}
html:root body #app .map-controls button{min-width:44px;min-height:44px}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.sheet,.panel,.prep-detail,.native-prep-unit,.hero-card,.asset-loading-panel){
 --roman-edge-x:16px;
 --roman-edge-y:16px;
 --roman-fill:#162720;
 border-radius:2px;
 border-image:var(--roman-stone) 64 / var(--roman-edge-y) var(--roman-edge-x) / 0 stretch;
}
/* Keep the real element transparent. Two equally colored gradient stops paint
   a solid field only inside the nine-slice center; there is no visual gradient.
   The quiet generated material uses the exact same bounded paint area.
   Rectangular backgrounds and shadows must never underpaint the alpha corners. */
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.sheet,.panel,.prep-detail,.native-prep-unit,.hero-card,.asset-loading-panel){
 background-color:transparent;
 background-image:var(--roman-inset),linear-gradient(var(--roman-fill),var(--roman-fill));
 background-size:calc(100% - var(--roman-edge-x) - var(--roman-edge-x)) calc(100% - var(--roman-edge-y) - var(--roman-edge-y));
 background-position:center;
 background-repeat:no-repeat;
 background-origin:border-box;
 background-blend-mode:soft-light,normal;
 box-shadow:none;
}
/* The generated command already supplies its dark center. Do not add a
   rectangular state fill: it drifts against the carved ends at small sizes. */
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,select,summary){
 background-color:transparent;
 background-image:none;
 box-shadow:none;
 --roman-edge-x:12px;
 padding-inline:calc(var(--roman-edge-x) + 5px);
 line-height:1.3;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button.selected,button.on,button[aria-pressed="true"],button[aria-selected="true"]){
 filter:brightness(1.14);
 outline:1px solid #dcc28b;
 outline-offset:-5px;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,select,summary):focus-visible{
 outline:3px solid #ffe3a5;
 outline-offset:-6px;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,summary):hover:not(:disabled){filter:brightness(1.16)}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,summary):active:not(:disabled){filter:brightness(.9)}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.topbar,.board-bottom,.prep-start,.sidebar,.native-turn){
 background:#17271f var(--roman-inset) repeat;
 background-blend-mode:soft-light;
 border-color:#a18a5b80;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.forecast-unit,.native-matchup-unit,.native-weapon-name){
 border-radius:2px;
 background:#17271f var(--roman-inset) repeat;
 background-blend-mode:soft-light;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .title-actions button{
 padding-inline:28px;
 letter-spacing:.04em;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .title-actions .title-help{
 font-size:13px;
}
@media(orientation:landscape){
 html:root[data-native-phone="true"] body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.sheet,.panel,.prep-detail,.native-prep-unit,.hero-card,.asset-loading-panel){--roman-edge-x:7px;--roman-edge-y:7px}
 html:root[data-native-phone="true"] body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.native-battle-hud button,.native-window button,.native-prep-tabs button){--roman-edge-x:10px;--roman-edge-y:5px}
}
@media(prefers-reduced-motion:reduce){
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,summary):active:not(:disabled){transform:none}
}
@media(forced-colors:active){
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,select,summary,.sheet,.panel,.prep-detail,.native-prep-unit){border-image:none;background:Canvas;color:CanvasText;filter:none;text-shadow:none;border-color:ButtonText}
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) button:disabled{color:GrayText;border-color:GrayText}
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,select,summary):focus-visible{outline-color:Highlight}
}

/* Live labels stay inside the laurel ends; small controls use slimmer slices. */
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.mobile-party button,.party-button,.prep-roster-unit,.map-controls button,.sheet-close,.title-settings){--roman-edge-x:9px}
html:root body #app .battle-dock :is(.context-actions button,.dock-toolbar button,.unit-details){--roman-edge-x:10px;padding-inline:14px}
html:root body #app .mobile-party button{padding-inline:13px}
@media(orientation:landscape){
 html:root[data-native-phone="true"] body #app .native-battle-hud button{--roman-edge-x:6px;padding-inline:9px}
 html:root[data-native-phone="true"] body #app .native-battle-hud [data-action="equipment"]{font-size:11px;padding-inline:7px}
}
@media(orientation:landscape) and (min-width:568px) and (max-width:1100px) and (max-height:540px){
 html:root:not([data-native-phone="true"]) body #app .game-shell .battle-dock .context-actions button{--roman-edge-x:8px;padding-inline:11px}
}
@media(orientation:landscape) and (min-width:568px) and (max-width:1100px) and (max-height:540px){
 html:root:not([data-native-phone="true"]) body #app .game-shell .mobile-party button{--roman-edge-y:5px}
}

/* One material system for windows, HUD cards and body-level feedback.
   Comic speech bubbles deliberately keep their established appearance.
   Fixed source corners are sliced; portrait, weapon and battlefield art is untouched. */
:root{--roman-panel-ink:#14251f;--roman-panel-paper:#f3e6c8;--roman-panel-muted:#c3c8b5;--roman-panel-gold:#ddc28b;--roman-ui-font:'DM Sans',system-ui,sans-serif;--roman-heading-font:'Cormorant Garamond',Georgia,serif}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.sheet,.panel,.prep-detail,.native-prep-unit,.hero-card,.asset-loading-panel,.dialogue-box:not(.speech-bubble),.exp-card,.promotion-details),
html:root body :is(#toast,.xp-notice){
 --roman-panel-edge:10px;
 border:1px solid #b99a61;
 border-radius:2px;
 border-image:var(--roman-stone) 64 / var(--roman-panel-edge) / 0 stretch;
 background-color:transparent;
 background-image:var(--roman-inset),linear-gradient(var(--roman-panel-ink),var(--roman-panel-ink));
 background-size:calc(100% - var(--roman-panel-edge)*2) calc(100% - var(--roman-panel-edge)*2);
 background-position:center;background-repeat:no-repeat;background-origin:border-box;background-blend-mode:soft-light,normal;
 color:var(--roman-panel-paper);box-shadow:none;
}
/* Compact information cards share the same stone at a lighter visual weight. */
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.battle-dock,.mobile-party,.board-meta,.range-legend,.map-controls,.native-turn,.forecast-unit,.native-matchup-unit,.native-weapon-name,.duel-unit,.promotion-unlocks,.completion-xp){
 --roman-panel-edge:4px;
 border:1px solid #a18a5b;
 border-radius:2px;
 border-image:var(--roman-stone) 64 / var(--roman-panel-edge) / 0 stretch;
 background-color:transparent;
 background-image:var(--roman-inset),linear-gradient(var(--roman-panel-ink),var(--roman-panel-ink));
 background-size:calc(100% - var(--roman-panel-edge)*2) calc(100% - var(--roman-panel-edge)*2);
 background-position:center;background-repeat:no-repeat;background-origin:border-box;background-blend-mode:soft-light,normal;
 color:var(--roman-panel-paper);box-shadow:none;
}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.stat-grid>div,.exp-stat,.native-toggle,.prep-options,.tag){border-radius:2px;border-color:#b99a6155;background:#1d3028;color:var(--roman-panel-paper);box-shadow:none}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.native-window-header,.native-window-footer,.exp-growth,.promotion-rule,.promotion-footer){border-color:#b99a6155}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.muted,.action-availability,.native-choice-note,.exp-reason,.exp-total,.prep-class){color:var(--roman-panel-muted)}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.native-window-header h2,.exp-name h2,.promotion-details h1){font-family:var(--roman-heading-font);color:var(--roman-panel-paper)}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .sheet{padding:18px;scroll-padding:12px}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .native-window-body{padding:4px;scroll-padding:8px}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .native-window-header{padding-right:48px;min-width:0}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .native-window-header h2{overflow-wrap:break-word;line-height:1.15}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .sheet-close{top:12px;right:12px}
html:root body #app .native-turn{padding:3px 4px;--roman-panel-edge:3px}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.forecast-unit,.native-matchup-unit){padding:10px;min-width:0}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.forecast-unit,.native-matchup-unit).enemy{border-image-source:var(--roman-stone)}
/* Combat HUD is live HTML on every screen, including the desktop cinema. */
html:root body .duel-stage{font-family:var(--roman-ui-font)}
html:root body .duel-hud{position:absolute;z-index:2;top:auto;bottom:calc(env(safe-area-inset-bottom) + 18px);left:calc(env(safe-area-inset-left) + 24px);right:calc(env(safe-area-inset-right) + 24px);display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:28px;align-items:end}
html:root body .duel-unit{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:5px 12px;min-width:0;padding:14px 18px;--roman-panel-edge:7px}
html:root body .duel-unit>strong{font:400 clamp(18px,2.2vw,28px)/1.12 var(--roman-heading-font);overflow-wrap:break-word;min-width:0}
html:root body .duel-unit>b{font-size:14px;white-space:nowrap;color:var(--roman-panel-paper);align-self:center}
html:root body .duel-unit>span{grid-column:1/-1;margin:0;min-height:0;font-size:13px;line-height:1.3;color:var(--roman-panel-muted);overflow-wrap:break-word}
html:root body .duel-unit .hp{grid-column:1/-1;margin:2px 0 0;height:5px}
html:root body .duel-footer{position:absolute;z-index:2;left:calc(env(safe-area-inset-left) + 24px);right:calc(env(safe-area-inset-right) + 24px);top:calc(env(safe-area-inset-top) + 18px);bottom:auto;display:flex;align-items:center;justify-content:flex-end;gap:12px}
html:root body .duel-footer>button{min-width:44px;min-height:44px}
@media(max-width:760px){
 html:root body .duel-hud{bottom:calc(env(safe-area-inset-bottom) + 8px);left:calc(env(safe-area-inset-left) + 8px);right:calc(env(safe-area-inset-right) + 8px);gap:8px}
 html:root body .duel-unit{padding:8px 10px;gap:3px 6px;--roman-panel-edge:4px}
 html:root body .duel-unit>strong{font-size:18px}
 html:root body .duel-unit>b{font-size:12px}
 html:root body .duel-unit>span{font-size:11px;line-height:1.25}
 html:root body .duel-footer{top:calc(env(safe-area-inset-top) + 8px);left:calc(env(safe-area-inset-left) + 8px);right:calc(env(safe-area-inset-right) + 8px)}
}
html:root body .exp-card:before{display:none}
html:root body .exp-card{padding:22px 24px 16px}
html:root body .exp-stat{min-width:0;gap:6px}
html:root body .promotion-details{padding:24px;min-width:0}
html:root body .promotion-unlocks{padding:12px;--roman-panel-edge:4px}
html:root body .promotion-stat{border-color:#b99a6144}
html:root body :is(#toast,.xp-notice){--roman-panel-edge:4px;padding:10px 14px;font-family:var(--roman-ui-font);line-height:1.35}
@media(orientation:landscape) and (max-height:540px){
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .sheet{--roman-panel-edge:6px;padding:10px;gap:6px}
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.forecast-unit,.native-matchup-unit){padding:7px;--roman-panel-edge:3px}
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) .sheet-close{top:8px;right:8px}
 html:root body .duel-hud{bottom:calc(env(safe-area-inset-bottom) + 6px);left:calc(env(safe-area-inset-left) + 8px);right:calc(env(safe-area-inset-right) + 8px);gap:10px}
 html:root body .duel-unit{padding:8px 10px;gap:3px 6px;--roman-panel-edge:4px}
 html:root body .duel-unit>strong{font-size:17px}
 html:root body .duel-unit>b{font-size:12px}
 html:root body .duel-unit>span{font-size:11px;line-height:1.2}
 html:root body .duel-footer{top:calc(env(safe-area-inset-top) + 6px);left:calc(env(safe-area-inset-left) + 8px);right:calc(env(safe-area-inset-right) + 8px);gap:8px}
 html:root body .exp-card{--roman-panel-edge:6px;padding:12px 14px}
 html:root body .exp-has-growth{gap:0 14px}
 html:root body .promotion-details{--roman-panel-edge:6px;padding:12px}
 html:root body .promotion-details h1{font-size:30px;line-height:1.05;margin:7px 0}
 html:root body .promotion-quote{font-size:13px;line-height:1.35;margin-bottom:8px}
 html:root body .promotion-unlocks{margin-top:8px;padding:8px}
 html:root body .promotion-unlocks>strong{font-size:18px;margin-bottom:6px}
}
@media(forced-colors:active){
 html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.sheet,.panel,.dialogue-box:not(.speech-bubble),.exp-card,.promotion-details,.duel-unit,.duel-phase,.battle-dock,.native-turn,.native-matchup-unit){border-image:none;background:Canvas;color:CanvasText;border-color:CanvasText}
}
html:root body .duel-unit>strong{grid-column:1;grid-row:1}
html:root body .duel-unit>b{grid-column:2;grid-row:1}
html:root body .duel-unit>span{grid-row:2}
html:root body .duel-unit .hp{grid-row:3}
html:root body .duel-unit.enemy .hp>i{background:var(--red)}
@media(orientation:landscape) and (max-height:540px){
 html:root[data-native-phone="true"] body #modal .sheet{padding:8px}
 html:root[data-native-phone="true"] body #modal .native-window-body{padding:0 4px}
 html:root[data-native-phone="true"] body #modal .native-matchup-unit{padding:6px;gap:3px}
 html:root[data-native-phone="true"] body #modal .native-forecast .native-window-body{display:flex;flex-direction:column;gap:3px}
 html:root[data-native-phone="true"] body #modal .native-forecast-note{margin:0;line-height:1.25}
 html:root[data-native-phone="true"] body #modal .native-preferences{gap:4px}
 html:root[data-native-phone="true"] body #modal .native-preferences .native-window-body{padding:0}
}
@media(orientation:landscape) and (max-height:540px){
 html:root[data-native-phone="true"] body #modal .battle-detail-sheet .stat-grid{grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;margin:6px 0}
 html:root[data-native-phone="true"] body #modal .battle-detail-sheet .stat-grid b{font-size:17px}
 html:root[data-native-phone="true"] body #modal .battle-detail-sheet .stat-grid small{font-size:10px;letter-spacing:0}
 html:root[data-native-phone="true"] body #modal .native-party-sheet{margin:0}
 html:root[data-native-phone="true"] body #modal .native-party-sheet .party-button{margin:0}
 html:root[data-native-phone="true"] body #modal .native-preferences-grid{gap:4px}
 html:root[data-native-phone="true"] body #modal .native-preferences-grid>label:not(.native-toggle){flex-direction:row;align-items:center;gap:6px}
 html:root[data-native-phone="true"] body #modal .native-preferences-grid select{flex:1;min-width:0;width:100%}
}
@media(orientation:landscape) and (max-height:540px){
 html:root[data-native-phone="true"] body #modal .native-audio-grid{gap:4px}
 html:root[data-native-phone="true"] body #modal .native-audio-master{gap:4px}
 html:root[data-native-phone="true"] body #modal .native-audio-grid:has(#audio-retry:not([hidden])) #audio-status{grid-column:1;align-self:center}
 html:root[data-native-phone="true"] body #modal .native-audio-grid #audio-retry{grid-column:2}
 html:root[data-native-phone="true"] body #modal .native-audio-levels{display:grid;grid-template-columns:max-content minmax(0,1fr);align-items:center;gap:4px 6px}
 html:root[data-native-phone="true"] body #modal .native-audio-levels label{white-space:nowrap}
}
html:root body .promotion-cinema{background:#0d1d18;border-color:#b99a6166;box-shadow:none}
html:root body :is(.promotion-header,.promotion-footer){background:#14251f var(--roman-inset) repeat;background-blend-mode:soft-light;color:var(--roman-panel-paper)}
html:root body .phase-banner{background:#14251fe8;border-block:1px solid #b99a6166;color:var(--roman-panel-paper);font-family:var(--roman-heading-font);letter-spacing:.08em}
html:root body :is(#app,#modal) .tactical-tip{border-radius:2px;background:#1d3028;border-color:#b99a6166;color:var(--roman-panel-paper)}
/* The shallow reveal reserves room for every gain and the learned technique. */
@media(orientation:landscape) and (max-height:540px){
 html:root body .promotion-composition{grid-template-columns:minmax(0,.36fr) minmax(0,.64fr)}
 html:root body .promotion-details{padding:8px 10px}
 html:root body .promotion-eyebrow{font-size:10px;letter-spacing:1px;line-height:1.2}
 html:root body .promotion-details h1{font-size:28px;line-height:1;margin:4px 0}
 html:root body .promotion-quote{line-height:1.25;margin-bottom:4px}
 html:root body .promotion-rule{padding:3px 0;letter-spacing:1px;font-size:8px}
 html:root body .promotion-stats{grid-template-columns:repeat(3,minmax(0,1fr));gap:0 8px}
 html:root body .promotion-stat{gap:4px;padding:3px 0;font-size:11px;line-height:14px}
 html:root body .promotion-stat i{margin:0 2px}
 html:root body .promotion-stat>b{font-size:15px;min-width:0}
 html:root body .promotion-unlocks{margin-top:4px;padding:6px}
 html:root body .promotion-unlocks small{margin-bottom:2px;line-height:10px;letter-spacing:1px}
 html:root body .promotion-unlocks>strong{font-size:18px;line-height:20px;margin-bottom:4px}
 html:root body .promotion-unlocks p{font-size:12px;line-height:1.25}
}
@media(orientation:landscape) and (max-height:540px){
 html:root body .exp-card:not(.exp-has-growth) .exp-identity{margin:8px 0}
 html:root body .exp-card:not(.exp-has-growth) .exp-portrait{height:64px;width:56px}
 html:root body .exp-meter-heading{margin-bottom:4px}
 html:root body .exp-award{margin:8px 0 0}
 html:root body .exp-skip{margin:8px auto 0}
 html:root body .exp-has-growth .exp-growth{margin-top:8px}
 html:root body .exp-has-growth .exp-growth-heading{min-height:30px;margin-bottom:6px}
}
/* Long policy text keeps its reading size inside the existing scrolling window. */
html:root body #modal .native-legal .legal-copy{overflow-wrap:anywhere}
html:root body #modal .native-legal .legal-copy p{font-size:16px;line-height:1.55;margin:0 0 16px}
html:root body #modal .native-legal .legal-copy h3{font-size:22px;line-height:1.25;margin:24px 0 10px}

/* New loot receipts retain a visible exit above every phone safe area. */
html:root body #modal :is(.cache-reward-backdrop,.items-panel-backdrop){align-items:center;justify-content:center;padding:calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 12px) calc(env(safe-area-inset-bottom) + 12px) calc(env(safe-area-inset-left) + 12px)}
html:root body #modal .sheet:is(.native-cache-reward,.items-panel){display:flex;flex-direction:column;width:min(640px,100%);height:auto;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);min-height:0;margin:0;overflow:hidden;animation:none}
html:root body #modal :is(.native-cache-reward,.items-panel) .sheet-handle{display:none}
html:root body #modal :is(.native-cache-reward,.items-panel) .native-window-header{flex:none;min-height:44px}
html:root body #modal :is(.native-cache-reward,.items-panel) .native-window-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
html:root body #modal :is(.native-cache-reward,.items-panel) .native-window-footer{display:flex;flex:none;min-height:44px;padding-top:8px}
html:root body #modal :is(.native-cache-reward,.items-panel) .native-window-footer>button{width:100%;min-height:44px;margin:0}
@media(max-width:760px) and (orientation:portrait){
 html:root body #modal :is(.native-cache-reward,.items-panel) .native-window-header{display:flex;flex-wrap:wrap;align-items:center;gap:4px;padding-right:44px}
 html:root body #modal :is(.native-cache-reward,.items-panel) .native-window-header h2{flex-basis:100%;margin:0;font-size:26px}
 html:root body #modal :is(.native-cache-reward,.items-panel) .native-window-header>span{font-size:13px}
}

/* Authoritative shared typography. Older screen rules define layout; these
   bounded text roles resolve their font/size overrides without changing art.
   A small set of important typography properties is deliberate: native and
   browser legacy selectors have different specificity. Keep the scale here. */
:root{
 --type-ui:'DM Sans',system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
 --type-display:'Cormorant Garamond',Georgia,serif;
 --type-body:15px;--type-control:15px;--type-meta:12px;
 --type-title:28px;--type-section:20px;--type-name:18px;--type-number:24px;--type-dialogue:18px;
 font-synthesis:none;
}

/* Account UI is absent while cloud configuration is disabled. */
.cloud-panel form{display:grid;gap:12px;margin:0 0 20px}
.cloud-panel label{display:grid;gap:6px}
.cloud-panel input{min-height:44px;width:100%;padding:10px;background:#142429;color:var(--paper);border:1px solid var(--gold)}
.cloud-panel .native-toggle{display:flex;align-items:center;gap:10px}
.cloud-panel .native-toggle input{width:20px;min-height:20px;flex:none}
.cloud-panel button{min-height:44px}
.cloud-choice{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-bottom:16px}
.cloud-choice section{min-width:0;padding:12px;border:1px solid var(--line)}
.cloud-choice button{width:100%;white-space:normal}
@media(max-width:500px){.cloud-choice{grid-template-columns:1fr}}
html:root body{font-family:var(--type-ui);font-weight:400;font-size:var(--type-body)}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage,#toast,.xp-notice){font-family:var(--type-ui);font-size:var(--type-body);font-weight:400}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage,#toast,.xp-notice) *{font-family:inherit!important;font-weight:400!important;font-synthesis:none}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,select,input,textarea,summary){font-size:var(--type-control)!important;line-height:1.3!important}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(button,summary) :is(strong,b,span){font-size:inherit!important;line-height:inherit!important}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(p,li,dt,dd,.objective,.log,.field-log){font-size:var(--type-body)!important;line-height:1.45!important}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(small,.eyebrow,.tag,.xp,.chapter-tag,.action-availability,.native-choice-note,.prep-class,.prep-readiness,.story-location,.story-cast,.story-art-status,.promotion-rule,.promotion-eyebrow,.promotion-chapter,.promotion-caption,.exp-kicker,.exp-reason,.exp-total,.exp-growth-subtitle,.exp-cap,.native-turn){font-size:var(--type-meta)!important;line-height:1.3!important}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(h1:not(.title-logo),h2,.brand,.phase-banner){font-family:var(--type-display)!important;font-size:var(--type-title)!important;line-height:1.15!important}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(h3,legend,.promotion-unlocks>strong){font-size:var(--type-section)!important;line-height:1.25!important}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.stat-grid b,.damage-number,.native-strike strong,.exp-level strong,.exp-growth-heading>strong){font-size:var(--type-number)!important;line-height:1.1!important}
html:root body #app .title-redesign .title-logo{font-family:var(--type-display)!important}
html:root body #app .title-redesign .title-logo .logo-bridge{font-family:var(--type-ui)!important;font-size:var(--type-meta)!important}
html:root body .duel-unit>strong{font-size:var(--type-name)!important;line-height:1.25!important}
html:root body .duel-unit>b{font-size:var(--type-body)!important}
html:root body .duel-unit>span{font-size:var(--type-meta)!important;line-height:1.3!important}
html:root body .cache-reward-list strong{font-size:var(--type-name)!important}
html:root body .cache-reward-list span{font-size:var(--type-number)!important}
html:root body :is(#app,#modal,.duel-stage,.exp-stage,.promotion-stage) :is(.sheet-close,.title-settings){font-size:24px!important;line-height:1!important}
/* Speech stays inside the existing comic bubble and measured tail/camera. */
html:root body #app .speech-bubble p{font-size:var(--type-dialogue)!important;line-height:1.4!important}
html:root body #app .speech-bubble .dialogue-heading h3{font-size:var(--type-meta)!important;line-height:1.3!important}
html:root body #app .speech-bubble .dialogue-heading>span{font-size:var(--type-meta)!important}
@media(max-width:760px),(orientation:landscape) and (max-height:540px){
 :root{--type-body:14px;--type-control:13px;--type-meta:12px;--type-title:22px;--type-section:16px;--type-name:16px;--type-number:20px;--type-dialogue:16px}
}

.cloud-panel .cloud-privacy-link{display:inline-flex;align-items:center;min-height:44px}

/* A quiet surround joins the safe areas and cropped exterior art margins.
   Keep all board sizing, pan margins and hit-test geometry in board-view.js. */
html:root body[data-screen="battle"],
html:root body #app .game-shell,
html:root body #app .game-shell :is(.board-column,.map-area){background:#101b17}
html:root body #app .game-shell #board{border-color:transparent}
html:root body #app .game-shell #board:not(:focus-visible){outline:none}

/* Simple decisions share a quiet reading area inside the ornamental stone.
   Body, warning and actions use one reading size; only the title is display. */
html:root body #modal .sheet:is(.native-confirmation,.native-chronicle){
 --type-control:var(--type-body);
 display:flex;flex-direction:column;gap:14px;
 width:min(600px,100%);height:auto;min-height:0;
 max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
 padding:26px;overflow:hidden;margin:0;animation:none;
}
html:root body #modal :is(.native-confirmation,.native-chronicle) .sheet-handle{display:none}
html:root body #modal :is(.native-confirmation,.native-chronicle) .sheet-close{top:18px;right:18px}
html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-header{
 display:flex;align-items:center;flex:none;min-height:44px;
 padding:0 54px 12px 0;border-bottom:1px solid #b99a6155;
}
html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-header h2{margin:0}
html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-body{
 flex:0 1 auto;min-height:0;overflow:auto;padding:0;scroll-padding:12px;
 color:var(--roman-panel-paper);overscroll-behavior:contain;
}
html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-body p{margin:0 0 12px}
html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-body p:last-child{margin-bottom:0}
html:root body #modal .native-chronicle .chronicle-warning{
 margin-top:14px;padding:12px 14px;border-left:2px solid var(--roman-panel-gold);
 background:#ddc28b0b;color:var(--roman-panel-paper);
}
html:root body #modal .native-chronicle .chronicle-warning p{margin:0 0 6px}
html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-footer{
 display:flex;flex:none;gap:12px;min-height:44px;padding:14px 0 0;
 border-top:1px solid #b99a6155;
}
html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-footer>button{
 flex:1;min-width:0;min-height:44px;margin:0;padding-block:10px;letter-spacing:0;
}
@media(max-width:760px),(orientation:landscape) and (max-height:540px){
 html:root body #modal .sheet:is(.native-confirmation,.native-chronicle){padding:20px;gap:12px}
 html:root body #modal :is(.native-confirmation,.native-chronicle) .sheet-close{top:12px;right:12px}
 html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-header{padding-bottom:8px}
 html:root body #modal :is(.native-confirmation,.native-chronicle) .native-window-footer{padding-top:12px}
}
@media(orientation:landscape) and (max-height:360px){
 html:root body #modal .sheet:is(.native-confirmation,.native-chronicle){padding:18px;gap:10px}
 html:root body #modal .native-chronicle .chronicle-warning{margin-top:10px;padding:10px 12px}
}

/* Details and promotion previews contain a complete standing figure. These
   overrides are limited to popups; party avatars and battle art keep their crop. */
#modal .battle-detail-sheet .unit-heading{display:grid;grid-template-columns:minmax(90px,140px) minmax(0,1fr);align-items:center;gap:18px;height:200px;margin:0 0 14px;padding:8px 14px}
#modal .battle-detail-sheet .unit-heading .unit-name{position:static;min-width:0;text-shadow:none}
#modal .battle-detail-sheet .unit-heading .unit-name h3{font-size:26px;overflow-wrap:break-word}
#modal .battle-detail-sheet .unit-heading .unit-name small{display:block;line-height:1.45}
#modal .popup-promotion-preview{display:grid;grid-template-columns:minmax(100px,36%) minmax(0,1fr);align-items:center;gap:18px}
#modal .popup-promotion-preview .promotion-art{height:clamp(160px,32dvh,280px);min-width:0;padding:6px}
#modal .popup-promotion-copy{min-width:0}
#modal .popup-promotion-copy p:last-child{margin-bottom:0}
#modal .battle-detail-sheet .unit-heading>.popup-unit-figure,#modal .promotion-art>.popup-unit-figure{position:static;inset:auto;width:100%;height:100%;max-width:none;mask-image:none;object-fit:contain}
@media(max-width:600px) and (orientation:portrait){
 #modal .battle-detail-sheet .unit-heading{grid-template-columns:100px minmax(0,1fr);height:170px;gap:12px;padding:6px 10px}
 #modal .popup-promotion-preview{grid-template-columns:1fr;gap:10px}
 #modal .popup-promotion-preview .promotion-art{height:190px}
}
@media(orientation:landscape) and (max-height:540px){
 #modal .battle-detail-sheet .unit-heading{grid-template-columns:90px minmax(0,1fr);height:148px;gap:12px}
 #modal .popup-promotion-preview{grid-template-columns:minmax(90px,28%) minmax(0,1fr);gap:14px}
 #modal .popup-promotion-preview .promotion-art{height:164px}
}

/* Cloud saves retain the Roman panels and visible, accessible text states. */
.cloud-status-slot{display:inline-flex;align-items:center}
.cloud-status-button{display:inline-flex;align-items:center;gap:6px;min-height:44px}
.title-cloud-status{position:absolute;top:max(18px,env(safe-area-inset-top));left:max(18px,env(safe-area-inset-left));z-index:3}
.title-actions .title-cloud-invite{min-height:44px;font-size:14px;background:transparent;border-color:transparent}
.title-cloud-invite[hidden]{display:none!important}
.cloud-panel #cloud-change{display:inline;min-height:44px}
.cloud-party{display:grid;gap:8px;padding:0;list-style:none}
.cloud-party li{display:flex;align-items:center;gap:8px}
.cloud-portrait{position:relative;display:inline-block;width:44px;height:44px;overflow:hidden;flex:none;background:#142429}
.cloud-portrait .portrait-art{position:static;display:block;width:44px;height:44px;min-width:0}
.cloud-choice .cloud-recommended{border-color:var(--gold)}
.cloud-chapter{color:var(--gold)}
.cloud-invite-background{min-height:100dvh;background:#142429}

/* Short landscape forecasts retain the consequence warning and actions while
   all detailed rows remain reachable by touch, wheel and keyboard scrolling. */
@media(orientation:landscape) and (max-height:540px){
 html:root[data-native-phone="true"] body #modal .sheet.native-forecast{
  height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px);
  gap:4px;
 }
 html:root[data-native-phone="true"] body #modal .native-forecast .native-window-body{
  display:block;overflow:auto;overscroll-behavior:contain;scroll-padding:8px;
  scrollbar-width:thin;
 }
 html:root[data-native-phone="true"] body #modal .native-forecast .native-window-body>p{margin:4px 0 0}
 html:root[data-native-phone="true"] body #modal .native-forecast>.native-forecast-note{
  flex:none;margin:0;padding:0 4px;
 }
 html:root[data-native-phone="true"] body #modal .native-forecast .native-strike{grid-template-columns:minmax(80px,.7fr) minmax(0,1.3fr)}
 html:root[data-native-phone="true"] body #app .native-prep-panel{
  overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;
 }
 html:root[data-native-phone="true"] body :is(#app .native-prep-panel,#modal .native-forecast .native-window-body):focus-visible{
  outline:2px solid var(--roman-panel-gold);outline-offset:-2px;
 }
}

/* Give chapter paintings a readable title/caption without changing game panels. */
html:root body #app .chapter-title-card .chapter-title-copy h1{font-size:clamp(38px,5.3vw,68px)!important;line-height:1.05!important}
html:root body #app .chapter-title-card .chapter-title-copy .chapter-caption{font-size:clamp(18px,1.65vw,23px)!important;line-height:1.5!important}
@media(orientation:landscape) and (max-height:540px){
 html:root body #app .chapter-title-card .chapter-title-copy h1{font-size:32px!important}
 html:root body #app .chapter-title-card .chapter-title-copy .chapter-caption{font-size:18px!important;line-height:1.4!important}
}

/* Every committed EXP award gets a temporary framed meter. Ordinary awards
   stay compact; the established level-up window retains its stat reveal. */
html:root body .exp-stage{padding:max(16px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
html:root body .exp-stage.exp-compact{background:#07100d28}
html:root body .exp-compact .exp-card{--roman-panel-edge:6px;width:min(460px,100%);display:grid;grid-template-columns:54px minmax(0,1fr) auto;gap:6px 12px;padding:14px 16px;overflow:hidden;max-height:100%}
html:root body .exp-compact .exp-topline{display:none}
html:root body .exp-compact .exp-identity{display:contents}
html:root body .exp-compact .exp-portrait{grid-column:1;grid-row:1/4;width:54px;height:74px;align-self:center;mask-image:none}
html:root body .exp-compact .exp-name{grid-column:2;grid-row:1;align-self:center}
html:root body .exp-compact .exp-name h2{font-size:20px!important;margin:0;line-height:1.15!important;overflow-wrap:anywhere}
html:root body .exp-compact .exp-name>span{display:none}
html:root body .exp-compact .exp-level{grid-column:3;grid-row:1;display:flex;align-items:center;justify-content:end;gap:5px;border:0;padding:0;min-width:0}
html:root body .exp-compact .exp-level small{font-size:11px;letter-spacing:.8px}
html:root body .exp-compact .exp-level strong{font-size:20px!important}
html:root body .exp-compact .exp-meter-heading{grid-column:2/4;grid-row:2;margin:0}
html:root body .exp-compact .exp-meter-heading>span{font-size:12px;letter-spacing:2px}
html:root body .exp-compact .exp-current{font-size:20px}
html:root body .exp-compact .exp-denominator{font-size:12px}
html:root body .exp-compact .exp-meter{grid-column:2/4;grid-row:3;height:18px}
html:root body .exp-compact .exp-award{grid-column:2;grid-row:4;margin:0;align-self:center}
html:root body .exp-compact .exp-award>strong{font-size:21px;white-space:nowrap}
html:root body .exp-compact .exp-award small{font-size:11px}
html:root body .exp-compact .exp-total{display:none}
html:root body .exp-compact .exp-skip{grid-column:3;grid-row:4;min-height:44px;margin:0;padding:8px 10px}
html:root body .exp-stage .exp-skip:focus-visible{outline:2px solid #ffe3a0;outline-offset:2px}
@media(max-width:380px){
 html:root body .exp-compact .exp-card{grid-template-columns:44px minmax(0,1fr) auto;gap:6px 8px;padding:12px}
 html:root body .exp-compact .exp-portrait{width:44px;height:64px}
}
@media(forced-colors:active){
 html:root body .exp-stage .exp-meter{border:1px solid CanvasText;background:Canvas}
 html:root body .exp-stage :is(.exp-fill,.exp-fill-gained){background:Highlight;forced-color-adjust:none}
}

/* Campaign summaries keep the chapter table scrollable in phone landscape. */
html:root body #modal .native-campaign-summary{display:flex;flex-direction:column;width:min(680px,100%);max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);min-height:0;overflow:hidden}
html:root body #modal .native-campaign-summary :is(.native-window-header,.native-window-footer){flex:none}
html:root body #modal .native-campaign-summary .native-window-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;overflow-wrap:anywhere;padding:8px}
.campaign-total{font-size:1.4em}.campaign-breakdown{border-collapse:collapse;width:100%;margin:16px 0}.campaign-breakdown :is(th,td){text-align:left;padding:7px;border-bottom:1px solid #b99a6155}.campaign-breakdown caption{text-align:left;font-weight:bold;margin-bottom:8px}
.campaign-stats :is(input:not([type=checkbox]),select){display:block;max-width:100%;min-height:44px;margin:8px 0}.campaign-stats button{min-height:44px}.ranking-opt-in{display:flex;align-items:center;gap:10px;margin:14px 0}.ranking-opt-in input{flex:none;min-width:44px;min-height:44px}.native-campaign-summary .native-window-footer{display:flex;flex-wrap:wrap;gap:8px}

/* Chapter I uses the shared Roman window, with a short, stable reading area. */
html:root body #modal .sheet:is(.native-chapter-one-tutorial,.native-tutorial-review){display:flex;flex-direction:column;gap:14px;width:min(560px,100%);height:auto;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);min-height:0;margin:0;padding:22px;overflow:hidden;animation:none}
html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) .sheet-handle{display:none}
html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) .native-window-header{display:block;flex:none;padding:0 40px 12px 0}
html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) h2{font-size:28px;line-height:1.15;margin:5px 0 0}
html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) .native-window-body{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:0;font-size:16px;line-height:1.5;overflow-wrap:anywhere}
html:root body #modal .native-chapter-one-tutorial p{margin:0 0 12px}
html:root body #modal .native-chapter-one-tutorial .tutorial-controls{font-size:13px;opacity:.8;margin-bottom:0}
html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) .native-window-footer{display:flex;flex:none;flex-wrap:wrap;gap:10px;padding-top:10px}
html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) .native-window-footer button{flex:1;min-width:140px;min-height:44px;margin:0}
html:root body #modal .tutorial-topics{display:grid;gap:10px}
html:root body #modal .tutorial-topics button{min-height:44px;text-align:left}
.tutorial-route-note{position:absolute;z-index:3;bottom:8px;left:50%;transform:translateX(-50%);width:max-content;max-width:calc(100% - 28px);margin:0;padding:6px 12px;border:1px solid #e8c776;background:#102326ed;color:#fff0c7;text-align:center;font-size:13px;line-height:1.35;pointer-events:none;box-sizing:border-box;box-shadow:0 2px 12px #0008}
.tutorial-route-note strong,.tutorial-route-note span{display:block}
@media(orientation:landscape){html[data-native-phone="true"] .tutorial-route-note{max-width:calc(100% - 2 * var(--native-hud-width) - 24px);font-size:12px;bottom:6px}}
@media(max-height:480px){
 html:root body #modal .sheet:is(.native-chapter-one-tutorial,.native-tutorial-review){gap:8px;padding:14px 18px;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px)}
 html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) h2{font-size:24px}
 html:root body #modal :is(.native-chapter-one-tutorial,.native-tutorial-review) .native-window-header{padding-bottom:8px}
}

html:root body .exp-stat.exp-stat-gain em{color:#ffe39a}
@media(max-width:1100px) and (max-height:540px){
 html:root body .exp-has-growth .exp-growth{grid-row:2/7}
 html:root body .exp-has-growth .exp-stats{gap:4px}
 html:root body .exp-has-growth .exp-stat{min-height:24px;padding:3px 6px}
 html:root body .exp-has-growth .exp-growth-heading{min-height:24px;margin-bottom:8px}
 html:root body .exp-has-growth .exp-cap{grid-column:1;grid-row:7;margin:4px 0 0;font-size:11px}
}
