:root {
  --bg: #0b0d10;
  --panel: #14171b;
  --panel-line: #262b31;
  --text: #e8e4da;
  --text-dim: #8b9198;
  --live: #4ee6a6;
  --live-soft: rgba(78, 230, 166, 0.14);
  --amber: #f2a65a;
  --font-display: "IBM Plex Mono", monospace;
  --font-body: "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---------- Header ---------- */

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--panel-line);
  padding: 2rem 1.5rem 1.5rem;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.site-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 10px 2px var(--live-soft);
  animation: pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.subtitle {
  color: var(--text-dim);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 620px;
  margin: 0 auto 0.9rem;
}

.subtitle strong { color: var(--live); font-weight: 600; }

.rule-line {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--amber);
  margin: 0;
}

.rule-detail { color: var(--text-dim); }

/* ---------- Layout ---------- */

main {
  width: 100%;
  max-width: 1040px;
  padding: 1.75rem 1.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

/* ---------- Spielfeld ---------- */

.board-frame {
  position: relative;
  padding: 14px;
  border: 1px solid var(--panel-line);
  background: var(--panel);
  max-width: 100%;
  overflow: auto;
}

.board-frame::before,
.board-frame::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-color: var(--amber);
  opacity: 0.7;
}

.board-frame::before {
  top: 4px;
  left: 4px;
  border-top: 2px solid var(--amber);
  border-left: 2px solid var(--amber);
}

.board-frame::after {
  bottom: 4px;
  right: 4px;
  border-bottom: 2px solid var(--amber);
  border-right: 2px solid var(--amber);
}

#board {
  display: block;
  image-rendering: pixelated;
  cursor: crosshair;
}

/* ---------- Konsole ---------- */

.console {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.console-group {
  flex: 1 1 200px;
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--panel-line);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.console-group:last-child { border-right: none; }

.group-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.btn {
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--panel-line);
  padding: 0.5rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.btn:hover { border-color: var(--live); color: var(--live); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary {
  border-color: var(--live);
  color: var(--live);
}

.slider-row, .checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--live);
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--live);
}

.value {
  font-family: var(--font-mono);
  color: var(--amber);
  min-width: 3.2em;
  text-align: right;
  font-size: 0.8rem;
}

#pattern {
  font-family: var(--font-body);
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--panel-line);
  padding: 0.5rem;
}

.hint {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.4;
}

.stats { flex: 1 1 160px; }

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--live);
}

.stat-name {
  font-size: 0.72rem;
  color: var(--text-dim);
}

/* ---------- Footer ---------- */

.site-footer {
  width: 100%;
  max-width: 900px;
  padding: 0 1.25rem 2rem;
  text-align: center;
}

.site-footer p {
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.site-footer a { color: var(--amber); }

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .console-group {
    border-right: none;
    border-bottom: 1px solid var(--panel-line);
  }
  .console-group:last-child { border-bottom: none; }
}

/* ---------- Barrierefreiheit ---------- */

@media (prefers-reduced-motion: reduce) {
  .dot { animation: none; }
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
