.emt-chest-lab {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid rgba(111, 182, 255, 0.34);
  border-radius: 11px;
  color: var(--text);
  background: radial-gradient(circle at 94% 0, rgba(111, 182, 255, 0.13), transparent 37%), #101b29;
}

.emt-chest-lab [hidden] { display: none !important; }
.emt-chest-lab :is(button, input):focus-visible {
  outline: 2px solid #a5e7dc;
  outline-offset: 3px;
}

.emt-chest-head { display: grid; justify-items: start; gap: 8px; }
.emt-chest-head h3 { margin: 0; font-size: clamp(1.08rem, 1.65vw, 1.28rem); }
.emt-chest-head p { max-width: 78ch; margin: 0; color: #c3d3dd; line-height: 1.5; }

.emt-chest-photo-study {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0 0 14px;
  overflow: hidden;
  border: 1px solid rgba(143, 209, 220, 0.34);
  border-radius: 9px;
  background: #091a28;
}
.emt-chest-photo-frame { position: relative; width: min(100%, 900px); margin-inline: auto; }
.emt-chest-photo-frame img { display: block; width: 100%; height: auto; aspect-ratio: 1672 / 941; object-fit: contain; }
.emt-chest-photo-marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #06262b;
  background: #8be5d1;
  box-shadow: 0 2px 10px #04151d;
  font-weight: 850;
  cursor: pointer;
}
.emt-chest-photo-marker[aria-pressed="true"] { color: #fff; background: #235b72; }
.emt-chest-photo-study figcaption,
.emt-chest-photo-detail,
.emt-chest-photo-feedback { margin: 0; padding: 0 12px; color: #c9dde2; line-height: 1.5; font-size: 0.8rem; }
.emt-chest-photo-points,
.emt-chest-photo-choices { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 12px; }
.emt-chest-photo-point,
.emt-chest-photo-choice {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(130, 190, 207, 0.45);
  border-radius: 7px;
  color: #e3eef2;
  background: #153243;
  text-align: left;
  font: inherit;
  font-size: 0.79rem;
  cursor: pointer;
}
.emt-chest-photo-point[aria-pressed="true"],
.emt-chest-photo-choice[aria-pressed="true"] { border-color: #8be5d1; background: rgba(85, 214, 190, 0.23); }
.emt-chest-photo-question { padding: 5px 12px 0; font-size: 0.88rem; }
.emt-chest-photo-check { justify-self: start; margin-left: 12px; }
.emt-chest-photo-feedback { padding-bottom: 4px; }

.emt-chest-layer-panel {
  display: grid;
  justify-items: start;
  gap: 11px;
  padding: 14px;
  border: 1px solid rgba(111, 182, 255, 0.22);
  border-radius: 8px;
  background: rgba(7, 17, 28, 0.57);
}
.emt-chest-layer-panel h4 { margin: 0; font-size: 0.93rem; }
.emt-chest-layer-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}
.emt-chest-layer-button {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 7px;
  color: #d6e5ed;
  background: #1a2a39;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 730;
  cursor: pointer;
}
.emt-chest-layer-button:hover,
.emt-chest-layer-button[aria-pressed="true"] {
  border-color: rgba(85, 214, 190, 0.72);
  color: #edfff9;
  background: rgba(50, 115, 104, 0.42);
}
.emt-chest-layer-number {
  flex: none;
  color: #a8c3d0;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.emt-chest-deck {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  align-items: stretch;
  min-width: 0;
}
.emt-chest-card {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 9px;
  background: rgba(6, 16, 27, 0.74);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.emt-chest-card[data-story="pressure"] { --case-accent: #78d9c4; }
.emt-chest-card[data-story="abrupt"] { --case-accent: #a6b9ff; }
.emt-chest-card[data-story="faint"] { --case-accent: #e2b782; }
.emt-chest-card[data-selected="true"] {
  border-color: var(--case-accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--case-accent) 35%, transparent);
}
.emt-chest-card-head { display: grid; align-content: start; gap: 5px; min-height: 93px; }
.emt-chest-code {
  width: fit-content;
  padding: 3px 7px;
  border: 1px solid color-mix(in srgb, var(--case-accent) 45%, transparent);
  border-radius: 999px;
  color: var(--case-accent);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.08em;
}
.emt-chest-card-head h4 { margin: 0; font-size: 0.96rem; line-height: 1.27; }
.emt-chest-card-head p { margin: 0; color: #9eb3c0; font-size: 0.72rem; line-height: 1.36; }
.emt-chest-visual {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 7px;
  min-height: 82px;
  padding: 8px;
  border: 1px solid color-mix(in srgb, var(--case-accent) 23%, transparent);
  border-radius: 7px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--case-accent) 10%, transparent), transparent 58%), #0b1b2a;
}
.emt-chest-person { position: relative; height: 65px; }
.emt-chest-person-head,
.emt-chest-person-body {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #668596;
  transition: background 180ms ease, box-shadow 180ms ease;
}
.emt-chest-person-head { top: 4px; width: 22px; height: 22px; border-radius: 50%; }
.emt-chest-person-body { bottom: 1px; width: 40px; height: 33px; border-radius: 24px 24px 6px 6px; }
.emt-chest-card[data-appearance="pale"] :is(.emt-chest-person-head, .emt-chest-person-body) { background: #d2c4a3; box-shadow: 0 0 10px rgba(238, 196, 115, 0.16); }
.emt-chest-card[data-appearance="guarded"] :is(.emt-chest-person-head, .emt-chest-person-body) { background: #a3b5d2; box-shadow: 0 0 10px rgba(166, 185, 255, 0.15); }
.emt-chest-card[data-appearance="clammy"] :is(.emt-chest-person-head, .emt-chest-person-body) { background: #dab2a0; box-shadow: 0 0 10px rgba(226, 183, 130, 0.16); }
.emt-chest-visual-signals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.emt-chest-signal {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: #94aebc;
  background: rgba(255, 255, 255, 0.025);
  text-align: center;
  font-size: 0.58rem;
  font-weight: 750;
  line-height: 1.14;
}
.emt-chest-card:has(.emt-chest-fact:nth-child(1)[data-revealed="true"]) .emt-chest-signal:nth-child(1),
.emt-chest-card:has(.emt-chest-fact:nth-child(2)[data-revealed="true"]) .emt-chest-signal:nth-child(2),
.emt-chest-card:has(.emt-chest-fact:nth-child(3)[data-revealed="true"]) .emt-chest-signal:nth-child(3),
.emt-chest-card:has(.emt-chest-fact:nth-child(4)[data-revealed="true"]) .emt-chest-signal:nth-child(4) {
  border-color: color-mix(in srgb, var(--case-accent) 52%, transparent);
  color: #e8f6fa;
  background: color-mix(in srgb, var(--case-accent) 15%, transparent);
}
.emt-chest-facts { display: grid; align-content: start; gap: 8px; }
.emt-chest-fact {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  min-height: 96px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-left: 3px solid #476071;
  border-radius: 6px;
  background: rgba(15, 33, 46, 0.48);
}
.emt-chest-fact[data-revealed="true"] {
  border-left-color: var(--case-accent);
  background: color-mix(in srgb, var(--case-accent) 7%, #102332);
}
.emt-chest-fact[data-included="true"] { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--case-accent) 45%, transparent); }
.emt-chest-fact-label { color: #e3edf1; font-size: 0.75rem; font-weight: 800; }
.emt-chest-fact-source { color: #9bb2c0; font-size: 0.64rem; letter-spacing: 0.03em; }
.emt-chest-fact p { margin: 0; color: #ccdae2; font-size: 0.74rem; line-height: 1.42; overflow-wrap: anywhere; }
.emt-chest-fact[data-revealed="false"] p { color: #8fa8b8; }
.emt-chest-timebar { height: 5px; margin-top: 5px; border-radius: 999px; background: rgba(255, 255, 255, 0.1); }
.emt-chest-timebar span { display: block; height: 100%; border-radius: inherit; background: var(--case-accent); }
.emt-chest-device-view { display: grid; gap: 3px; margin-top: 5px; }
.emt-chest-device-readings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.emt-chest-device-readings > span { display: grid; gap: 2px; padding: 5px; border: 1px solid rgba(111, 182, 255, 0.19); border-radius: 4px; background: rgba(8, 25, 39, 0.72); }
.emt-chest-device-readings small { color: #9db8c6; font-size: 0.6rem; }
.emt-chest-device-readings strong { color: #e3f4f6; font-size: 0.73rem; font-variant-numeric: tabular-nums; }
.emt-chest-device-view svg { width: 100%; height: 28px; border-radius: 4px; background: #09212b; }
.emt-chest-device-view path { fill: none; stroke: #72d9c7; stroke-width: 1.7; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.emt-chest-device-view small { color: #a2bfc6; font-size: 0.6rem; }
.emt-chest-select {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 1px solid rgba(111, 182, 255, 0.32);
  border-radius: 6px;
  color: #dcecf3;
  background: rgba(34, 60, 76, 0.68);
  font-size: 0.75rem;
  font-weight: 760;
  cursor: pointer;
}
.emt-chest-select:hover,
.emt-chest-select[aria-pressed="true"] {
  border-color: var(--case-accent);
  color: #fff;
  background: color-mix(in srgb, var(--case-accent) 19%, #183145);
}

.emt-chest-composer {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(85, 214, 190, 0.33);
  border-radius: 9px;
  background: rgba(5, 19, 29, 0.72);
}
.emt-chest-composer-head h4 { margin: 0 0 5px; font-size: 1rem; }
.emt-chest-composer-head p { margin: 0; color: #a9c1ca; font-size: 0.78rem; line-height: 1.45; }
.emt-chest-composer-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr); gap: 12px; }
.emt-chest-pick-list { display: grid; align-content: start; gap: 7px; }
.emt-chest-pick-button {
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 6px;
  color: #d7e8ed;
  background: #1a2d3a;
  text-align: left;
  font-size: 0.73rem;
  line-height: 1.3;
  cursor: pointer;
}
.emt-chest-pick-button[aria-pressed="true"] { border-color: #55d6be; color: #ecfff9; background: rgba(42, 102, 89, 0.56); }
.emt-chest-pick-button:disabled { opacity: 0.54; cursor: not-allowed; }
.emt-chest-preview,
.emt-chest-uncertainty { min-width: 0; padding: 12px; border: 1px solid rgba(111, 182, 255, 0.19); border-radius: 7px; background: rgba(16, 36, 51, 0.6); }
.emt-chest-preview h5,
.emt-chest-uncertainty h5 { margin: 0 0 7px; color: #94e7d8; font-size: 0.79rem; }
.emt-chest-alert-text { margin: 0; color: #dfedf0; font-size: 0.78rem; line-height: 1.5; overflow-wrap: anywhere; }
.emt-chest-uncertainty ul { display: grid; gap: 5px; margin: 0; padding-left: 19px; color: #d1dfe5; font-size: 0.75rem; line-height: 1.48; }
.emt-chest-note { margin: 0; color: #a5bbc6; font-size: 0.72rem; line-height: 1.48; }
.emt-chest-live-summary { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 1180px) {
  .emt-chest-deck { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .emt-chest-layer-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .emt-chest-deck,
  .emt-chest-composer-grid { grid-template-columns: 1fr; }
  .emt-chest-card-head { min-height: 0; }
  .emt-chest-fact { min-height: 0; }
}
@media (max-width: 420px) {
  .emt-chest-lab { padding: 14px; }
  .emt-chest-layer-button { min-height: 58px; }
  .emt-chest-visual { grid-template-columns: 55px minmax(0, 1fr); }
}
