/* Carbon-copy paperwork and live label pieces are native UI, not flattened text images. */
#case-stage .case-crate {
  background: transparent !important;
  border: 0 !important;
  border-radius: 5px;
  padding: 0;
  min-height: 0;
  box-shadow: none;
  color: inherit;
  cursor: default;
  transition: transform .2s ease, filter .2s ease;
}
.case-crate > img, .case-crate-label, .case-crate-id { pointer-events: none; }
#case-stage .case-crate:disabled { opacity: 1; }
.case-stage[data-investigation="active"] .case-crate { cursor: pointer; }
.case-stage[data-investigation="active"] .case-crate:hover { transform: translateY(-3px); }
.case-stage[data-investigation="active"] .case-crate[aria-pressed="true"] {
  outline: 2px dashed #365776;
  outline-offset: 3px;
  transform: translateY(-3px) scale(1.04);
}
.case-stage[data-investigation="active"] .case-crate:focus-visible { outline: 3px solid #a44826; outline-offset: 4px; }
.case-crate-id {
  display: none;
  position: absolute;
  left: 50%;
  bottom: -1.2rem;
  transform: translateX(-50%);
  padding: .05rem .3rem;
  border-radius: 4px;
  color: #354d64;
  background: #fff8e6ed;
  font: 700 .65rem/1.3 system-ui, sans-serif;
  white-space: nowrap;
}
.case-stage[data-investigation="active"] .case-crate-id { display: block; }
.case-crate[data-solved="true"] .case-crate-label { color: #28583c; }
body[data-case-investigating="true"] :is(#case-play, #case-skip, #case-status, #case-progress) { display: none; }
body[data-case-investigating="true"] .case-playback-controls { margin: .5rem 0; }
body[data-case-investigating="true"] #case-sidebar > .case-eyebrow { display: none; }
body[data-case-investigating="true"] #case-title { font-size: 1.15rem; }
body[data-case-investigating="true"] .case-investigation { margin-top: .8rem; padding-top: .8rem; }
.case-investigation > h3 { font-size: 1.05rem; line-height: 1.3; }
.case-sidebar .case-investigation-progress { font: 700 .8rem/1.4 system-ui, sans-serif; color: #315b42; margin: .5rem 0; }
.case-investigation #case-choose-crate { font-size: .95rem; }
#case-selected-heading { font-size: 1rem; line-height: 1.4; margin: 1rem 0 .6rem; }
.case-docket { color: #3e4f78; font: .8rem/1.5 'Courier New', ui-monospace, monospace; margin: .7rem 0 1.3rem; }
.case-docket-sheet {
  position: relative;
  padding: .8rem .65rem .6rem 1.05rem;
  border: 1px solid #adbec8;
  background-color: #e7eff2;
  background-image: repeating-linear-gradient(0deg, #ffffff10 0 1px, #a8bac30a 1px 3px),
    radial-gradient(ellipse at 20% 25%, #ffffff52, transparent 70%);
  overflow-wrap: anywhere;
}
.case-docket-sheet::before {
  content: '';
  position: absolute;
  left: 3px; top: 5px; bottom: 5px; width: 7px;
  background: radial-gradient(circle, #fff9eb 0 2px, #9db0bd 2.1px 2.7px, transparent 2.9px) 0 0 / 7px 18px repeat-y;
}
.case-docket-front { box-shadow: 2px 2px 0 #d7e3e8, 4px 4px 0 #c7d7df; }
.case-docket-heading { display: flex; justify-content: space-between; align-items: start; gap: .5rem; padding-bottom: .6rem; border-bottom: 1px dashed #8da4b9; font-size: .65rem; letter-spacing: .03em; font-weight: bold; }
.case-docket-heading > span:last-child { white-space: nowrap; }
.case-record h5 { font: 700 .77rem/1.4 'Courier New', monospace; letter-spacing: .06em; margin: .75rem 0; text-decoration: underline; text-underline-offset: .2em; }
.case-record dl { margin: 0; }
.case-record dl > div { margin: 0 0 .65rem; }
.case-record dt { text-transform: uppercase; font-size: .62rem; letter-spacing: .03em; }
.case-record dd { margin: .12rem 0 0; font-weight: bold; font-size: .83rem; }
.case-record ul { margin: .6rem 0; padding-left: 1rem; }
.case-record li { margin-bottom: .45rem; }
.case-sidebar .case-carbon-footer { font: .52rem/1.5 'Courier New', monospace; letter-spacing: .03em; padding-top: .5rem; border-top: 1px dotted #9aafbc; margin: .8rem 0 0; }
.case-fold-edge { height: 10px; border: 1px solid #aebfc9; border-top: 0; background: linear-gradient(#bacbd5, #e4edf1 40%, #d2dfe6); margin-right: -3px; }
#case-sidebar .case-unfold {
  width: 100%; padding: .5rem .25rem; min-height: 44px;
  background: #dce7ee !important; color: #3e4f78 !important; border: 1px dashed #8da4b9 !important;
  border-radius: 0 0 4px 4px; font: 700 .75rem/1.4 'Courier New', monospace; box-shadow: none;
}
#case-sidebar .case-unfold:disabled { cursor: default; opacity: .8; }
.case-docket-back { border-top: 1px dashed #8da4b9; box-shadow: 2px 3px 0 #cbdbe3; animation: case-paper-unfold .25s ease-out; }
.case-docket-back .case-record h5 { margin-top: .2rem; }
@keyframes case-paper-unfold { from { opacity: .4; transform: translateY(-7px); } to { opacity: 1; transform: translateY(0); } }
.case-sidebar .case-roman-help { background: transparent; padding: .4rem 0 0; border-radius: 0; border-top: 1px dotted #a3b7c6; margin: .5rem 0 0; padding-top: .4rem; }
.case-sidebar .case-roman-help summary { color: #3e4f78; font: .7rem/1.4 'Courier New', monospace; min-height: 32px; }
.case-sidebar .case-roman-help p { color: #3e4f78; font: .8rem/1.4 'Courier New', monospace; margin: .3rem 0; }
.case-label-workbench h4 { font-size: 1rem; margin: 1rem 0 .45rem; }
.case-label-workbench .case-label-help { font: .75rem/1.45 system-ui, sans-serif; margin: .4rem 0 .65rem; }
.case-repair-label { position: relative; width: 100%; max-width: 100%; min-height: 96px; aspect-ratio: 2.8; transform: rotate(-.4deg); }
.case-repair-label > svg { position: absolute; width: 100%; height: 100%; inset: 0; filter: drop-shadow(0 2px 2px #6b4d2825); }
.case-label-slots { position: absolute; inset: 22% 10%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
#case-label-workbench .case-label-slot {
  min-width: 0; min-height: 44px; width: 100%; padding: 0;
  background: #fff9e622 !important; color: #334a70 !important; border: 1px dashed #9a886670 !important;
  border-radius: 4px; box-shadow: none; font: 700 clamp(1.6rem, 3vw, 2.1rem)/1 Georgia, serif;
  touch-action: none; user-select: none;
}
#case-label-workbench .case-label-slot[data-filled="true"] { border-color: transparent !important; background: transparent !important; cursor: grab; }
#case-label-workbench .case-label-slot[aria-pressed="true"] { outline: 2px solid #5a76a2; background: #e2eaf25c !important; }
#case-label-workbench .case-label-slot:disabled { opacity: 1; cursor: default; }
.case-repair-label[data-solved="true"] { filter: drop-shadow(0 1px 4px #3c78402b); }
.case-label-workbench .case-tray-heading { margin: .8rem 0 .35rem; font: 700 .75rem/1.4 system-ui, sans-serif; }
.case-digit-tray { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; padding: 7px; border: 1px solid #b4a68a; border-radius: 7px; background: #d9c9a74a; }
#case-label-workbench .case-digit-tile {
  width: 100%; min-width: 0; min-height: 44px; padding: .2rem 0;
  background: #fff3d5 !important; color: #344e77 !important; border: 1px solid #b9a17a !important;
  box-shadow: 0 2px 0 #ad9670; border-radius: 4px; font: 700 1.4rem/1 Georgia, serif;
  touch-action: none; user-select: none; cursor: grab;
}
#case-label-workbench .case-digit-tile[data-used="true"] { opacity: .22; cursor: default !important; box-shadow: none !important; }
#case-label-workbench .case-digit-tile[aria-pressed="true"] { outline: 2px solid #48638a; outline-offset: 1px; background: #dbe6ee !important; }
#case-label-workbench .case-return-tile { width: 100%; font-size: .7rem; padding: .35rem .2rem; margin-top: .4rem; min-height: 36px; }
.case-return-tile:disabled { opacity: .45; cursor: default; }
.case-label-actions { display: grid; grid-template-columns: 1.2fr 1fr; gap: .4rem; margin-top: .65rem; }
.case-label-actions button { font-size: .78rem; padding: .4rem .15rem; min-width: 0; }
.case-label-actions button:disabled { opacity: .65; cursor: default; }
.case-label-workbench .case-label-feedback { font: .8rem/1.5 system-ui, sans-serif; min-height: 4.5em; margin: .7rem 0; }
.case-label-feedback[data-kind="success"] { color: #285f3c !important; }
.case-label-feedback[data-kind="try-again"] { color: #813e2d !important; }
.case-reset-investigation { width: 100%; margin: .9rem 0 .2rem; font-size: .73rem; padding: .4rem .2rem; }
.case-reset-investigation:disabled { opacity: .45; cursor: default; }
.case-tile-ghost { position: fixed; z-index: 20000; transform: translate(-50%, -50%) rotate(-4deg); pointer-events: none; width: 48px; height: 52px; display: grid; place-items: center; border: 1px solid #8c7754; border-radius: 5px; background: #fff1ce; color: #344e77; box-shadow: 0 5px 14px #2b241a45; font: 700 2rem/1 Georgia, serif; }
.case-dragging { user-select: none; cursor: grabbing; }
.case-resolution { padding: .8rem; border: 1px solid #809b77; background: #f0f3e4; border-radius: 8px; margin: .7rem 0 1rem; }
.case-resolution h4 { font-size: 1.1rem; margin: .6rem 0; }
.case-sidebar .case-resolution p { font-size: .83rem; line-height: 1.5; }
.case-sidebar .case-solved-stamp { font: 800 .82rem/1.4 'Courier New', monospace; letter-spacing: .13em; color: #315e3b !important; transform: rotate(-3deg); margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .case-crate, .case-docket-back { animation: none; transition: none; }
}

/* The central bottom bar is the work surface; the sidebar holds the evidence. */
body[data-place="zero-square"] .scene-title h1 {
  font-size: clamp(1.5rem, 2vw, 1.95rem) !important;
  white-space: nowrap;
}
.case-label-workbench {
  position: absolute;
  z-index: 5;
  left: 3%; right: 3%; bottom: 2%;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: .5rem 1rem;
  padding: .8rem 1rem;
  border: 1px solid #b6a383;
  border-radius: 12px;
  background: #fff9e9f2;
  color: #493c2a;
  box-shadow: 0 3px 16px #35251220;
}
.case-workbench-heading { grid-column: 1 / -1; display: flex; align-items: baseline; gap: .8rem; }
.case-workbench-heading h4 { flex: 0 0 auto; margin: 0; font-size: 1.05rem; }
.case-workbench-heading .case-label-help { margin: 0; font-size: .73rem; line-height: 1.4; }
.case-workbench-label-side, .case-workbench-tray-side { min-width: 0; }
.case-workbench-label-side { display: flex; flex-direction: column; justify-content: center; }
.case-workbench-label-side .case-repair-label { max-width: 390px; margin: 0 auto; }
.case-workbench-label-side .case-label-actions { width: 100%; max-width: 390px; margin: .5rem auto 0; }
.case-label-workbench .case-label-feedback { grid-column: 1 / -1; min-height: 1.5em; margin: 0; font-size: .78rem; line-height: 1.4; }
.case-label-workbench .case-tray-heading { margin: 0 0 .3rem; }
.case-workbench-tray-side .case-digit-tray { gap: 4px; padding: 6px; }
#case-label-workbench .case-digit-tile { min-height: 36px; }
#case-label-workbench .case-label-slot { font-size: 2.1rem; }
.case-stage[data-workbench="open"] #case-caption { display: none; }
.case-stage[data-workbench="open"] .case-crates {
  bottom: calc(6.87% + (var(--case-workbench-height, 280px) + 44px) / 1.18);
}
@media (max-width: 1199px) {
  .case-label-workbench { position: relative; flex: none; left: auto; right: auto; bottom: auto; margin: 0; border-radius: 0; box-shadow: none; }
  .case-stage[data-workbench="open"] .case-crates { bottom: 25%; }
}
@media (max-width: 600px) {
  .case-label-workbench { grid-template-columns: minmax(0, 1fr); padding: .8rem; }
  .case-workbench-heading { display: block; }
  .case-workbench-heading .case-label-help { margin: .35rem 0 .2rem; }
  .case-workbench-label-side .case-repair-label, .case-workbench-label-side .case-label-actions { max-width: 340px; }
  #case-label-workbench .case-digit-tile { min-height: 44px; }
  .case-workbench-tray-side { margin-top: .4rem; }
}

/* Quiet scene-corner access to the introduction, matching the bridge location. */
#case-stage #case-info {
  position: absolute; top: 1rem; right: 1rem; z-index: 7;
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  border: 2px solid #315f59 !important; border-radius: 50%;
  background: #f8faeff2 !important; color: #244a45 !important;
  box-shadow: 0 2px 10px #183b3430; font: bold italic 1.6rem/1 Georgia, serif;
}
.case-information {
  box-sizing: border-box; width: min(38rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem); overflow: auto;
  padding: 1.4rem 1.6rem; border: 2px solid #78917e; border-radius: 14px;
  background: #f3f5eb; color: #343e35; box-shadow: 0 20px 80px #102c3260;
  font: 1.05rem/1.6 Georgia, serif;
}
.case-information::backdrop { background: #102c326b; }
.case-information-topline { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.case-information-topline .case-eyebrow { margin: 0; }
.case-information h2 { margin: 1rem 0; font-size: 1.7rem; line-height: 1.25; color: #343e35; }
.case-information h3 { font-size: 1.15rem; }
.case-information-steps { padding-left: 1.25rem; }
.case-information-steps li { margin-bottom: .6rem; }
.case-information .case-transcript { background: transparent; }
.case-information .case-transcript li { font-size: .95rem; }
.case-information-reminder { border-top: 1px solid #b4bfa8; padding-top: .8rem; font-size: .9rem; }
#case-information button {
  min-height: 44px; padding: .55rem .8rem; border: 1px solid #78917e !important;
  border-radius: 7px; background: #fafbf4 !important; color: #244a45 !important;
  box-shadow: none; font: .94rem/1.3 system-ui, sans-serif;
}
@media (max-width: 600px) {
  .case-information { padding: 1rem; }
  .case-information h2 { font-size: 1.4rem; }
}

/* Pull back to the original conversation framing for the voiced payoff. */
#case-stage[data-ending-view="true"] .case-world { transform: none; }
#case-stage[data-ending-view="true"] .case-actor { opacity: 1; }
#case-stage[data-ending-view="true"] .case-crates { left: 36%; right: 36%; bottom: 41%; }
#case-replay-ending { width: 100%; font-size: .85rem; padding: .5rem; }
