:root {
  --bg: #111827;
  --surface: #1f2937;
  --border: #374151;
  --text: #f9fafb;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --success: #10b981;
  --radius: 12px;
  --picker-size: 240px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.container {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Header */
header { text-align: center; }

h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-size: 0.95rem;
}

/* Color boxes */
.color-display {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.color-box-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.color-box {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: #374151;
  transition: background-color 0.1s ease;
  max-height: 160px;
}

.color-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Picker section */
#picker-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

#color-picker {
  display: flex;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  width: 100%;
  max-width: 280px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

/* Result section */
#result-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  width: 100%;
}

.score-value {
  font-size: clamp(1.75rem, 8vw, 2.75rem);
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #a78bfa, #60a5fa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.color-values {
  display: flex;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.color-values code {
  font-family: 'Courier New', monospace;
  color: var(--text);
  font-size: 0.9em;
}

#rgb-canvas {
  width: 100%;
  aspect-ratio: 1;
  background: #0b0f1a;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: grab;
  touch-action: none;
  overflow: hidden;
}

#rgb-canvas:active { cursor: grabbing; }

.canvas-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: -0.5rem;
}

.comeback {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.copy-feedback {
  color: var(--success);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Utility */
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 360px) {
  h1 { font-size: 2rem; }
  :root { --picker-size: 200px; }
}
