:root {
  --ink: #143f32;
  --ink-soft: #45665b;
  --mint: #edf8ef;
  --cream: #fffaf1;
  --paper: #ffffff;
  --orange: #f36a25;
  --orange-dark: #da5415;
  --line: rgba(20, 63, 50, 0.14);
  --shadow: 0 22px 70px rgba(20, 63, 50, 0.1);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--mint);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  min-height: 100vh;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  min-height: 78px;
  padding: 0 5vw;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 28px;
  background: rgba(237, 248, 239, 0.92);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.brand {
  color: var(--ink);
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 31px;
  text-decoration: none;
  letter-spacing: -0.8px;
}

.brand span { color: var(--orange); margin-left: 3px; }
.header-note { color: var(--ink-soft); font-size: 14px; }
.price { margin-left: auto; font-weight: 700; font-size: 18px; }

main { padding: 54px 5vw 72px; }

.intro { max-width: 820px; margin: 0 auto 46px; text-align: center; }
.eyebrow, .step-label {
  color: var(--orange);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.intro h1 {
  margin: 12px 0 18px;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: clamp(54px, 6vw, 88px);
  line-height: 0.93;
  letter-spacing: -0.04em;
  font-weight: 400;
}

.lede { max-width: 650px; margin: 0 auto; color: var(--ink-soft); line-height: 1.65; font-size: 17px; }
.product-pills { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.product-pills span { background: rgba(255,255,255,.72); border: 1px solid var(--line); padding: 9px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }

.workspace {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(310px, 0.78fr) minmax(500px, 1.4fr);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 30px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.upload-panel { padding: 38px; border-right: 1px solid var(--line); background: var(--cream); }
.results-panel { padding: 38px; min-width: 0; }
.step-label { display: flex; align-items: center; gap: 9px; }
.step-label span { width: 28px; height: 28px; display: inline-grid; place-items: center; background: #fff0e7; border-radius: 50%; font-size: 10px; letter-spacing: 0; }
h2 { font-family: "DM Serif Display", Georgia, serif; font-size: 32px; font-weight: 400; margin: 14px 0 4px; line-height: 1.05; }
.hint { color: var(--ink-soft); font-size: 13px; margin: 0 0 18px; }

.drop-zone {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  max-height: 450px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  border: 2px dashed rgba(20,63,50,.28);
  border-radius: 22px;
  background: var(--paper);
  transition: border-color .2s ease, transform .2s ease;
}

.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--orange); transform: translateY(-2px); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-placeholder { display: grid; justify-items: center; gap: 8px; color: var(--ink-soft); text-align: center; }
.drop-placeholder strong { color: var(--ink); }
.upload-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--orange); font-size: 24px; font-weight: 700; }
#source-preview { width: 100%; height: 100%; object-fit: contain; background: #eff3ef; }
.change-photo { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); border: 0; background: rgba(20,63,50,.88); color: #fff; border-radius: 999px; padding: 10px 15px; cursor: pointer; white-space: nowrap; }

.quality-tips { margin-top: 20px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; font-size: 13px; }
.quality-tips strong { font-size: 13px; }
.quality-tips ul { color: var(--ink-soft); margin: 9px 0 0; padding-left: 18px; line-height: 1.55; }

.attempt-meter { margin: 22px 0 14px; }
.attempt-meter > div:first-child { display: flex; justify-content: space-between; gap: 15px; font-size: 13px; }
.meter-track { height: 7px; margin-top: 9px; border-radius: 999px; background: #dfe9df; overflow: hidden; }
.meter-track span { display: block; width: 0; height: 100%; background: var(--orange); border-radius: inherit; transition: width .3s ease; }

.generate-button {
  width: 100%;
  min-height: 55px;
  border: 0;
  border-radius: 999px;
  padding: 0 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease, opacity .2s ease;
}
.generate-button:hover:not(:disabled) { background: var(--orange-dark); transform: translateY(-1px); }
.generate-button:disabled { opacity: .42; cursor: not-allowed; }
.status { min-height: 20px; margin: 12px 0 0; text-align: center; color: var(--ink-soft); font-size: 13px; }
.status.is-error { color: #a23324; }

.results-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.mode-badge { border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; font-size: 11px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.mode-badge.is-live { background: var(--mint); color: var(--ink); }
.demo-notice { margin-top: 20px; padding: 14px 16px; border-radius: 14px; background: #fff5df; border: 1px solid #f0d49f; display: grid; gap: 3px; font-size: 12px; color: #70572b; }

.empty-state { min-height: 510px; display: grid; align-content: center; justify-items: center; text-align: center; color: var(--ink-soft); }
.empty-state h3 { margin: 22px 0 5px; color: var(--ink); font-family: "DM Serif Display", Georgia, serif; font-size: 27px; font-weight: 400; }
.empty-state p { margin: 0; font-size: 14px; }
.empty-art { width: 150px; height: 170px; border-radius: 48% 48% 44% 44%; display: grid; place-items: center; position: relative; background: #e4f1e6; border: 1px solid var(--line); }
.ear { position: absolute; width: 58px; height: 75px; top: -26px; background: #e4f1e6; border: 1px solid var(--line); transform: rotate(18deg); border-radius: 80% 10% 50% 30%; z-index: -1; }
.ear-left { left: 6px; transform: rotate(-18deg) scaleX(-1); }
.ear-right { right: 6px; }
.face { font-size: 42px; color: var(--orange); }

.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.result-card { position: relative; border: 1px solid var(--line); border-radius: 19px; padding: 8px; background: #fff; overflow: hidden; box-shadow: 0 12px 36px rgba(20,63,50,.08); }
.result-card.is-selected { border-color: var(--orange); box-shadow: 0 0 0 2px rgba(243,106,37,.18), 0 12px 36px rgba(20,63,50,.08); }
.result-card img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 13px; background: #eef3ef; }
.edition-heading { min-height: 61px; padding: 7px 6px 11px; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.edition-heading > div { display: grid; gap: 2px; }
.edition-heading strong { font-family: "DM Serif Display", Georgia, serif; font-size: 21px; font-weight: 400; }
.edition-heading span { color: var(--ink-soft); font-size: 10px; }
.edition-heading em { font-style: normal; border-radius: 999px; background: var(--mint); padding: 5px 7px; color: var(--ink-soft); font-size: 9px; font-weight: 700; white-space: nowrap; }
.missing-edition { width: 100%; aspect-ratio: 2 / 3; border-radius: 13px; background: #f3f6f2; border: 1px dashed rgba(20,63,50,.22); display: grid; align-content: center; justify-items: center; gap: 8px; color: var(--ink-soft); text-align: center; padding: 20px; }
.missing-edition span { color: var(--orange); font-size: 28px; }
.missing-edition strong { font-size: 12px; }
.result-actions { display: grid; gap: 7px; padding: 10px 4px 4px; }
.select-button, .remake-button { width: 100%; min-height: 36px; border-radius: 999px; padding: 8px 12px; cursor: pointer; font-size: 11px; font-weight: 700; }
.select-button { border: 0; background: var(--ink); color: #fff; }
.remake-button { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.select-button:disabled, .remake-button:disabled { opacity: .4; cursor: not-allowed; }
.result-card.is-selected .select-button { background: var(--orange); }

.selection-summary { margin-top: 22px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--mint); }
.selection-summary > div { display: grid; gap: 3px; }
.selection-summary span { font-size: 11px; color: var(--ink-soft); }
.selection-actions { display: flex !important; grid-template-columns: auto auto; align-items: center; gap: 8px !important; }
.download-link, .cart-button { text-decoration: none; border-radius: 999px; padding: 11px 14px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.download-link.secondary { color: var(--ink); background: #fff; border: 1px solid var(--line); }
.cart-button { border: 0; color: #fff; background: var(--orange); cursor: pointer; }
.cart-button:hover { background: var(--orange-dark); }
.cart-confirmation { margin-top: 12px; padding: 13px 15px; border: 1px solid #b9d7c0; border-radius: 13px; color: var(--ink); background: #f0faef; font-size: 12px; line-height: 1.5; }

footer { padding: 24px 5vw; border-top: 1px solid var(--line); color: var(--ink-soft); display: flex; justify-content: space-between; gap: 20px; font-size: 12px; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .upload-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .drop-zone { max-height: 520px; }
}

@media (max-width: 600px) {
  .site-header { min-height: 66px; padding: 0 20px; }
  .header-note { display: none; }
  main { padding: 36px 14px 50px; }
  .intro h1 { font-size: 48px; }
  .lede { font-size: 15px; }
  .workspace { border-radius: 22px; }
  .upload-panel, .results-panel { padding: 26px 20px; }
  .results-heading { display: grid; }
  .result-grid { gap: 10px; }
  .result-card { border-radius: 14px; padding: 6px; }
  .result-grid { grid-template-columns: 1fr; }
  .selection-summary { align-items: stretch; flex-direction: column; }
  .selection-actions { align-items: stretch !important; flex-direction: column; }
  .download-link, .cart-button { text-align: center; width: 100%; }
  footer { flex-direction: column; padding: 20px; }
}
