/* Window system: one ceremonial frame, readable sections, framed controls.
   Copy never receives a second rectangular background or a nested window. */
:root{--window-inset:24px;--window-gap:20px;--window-copy:#e1e7ec;--window-muted:#b9c9d8;--window-title:#f5dfb6}
html body :is(#modal,.palace-sheet){color:var(--window-copy)!important;border:8px solid transparent!important;border-image:var(--bronze-frame) 180 fill / 12px / 0 stretch!important;box-sizing:border-box;padding:0!important;overflow:hidden!important}
html body #modal[open]{display:flex!important;flex-direction:column;inset:0!important;transform:none!important;margin:auto!important;width:min(720px,calc(100vw - 24px))!important;height:fit-content!important;min-height:0!important;max-height:calc(100dvh - 24px)!important}
html body #modal:has(.portrait-picker,.portrait-grid){width:min(920px,calc(100vw - 24px))!important}
html body #modal:has(#confirm-start){inset:0!important;transform:none!important;margin:auto!important;width:min(540px,calc(100vw - 24px))!important;height:fit-content!important}
html body #modal #modal-content{display:flex!important;flex-direction:column;width:100%;min-width:0;min-height:0!important;padding:0!important;height:auto!important;max-height:100%;overflow:hidden}
html body :is(#modal,.palace-sheet) :is(.modal-top,.palace-sheet>header){display:flex!important;align-items:center;justify-content:space-between;flex:none;gap:16px;min-height:68px;padding:12px var(--window-inset)!important;margin:0!important;border:0!important;border-image:none!important;background:none!important;box-shadow:none!important}
html body :is(#modal,.palace-sheet) :is(.modal-top h2,.palace-sheet>header h2){font-size:22px!important;line-height:1.4!important;letter-spacing:.02em;color:var(--window-title)!important;margin:0!important;min-width:0;overflow-wrap:anywhere}
html body :is(#modal,.palace-sheet) :is(.close-modal,.palace-sheet>header>button){flex:none;min-width:64px!important;min-height:44px!important;height:auto!important;padding:9px 12px!important;font-size:14px!important;line-height:1.3!important;border:2px solid transparent!important;border-image:var(--value-frame) 180 fill / 5px / 0 stretch!important;background:transparent!important}
html body #modal .window-reading-body{overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;min-height:0;min-width:0;flex:1 1 auto;padding:4px var(--window-inset) var(--window-inset);line-height:1.75;font-size:15px}
html body :is(#modal,.palace-sheet) :is(.window-reading-body,.palace-sheet-body){scroll-padding-block:12px;scrollbar-color:#758b9c transparent}
html body .palace-sheet>.palace-sheet-body{padding:4px var(--window-inset) var(--window-inset)!important;min-width:0;min-height:0;overscroll-behavior:contain}
html body :is(#modal,.palace-sheet) :is(.window-reading-body,.palace-sheet-body)>:first-child{margin-top:0!important}
html body :is(#modal,.palace-sheet) :is(.modal-copy,.person-dossier,.room-guide-panel,.faction-details){padding:0!important;max-width:100%;min-width:0}
html body :is(#modal,.palace-sheet) :is(p,li){font-size:15px;line-height:1.75;color:var(--window-copy);overflow-wrap:anywhere}
html body :is(#modal,.palace-sheet) :is(.modal-copy,.window-reading-body,.register-detail,.dossier-record)>p{margin:10px 0 16px!important;padding:0!important}
html body :is(#modal,.palace-sheet) :is(h3,h4){line-height:1.45;color:var(--window-title)}
html body :is(#modal,.palace-sheet) h3{font-size:21px}html body :is(#modal,.palace-sheet) h4{font-size:17px}
html body :is(#modal,.palace-sheet) :is(.modal-copy,.window-reading-body,.register-detail)>:is(h3,h4){margin:20px 0 10px!important}
html body :is(#modal,.palace-sheet) :is(.window-docked-actions,.palace-sheet>footer){flex:none;padding:12px var(--window-inset)!important;margin:0!important;gap:12px;background:none!important;border:0!important;border-image:none!important}
html body :is(#modal,.palace-sheet) :is(.window-docked-actions button,.palace-confirm){min-height:44px!important;font-size:15px!important;padding:10px 16px!important}
html body :is(#modal,.palace-sheet) :is(.text-button,summary){min-height:44px;display:block;padding-block:10px!important;font-size:14px!important;line-height:1.6!important;cursor:pointer}
html body :is(#modal,.palace-sheet) .text-button{width:fit-content!important;max-width:100%;padding-inline:0!important;color:#d9c496!important;text-decoration:underline;text-underline-offset:4px}
/* Explanations, section containers and numeric facts are not separate windows. */
html body :is(#modal,.palace-sheet) :is(
 .choice-report,.choice-detail-intro,.choice-experience,.growth-report,.fixed-report,.experience-gain,.forecast-fixed,.forecast-gain,
 .palace-order-brief,.palace-blocked-reason,.campaign-method,.dossier-hero,.dossier-record,.dossier-skill,.dossier-caption,.dossier-stats>div,
 .detail-data-card,.faction-detail-grid article,.promotion-all,.promotion-preview,.promotion-offices>div,.promotion-check,
 .patronage-strip,.relationship-panel,.command-authority-panel,.court-career-panel,.personnel-review,.career-transfer,.experience-panel,.faction-court,
 .relationship-meter,.command-authority-effects>span,.personnel-review-record,.guide-requirements>div,.guide-choice-preview,
 .birth-identity,.trait-identity,.origin-trait,.person-stat-details,.career-requirements>div){
 border:0!important;border-image:none!important;outline:none!important;box-shadow:none!important;border-radius:0!important;background:transparent!important;
}
html body :is(#modal,.palace-sheet) :is(.choice-report,.promotion-preview,.personnel-review,.career-transfer,.command-authority-panel,.relationship-panel,.court-career-panel,.experience-panel,.faction-court){padding:0!important;margin:0!important}
html body :is(#modal,.palace-sheet) :is(.choice-detail-intro,.choice-experience,.growth-report,.fixed-report,.patronage-strip,.campaign-method,.dossier-skill,.detail-data-card){padding:12px 0!important;margin:8px 0!important}
html body :is(#modal,.palace-sheet) :is(.choice-report-heading,.report-section-title){height:auto!important;min-height:44px!important;gap:12px!important;padding:0!important;margin:0 0 8px!important}
html body :is(#modal,.palace-sheet) .choice-report-heading>span{font-size:18px!important;font-weight:700;line-height:1.4}
html body :is(#modal,.palace-sheet) :is(.choice-report-heading small,.report-section-title>small,.growth-report-note,.growth-plan-rate,.growth-death-risk){font-size:13px!important;line-height:1.65!important}
html body :is(#modal,.palace-sheet) .report-section-title>strong{font-size:16px!important}
html body :is(#modal,.palace-sheet) :is(.forecast-gain,.forecast-fixed,.experience-gain){padding:8px 0!important;min-width:0;gap:6px;line-height:1.65;font-size:14px!important}
html body :is(#modal,.palace-sheet) :is(.forecast-gain,.forecast-fixed,.experience-gain) small{font-size:12px!important;line-height:1.65!important}
html body :is(#modal,.palace-sheet) .choice-forecast{gap:12px 20px!important}
html body :is(#modal,.palace-sheet) .palace-order-brief{padding:0!important;margin:0 0 20px!important;gap:18px!important;grid-template-columns:132px minmax(0,1fr)!important}
html body :is(#modal,.palace-sheet) .palace-order-brief img{width:132px!important;height:96px!important;object-fit:cover}
html body :is(#modal,.palace-sheet) .palace-order-brief h3{font-size:22px!important;margin:4px 0!important}
html body :is(#modal,.palace-sheet) .palace-order-brief :is(p,span){font-size:14px!important;line-height:1.55!important}
html body :is(#modal,.palace-sheet) .palace-blocked-reason{padding:12px 0 12px 34px!important;background-image:url('assets/ui-icon-lock-v1.webp')!important;background-repeat:no-repeat!important;background-size:24px!important;background-position:0 16px!important;font-size:14px!important;color:#edbea4!important}
html body :is(#modal,.palace-sheet) .routine-choice-detail>summary{padding:10px 0!important;min-height:44px!important}
html body :is(#modal,.palace-sheet) .routine-choice-detail>summary::after{right:0!important}
/* The action window already is the expanded report: do not repeat its title or toggle. */
html body .palace-sheet[data-content=action] .routine-choice-detail[open]>summary,
html body .palace-sheet[data-content=action] .choice-report-heading{display:none!important}
html body .palace-sheet[data-content=action] .palace-order-brief{margin-bottom:12px!important}
html body .palace-sheet[data-content=action] .palace-order-brief h3{display:none!important}
/* Conditions stay readable as a ledger; the decision controls carry the frame. */
html body :is(#modal,.palace-sheet) :is(.promotion-offices>div,.promotion-check,.career-requirements>div,.personnel-review-record){padding:10px 0!important;gap:6px;line-height:1.6}
html body :is(#modal,.palace-sheet) :is(.promotion-offices strong,.personnel-review-record strong){font-size:24px!important}
html body :is(#modal,.palace-sheet) :is(.personnel-review-role,.guide-recommendation,.guide-remaining>button){border:2px solid transparent!important;border-image:var(--value-frame) 180 fill / 6px / 0 stretch!important;box-shadow:none!important;background:transparent!important;min-height:44px;padding:16px!important;gap:8px!important;margin:12px 0!important;color:var(--window-copy)!important}
html body :is(#modal,.palace-sheet) .personnel-review-role{width:100%;min-width:0}
html body :is(#modal,.palace-sheet) :is(.personnel-review-role strong,.guide-recommendation>strong,.guide-remaining>button>strong){font-size:17px!important;line-height:1.5!important}
html body :is(#modal,.palace-sheet) :is(.personnel-review-role small,.guide-recommendation>span,.guide-remaining>button>span){font-size:13px!important;line-height:1.7!important}
html body :is(#modal,.palace-sheet) :is(.personnel-review-role b){font-size:26px!important}
/* Fixed guide tabs sit outside the scrolling reading area. */
html body .palace-sheet[data-content=guide]>.guide-goal-tabs{position:static!important;display:grid!important;height:auto!important;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;flex:none;padding:0 var(--window-inset) 16px!important;margin:0!important;background:none!important}
html body :is(#modal,.palace-sheet) :is(.person-detail-tabs,.guide-goal-tabs) button{min-height:44px!important;height:auto!important;padding:9px 6px!important;font-size:14px!important;line-height:1.4!important;white-space:nowrap;border:2px solid transparent!important;border-image:var(--value-frame) 180 fill / 5px / 0 stretch!important}
html body :is(#modal,.palace-sheet) :is(.person-detail-tabs,.guide-goal-tabs) button[aria-pressed=true]{color:#ffe2a3!important;font-weight:800!important;text-decoration:underline;text-underline-offset:5px}
html body .palace-sheet[data-content=guide] .room-guide-panel{padding:0!important}
html body .palace-sheet[data-content=guide] .guide-choice-preview{padding:8px 0 0!important;margin:0!important;display:grid;gap:7px!important}
html body .palace-sheet[data-content=guide] .guide-choice-preview>span{font-size:14px!important;line-height:1.6!important}
html body .palace-sheet[data-content=guide] .guide-requirements{gap:8px 20px!important;margin:16px 0!important}
html body .palace-sheet[data-content=guide] .guide-requirements>div{padding:8px 0!important;gap:5px;font-size:14px!important}
html body .palace-sheet[data-content=guide] .guide-requirements b{font-size:22px!important}
html body .palace-sheet[data-content=guide] .guide-requirements small{font-size:12px!important}
html body .palace-sheet[data-content=guide] .guide-requirements .is-missing small{color:#f1b3a3!important}
/* Faction and historical profiles share the same quiet, spaced interior. */
html body :is(#modal,.palace-sheet) .faction-detail-panel>header{padding:0 0 12px!important;margin:0!important;border:0!important;background:none!important}
html body :is(#modal,.palace-sheet) .faction-detail-panel h3{font-size:26px!important;margin:4px 0 8px!important}
html body :is(#modal,.palace-sheet) .faction-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 24px!important}
html body :is(#modal,.palace-sheet) .faction-detail-grid article{padding:8px 0!important;min-height:64px!important;display:grid;grid-template-columns:34px minmax(0,1fr);gap:6px 10px;align-content:center}
html body :is(#modal,.palace-sheet) .faction-detail-grid article i{grid-column:1;grid-row:1/3;align-self:center;font-size:23px;display:grid;place-items:center;width:34px;height:42px}
html body :is(#modal,.palace-sheet) .faction-detail-grid article span{font-size:13px!important;color:var(--window-muted)!important}
html body :is(#modal,.palace-sheet) .faction-detail-grid article strong{font-size:22px!important;line-height:1.4;overflow-wrap:anywhere}
html body :is(#modal,.palace-sheet) .faction-detail-note{font-size:13px!important;margin-top:20px!important}
html body :is(#modal,.palace-sheet) .dossier-hero{padding:0 0 16px!important;margin:0!important}
html body :is(#modal,.palace-sheet) .dossier-record{padding:0!important;margin:12px 0 20px!important;font-size:15px!important;line-height:1.8!important}
html body :is(#modal,.palace-sheet) .dossier-stats{gap:18px!important;margin:16px 0 20px!important}
html body :is(#modal,.palace-sheet) .dossier-stats>div{padding:0!important}
html body :is(#modal,.palace-sheet) .dossier-stats>div span{font-size:13px!important}
html body :is(#modal,.palace-sheet) .dossier-stats>div b{font-size:28px!important}
html body :is(#modal,.palace-sheet) .dossier-skill>strong{font-size:19px!important}
html body :is(#modal,.palace-sheet) .detail-card-grid{gap:18px 24px!important}
html body :is(#modal,.palace-sheet) .detail-data-card h4{margin:0 0 12px!important}
html body :is(#modal,.palace-sheet) .detail-data-card dt{font-size:13px!important}
html body :is(#modal,.palace-sheet) .detail-data-card dd{font-size:17px!important}
html body :is(#modal,.palace-sheet) .detail-data-card dd small{font-size:13px!important}
/* Older panels formerly supplied their own paper/charcoal backing. */
html body :is(#modal,.palace-sheet) :is(.routine-choice-card,.routine-choice-detail,.person-dossier,.campaign-readiness,.campaign-route-explanation,.campaign-scale-note,.conquest-details,.conquest-panel,.conquest-court,.conquest-political-steps,.trait-card,.trait-detail-section,.traits-catalog,.career-progress-note,.personnel-review-guide,.recruitment-review-guide,.career-management-guide){border:0!important;border-image:none!important;background:transparent!important;box-shadow:none!important;border-radius:0!important;outline:none!important}
html body :is(#modal,.palace-sheet) :is(.routine-choice-card,.person-dossier,.campaign-readiness){padding:0!important;margin:0!important}
html body #modal:has(.person-dossier){width:min(780px,calc(100vw - 24px))!important;height:fit-content!important;min-height:0!important}
html body :is(#modal,.palace-sheet) .campaign-readiness>p{padding:0!important;margin:10px 0 18px!important}
html body :is(#modal,.palace-sheet) .campaign-method-heading>strong{background:none!important;padding:0!important;color:#accadf!important;font-size:14px!important}
html body :is(#modal,.palace-sheet) .campaign-method-stats>div{padding:8px 0!important;background:none!important;border:0!important;gap:10px;font-size:14px!important}
html body :is(#modal,.palace-sheet) .faction-detail-grid article[data-faction-detail=policy]{grid-column:1/-1}
html body :is(#modal,.palace-sheet) :is(
 .campaign-requirements,.conquest-pressure,.allegiance-reputation,.career-management,.personal-story-panel,.personal-story-result,
 .life-result,.mastery-entry,.hall-readonly,.experience-mastery,.policy-rules,.unification-summary,.world-result-entry,
 .world-detail .world-effect,.world-metrics>div,.biography-judgment,.birth-family,.birth-innate,.policy-panel,.policy-option,.unification-panel,
 .story-choice-memory,.personal-story-records,.relationship-details,.court-details,.command-authority-note,.command-authority-scope,
 .personnel-review-footnote,.career-transfer-note,.recruitment-review,.recruitment-options,.faction-court-status,.realm-name-choices,
 .conquest-court-status,.world-history-entry,.conquest-records li,.campaign-method-grid,.personnel-review-roles,.historical-person-profile,
 .guide-remaining,.guide-goal-content>details,.mobilization-ledger,.policy-benefit,.policy-tradeoff,.career-transfer-summary,.recruitment-summary){
 border:0!important;border-image:none!important;background:transparent!important;box-shadow:none!important;border-radius:0!important;outline:none!important;
}
html body :is(#modal,.palace-sheet) :is(.modal-copy,.window-reading-body,.palace-sheet-body) p{font-size:15px;line-height:1.75}
html body :is(#modal,.palace-sheet) small{font-size:12px!important;line-height:1.6!important}
html body :is(#modal,.palace-sheet) :is(.eyebrow,.dossier-kicker,.faction-detail-panel>header>span){font-size:12px!important;line-height:1.6!important;color:var(--window-muted)!important}
html body :is(#modal,.palace-sheet) button{min-height:44px;touch-action:manipulation}
html body :is(#modal,.palace-sheet) :is(button.primary,button.secondary,.policy-option>button,.career-transfer-option,.personnel-review-role>button){border:2px solid transparent!important;border-image:var(--value-frame) 180 fill / 5px / 0 stretch!important;background:transparent!important;box-shadow:none!important;font-size:15px!important;min-height:44px!important;line-height:1.5!important}
html body :is(#modal,.palace-sheet) .policy-option{padding:12px 0!important;margin:0 0 12px!important}
html body :is(#modal,.palace-sheet) .policy-option>button{padding:14px!important;width:100%}
html body :is(#modal,.palace-sheet) :is(.policy-benefit,.policy-tradeoff,.policy-rules,.allegiance-reputation,.mobilization-ledger){padding:10px 0!important;margin:10px 0!important;font-size:14px!important;line-height:1.7!important}
html body :is(#modal,.palace-sheet) .guide-remaining{padding:8px 0!important;margin:16px 0 0!important}
html body :is(#modal,.palace-sheet) :is(.promotion-check.is-missing,.campaign-method-stats .is-missing,.career-requirements .is-missing){color:#efb3a4!important}
html body :is(#modal,.palace-sheet) :is(.promotion-check.is-met,.campaign-method-stats .is-met,.career-requirements .is-met){color:#c7e0e9!important}
/* Control outlines are interaction feedback, never an extra decorative mat. */
html body :is(#modal,.palace-sheet) :is(button,a,summary,select,input):focus-visible{outline:2px solid #e4ce9e!important;outline-offset:2px!important}
@media(max-width:700px){
 :root{--window-inset:16px;--window-gap:16px}
 html body :is(#modal,.palace-sheet){border-width:6px!important;border-image-width:9px!important}
 html body #modal[open]{width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px)!important}
 html body :is(#modal,.palace-sheet) :is(.modal-top,.palace-sheet>header){min-height:62px;padding-block:8px!important;gap:10px}
 html body :is(#modal,.palace-sheet) :is(.modal-top h2,.palace-sheet>header h2){font-size:19px!important}
 html body :is(#modal,.palace-sheet) :is(p,li){font-size:14px;line-height:1.75}
 html body :is(#modal,.palace-sheet) :is(.person-detail-tabs,.guide-goal-tabs) button{font-size:13px!important;padding-inline:4px!important}
 html body :is(#modal,.palace-sheet) .palace-order-brief{grid-template-columns:92px minmax(0,1fr)!important;gap:12px!important;margin-bottom:16px!important}
 html body :is(#modal,.palace-sheet) .palace-order-brief img{width:92px!important;height:80px!important}
 html body :is(#modal,.palace-sheet) .palace-order-brief h3{font-size:19px!important}
 html body :is(#modal,.palace-sheet) .choice-forecast{gap:12px!important}
 html body :is(#modal,.palace-sheet) .faction-detail-grid{gap:12px 16px!important}
 html body :is(#modal,.palace-sheet) .faction-detail-grid article{grid-template-columns:24px minmax(0,1fr);gap:5px 6px}
 html body :is(#modal,.palace-sheet) .faction-detail-grid article i{font-size:20px;width:24px;height:34px}
 html body :is(#modal,.palace-sheet) .faction-detail-grid article strong{font-size:18px!important}
 html body :is(#modal,.palace-sheet) .dossier-record{font-size:14px!important}
}
