@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&family=JetBrains+Mono:wght@400;700&display=swap');

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

:root {
  --void: #020205;
  --text-primary: #f5f0eb;
  --text-muted: #6a6560;
  --accent-cold: #14b8a6;
  --accent-hot: #f97316;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--void);
  color: var(--text-primary);
  font-family: var(--font-body);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  touch-action: none; /* Prevent browser gestures (scroll, zoom, pull-to-refresh) */
}

/* ── UI Overlay ───────────────────────────── */

#overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* Entropy display — top left */
#entropy-panel {
  position: absolute;
  top: 32px;
  left: 32px;
}

#entropy-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

#entropy-value {
  font-family: var(--font-mono);
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
  transition: color 0.6s ease;
}

#entropy-value.hot {
  color: var(--accent-hot);
}

#entropy-unit {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

#entropy-bar-track {
  width: 180px;
  height: 3px;
  background: rgba(255,255,255,0.06);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

#entropy-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-cold), var(--accent-hot));
  transition: width 0.3s ease;
}

/* State label — center */
#state-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(245, 240, 235, 0);
  transition: color 0.8s ease, opacity 0.8s ease;
  opacity: 0;
}

#state-label.visible {
  color: rgba(245, 240, 235, 0.25);
  opacity: 1;
}

/* Click instruction — bottom center */
#click-instruction {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  transition: opacity 0.5s ease;
}

#click-instruction.hidden {
  opacity: 0;
}

/* Renderer badge — bottom left */
#renderer-badge {
  position: absolute;
  bottom: 32px;
  left: 32px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px;
  color: var(--text-muted);
  background: rgba(2, 2, 5, 0.6);
  backdrop-filter: blur(8px);
}

/* Caption — bottom right */
#caption {
  position: absolute;
  bottom: 32px;
  right: 32px;
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
  max-width: 280px;
  text-align: right;
  line-height: 1.5;
}

/* Loading state */
#loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--void);
  z-index: 100;
  transition: opacity 0.6s ease;
}

#loading.fade-out {
  opacity: 0;
  pointer-events: none;
}

#loading-text {
  font-size: 13px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255,255,255,0.08);
  border-top-color: var(--accent-cold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 640px) {
  #entropy-panel { top: 20px; left: 20px; }
  #entropy-value { font-size: 28px; }
  #entropy-bar-track { width: 120px; }
  #caption { display: none; }
  #renderer-badge { bottom: 20px; left: 20px; }
  #click-instruction { bottom: 24px; font-size: 11px; }
}