/* Extend the existing archive workspace: character-led scenes, not a new site theme. */
/* Briefing is a deliberate first-entry reading step; later dialogue stays a strip. */
#case-opening{box-sizing:border-box;width:min(920px,calc(100vw - 32px));max-width:calc(100vw - 32px);max-height:calc(100dvh - 32px);margin:auto;padding:clamp(20px,4vw,44px);border:1px solid var(--g-rule);border-radius:16px;color:var(--g-text);background:var(--g-panel);box-shadow:0 12px 36px rgb(30 24 17 / 15%);overflow:auto;overscroll-behavior:contain;font-family:'Microsoft YaHei',sans-serif;}
#case-opening::backdrop{background:rgb(30 26 22 / 68%);}
#case-opening h2{margin:0;font:600 clamp(23px,3vw,32px)/1.4 'SimSun',serif;text-wrap:balance;}
#case-opening .opening-location{margin:10px 0 24px;padding-bottom:16px;border-bottom:1px solid var(--g-rule);font-size:13px;color:var(--g-muted);}
#case-opening #opening-title:focus{outline:none;}
#case-opening #opening-title{padding-right:36px;}
html body #case-opening #opening-dismiss{position:absolute;top:12px;right:12px;width:44px;min-height:44px;padding:10px;border:0!important;border-radius:10px;background:var(--g-panel)!important;color:var(--g-text)!important;}
#opening-dismiss svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.8;}
#case-opening #opening-dismiss:focus-visible{outline:3px solid var(--g-accent);outline-offset:2px;}
.opening-scene{display:grid;grid-template-columns:minmax(0,1fr) 156px;gap:32px;align-items:start;}
#opening-background p{font:17px/1.95 'Songti SC','SimSun',serif;margin:0 0 18px;overflow-wrap:anywhere;}
#opening-background p:last-child{margin-bottom:0;}
#opening-correspondent{margin:4px 0 0;}
#opening-correspondent .character-portrait{width:156px;height:184px;border-radius:12px;background-color:var(--g-board);}
#opening-correspondent figcaption{display:grid;gap:6px;margin-top:12px;font:14px/1.6 'Microsoft YaHei',sans-serif;}
#opening-correspondent figcaption span{font-size:12px;color:var(--g-muted);}
.opening-assignment{border-top:1px solid var(--g-rule);margin-top:28px;padding-top:16px;}
.opening-assignment p{font:14px/1.8 'Microsoft YaHei',sans-serif;margin:0 0 8px;overflow-wrap:anywhere;}
.opening-actions{display:flex;align-items:center;gap:18px;justify-content:space-between;margin-top:28px;}
.opening-actions small{max-width:28ch;font:12px/1.6 'Microsoft YaHei',sans-serif;color:var(--g-muted);}
html body #case-opening #opening-enter{min-height:44px;padding:10px 24px;border:1px solid var(--g-accent);border-radius:10px;background:var(--g-accent)!important;color:var(--desk-on-accent,var(--g-bg))!important;font:600 14px/1.5 'Microsoft YaHei',sans-serif;box-shadow:0 3px 9px rgb(30 24 17 / 5%);white-space:nowrap;}
#case-opening #opening-enter:focus-visible{outline:3px solid var(--g-accent);outline-offset:4px;}
html body.reference-case #dialogue-close{position:absolute;z-index:3;top:8px;right:8px;display:grid;place-items:center;width:44px;min-height:44px;padding:10px;border:0!important;background:var(--g-panel)!important;color:var(--g-text)!important;}
body:has(#case-opening[open]) #window-story{opacity:0;pointer-events:none;}
#dialogue-close svg{width:20px;height:20px;stroke:currentColor;stroke-width:1.8;fill:none;}
body.reference-case .dialogue-scene{padding-right:44px;}
@media(max-width:640px){#case-opening{padding:20px;}.opening-scene{display:flex;flex-direction:column;gap:20px;}#opening-correspondent{display:flex;gap:14px;align-items:center;order:-1;}#opening-correspondent .character-portrait{width:64px;height:76px;flex:none;}#opening-correspondent figcaption{margin:0;}#opening-background p{font-size:16px;line-height:1.9;}.opening-actions{align-items:stretch;flex-direction:column;gap:12px;margin-top:24px;}.opening-actions small{max-width:none;}}
.story-led-case #window-story { width:min(640px,calc(100vw - 24px)); }
.story-led-case .story-pane { padding:16px 20px 20px; }
.story-led-case .story-pane > div:first-child .dossier-intro { display:none; }
.story-led-case .story-pane > div:first-child > .eyebrow { display:none; }
.story-led-case .case-dialogue h2 { font-size:clamp(23px,2.4vw,30px); margin:12px 0 10px; line-height:1.3; }
.dialogue-scene { color:var(--g-muted); font-size:13px; line-height:1.6; }
.dialogue-ambient { color:var(--g-text); font-size:14px; line-height:1.8; margin:0 0 24px; }
.dialogue-speech { display:flex; gap:20px; align-items:flex-start; }
.character-portrait { flex:none; width:108px; height:108px; background-image:url('assets/characters-v1.png'); background-size:400% 300%; background-repeat:no-repeat; border-radius:10px; background-color:#3c403a; }
.dialogue-copy { flex:1; min-width:0; }
.dialogue-who { display:flex; flex-wrap:wrap; gap:6px 12px; align-items:baseline; padding-bottom:8px; border-bottom:1px solid var(--g-rule); }
.dialogue-who strong { font-size:18px; color:var(--g-text); }
.dialogue-who span { color:var(--g-muted); font-size:12px; }
#dialogue-text { margin:12px 0 0; font-size:17px; line-height:1.85; min-height:94px; overflow-wrap:anywhere; color:var(--g-text); }
.dialogue-actions { display:flex; align-items:center; gap:12px; margin-top:24px; }
.dialogue-actions button { min-height:44px; padding:10px 16px; }
.dialogue-actions .primary { margin:0 0 0 auto; }
#dialogue-count { color:var(--g-muted); font-size:13px; }
.dialogue-history { display:block; font-size:12px; color:var(--g-muted); margin-top:24px; }
.dialogue-history select { display:block; width:100%; margin-top:6px; min-height:44px; }
#dialogue-guide { margin-top:18px; border-top:1px solid var(--g-rule); padding-top:8px; }
#dialogue-guide summary { cursor:pointer; min-height:44px; display:flex; align-items:center; color:var(--g-text); font-size:14px; }
.dialogue-guide-body { display:flex; gap:12px; align-items:flex-start; padding:8px 0; }
.dialogue-guide-body .character-portrait { width:64px; height:64px; }
.dialogue-guide-body p { margin:8px 0 0; line-height:1.8; font-size:14px; }
.story-led-case .workspace-clues .clue-list { display:flex; flex-wrap:wrap; }
.story-led-case .workspace-clues .clue { flex:1; min-width:min(240px,100%); }
.story-led-case .suspects .character-portrait { width:48px; height:48px; }
.story-led-case .suspects button { display:flex; align-items:center; gap:10px; text-align:left; }
.story-led-case .investigation-steps { display:none; }
.story-led-case .workspace-tools button[aria-controls=window-verdict]:disabled { opacity:.55; }
.story-led-case .board-instruction { max-width:75ch; }
.story-led-case [hidden] { display:none!important; }
.story-led-case.reading-story .query-return { display:none; }
html[data-game-theme=archive] .story-led-case #dialogue-next { color:#292921; }
@media(max-width:650px){
 .story-led-case .story-pane { padding:12px; }
 .dialogue-speech { gap:12px; }
 .dialogue-speech .character-portrait { width:76px; height:76px; }
 #dialogue-text { font-size:16px; min-height:0; }
 .dialogue-who { display:block; }
 .dialogue-who span { display:block; margin-top:4px; }
 .dialogue-ambient { margin-bottom:18px; }
 .dialogue-actions { gap:8px; margin-top:18px; }
 .dialogue-actions button { padding-inline:10px; }
}
@media(prefers-reduced-motion:no-preference){.case-dialogue .dialogue-speech { animation:dialogue-arrive .2s cubic-bezier(.16,1,.3,1); }@keyframes dialogue-arrive { from { opacity:.6; transform:translateY(4px); } to { opacity:1; transform:none; } }}

/* Character dialogue is a paper strip at the bottom, not another desktop window. */
body.reference-case #window-story { position:fixed!important;left:50%!important;right:auto!important;top:auto!important;bottom:max(18px,env(safe-area-inset-bottom))!important;transform:translateX(-50%);width:min(1060px,calc(100vw - 48px))!important;height:auto!important;min-width:0!important;min-height:0!important;max-height:min(340px,45dvh)!important;resize:none!important;overflow:visible!important;background:transparent!important;border:0!important;box-shadow:none!important;z-index:40!important; }
body.reference-case #window-story[hidden] { display:none!important; }
body.reference-case #window-story .window-titlebar,body.reference-case .story-pane>div:first-child { display:none!important; }
body.reference-case #window-story .window-content { height:auto;max-height:inherit;overflow:visible; }
body.reference-case .story-pane { padding:0!important;background:transparent; }
body.reference-case .case-dialogue { position:relative;isolation:isolate;padding:22px 28px 24px;background:transparent!important;border:0!important;border-radius:0!important;color:var(--g-text);box-shadow:none!important;filter:drop-shadow(0 7px 14px rgb(30 24 17 / 12%));max-height:min(340px,45dvh);overflow:auto;display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:16px; }
/* Only the material is cut. Text, focus outlines and scrollable history stay live. */
body.reference-case .case-dialogue::before { content:'';position:absolute;inset:0;z-index:-1;pointer-events:none;background:var(--g-panel);background-image:linear-gradient(color-mix(in srgb,var(--g-panel) 88%,transparent),color-mix(in srgb,var(--g-panel) 88%,transparent)),url('assets/dialogue-paper-v1.webp');background-size:auto,360px;clip-path:polygon(.3% 4%,3% 2.2%,7% 3.6%,11% .6%,17% 2.5%,24% 1.1%,33% 2.8%,42% 0,51% 1.8%,63% .4%,74% 2%,85% .8%,94% 2.1%,99.2% .7%,100% 23%,99.7% 42%,100% 68%,99.4% 96%,96% 98.2%,91% 96.7%,83% 99.3%,76% 97.1%,68% 100%,61% 97.8%,52% 99.5%,43% 97.2%,35% 99.3%,26% 96.9%,18% 98.9%,10% 96.7%,3% 99%,0 96%,.5% 74%,0 53%,.6% 28%); }
body.reference-case .case-dialogue::after { display:none; }
body.reference-case .dialogue-scene { grid-column:1/-1;font:12px/1.6 'Microsoft YaHei',sans-serif;margin:0 36px 7px 110px; }
body.reference-case .dialogue-speech { grid-column:1/-1;gap:18px;align-items:center; }
body.reference-case .dialogue-speech .character-portrait { width:92px;height:108px;border-radius:8px!important;background-color:var(--g-board);box-shadow:0 3px 10px rgb(30 24 17 / 12%); }
body.reference-case .dialogue-who { border:0;padding-bottom:0; }
body.reference-case .dialogue-who strong { font-size:16px; }
body.reference-case #dialogue-text { margin:7px 0 0;font:16px/1.65 'Microsoft YaHei',sans-serif;min-height:0;max-height:100px;overflow:auto; }
body.reference-case .dialogue-actions { grid-column:1;grid-row:3;margin:10px 0 0;padding-left:110px;gap:10px; }
body.reference-case .dialogue-actions button { min-height:44px;font:13px/1.4 'Microsoft YaHei',sans-serif;padding:8px 14px; }
body.reference-case #dialogue-count { font-size:12px; }
body.reference-case #dialogue-context { grid-column:2;grid-row:3;align-self:end;max-width:260px; }
body.reference-case #dialogue-context>summary { cursor:pointer;font:12px/1.5 'Microsoft YaHei',sans-serif;min-height:40px;display:flex;align-items:center;color:var(--g-muted); }
body.reference-case #dialogue-context[open] { grid-column:1/-1;grid-row:4;max-width:none;padding-top:12px; }
body.reference-case #dialogue-context[open]>summary { min-height:30px; }
body.reference-case #dialogue-context h2 { font-size:18px;margin:8px 0; }
body.reference-case #dialogue-context .dialogue-history { margin-top:10px; }
body.reference-case #dialogue-context .dialogue-ambient { margin-bottom:10px; }
body.reference-case .case-dialogue #dialogue-guide { margin-top:10px; }
body.reference-case.reading-story main { padding-bottom:24px; }
@media(max-width:760px){
 body.reference-case #window-story { width:calc(100vw - 24px)!important;bottom:max(12px,env(safe-area-inset-bottom))!important;max-height:min(360px,48dvh)!important; }
 body.reference-case .case-dialogue { padding:16px 14px 20px;column-gap:8px;max-height:min(360px,48dvh); }
 body.reference-case .dialogue-speech { gap:12px;align-items:flex-start; }
 body.reference-case .dialogue-speech .character-portrait { width:58px;height:72px; }
 body.reference-case .dialogue-who strong { font-size:14px; }
 body.reference-case .dialogue-who span { margin-top:2px;font-size:11px; }
 body.reference-case #dialogue-text { font-size:16px;line-height:1.55;max-height:135px; }
 body.reference-case .dialogue-actions { padding-left:0;grid-column:1/-1;margin-top:12px;flex-wrap:wrap; }
 body.reference-case .dialogue-scene { margin-left:70px; }
 body.reference-case #dialogue-context { grid-column:1/-1;grid-row:4;max-width:none; }
 body.reference-case #dialogue-context>summary { min-height:30px; }
 body.reference-case #dialogue-context[open] { grid-row:4; }
 body.reference-case.reading-story main { padding-bottom:40px; }
}
