:root {
  --dx-red: #e30613;
  --dx-navy: #0b1c2c;
  --dx-ink: #122433;
  --dx-blue: #2f6fa8;
  --dx-mist: #a9c9d8;
  --dx-deep: #1c3c4f;
  --dx-paper: #ffffff;
  --dx-line: #d8d2c8;
  --font: "DM Sans", "Segoe UI", sans-serif;
  --display: "Playfair Display", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--dx-ink);
  background: var(--dx-paper);
}
a { color: inherit; }

.dx-header {
  background: #fff;
  border-bottom: 1px solid var(--dx-line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.dx-header__bar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.dx-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.dx-logo__heart { width: 42px; height: 36px; }
.dx-logo__word { font-weight: 700; font-size: 1.45rem; letter-spacing: -0.03em; }
.dx-logo__tag {
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--dx-blue);
  padding-left: 8px;
  border-left: 1px solid var(--dx-line);
}
.dx-nav { display: flex; gap: 22px; font-weight: 500; }
.dx-nav a { text-decoration: none; }
.dx-nav a:hover { color: var(--dx-red); }

.dx-hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 64px 24px 40px;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 40px;
  align-items: center;
}
.dx-kicker { text-transform: uppercase; letter-spacing: .16em; font-size: .78rem; color: var(--dx-blue); }
.dx-hero h1, .dx-tool-hero h1, .dx-steps-preview h2 {
  font-family: var(--display);
  line-height: 1.15;
}
.dx-hero h1 { font-size: clamp(2rem, 4vw, 3.4rem); margin: 8px 0 16px; }
.dx-lead { font-size: 1.1rem; max-width: 36rem; }
.dx-hero__swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dx-hero__swatches div {
  min-height: 120px;
  border-radius: 18px;
  color: #fff;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  font-weight: 600;
}

.dx-btn, .dx-next, .dx-generate, .dx-icon-btn {
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}
.dx-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  text-decoration: none;
}
.dx-btn--primary, .dx-generate { background: var(--dx-red); color: #fff; }
.dx-generate { padding: 12px 26px; border-radius: 999px; font-size: 1rem; }

.dx-steps-preview { max-width: 1180px; margin: 0 auto 80px; padding: 0 24px; }
.dx-steps-preview__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.dx-steps-preview article {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  min-height: 180px;
}
.dx-steps-preview b { color: var(--dx-red); font-size: 1.2rem; }

.dx-footer { background: #fff; color: var(--dx-ink); margin-top: 40px; border-top: 1px solid var(--dx-line); }
.dx-footer__inner, .dx-footer__copy { max-width: 1180px; margin: 0 auto; padding: 32px 24px; }
.dx-footer__inner { display: flex; justify-content: space-between; gap: 24px; }
.dx-logo--light { color: var(--dx-ink); margin-bottom: 8px; }
.dx-footer__hotline span { display: block; color: #6b7280; }
.dx-footer__hotline strong { font-size: 1.8rem; color: var(--dx-red); }
.dx-footer__copy { border-top: 1px solid var(--dx-line); color: #6b7280; padding-top: 16px; padding-bottom: 24px; }

.dx-tool-page { background: #fff; color: var(--dx-ink); }
.dx-tool-page .dx-header { background: #fff; color: var(--dx-ink); }
.dx-tool-hero {
  text-align: center;
  padding: 36px 16px 8px;
  background: #fff;
}
.dx-crumb { color: #6b7280; margin-bottom: 18px; }
.dx-crumb a { color: inherit; }
.dx-tool-hero h1 { letter-spacing: .18em; font-size: clamp(1.6rem, 4vw, 2.6rem); color: var(--dx-ink); }
.dx-tool-hero p { color: #5b6570; }

.dx-tool { max-width: 1100px; margin: 0 auto 80px; padding: 0 16px 40px; }
.dx-tool__tabs {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--dx-line);
  margin: 24px 0 28px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .85rem;
}
.dx-tool__tabs span { color: #9aa3ad; padding-bottom: 12px; }
.dx-tool__tabs strong { color: var(--dx-red); border-bottom: 3px solid var(--dx-red); padding-bottom: 12px; }

.dx-stepper {
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 18px;
  margin: 0 auto 28px;
  background: #f7f5f2;
  border-radius: 8px;
  max-width: 520px;
  color: #111;
}
.dx-stepper li {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid #cfcfcf; display: grid; place-items: center; font-weight: 700;
  position: relative;
}
.dx-stepper li:not(:last-child)::after {
  content: ""; position: absolute; left: 52px; width: 28px; height: 2px; background: #cfcfcf; top: 50%;
}
.dx-stepper .is-active, .dx-stepper .is-done { border-color: var(--dx-red); color: var(--dx-red); }
.dx-stepper .is-done { background: var(--dx-red); color: #fff; }

.dx-quota { text-align: center; color: #5b6570; margin-bottom: 18px; }
.dx-panel { display: none; }
.dx-panel.is-active { display: block; }
.dx-panel h2 { text-align: center; font-size: 1.15rem; font-weight: 500; margin-bottom: 18px; color: var(--dx-ink); }

.dx-upload-card {
  background: #f7f5f2;
  color: var(--dx-ink);
  min-height: 420px;
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  border: 1px solid #e6e0d6;
}
.dx-upload-card__actions {
  position: absolute; right: 16px; top: 16px; display: flex; gap: 8px; z-index: 2;
}
.dx-icon-btn {
  width: 44px; height: 44px; border-radius: 50%; background: #eee; font-size: 1.1rem;
}
.dx-upload-card__stage {
  min-height: 420px; display: grid; place-items: center;
  background: center/cover no-repeat;
}
.dx-upload-cta {
  background: none; border: 0; color: var(--dx-red); font-weight: 700; font-size: 1.1rem;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.dx-upload-cta span {
  width: 42px; height: 42px; border-radius: 50%; background: var(--dx-red); color: #fff;
  display: grid; place-items: center;
}

.dx-sample-grid, .dx-style-grid, .dx-result-grid, .dx-palette-list {
  display: grid; gap: 12px;
}
.dx-sample-grid { grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.dx-sample-grid button, .dx-style-grid button, .dx-palette-list button {
  border: 2px solid #ece8e1; border-radius: 14px; overflow: hidden; cursor: pointer; background: #fff; color: var(--dx-ink); padding: 0;
}
.dx-sample-grid img { width: 100%; height: 120px; object-fit: cover; display: block; }
.dx-sample-grid span, .dx-style-grid strong, .dx-palette-list strong { display: block; padding: 8px 10px; font-size: .92rem; }
.dx-sample-grid button:hover, .dx-style-grid button:hover, .dx-palette-list button:hover {
  border-color: #d8cfc4;
}
.dx-sample-grid .is-selected, .dx-style-grid .is-selected, .dx-palette-list .is-selected, .dx-swatch.is-selected {
  border-color: var(--dx-red);
  background: #fff8f8;
}

.dx-next {
  background: none; color: var(--dx-red); display: block; margin: 18px 0 0 auto; font-size: 1.05rem;
}
.dx-next--ghost { color: #8a93a0; }
.dx-nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; gap: 12px; }
.dx-nav-row .dx-next, .dx-nav-row .dx-generate { margin: 0; }
.dx-nav-row a.dx-next { text-decoration: none; padding: 10px 18px; }

.dx-palette-list { grid-template-columns: repeat(2, 1fr); }
.dx-palette-list button { text-align: left; padding: 14px 16px; }
.dx-swatch-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.dx-swatch {
  width: 72px; border: 2px solid transparent; background: none; color: inherit; cursor: pointer; padding: 0;
}
.dx-swatch i { display: block; height: 52px; border-radius: 8px; }
.dx-swatch b, .dx-swatch small { display: block; font-size: .72rem; font-weight: 500; margin-top: 4px; }

.dx-chart-lead { text-align: center; color: #5b6570; margin: -8px 0 18px; }
.dx-chart {
  background: #fff;
  border: 1px solid var(--dx-line);
  border-radius: 18px;
  padding: 18px 18px 12px;
}
.dx-huebar-label { display: block; font-size: .82rem; color: #5b6570; margin-bottom: 8px; }
.dx-huebar {
  width: 100%;
  height: 28px;
  appearance: none;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  border: 1px solid #e6e0d6;
}
.dx-huebar::-webkit-slider-thumb {
  appearance: none;
  width: 18px;
  height: 34px;
  border-radius: 4px;
  background: #fff;
  border: 2px solid #333;
  box-shadow: 0 1px 4px #0003;
}
.dx-huebar::-moz-range-thumb {
  width: 18px;
  height: 34px;
  border-radius: 4px;
  background: #fff;
  border: 2px solid #333;
}
.dx-huebar-names {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  margin: 8px 0 16px;
}
.dx-huebar-names button {
  border: 0;
  background: none;
  font-size: .62rem;
  letter-spacing: .02em;
  color: #6b7280;
  cursor: pointer;
  padding: 4px 0;
  text-transform: uppercase;
}
.dx-huebar-names button.is-active { color: var(--dx-red); font-weight: 700; }
.dx-chart-search {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.dx-chart-search input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--dx-line);
  border-radius: 8px;
  font-family: inherit;
}
.dx-chart-search button {
  background: var(--dx-navy);
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
}
.dx-chart-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: start;
}
.dx-chart-selected {
  background: #f7f5f2;
  border-radius: 14px;
  padding: 14px;
  min-height: 280px;
}
.dx-chart-selected h3 { margin: 0 0 10px; font-size: .95rem; }
.dx-chart-empty, .dx-chart-note { color: #6b7280; font-size: .82rem; }
.dx-chart-note { margin: 14px 0 0; }
.dx-selected-swatch {
  height: 120px;
  border-radius: 10px;
  border: 1px solid #0001;
  margin-bottom: 10px;
}
.dx-chart-selected strong { display: block; font-size: 1.05rem; }
.dx-chart-selected code {
  display: block;
  font-family: inherit;
  color: var(--dx-blue);
  margin: 2px 0 8px;
}
.dx-chart-selected dl { margin: 0; font-size: .82rem; }
.dx-chart-selected dt { color: #8a93a0; float: left; width: 52px; }
.dx-chart-selected dd { margin: 0 0 4px 52px; }
.dx-fan {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
  min-height: 220px;
}
.dx-fan__chip {
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  padding: 0;
  text-align: left;
  min-height: 168px;
  display: flex;
  flex-direction: column;
}
.dx-fan__chip i {
  display: block;
  flex: 1;
  min-height: 92px;
}
.dx-fan__chip span {
  display: block;
  padding: 8px 8px 2px;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.25;
}
.dx-fan__chip small {
  display: block;
  padding: 0 8px 8px;
  font-size: .68rem;
  color: #6b7280;
}
.dx-fan__chip.is-selected { border-color: var(--dx-red); }
.dx-fan__chip.is-selected span { color: var(--dx-red); }
.dx-page-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  gap: 8px;
}
.dx-page-nav button {
  background: none;
  border: 0;
  color: var(--dx-red);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.dx-page-nav button:disabled { color: #c5c9ce; cursor: default; }
.dx-page-nav span { font-size: .9rem; color: #5b6570; }

.dx-style-grid { grid-template-columns: repeat(3, 1fr); }
.dx-style-grid button { padding: 16px; text-align: left; min-height: 120px; }
.dx-style-grid p { color: #6b7280; font-size: .85rem; margin: 6px 0 0; }

.dx-notes {
  width: 100%; min-height: 140px; border-radius: 14px; border: 1px solid var(--dx-line); background: #fff; color: var(--dx-ink);
  padding: 14px; font-family: inherit;
}
.dx-hint { text-align: center; color: #5b6570; }
.dx-result-grid { grid-template-columns: repeat(2, 1fr); }
.dx-result-card {
  background: #fff; border-radius: 14px; overflow: hidden; position: relative;
  border: 1px solid var(--dx-line);
}
.dx-result-card img { width: 100%; height: 180px; object-fit: cover; filter: contrast(.95); }
.dx-result-card .dx-btn { position: absolute; right: 10px; bottom: 10px; }

.dx-modal[hidden], .dx-loading[hidden] { display: none !important; }
.dx-modal {
  position: fixed; inset: 0; background: #000c; display: grid; place-items: center; z-index: 40; padding: 16px;
}
.dx-modal__card {
  background: #fff; color: var(--dx-ink); border-radius: 18px; padding: 24px; width: min(440px, 100%);
  max-height: 90vh; overflow: auto;
}
.dx-modal__card--wide { width: min(860px, 100%); }
.dx-modal__card img { max-width: 100%; border-radius: 12px; }
.dx-modal__card label { display: block; margin-bottom: 10px; font-size: .9rem; }
.dx-modal__card input {
  width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 8px; border: 1px solid #ccc;
}
.dx-error { color: var(--dx-red); }

.dx-puzzle { position: relative; width: 320px; height: 180px; margin: 12px auto; overflow: hidden; border-radius: 10px; }
.dx-puzzle img { position: absolute; left: 0; top: 0; }
#puzzleBg { width: 320px; height: 180px; }
#puzzlePiece { width: 52px; height: 52px; box-shadow: 0 6px 16px #0006; z-index: 2; border-radius: 4px; }
#puzzleSlider { width: 100%; accent-color: var(--dx-red); }

.dx-loading {
  position: fixed; inset: 0; background: #000a; color: #fff; display: grid; place-items: center; z-index: 50;
}
.dx-loading__spin {
  width: 46px; height: 46px; border-radius: 50%; border: 4px solid #fff4; border-top-color: #fff;
  animation: spin .8s linear infinite; margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .dx-hero, .dx-steps-preview__grid, .dx-sample-grid, .dx-style-grid, .dx-result-grid, .dx-palette-list {
    grid-template-columns: 1fr;
  }
  .dx-chart-body, .dx-huebar-names { grid-template-columns: 1fr; }
  .dx-huebar-names { display: flex; flex-wrap: wrap; }
  .dx-nav { display: none; }
  .dx-footer__inner { flex-direction: column; }
}
