/**
 * Apex Parasite - Post-Combat Surgery Visual Stylesheet
 * High-Contrast Persona 5 Bio-Cyberpunk Palette:
 * Obsidian #05070a, Crimson #f43f5e, Gold #f59e0b, Cyan #00f0ff, Purple #c084fc
 */

:root {
  --bg-obsidian: #05070a;
  --bg-card: rgba(15, 23, 42, 0.92);
  --border-slate: #334155;
  --crimson-vivid: #f43f5e;
  --crimson-dark: #881337;
  --gold-vivid: #f59e0b;
  --gold-dark: #d97706;
  --cyan-vivid: #00f0ff;
  --blue-vivid: #38bdf8;
  --purple-vivid: #c084fc;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-mono: 'Consolas', 'Fira Code', monospace;
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Postcombat Overlay (Within 60-100 z-index band) */
.postcombat-surgery-overlay {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 720px;
  background-color: var(--bg-obsidian);
  color: var(--text-main);
  font-family: var(--font-display);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  user-select: none;
  z-index: 70;
}

/* 1. TOP STATUS BAR */
.surgery-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(5, 7, 10, 0.8) 100%);
  border-bottom: 2px solid var(--border-slate);
  z-index: 80;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meta-specimen {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text-main);
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.meta-status {
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  transform: skewX(-12deg);
}

.meta-status.status-living {
  background: var(--crimson-vivid);
  color: #fff;
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.5);
}

.meta-status.status-dead {
  background: #475569;
  color: #cbd5e1;
}

/* Pulse Meter */
.pulse-meter-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--crimson-dark);
  box-shadow: inset 0 0 15px rgba(244, 63, 94, 0.2);
  min-width: 220px;
  transition: all 0.3s ease;
}

.pulse-meter-container.pulse-hidden {
  display: none;
}

.pulse-meter-container.pulse-drop-flash {
  background: rgba(244, 63, 94, 0.4);
  box-shadow: 0 0 20px var(--crimson-vivid);
}

.pulse-readout {
  display: flex;
  flex-direction: column;
}

.pulse-label {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--crimson-vivid);
}

.pulse-val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 8px var(--crimson-vivid);
}

.flatline-banner {
  display: none;
  position: absolute;
  inset: 0;
  background: #881337;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 4px;
  display: none;
  align-items: center;
  justify-content: center;
  animation: flatlineStrobe 0.8s infinite alternate;
}

.pulse-meter-container.is-flatline .flatline-banner {
  display: flex;
}

@keyframes flatlineStrobe {
  0% { background: #881337; box-shadow: 0 0 10px #f43f5e; }
  100% { background: #4c0519; box-shadow: 0 0 2px #881337; }
}

/* Top Telemetry */
.top-telemetry {
  display: flex;
  align-items: center;
  gap: 20px;
}

.telemetry-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-slate);
  transform: skewX(-8deg);
}

.t-glyph {
  font-size: 1.1rem;
}

.t-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
}

.t-val {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--gold-vivid);
}

.sac-item {
  cursor: pointer;
  border-color: var(--purple-vivid);
  transition: transform 0.2s ease;
}

.sac-item.sac-pulse {
  transform: skewX(-8deg) scale(1.15);
  box-shadow: 0 0 15px var(--purple-vivid);
}

/* 2. CENTER ANATOMY STAGE */
.surgery-stage-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 40px;
  perspective: 1200px;
  overflow: visible;
}

.surgery-art-wrapper {
  position: relative;
  width: auto;
  height: 60vh;
  max-height: 640px;
  max-width: 1024px;
  transform-origin: center center;
  transition: transform 0.3s ease;
}

.surgery-art-wrapper.entrance-tilt {
  transform: rotateX(25deg) scale(0.55);
  animation: entranceDescend 1.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes entranceDescend {
  0% {
    transform: rotateX(25deg) scale(0.55);
    opacity: 0.3;
  }
  100% {
    transform: rotateX(0deg) scale(1.0);
    opacity: 1;
  }
}

.surgery-art-wrapper.body-breathing .surgery-anatomy-img,
.surgery-art-wrapper.body-breathing .surgery-placeholder-svg {
  animation: creatureTwitch var(--breathe-speed, 1.2s) ease-in-out infinite alternate;
  transform-origin: center center;
}

@keyframes creatureTwitch {
  0% { transform: scale(1.0); }
  50% { transform: scale(1.008) rotate(0.15deg); }
  100% { transform: scale(0.995); }
}

.surgery-art-wrapper.body-limp {
  animation: none !important;
  transform: scale(0.99) !important;
  filter: grayscale(0.5) contrast(0.85);
  transition: all 0.6s ease;
}

.surgery-art-wrapper.screen-shake {
  animation: shake 0.35s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-8px, 6px); }
  40% { transform: translate(7px, -5px); }
  60% { transform: translate(-5px, 3px); }
  80% { transform: translate(4px, -2px); }
}

.surgery-art-wrapper.feast-push {
  transform: scale(1.2) translateY(-20px);
  filter: brightness(1.2);
  transition: transform 0.8s ease;
}

.surgery-anatomy-img,
.surgery-placeholder-svg,
.surgery-overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.surgery-overlay-svg {
  pointer-events: none;
  z-index: 10;
}

/* SVG Hit Regions */
.organ-hit-region {
  pointer-events: all;
  cursor: pointer;
  outline: none;
}

.organ-hit-shape {
  fill: rgba(0, 240, 255, 0.05);
  stroke: rgba(0, 240, 255, 0.3);
  stroke-width: 1.5;
  stroke-dasharray: 4 2;
  transition: all 0.2s ease;
}

.organ-hit-region.region-hovered .organ-hit-shape,
.organ-hit-region:focus .organ-hit-shape {
  fill: rgba(244, 63, 94, 0.25);
  stroke: var(--crimson-vivid);
  stroke-width: 3;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 8px var(--crimson-vivid));
}

.organ-hit-region.is-extracted .organ-hit-shape {
  fill: none;
  stroke: #334155;
  stroke-width: 1;
  stroke-dasharray: 2 4;
  opacity: 0.3;
}

.organ-hit-region.is-destroyed .organ-hit-shape {
  fill: rgba(136, 19, 55, 0.3);
  stroke: #881337;
  opacity: 0.4;
}

/* SVG Clamp Points */
.clamp-node {
  pointer-events: all;
  cursor: pointer;
  outline: none;
}

.clamp-pulse-ring {
  fill: none;
  stroke: var(--gold-vivid);
  stroke-width: 2;
  animation: clampPulse 1.8s infinite ease-out;
}

@keyframes clampPulse {
  0% { r: 12; opacity: 1; }
  100% { r: 24; opacity: 0; }
}

.clamp-core-dot {
  fill: var(--gold-vivid);
  stroke: #fff;
  stroke-width: 1.5;
}

.clamp-crosshair {
  stroke: #ffffff;
  stroke-width: 1.5;
}

.clamp-svg-label {
  fill: var(--gold-vivid);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.clamp-node:hover .clamp-svg-label,
.clamp-node:focus .clamp-svg-label {
  opacity: 1;
}

.clamp-node.is-clamped .clamp-pulse-ring {
  animation: none;
  stroke: #38bdf8;
  opacity: 0.8;
}

.clamp-node.is-clamped .clamp-core-dot {
  fill: #38bdf8;
}

.clamp-node.is-clamped {
  cursor: default;
  pointer-events: none;
}

/* Leader Lines - Laser targeting: Hidden by default, illuminates exclusively on active hover */
.leader-line {
  stroke: #334155;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, stroke 0.2s ease;
}

.leader-line.leader-hovered {
  opacity: 1;
  stroke: var(--crimson-vivid);
  stroke-width: 2.5;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 8px var(--crimson-vivid));
}

/* Callouts Container & Flex Columns - Guarantees ZERO vertical overlap */
.surgery-callouts-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  padding: 14px 20px;
}

.callouts-column {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  max-height: calc(100% - 28px);
  z-index: 25;
  pointer-events: auto;
}

.callouts-column-left {
  align-items: flex-start;
}

.callouts-column-right {
  align-items: flex-end;
}

.callout-tag {
  position: relative;
  pointer-events: all;
  width: 220px;
  box-sizing: border-box;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-slate);
  color: var(--text-main);
  text-align: left;
  transform: skewX(-8deg);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  cursor: pointer;
  outline: none;
}

.callout-tag:hover,
.callout-tag.tag-hovered,
.callout-tag:focus {
  transform: skewX(-8deg) scale(1.04) translateX(4px);
  border-color: var(--crimson-vivid);
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.45);
  background: rgba(30, 41, 59, 0.98);
}

.callouts-column-right .callout-tag:hover,
.callouts-column-right .callout-tag.tag-hovered,
.callouts-column-right .callout-tag:focus {
  transform: skewX(-8deg) scale(1.04) translateX(-4px);
}

.callout-tag.rarity-common { border-left: 4px solid #94a3b8; }
.callout-tag.rarity-uncommon { border-left: 4px solid #4ade80; }
.callout-tag.rarity-rare { border-left: 4px solid #38bdf8; }
.callout-tag.rarity-epic { border-left: 4px solid #c084fc; }
.callout-tag.rarity-legendary { border-left: 4px solid #f59e0b; }

.callout-tag.is-ghost {
  opacity: 0.35;
  padding: 4px 8px;
  width: 170px;
  background: rgba(15, 23, 42, 0.5);
  filter: grayscale(0.85);
  cursor: not-allowed;
  border-left: 3px solid #64748b !important;
  pointer-events: none;
}

.tag-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.tag-glyph {
  font-size: 1rem;
}

.tag-name {
  font-size: 0.82rem;
  font-weight: 800;
  flex: 1;
  white-space: normal;
  line-height: 1.2;
  word-break: break-word;
}

.tag-rarity {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 800;
}

.tag-condition-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 3px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.condition-bar-track {
  flex: 1;
  height: 5px;
  background: #0f172a;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.condition-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.condition-band-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.tag-body {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 4px;
  margin-top: 2px;
}

.val-success { color: var(--cyan-vivid); font-weight: bold; }
.val-pulse { color: var(--crimson-vivid); font-weight: bold; }
.val-pulse.discounted { color: var(--blue-vivid); text-decoration: underline; }
.val-pulse.kills-pulse-val { color: #f43f5e; font-weight: 900; text-shadow: 0 0 8px #f43f5e; letter-spacing: 0.5px; }
.val-cal { color: var(--gold-vivid); font-weight: bold; }

.btn-feast.feast-cal-drop {
  animation: feastDropFlash 0.35s ease;
}

@keyframes feastDropFlash {
  0% { transform: skewX(-12deg) scale(1.0); }
  50% { transform: skewX(-12deg) scale(0.96); background: #881337; box-shadow: 0 0 10px #f43f5e; }
  100% { transform: skewX(-12deg) scale(1.0); }
}

.tag-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.badge {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 2px;
}

.badge-fragile { background: #881337; color: #fecdd3; animation: blink 1.2s infinite; }
.badge-danger { background: #e11d48; color: #fff; }
.badge-req { background: #1e293b; color: #94a3b8; border: 1px solid #475569; }
.badge-success { background: #15803d; color: #dcfce7; }
.badge-destroyed { background: #450a0a; color: #f87171; }
.badge-lost { background: #3b0764; color: #e9d5ff; }
.badge-rot { background: #450a0a; color: #fca5a5; border: 1px solid #ef4444; }
.badge-two-step { background: #d97706; color: #fff; animation: pulseTwoStep 0.8s infinite alternate; }
.badge-ghost { background: #1e293b; color: #64748b; border: 1px solid #334155; }

@keyframes pulseTwoStep {
  0% { transform: scale(1.0); }
  100% { transform: scale(1.08); box-shadow: 0 0 6px #f59e0b; }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.tag-disable-reason {
  font-size: 0.65rem;
  color: #f87171;
  font-style: italic;
  margin-top: 2px;
  empty-cells: hide;
}

.callout-tag.is-disabled {
  opacity: 0.55;
  filter: grayscale(0.5);
  cursor: not-allowed;
}

.callout-tag.is-extracted,
.callout-tag.is-destroyed,
.callout-tag.is-lost {
  opacity: 0.45;
  cursor: default;
}

/* 3. BOTTOM CONTROLS */
.surgery-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: linear-gradient(0deg, rgba(15, 23, 42, 0.95) 0%, rgba(5, 7, 10, 0.8) 100%);
  border-top: 2px solid var(--border-slate);
  z-index: 80;
}

.ground-loot-tray {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ground-loot-label {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

.ground-loot-items {
  display: flex;
  gap: 8px;
}

.ground-loot-tile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--blue-vivid);
  color: #fff;
  cursor: pointer;
  transform: skewX(-8deg);
  transition: all 0.2s ease;
  outline: none;
}

.ground-loot-tile:hover:not(:disabled) {
  background: rgba(2, 132, 199, 0.4);
  box-shadow: 0 0 10px var(--blue-vivid);
}

.ground-loot-tile.taken {
  opacity: 0.4;
  border-color: #475569;
  cursor: default;
}

.tray-cond-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid #0284c7;
  padding: 1px 5px;
  border-radius: 2px;
}

.ground-glyph { font-size: 1.1rem; }
.ground-name { font-size: 0.8rem; font-weight: 700; }
.ground-status { font-family: var(--font-mono); font-size: 0.7rem; color: var(--gold-vivid); }

/* Overflow Chips (Section 9) */
.overflow-chip {
  position: absolute;
  pointer-events: all;
  width: 200px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--purple-vivid);
  color: #fff;
  transform: translateY(-50%) skewX(-8deg);
  cursor: pointer;
  z-index: 25;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(192, 132, 252, 0.3);
}

.overflow-chip:hover, .overflow-chip:focus {
  background: rgba(30, 41, 59, 1);
  box-shadow: 0 0 18px rgba(192, 132, 252, 0.6);
  transform: translateY(-50%) skewX(-8deg) scale(1.04);
}

.overflow-chip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
}

.overflow-chip-drawer {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 240px;
  background: #0b1120;
  border: 1px solid #c084fc;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  padding: 8px;
  gap: 6px;
  flex-direction: column;
  z-index: 30;
}

.overflow-chip:hover .overflow-chip-drawer,
.overflow-chip:focus-within .overflow-chip-drawer {
  display: flex;
}

.action-buttons-group {
  display: flex;
  gap: 16px;
}

.surgery-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border: none;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 1.5px;
  cursor: pointer;
  transform: skewX(-12deg);
  transition: all 0.2s ease;
  outline: none;
}

.btn-feast {
  background: var(--crimson-vivid);
  color: #ffffff;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

.btn-feast:hover {
  background: #ff2a4d;
  box-shadow: 0 0 25px rgba(244, 63, 94, 0.8);
  transform: skewX(-12deg) scale(1.05);
}

.btn-leave {
  background: #334155;
  color: #cbd5e1;
  border: 1px solid #475569;
}

.btn-leave:hover {
  background: #475569;
  color: #ffffff;
  transform: skewX(-12deg) scale(1.05);
}

.surgery-btn.confirming {
  background: #f59e0b !important;
  color: #05070a !important;
  animation: confirmPulse 0.5s infinite alternate;
}

@keyframes confirmPulse {
  0% { transform: skewX(-12deg) scale(1.0); box-shadow: 0 0 10px #f59e0b; }
  100% { transform: skewX(-12deg) scale(1.06); box-shadow: 0 0 25px #f59e0b; }
}

/* 4. FLYING GLYPHS & PARTICLES (z-index: 3500+) */
.flying-organ-glyph {
  position: fixed;
  font-size: 2.2rem;
  pointer-events: none;
  z-index: 3600;
  transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.6s ease;
  filter: drop-shadow(0 0 10px var(--gold-vivid));
}

.flying-organ-glyph.quality-pristine { filter: drop-shadow(0 0 15px #f59e0b); }
.flying-organ-glyph.quality-intact { filter: drop-shadow(0 0 8px #ffffff); }
.flying-organ-glyph.quality-damaged { filter: drop-shadow(0 0 6px #94a3b8) grayscale(0.8); }

.shattering-organ-glyph {
  position: fixed;
  font-size: 2.4rem;
  pointer-events: none;
  z-index: 3600;
  animation: shatterRuined 0.7s forwards;
}

@keyframes shatterRuined {
  0% { transform: scale(1.0); opacity: 1; filter: drop-shadow(0 0 15px #ef4444); }
  50% { transform: scale(1.4) rotate(25deg); opacity: 0.8; filter: grayscale(1); }
  100% { transform: scale(0.4) translate(0, 40px) rotate(60deg); opacity: 0; }
}

/* HARNESS HOST PAGE STYLES */
.harness-viewport-container {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  background: #020408;
  color: #e2e8f0;
  overflow: hidden;
}

.harness-dev-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 20px;
  background: #0b1120;
  border-bottom: 2px solid #1e293b;
  font-size: 0.8rem;
  align-items: center;
  z-index: 100;
}

.dev-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dev-group label {
  font-weight: 700;
  color: #94a3b8;
}

.dev-group input,
.dev-group select {
  background: #1e293b;
  color: #fff;
  border: 1px solid #334155;
  padding: 4px 8px;
  border-radius: 3px;
  font-family: inherit;
}

.dev-btn {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 5px 12px;
  border-radius: 3px;
  font-weight: 700;
  cursor: pointer;
}

.dev-btn:hover {
  background: #2563eb;
}

.validation-box {
  padding: 6px 12px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  border-radius: 3px;
}

.validation-box.success {
  background: rgba(22, 101, 52, 0.4);
  color: #86efac;
  border: 1px solid #166534;
}

.validation-box.warning {
  background: rgba(180, 83, 9, 0.4);
  color: #fde047;
  border: 1px solid #b45309;
}

.validation-box.error {
  background: rgba(153, 27, 27, 0.4);
  color: #fca5a5;
  border: 1px solid #991b1b;
}

/* Collapsible Harness Bottom Split (Section 9) */
.harness-bottom-split {
  display: flex;
  flex-direction: column;
  height: 220px;
  background: #05070a;
  border-top: 2px solid #1e293b;
  z-index: 100;
  transition: height 0.25s ease;
}

.harness-bottom-split.is-collapsed {
  height: 28px !important;
}

.bottom-pane-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 16px;
  background: #0f172a;
  color: #94a3b8;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 1px solid #1e293b;
  user-select: none;
}

.bottom-pane-toggle:hover {
  background: #1e293b;
  color: #00f0ff;
}

.bottom-split-content {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.harness-bottom-split.is-collapsed .bottom-split-content {
  display: none !important;
}

.log-pane, .result-pane {
  flex: 1;
  padding: 10px;
  overflow-y: auto;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: #080c14;
}

.log-pane {
  border-right: 1px solid #1e293b;
}

.log-line {
  line-height: 1.4;
  color: #cbd5e1;
}

.result-pane pre {
  margin: 0;
  color: #38bdf8;
}

/* Body Inspector Drawer (Section 9) */
.body-inspector-drawer {
  position: absolute;
  top: 70px;
  right: 20px;
  bottom: 240px;
  width: 600px;
  max-width: 92vw;
  background: rgba(11, 17, 32, 0.98);
  border: 1px solid #00f0ff;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.25);
  display: flex;
  flex-direction: column;
  z-index: 400;
  border-radius: 4px;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(90deg, #0f172a, #1e293b);
  border-bottom: 1px solid #334155;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.82rem;
  color: #00f0ff;
}

.inspector-table-container {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.inspector-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.inspector-table th {
  background: #1e293b;
  color: #94a3b8;
  padding: 6px 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  border-bottom: 2px solid #334155;
}

.inspector-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #1e293b;
}

.kind-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-weight: 700;
}
.kind-badge.kind-organ { background: rgba(244, 63, 94, 0.2); color: #f43f5e; border: 1px solid #f43f5e; }
.kind-badge.kind-part { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid #38bdf8; }
.kind-badge.kind-trait { background: rgba(192, 132, 252, 0.2); color: #c084fc; border: 1px solid #c084fc; }
.kind-badge.kind-loose { background: rgba(245, 158, 11, 0.2); color: #f59e0b; border: 1px solid #f59e0b; }

.headless-display {
  padding: 20px;
  background: #020408;
  color: #38bdf8;
  font-family: monospace;
  white-space: pre-wrap;
}

/* Debug highlight hitboxes toggle */
.debug-highlight-hitboxes .organ-hit-shape {
  fill: rgba(0, 240, 255, 0.2) !important;
  stroke: #00f0ff !important;
  stroke-width: 2 !important;
}

/* ==========================================================
   TACTICAL ANATOMICAL RETICLES & SURGICAL INSPECTION HUD
   ========================================================== */

/* 1. SVG Bio-Reticle Nodes on Specimen */
.organ-reticle-node {
  cursor: pointer;
  outline: none;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center center;
}

.organ-reticle-node .reticle-outer-ring {
  fill: rgba(15, 23, 42, 0.7);
  stroke-width: 1.8;
  stroke-dasharray: 4 2;
  transition: all 0.25s ease;
}

.organ-reticle-node .reticle-core-bg {
  fill: #05070a;
  stroke: rgba(255, 255, 255, 0.15);
  stroke-width: 1;
}

.organ-reticle-node .reticle-glyph {
  font-size: 13px;
  user-select: none;
  pointer-events: none;
}

.organ-reticle-node .reticle-hazard-bracket {
  fill: none;
  stroke: var(--crimson-vivid);
  stroke-width: 1.5;
  opacity: 0.85;
  pointer-events: none;
  transition: opacity 0.2s ease, stroke-width 0.2s ease;
}

.organ-reticle-node:hover .reticle-hazard-bracket,
.organ-reticle-node.reticle-hovered .reticle-hazard-bracket,
.organ-reticle-node:focus .reticle-hazard-bracket {
  opacity: 1;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 6px var(--crimson-vivid));
}

.organ-reticle-node:hover,
.organ-reticle-node.reticle-hovered,
.organ-reticle-node:focus {
  filter: drop-shadow(0 0 10px var(--crimson-vivid));
}

.organ-reticle-node:hover .reticle-outer-ring,
.organ-reticle-node.reticle-hovered .reticle-outer-ring,
.organ-reticle-node:focus .reticle-outer-ring {
  stroke-width: 3;
  stroke-dasharray: none;
  stroke: var(--crimson-vivid) !important;
  fill: rgba(244, 63, 94, 0.2);
}

.organ-reticle-node.is-ghost-node {
  opacity: 0.25;
  cursor: not-allowed;
}

.ghost-reticle-circle {
  fill: none;
  stroke: #475569;
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.ghost-reticle-cross {
  stroke: #64748b;
  stroke-width: 1.5;
}

.organ-reticle-node.is-extracted .reticle-outer-ring {
  stroke: #15803d !important;
  fill: rgba(21, 128, 61, 0.2);
  opacity: 0.4;
}

.organ-reticle-node.is-destroyed .reticle-outer-ring,
.organ-reticle-node.is-ruptured .reticle-outer-ring {
  stroke: #881337 !important;
  fill: rgba(136, 19, 55, 0.3);
  opacity: 0.4;
}

/* 2. Tactical Organ Analysis HUD Card (Single Source of Truth) */
.surgery-inspection-hud {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 280px;
  background: rgba(5, 7, 10, 0.94);
  border: 1px solid var(--border-slate);
  border-top: 3px solid var(--cyan-vivid);
  padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), inset 0 0 15px rgba(0, 240, 255, 0.05);
  transform: skewX(-4deg);
  pointer-events: auto;
  z-index: 35;
  backdrop-filter: blur(8px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.surgery-inspection-hud:hover {
  border-color: var(--crimson-vivid);
  box-shadow: 0 12px 35px rgba(244, 63, 94, 0.2), inset 0 0 20px rgba(244, 63, 94, 0.1);
}

.hud-scanner-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
  margin-bottom: 10px;
}

.hud-scanner-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--cyan-vivid);
}

/* 3. Collapsible Organ Roster Drawer */
.surgery-roster-drawer {
  position: absolute;
  top: 20px;
  left: 24px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.roster-drawer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-slate);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  transform: skewX(-8deg);
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.roster-drawer-toggle:hover {
  background: rgba(30, 41, 59, 0.98);
  border-color: var(--cyan-vivid);
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.3);
}

.roster-drawer-content {
  display: flex;
  gap: 12px;
  background: rgba(5, 7, 10, 0.96);
  border: 1px solid var(--border-slate);
  border-top: 2px solid var(--cyan-vivid);
  padding: 12px;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  transform: skewX(-4deg);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 520px;
  overflow-y: auto;
}

.surgery-roster-drawer.is-collapsed .roster-drawer-content {
  display: none;
}

/* Idle State */
.hud-body-idle {
  text-align: center;
  padding: 10px 4px;
}

.hud-idle-icon {
  font-size: 1.6rem;
  margin-bottom: 4px;
}

.hud-idle-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.hud-idle-desc {
  font-size: 0.72rem;
  color: #64748b;
  line-height: 1.35;
}

/* Active State */
.hud-active-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.hud-active-glyph {
  font-size: 1.6rem;
  background: rgba(15, 23, 42, 0.8);
  padding: 4px;
  border: 1px solid var(--border-slate);
}

.hud-active-meta {
  flex: 1;
}

.hud-active-name {
  font-size: 0.95rem;
  font-weight: 900;
  color: #fff;
  line-height: 1.15;
}

.hud-active-sub {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-top: 2px;
}

.hud-cond-section {
  margin-bottom: 10px;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.hud-cond-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.hud-cond-track {
  height: 6px;
  background: #0f172a;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hud-cond-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.hud-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}

.hud-metric-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-slate);
  padding: 4px 8px;
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--text-muted);
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--gold-vivid);
}

.val-pulse-hud.val-pulse-kill {
  color: var(--crimson-vivid);
  text-shadow: 0 0 8px var(--crimson-vivid);
}

.hud-warnings-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.hud-warning-pill {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: 2px;
  line-height: 1.25;
}

.hud-warning-pill.warn-lethal {
  background: #881337;
  color: #fff;
  border-left: 3px solid #f43f5e;
}

.hud-warning-pill.warn-mutual {
  background: #451a03;
  color: #fed7aa;
  border-left: 3px solid #f97316;
}

.hud-warning-pill.warn-caustic {
  background: #3b0764;
  color: #f5d0fe;
  border-left: 3px solid #d946ef;
}

.hud-warning-pill.warn-fragile {
  background: #1e1b4b;
  color: #c7d2fe;
  border-left: 3px solid #6366f1;
}

.hud-btn-harvest {
  width: 100%;
  padding: 8px 12px;
  background: var(--crimson-vivid);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 1px;
  border: none;
  cursor: pointer;
  transform: skewX(-6deg);
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.4);
}

.hud-btn-harvest:hover:not(:disabled) {
  background: #fb7185;
  box-shadow: 0 0 25px rgba(244, 63, 94, 0.8);
  transform: skewX(-6deg) scale(1.02);
}

.hud-btn-harvest:disabled {
  background: #475569;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}
