/* Own-world desk: existing player themes; reference compositions only.
   One palette authority covers map, records, SQL, charts and bottom dialogue. */
html[data-game-theme] body.reference-case {
 --desk-accent:var(--g-accent);--desk-help:color-mix(in srgb,var(--g-accent) 18%,var(--g-panel));
 background:var(--g-bg);color:var(--g-text); height:100dvh; overflow:hidden; font-family:'Courier New','Microsoft YaHei',monospace;
}
body.reference-case :is(button,select,input,textarea,.button,.reference-tool) { border-radius:0!important; }
html body.reference-case.game-ui[data-reference-view] :is(button,input,select,textarea,.button,.results,.feedback,pre,.board,.console,.pin) { border-radius:0!important; }
body.reference-case :is(button,.button,.reference-tool) { min-height:36px; border:2px solid var(--g-text)!important; box-shadow:3px 3px 0 var(--g-text)!important; font-size:11px; font-weight:700; letter-spacing:.08em; padding:8px 12px; color:var(--g-text)!important; background:var(--g-panel)!important; transition:none; }
body.reference-case :is(button,.reference-tool):hover:not(:disabled) { background:var(--g-board)!important; transform:none; }
body.reference-case :is(button,.reference-tool):active:not(:disabled) { translate:2px 2px; box-shadow:1px 1px 0 var(--g-text)!important; }
body.reference-case button:disabled { background:var(--g-board)!important;color:var(--g-muted)!important;opacity:.75;box-shadow:2px 2px 0 var(--g-rule)!important;cursor:not-allowed; }
body.reference-case :is(button,a,select,input,textarea):focus-visible { outline:3px solid var(--g-accent); outline-offset:4px; }
body.reference-case .topbar { height:64px; padding:10px 22px; gap:14px; display:flex; flex-direction:row;align-items:center;justify-content:flex-start;flex-wrap:nowrap; background:var(--g-panel); border:0; box-shadow:0 7px 0 rgb(34 35 28 / 16%); position:relative; z-index:35; }
body.reference-case .topbar h1 { margin:0 auto 0 0; min-width:0; font:700 clamp(18px,1.65vw,30px)/1.2 Georgia,'SimSun',serif; max-width:52%; }
.reference-tool { display:inline-flex; align-items:center; justify-content:center; gap:8px; text-decoration:none; flex:none; }
.reference-tool svg,.reference-locked svg { width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.6;flex:none; }
body.reference-case .reference-tool[aria-pressed=true],body.reference-case #run,body.reference-case #verify:not(:disabled),body.reference-case .reference-query-tab[aria-selected=true],body.reference-case .result-toolbar button[aria-pressed=true] { background:var(--desk-accent)!important; }
body.reference-case .reference-help { background:var(--desk-help)!important; }
body.reference-case .topbar > #progress { font-size:11px; white-space:nowrap; }
.reference-checkpoints { display:flex; gap:6px; align-items:center;margin:0!important; }
html body.reference-case.game-ui[data-reference-view] .reference-checkpoints button { min-height:26px; width:26px; padding:0; border-radius:50%!important; box-shadow:none!important; font-size:12px; letter-spacing:0; }
body.reference-case .reference-checkpoints button.current { background:var(--g-text)!important;color:var(--g-panel)!important; }
body.reference-case .reference-checkpoints button.complete { background:var(--desk-accent)!important; }
.reference-settings { position:relative; }
.reference-settings summary { width:38px;height:38px;display:flex;align-items:center;justify-content:center;border:2px solid var(--g-text);box-shadow:3px 3px 0 var(--g-text);cursor:pointer;list-style:none; }
.reference-settings summary::-webkit-details-marker { display:none; }
.reference-settings summary svg { width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.6; }
.reference-settings-panel { position:absolute;right:0;top:50px;width:310px;padding:20px;background:var(--g-panel);border:2px solid var(--g-text);box-shadow:4px 4px 0 var(--g-text);display:grid;gap:14px;font-size:13px; }
.reference-settings-panel select { width:100%;min-height:44px;max-width:100%;background:var(--g-panel)!important;color:var(--g-text)!important;font:13px 'Microsoft YaHei',sans-serif; }
body.reference-case main { height:calc(100dvh - 64px); max-width:none; margin:0; padding:20px 22px 24px; overflow:hidden; position:relative; }
body.reference-case :is(.case-heading,.ux-context,.investigation-steps,.workspace-tools,.workspace-clues,main>footer,.game-shell .board-head,.game-shell .board-instruction,.game-shell .board-count,.game-shell .connection,.game-shell .board-status) { display:none!important; }
.reference-shell { height:100%; display:grid; grid-template-columns:minmax(290px,26%) minmax(0,1fr); gap:22px; min-height:0; }
.reference-brief { position:relative; background:var(--g-panel); padding:28px 24px 32px; overflow:auto; min-width:0; color:var(--g-text); }
.reference-brief::after { content:'';position:absolute;display:block;bottom:0;left:0;right:0;height:18px;margin:0;background:var(--g-bg);clip-path:polygon(0 100%,0 55%,12% 0,25% 65%,38% 0,51% 70%,64% 5%,76% 62%,88% 0,100% 65%,100% 100%); }
.reference-brief h3 { font:700 10px/1.6 'Courier New',monospace;letter-spacing:.2em;margin:10px 0 8px; }
.reference-tables { display:flex;flex-wrap:wrap;gap:5px;margin-bottom:22px; }
body.reference-case .reference-tables button { min-height:24px;padding:3px 6px;font-size:11px;letter-spacing:0;box-shadow:none!important;border-width:1px!important; }
.reference-tables svg { width:12px;height:12px; }
.reference-tables button:first-child { background:var(--desk-accent)!important; }
.reference-checkpoint { border-top:1px dashed var(--g-rule);padding-top:20px;margin-top:12px; }
.reference-checkpoint strong { background:var(--desk-accent);padding:2px 4px;font-size:12px; }
.reference-brief .task-pane { padding:0!important; }
.reference-brief #clue-title { font:700 18px/1.5 Georgia,'SimSun',serif;margin:10px 0; }
.reference-brief .mission { font:13px/1.9 'Courier New','Microsoft YaHei',monospace;margin:10px 0 26px; }
.reference-expected { margin:26px 0; }
.reference-expected p { font-size:12px;line-height:1.8; }
.reference-expected table { border:2px solid var(--g-text);width:100%;font-size:11px; }
.reference-expected th,.reference-expected td { padding:10px;background:var(--g-panel)!important;color:var(--g-text)!important;border-color:var(--g-text); }
.reference-brief-tools { display:flex;flex-wrap:wrap;gap:10px;border-top:1px dashed var(--g-rule);padding-top:18px; }
body.reference-case .reference-brief-tools button { min-height:36px;padding:8px;font-size:10px;letter-spacing:0; }
.reference-locked { margin-top:24px; }
.reference-locked p { display:flex;gap:10px;justify-content:space-between;font-size:12px;color:var(--g-muted); }
.reference-locked p::after { content:'';display:block;flex:1;height:9px;background:var(--g-muted);align-self:center;transform:rotate(-.8deg); }
.reference-locked svg { order:3;width:14px;height:14px; }
.reference-console-stack { min-width:0;min-height:0;display:flex;flex-direction:column;gap:16px; }
.reference-result-sheet { flex:1;min-height:0;border:2px solid var(--g-text);background:var(--g-panel);box-shadow:4px 4px 0 var(--g-text);overflow:hidden; }
body.reference-case .case-window { border-radius:0!important;border:2px solid var(--g-text)!important;box-shadow:4px 4px 0 var(--g-text)!important;background:var(--g-panel)!important;color:var(--g-text); }
body.reference-case .window-titlebar { background:var(--g-panel)!important;border-bottom:1px solid var(--g-text);padding:4px 12px;min-height:42px; }
body.reference-case .window-handle { font:700 11px/1.6 'Courier New','Microsoft YaHei',monospace;letter-spacing:.18em;border:0!important;box-shadow:none!important;background:transparent!important; }
body.reference-case .window-titlebar :is(.window-close,.window-maximize) { width:30px;height:30px;min-height:30px;border:0!important;box-shadow:none!important;background:transparent!important;padding:6px; }
body.reference-case .window-view-toggle { min-height:28px;border-width:1px!important;box-shadow:none!important;font-size:10px;padding:4px 8px; }
body.reference-case .window-content { padding:0; }
body.reference-case .case-window .console { padding:18px;border-radius:0!important;background:var(--g-panel)!important;display:flex;flex-direction:column; }
body.reference-case .console > .eyebrow,body.reference-case .console > .mobile-reference,body.reference-case .console > .query-help,body.reference-case .window-clue-picker,body.reference-case .console .query-composer > label,body.reference-case .sql-completion-hint { display:none; }
.reference-query-tabs { display:flex;gap:6px;align-items:end;padding:0 12px;min-height:42px;background:var(--g-board);border-bottom:2px solid var(--g-text); }
body.reference-case .reference-query-tabs button { min-height:34px;font-size:10px;padding:8px 12px;box-shadow:none!important;border-width:1px!important;border-bottom:0!important;background:var(--g-panel)!important; }
body.reference-case .query-composer { position:static!important;display:flex;flex-direction:column;min-height:0;flex:1; }
.reference-sql-wrap { position:relative;min-height:110px;height:150px;border:2px solid var(--g-text);margin:0 0 16px;overflow:hidden; }
body.reference-case .console .reference-sql-wrap #sql { position:absolute;inset:0;resize:none;min-height:0!important;max-height:none!important;height:100%!important;width:100%;background:transparent!important;color:transparent!important;caret-color:var(--g-text);border:0;box-shadow:none;border-radius:0!important;outline-offset:2px;padding:12px 16px 12px 44px;z-index:2;font:16px/26px 'Courier New','Microsoft YaHei',monospace;white-space:pre;overflow-wrap:normal;overflow:auto; }
.reference-highlight { position:absolute;inset:0;margin:0!important;padding:12px 16px 12px 44px;font:16px/26px 'Courier New','Microsoft YaHei',monospace!important;background:transparent!important;box-shadow:none!important;color:var(--g-text)!important;white-space:pre!important;overflow:hidden;pointer-events:none;border:0!important; }
.reference-highlight mark { background:var(--desk-accent);color:var(--g-text);font-weight:700; }
.reference-highlight .sql-literal { color:var(--g-error); }
.reference-highlight .sql-comment { color:var(--g-muted); }
.reference-line-numbers { position:absolute;left:8px;top:12px;bottom:12px;width:25px;white-space:pre;font:14px/26px 'Courier New',monospace;color:var(--g-muted);z-index:1;text-align:right;overflow:hidden; }
body.reference-case .actions { margin:0;display:flex;gap:12px;justify-content:flex-end;align-items:center; }
body.reference-case .actions small { order:-1;margin-right:auto;font:10px/1.5 'Courier New',monospace;color:var(--g-muted); }
body.reference-case #run svg,body.reference-case #verify svg { width:14px;height:14px;stroke:currentColor;fill:none; }
body.reference-case :is(#run,#verify) { display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:40px;min-width:96px; }
.reference-result-heading { display:flex;align-items:center;justify-content:space-between;gap:10px; }
.reference-result-heading h2 { font:700 25px/1.2 Georgia,'SimSun',serif;margin:0 0 12px; }
.reference-result-heading span { font:10px/1.5 'Courier New',monospace;letter-spacing:.15em;color:var(--g-muted); }
body.reference-case .result-pane { position:relative;padding:18px;display:flex;flex-direction:column;min-height:0;overflow:hidden; }
body.reference-case .result-pane .results-head { display:none; }
body.reference-case .result-pane .feedback { order:4;flex:none;margin:12px 0 0;padding:8px 0;border:0;background:transparent;font:11px/1.6 'Courier New','Microsoft YaHei',monospace; }
body.reference-case .result-pane .result-toolbar { gap:5px;margin:0 0 12px;flex:none; }
body.reference-case .result-toolbar button { padding:3px 12px;min-height:24px;border-width:1px!important;box-shadow:none!important;font:700 10px/1.3 'Courier New',monospace; }
body.reference-case .result-toolbar .reference-fields { margin-left:auto; }
body.reference-case .results { border:1px solid var(--g-text);flex:1;min-height:70px;max-height:none;overflow:auto; }
body.reference-case .results table { border-collapse:collapse;width:max-content;min-width:100%;font:12px/1.5 'Courier New','Microsoft YaHei',monospace; }
body.reference-case .results :is(th,td) { padding:6px 10px;color:var(--g-text)!important;background:transparent!important;border:0;border-bottom:1px solid var(--g-rule);white-space:nowrap; }
body.reference-case .results th { border-bottom:2px solid var(--g-text);letter-spacing:.06em;font-size:11px; }
body.reference-case .results tr:nth-child(even) { background:var(--g-board); }
.reference-chart-fields { display:flex;gap:16px;flex:none;margin-bottom:12px;font:700 10px/1.6 'Courier New',monospace; }
.reference-chart-fields label { display:flex;gap:8px;align-items:center;flex:1;min-width:0; }
.reference-chart-fields select { min-width:0;flex:1;padding:3px;background:var(--g-panel)!important;color:var(--g-text)!important;border:1px solid var(--g-text);font:12px 'Courier New',monospace; }
.reference-chart { min-height:0;flex:1;overflow:auto;position:relative; }
.reference-chart svg { width:100%;min-width:450px;height:100%;min-height:180px;max-height:340px; }
.reference-chart svg text { fill:var(--g-text);font:11px 'Courier New','Microsoft YaHei',monospace; }
.chart-legend { position:absolute;left:55%;top:20%;padding:0;margin:0;list-style:none;font-size:11px;line-height:2; }
.chart-legend span { display:inline-block;width:12px;height:12px;border:1px solid var(--g-text);margin-right:8px; }
.chart-kpis { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px; }
.chart-kpis dt { font-size:11px;line-height:1.8; }
.chart-kpis dd { margin:12px 0 0;font:700 42px/1.2 Georgia,'SimSun',serif; }
.chart-message { padding:20px;font-size:13px;line-height:1.8; }
.reference-pin-actions { display:flex;gap:12px;order:5;margin-top:12px;flex:none; }
body.reference-case .reference-pin-actions #pin-query { flex:1;min-height:38px;font-size:10px; }
.reference-status { position:absolute;bottom:4px;left:24px;right:24px;margin:0;font-size:10px;color:var(--g-text);max-height:20px;overflow:hidden; }
body.reference-case .game-shell { position:absolute;inset:20px 22px 24px 22px;z-index:0; }
body.reference-case .game-shell .board { height:100%;width:calc(100% - 300px);min-height:0;margin-left:0;padding:0;border:1px solid var(--g-rule);border-radius:0!important;box-shadow:6px 6px 0 rgb(34 35 28 / 14%)!important;background:var(--g-panel)!important;overflow:auto; }
body.reference-case .route-map { width:100%;height:100%;object-fit:contain;opacity:.9;position:absolute;inset:0; }
body.reference-case .map-walls { stroke:var(--g-muted);stroke-width:2; }
body.reference-case .map-labels text { fill:var(--g-text);stroke:var(--g-panel);font-family:'Courier New','SimSun',serif;font-size:13px; }
body.reference-case .ink-trace { opacity:.8; }
body.reference-case .pin { border-radius:0!important;background:var(--g-panel)!important;border:1px solid var(--g-text)!important;box-shadow:2px 3px 0 rgb(0 0 0 / 20%)!important;font-size:11px; }
.reference-board-notes { position:absolute;bottom:36px;left:25%;width:36%;display:flex;flex-direction:column;gap:10px;z-index:3; }
.board-excerpt { padding:12px;background:var(--g-panel);border:1px solid var(--g-text);position:relative;font-size:11px; }
.board-excerpt strong,.board-excerpt code { display:block;line-height:1.6;overflow-wrap:anywhere; }
body.reference-case .board-excerpt button { position:absolute;right:4px;top:4px;padding:0;width:24px;min-height:24px;box-shadow:none!important;border:0!important; }
.board-excerpt code { max-width:85%; }
body.reference-case[data-reference-view=map] .reference-shell { display:block;position:relative;z-index:2;width:300px; }
body.reference-case[data-reference-view=map] .reference-brief { height:100%;box-shadow:5px 6px 0 rgb(34 35 28 / 15%); }
body.reference-case[data-reference-view=map] .reference-console-stack { display:none; }
body.reference-case[data-reference-view=map] #window-query { overflow:hidden;display:flex;resize:both;min-height:360px; }
body.reference-case[data-reference-view=map] #window-query[hidden] { display:none; }
.reference-tape { position:fixed;width:82px;height:27px;background:rgb(186 179 143 / 65%);transform:rotate(-34deg);z-index:31;pointer-events:none; }
body.reference-case[data-reference-view=map] #window-query .window-content { display:flex;flex-direction:column;overflow:hidden; }
body.reference-case[data-reference-view=map] #window-query .console { flex:none;padding:16px 18px 8px; }
body.reference-case[data-reference-view=map] #window-query .result-pane { flex:1;height:auto; }
body.reference-case[data-reference-view=map] .reference-query-tabs { display:none; }
body.reference-case[data-reference-view=console] .game-shell { display:none; }
body.reference-case[data-reference-view=console] #window-query { position:relative!important;inset:auto!important;width:100%!important;height:clamp(280px,37vh,380px)!important;max-width:none!important;max-height:none!important;flex:none;resize:none;min-width:0;min-height:0; }
body.reference-case[data-reference-view=console] #window-query .window-titlebar { display:none; }
body.reference-case[data-reference-view=console] #window-query .window-content { display:flex;flex-direction:column; }
body.reference-case[data-reference-view=console] #window-query .console { flex:1;min-height:0; }
body.reference-case[data-reference-view=console] .reference-sql-wrap { border:0;flex:1;min-height:90px;margin-bottom:10px; }
body.reference-case[data-reference-view=console] #run { background:var(--g-panel)!important; }
body.reference-case[data-reference-view=console] .reference-result-sheet .result-pane { height:100%; }
body.reference-case[data-reference-view=console] .reference-result-heading { margin:-18px -18px 12px;padding:8px 12px;border-bottom:1px solid var(--g-text);background:var(--g-board); }
body.reference-case[data-reference-view=console] .reference-result-heading h2 { font:700 11px/1.5 'Courier New',monospace;letter-spacing:.15em;margin:0; }
body.reference-case .duel-meter { position:absolute;z-index:15;left:24px;right:24px;bottom:28px;max-height:120px;overflow:auto;background:var(--g-panel);border:1px solid var(--g-text);font-size:11px; }
body.reference-case .duel-meter:not([hidden]) { top:14px;bottom:auto;max-height:82px; }
body.reference-case main:has(.duel-meter:not([hidden])) { padding-top:104px; }
body.reference-case main:has(.duel-meter:not([hidden])) .game-shell { top:104px; }
body.reference-case .duel-meter #opponent-progress { max-height:52px; }
body.reference-case.reading-story #case-ranking { display:none; }
body.reference-case #case-ranking { position:fixed;z-index:34;right:24px;bottom:24px;background:var(--g-panel);border:2px solid var(--g-text);max-height:240px;overflow:auto;padding:12px;width:min(330px,calc(100vw - 48px)); }
body.reference-case #window-story { border:0!important;box-shadow:5px 5px 0 rgb(34 35 28 / 20%)!important; }
body.reference-case #window-story .window-titlebar { border-bottom:1px solid var(--g-text); }
body.reference-case .character-portrait { border-radius:0!important; }
body.reference-case #dialogue-next { background:var(--desk-accent)!important;min-height:42px; }
body.reference-case .query-return { z-index:30;background:var(--desk-accent)!important;border:2px solid var(--g-text);border-radius:0!important;box-shadow:3px 3px 0 var(--g-text);font-size:11px; }
body.reference-case:has(#window-query:not([hidden])) .query-return { display:none!important; }
@media(max-width:1100px){body.reference-case .topbar { gap:8px;padding-inline:12px; }.reference-tool { padding-inline:8px!important; }.reference-shell { grid-template-columns:250px minmax(0,1fr);gap:16px; }.reference-brief { padding:20px 16px; }body.reference-case .topbar h1 { font-size:20px; }.reference-checkpoints { gap:4px; }body.reference-case .topbar > #progress { display:none; }}
@media(max-width:760px){
 html[data-game-theme] body.reference-case { height:auto;min-height:100dvh;overflow:auto; }
 body.reference-case .topbar { height:auto;min-height:88px;flex-wrap:wrap;padding:10px 12px;gap:10px; }
 body.reference-case .topbar h1 { flex:1 1 100%;max-width:none;font-size:22px;margin:0; }
 body.reference-case .topbar > #progress { display:block;margin-left:auto; }
 body.reference-case .reference-checkpoints { flex-basis:calc(100% - 55px); }
 body.reference-case .topbar .reference-tool { min-height:32px;font-size:9px;padding:6px!important; }
 .reference-settings summary { width:32px;height:32px; }
 body.reference-case main { height:auto;min-height:calc(100dvh - 110px);padding:14px 12px 40px;overflow:visible; }
 .reference-shell { display:flex;flex-direction:column;gap:16px;height:auto; }
 .reference-brief { padding:18px;max-height:320px;flex:none;overflow:auto; }
 .reference-console-stack { min-height:680px; }
 body.reference-case[data-reference-view=console] #window-query { height:290px!important;position:sticky!important;top:12px!important;z-index:12; }
 .reference-result-sheet { min-height:360px;height:360px; }
 body.reference-case[data-reference-view=map] .reference-shell { width:auto; }
 body.reference-case[data-reference-view=map] .reference-brief { max-height:210px;height:auto; }
 body.reference-case .game-shell { position:relative;inset:auto;height:550px; }
 body.reference-case .game-shell .board { width:100%;height:100%;margin-top:16px; }
 body.reference-case[data-reference-view=map] #window-query { min-height:240px;max-height:calc(100dvh - 24px);overflow:hidden; }
 .reference-tape { display:none; }
 body.reference-case .reference-highlight,body.reference-case .console .reference-sql-wrap #sql { font-size:14px!important;line-height:24px!important; }
 .reference-line-numbers { font-size:12px;line-height:24px; }
 .reference-chart svg { min-width:360px; }
 .chart-kpis { grid-template-columns:1fr;gap:12px; }.chart-kpis dd { font-size:30px;margin-top:4px; }
 body.reference-case .duel-meter { position:relative;left:auto;right:auto;bottom:auto;max-height:170px; }
 body.reference-case .duel-meter:not([hidden]) { top:auto;max-height:120px; }
 body.reference-case main:has(.duel-meter:not([hidden])) { padding-top:14px; }
 .reference-status { bottom:6px;left:12px;right:12px; }
}
/* Selected theme controls contrast independently of the surrounding surface. */
html[data-game-theme=office],html[data-game-theme=comic],html[data-game-theme=paper] { --desk-on-accent:#ffffff; }
html[data-game-theme=charcoal],html[data-game-theme=navy],html[data-game-theme=archive] { --desk-on-accent:#17191e; }
body.reference-case .reference-tool[aria-pressed=true],body.reference-case #run,body.reference-case #verify:not(:disabled),body.reference-case .reference-query-tab[aria-selected=true],body.reference-case .result-toolbar button[aria-pressed=true],body.reference-case .reference-tables button:first-child,body.reference-case #dialogue-next,body.reference-case .query-return,body.reference-case .reference-checkpoints button.complete { color:var(--desk-on-accent)!important; }
body.reference-case[data-reference-view=console] #run { color:var(--g-text)!important; }
.reference-highlight mark,.reference-checkpoint strong { color:var(--desk-on-accent); }
body.reference-case .reference-help { color:var(--g-text)!important; }
body.reference-case .reference-settings summary { background:var(--g-panel);color:var(--g-text); }
body.reference-case .reference-tape { background:color-mix(in srgb,var(--g-accent) 25%,transparent); }
body.reference-case .reference-line-numbers,body.reference-case .chart-message { color:var(--g-muted); }
body.reference-case .reference-highlight .sql-literal { color:var(--g-error); }
body.reference-case .dialogue-sheet-paper { background:var(--g-panel); }
