:root {
  color-scheme: light;
  --ink: #18211f;
  --muted: #66706d;
  --line: #d8dfdc;
  --soft: #f4f1ec;
  --panel: #ffffff;
  --mint: #b7e4d7;
  --moss: #2e6b57;
  --coral: #d8655b;
  --berry: #8e3d63;
  --gold: #d8aa42;
  --shadow: 0 18px 60px rgba(27, 35, 32, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #e9ede8;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.workspace {
  width: min(1480px, 100%);
  min-height: calc(100vh - 48px);
  margin: 0 auto;
  background: var(--soft);
  border: 1px solid rgba(24, 33, 31, 0.08);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  min-height: 86px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--moss);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
}

h3 {
  font-size: 18px;
  line-height: 1.25;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.judge-action,
.primary-action,
.secondary-action {
  border: 0;
  min-height: 42px;
  border-radius: 7px;
  font-weight: 800;
}

.icon-button {
  width: 42px;
  background: #edf3f0;
  color: var(--moss);
  font-size: 22px;
}

.primary-action {
  padding: 0 18px;
  background: var(--moss);
  color: #fff;
}

.judge-action {
  padding: 0 14px;
  background: #f4d35e;
  color: #2e2510;
}

.secondary-action {
  padding: 0 14px;
  background: #18211f;
  color: #fff;
}

.main-grid {
  display: grid;
  grid-template-columns: 300px minmax(430px, 1fr) 390px;
  gap: 16px;
  padding: 16px;
}

.control-panel,
.experience-panel,
.recommendation-panel {
  min-width: 0;
}

.control-panel,
.recommendation-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel-section,
.recommendation-panel,
.insight-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel-section {
  padding: 16px;
}

.section-heading {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.section-heading.wide {
  align-items: flex-start;
  margin-bottom: 12px;
}

.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.step-dot {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--mint);
  color: #14372d;
  font-size: 12px;
  font-weight: 900;
}

.portrait-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}

.portrait-option {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  background: #dfe6e2;
}

.portrait-option.active {
  border-color: var(--coral);
}

.portrait-option img,
.preview-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.upload-drop {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px dashed #aab6b2;
  border-radius: 8px;
  color: var(--moss);
  font-weight: 800;
}

.upload-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.segment {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf8;
  color: var(--ink);
  font-weight: 800;
}

.segment.active {
  background: #18211f;
  color: #fff;
  border-color: #18211f;
}

.budget-row,
.toggle-row,
.shopping-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.budget-row {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

output {
  color: var(--ink);
  font-weight: 900;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--coral);
}

.toggle-row {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.api-check {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.text-action {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf8;
  color: var(--moss);
  font-weight: 900;
}

.api-check p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.field-label,
.live-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.template-select {
  width: 100%;
  min-height: 40px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf8;
  color: var(--ink);
  padding: 0 10px;
  font-weight: 750;
}

.live-action {
  width: 100%;
  min-height: 42px;
  margin-top: 10px;
  border: 0;
  border-radius: 7px;
  background: var(--coral);
  color: #fff;
  font-weight: 900;
}

.live-action:disabled {
  cursor: wait;
  opacity: 0.68;
}

.live-note {
  margin-top: 9px;
  line-height: 1.35;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
}

.switch input {
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c9d2ce;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--coral);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.experience-panel {
  display: grid;
  grid-template-rows: minmax(520px, 1fr) auto;
  gap: 16px;
}

.preview-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 8px;
  background: #cad8d1;
}

.tryon-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: multiply;
}

#lipShade,
#cheekShade,
#eyeShade {
  position: absolute;
  display: block;
  opacity: 0.58;
  filter: blur(12px);
}

#lipShade {
  width: 84px;
  height: 24px;
  left: 48%;
  top: 54%;
  border-radius: 50%;
  background: var(--berry);
}

#cheekShade {
  width: 132px;
  height: 64px;
  left: 54%;
  top: 45%;
  border-radius: 50%;
  background: #e7897d;
}

#eyeShade {
  width: 156px;
  height: 28px;
  left: 40%;
  top: 36%;
  border-radius: 50%;
  background: #b58359;
  opacity: 0.32;
}

.status-stack {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 8px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 142px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #20302b;
  font-size: 12px;
  font-weight: 900;
}

.status-pill span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #38a169;
}

.status-pill.failed span {
  background: #d84f45;
}

.status-pill.ready span {
  background: var(--gold);
}

.insight-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.2fr 0.7fr;
  gap: 12px;
}

.insight-card {
  min-height: 104px;
  padding: 16px;
}

.insight-card p,
.product-card p,
.shopping-summary p {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.insight-card h3 {
  margin-top: 10px;
}

.recommendation-panel {
  padding: 16px;
}

.product-list {
  display: grid;
  gap: 10px;
}

.product-card {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 84px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.product-swatch {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  background: var(--swatch);
  border: 1px solid rgba(24, 33, 31, 0.12);
}

.product-card h3 {
  font-size: 15px;
  margin-bottom: 5px;
}

.product-card p {
  text-transform: none;
  line-height: 1.35;
  font-weight: 650;
}

.price {
  font-weight: 900;
}

.shopping-summary {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.shopping-summary strong {
  display: block;
  font-size: 26px;
}

.retail-dashboard {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.retail-dashboard.spotlight {
  animation: dashboardPulse 900ms ease-out;
}

.dashboard-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.dashboard-heading h2 {
  font-size: 14px;
}

.dashboard-heading span {
  min-height: 26px;
  display: inline-grid;
  place-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf3f0;
  color: var(--moss);
  font-size: 11px;
  font-weight: 900;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-grid article {
  min-height: 82px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.metric-grid p,
.dashboard-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
  line-height: 1.15;
}

.dashboard-note {
  margin-top: 10px;
  line-height: 1.35;
  font-weight: 650;
}

@keyframes dashboardPulse {
  0% {
    filter: brightness(1);
  }

  42% {
    filter: brightness(1.08);
  }

  100% {
    filter: brightness(1);
  }
}

.copied {
  background: var(--moss);
}

@media (max-width: 1180px) {
  .main-grid {
    grid-template-columns: 290px minmax(0, 1fr);
  }

  .recommendation-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 0;
  }

  .workspace {
    min-height: 100vh;
    border: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .judge-action,
  .primary-action {
    flex: 1;
  }

  .main-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .experience-panel {
    grid-template-rows: auto auto;
  }

  .preview-stage {
    min-height: 430px;
  }

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

  .product-card {
    grid-template-columns: 56px 1fr;
  }

  .price {
    grid-column: 2;
  }

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