body.investigating header {
  height: auto;
  min-height: 60px;
  background: #fffdf5;
}
body.investigating header nav { flex-wrap: wrap; }
header #caseCards { font-weight: 700; }
header #caseCards[aria-expanded="true"] { background: #f5ce39; }
header button { min-height: 44px; }
header button[hidden], .case-presentation[hidden] { display: none; }
body.investigating .map-top { top: var(--map-controls-top, 92px); }
body.investigating .dossier {
  top: var(--case-top, 155px);
  bottom: auto;
  right: 78px;
  left: auto;
  width: min(420px, 38vw);
  max-height: calc(100dvh - var(--case-top, 155px) - 24px);
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  background: #fffdf5;
  box-shadow: 0 5px 20px #23231f30;
}
.case-panel-heading {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  flex: none;
  padding: 14px 18px;
  border-bottom: 1px solid #d5d0c0;
}
.case-panel-heading > div { min-width: 0; }
.case-panel-name { display: block; font-weight: 700; font-size: 15px; overflow-wrap: anywhere; }
.case-step { display: block; margin-top: 4px; color: #555348; font-size: 12px; line-height: 1.5; }
#caseSize { min-height: 44px; flex: none; padding: 8px 12px; box-shadow: none; }
.case-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 18px;
  scrollbar-gutter: stable;
  overflow-wrap: anywhere;
}
.case-body:focus-visible { outline: 3px solid #387f9a; outline-offset: -3px; }
.case-body h2:first-child { margin-top: 0; }
.case-body .small { color: #555348; }
.case-body .text, .case-body .discovery { font-size: 16px; line-height: 1.55; }
.case-body .text p:last-child { margin-bottom: 0; }
.case-actions { flex: none; padding: 12px 18px 16px; border-top: 1px solid #d5d0c0; display: flex; gap: 8px; flex-wrap: wrap; }
.case-actions:empty { display: none; }
body.investigating .case-actions button { min-height: 44px; flex: 1; margin: 0; }
body.investigating .case-actions .primary { width: 100%; }
body.investigating .dossier.compact { width: min(360px, 34vw); }
.compact .case-panel-heading { padding: 10px 14px; }
.compact .case-body { padding: 14px; }
.compact .dossier-art, .compact .case-wording:has(.dossier-art) > h2 { display: none; }
.compact .case-actions { padding: 10px 14px 12px; }
body.investigating .compact h2 { font-size: 20px; line-height: 1.35; }
.card-history button, .case-body .view { min-width: 44px; min-height: 44px; }
body.investigating .map-bottom { bottom: 18px; }
body.investigating .tools button, body.investigating .zoom button { min-width: 44px; min-height: 44px; }
@media (max-width: 1050px) {
  body.investigating header { flex-wrap: wrap; gap: 8px; }
  body.investigating #connection { display: none; }
  body.investigating header nav { flex: 1; justify-content: flex-end; }
  body.investigating .wordmark { font-size: 20px; }
  body.investigating .dossier { width: 350px; right: 70px; }
  body.investigating .dossier.compact { width: 320px; }
}
@media (max-width: 800px) {
  body.investigating header { min-height: 0; padding: 8px; }
  body.investigating .wordmark { display: none; }
  body.investigating header nav { gap: 4px; justify-content: center; }
  body.investigating header:has(.ta-audio-controls) #soundButton { display: none; }
  body.investigating #helpButton { min-width: 44px; }
  body.investigating header .ta-audio-controls { justify-content: center; }
  body.investigating .dossier, body.investigating .dossier.compact {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-height: min(47dvh, calc(100dvh - var(--case-top, 170px) - 60px));
  }
  body.investigating .dossier.compact { max-height: min(32dvh, calc(100dvh - var(--case-top, 170px) - 60px)); }
  .case-panel-heading { padding: 10px 14px; }
  .case-panel-name { font-size: 14px; }
  .case-body { padding: 14px; }
  body.investigating .dossier .text, .case-body .discovery { font-size: 15px; }
  body.investigating .dossier h2 { font-size: 19px; line-height: 1.35; }
  body.investigating .dossier .case-pictures { max-height: none; }
  body.investigating .dossier .case-pictures img { max-height: 80px !important; }
  .case-actions { padding: 10px 14px; }
  body.investigating .map-bottom { top: var(--map-controls-top, 140px); bottom: auto; right: 72px; left: auto; }
}
@media (max-height: 540px) and (min-width: 650px) {
  body.investigating .dossier, body.investigating .dossier.compact { top: var(--map-controls-top, 90px); bottom: 10px; left: auto; right: 70px; width: min(350px, 42vw); max-height: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .case-presentation { animation: case-open 160ms ease-out; }
  @keyframes case-open { from { opacity: .6; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
}
