/* ---------- Topbar help button -------------------------------------------- */

.topbar-help {
  padding: 0.3rem 0.75rem;
  border: 2px solid var(--ink); border-radius: 100px;
  background: var(--paper); color: var(--ink);
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 0.82rem;
  line-height: 1; cursor: pointer;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  margin-right: 0.1rem;
  transition: transform 0.22s var(--ease-back), box-shadow 0.22s var(--ease-back), background 0.12s ease;
}
.topbar-help:hover { background: var(--sun); transform: translate(-2px, -2px) rotate(-2deg); box-shadow: 3.5px 3.5px 0 var(--ink); }
.topbar-help:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
/* Default: show the word; swap to "?" glyph on narrow screens. */
.topbar-help .help-short { display: none; }

/* ---------- Image adjust panel ------------------------------------------- */

.adj-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem; margin-top: 0.1rem;
}
.adj-btn {
  padding: 0.35rem 0.1rem;
  background: var(--paper); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 8px;
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 0.72rem;
  cursor: pointer; box-shadow: 1.5px 1.5px 0 var(--ink);
  transition: transform 0.22s var(--ease-back), box-shadow 0.22s var(--ease-back), background 0.12s ease;
  line-height: 1;
}
.adj-btn:hover { background: var(--cream); transform: translate(-2px, -2px); box-shadow: 3.5px 3.5px 0 var(--ink); }
.adj-btn:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.adj-btn.active { background: var(--lime); box-shadow: inset 0 0 0 2px var(--ink); transform: none; }

.adj-slider { margin-top: 0.1rem; }

.adj-reset {
  align-self: flex-end;
  padding: 0.3rem 0.65rem;
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px dashed var(--ink-muted); border-radius: 100px;
  font-family: 'Fredoka', sans-serif; font-size: 0.7rem; font-weight: 500;
  cursor: pointer;
  transition: color 0.1s ease, border-color 0.1s ease;
}
.adj-reset:hover { color: var(--ink); border-color: var(--ink); }

/* Secondary, low-key upload control used at the bottom of the Image panel
   once the user is already in the studio — the primary CTA is the landing
   drop zone, so this one should read as "swap" rather than "get started". */
.upload-replace-wrap {
  margin-top: 0.5rem;
  padding-top: 0.6rem;
  border-top: 1.5px dashed rgba(43, 30, 15, 0.2);
  display: flex; flex-direction: column; gap: 0.3rem;
}
.upload-replace {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem; padding: 0.4rem 0.75rem;
  background: var(--paper); color: var(--ink-soft);
  border: 1.5px dashed var(--ink-muted); border-radius: 100px;
  font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 0.78rem;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.upload-replace:hover { color: var(--ink); border-color: var(--ink); border-style: solid; background: var(--cream); }
.upload-replace span { font-size: 0.95rem; line-height: 1; }

/* ---------- Palette exclude indicators ----------------------------------- */

/* Ban badge on the pal-cell blob: hidden by default, revealed when the
   cell has `.excluded`. A red circle with an ✕ glyph sat bottom-left so
   it doesn't collide with the used-checkmark corner. */
.pal-ban {
  position: absolute;
  left: -6%; bottom: -6%;
  width: 44%; height: 44%;
  background: var(--coral-deep);
  color: #FFFDF6;
  border: 2.5px solid #FFF6DC;
  border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 0.7em;
  pointer-events: none;
  box-shadow: 1px 1px 0 rgba(43, 30, 15, 0.45);
  z-index: 4;
}
.pal-cell.excluded .pal-ban { display: flex; }
.pal-cell.excluded { filter: grayscale(0.8); opacity: 0.55; }
.pal-cell.excluded .pal-blob { opacity: 0.5; }

.swatch.excluded { opacity: 0.55; filter: grayscale(0.6); }
.swatch .swatch-box { position: relative; }
.swatch-ban {
  position: absolute;
  inset: -4px;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(249, 85, 92, 0.85);
  color: #FFFDF6;
  border: 1.5px solid var(--ink); border-radius: 8px;
  font-family: 'Fredoka', sans-serif; font-weight: 800; font-size: 1.2rem;
  pointer-events: none;
}
.swatch.excluded .swatch-ban { display: flex; }

.excluded-strip {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  padding: 0.5rem 0.6rem; margin-bottom: 0.6rem;
  background: color-mix(in srgb, var(--coral) 15%, var(--paper));
  border: 1.5px dashed var(--coral-deep); border-radius: 10px;
  flex-basis: 100%;
}
.excluded-strip-title {
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 0.72rem;
  color: var(--ink); letter-spacing: 0.02em;
}
.excluded-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.2rem 0.5rem;
  background: var(--paper); border: 1.5px solid var(--ink); border-radius: 100px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; font-weight: 600;
  cursor: pointer; color: var(--ink);
  box-shadow: 1px 1px 0 var(--ink);
  transition: transform 0.22s var(--ease-back), box-shadow 0.22s var(--ease-back);
}
.excluded-chip:hover { transform: translate(-2px, -2px) rotate(-2deg); box-shadow: 2.5px 2.5px 0 var(--ink); background: var(--sun); }
.excluded-chip-dot {
  width: 12px; height: 12px;
  border: 1.2px solid var(--ink); border-radius: 3px;
}
.excluded-chip-x { font-family: 'Fredoka', sans-serif; color: var(--coral-deep); font-weight: 700; }
.excluded-clear {
  margin-left: auto;
  padding: 0.2rem 0.6rem;
  background: var(--coral-deep); color: #FFFDF6;
  border: 1.5px solid var(--ink); border-radius: 100px;
  font-family: 'Fredoka', sans-serif; font-size: 0.7rem; font-weight: 700;
  cursor: pointer; box-shadow: 1px 1px 0 var(--ink);
}
.excluded-clear:hover { background: #CE3A40; transform: translate(-1px, -1px); box-shadow: 2px 2px 0 var(--ink); }

/* ---------- Palette "mark as done" indicators --------------------------- */

/* Done colours are still in the design — users mark them so finished
   paints stop competing for attention in the palette strip. Muted but not
   as aggressively as .excluded, and using a diagonal strike so it reads
   as "crossed off a list" rather than "removed". */
.pal-cell.completed:not(.excluded) { opacity: 0.45; filter: saturate(0.6); }
.pal-cell.completed:not(.excluded) .pal-blob { opacity: 0.7; }
.swatch.completed:not(.excluded) { opacity: 0.5; filter: saturate(0.6); }
.swatch.completed:not(.excluded) .swatch-box::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top right, transparent calc(50% - 1.5px), var(--ink) calc(50% - 1.5px), var(--ink) calc(50% + 1.5px), transparent calc(50% + 1.5px));
  pointer-events: none;
}
.swatch.completed:not(.excluded) .swatch-hex { text-decoration: line-through; }

/* ---------- Swatch right-click menu ------------------------------------- */

.swatch-menu {
  position: fixed; z-index: 1200;
  min-width: 180px;
  padding: 0.35rem;
  background: var(--paper);
  border: 1.5px solid var(--ink); border-radius: 10px;
  box-shadow: 3px 3px 0 var(--ink);
  display: none;
  font-family: 'Fredoka', sans-serif;
}
.swatch-menu.show { display: block; }
.swatch-menu-head {
  display: flex; align-items: center; gap: 0.4rem;
  padding: 0.25rem 0.5rem 0.35rem;
  border-bottom: 1px dashed var(--ink-muted);
  margin-bottom: 0.3rem;
}
.swatch-menu-dot {
  width: 14px; height: 14px;
  border: 1.2px solid var(--ink); border-radius: 3px;
}
.swatch-menu-hex {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem; font-weight: 600; color: var(--ink);
}
.swatch-menu-item {
  display: block; width: 100%; text-align: left;
  padding: 0.4rem 0.55rem;
  background: transparent; border: none; border-radius: 6px;
  font-family: 'Fredoka', sans-serif; font-size: 0.8rem; font-weight: 600;
  color: var(--ink); cursor: pointer;
}
.swatch-menu-item:hover { background: var(--cream); }


/* ---------- Modal (cheat sheet) ------------------------------------------ */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(43, 30, 15, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.15s ease, visibility 0.15s;
}
.modal-backdrop.show {
  opacity: 1; visibility: visible; pointer-events: auto;
}
.modal-card {
  position: relative;
  background: var(--paper);
  border: 2.5px solid var(--ink); border-radius: 16px;
  box-shadow: var(--shadow-pop);
  max-width: 560px; width: 100%;
  max-height: calc(100dvh - 2rem);
  overflow: auto;
  padding: 1.3rem 1.4rem 1.4rem;
  transform: translateY(10px) scale(0.96);
  transition: transform 0.32s var(--ease-back);
}
.modal-backdrop.show .modal-card { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute; top: 0.6rem; right: 0.6rem;
  width: 30px; height: 30px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 100px;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 0.85rem;
  cursor: pointer; box-shadow: 1.5px 1.5px 0 var(--ink);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.modal-close { transition: transform 0.3s var(--ease-back), box-shadow 0.3s var(--ease-back), background 0.15s ease; }
.modal-close:hover { background: var(--coral); transform: rotate(90deg); box-shadow: 2.5px 2.5px 0 var(--ink); }
.modal-card h2 {
  margin: 0 0 0.35rem; font-family: 'Fredoka', sans-serif;
  font-weight: 700; font-size: 1.3rem; color: var(--ink);
}
.modal-sub {
  margin: 0 0 1rem;
  font-family: 'Nunito', sans-serif; font-size: 0.85rem;
  color: var(--ink-soft); line-height: 1.45;
}

.shortcuts-group { margin-bottom: 0.9rem; }
.shortcuts-group h3 {
  margin: 0 0 0.4rem;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 0.7rem;
  color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.1em;
}
.shortcuts-group dl {
  margin: 0;
  display: grid; grid-template-columns: 1fr; gap: 0.25rem;
}
.shortcuts-group dl > div {
  display: grid; grid-template-columns: max-content 1fr;
  align-items: baseline; column-gap: 0.9rem;
  padding: 0.3rem 0;
  border-bottom: 1px dashed rgba(43, 30, 15, 0.12);
}
.shortcuts-group dl > div:last-child { border-bottom: none; }
.shortcuts-group dt { margin: 0; }
.shortcuts-group dd {
  margin: 0; font-family: 'Fredoka', sans-serif;
  font-size: 0.84rem; color: var(--ink); line-height: 1.35;
}
.shortcuts-group kbd {
  display: inline-block;
  background: var(--cream); color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 6px;
  box-shadow: 1.5px 1.5px 0 var(--ink);
  padding: 0.15rem 0.45rem;
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; font-weight: 600;
  white-space: nowrap;
}

/* Responsive tweaks so the adjust grid wraps nicely on narrow sidebars. */
@media (max-width: 520px) {
  .adj-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shortcuts-group dl > div {
    grid-template-columns: 1fr;
    row-gap: 0.15rem;
  }
  .shortcuts-group dt { margin-bottom: 0.1rem; }
}
