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

:root {
  --storm-deep:    #060d1a;
  --storm-mid:     #0a1628;
  --storm-cloud:   #111f35;
  --storm-mist:    #1a2d48;
  --rain-streak:   rgba(140,190,255,0.18);
  --text-bright:   #cde4ff;
  --text-dim:      rgba(140,180,220,0.45);
  --accent-glow:   #4aa3ff;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--storm-deep);
  cursor: crosshair;
}

/* ── Layered sky ── */
#sky {
  position: fixed; inset: 0;
  background: linear-gradient(180deg,
    #030912 0%,
    #07111f 30%,
    #0d1e35 60%,
    #0f2240 80%,
    #102540 100%
  );
  z-index: 0;
}

/* ── Cloud layer ── */
#clouds {
  position: fixed; inset: 0;
  z-index: 1;
  overflow: hidden;
}
.cloud-band {
  position: absolute;
  width: 200%;
  height: 120px;
  background: radial-gradient(ellipse 60% 100% at 50% 50%,
    rgba(15,32,58,0.9) 0%, transparent 70%);
  animation: driftCloud linear infinite;
}
.cloud-band:nth-child(1){ top: -20px; animation-duration: 90s; opacity: 0.8; }
.cloud-band:nth-child(2){ top: 40px;  animation-duration: 130s; animation-direction: reverse; opacity: 0.6; }
.cloud-band:nth-child(3){ top: 80px;  animation-duration: 75s;  opacity: 0.5; }

@keyframes driftCloud {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── Background rain streaks ── */
#bg-rain {
  position: fixed; inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.bg-streak {
  position: absolute;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--rain-streak), transparent);
  animation: bgFall linear infinite;
  top: -100%;
}
@keyframes bgFall {
  to { transform: translateY(200vh); }
}

/* ── Lightning ── */
#lightning-flash {
  position: fixed; inset: 0;
  background: rgba(200,230,255,0);
  z-index: 3;
  pointer-events: none;
  transition: background 0.05s;
}

/* ── Main canvas ── */
canvas {
  position: fixed; inset: 0;
  z-index: 4;
}

/* ── UI ── */
#ui {
  position: fixed; inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 44px 32px;
}

#header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

#title h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(36px, 5.5vw, 72px);
  color: var(--text-bright);
  letter-spacing: 0.12em;
  line-height: 1;
  text-shadow: 0 0 40px rgba(74,163,255,0.3);
}
#title h1 em {
  font-style: italic;
  font-weight: 300;
  color: #7ec8ff;
}
#title sub {
  display: block;
  font-family: 'Courier Prime', monospace;
  font-size: 10px;
  letter-spacing: 0.35em;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 6px;
}

#counters {
  text-align: right;
  font-family: 'Courier Prime', monospace;
}
#counters .line {
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--text-dim);
  text-transform: uppercase;
  line-height: 2.2;
}
#counters .line strong {
  color: #7ec8ff;
  font-size: 13px;
}

/* ── Palette river at bottom ── */
#palette-river {
  display: flex;
  gap: 3px;
  height: 28px;
  align-items: stretch;
}
.p-swatch {
  flex: 1;
  border-radius: 2px;
  transition: background 1s ease, transform 0.3s ease;
  position: relative;
  overflow: hidden;
}
.p-swatch::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.15), transparent);
  border-radius: 2px;
}

/* ── Hover hint ── */
#hint {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 11;
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.32em;
  color: rgba(140,180,220,0.25);
  text-transform: uppercase;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Current color tooltip ── */
#color-tooltip {
  position: fixed;
  z-index: 20;
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  color: #fff;
  background: rgba(6,13,26,0.85);
  border: 1px solid rgba(74,163,255,0.3);
  padding: 5px 12px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  backdrop-filter: blur(6px);
}

/* ── CodePen tags ── */
#tags {
  position: fixed;
  bottom: 52px;
  right: 44px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  pointer-events: none;
}
.cp-tag {
  font-family: 'Courier Prime', monospace;
  font-size: 8px;
  letter-spacing: 0.28em;
  color: rgba(100,160,210,0.28);
  text-transform: lowercase;
}
.cp-tag::before {
  content: '#';
  color: rgba(74,163,255,0.2);
}

/* ── Russell badge ── */
.russell-badge {
  position: fixed;
  bottom: 44px;
  left: 44px;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 5px 14px 5px 11px;
  border: 1px solid rgba(74,163,255,0.15);
  border-radius: 2px;
  background: rgba(6,13,26,0.45);
  backdrop-filter: blur(8px);
  cursor: pointer;
  transition: border-color 0.4s, background 0.4s;
  overflow: hidden;
}
.russell-badge:hover {
  border-color: rgba(74,163,255,0.38);
  background: rgba(10,22,40,0.65);
}
.russell-badge:hover .badge-glow {
  opacity: 1;
}
.russell-badge:hover .badge-text {
  color: rgba(160,210,255,0.7);
}
.badge-text {
  font-family: 'Courier Prime', monospace;
  font-size: 9px;
  letter-spacing: 0.32em;
  color: rgba(100,155,200,0.38);
  text-transform: lowercase;
  position: relative;
  z-index: 1;
  transition: color 0.4s;
}
.badge-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(74,163,255,0.08) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}