/* Paper investigation tools: own palette, bounded world, stable SQL controls. */
html body.reference-case.game-ui[data-reference-view] :is(button,input,select,textarea,.button,.results,.feedback,pre,.board,.console,.pin,.reference-tool){border-radius:10px!important;}
html body.reference-case :is(.case-window,.reference-brief,.reference-result-sheet,.board-excerpt,.reference-settings-panel){border-radius:16px!important;box-shadow:0 5px 18px rgb(30 24 17 / 5%)!important;}
html body.reference-case :is(button,.button,.reference-tool,.reference-settings summary){box-shadow:0 3px 9px rgb(30 24 17 / 5%)!important;border-width:1px!important;letter-spacing:0;}
html body.reference-case .topbar{box-shadow:0 3px 12px rgb(30 24 17 / 5%);}
html body.reference-case .reference-settings summary{border-radius:10px;}
body.reference-case .console{order:0;}
body.reference-case .console::before{display:none;}
html body.reference-case .reference-brief{background:linear-gradient(115deg,color-mix(in srgb,var(--g-paper) 94%,var(--g-accent)),var(--g-panel));padding:20px;}
.reference-brief::after{display:none!important;}
html body.reference-case select{appearance:none;border:1px solid var(--g-rule);padding:9px 32px 9px 12px!important;min-height:38px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%238c7055' stroke-width='2'/%3E%3C/svg%3E")!important;background-position:right 10px center!important;background-repeat:no-repeat!important;}
body.reference-case[data-reference-view=map] .game-shell{left:340px;right:22px;bottom:96px;}
body.reference-case .game-shell #board-viewport{width:100%;height:100%;overflow:hidden;position:relative;margin:0;background:var(--g-board)!important;touch-action:none;}
#board-canvas{position:absolute;width:1000px;height:700px;left:0;top:0;transform-origin:0 0;}
body.reference-case #board-canvas .route-map{width:1000px;height:700px;}
body.reference-case #board-canvas .ink-trace{display:none;}
#board-ink{position:absolute;inset:0;width:1000px;height:700px;pointer-events:none;z-index:4;}
#board-ink path{fill:none;stroke:var(--g-mark);stroke-width:3;stroke-linecap:round;stroke-linejoin:round;}
#board-viewport[data-board-mode=pan]{cursor:grab;}
#board-viewport[data-board-mode=pen]{cursor:crosshair;}
#board-viewport[data-board-mode=pen] .route-map{pointer-events:none;}
#board-viewport:is([data-board-mode=pen],[data-board-mode=pan]) .pin{pointer-events:none;}
body.reference-case #board-notes{position:absolute;inset:0;width:100%;height:100%;display:block;z-index:5;pointer-events:none;}
body.reference-case #board-notes .board-excerpt{position:absolute;width:300px;max-height:210px;overflow:auto;padding:12px;pointer-events:auto;border:1px solid var(--g-rule);background:var(--g-panel);}
html body.reference-case #board-notes .board-note-handle{position:static;display:block;width:calc(100% - 30px);height:auto;min-height:36px;text-align:left;padding:4px;cursor:move;border:0!important;background:transparent!important;color:var(--g-text)!important;}
html body.reference-case #board-notes .board-note-remove{position:absolute;right:6px;top:8px;width:28px;min-height:28px;padding:0;}
body.reference-case #board-notes code{font:12px/1.6 Consolas,monospace;white-space:pre-wrap;max-width:100%;}
body.reference-case #board-notes p{font:13px/1.6 'Microsoft YaHei',sans-serif;overflow-wrap:anywhere;}
#board-tools{position:absolute;top:calc(100% + 12px);left:0;right:0;display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:8px;background:var(--g-panel);border-radius:14px;z-index:8;}
.board-tool-help{font:12px/1.5 'Microsoft YaHei',sans-serif;color:var(--g-muted);margin-left:8px;}
body.reference-case #board-tools button{min-height:38px;min-width:38px;padding:8px;display:flex;align-items:center;gap:6px;}
#board-tools svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;}
#board-tools button[aria-pressed=true]{outline:2px solid var(--g-accent);outline-offset:0;}
#board-tools button span{display:none;}
#board-zoom{min-width:48px;text-align:center;font:12px Consolas,monospace;}
#board-announcement{position:absolute;left:0;bottom:4px;margin:0;font:12px/1.5 'Microsoft YaHei',sans-serif;max-width:100%;color:var(--g-muted);}
.desk-task-heading{margin:0 0 12px;font:600 18px/1.5 'Microsoft YaHei',sans-serif;}
.desk-task-help{font:13px/1.7 'Microsoft YaHei',sans-serif;color:var(--g-muted);}
.reference-case-category{font:13px/1.7 'Microsoft YaHei',sans-serif;color:var(--g-muted);margin:0 0 12px;overflow-wrap:anywhere;}
html body.reference-case #open-query{display:flex;width:100%;justify-content:center;min-height:44px;margin:4px 0 20px;background:var(--g-accent)!important;color:var(--desk-on-accent)!important;font:600 14px/1.5 'Microsoft YaHei',sans-serif;}
body.reference-case #open-query svg{width:18px;height:18px;}
body.reference-case .reference-settings-panel .game-preferences{display:grid;gap:14px;width:100%;max-width:none;}
body.reference-case .reference-settings-panel .game-preferences label{display:grid;gap:6px;font:13px/1.5 'Microsoft YaHei',sans-serif;}
body.reference-case .reference-settings-panel .game-preferences select{max-width:none;width:100%;min-height:44px;}
body.reference-case .result-pane[hidden],body.reference-case .reference-result-sheet[hidden]{display:none!important;}
body.reference-case[data-result-state=empty] .reference-console-stack{min-height:0;}
body.reference-case .reference-console-stack:has(.reference-result-sheet[hidden]){min-height:0;}
body.reference-case .console>.feedback{flex:none;margin:10px 0 0;padding:8px 0;max-height:min(120px,22dvh);overflow:auto;overflow-wrap:anywhere;font:13px/1.65 'Microsoft YaHei',sans-serif;}
body.reference-case .console>.feedback:empty{display:none;}
body.reference-case .console>.feedback.error{color:var(--g-error);}
body.reference-case[data-dialogue-pending=true] #open-query{visibility:hidden;}
body.reference-case[data-reference-view=console] :is(#board-tools,#board-announcement){display:none;}
body.reference-case .reference-status{position:static;font-size:12px;max-height:none;margin-top:8px;}
/* Floating tools must not lose controls to the header or squeeze real rows away. */
body.reference-case #window-records .dossier::before{display:none;}
body.reference-case.reading-story #window-story{z-index:90!important;}
body.reference-case .topbar:has(.reference-settings[open]){z-index:80;}
body.reference-case .reference-settings-panel{position:fixed;left:auto;right:12px;width:min(310px,calc(100vw - 24px));overflow:auto;z-index:2;}
body.reference-case .reference-sql-wrap{border-radius:10px;}
body.reference-case[data-reference-view=map] #window-query .window-content{overflow:auto;scrollbar-gutter:stable;}
body.reference-case[data-reference-view=map] #window-query .console{position:sticky;top:0;z-index:4;background:var(--g-panel);}
body.reference-case[data-reference-view=map] #window-query .result-pane{flex:1 0 auto;min-height:360px;overflow:visible;}
body.reference-case[data-reference-view=map] #window-query .results{flex:1 0 120px;min-height:120px;max-height:300px;}
@media(max-height:700px){
 body.reference-case[data-reference-view=map] .reference-sql-wrap{height:100px;min-height:80px;}
 html[data-game-theme] body.reference-case[data-reference-view=console]{height:auto;min-height:100dvh;overflow:auto;}
 body.reference-case[data-reference-view=console] main{height:auto;overflow:visible;}
 body.reference-case[data-reference-view=console] .reference-shell{height:auto;}
 body.reference-case[data-reference-view=console] .reference-console-stack{min-height:680px;}
 body.reference-case[data-reference-view=console] #window-query{position:sticky!important;top:12px!important;z-index:12;}
 body.reference-case[data-reference-view=console] .reference-result-sheet{min-height:360px;}
}
@media(max-width:1100px){body.reference-case[data-reference-view=map] .game-shell{left:328px;right:12px;}#board-tools{gap:3px;padding:6px;}.board-tool-help{display:none;}}
@media(max-width:760px){body.reference-case[data-reference-view=map] .game-shell{left:auto;right:auto;bottom:auto;height:460px;margin-top:16px;margin-bottom:144px;}#board-announcement{bottom:4px;font-size:11px;background:var(--g-panel);padding:4px;}body.reference-case #board-notes .board-excerpt{width:280px;}body.reference-case .reference-status{margin-bottom:20px;}body.reference-case .game-preferences select{max-width:150px;}}
