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

body {
  background: #07070e;
  color: #fff;
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 32px;
  gap: 16px;
}

h1 {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg,
    #ff3040, #ff7700, #ffcc00, #00cc44,
    #00bbdd, #0066ff, #9933ff, #ff44aa, #ff3040);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: rainbow 6s linear infinite;
}

@keyframes rainbow {
  from { background-position: 0% 50%; }
  to   { background-position: 300% 50%; }
}

#status {
  font-size: 0.8rem;
  padding: 5px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  transition: color 0.3s, border-color 0.3s;
}
#status.connected { border-color: #2ecc40; color: #2ecc40; }
#status.error     { border-color: #ff4136; color: #ff4136; }

#app {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

canvas {
  display: block;
  border-radius: 18px;
  cursor: crosshair;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.06),
    0 8px 40px rgba(0,0,0,0.8);
  transition: filter 0.1s;
}

#sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 172px;
  flex-shrink: 0;
}

.panel {
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 14px;
}

.panel-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.35;
  margin-bottom: 10px;
}

#color-swatch {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 0 auto 8px;
  transition: background 0.2s, box-shadow 0.2s;
}
#color-name {
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

#palette-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}
.pal-btn {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.15s, box-shadow 0.15s;
}
.pal-btn:hover  { transform: scale(1.12); }
.pal-btn.active { border-color: #fff; }

#glow-bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
}
#glow-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #9933ff, #ff44aa);
  transition: width 0.15s;
}
#glow-label {
  font-size: 0.75rem;
  opacity: 0.45;
  text-align: center;
}

.tip { font-size: 0.72rem; line-height: 2; opacity: 0.45; }
.tip b { opacity: 1; color: #aabfff; font-weight: 600; }

#clear-btn, #save-btn {
  width: 100%;
  padding: 9px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: background 0.15s;
}
#clear-btn {
  border: 1px solid rgba(255,80,80,0.25);
  background: rgba(255,60,60,0.08);
  color: #ff8888;
}
#clear-btn:hover { background: rgba(255,60,60,0.18); }
#save-btn {
  border: 1px solid rgba(120,200,255,0.3);
  background: rgba(80,160,255,0.1);
  color: #9cf;
  margin-top: 8px;
}
#save-btn:hover { background: rgba(80,160,255,0.22); }

#hint {
  font-size: 0.72rem;
  opacity: 0.25;
  text-align: center;
  max-width: 600px;
  line-height: 1.6;
}
