/* Cell Auto */
* { box-sizing: border-box; }

body {
  margin: 0; padding: 0;
  font-family: 'Courier New', monospace;
  background: #0a0a0f;
  color: #c8d8c8;
  overflow: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(0,0,0,0.1) 1px, rgba(0,0,0,0.1) 2px);
  pointer-events: none;
  z-index: 9999;
}

.ca-container { position: relative; width: 100vw; height: calc(100vh - 48px); }

.ca-canvas {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}

/* --- Top-left header --- */
.ca-header {
  position: fixed;
  top: 56px;
  left: 16px;
  z-index: 100;
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.ca-title {
  font-size: 0.9rem;
  font-weight: bold;
  letter-spacing: 4px;
  color: #22c55e;
  text-shadow: 0 0 4px rgba(34,197,94,0.4);
  margin: 0;
  white-space: nowrap;
}

.ca-gen {
  font-size: 0.65rem;
  color: #8a9a8a;
  letter-spacing: 1px;
  white-space: nowrap;
}

.ca-gen-num { color: #22c55e; font-weight: bold; }

/* --- Bottom toolbar (centered panel) --- */
.ca-toolbar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(20, 20, 24, 0.94);
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  max-width: 96vw;
  backdrop-filter: blur(8px);
  z-index: 100;
}

.ca-toolbar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Solid divider between groups */
.ca-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.1);
  flex-shrink: 0;
}

/* --- Buttons --- */
.ca-btn {
  background: transparent;
  border: 2px solid rgba(255,255,255,0.15);
  color: #c8d8c8;
  padding: 8px 18px;
  font-family: 'Courier New', monospace;
  font-size: 0.7rem;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.1s;
  text-transform: uppercase;
  border-radius: 2px;
  white-space: nowrap;
}

.ca-btn:hover {
  border-color: #22c55e; color: #22c55e;
  box-shadow: 0 0 8px rgba(34,197,94,0.3);
}

.ca-btn.active {
  background: rgba(34,197,94,0.12);
  border-color: #22c55e; color: #22c55e;
}

.ca-btn-wall.active {
  background: rgba(226,232,240,0.12);
  border-color: #94a3b8; color: #e2e8f0;
}

.ca-btn-sm { padding: 5px 10px; font-size: 0.6rem; }

.ca-btn-play {
  min-width: 60px;
  border-color: #22c55e;
}

.ca-btn-play.playing {
  background: #22c55e; color: #000;
  animation: ca-pulse 1s infinite;
}

@keyframes ca-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(34,197,94,0.5); }
  50% { box-shadow: 0 0 18px rgba(34,197,94,0.6), 0 0 30px rgba(34,197,94,0.2); }
}

/* --- Home link --- */
.ca-home {
  text-decoration: none;
  border-color: #333; color: #707878;
  padding: 6px 12px;
  font-size: 0.65rem;
  text-transform: uppercase;
}
.ca-home:hover { border-color: #22c55e; color: #22c55e; }

/* --- Groups / Labels / Sliders / Selects --- */
.ca-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.ca-tools { display: flex; gap: 3px; }

.ca-label {
  font-size: 0.55rem;
  line-height: 1;
  color: #8a9a8a;
  letter-spacing: 1px;
  text-transform: uppercase;
  white-space: nowrap;
  text-align: center;
}

.ca-val {
  color: #22c55e;
  font-weight: bold;
}

.ca-slider {
  width: 64px;
  height: 3px;
  background: #1a1a20;
  outline: none;
  border-radius: 2px;
  -webkit-appearance: none;
  display: block;
}

.ca-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  background: #22c55e;
  cursor: pointer;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(34,197,94,0.5);
}

.ca-slider::-moz-range-thumb {
  width: 12px; height: 12px;
  background: #22c55e;
  cursor: pointer;
  border-radius: 2px;
  border: none;
}

.ca-sel {
  background: #141418;
  border: 2px solid rgba(255,255,255,0.15);
  color: #c8d8c8;
  padding: 3px 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  border-radius: 2px;
  cursor: pointer;
}
.ca-sel:hover { border-color: #22c55e; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .ca-container { height: calc(100vh - 40px); }
  .ca-header { top: 48px; }
}

@media (max-width: 900px) {
  .ca-toolbar { padding: 8px 10px; gap: 5px; bottom: 8px; }
  .ca-toolbar-row { gap: 6px; }
  .ca-btn { padding: 5px 10px; font-size: 0.6rem; }
  .ca-btn-sm { padding: 4px 7px; font-size: 0.55rem; }
  .ca-title { font-size: 0.75rem; letter-spacing: 2px; }
  .ca-slider { width: 48px; }
  .ca-divider { height: 18px; }
}
