:root {
  --bg: #142016;
  --surface: rgba(255, 252, 247, 0.92);
  --text: #1a2618;
  --muted: #5a6a56;
  --accent: #3a8f4a;
  --accent-deep: #1e4d2b;
  --accent-soft: rgba(58, 143, 74, 0.12);
  --line: rgba(45, 80, 50, 0.16);
  --shadow: 0 24px 60px rgba(10, 24, 12, 0.28);
  --radius: 18px;
  --font-brand: "Fraunces", "Cormorant Garamond", Georgia, serif;
  --font-display: "ZCOOL XiaoWei", "Cormorant Garamond", "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --gold: #c6a45a;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.page-bg-photo {
  position: absolute;
  inset: -4%;
  background:
    url("https://images.unsplash.com/photo-1558904541-efa843a96f01?auto=format&fit=crop&w=2000&q=80")
    center 40% / cover no-repeat;
  transform: scale(1.05);
  animation: bgDrift 28s ease-in-out infinite alternate;
  filter: saturate(1.12) contrast(1.06);
}

.page-bg-wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(12, 28, 16, 0.55) 0%, rgba(18, 36, 22, 0.42) 28%, rgba(236, 242, 232, 0.78) 58%, rgba(238, 244, 234, 0.94) 100%),
    radial-gradient(ellipse 70% 50% at 15% 10%, rgba(70, 140, 80, 0.35), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 5%, rgba(198, 164, 90, 0.22), transparent 50%);
}

.page-bg-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background-image: url("data:image/svg+xml,%3Csvg width='120' height='120' viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%231e4d2b' stroke-width='1.2' opacity='0.55'%3E%3Cpath d='M60 10c8 18 8 34 0 50-8-16-8-32 0-50z'/%3E%3Cpath d='M60 20c14 6 24 16 30 30-16-4-30-4-44 0 6-14 16-24 30-30z'/%3E%3Cpath d='M60 60c0 22-8 40-20 50 4-18 8-34 20-50z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 140px 140px;
  mix-blend-mode: multiply;
}

.leaf {
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 70% 30% 68% 32% / 42% 62% 38% 58%;
  background: radial-gradient(circle at 30% 30%, rgba(120, 180, 110, 0.35), rgba(30, 77, 43, 0.08) 70%, transparent 75%);
  filter: blur(1px);
  animation: leafFloat 16s ease-in-out infinite;
  pointer-events: none;
}

.leaf-a { top: 8%; left: -40px; }
.leaf-b { top: 22%; right: -50px; width: 220px; height: 220px; animation-delay: -4s; animation-duration: 20s; }
.leaf-c { bottom: 18%; left: 8%; width: 140px; height: 140px; opacity: 0.55; animation-delay: -8s; }

@keyframes bgDrift {
  from { transform: scale(1.05) translate3d(0, 0, 0); }
  to { transform: scale(1.1) translate3d(-1.5%, -1%, 0); }
}

@keyframes leafFloat {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-18px) rotate(8deg); }
}

.site-header {
  max-width: 760px;
  margin: 0 auto;
  padding: 3.2rem 1.25rem 1.4rem;
  text-align: center;
  animation: rise 0.7s ease both;
}

.brand {
  margin: 0 0 0.85rem;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
}

.brand-mark {
  width: 42px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--accent), transparent);
  animation: markGlow 3.5s ease-in-out infinite;
}

@keyframes markGlow {
  0%, 100% { opacity: 0.55; transform: scaleX(0.85); }
  50% { opacity: 1; transform: scaleX(1); }
}

.brand-name {
  font-family: var(--font-brand);
  font-size: clamp(2.85rem, 9vw, 4.35rem);
  font-weight: 700;
  font-style: italic;
  font-optical-sizing: auto;
  letter-spacing: -0.02em;
  line-height: 0.92;
  color: #f4f8ef;
  -webkit-text-fill-color: #f4f8ef;
  background: none;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.18),
    0 12px 32px rgba(0, 0, 0, 0.4),
    0 2px 8px rgba(30, 77, 43, 0.45);
}

.site-header h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.4vw, 1.75rem);
  font-weight: 400;
  color: rgba(247, 250, 244, 0.92);
  letter-spacing: 0.12em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

.header-sub {
  margin: 0.95rem auto 0;
  max-width: 540px;
  color: rgba(236, 242, 232, 0.88);
  font-size: 1rem;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.3);
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

#gardenForm,
.result {
  background: var(--surface);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem 1.35rem 1.6rem;
  animation: rise 0.55s ease 0.12s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.15rem;
}

.field > span {
  font-size: 0.95rem;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.78rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font: inherit;
  color: var(--text);
  background: #fbfcf9;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field textarea { resize: vertical; min-height: 88px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 122, 62, 0.14);
}

.field input.invalid,
.field select.invalid,
.field textarea.invalid {
  border-color: #c45a4a;
}

.chip-fieldset {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  margin: 0 0 1.15rem;
  padding: 0.85rem 0.9rem 1rem;
  background: #fbfcf9;
}

.chip-fieldset.invalid {
  border-color: #c45a4a;
}

.chip-fieldset legend {
  padding: 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.chip-fieldset legend small {
  font-weight: 400;
  color: var(--muted);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.45rem;
}

.chip {
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  background: #fff;
  transition: all 0.2s;
}

.chip input:checked + span {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}

.chip input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(47, 122, 62, 0.14);
}

.upload-zone {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 1.6rem 1rem;
  text-align: center;
  cursor: pointer;
  background: linear-gradient(180deg, #fafcf8, #f1f6ed);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.upload-zone:hover,
.upload-zone:focus,
.upload-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.upload-zone:hover { transform: translateY(-1px); }

.upload-title { margin: 0; font-weight: 600; }
.upload-hint { margin: 0.35rem 0 0; font-size: 0.82rem; color: var(--muted); }

.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e8efe4;
  animation: rise 0.3s ease;
}

.preview-item img,
.preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-item .badge {
  position: absolute;
  bottom: 4px;
  left: 4px;
  font-size: 0.65rem;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
}

.preview-item .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  line-height: 1;
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 0.85rem 1.25rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn.primary {
  width: 100%;
  margin-top: 0.35rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  box-shadow: 0 10px 24px rgba(47, 122, 62, 0.28);
}

.btn.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(47, 122, 62, 0.34);
}

.btn.primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn.secondary {
  display: inline-block;
  margin-top: 1rem;
  background: #fff;
  color: var(--accent-deep);
  border: 1.5px solid var(--accent);
}

.btn.ghost {
  display: block;
  margin: 1.35rem auto 0;
  background: transparent;
  color: var(--muted);
}

.result-label {
  margin: 0 0 0.75rem;
  font-family: var(--font-brand);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.advice {
  font-family: var(--font-display);
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--text);
}

.advice p { margin: 0 0 0.85rem; }
.advice p:last-child { margin-bottom: 0; }

.meta {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--muted);
}

.result-block {
  margin-top: 1.75rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--line);
}

.result-block h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--accent-deep);
}

.block-intro {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.plant-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.plant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 640px;
}

.plant-table th,
.plant-table td {
  padding: 0.7rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.plant-table th {
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-weight: 600;
  white-space: nowrap;
}

.plant-table tr:last-child td { border-bottom: none; }
.plant-table em { color: var(--muted); font-size: 0.82rem; }

.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}

.ref-card {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f7faf5;
}

.ref-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e8efe4;
}

.ref-card figcaption {
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ref-card figcaption strong {
  color: var(--accent-deep);
  font-size: 0.78rem;
}

.redesign-empty {
  margin: 0;
  padding: 1.25rem;
  text-align: center;
  color: var(--muted);
  background: #f7faf5;
  border-radius: 12px;
  border: 1px dashed var(--line);
}

.redesign-list {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.redesign-card {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcf9;
}

.redesign-card-head h3 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--accent-deep);
}

.redesign-card-head p {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--muted);
  word-break: break-all;
}

.video-frame-wrap {
  position: relative;
}

.video-frame-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.frame-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 999px;
}

.redesign-error {
  margin: 0;
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.compare-labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.45rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-deep);
}

.compare-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.compare-pair figure {
  margin: 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #e8efe4;
}

.compare-pair img,
.compare-pair canvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.hidden { display: none !important; }

.site-footer-link {
  text-align: center;
  padding: 0 1.25rem 2rem;
  font-size: 0.82rem;
}

.site-footer-link a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer-link a:hover {
  color: var(--accent-deep);
  text-decoration: underline;
}

.upload-progress {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 700px) {
  .field-row,
  .ref-grid,
  .compare-labels,
  .compare-pair {
    grid-template-columns: 1fr;
  }

  .compare-labels span:last-child {
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  .site-header { padding-top: 2rem; }
  #gardenForm, .result { padding: 1.25rem 1.1rem 1.35rem; }
}
