:root {
  --ink: #252722;
  --ink-soft: #5f625a;
  --paper: #f6f2eb;
  --paper-deep: #ede7dc;
  --white: #fffdf9;
  --line: #d9d1c4;
  --accent: #b85f42;
  --accent-dark: #91452f;
  --sage: #788274;
  --success: #426a4c;
  --danger: #a33d32;
  --shadow: 0 22px 70px rgba(53, 43, 31, 0.1);
  --radius: 20px;
  --font-display: Georgia, "Times New Roman", serif;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-ui);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

main { min-height: calc(100vh - 150px); }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, input[type="submit"] { cursor: pointer; }
button:disabled, input[type="submit"]:disabled { cursor: wait; opacity: 0.72; }

.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }

.site-header {
  position: relative;
  z-index: 10;
  border-bottom: 1px solid rgba(37, 39, 34, 0.1);
  background: rgba(246, 242, 235, 0.92);
  backdrop-filter: blur(14px);
}

.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -0.03em; font-size: 1.15rem; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50% 50% 44% 50%; color: white; background: var(--accent); font-family: var(--font-display); font-weight: normal; }
.main-nav { display: flex; align-items: center; gap: 24px; font-size: 0.92rem; font-weight: 650; }
.main-nav form { margin: 0; }
.main-nav a:not(.button):hover, .link-button:hover { color: var(--accent); }
.link-button { border: 0; padding: 0; color: inherit; background: transparent; font-weight: inherit; }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: white;
  background: var(--ink);
  font-weight: 750;
  letter-spacing: -0.01em;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.button:hover { transform: translateY(-1px); background: #11130f; box-shadow: 0 9px 25px rgba(37, 39, 34, 0.16); }
.button--small { min-height: 38px; padding-inline: 18px; }
.button--large { min-height: 54px; padding-inline: 29px; }
.button--secondary { color: var(--ink); background: transparent; border-color: var(--line); }
.button--secondary:hover { background: var(--white); }
.button--full { width: 100%; }
.text-link, .back-link { color: var(--accent-dark); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

.flash-stack { position: fixed; z-index: 20; top: 88px; left: 50%; transform: translateX(-50%); pointer-events: none; }
.flash { width: fit-content; max-width: 100%; margin-left: auto; padding: 13px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); box-shadow: var(--shadow); pointer-events: auto; }
.flash--alert { color: var(--danger); border-color: #e5b4ae; }
.flash--notice { color: var(--success); border-color: #b9ceb8; }

.eyebrow { margin: 0 0 13px; color: var(--accent-dark); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; }
.muted { color: var(--ink-soft); }

.hero { overflow: hidden; padding: 78px 0 88px; }
.hero-grid { display: grid; grid-template-columns: 0.92fr 1.08fr; align-items: center; gap: clamp(50px, 8vw, 100px); }
.hero-copy h1 { margin: 0; font: 400 clamp(3.8rem, 7vw, 7rem)/0.91 var(--font-display); letter-spacing: -0.065em; }
.hero-lede { max-width: 590px; margin: 28px 0 0; color: var(--ink-soft); font-size: 1.14rem; }
.hero-actions { display: flex; align-items: center; gap: 24px; margin-top: 34px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 31px; color: var(--ink-soft); font-size: 0.78rem; font-weight: 650; }
.trust-row span::before { content: "✓"; margin-right: 7px; color: var(--sage); }

.room-preview {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 520px;
  overflow: hidden;
  border: 9px solid var(--white);
  border-radius: 30px;
  box-shadow: var(--shadow);
  transform: rotate(1.1deg);
}
.room-preview::after { content: ""; position: absolute; inset: 0 auto 0 50%; width: 2px; background: var(--white); box-shadow: 0 0 18px rgba(0,0,0,.2); }
.room-panel { position: relative; overflow: hidden; background: linear-gradient(#d4d0c8 0 66%, #b9a995 66%); }
.room-panel::before { content: ""; position: absolute; inset: 66% 0 0; background: repeating-linear-gradient(100deg, transparent 0 34px, rgba(60,45,35,.09) 35px 37px); }
.room-panel--after { background: linear-gradient(#d3c7b5 0 66%, #785f4b 66%); }
.preview-label { position: absolute; z-index: 3; top: 17px; left: 17px; padding: 6px 11px; border-radius: 999px; color: var(--ink); background: rgba(255,253,249,.88); font-size: .72rem; font-weight: 800; }
.window { position: absolute; top: 55px; left: 19%; width: 62%; height: 190px; border: 10px solid #f3eee5; background: linear-gradient(155deg, #a9c0c1, #dfe3d9); box-shadow: inset 0 0 0 2px rgba(37,39,34,.15); }
.window::after { content: ""; position: absolute; inset: 0 48%; background: #f3eee5; }
.sofa { position: absolute; z-index: 2; left: 10%; right: 10%; bottom: 77px; height: 105px; border-radius: 22px 22px 8px 8px; background: #98978f; box-shadow: inset 0 -17px rgba(0,0,0,.08); }
.sofa::before, .sofa::after { content: ""; position: absolute; top: 20px; width: 44%; height: 50px; border-radius: 12px; background: rgba(255,255,255,.14); }
.sofa::before { left: 4%; } .sofa::after { right: 4%; }
.room-panel--after .sofa { background: #ac664d; }
.table { position: absolute; z-index: 3; left: 34%; bottom: 35px; width: 42%; height: 36px; border-radius: 50%; background: #4d3c30; box-shadow: 0 33px 0 -14px #3e3027; }
.art { position: absolute; top: 75px; right: 5%; width: 36px; height: 66px; border: 5px solid #f2e5d3; background: var(--accent); }
.plant { position: absolute; z-index: 3; left: 4%; bottom: 54px; width: 33px; height: 83px; border-radius: 70% 10% 70% 15%; background: #66775e; transform: rotate(-13deg); }

.how-it-works { padding: 88px 0 105px; border-top: 1px solid var(--line); background: var(--white); }
.how-it-works h2 { max-width: 650px; margin: 0; font: 400 clamp(2.3rem, 4vw, 4rem)/1 var(--font-display); letter-spacing: -0.045em; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; margin-top: 55px; }
.steps article { padding-top: 22px; border-top: 1px solid var(--line); }
.steps span { color: var(--accent); font-size: 0.75rem; font-weight: 800; }
.steps h3 { margin: 24px 0 6px; font: 400 1.6rem var(--font-display); }
.steps p { max-width: 280px; margin: 0; color: var(--ink-soft); }

.auth-page { display: grid; min-height: calc(100vh - 144px); place-items: center; padding: 60px 20px; background: radial-gradient(circle at 18% 10%, #ead8ca, transparent 35%), var(--paper); }
.auth-card { width: min(100%, 470px); padding: clamp(28px, 6vw, 52px); border: 1px solid var(--line); border-radius: 26px; background: var(--white); box-shadow: var(--shadow); }
.auth-card h1 { margin: 0; font: 400 2.65rem/1 var(--font-display); letter-spacing: -0.04em; }
.auth-card > .muted { margin: 15px 0 27px; }
.auth-switch { margin: 25px 0 0; text-align: center; color: var(--ink-soft); font-size: .88rem; }
.auth-switch a { color: var(--accent-dark); font-weight: 750; }
.stacked-form { display: grid; gap: 19px; }

.field { display: grid; gap: 8px; }
.field label { font-size: .78rem; font-weight: 800; letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  color: var(--ink);
  background: var(--white);
  transition: border 150ms ease, box-shadow 150ms ease;
}
.field input, .field select { height: 48px; padding: 0 14px; }
.field textarea { min-height: 100px; padding: 13px 14px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184,95,66,.12); }
.field small { color: var(--ink-soft); font-size: .77rem; }
.form-errors { margin-bottom: 24px; padding: 15px 18px; border: 1px solid #e5b4ae; border-radius: 12px; color: var(--danger); background: #fff5f2; font-size: .86rem; }
.form-errors ul { margin: 8px 0 0; padding-left: 20px; }

.workspace-page, .result-page { padding: 60px 0 100px; }
.workspace-heading, .result-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 42px; }
.workspace-heading h1, .result-heading h1 { margin: 0; font: 400 clamp(2.8rem, 6vw, 5.2rem)/.95 var(--font-display); letter-spacing: -0.055em; }
.workspace-heading p:last-child { max-width: 620px; margin: 15px 0 0; color: var(--ink-soft); }

.design-form { display: grid; gap: 20px; }
.form-card { display: grid; grid-template-columns: 55px 245px 1fr; gap: 28px; padding: 34px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.section-number { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--accent-dark); font-size: .72rem; font-weight: 800; }
.section-copy h2 { margin: 0 0 7px; font: 400 1.65rem var(--font-display); }
.section-copy p { margin: 0; color: var(--ink-soft); font-size: .86rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.field--wide { grid-column: 3; margin-top: 8px; }

.upload-zone { position: relative; display: grid; min-height: 310px; place-items: center; overflow: hidden; border: 1.5px dashed #bcb1a3; border-radius: 15px; background: #faf8f3; cursor: pointer; }
.upload-zone:hover { border-color: var(--accent); background: #fffaf6; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.upload-zone img { width: 100%; height: 100%; max-height: 470px; object-fit: contain; }
.upload-zone--filled { border-style: solid; background: #22231f; }
.upload-prompt { display: grid; place-items: center; text-align: center; }
.upload-prompt strong { margin-top: 13px; }
.upload-prompt small { color: var(--ink-soft); }
.upload-icon { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 50%; color: white; background: var(--accent); font-size: 1.7rem; font-weight: 300; }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choice-card { position: relative; cursor: pointer; }
.choice-card input { position: absolute; opacity: 0; }
.choice-card span { display: grid; min-height: 100px; align-content: center; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 13px; background: #faf8f3; transition: 150ms ease; }
.choice-card small { color: var(--ink-soft); font-size: .74rem; }
.choice-card input:checked + span { border-color: var(--accent); background: #fff2eb; box-shadow: inset 0 0 0 1px var(--accent); }
.choice-card input:focus-visible + span { outline: 3px solid rgba(184,95,66,.2); }
.generate-bar { position: sticky; z-index: 5; bottom: 18px; display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 18px 20px 18px 25px; border: 1px solid rgba(37,39,34,.14); border-radius: 18px; background: rgba(255,253,249,.94); box-shadow: 0 16px 48px rgba(43,35,27,.15); backdrop-filter: blur(16px); }
.generate-bar div { display: grid; }
.generate-bar span { color: var(--ink-soft); font-size: .78rem; }

.design-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.design-card { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: var(--white); transition: transform 160ms ease, box-shadow 160ms ease; }
.design-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.design-card-image { position: relative; aspect-ratio: 4/3; overflow: hidden; background: var(--paper-deep); }
.design-card-image img { width: 100%; height: 100%; object-fit: cover; }
.design-card-image .status { position: absolute; top: 12px; right: 12px; }
.design-card-body { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px; }
.design-card-body div { display: grid; }
.design-card-body span { color: var(--ink-soft); font-size: .75rem; }
.design-card-body .arrow { color: var(--accent); font-size: 1.3rem; }
.status { display: inline-flex; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.9); font-size: .68rem; font-weight: 800; }
.status--completed { color: var(--success); }
.status--failed { color: var(--danger); }
.empty-state { padding: 85px 20px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; background: rgba(255,255,255,.42); }
.empty-mark { display: grid; width: 58px; height: 58px; margin: 0 auto 23px; place-items: center; border-radius: 50%; color: white; background: var(--accent); font: 400 1.6rem var(--font-display); }
.empty-state h2 { margin: 0; font: 400 2.2rem var(--font-display); }
.empty-state p { margin: 10px 0 25px; color: var(--ink-soft); }

.result-heading { align-items: center; }
.result-heading .back-link { display: inline-block; margin-bottom: 30px; }
.result-intro { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 20px; }
.result-intro h2, .source-section h2, .brief-card h2 { margin: 0; font: 400 2rem var(--font-display); }
.result-intro p { margin: 0; color: var(--ink-soft); }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.result-card { padding: 9px 9px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.result-image-wrap { position: relative; aspect-ratio: 4/3; overflow: hidden; margin-bottom: 12px; border-radius: 12px; background: var(--paper-deep); }
.result-image-wrap img { width: 100%; height: 100%; object-fit: contain; background: #22231f; }
.result-image-wrap span { position: absolute; left: 13px; bottom: 13px; padding: 6px 10px; border-radius: 999px; background: rgba(255,253,249,.9); font-size: .72rem; font-weight: 800; }
.source-section { display: grid; grid-template-columns: 260px 1fr; gap: 40px; margin-top: 80px; padding-top: 35px; border-top: 1px solid var(--line); }
.source-section img { width: 100%; max-height: 620px; object-fit: contain; border-radius: 14px; background: #22231f; }
.brief-card { margin-top: 24px; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.brief-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 25px 0 0; }
.brief-card dl div { padding-top: 13px; border-top: 1px solid var(--line); }
.brief-card dt, .custom-note span { color: var(--ink-soft); font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.brief-card dd { margin: 5px 0 0; font-weight: 700; }
.custom-note { margin-top: 25px; padding: 18px; border-radius: 12px; background: var(--paper); }
.custom-note p { margin: 5px 0 0; }
.demo-notice { margin-bottom: 30px; padding: 14px 18px; border: 1px solid #d5be96; border-radius: 12px; color: #61491f; background: #fff7e7; font-size: .86rem; }
.demo-notice code { padding: 2px 5px; border-radius: 4px; background: rgba(97,73,31,.09); }
.generation-error, .generation-pending { display: flex; align-items: center; justify-content: center; gap: 22px; min-height: 250px; padding: 30px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
.generation-error > span { display: grid; width: 50px; height: 50px; place-items: center; border-radius: 50%; color: white; background: var(--danger); font-size: 1.4rem; font-weight: 800; }
.generation-error h2, .generation-pending h2 { margin: 0; font: 400 1.8rem var(--font-display); }
.generation-error p, .generation-pending p { margin: 5px 0 0; color: var(--ink-soft); }
.generation-pending { flex-direction: column; text-align: center; }
.spinner { width: 42px; height: 42px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.metric { display: grid; min-width: 100px; text-align: right; color: var(--ink-soft); }
.metric strong { color: var(--ink); font: 400 2rem var(--font-display); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 16px 20px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--ink-soft); background: #faf8f3; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }

.site-footer { border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .75rem; }
.footer-inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-copy { max-width: 700px; }
  .room-preview { min-height: 480px; transform: none; }
  .form-card { grid-template-columns: 48px 1fr; }
  .form-card > :nth-child(n+3), .field--wide { grid-column: 1 / -1; }
  .design-grid { grid-template-columns: 1fr 1fr; }
  .source-section { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1180px); }
  .header-inner { min-height: 64px; }
  .main-nav { gap: 13px; }
  .main-nav > a:first-child { display: none; }
  .brand { font-size: 1rem; }
  .hero { padding: 55px 0 65px; }
  .hero-copy h1 { font-size: clamp(3.25rem, 17vw, 5rem); }
  .hero-actions { align-items: flex-start; flex-direction: column; }
  .room-preview { min-height: 340px; border-width: 6px; border-radius: 20px; }
  .window { top: 44px; height: 120px; border-width: 7px; }
  .sofa { bottom: 55px; height: 70px; }
  .table { bottom: 25px; }
  .steps, .result-grid, .design-grid, .brief-card dl { grid-template-columns: 1fr; }
  .workspace-page, .result-page { padding: 42px 0 70px; }
  .workspace-heading, .result-heading, .result-intro { align-items: flex-start; flex-direction: column; margin-bottom: 30px; }
  .workspace-heading h1, .result-heading h1 { font-size: 3rem; }
  .form-card { grid-template-columns: 1fr; padding: 22px; gap: 18px; }
  .form-card > *, .field--wide { grid-column: 1; }
  .section-number { width: 35px; height: 35px; }
  .form-grid, .choice-grid { grid-template-columns: 1fr; }
  .upload-zone { min-height: 230px; }
  .generate-bar { align-items: stretch; flex-direction: column; bottom: 8px; }
  .generate-bar .button { width: 100%; }
  .source-section { margin-top: 55px; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation-duration: .01ms !important; }
}
