/* ─── Color correct: shared menu + Manual panel (2026-10-28) ───────
   Used by Flat-lay Studio (flatlay.html) and My Catalog (index.html); script:
   color-correct.js. Own tokens, so it looks the same on both pages' stylesheets. */
.cc-menu, .cc-modal {
  --cc-accent: #8b5cf6; --cc-accent-hover: #a78bfa; --cc-accent-dim: rgba(139,92,246,.10); --cc-accent-glow: rgba(139,92,246,.18);
  --cc-bg: #09090b; --cc-bg-elevated: #27272a; --cc-border: #3f3f46; --cc-border-hover: #52525b;
  --cc-text: #fafafa; --cc-text-2: #a1a1aa; --cc-text-3: #71717a; --cc-error: #ef4444;
  --cc-r-sm: 6px; --cc-r-md: 10px;
  --cc-sh-md: 0 4px 6px -1px rgba(0,0,0,.4), 0 2px 4px -2px rgba(0,0,0,.3);
  --cc-sh-xl: 0 20px 25px -5px rgba(0,0,0,.5), 0 8px 10px -6px rgba(0,0,0,.4);
  --cc-fast: 120ms; --cc-norm: 200ms; --cc-ease: cubic-bezier(.16,1,.3,1);
  font-family: inherit; box-sizing: border-box;
}
.cc-menu *, .cc-modal * { box-sizing: border-box; }
@keyframes cc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cc-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes cc-spin { to { transform: rotate(360deg); } }
.cc-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(63,63,70,.5); border-top-color: var(--cc-accent); animation: cc-spin .7s linear infinite;
}
.cc-modal p { margin: 0; }
.cc-hint { font-size: .75rem; color: var(--cc-text-3); }
.cc-button {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px;
  font: inherit; font-size: .875rem; font-weight: 500; border-radius: var(--cc-r-md); cursor: pointer; white-space: nowrap;
  transition: all var(--cc-fast) var(--cc-ease);
}
.cc-button-primary { background: linear-gradient(135deg, var(--cc-accent), #7c3aed); color: #fff; border: none; }
.cc-button-primary:hover { background: linear-gradient(135deg, var(--cc-accent-hover), var(--cc-accent)); }
.cc-button-ghost { background: transparent; color: var(--cc-text); border: 1px solid var(--cc-border); }
.cc-button-ghost:hover { border-color: var(--cc-border-hover); background: var(--cc-bg-elevated); }

/* Menu: Auto / Manual (+ Remove once applied). */
.cc-menu {
  position: fixed; z-index: 10040; width: 236px; padding: 6px;
  background: #17171c; border: 1px solid var(--cc-border); border-radius: var(--cc-r-md); box-shadow: var(--cc-sh-xl);
  animation: cc-fade var(--cc-fast) var(--cc-ease);
}
.cc-menu-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-height: 48px;
  padding: 8px 10px; border: 0; border-radius: var(--cc-r-sm); background: transparent; color: var(--cc-text);
  text-align: left; cursor: pointer;
}
.cc-menu-item:hover, .cc-menu-item:focus-visible { background: var(--cc-bg-elevated); outline: none; }
.cc-menu-label { font-size: .875rem; font-weight: 600; line-height: 1.3; }
.cc-menu-sub { font-size: .75rem; color: var(--cc-text-3); line-height: 1.3; }
.cc-menu-sep { height: 1px; margin: 4px 2px; background: var(--cc-border); }

/* Manual panel: modal on desktop, bottom sheet on phone. */
.cc-modal { position: fixed; inset: 0; z-index: 10050; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 16px; }
.cc-panel {
  width: 100%; max-width: 720px; max-height: calc(100vh - 32px); overflow: auto;
  background: #17171c; border: 1px solid var(--cc-border); border-radius: 16px; padding: 18px;
  display: grid; gap: 16px 22px;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  grid-template-areas: "head head" "prev ctrl" "act act";
}
.cc-head { grid-area: head; }
.cc-title { font-weight: 600; font-size: 1.05rem; color: #fff; }
.cc-sub { font-size: .8125rem; color: var(--cc-text-2); }

.cc-preview {
  grid-area: prev; position: relative; aspect-ratio: 3/4; overflow: hidden;
  border-radius: var(--cc-r-md); background: var(--cc-bg); border: 1px solid var(--cc-border);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer;
}
.cc-img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; transition: opacity var(--cc-norm) var(--cc-ease); }
.cc-preview.is-loading .cc-img { opacity: .72; }
.cc-spin { position: absolute; top: 10px; right: 10px; display: none; }
.cc-preview.is-loading .cc-spin { display: block; }
.cc-badge {
  position: absolute; top: 10px; left: 10px; font-size: .625rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px; backdrop-filter: blur(6px);
  background: var(--cc-accent-dim); color: var(--cc-accent-hover); border: 1px solid rgba(139,92,246,.4);
}
.cc-preview.is-before .cc-badge { background: rgba(9,9,11,.75); color: var(--cc-text); border-color: var(--cc-border-hover); }
.cc-hold {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  height: 36px; padding: 0 14px; border-radius: 999px; white-space: nowrap;
  background: rgba(9,9,11,.72); border: 1px solid var(--cc-border-hover); color: #fff;
  font-size: .8125rem; font-weight: 500; backdrop-filter: blur(6px); cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.cc-hold[aria-pressed="true"] { background: var(--cc-accent); border-color: var(--cc-accent); }
.cc-hold:disabled { opacity: .5; cursor: default; }

.cc-controls { grid-area: ctrl; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.cc-field-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cc-field-head label { font-size: .875rem; font-weight: 600; color: var(--cc-text); }
.cc-val { font-size: .8125rem; color: var(--cc-text-2); font-variant-numeric: tabular-nums; }
.cc-ends { display: flex; justify-content: space-between; gap: 8px; font-size: .75rem; color: var(--cc-text-3); }
.cc-err { font-size: 12.5px; color: var(--cc-error); }

.cc-range { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; cursor: pointer; touch-action: pan-y; }
.cc-range:focus-visible { outline: none; }
.cc-range::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, var(--cc-accent) 0 var(--pct, 50%), var(--cc-bg-elevated) var(--pct, 50%) 100%);
}
.cc-range::-webkit-slider-thumb {
  -webkit-appearance: none; box-sizing: border-box; width: 24px; height: 24px; margin-top: -9px;
  border-radius: 50%; background: #fff; border: 3px solid var(--cc-accent); box-shadow: var(--cc-sh-md);
}
.cc-range::-moz-range-track { height: 6px; border-radius: 999px; background: var(--cc-bg-elevated); }
.cc-range::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--cc-accent); }
.cc-range::-moz-range-thumb {
  box-sizing: border-box; width: 24px; height: 24px;
  border-radius: 50%; background: #fff; border: 3px solid var(--cc-accent); box-shadow: var(--cc-sh-md);
}
.cc-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--cc-accent-glow); }
.cc-range:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 5px var(--cc-accent-glow); }
@media (pointer: coarse) {
  .cc-range { height: 40px; }
  .cc-range::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -11px; }
  .cc-range::-moz-range-thumb { width: 28px; height: 28px; }
}

.cc-actions { grid-area: act; display: flex; align-items: center; gap: 8px; }
.cc-reset {
  margin-right: auto; min-height: 44px; padding: 0 4px; border: 0; background: none; cursor: pointer;
  color: var(--cc-text-2); font-size: .8125rem; text-decoration: underline; text-underline-offset: 3px;
}
.cc-reset:hover { color: var(--cc-text); }

@media (max-width: 640px) {
  .cc-modal { place-items: end stretch; padding: 0; }
  .cc-panel {
    max-width: none; max-height: 92vh; max-height: 92dvh;
    border-radius: 18px 18px 0 0; border-bottom: 0; padding: 10px 16px 0; gap: 12px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "grab" "head" "prev" "ctrl" "act";
    animation: cc-up var(--cc-norm) var(--cc-ease);
  }
  .cc-panel::before { content: ""; grid-area: grab; justify-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--cc-border); }
  .cc-preview { aspect-ratio: auto; height: 34vh; height: 34dvh; }
  .cc-actions {
    position: sticky; bottom: 0; background: #17171c;
    padding: 10px 0 calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(63,63,70,.4);
  }
}
