:root {
  --bg: #041421;
  --panel: rgba(8, 31, 46, 0.82);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8f5ff;
  --muted: #9fb7c7;
  --accent: #25d6a2;
  --accent-2: #4fb3ff;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 10%, rgba(76, 163, 255, 0.12), transparent 30%),
    radial-gradient(circle at 90% 20%, rgba(37, 214, 162, 0.12), transparent 32%),
    linear-gradient(140deg, #03121d, #061b2a 60%, #042239);
  color: var(--text);
  padding: 32px;
}

.app {
  max-width: 1200px;
  margin: 0 auto 48px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.title-block h1 {
  margin: 4px 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: var(--accent);
  margin: 0;
}

.description {
  margin: 6px 0 0;
  color: var(--muted);
  max-width: 720px;
}

.controls {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.controls .hint {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.scene {
  position: relative;
  background: linear-gradient(160deg, rgba(39, 68, 97, 0.25), rgba(7, 24, 38, 0.7));
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  min-height: 520px;
  box-shadow: var(--shadow);
}

.scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.side-panel {
  display: grid;
  gap: 14px;
  align-content: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.live-state .header-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  margin-bottom: 6px;
}

.live-state .pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff6b6b;
  box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.6);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.55);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 12px rgba(255, 107, 107, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 107, 107, 0);
  }
}

.small {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.results .result-line {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.results .result-line:last-of-type {
  border-bottom: none;
}

.quip-card h2 {
  margin-bottom: 8px;
}

.quip-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 15px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.03);
}

.number-die {
  background: var(--accent);
}

.color-die {
  background: var(--accent-2);
}

.label {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.value {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 600;
}

#colorValue {
  position: relative;
  padding-left: 22px;
}

#colorValue::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--swatch, var(--accent-2));
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.04);
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.12s ease, background 0.2s ease;
}

button.primary {
  background: linear-gradient(120deg, #20dba3, #36b9ff);
  color: #03121d;
  box-shadow: 0 12px 30px rgba(54, 185, 255, 0.35);
}

button.primary:active {
  transform: translateY(1px);
}

button.ghost {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 12px;
}

button:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

@media (max-width: 900px) {
  body {
    padding: 20px;
  }

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

  .controls {
    justify-items: start;
  }

  .scene {
    min-height: 460px;
  }
}
