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

:root {
  --bg: #0b132b;          /* deep navy */
  --panel: #111831;       /* panel/swatch container bg */
  --ink: #e8eefc;         /* text on dark */
  --muted: #b6c3e3;
  --gold: #ffc107;        /* accent */
  --gold-2: #ffb300;
  --blue-focus: #1f4aa8;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(0,0,0,0.35);

  --swatch-radius: 14px;
}

html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, #13224e 0%, #0b132b 55%, #060b1e 100%);
  color: var(--ink);
  display: grid; place-items: center;
  padding: 24px;
}

.wrap { width: min(980px, 100%); }

.head { text-align: center; margin-bottom: 18px; }
.head h1 { font-size: clamp(1.5rem, 1.2rem + 1.8vw, 2.2rem); }
.head .sub { color: var(--muted); margin-top: 6px; }

/* =========================
   Palette + Swatches
   ========================= */
.palette {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.swatch {
  position: relative;
  border-radius: var(--swatch-radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--panel);
}

/* Button that fills the swatch; background color is set inline */
.swatch-btn {
  display: grid;
  place-items: end center;
  width: 100%;
  aspect-ratio: 5 / 4;
  border: none;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.swatch-btn:hover { filter: brightness(1.03); }
.swatch-btn:focus-visible {
  outline: 3px solid var(--blue-focus);
  outline-offset: -3px;
}

/* Hex overlay label */
.hex {
  width: 100%;
  text-align: center;
  padding: 10px 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px) saturate(1.1);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  background: color-mix(in oklab, currentColor 16%, transparent);
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
}

/* Lock button (emoji) */
.lock {
  position: absolute;
  top: 10px; right: 10px;
  width: 40px; height: 40px;
  z-index: 2;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.22);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.05s ease, background 0.15s ease, border-color 0.15s ease;
}
.lock:hover { background: rgba(0,0,0,0.32); }
.lock:active { transform: translateY(1px); }
.lock[aria-pressed="true"] {
  background: rgba(0,0,0,0.5);
  border-color: rgba(255,255,255,0.45);
}

/* =========================
   Actions / Buttons / Toast
   ========================= */
.actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 16px;
}
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  color: #0b132b;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  box-shadow: 0 8px 20px rgba(255,193,7,0.25);
  transition: transform 0.05s ease, filter 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { filter: brightness(1.02); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 3px solid var(--blue-focus);
  outline-offset: 3px;
}
.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: none;
}

.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-8px); }

/* =========================
   Mobile: stacked rows
   ========================= */
@media (max-width: 820px) {
  .palette {
    grid-template-columns: 1fr;   /* single column */
    gap: 10px;
  }

  .swatch {
    border-radius: 0;            /* full-width stripe look */
  }

  .swatch-btn {
    aspect-ratio: auto;
    height: 100px;               /* stripe height */
    place-items: center;
  }

  .hex { font-size: 1.1rem; }

  .lock { top: 12px; right: 12px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .btn, .swatch-btn, .toast { transition: none; }
}
