:root {
  --navy: #1b2a4a;
  --navy-2: #2a3d66;
  --cream: #f6f1e8;
  --cream-2: #efe6d6;
  --ink: #1c1915;
  --muted: #6b6258;
  --gold: #b8894a;
  --gold-2: #c9a36a;
  --line: #e4dac8;
  --white: #fffcf7;
  --danger: #8b3a2a;
  --ok: #2f6b4f;
  --shadow: 0 10px 30px rgba(27, 42, 74, 0.12);
  --radius: 16px;
  --safe: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Outfit, system-ui, sans-serif;
  background: var(--cream);
  color: var(--ink);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
h1, h2, h3, .brand-name, .eyebrow {
  font-family: Fraunces, Georgia, serif;
}

.top {
  padding: 16px 20px 0;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--navy); color: var(--cream);
  display: grid; place-items: center;
  font-family: Fraunces, serif; font-weight: 650; font-size: 13px;
  letter-spacing: 0.02em;
}
.brand-name { margin: 0; font-size: 16px; font-weight: 650; }
.brand-place { margin: 0; font-size: 12px; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }

main { flex: 1; max-width: 980px; width: 100%; margin: 0 auto; padding: 8px 20px 40px; }

.hero { padding: 12px 0 24px; }
.eyebrow {
  color: var(--gold); letter-spacing: 0.14em; text-transform: uppercase;
  font-size: 12px; margin: 0 0 8px; font-weight: 500;
}
h1 { font-size: clamp(36px, 8vw, 64px); margin: 0 0 12px; letter-spacing: -0.03em; line-height: 1.05; }
.lede { font-size: 17px; line-height: 1.5; color: var(--muted); margin: 0 0 28px; max-width: 40rem; }

.uploader {
  background: var(--white);
  border: 1px dashed #d3c6ae;
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}
.upload-btn {
  appearance: none; border: 0; cursor: pointer;
  background: var(--navy); color: var(--cream);
  border-radius: 999px; padding: 14px 22px;
  font-weight: 600; font-size: 16px;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 48px;
}
.upload-btn:active { transform: translateY(1px); }
.upload-icon { font-size: 22px; line-height: 1; }
.hint { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.thumbs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.thumbs[hidden], [hidden] { display: none !important; }
.thumb {
  position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden;
  border: 2px solid transparent; padding: 0; background: none; cursor: pointer;
}
.thumb.is-on { border-color: var(--navy); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x {
  position: absolute; top: 2px; right: 2px; width: 22px; height: 22px;
  border: 0; border-radius: 50%; background: rgba(27,42,74,0.8); color: #fff;
  font-size: 14px; cursor: pointer;
}

.samples { margin-top: 28px; }
.samples-label { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.sample-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 640px) { .sample-grid { grid-template-columns: repeat(3, 1fr); } }
.sample {
  padding: 0; border: 0; background: none; cursor: pointer;
  border-radius: 10px; overflow: hidden; position: relative;
  aspect-ratio: 4/3;
}
.sample img { width: 100%; height: 100%; object-fit: cover; }
.sample span {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(transparent, rgba(27,42,74,0.75));
  color: #fff; font-size: 11px; padding: 14px 6px 6px; text-align: left;
}

.workspace { display: grid; gap: 22px; }
@media (min-width: 880px) {
  .workspace { grid-template-columns: 1.15fr 0.85fr; align-items: start; }
}

.photo-wrap { position: sticky; top: 8px; }
.slider {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #111; box-shadow: var(--shadow); user-select: none;
  touch-action: none;
}
.slider img { width: 100%; height: auto; vertical-align: middle; display: block; }
.before-clip {
  position: absolute; inset: 0 auto 0 0; width: 50%; overflow: hidden;
}
.before-clip img { width: var(--slider-w, 100%); max-width: none; height: 100%; object-fit: cover; object-position: left center; }
.slider-bar {
  position: absolute; top: 0; bottom: 0; left: 50%; width: 0;
  z-index: 2;
}
.slider-handle {
  position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%);
  width: 48px; height: 48px; border-radius: 50%;
  border: 3px solid #fff; background: var(--navy);
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  cursor: ew-resize; padding: 0;
}
.slider-handle::before, .slider-handle::after {
  content: ""; position: absolute; top: 50%; width: 0; height: 0;
  border-top: 6px solid transparent; border-bottom: 6px solid transparent;
  transform: translateY(-50%);
}
.slider-handle::before { left: 10px; border-right: 8px solid #fff; }
.slider-handle::after { right: 10px; border-left: 8px solid #fff; }
.slider-bar::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0;
  width: 3px; background: #fff; transform: translateX(-50%);
}
.tag {
  position: absolute; top: 10px; z-index: 3;
  background: rgba(27,42,74,0.72); color: #fff;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 999px;
}
.tag-before { left: 10px; }
.tag-after { right: 10px; }

.status { min-height: 1.4em; font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.status.is-err { color: var(--danger); }

.controls h2 { font-size: 22px; margin: 0 0 12px; }
.surfaces { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--white);
  border-radius: 999px; padding: 10px 14px; min-height: 44px;
  cursor: pointer; color: var(--ink);
  display: inline-flex; align-items: center; gap: 8px;
}
.chip .dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15); background: #ddd;
}
.chip.is-on { border-color: var(--navy); background: var(--navy); color: var(--cream); }
.chip.is-on .dot { box-shadow: 0 0 0 2px #fff; }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.chip .miss { font-size: 11px; opacity: 0.8; }

.picker {
  background: var(--white); border-radius: var(--radius);
  padding: 16px; border: 1px solid var(--line);
}
.picker-head h3 { margin: 0; font-size: 18px; }
.picker-sub { margin: 4px 0 12px; color: var(--muted); font-size: 13px; }
.cabinet-opts, .sheen-only { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; margin-bottom: 12px; }
.sheen-only { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); text-align: left; }
.field select, #color-search {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  background: var(--cream); color: var(--ink); width: 100%;
}
.product-note { grid-column: 1 / -1; margin: 0; font-size: 12px; color: var(--muted); }
.brand-tabs { display: flex; gap: 6px; margin: 4px 0 10px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: var(--cream); border-radius: 999px;
  padding: 8px 12px; min-height: 40px; cursor: pointer;
}
.tab.is-on { background: var(--navy); color: var(--cream); border-color: var(--navy); }
#color-search { margin-bottom: 10px; background: #fff; }
.swatch-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px; max-height: 340px; overflow: auto; padding-right: 4px;
}
.swatch {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 0; cursor: pointer; text-align: left; overflow: hidden;
}
.swatch .chip-color { height: 42px; }
.swatch .meta { padding: 6px 8px 8px; }
.swatch .meta strong { display: block; font-size: 11px; font-weight: 600; line-height: 1.2; }
.swatch .meta span { display: block; font-size: 10px; color: var(--muted); }
.swatch.is-on { outline: 2px solid var(--navy); outline-offset: 1px; }

.disclaimer { font-size: 12px; color: var(--muted); line-height: 1.45; margin: 16px 0 0; }
.photo-switch { display: flex; gap: 8px; margin-bottom: 12px; }
.photo-switch button {
  width: 52px; height: 52px; padding: 0; border-radius: 8px;
  border: 2px solid transparent; overflow: hidden; cursor: pointer; background: none;
}
.photo-switch button.is-on { border-color: var(--navy); }
.photo-switch img { width: 100%; height: 100%; object-fit: cover; }

footer {
  padding: 20px 20px calc(20px + var(--safe));
  text-align: center; color: var(--muted); font-size: 13px;
}
footer p { margin: 0 0 4px; }
.foot-note { font-size: 11px; }

@media (max-width: 640px) {
  .lede { font-size: 16px; }
  .photo-wrap { position: static; }
}
