/* ──────────────────────────────────────────────
   Design tokens
   ────────────────────────────────────────────── */
:root {
  --bg:           #1a1a2e;
  --bg-surface:   #16213e;
  --bg-elevated:  #0f3460;
  --accent:       #e94560;
  --text:         #eaeaea;
  --text-muted:   #8892a4;
  --radius:       8px;
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --topbar-h:     48px;
  --palette-h:    72px;
  --transition:   0.2s ease;
}

/* ──────────────────────────────────────────────
   Reset & base
   ────────────────────────────────────────────── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

/* ──────────────────────────────────────────────
   Top bar
   ────────────────────────────────────────────── */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(22, 33, 62, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  z-index: 100;
  user-select: none;
}

.topbar-left,
.topbar-right,
.topbar-center {
  display: flex;
  align-items: center;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  background: linear-gradient(135deg, var(--accent), #ff7eb3);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
}

#coords {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.zoom-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elevated);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* ──────────────────────────────────────────────
   Canvas viewport
   ────────────────────────────────────────────── */
#viewport {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: var(--palette-h);
  overflow: hidden;
  cursor: crosshair;
  background:
    radial-gradient(circle at 50% 50%, rgba(15,52,96,0.4) 0%, transparent 70%),
    var(--bg);
}

#canvas,
#cursor-canvas {
  position: absolute;
  top: 0; left: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#cursor-canvas {
  pointer-events: none;
}

/* ──────────────────────────────────────────────
   Palette bar
   ────────────────────────────────────────────── */
#palette-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--palette-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 33, 62, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255,255,255,0.06);
  z-index: 100;
  user-select: none;
}

#palette {
  display: flex;
  gap: 6px;
  padding: 0 12px;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 720px;
}

.palette-swatch {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  position: relative;
}

.palette-swatch:hover {
  transform: scale(1.18);
  z-index: 2;
}

.palette-swatch.selected {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent), 0 4px 14px rgba(233,69,96,0.35);
  transform: scale(1.22);
  z-index: 3;
}

/* ──────────────────────────────────────────────
   Cooldown overlay
   ────────────────────────────────────────────── */
#cooldown-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(22, 33, 62, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

#cooldown-overlay.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#cooldown-overlay.ready-flash {
  opacity: 1;
  transform: translateY(0);
  animation: cooldown-flash 0.6s ease forwards;
}

@keyframes cooldown-flash {
  0%   { background: rgba(0, 204, 120, 0.35); }
  100% { background: rgba(22, 33, 62, 0);  opacity: 0; transform: translateY(100%); }
}

.cooldown-content {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.cooldown-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
  animation: cooldown-pulse 1.5s ease-in-out infinite;
}

@keyframes cooldown-pulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.1); }
}

.cooldown-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  min-width: 50px;
  text-align: center;
}

.cooldown-progress-track {
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.cooldown-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #ff7eb3);
  transition: width 0.08s linear;
  box-shadow: 0 0 8px rgba(233, 69, 96, 0.4);
}

/* Dim palette swatches during cooldown */
#palette.cooldown-active .palette-swatch {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(0.6);
  transition: opacity 0.3s ease, filter 0.3s ease;
}

/* ──────────────────────────────────────────────
   Scrollbar (hidden)
   ────────────────────────────────────────────── */
::-webkit-scrollbar { display: none; }
