* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
  overflow: hidden;
  background: #0b1220;
}

.wallpaper-bg {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  object-position: center;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.wallpaper-bg.visible {
  opacity: 1;
}

/* Subtle vignette so white text remains legible over bright wallpapers */
.wallpaper-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(circle, rgba(8, 15, 28, 0.14) 0%, rgba(8, 15, 28, 0.42) 100%);
}

/* Top Right Navigation */
.top-right-nav {
  position: fixed;
  top: 20px;
  right: 25px;
  display: flex;
  gap: 20px;
  z-index: 1000;
}

.top-right-nav a {
  color: #ffffff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: opacity 0.2s ease;
}

.top-right-nav a:hover {
  opacity: 0.75;
}

/* Centered Greeting */
.top-left-intro {
  position: fixed;
  top: 20px;
  left: 25px;
  text-align: left;
  z-index: 3;
  pointer-events: none;
}

.top-left-intro h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

/* Bottom Right Info + Download Pill */
.bottom-right-controls {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-info,
.download-btn {
  font-size: 0.78rem;
  color: rgba(248, 250, 252, 0.95);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.download-btn {
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.download-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Color Picker */
.picker {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 3;
  width: 236px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
}

.sv-stage {
  position: relative;
  height: 118px;
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
}

.sv-plane {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(to top, #000, transparent),
    linear-gradient(to right, #fff, var(--hue, #ff00aa));
}

.sv-cursor,
.hue-cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.picker-row {
  display: grid;
  grid-template-columns: 28px 28px 1fr;
  align-items: center;
  gap: 8px;
  margin: 10px 4px 8px;
}

.eyedropper {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: #334155;
  border-radius: 8px;
  cursor: pointer;
}

.eyedropper:hover,
.eyedropper.active {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.hue-stage {
  position: relative;
  height: 14px;
  cursor: pointer;
}

.hue-track {
  height: 8px;
  margin-top: 3px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #ff0000,
    #ffff00,
    #00ff00,
    #00ffff,
    #0000ff,
    #ff00ff,
    #ff0000
  );
}

.hue-cursor {
  top: 7px;
}

.rgb-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 2px 4px;
}

.rgb-row label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.rgb-row span {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: #64748b;
}

.rgb-row input {
  width: 100%;
  height: 32px;
  text-align: center;
  font-size: 0.92rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: #0f172a;
  outline: none;
}

.rgb-row input:focus {
  border-color: #94a3b8;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: #0b1220;
  color: #7dd3fc;
}

.loading-screen.hidden {
  display: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(125, 211, 252, 0.2);
  border-top-color: #7dd3fc;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .bottom-right-controls {
    top: 56px;
    bottom: auto;
    right: 16px;
    left: 16px;
    justify-content: center;
  }
}