:root {
  --bg: #f5f1e8;
  --paper: #fffdfa;
  --ink: #1d1b18;
  --muted: #6f665a;
  --line: #d5cab9;
  --accent: #1f6f64;
  --accent-strong: #18554d;
  --danger: #ad3f3f;
  --shadow: 0 20px 40px rgba(58, 48, 36, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  background: radial-gradient(circle at 20% 15%, #ffffff 0%, var(--bg) 45%, #ece5d8 100%);
  color: var(--ink);
  position: relative;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(2px);
  z-index: -1;
}

.shape-1 {
  width: 320px;
  height: 320px;
  top: -80px;
  right: -40px;
  background: rgba(31, 111, 100, 0.18);
}

.shape-2 {
  width: 280px;
  height: 280px;
  bottom: -90px;
  left: -60px;
  background: rgba(173, 114, 71, 0.16);
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 20px 64px;
}

/* Hero */
.hero {
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.subtext {
  margin: 12px 0 0;
  color: var(--muted);
  max-width: 520px;
  font-size: 1.02rem;
  line-height: 1.55;
}

/* Panel */
.panel {
  background: color-mix(in srgb, var(--paper) 88%, white 12%);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0;
}

/* Step sections */
.step-section {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.step-section:first-child {
  padding-top: 0;
}

.step-section:last-of-type {
  border-bottom: none;
}

.step-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.step-num {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  margin-top: 2px;
}

.step-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.step-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.optional-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: #ede8df;
  border-radius: 6px;
  padding: 2px 7px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 200px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  padding: 32px 20px;
}

.dropzone:hover,
.dropzone.dragging {
  border-color: var(--accent);
  background: #f4fdfb;
  transform: translateY(-2px);
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  color: var(--muted);
  margin-bottom: 4px;
}

.dropzone-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.dropzone-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

/* Image preview */
.image-preview-wrap {
  margin-top: 14px;
}

.image-preview-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}

.preview-img-large {
  width: 100%;
  height: 280px;
  object-fit: cover;
  display: block;
}

.preview-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.preview-filename {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 340px;
}

.preview-btns {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Dimensions */
.dimension-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.86rem;
  color: var(--muted);
}

.field input,
.field select {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(31, 111, 100, 0.18);
  border-color: var(--accent);
}

.dimension-status {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.dimension-status.ok {
  color: var(--accent-strong);
}

.metrics {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.metrics p {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 0.9rem;
}

/* Brief / reference upload */
.step-section textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-size: 0.95rem;
  background: #fff;
  resize: vertical;
  min-height: 110px;
}

.step-section textarea:focus {
  outline: 2px solid rgba(31, 111, 100, 0.18);
  border-color: var(--accent);
}

.reference-upload {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.reference-copy {
  display: grid;
  gap: 3px;
}

.reference-title,
.reference-hint {
  margin: 0;
}

.reference-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.reference-hint {
  color: var(--muted);
  font-size: 0.88rem;
}

.upload-btn {
  cursor: pointer;
  flex-shrink: 0;
}

.reference-preview {
  margin-top: 12px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  padding: 16px;
  text-align: center;
  font-size: 0.9rem;
}

.reference-card {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.reference-image {
  width: 100px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.reference-meta {
  min-width: 0;
}

.reference-name,
.reference-caption {
  margin: 0;
}

.reference-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.reference-caption {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Opposite wall prompt modal */
.opp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

.opp-modal {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 28px 24px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.opp-modal-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(31, 111, 100, 0.1);
  color: var(--accent);
  display: grid;
  place-items: center;
  margin-bottom: 16px;
}

.opp-modal-icon svg {
  width: 26px;
  height: 26px;
}

.opp-modal h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}

.opp-modal p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.opp-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opp-modal-skip {
  background: none;
  border: none;
  padding: 8px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.opp-modal-skip:hover {
  color: var(--ink);
}

/* Buttons */
.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  padding: 12px 28px;
  font-size: 1rem;
}

.btn.primary:hover:enabled {
  background: var(--accent-strong);
}

.btn.ghost {
  background: #f4ede1;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.danger {
  background: #fff4f4;
  color: var(--danger);
  border: 1px solid #e9c7c7;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.84rem;
  min-height: 34px;
}

/* Footer */
.footer-actions {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.form-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-status.error {
  color: var(--danger);
}

/* Lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.lightbox-img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 12px;
  object-fit: contain;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Responsive */
@media (max-width: 680px) {
  .panel {
    padding: 18px;
  }

  .dimension-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .reference-upload,
  .footer-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .reference-upload .btn,
  .footer-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .reference-card {
    grid-template-columns: 1fr;
  }

  .reference-image {
    width: 100%;
    height: 160px;
  }

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

  .preview-filename {
    max-width: 100%;
  }

  .preview-btns {
    width: 100%;
  }

  .preview-btns .btn {
    flex: 1;
    justify-content: center;
  }
}
