/* Keep readable content and focus rings inside the detective desk. */
.case-page .board { overflow: clip; }
.case-page :is(.board-head > div:first-child, .case-heading > div:first-child,
  .actions, .topbar nav, .connection) { min-width: 0; }
.case-page :is(h1, h2, p, .feedback, .connection strong, .clue, .pin strong) {
  overflow-wrap: anywhere;
}
.case-page .board-head { flex-wrap: wrap; }
.case-page .board-head > div:first-child { flex: 1 1 160px; }
.case-page .pin[data-clue="0"] { left: 4%; }
.case-page .pin[data-clue="1"] { right: 4%; }
.case-page .console textarea { max-width: 100%; min-width: 0; }
.case-page .results { max-width: 100%; }
.case-page .console::before { position: static; display: block; margin-bottom: 5px; }
/* Three previews use the available width, rather than cropping a fixed desktop. */
.preview iframe { width: calc(100% / .305); }
body :is(.form-row label, .player, .toolbar > *, .theme-actions > *) { min-width: 0; }
body :is(.feedback, .player, .duel-meter, .intro, pre) { overflow-wrap: anywhere; }
.invite-url, .sql-editor { max-width: 100%; }
@supports (padding: max(0px)) {
  body > header {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
  body > main {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(28px, env(safe-area-inset-bottom));
  }
}
@media(max-width:650px) {
  .case-page .board { padding-inline: 18px; }
  .case-page .pin { width: 28%; }
  .case-page .case-heading { flex-wrap: wrap; }
  .case-page .case-progress { text-align: left; }
}
.investigation-steps { display:flex; flex-wrap:wrap; gap:8px; margin:0 0 16px; }
.investigation-steps a { padding:8px 12px; border:1px solid currentColor; border-radius:10px; text-decoration:none; font-size:12px; }
.data-guide > h2 { font-size:20px; margin:0 0 8px; }
.data-guide > p { font-size:12px; line-height:1.7; margin-bottom:12px; }
.schema details, .mobile-reference details { margin:10px 0; padding:10px; border:1px solid currentColor; border-radius:10px; }
[data-guide-table] summary { cursor:pointer; }
[data-guide-table] summary strong { display:block; font-size:14px; }
.table-purpose { display:block; font-size:11px; margin-top:6px; }
[data-guide-table].current-table { border-width:2px; }
[data-guide-table] dl { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.3fr); gap:6px 10px; margin:12px 0 0; }
[data-guide-table] dt { font:12px Consolas,monospace; overflow-wrap:anywhere; }
[data-guide-table] dd { margin:0; font-size:12px; overflow-wrap:anywhere; }
.query-help { margin-top:14px; font-size:12px; }
.query-help summary { cursor:pointer; padding-block:8px; font-weight:700; }
.query-help p { margin:8px 0; }
.query-help button { padding:8px 12px; min-height:44px; }
/* Keep investigation and repeated queries within reach without moving the page. */
.case-page #sql { scroll-margin-block:24px; }
.case-page .query-return { display:none; }
.case-page .results { max-height:260px; overflow:auto; scrollbar-gutter:stable; }
@media(min-width:831px) and (min-height:601px) {
  .case-page .console { position:sticky; top:12px; max-height:calc(100dvh - 24px); min-height:0; overflow:auto; scrollbar-gutter:stable; }
  .case-page .query-composer { position:sticky; top:0; z-index:4; padding:1px 3px 10px; background:var(--g-panel, #292b28); }
  .case-page .console textarea { min-height:110px; max-height:180px; }
}
@media(max-width:830px), (max-height:600px) {
  .case-page .query-return { display:flex; position:fixed; z-index:10; bottom:max(12px, env(safe-area-inset-bottom)); right:max(16px, env(safe-area-inset-right)); align-items:center; min-height:44px; padding:10px 16px; border:1px solid var(--g-rule, #95825c); border-radius:10px; background:var(--g-panel, #292b28); color:var(--g-text, #e9e1ce); text-decoration:none; box-shadow:0 6px 20px rgb(0 0 0 / 5%); }
  .case-page main { padding-bottom:84px; }
}
