/* Only the four generic closing consumers receive these presentation rules. */
.closing-visual{background:#142832;overflow:hidden}
.closing-visual>.closing-art-image{display:block;width:100%;height:100%;object-fit:cover;object-position:center top}
.closing-visual[data-closing-state="loading"]>.closing-art-image,.closing-visual[data-closing-state="failed"]>.closing-art-image{display:none}
.closing-art-status{position:absolute;inset:20px 16px auto;margin:0;padding:12px 14px;color:#fff9e6;background:#142832d9;font:14px/1.45 Inter,Arial,sans-serif}
.closing-art-status[hidden]{display:none}
.agency-shell #ending.ending-cinematic>.ending-scene.closing-visual img,.week-report-art.closing-visual img{object-position:center top}
.agency-shell #ending.ending-cinematic>.ending-scene.closing-visual[data-closing-resolved-orientation="portrait"][data-closing-resolved-family="b"] img,.week-report-art.closing-visual[data-closing-resolved-orientation="portrait"][data-closing-resolved-family="b"] img{object-position:left top}
.closing-legacy{position:relative;aspect-ratio:16/9;min-height:160px}
.closing-legacy>.closing-art-image{position:absolute;inset:0}
/* Generic non-birthday evening keeps its original text, buttons and handlers.
   Its art frame, not the browser viewport, chooses the authored orientation. */
.week-choice.closing-generic[open]{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(240px,1fr);height:min(560px,calc(100dvh - 32px));overflow:hidden}
.closing-generic-visual{position:relative;margin:0;min-height:0;height:100%}
.week-choice.closing-generic>.week-choice-copy{align-self:stretch;max-height:100%;overflow:auto;overscroll-behavior:contain;box-sizing:border-box;padding:28px}
@media(orientation:portrait){
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced:not([hidden]){padding:12px;align-items:flex-end;justify-content:center}
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced .ending-panel{box-sizing:border-box;width:min(440px,100%);max-height:calc((100dvh - 24px)*.48);padding:16px;overflow:auto}
 .agency-shell #ending.ending-cinematic.closing-enhanced h2{font-size:30px;line-height:1.05;margin-bottom:10px}
 .agency-shell #ending.ending-cinematic.closing-enhanced .ending-earned{font-size:28px;margin-bottom:12px}
 .agency-shell #ending.ending-cinematic.closing-enhanced .ending-tomorrow{margin-top:12px}
 .week-report.closing-enhanced{display:flex;flex-direction:column;justify-content:flex-end;align-items:stretch;gap:8px;padding:12px;height:100%;overflow:hidden}
 .week-report.closing-enhanced .week-report-caption{align-self:stretch;flex:none;padding:0}
 .week-report.closing-enhanced .week-report-caption>span{font-size:12px;margin-bottom:4px}
 .agency-shell #ending .week-report.closing-enhanced .week-report-caption h2{font-size:34px;line-height:1}
 .week-report.closing-enhanced .week-report-card{width:100%;max-height:44dvh;padding:16px;flex:0 1 auto;overflow:auto}
 .week-choice.closing-generic[open]{position:fixed;display:block;width:calc(100vw - 16px);height:calc(100dvh - 24px);max-height:calc(100dvh - 24px);isolation:isolate}
 .week-choice.closing-generic>.closing-generic-visual{position:absolute;inset:0;height:100%;z-index:-1}
 .week-choice.closing-generic>.week-choice-copy{position:absolute;inset:auto 0 0;max-height:calc((100dvh - 24px)*.48);padding:16px;background:#fff9e6}
 .week-choice.closing-generic .week-choice-day{margin-top:0}
 .week-choice.closing-generic h2{font-size:30px;margin:8px 0 12px}
 .week-choice.closing-generic .week-choice-actions{gap:12px;margin-top:16px}
 .closing-legacy{height:min(52dvh,520px);min-height:180px;aspect-ratio:auto}
}
@media(orientation:portrait) and (max-height:640px){
 .week-report.closing-enhanced .week-report-card{max-height:38dvh}
}
@media(orientation:landscape) and (max-height:540px){
 .week-choice.closing-generic>.week-choice-copy{padding:16px}
 .week-choice.closing-generic h2{font-size:28px;margin:8px 0 12px}
 .week-choice.closing-generic .week-choice-actions{gap:10px;margin-top:14px}
}

@media(orientation:landscape) and (min-height:641px){
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced:not([hidden]){align-items:flex-end}
}

/* Existing native actions remain visible; only the original surrounding copy
   and details scroll. No controls are cloned or given replacement handlers. */
.closing-recap-scroll,.closing-report-scroll{display:contents}
@media(orientation:portrait){
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced .ending-panel,.week-report.closing-enhanced .week-report-card{display:flex;flex-direction:column;overflow:hidden;min-height:0}
 .closing-recap-scroll,.closing-report-scroll{display:block;min-height:0;flex:1 1 auto;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
 .agency-shell #ending.ending-cinematic.closing-enhanced .ending-panel>.ending-actions{flex:0 0 auto;position:static;padding:10px 5px 5px 0;margin:0;background:var(--paper)}
 .week-report.closing-enhanced .week-report-card>footer{flex:0 0 auto;padding-top:10px;gap:8px}
}

.closing-evening-scroll{display:contents}
@media(orientation:portrait){
 .week-choice.closing-generic>.week-choice-copy{display:flex;flex-direction:column;overflow:hidden}
 .closing-evening-scroll{display:block;min-height:0;flex:1 1 auto;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
 .week-choice.closing-generic .week-choice-actions{flex:0 0 auto;display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
 .week-choice.closing-generic .week-choice-actions>.button{min-height:48px;font-size:14px;line-height:1.2;padding:10px 8px}
 .week-choice.closing-generic .week-choice-actions>.button:first-child{grid-column:1/-1}
}

/* Short landscape uses the same original action nodes and scroll regions. */
@media(orientation:landscape) and (max-height:540px){
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced:not([hidden]){padding:12px;align-items:flex-end}
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced .ending-panel{width:min(390px,44vw);max-height:60dvh;padding:12px;display:flex;flex-direction:column;overflow:hidden;min-height:0;box-sizing:border-box}
 .agency-shell #ending.ending-cinematic.closing-enhanced h2{font-size:28px;margin-bottom:8px}
 .closing-recap-scroll,.closing-report-scroll,.closing-evening-scroll{display:block;min-height:0;flex:1 1 auto;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
 .agency-shell #ending.ending-cinematic.closing-enhanced .ending-panel>.ending-actions{flex:0 0 auto;position:static;padding:8px 5px 5px 0;margin:0;background:var(--paper)}
 .week-report.closing-enhanced{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,48%);align-items:center;gap:12px;padding:12px}
 .week-report.closing-enhanced .week-report-caption{align-self:end;padding:0}
 .agency-shell #ending .week-report.closing-enhanced .week-report-caption h2{font-size:34px;line-height:1}
 .week-report.closing-enhanced .week-report-card{max-height:calc(100dvh - 24px);padding:12px;display:flex;flex-direction:column;min-height:0;overflow:hidden}
 .week-report.closing-enhanced .week-report-card>footer{flex:0 0 auto;padding-top:8px;gap:8px}
 .week-choice.closing-generic[open]{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
 .week-choice.closing-generic>.week-choice-copy{display:flex;flex-direction:column;overflow:hidden;min-height:0;min-width:0;padding:12px}
 .week-choice.closing-generic .week-choice-actions{flex:0 0 auto;display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:8px}
 .week-choice.closing-generic .week-choice-actions>.button{min-height:48px;font-size:14px;line-height:1.2;padding:10px 8px}
 .week-choice.closing-generic .week-choice-actions>.button:first-child{grid-column:1/-1}
}

/* A failed phone portrait may resolve to the wide painting. Keep the whole
   substitute above the existing recap without changing the measured frame. */
.agency-shell #ending.ending-cinematic>.ending-scene.closing-visual[data-closing-fallback="true"][data-closing-orientation="portrait"][data-closing-resolved-orientation="landscape"]>.closing-art-image,
.closing-visual[data-closing-fallback="true"][data-closing-orientation="portrait"][data-closing-resolved-orientation="landscape"]>.closing-art-image{object-fit:contain;object-position:center top}


/* A small-screen keepsake shows the real outcome first. The same native report
   expands for deliberate reading instead of living in a tiny nested scroller. */
.closing-details-toggle[hidden]{display:none!important}
.closing-reader-save:empty{display:none}
/* Authored portraits fill the width. Their quiet lower foreground can extend
   behind the recap; no side strips, horizontal crop, or enlarged faces. */
.agency-shell #ending.ending-cinematic>.ending-scene.closing-visual[data-closing-resolved-orientation="portrait"]>.closing-art-image,
.week-report-art.closing-visual[data-closing-resolved-orientation="portrait"]>.closing-art-image,
.closing-generic-visual.closing-visual[data-closing-resolved-orientation="portrait"]>.closing-art-image{width:100%;height:auto;object-fit:contain;object-position:center top}
@media(max-width:760px),(max-height:540px){
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced:not([hidden]){padding:12px}
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced .ending-panel.closing-reader,
 .week-report.closing-enhanced .week-report-card.closing-reader{padding:12px;max-height:calc(100dvh - 24px);overflow:auto;display:flex;flex-direction:column;min-height:0}
 .closing-reader[data-closing-reading="false"]>.closing-recap-scroll,
 .closing-reader[data-closing-reading="false"]>.closing-report-scroll{flex:none;overflow:visible}
 .closing-reader[data-closing-reading="false"]>.closing-report-scroll>:not(header):not(.week-report-stats):not(.week-report-personal),
 .closing-reader[data-closing-reading="false"]>.closing-report-scroll>header>p:not(.week-report-rating),
 .closing-reader[data-closing-reading="false"] .week-stat:nth-child(n+3),
 .closing-reader[data-closing-reading="false"]>.closing-recap-scroll>:not(.ending-recap-copy):not(.ending-tomorrow){display:none}
 .closing-reader[data-closing-reading="false"]>.closing-report-scroll>header h3{font-size:24px;line-height:1.08;margin:4px 0 8px}
 .agency-shell #ending .closing-reader[data-closing-reading="false"] .week-report-rating{font-size:12px;margin:0}
 .closing-reader[data-closing-reading="false"] .week-report-stats{grid-template-columns:1fr 1fr;gap:8px;margin:10px 0 0;padding:8px 0;border-bottom:0}
 .closing-reader[data-closing-reading="false"] .week-stat dt{min-height:0;font-size:12px}
 .closing-reader[data-closing-reading="false"] .week-stat dd{font-size:24px;margin-top:2px}
 .agency-shell #ending .closing-reader[data-closing-reading="false"] .week-report-personal{font-size:13px;line-height:1.35;margin:8px 0 0}
 .agency-shell #ending.ending-cinematic .closing-reader[data-closing-reading="false"] .ending-product{display:none}
 .agency-shell #ending.ending-cinematic .closing-reader[data-closing-reading="false"] h2{font-size:26px;line-height:1.05;margin:0 0 6px}
 .closing-reader[data-closing-reading="false"] h2 br{display:none}
 .agency-shell #ending.ending-cinematic .closing-reader[data-closing-reading="false"] .ending-earned{font-size:26px;margin:6px 0}
 .agency-shell #ending.ending-cinematic .closing-reader[data-closing-reading="false"] .ending-tomorrow{font-size:13px;line-height:1.4;margin:8px 0 0}
 .agency-shell #ending.ending-cinematic .ending-panel.closing-reader>.ending-actions,
 .week-report.closing-enhanced .week-report-card.closing-reader>footer{display:grid;grid-template-columns:1fr 1fr;align-items:stretch;gap:8px;flex:none;padding:12px 4px 4px 0;margin:0}
 .agency-shell #ending .closing-reader>.ending-actions>.button,
 .agency-shell #ending .closing-reader>footer>.button{width:100%;min-width:0;min-height:48px;height:auto;font-size:14px;line-height:1.25;white-space:normal;padding:10px 8px;gap:6px;margin:0;justify-content:center}
 .agency-shell #ending .closing-reader .closing-details-toggle{background:var(--paper,#fff8e5);color:var(--blue,#0055ff);border:1px solid var(--blue,#0055ff);box-shadow:none}
 .closing-reader>footer>a{grid-column:1/-1;min-height:44px;display:flex;align-items:center;justify-content:center}
 .closing-reader[data-closing-reading="false"]>footer>a{display:none}
 .agency-shell #ending .closing-reader>.closing-reader-save{flex:none;font-size:12px;line-height:1.4;margin:8px 0 0;min-height:0}
 .agency-shell .play-grid>#ending.ending-cinematic.closing-enhanced .ending-panel.closing-reader[data-closing-reading="true"],
 .week-report.closing-enhanced .week-report-card.closing-reader[data-closing-reading="true"]{position:absolute;inset:12px;width:auto;height:calc(100% - 24px);max-height:none;margin:0;overflow:hidden;z-index:2}
 .closing-reader[data-closing-reading="true"]>.closing-recap-scroll,
 .closing-reader[data-closing-reading="true"]>.closing-report-scroll{display:block;flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;padding-right:4px}
 .week-report.closing-reading>.week-report-caption{visibility:hidden}
 .closing-reader[data-closing-reading="true"] .week-report-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .closing-reader[data-closing-reading="true"] .week-report-days{overflow-x:auto}
 .closing-reader[data-closing-reading="true"] :is(.ending-product,.ending-details>summary,.week-report-days>summary){min-height:44px}
 /* Decision consequences are always visible, never behind the report toggle. */
 .week-choice.closing-generic>.week-choice-copy{max-height:calc(100% - 48px);overflow:auto;padding:12px}
 .week-choice.closing-generic .closing-evening-scroll{flex:none;overflow:visible}
 .week-choice.closing-generic .week-choice-day{margin:0;font-size:12px}
 .week-choice.closing-generic h2{font-size:25px;line-height:1.1;margin:5px 0 8px}
 .week-choice.closing-generic .closing-evening-scroll>p{font-size:14px;line-height:1.4}
 .week-choice.closing-generic .closing-evening-scroll>p:last-child{margin:0}
 .closing-reader :is(button,a,summary):focus-visible{outline:2px solid var(--blue,#0055ff);outline-offset:2px}
}
@media(max-width:760px) and (orientation:portrait){
 .week-report.closing-enhanced{gap:8px;padding:12px}
 .week-report.closing-enhanced .week-report-caption{position:absolute;top:18px;left:16px;right:16px;max-width:none}
 .agency-shell #ending .week-report.closing-enhanced .week-report-caption h2{font-size:28px}
}

/* Desktop reports retain their actions while the complete ledger scrolls. */
@media(min-width:761px) and (min-height:541px){
 .week-report.closing-enhanced .week-report-card.closing-reader{display:flex;flex-direction:column;min-height:0;overflow:hidden}
 .week-report.closing-enhanced .closing-reader>.closing-report-scroll{display:block;flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin;padding-right:4px}
 .week-report.closing-enhanced .closing-reader>footer{flex:0 0 auto;padding-top:16px}
 .week-report.closing-enhanced .closing-reader>.closing-reader-save{flex:0 0 auto}
}
