﻿/* override global html background so scrolling past the fixed canvas shows the right colour */
html { background: var(--ht-bg); }

/* ── HALFTONE OVERRIDES ─────────────────────────────────── */
header h1              { color: var(--ht-ink) !important; }
.subtitle              { color: rgba(var(--ht-ink-raw),.55) !important; }
.control-label         { color: rgba(var(--ht-ink-raw),.55) !important; }
.control-hint          { color: rgba(var(--ht-ink-raw),.4) !important; }

.panel {
  background: rgba(var(--ht-ink-raw),.04) !important;
  border: 1.5px solid rgba(var(--ht-ink-raw),.2) !important;
  border-radius: 4px !important;
}

.count-stepper {
  background: rgba(var(--ht-ink-raw),.05) !important;
  border: 1.5px solid rgba(var(--ht-ink-raw),.2) !important;
  border-radius: 4px !important;
}
.count-btn { color: var(--ht-ink) !important; }
.count-btn:hover { background: rgba(var(--ht-ink-raw),.08) !important; color: var(--ht-ink) !important; }
.count-display { color: var(--ht-ink) !important; }

.pill {
  background: rgba(var(--ht-ink-raw),.05) !important;
  border: 1px solid rgba(var(--ht-ink-raw),.2) !important;
  color: rgba(var(--ht-ink-raw),.65) !important;
  border-radius: 4px !important;
}
.pill:hover {
  background: rgba(var(--ht-ink-raw),.1) !important;
  color: var(--ht-ink) !important;
  border-color: rgba(var(--ht-ink-raw),.35) !important;
}
.pill.active { background: var(--ht-ink) !important; border-color: var(--ht-ink) !important; color: var(--ht-bg) !important; }

.shades-panel {
  background: rgba(var(--ht-ink-raw),.04) !important;
  border: 1.5px solid rgba(var(--ht-ink-raw),.2) !important;
  border-radius: 4px !important;
}
.shades-header { color: var(--ht-ink) !important; }
.shades-hint   { color: rgba(var(--ht-ink-raw),.5) !important; }
.shades-close {
  background: rgba(var(--ht-ink-raw),.06) !important;
  border-color: rgba(var(--ht-ink-raw),.2) !important;
  color: var(--ht-ink) !important;
  border-radius: 4px !important;
}
.shades-close:hover { background: var(--ht-ink) !important; color: var(--ht-bg) !important; }
.shade-swatch.current-shade { border-color: var(--ht-ink) !important; box-shadow: 0 0 0 2px var(--ht-accent) !important; }

.btn-generate {
  border-radius: 4px !important;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: var(--font-ui) !important;
}
.btn-generate:hover { box-shadow: none !important; }

.btn-copy-all {
  background: rgba(var(--ht-ink-raw),.05) !important;
  color: var(--ht-ink) !important;
  border: 1.5px solid rgba(var(--ht-ink-raw),.2) !important;
  border-radius: 4px !important;
}
.btn-copy-all:hover {
  background: var(--ht-ink) !important;
  color: var(--ht-bg) !important;
  border-color: var(--ht-ink) !important;
}

.hint { color: rgba(var(--ht-ink-raw),.5) !important; }
kbd {
  background: rgba(var(--ht-ink-raw),.08) !important;
  border: 1px solid rgba(var(--ht-ink-raw),.2) !important;
  color: var(--ht-ink) !important;
}

.faq h2 { color: var(--ht-ink) !important; border-bottom-color: rgba(var(--ht-ink-raw),.15) !important; }
.faq details { border-bottom-color: rgba(var(--ht-ink-raw),.1) !important; }
.faq summary { color: var(--ht-ink) !important; }
.faq summary:hover { color: var(--ht-accent) !important; }
.faq summary::after { color: rgba(var(--ht-ink-raw),.4) !important; }

.logo-img { filter: none !important; }

/* Colour picker popup — light theme */
#cp-popup {
  background: var(--ht-bg) !important;
  border: 2px solid var(--ht-ink) !important;
  color: var(--ht-ink) !important;
}
/* ── END HALFTONE OVERRIDES ─────────────────────────────── */

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

body {
  background-color: var(--ht-bg);
  color: var(--ht-ink);
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
}

#canvas-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: transparent;
}

.container {
  max-width: 1600px;
  margin: 2rem auto 1rem;
  padding: 0 1rem;
  flex: 1;
  width: 100%;
}

/* ── Header ───────────────────────────────────────────── */
header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.logo-img {
  height: 60px;
  width: auto;
  filter: drop-shadow(0 0 12px rgba(52,84,209,.25));
  transition: transform .2s ease;
}

.logo-link:hover .logo-img { transform: scale(1.05); }

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
  margin-bottom: .4rem;
}

.subtitle {
  color: rgba(230,235,224,.5);
  font-size: .95rem;
}

/* ── Panel ────────────────────────────────────────────── */
.panel {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  margin-bottom: 2.5rem;
}

/* ── Controls bar ─────────────────────────────────────── */
.controls-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  margin-bottom: 1.5rem;
  align-items: flex-start;
}

.control-group { display: flex; flex-direction: column; gap: .5rem; }
.control-group--wide { flex: 1; min-width: 280px; }

.control-label {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(230,235,224,.45);
}

.control-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: rgba(230,235,224,.3);
}

/* count stepper */
.count-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  overflow: hidden;
  width: fit-content;
}

.count-btn {
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  color: rgba(230,235,224,.8);
  font-size: 1.3rem;
  font-family: var(--font-text);
  cursor: pointer;
  transition: background .15s, color .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.count-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.count-btn:disabled { opacity: .3; cursor: not-allowed; }

.count-display {
  width: 36px;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  user-select: none;
}

/* harmony pills */
.harmony-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.pill {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: rgba(230,235,224,.65);
  border-radius: 999px;
  padding: .35rem .9rem;
  font-family: var(--font-text);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s, color .18s;
  white-space: nowrap;
}

.pill:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.25); }
.pill.active { background: var(--brand-blue); border-color: var(--brand-blue); color: #fff; }

/* ── Palette wrapper ──────────────────────────────────── */
.palette-wrap { margin-bottom: 1rem; }

.palette {
  display: flex;
  border-radius: 14px;
  overflow: hidden;
  /* height set by JS via --count custom prop */
  height: 380px;
}

/* ── Swatch ───────────────────────────────────────────── */
.swatch {
  position: relative;
  flex: 1;
  min-width: 0;
  cursor: pointer;
  transition: flex .25s ease;
  overflow: hidden;
  /* no gap — colours touch each other */
}

.swatch:hover { flex: 1.35; }

/* swatch body is clickable */
.swatch { cursor: pointer; }

/* ── Swatch overlay (shows on hover / focus-within) ───── */
.swatch-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 8px 12px;
  opacity: 0;
  transition: opacity .18s ease;
  pointer-events: none; /* overlay itself doesn't block clicks */
}

.swatch:hover .swatch-overlay,
.swatch:focus-within .swatch-overlay,
.swatch.locked .swatch-overlay { opacity: 1; }

/* make buttons inside overlay interactive */
.swatch-overlay button { pointer-events: auto; }

/* top row: copy + lock */
.swatch-top {
  display: flex;
  justify-content: center;
  gap: 6px;
}

/* click-hint label */
.swatch-click-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
  pointer-events: none;
  padding: 4px 10px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity .18s;
}

.swatch:hover .swatch-click-hint { opacity: 1; }

.swatch.light .swatch-click-hint { background: rgba(255,255,255,.35); color: rgba(0,0,0,.65); }
.swatch.dark  .swatch-click-hint { background: rgba(0,0,0,.3);        color: rgba(255,255,255,.7); }

/* bottom row: move left + hex + shades + move right */
.swatch-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* icon buttons */
.swatch-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  z-index: 2;
  position: relative;
}

.swatch-btn svg { width: 14px; height: 14px; display: block; }

.swatch.light .swatch-btn { background: rgba(255,255,255,.4); }
.swatch.dark  .swatch-btn { background: rgba(0,0,0,.28); }

.swatch.light .swatch-btn svg { stroke: #1a1a1e; }
.swatch.dark  .swatch-btn svg { stroke: #fff; }

.swatch.light .swatch-btn:hover { background: rgba(255,255,255,.65); transform: scale(1.1); }
.swatch.dark  .swatch-btn:hover { background: rgba(0,0,0,.5);        transform: scale(1.1); }

/* shades button — text pill */
.swatch-shades-btn {
  border-radius: 20px;
  border: none;
  cursor: pointer;
  font-family: var(--font-text);
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 4px 9px;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  z-index: 2;
  position: relative;
  white-space: nowrap;
}

.swatch.light .swatch-shades-btn { background: rgba(255,255,255,.4); color: rgba(0,0,0,.7); }
.swatch.dark  .swatch-shades-btn { background: rgba(0,0,0,.28);      color: rgba(255,255,255,.85); }

.swatch.light .swatch-shades-btn:hover { background: rgba(255,255,255,.65); transform: scale(1.05); }
.swatch.dark  .swatch-shades-btn:hover { background: rgba(0,0,0,.5);        transform: scale(1.05); }

/* move arrow buttons — hide first/last where irrelevant (set via JS data attr) */
.swatch-btn.move-btn[disabled] { opacity: 0; pointer-events: none; }

/* hex code button */
.swatch-hex {
  font-family: var(--font-text);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background .15s;
  z-index: 2;
  position: relative;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.swatch.light .swatch-hex { color: rgba(0,0,0,.75); }
.swatch.dark  .swatch-hex { color: rgba(255,255,255,.9); }

.swatch.light .swatch-hex:hover { background: rgba(255,255,255,.4); }
.swatch.dark  .swatch-hex:hover { background: rgba(0,0,0,.25); }

/* lock indicator ring when locked */
.swatch.locked { outline: 3px solid rgba(255,255,255,.55); outline-offset: -3px; }

/* copied flash */
.copied-flash {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-text);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .8px;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(0,0,0,.55);
  color: #4ade80;
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
  z-index: 10;
  white-space: nowrap;
}

.copied-flash.show { opacity: 1; }

/* drag feedback */
.swatch.drag-over { outline: 3px solid #fff; outline-offset: -3px; }
.swatch.dragging  { opacity: .4; }

/* ── Shades panel ─────────────────────────────────────── */
.shades-panel {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  animation: slideDown .2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.shades-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
  font-size: .9rem;
  color: rgba(230,235,224,.8);
  gap: 1rem;
}

.shades-hint {
  font-size: .75rem;
  color: rgba(230,235,224,.4);
  margin-bottom: .75rem;
}

.shades-close {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(230,235,224,.7);
  border-radius: 6px;
  padding: .3rem .7rem;
  font-family: var(--font-text);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.shades-close:hover { background: rgba(255,255,255,.15); color: #fff; }

.shades-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.shade-swatch {
  flex: 1;
  min-width: 50px;
  height: 64px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
  position: relative;
  overflow: hidden;
}

.shade-swatch:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,.6);
}

.shade-swatch.current-shade {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--brand-blue);
}

.shade-label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .5px;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Action row ───────────────────────────────────────── */
.action-row {
  display: flex;
  gap: .75rem;
  margin-bottom: 1rem;
}

.btn-generate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .85rem 1.5rem;
  background: var(--brand-blue);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font-text);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s, transform .1s, box-shadow .2s;
}

.btn-generate:hover {
  background: #4a6be8;
  box-shadow: 0 4px 18px rgba(52,84,209,.45);
}

.btn-generate:active { transform: translateY(1px); }

.btn-copy-all {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .85rem 1.25rem;
  background: rgba(255,255,255,.07);
  color: rgba(230,235,224,.75);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  font-family: var(--font-text);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s;
}

.btn-copy-all:hover {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-color: rgba(255,255,255,.25);
}

.btn-copy-all:active { transform: translateY(1px); }

/* ── Hint ─────────────────────────────────────────────── */
.hint {
  font-size: .8rem;
  color: rgba(230,235,224,.35);
  text-align: center;
  line-height: 1.5;
}

kbd {
  font-family: var(--font-text);
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: .78rem;
  color: rgba(230,235,224,.6);
}

/* ── FAQ ──────────────────────────────────────────────── */
.faq {
  margin-bottom: 3rem;
}

.faq h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ht-ink);
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--ht-ink);
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

.faq details {
  border-bottom: 1px solid rgba(var(--ht-ink-raw),0.15);
}

.faq details:last-child {
  border-bottom: none;
}

.faq summary {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ht-ink);
  padding: 1rem 0;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: color .15s;
  font-family: var(--font-body);
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "+";
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ht-ink);
  flex-shrink: 0;
  margin-left: 1rem;
  transition: transform .2s;
}

.faq details[open] summary::after { transform: rotate(45deg); }

.faq summary:hover { color: var(--ht-accent); }

.faq details > p,
.faq details > ul {
  font-size: .95rem;
  color: var(--ht-ink);
  opacity: 0.8;
  line-height: 1.65;
  padding-bottom: 1rem;
  font-family: var(--font-body);
}

.faq details > ul {
  padding-left: 1.25rem;
}

.faq details > ul li { margin-bottom: .35rem; }

.faq details strong { color: var(--ht-ink); opacity: 1; }
.faq details kbd {
  font-size: .78rem;
  color: rgba(230,235,224,.6);
}

/* ── Footer ───────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 1rem;
  font-family: var(--font-text);
  font-size: .9rem;
  color: #444;
}

/* ── Tool sections (Adjust / CB) ─────────────────────── */
.tool-section {
  border: 1.5px solid rgba(var(--ht-ink-raw),.25);
  border-radius: 12px;
  margin-bottom: .75rem;
  overflow: hidden;
}

.tool-section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .9rem 1rem;
  background: rgba(var(--ht-ink-raw),.04);
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-text);
  color: var(--ht-ink);
  transition: background .18s;
}

.tool-section-toggle:hover { background: rgba(var(--ht-ink-raw),.08); }

.ts-icon { flex-shrink: 0; display: flex; opacity: .7; }
.ts-icon svg { stroke: var(--ht-ink); }

.ts-title {
  font-size: .9rem;
  font-weight: 700;
  flex-shrink: 0;
}

.ts-sub {
  font-size: .78rem;
  color: rgba(var(--ht-ink-raw),.6);
  flex: 1;
}

.ts-chevron {
  flex-shrink: 0;
  transition: transform .22s ease;
  stroke: rgba(var(--ht-ink-raw),.55);
}

.tool-section-toggle[aria-expanded="true"] .ts-chevron { transform: rotate(180deg); }

.tool-section-body {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid rgba(var(--ht-ink-raw),.15);
  animation: slideDown .18s ease;
}

/* ── Sliders ──────────────────────────────────────────── */
.sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
  margin-bottom: 1rem;
}

.slider-row { display: flex; flex-direction: column; gap: .4rem; }

.slider-label-row { display: flex; flex-direction: column; gap: .15rem; }

.slider-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--ht-ink);
}

.slider-hint {
  font-size: .72rem;
  color: rgba(var(--ht-ink-raw),.55);
}

.slider-input-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.adj-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: rgba(var(--ht-ink-raw),.25);
  outline: none;
  cursor: pointer;
}

.adj-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ht-ink);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  transition: transform .1s;
}

.adj-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.adj-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ht-ink); cursor: pointer; border: none;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.slider-val {
  font-size: .78rem;
  font-weight: 700;
  color: rgba(var(--ht-ink-raw),.7);
  min-width: 38px;
  text-align: right;
}

.slider-endpoint { font-size: .9rem; flex-shrink: 0; }

.btn-reset {
  background: rgba(var(--ht-ink-raw),.05);
  border: 1.5px solid rgba(var(--ht-ink-raw),.3);
  color: var(--ht-ink);
  border-radius: 8px;
  padding: .5rem 1rem;
  font-family: var(--font-text);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.btn-reset:hover { background: var(--ht-ink); color: var(--ht-bg); }

/* ── Colour Blindness ─────────────────────────────────── */
.cb-controls { margin-bottom: 1rem; display: flex; flex-direction: column; gap: .4rem; }
.cb-strength-row { margin-top: .3rem; }

.cb-select {
  background: var(--ht-bg);
  border: 1.5px solid rgba(var(--ht-ink-raw),.35);
  color: var(--ht-ink);
  padding: .65rem .9rem;
  border-radius: 8px;
  font-family: var(--font-text);
  font-size: .88rem;
  cursor: pointer;
  max-width: 460px;
  transition: border-color .15s;
}

.cb-select:focus { outline: none; border-color: var(--brand-blue); }

.cb-preview { animation: slideDown .18s ease; }

.cb-row-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: rgba(var(--ht-ink-raw),.6);
  margin-bottom: .4rem;
}

.cb-row-label--sim { margin-top: .9rem; color: #3454D1; }

.cb-palette-row {
  display: flex;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
}

.cb-swatch { flex: 1; }

.cb-explainer {
  margin-top: .75rem;
  font-size: .82rem;
  color: rgba(var(--ht-ink-raw),.75);
  line-height: 1.6;
}

/* ── Mobile ───────────────────────────────────────────── */
@media (max-width: 680px) {
  .container { margin: 1.5rem auto; }
  header h1  { font-size: 1.6rem; }

  .panel { padding: 1.1rem; border-radius: 12px; }

  .controls-bar { gap: 1rem; }
  .control-group--wide { min-width: 100%; }

  /* stack swatches vertically on mobile */
  .palette {
    flex-direction: column;
    height: auto;
    border-radius: 12px;
  }

  .swatch {
    height: 90px;
    flex: none !important;
  }

  .swatch:hover { flex: none; }

  .swatch-overlay {
    flex-direction: row;
    align-items: center;
    padding: 0 10px;
    opacity: 1; /* always visible on mobile */
  }

  .swatch-top { flex-direction: row; }

  .swatch-click-hint { display: none; }

  .swatch-bottom {
    gap: 6px;
    flex-wrap: nowrap;
  }

  /* on mobile move arrows become up/down */
  .move-left svg  { transform: rotate(90deg); }
  .move-right svg { transform: rotate(90deg) scaleX(-1); }

  .shades-row { gap: 4px; }
  .shade-swatch { min-width: 38px; height: 54px; }

  .sliders-grid { grid-template-columns: 1fr; }

  .cb-select { max-width: 100%; }
}

/* ── Custom Colour Picker Popup ───────────────────────────── */

#cp-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
}

#cp-popup {
  position: fixed;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  width: 320px;
  background: #1e1e22;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: 0 24px 64px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.04);
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

#cp-popup[hidden],
#cp-backdrop[hidden] { display: none; }

.cp-title {
  font-size: .85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(230,235,224,.5);
  text-align: center;
  margin: 0;
}

/* SL (saturation/value) picker area */
#cp-sl {
  position: relative;
  width: 100%;
  height: 186px;
  border-radius: 10px;
  cursor: crosshair;
  overflow: hidden;
  flex-shrink: 0;
  touch-action: none;
}

#cp-cursor {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: none;
}

/* Hue slider */
.cp-row {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.cp-row-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: rgba(230,235,224,.4);
}

#cp-hue {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  border-radius: 7px;
  outline: none;
  border: none;
  cursor: pointer;
  background: linear-gradient(to right,
    hsl(0,100%,50%),   hsl(30,100%,50%),  hsl(60,100%,50%),
    hsl(90,100%,50%),  hsl(120,100%,50%), hsl(150,100%,50%),
    hsl(180,100%,50%), hsl(210,100%,50%), hsl(240,100%,50%),
    hsl(270,100%,50%), hsl(300,100%,50%), hsl(330,100%,50%),
    hsl(360,100%,50%));
}

#cp-hue::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,.25);
  box-shadow: 0 1px 6px rgba(0,0,0,.45);
  cursor: grab;
}
#cp-hue::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid rgba(0,0,0,.25);
  box-shadow: 0 1px 6px rgba(0,0,0,.45);
  cursor: grab;
}

/* Footer: preview swatches + hex input */
.cp-footer {
  display: flex;
  align-items: flex-end;
  gap: .75rem;
}

.cp-preview {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.cp-swatch {
  width: 54px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}

.cp-preview-labels {
  display: flex;
  justify-content: space-between;
  font-size: .62rem;
  color: rgba(230,235,224,.35);
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  width: 54px;
}

.cp-preview {
  width: 54px;
}

.cp-hex-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.cp-hex-wrap {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  overflow: hidden;
  padding: 0 .6rem;
  gap: .2rem;
}

.cp-hash {
  color: rgba(230,235,224,.45);
  font-size: .9rem;
  font-weight: 600;
  font-family: monospace;
}

#cp-hex-input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: .9rem;
  font-family: monospace;
  font-weight: 600;
  width: 100%;
  padding: .5rem 0;
  letter-spacing: .5px;
  text-transform: uppercase;
}

/* Action buttons */
.cp-actions {
  display: flex;
  gap: .6rem;
}

.cp-btn {
  flex: 1;
  padding: .6rem 1rem;
  border-radius: 10px;
  border: none;
  font-family: var(--font-text);
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s, box-shadow .15s;
}

.cp-cancel {
  background: rgba(255,255,255,.08);
  color: rgba(230,235,224,.7);
  border: 1px solid rgba(255,255,255,.1);
}
.cp-cancel:hover {
  background: rgba(255,255,255,.13);
  color: #fff;
}

.cp-confirm {
  background: var(--brand-blue, #3454D1);
  color: #fff;
  box-shadow: 0 4px 16px rgba(52,84,209,.35);
}
.cp-confirm:hover {
  background: #4466e8;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(52,84,209,.5);
}
.cp-confirm:active { transform: translateY(0); }

@media (max-width: 360px) {
  #cp-popup { width: calc(100vw - 2rem); }
}
