/* Development-only user interface. Loaded for all, displayed only for ?debug=1. */
.debug-overlay{z-index:108;background:#071d31}
.debug-overlay .overlay-top{padding:10px 13px;background:#123d5f;flex-shrink:0}
.debug-overlay .overlay-top h2{font-size:clamp(18px,4.8vw,25px);line-height:1.25}
.debug-overlay .overlay-kicker{font-size:10px;letter-spacing:.045em;color:#aedff6}
.debug-overlay .debug-body{min-height:0;padding:0 13px calc(28px + env(safe-area-inset-bottom,0px));overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;background:#082740;color:#fff;font:600 14px/1.5 system-ui,-apple-system,sans-serif}
.debug-controls{position:sticky;top:0;z-index:4;background:#082740;padding:12px 0 10px;border-bottom:2px solid #277a9e;box-shadow:0 10px 15px #082740ec}
.debug-note{font-size:12px;color:#deeff9;line-height:1.55;margin:0 0 8px;max-width:65ch}
.debug-current{font-size:11px;color:#b9edff;line-height:1.5;margin-bottom:10px;overflow-wrap:anywhere}
.debug-search-row{display:flex;gap:8px;align-items:stretch;width:100%}
.debug-search-row input{flex:1;min-width:0;width:100%;min-height:46px;padding:10px 12px;border:2px solid #67bee4;border-radius:6px;background:#f1fbff;color:#123550;font:700 15px/1.35 system-ui,-apple-system,sans-serif;outline-offset:2px}
.debug-search-row input::placeholder{color:#456a80;opacity:1}
.debug-clear{flex:none;padding:0 12px;min-height:46px;border:1px solid #8acee5;border-radius:6px;background:#1b5170;color:#f6fdff;font:800 13px system-ui,-apple-system,sans-serif}
.debug-match-count{color:#c7edff;font-size:12px;margin:9px 0 0;font-variant-numeric:tabular-nums}
.debug-body .debug-section{padding:0;border:1px solid #376986;border-radius:6px;margin:12px 0 0;background:#0c304d;overflow:hidden}
.debug-section-summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:10px;min-height:53px;padding:12px 12px;background:#164363;color:#f4fcff;font:900 clamp(14px,3.7vw,17px)/1.35 system-ui,-apple-system,sans-serif}
.debug-section-summary::-webkit-details-marker{display:none}
.debug-section-summary::before{content:'▸';color:#9fe5ff;font-size:20px;transition:transform .15s ease}
.debug-section[open]>.debug-section-summary::before{transform:rotate(90deg)}
.debug-section-name{flex:1;min-width:0;overflow-wrap:anywhere}
.debug-section-count{flex:none;border:1px solid #7ecce9;border-radius:40px;padding:2px 7px;background:#092942;color:#bfeaff;font:800 11px system-ui,-apple-system,sans-serif}
.debug-item-list{padding:5px 8px 9px;display:flex;flex-direction:column;gap:6px}
.debug-entry{display:flex;flex-direction:column;gap:6px;align-items:stretch;width:100%;min-width:0;min-height:51px;text-align:left;border-radius:5px;border:1px solid #37799d;background:#103b59;color:#fff;padding:10px 11px;font:700 13px/1.45 system-ui,-apple-system,sans-serif}
.debug-entry:active{background:#1a6485}
.debug-entry:focus-visible,.debug-section-summary:focus-visible,.debug-clear:focus-visible{outline:3px solid #ffe18e;outline-offset:2px}
.debug-entry-label{display:block;min-width:0;overflow-wrap:anywhere;word-break:normal}
.debug-entry-action{align-self:flex-end;color:#092940;background:#c6eeff;border-radius:4px;padding:3px 10px;font:900 12px system-ui,-apple-system,sans-serif}
.debug-body .debug-entry[hidden],.debug-body .debug-section[hidden]{display:none!important}
#zoomPanel{z-index:121} /* thumbnails opened from debug stay atop its list */
#archivePanel{z-index:61}
#debugPanel .close-btn{min-width:46px;min-height:46px}
@media(max-width:360px){.debug-overlay .debug-body{padding-inline:8px}.debug-section-summary{padding-inline:8px}.debug-entry{padding:9px}.debug-overlay .overlay-top{padding-inline:9px}}
@media(prefers-reduced-motion:reduce){.debug-section-summary::before{transition:none}}
/* Keep the developer launcher reachable from END and inspect modals without touching normal-mode UI. */
.app > .debug-trigger:not([hidden]){z-index:115}
/* Single, predictable scroll surface for long confirmation memos on short phones.
   Avoid nested scrolling that hides the last line behind the continuation button. */
.evidence-card{overflow-y:auto;overflow-x:hidden;max-height:calc(100dvh - 26px);overscroll-behavior:contain}
.evidence-card .record-summary{max-height:none!important;overflow:visible!important;flex-shrink:0}
.evidence-card #evidenceNext{position:sticky;bottom:0;z-index:2;box-shadow:0 -6px 12px #0a2d49b8}
/* Correct a short-screen legacy grid rule: the portrait was painting over the name. */
.wanted-detail-overlay .wanted-detail-body{display:flex!important;flex-direction:column;align-items:stretch;gap:7px;overflow-y:auto!important;min-height:0}
.wanted-detail-overlay .wanted-detail-body > *{grid-area:auto!important;flex-shrink:0}
.wanted-detail-overlay .wanted-detail-portrait{align-self:center;width:min(100%,190px);max-height:none!important;min-height:0!important;overflow:hidden}
.wanted-detail-overlay .wanted-detail-portrait canvas{width:100%;height:auto;max-height:min(29dvh,225px);object-fit:contain}
.wanted-detail-overlay .wanted-detail-name{font-size:clamp(22px,6vw,28px);line-height:1.25}
.wanted-detail-overlay .wanted-detail-body .primary-btn{position:sticky;bottom:0;min-height:52px;z-index:2}
@media(max-height:700px){.wanted-detail-overlay .wanted-detail-portrait{width:min(100%,150px)}.wanted-detail-overlay .wanted-detail-portrait canvas{max-height:min(23dvh,170px)}}
/* Don't obscure the official poster heading with a developer-only button. */
body:has(#wantedDetailPanel:not([hidden])) .app > .debug-trigger{display:none}

/* Ultra-short phones: keep the charge line readable above the poster's action. */
@media(max-width:365px) and (max-height:640px){
 .wanted-detail-overlay .wanted-detail-body{gap:4px;padding-top:6px;padding-bottom:8px}
 .wanted-detail-overlay .wanted-detail-seal{font-size:12px;padding:4px 6px;letter-spacing:.07em}
 .wanted-detail-overlay .wanted-detail-portrait{width:min(100%,108px)}
 .wanted-detail-overlay .wanted-detail-portrait canvas{max-height:118px}
 .wanted-detail-overlay .wanted-detail-name{font-size:21px;padding-bottom:3px}
 .wanted-detail-overlay .wanted-detail-warning{font-size:13px;padding:5px 8px}
 .wanted-detail-overlay .wanted-detail-hint,.wanted-detail-overlay .wanted-detail-crime{font-size:14px;line-height:1.35}
 .wanted-detail-overlay .wanted-detail-body .primary-btn{min-height:44px}
}
/* Narrow phones with a medium-height viewport need a little more poster clearance. */
@media(min-width:366px) and (max-width:390px) and (max-height:700px){
 .wanted-detail-overlay .wanted-detail-portrait{width:min(100%,130px)}
}
/* Very short viewports retain the same poster layout, without covering the charge text. */
@media(max-width:390px) and (max-height:600px){
 .wanted-detail-overlay .wanted-detail-body{gap:2px;padding-top:4px;padding-bottom:5px}
 .wanted-detail-overlay .wanted-detail-seal{font-size:11px;padding:3px 5px}
 .wanted-detail-overlay .wanted-detail-index{padding-bottom:3px}
 .wanted-detail-overlay .wanted-detail-portrait{width:min(100%,90px)}
 .wanted-detail-overlay .wanted-detail-portrait canvas{max-height:100px}
 .wanted-detail-overlay .wanted-detail-name{font-size:20px;padding-bottom:3px}
 .wanted-detail-overlay .wanted-detail-warning{padding:4px 6px;font-size:13px;line-height:1.3}
 .wanted-detail-overlay .wanted-detail-hint,.wanted-detail-overlay .wanted-detail-crime{font-size:13px;line-height:1.3}
 .wanted-detail-overlay .wanted-detail-body .primary-btn{min-height:42px;padding:6px}
}
@media(min-width:391px) and (max-height:800px){
 .wanted-detail-overlay .wanted-detail-portrait{width:min(100%,170px)}
}

/* Focused improvements: no changes to the base palette or scene composition. */
.wanted-detail-hint{border-left:3px solid #3b6d85;padding-left:8px;background:#eaf3f31a}
.inspect-extra-actions{display:flex;flex-wrap:wrap;gap:3px 9px;align-items:center;justify-content:center;margin:-5px 0}
.inspect-extra-actions .text-btn{min-height:44px;padding:3px 7px;color:#e2dfcd;text-decoration:underline;font-size:12px}
.inspect-extra-actions [hidden]{display:none!important}
.record-lead{font-size:clamp(14px,3.9vw,18px);font-weight:900;line-height:1.45;padding:8px 10px;border-left:4px solid #287da5;background:#eaf4fa;color:#143f57;margin:4px 0 8px}
.archive-item span{overflow-wrap:anywhere;white-space:normal;line-height:1.35}
.archive-grid.evidence-grid .archive-item span{min-height:48px}
.archive-setting{border-top:1px solid #496477;padding:13px 6px;color:#dbeaf1;font:700 13px/1.6 system-ui,-apple-system,sans-serif}
.archive-setting label{display:flex;align-items:center;gap:9px}
.archive-setting input{width:20px;height:20px;accent-color:#78bfe3;flex:none}
@media(max-height:555px){.panel-overlay{overflow-y:auto;align-items:flex-start}.panel-overlay .modal-card{max-height:none;margin:auto 0;overflow:visible}.compare-card .compare-box canvas{max-height:95px}.compare-card{gap:5px}.panel-overlay .primary-btn,.panel-overlay .secondary-btn{min-height:44px}}
@media(max-width:365px){.inspect-extra-actions .text-btn{font-size:11px}.archive-item span{font-size:clamp(12px,3.7vw,17px)}}
@media(prefers-reduced-motion:reduce){.inspect-extra-actions *{transition:none}}
/* Contrast audit: global modal paragraph colors must never override the pale record lead. */
.evidence-card .record-summary p.record-lead{color:#143f57;background:#eaf4fa;font-weight:900}
