:root {
  --bg-deep: #0f1d1f;
  --bg-mid: #1b2f34;
  --bg-soft: #243c42;
  --accent: #7dd3c7;
  --accent-strong: #4db6ac;
  --panel: rgba(18, 28, 32, 0.88);
  --panel-border: rgba(125, 211, 199, 0.2);
  --text-main: #e9f5f3;
  --text-sub: #a9c6c2;
  --warning: #ffb37b;
  --dish-core: radial-gradient(circle at 30% 30%, #cfe7e3, #92b8b3 60%, #5c7a78 100%);
  --dish-shadow: rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "IBM Plex Sans", sans-serif;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 15% 20%, #213c41 0%, transparent 40%),
    radial-gradient(circle at 80% 10%, #1a2f34 0%, transparent 50%),
    linear-gradient(135deg, var(--bg-deep), var(--bg-mid) 55%, var(--bg-soft));
  color: var(--text-main);
  overflow-y: auto;
}

.lab-bg {
  min-height: 100vh;
  background: transparent;
  padding: 24px;
  position: relative;
  overflow: visible;
}

.lab-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(125, 211, 199, 0.08) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.4;
  pointer-events: none;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 1;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(145deg, #3d6c6d, #7dd3c7);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.brand-title {
  font-weight: 600;
  letter-spacing: 0.5px;
}

.brand-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: var(--text-sub);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-sub);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(125, 211, 199, 0.8);
}

.workspace {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 20px;
  position: relative;
  z-index: 1;
  align-items: start;
  min-height: calc(100vh - 130px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 20px;
  height: 760px;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel.left {
  overflow: hidden;
}

.panel.right {
  overflow: hidden;
}

.panel h2 {
  font-weight: 600;
  letter-spacing: 0.4px;
}

.panel-desc {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.4;
}

.microbe-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
  min-height: 0;
}

.microbe-card {
  border-radius: 14px;
  padding: 10px;
  background: rgba(125, 211, 199, 0.12);
  border: 1px solid rgba(125, 211, 199, 0.25);
  cursor: grab;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: grid;
  gap: 6px;
  justify-items: center;
  text-align: center;
}

.microbe-card.dragging {
  opacity: 1;
}

.microbe-card:active {
  cursor: grabbing;
  transform: scale(0.98);
}

.microbe-card:hover {
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
}

.card-title {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-main);
}

.card-sub {
  font-size: 10px;
  color: var(--text-sub);
}

.microbe-photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.35);
  filter: saturate(0.9) contrast(1.05);
}

.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  padding-top: 6px;
  height: 760px;
}

.dish-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}

.dish {
  width: 360px;
  aspect-ratio: 1;
  border-radius: 50%;
  position: relative;
  background: var(--dish-core);
  box-shadow: 0 20px 40px var(--dish-shadow), inset 0 0 25px rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
  overflow: hidden;
}

.dish.drag-over {
  transform: scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.55), inset 0 0 30px rgba(255, 255, 255, 0.35);
}

.dish-ring {
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.35);
}

.dish-grid {
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background-image: radial-gradient(rgba(255, 255, 255, 0.3) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.4;
}

.colony {
  position: absolute;
  border-radius: 50%;
  background: rgba(77, 182, 172, 0.8);
  box-shadow: 0 0 10px rgba(77, 182, 172, 0.6);
  transform: translate(-50%, -50%);
  animation: bloom 1.8s ease forwards;
}

.colony.ecoli {
  width: 26px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(125, 211, 199, 0.9), rgba(77, 182, 172, 0.7));
}

.colony.staph {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 214, 170, 0.85);
  box-shadow: 10px 0 0 rgba(255, 214, 170, 0.7), -8px 6px 0 rgba(255, 214, 170, 0.6),
    6px -8px 0 rgba(255, 214, 170, 0.6);
}

.colony.yeast {
  width: 22px;
  height: 16px;
  border-radius: 60% 60% 50% 50%;
  background: rgba(200, 170, 255, 0.75);
}

.colony.penicillium {
  width: 28px;
  height: 8px;
  border-radius: 8px;
  background: repeating-linear-gradient(
    90deg,
    rgba(120, 210, 170, 0.8),
    rgba(120, 210, 170, 0.8) 4px,
    rgba(90, 180, 150, 0.6) 4px,
    rgba(90, 180, 150, 0.6) 8px
  );
}

.colony.bacillus {
  width: 28px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(150, 210, 220, 0.9), rgba(80, 150, 170, 0.7));
  box-shadow: 0 0 8px rgba(150, 210, 220, 0.5);
}

.colony.salmonella {
  width: 26px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 190, 140, 0.9), rgba(255, 140, 110, 0.7));
}

.colony.pseudomonas {
  width: 24px;
  height: 14px;
  border-radius: 12px;
  background: rgba(120, 220, 200, 0.8);
  box-shadow: 8px 0 0 rgba(80, 170, 200, 0.7), -8px 0 0 rgba(80, 170, 200, 0.7);
}

.colony.lactobacillus {
  width: 30px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 200, 200, 0.9), rgba(200, 120, 140, 0.7));
}

.colony.candida {
  width: 20px;
  height: 18px;
  border-radius: 60% 60% 55% 55%;
  background: rgba(220, 200, 170, 0.8);
}

.colony.deinococcus {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 160, 120, 0.8);
  box-shadow: 10px 0 0 rgba(255, 160, 120, 0.7), -10px 0 0 rgba(255, 160, 120, 0.7),
    0 10px 0 rgba(255, 160, 120, 0.7), 0 -10px 0 rgba(255, 160, 120, 0.7);
}

@keyframes bloom {
  0% {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0.2;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.readout {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
  background: rgba(12, 18, 20, 0.75);
  text-align: center;
}

.chart-panel {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
  background: rgba(12, 18, 20, 0.82);
  padding: 12px 16px;
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(125, 211, 199, 0.7);
}

#growthChart {
  width: 100%;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(30, 50, 55, 0.6), rgba(10, 18, 20, 0.8));
  border: 1px solid rgba(125, 211, 199, 0.15);
  height: 140px;
}

.spike-log {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--text-sub);
}

.spike-title {
  font-weight: 600;
  color: var(--text-main);
}

.spike-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(125, 211, 199, 0.08);
  border: 1px solid rgba(125, 211, 199, 0.15);
}

.spike-empty {
  color: rgba(169, 198, 194, 0.7);
}

.readout-label {
  font-size: 12px;
  color: var(--text-sub);
}

.readout-value {
  font-weight: 600;
  margin-top: 6px;
}

.control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(125, 211, 199, 0.08);
  border: 1px solid rgba(125, 211, 199, 0.2);
}

.control-list {
  display: grid;
  gap: 10px;
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
  min-height: 0;
}

.control label {
  font-size: 13px;
  color: var(--text-sub);
}

.control input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.control .value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: var(--accent);
}

.reset {
  margin-top: 6px;
  margin-bottom: 6px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 179, 123, 0.4);
  background: rgba(255, 179, 123, 0.15);
  color: var(--warning);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}


.reset:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.25);
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  .dish {
    width: 280px;
  }

  .readout {
    grid-template-columns: 1fr;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 900px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .brand-title {
    font-size: 18px;
  }

  .panel {
    padding: 16px;
  }

  .dish {
    width: 240px;
  }
}

@media (max-width: 600px) {
  .lab-bg {
    padding: 16px;
  }

  .top-bar {
    padding: 10px 12px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-title {
    font-size: 16px;
  }

  .brand-sub {
    font-size: 11px;
  }

  .workspace {
    gap: 16px;
  }

  .panel-desc {
    font-size: 12px;
  }

  .microbe-card {
    padding: 12px 14px;
  }

  .dish {
    width: 210px;
  }

  .readout {
    padding: 12px 14px;
    gap: 10px;
  }
}
