:root {
  --ivory: #ffffff;
  --foam: #ffffff;
  --sage: #5a8674;
  --sage-deep: #2f5a4a;
  --ink: #161616;
  --muted: #6a6a6a;
  --line: rgba(0, 0, 0, 0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 80px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  color: var(--ink);
  background: url("assets/chengchu-page-bg.png?v=1") center / cover no-repeat fixed #efece6;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

a { color: inherit; text-decoration: none; }

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: calc(var(--nav-h) + var(--safe-top));
  padding: var(--safe-top) 48px 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.logo { display: flex; flex-direction: column; line-height: 1; justify-self: start; }
.logo em {
  font-family: "Bodoni MT", "Didot", "Palatino Linotype", serif;
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--sage-deep);
}
.logo strong {
  font-weight: 400;
  font-size: 34px;
  letter-spacing: 0.34em;
}

.site-nav nav {
  display: flex;
  gap: 48px;
  font-size: 18px;
  letter-spacing: 0.28em;
  color: #555;
}
.site-nav nav a:hover { color: var(--ink); }
.nav-balance { justify-self: end; }

.hero-cta,
.card .meta button {
  border: 1px solid rgba(90, 134, 116, 0.35);
  background: #fff;
  color: var(--sage-deep);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.hero-cta {
  background: var(--sage);
  color: #fff;
  border-color: transparent;
  padding: 16px 42px;
  font-size: 17px;
  letter-spacing: 0.18em;
}

.hero {
  min-height: calc(100dvh - 76px);
  display: grid;
  align-items: center;
  justify-items: start;
  padding: 48px 24px 48px 9%;
  background:
    linear-gradient(180deg, rgba(237, 236, 232, 0) 90%, rgba(238, 235, 229, 0.85) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 0%, rgba(255, 255, 255, 0.06) 42%, rgba(255, 255, 255, 0) 68%),
    url("assets/chengchu-desktop.png?v=7") 70% 50% / cover no-repeat #edece8;
}

.hero-copy {
  text-align: left;
  max-width: 36em;
}
.eyebrow {
  margin: 0 0 14px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--sage-deep);
}
.hero h1 {
  margin: 0 0 18px;
  font-weight: 300;
  font-size: clamp(40px, 5vw, 60px);
  letter-spacing: 0.22em;
  line-height: 1.25;
}
.hero h1 span { display: block; }
.lead {
  margin: 0 auto 32px;
  font-size: 17px;
  line-height: 1.8;
  color: #444;
}
.lead span { display: block; }

.shelf { padding: 0 64px 72px; }
.shelf-head {
  margin: 0 0 22px;
  padding-top: 20px;
  scroll-margin-top: calc(var(--nav-h) + var(--safe-top));
}
.shelf-head p {
  margin: 0 0 6px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--sage-deep);
}
.shelf-head h2 { margin: 0; font-weight: 400; font-size: 28px; letter-spacing: 0.16em; }

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

.card {
  display: flex;
  flex-direction: column;
  background: var(--foam);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 22px;
  overflow: hidden;
  padding: 0 0 18px;
  min-width: 0;
  box-shadow: 0 12px 32px rgba(22, 22, 22, 0.05);
}

.thumb {
  aspect-ratio: 1;
  overflow: hidden;
  background: #f6f6f6;
}
.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card h3 {
  margin: 16px 20px 8px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.4;
  min-height: 2.8em;
}
.card .desc {
  margin: 0 20px 8px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.card .fit {
  margin: 0 20px 16px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  min-height: 2.4em;
}
.card .fit span {
  font-size: 12.5px;
  letter-spacing: 0.08em;
  color: var(--sage-deep);
}
.card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding: 0 20px;
}
.card .meta b { font-size: 18px; font-weight: 500; color: var(--sage-deep); }

.site-foot {
  padding: 48px 64px 96px;
  color: var(--muted);
  font-size: 13px;
}

.fab {
  position: fixed;
  right: 28px;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 40;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: var(--sage);
  color: #fff;
  box-shadow: 0 14px 32px rgba(61, 104, 88, 0.28);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.08em;
}
body.chat-open .fab { display: none; }

.mp {
  position: fixed;
  right: 28px;
  bottom: calc(28px + var(--safe-bottom));
  z-index: 35;
  width: min(520px, calc(100vw - 48px));
  height: min(880px, calc(100dvh - var(--nav-h) - var(--safe-top) - 28px - var(--safe-bottom) - 12px));
  display: flex;
  flex-direction: column;
  background: var(--ivory);
  border-radius: 28px;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.14);
  overflow: hidden;
}
.mp::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/chengchu-chat-bg.png?v=6") center / cover no-repeat;
  opacity: 1;
  pointer-events: none;
  z-index: 0;
}
.mp > * { position: relative; z-index: 1; }
.mp[hidden] { display: none; }

.mp-nav {
  display: grid;
  grid-template-columns: 64px 1fr 88px;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.78);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.nav-reset {
  border: 0;
  background: transparent;
  color: var(--sage-deep);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.nav-title { display: flex; flex-direction: column; align-items: center; }
.nav-title strong { font-size: 16px; font-weight: 600; }

.live {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}
.live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c8c8c8;
}
.live.ok { color: var(--sage-deep); }
.live.ok::before { background: #5ea67a; box-shadow: 0 0 0 3px rgba(94, 166, 122, 0.2); }
.live.off { color: #b42318; }
.live.off::before { background: #e35d5d; }

.nav-close {
  justify-self: end;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.chat {
  flex: 1;
  overflow: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: transparent;
}

.gate {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.gate[hidden] { display: none; }
.gate-card {
  width: 100%;
  max-width: 300px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.gate-card strong { font-size: 16px; font-weight: 600; }
.gate-card p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.gate-card input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  outline: none;
  text-align: center;
}
.gate-card input:focus { border-color: var(--sage); }
.gate-card button {
  border: 0;
  border-radius: 10px;
  padding: 10px 0;
  background: var(--sage);
  color: #f7fffb;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.gate-card button:hover { background: var(--sage-deep); }
.gate-card button:disabled { opacity: 0.6; cursor: default; }
.gate-err { color: #b42318 !important; }

.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 86%;
  animation: rise 0.24s ease;
}
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; }
.col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.who { font-size: 11px; color: var(--muted); padding-left: 4px; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: #e7eee9;
}

.bubble {
  padding: 10px 13px;
  border-radius: 16px;
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 14.5px;
}
.msg.bot .bubble {
  background: var(--foam);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}
.msg.user .bubble {
  background: var(--sage);
  color: #f7fffb;
  border-bottom-right-radius: 5px;
}
.bubble b.pname { font-weight: 600; color: var(--sage-deep); }
.msg.user .bubble b.pname { color: #fff; }

.composer {
  flex-shrink: 0;
  padding: 8px 12px 12px;
  background: rgba(255, 255, 255, 0.86);
  border-top: 1px solid var(--line);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink, #3a3f3a);
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--sage);
  color: var(--sage);
}

.pending {
  display: flex;
  margin-bottom: 8px;
}
.pending[hidden] { display: none; }
.pending-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}
.pending-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}
.pending-thumb button {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #2b2723;
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px #fff;
}

.row { display: flex; gap: 8px; align-items: flex-end; }

button.attach {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--sage-deep);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
button.attach:hover { background: #f4f4f4; }
button.attach:disabled { opacity: 0.45; cursor: wait; }

.bubble .pcard-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  justify-content: safe center;
}
.bubble .pcard {
  flex: 0 0 150px;
  margin: 0;
  padding: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.bubble .pcard:hover {
  box-shadow: 0 8px 20px rgba(22, 22, 22, 0.08);
  transform: translateY(-1px);
}
.bubble .pcard img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: contain;
  background: #fff;
}
.bubble .pcard-name {
  display: block;
  margin: 8px 6px 3px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink);
  white-space: nowrap;
  text-align: center;
}
.bubble .pcard-info {
  display: block;
  margin: 0 6px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
}
.bubble .pcard-price {
  color: var(--sage-deep);
  font-weight: 600;
}
.bubble .pcard-combo {
  margin-top: 8px;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--sage-deep);
  font-weight: 500;
}
.msg.user .bubble img.user-pic {
  display: block;
  max-width: 180px;
  max-height: 180px;
  border-radius: 10px;
  margin-bottom: 8px;
  object-fit: cover;
}
.msg.user .bubble img.user-pic:last-child { margin-bottom: 0; }

textarea {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 96px;
  border-radius: 21px;
  border: 1px solid var(--line);
  background: var(--ivory);
  padding: 10px 14px;
  font: inherit;
  font-size: 15px;
  outline: none;
}
textarea:focus { border-color: rgba(90, 134, 116, 0.45); background: #fff; }

button.send {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 21px;
  background: var(--sage);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}
button.send:disabled { opacity: 0.45; cursor: wait; }

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 980px) {
  :root { --nav-h: 64px; }
  .bubble .pcard { flex: 0 0 calc(50% - 5px); min-width: 0; }
  .bubble .pcard img { height: 104px; }
  .bubble .pcard-name,
  .bubble .pcard-info { white-space: normal; }
  .site-nav {
    padding: var(--safe-top) 20px 0;
    grid-template-columns: auto 1fr;
  }
  .nav-balance { display: none; }
  .logo strong { font-size: 26px; letter-spacing: 0.24em; }
  .site-nav nav { justify-self: end; gap: 18px; font-size: 15px; letter-spacing: 0.16em; }
  .hero {
    min-height: 88dvh;
    place-items: start center;
    padding: 56px 24px 72px;
    background:
      linear-gradient(180deg, rgba(240, 239, 237, 0) 90%, rgba(240, 237, 231, 0.85) 100%),
      linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.55) 0%,
        rgba(255, 255, 255, 0.22) 36%,
        rgba(255, 255, 255, 0.04) 70%,
        rgba(255, 255, 255, 0) 100%
      ),
      url("assets/chengchu-mobile.png?v=7") 50% 0% / cover no-repeat #f0efed;
  }
  html, body {
    background-image: url("assets/chengchu-page-bg-mobile.png?v=1");
  }
  .hero-copy { padding-top: 12px; text-align: center; }
  .hero .lead { margin: 0 auto 22px; }
  .hero .hero-cta { padding: 11px 28px; font-size: 14px; letter-spacing: 0.12em; }
  .hero .eyebrow,
  .hero h1,
  .hero .lead {
    text-shadow: 0 1px 14px rgba(255, 255, 255, 0.95);
  }
  .shelf, .site-foot { padding-left: 20px; padding-right: 20px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fab { right: 18px; }
  .mp {
    top: calc(var(--nav-h) + var(--safe-top));
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: auto;
    border-radius: 0;
    box-shadow: none;
  }
  body.chat-open { overflow: hidden; }
}

@media (max-width: 560px) {
  .grid { grid-template-columns: 1fr; }
}
