* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #080a0f;
  overflow: hidden;
  font-family: 'Courier New', monospace;
  color: #c0c8d8;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  touch-action: none;
}

#timeline {
  pointer-events: none;
  z-index: 5;
}

#stats {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(8, 10, 15, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 11px;
  letter-spacing: 1px;
  min-width: 180px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.stat-group {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.stat-label {
  color: rgba(255, 255, 255, 0.4);
  font-size: 10px;
}

.stat-value {
  color: rgba(255, 255, 255, 0.85);
  font-weight: bold;
  font-size: 12px;
}

.stat-value.green { color: #50dc64; }
.stat-value.yellow { color: #dcdc50; }
.stat-value.red { color: #dc5050; }

.stat-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 6px 0;
}

#inspect {
  display: none;
  position: fixed;
  top: 60px;
  left: 16px;
  background: rgba(8, 10, 15, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 11px;
  letter-spacing: 0.5px;
  min-width: 220px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

#inspect.active {
  display: block;
}

.inspect-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.inspect-header .creature-id {
  font-size: 12px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.7);
}

.inspect-header .creature-gen {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
}

.inspect-trait {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
}

.inspect-trait-label {
  color: rgba(255, 255, 255, 0.35);
  font-size: 10px;
}

.inspect-trait-value {
  color: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: bold;
}

.gene-bar-row {
  display: flex;
  align-items: center;
  padding: 2px 0;
  gap: 6px;
}

.gene-bar-label {
  color: rgba(255, 255, 255, 0.3);
  font-size: 9px;
  width: 32px;
  text-align: right;
  flex-shrink: 0;
}

.gene-bar-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

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

.inspect-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 0;
}

#controls {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 10, 15, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  z-index: 10;
  display: flex;
  gap: 16px;
  align-items: center;
}

.key {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  margin-right: 4px;
}

#title {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
}

#title h1 {
  font-size: 14px;
  letter-spacing: 4px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
}

#title p {
  font-size: 10px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 2px;
}

#mobile-controls {
  display: none;
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 10, 15, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 6px 8px;
  z-index: 10;
  gap: 4px;
  backdrop-filter: blur(10px);
}

.mobile-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  #mobile-controls {
    display: flex;
  }
  #controls {
    display: none;
  }
  #stats {
    top: auto;
    bottom: 70px;
    right: 8px;
    max-height: 40vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 10px;
    padding: 10px 12px;
    min-width: 150px;
  }
  #inspect.active {
    top: auto;
    bottom: 70px;
    left: 8px;
    right: 8px;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-width: unset;
    width: auto;
  }
  #title h1 {
    font-size: clamp(11px, 3.5vw, 14px);
  }
  #title p {
    font-size: clamp(8px, 2.5vw, 10px);
  }
}
