:root {
  --c1: #051f20;
  --c2: #0b2b26;
  --c3: #163832;
  --c4: #235347;
  --c5: #8eb69b;
  --c6: #daf1de;
  --bg: var(--c6);
  --text: var(--c1);
  --muted: rgba(5, 31, 32, 0.58);
  --accent: var(--c4);
  --accent-soft: rgba(142, 182, 155, 0.35);
  --line: rgba(5, 31, 32, 0.1);
  --font: 'Huninn', -apple-system, 'PingFang TC', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r-card: 22px;
  --r-btn: 16px;
  --glass-bg: rgba(255, 255, 255, 0.5);
  --glass-border: rgba(255, 255, 255, 0.75);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 0 rgba(35, 83, 71, 0.08), 0 10px 30px rgba(22, 56, 50, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; }
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 40% at 0% 0%, rgba(255, 255, 255, 0.9), transparent 70%),
    radial-gradient(55% 40% at 100% 45%, rgba(142, 182, 155, 0.55), transparent 70%),
    radial-gradient(70% 45% at 10% 100%, rgba(142, 182, 155, 0.4), transparent 70%),
    var(--c6);
}
button { font: inherit; color: inherit; cursor: pointer; }

.glass {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.32) 55%, rgba(255, 255, 255, 0.45));
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; text-align: center; }
.mark { display: inline-block; letter-spacing: 0.35em; padding: 6px 14px 6px calc(14px + 0.35em); color: var(--accent); font-size: 13px; margin-bottom: 24px; border-radius: 999px; }
.center h1 { font-weight: 400; font-size: 24px; margin: 0 0 8px; }
.center p { color: var(--muted); font-size: 14px; margin: 0 0 24px; line-height: 1.7; }

.lock { width: min(340px, 100%); padding: 28px 22px 22px; border-radius: 28px; }
.lock input {
  width: 100%; height: 54px; border-radius: var(--r-btn); border: 1px solid rgba(35, 83, 71, 0.18); background: rgba(255, 255, 255, 0.75);
  color: var(--text); font: inherit; font-size: 22px; text-align: center; letter-spacing: 0.3em; outline: none;
  box-shadow: inset 0 2px 5px rgba(22, 56, 50, 0.08);
}
.lock input:focus { border-color: var(--accent); }
.lock .err { color: #b4472f; font-size: 13px; min-height: 20px; margin: 10px 0 6px; }

.btn {
  display: block; width: 100%; height: 54px; border: 0; border-radius: var(--r-btn);
  background: linear-gradient(180deg, #2f6a5a, var(--c4) 50%, var(--c3));
  color: var(--c6); font-size: 17px; letter-spacing: 0.15em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 0 rgba(0, 0, 0, 0.15), 0 10px 24px rgba(22, 56, 50, 0.3);
  transition: transform 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; }

.ribbon { margin: 12px 16px 0; padding: 8px 14px; border-radius: 999px; color: var(--c4); font-size: 12px; text-align: center; letter-spacing: 0.05em; }

.page { max-width: 560px; margin: 0 auto; padding: 0 16px calc(104px + var(--safe-b)); }
.topbar { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.topbar .name { font-size: 13px; color: var(--muted); letter-spacing: 0.08em; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--c3); padding: 0; }
.icon-btn svg { width: 19px; height: 19px; }

.hero { padding: 22px 20px; border-radius: var(--r-card); }
.hero .addr { color: var(--accent); font-size: 13px; letter-spacing: 0.15em; }
.hero .price { font-size: 42px; margin: 6px 0 2px; letter-spacing: 0.02em; display: flex; align-items: center; gap: 10px; }
.hero .sub { color: var(--muted); font-size: 14px; }
.tag { font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--c4); color: var(--c6); }

.section-title { font-size: 16px; letter-spacing: 0.15em; margin: 28px 4px 12px; display: flex; align-items: baseline; justify-content: space-between; }
.section-title small { font-size: 12px; color: var(--muted); letter-spacing: 0.03em; }

.plan { border-radius: var(--r-card); padding: 16px 12px; background: #fff; border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: 0 10px 30px rgba(22, 56, 50, 0.12); }
.plan svg { display: block; width: 100%; height: auto; }
.plan .room { fill: transparent; cursor: pointer; transition: fill 0.2s; }
.plan .room:active { fill: var(--accent-soft); }
.plan .wall { stroke: var(--c2); stroke-width: 5; stroke-linecap: round; }
.plan .label { fill: var(--c1); font-size: 42px; text-anchor: middle; pointer-events: none; font-family: var(--font); }
.plan .label .size { fill: var(--c4); font-size: 34px; }

.facts { border-radius: var(--r-card); margin: 0; overflow: hidden; }
.fact { display: flex; justify-content: space-between; gap: 16px; padding: 15px 18px; border-bottom: 1px solid var(--line); font-size: 15px; }
.fact:last-child { border-bottom: 0; }
.fact dt { color: var(--muted); flex-shrink: 0; }
.fact dd { margin: 0; text-align: right; }

.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(14px + var(--safe-b)); background: linear-gradient(to top, rgba(218, 241, 222, 0.95) 40%, transparent); }
.bottom-bar .btn { max-width: 528px; margin: 0 auto; }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%) translateY(12px); z-index: 20;
  color: var(--text); font-size: 14px; padding: 11px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: 0.25s; max-width: calc(100% - 32px);
  background: rgba(255, 255, 255, 0.75); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* 3D 看房 */
body.in-3d { overflow: hidden; }
.viewer { position: fixed; inset: 0; z-index: 10; background: var(--bg); display: none; touch-action: none; user-select: none; -webkit-user-select: none; overflow: hidden; }
.viewer.open { display: block; }
.viewer canvas { display: block; width: 100%; height: 100%; }

.v-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; background: var(--bg); transition: opacity 0.4s; z-index: 3; }
.v-loading.done { opacity: 0; pointer-events: none; }
.v-bar { width: 200px; height: 6px; border-radius: 999px; background: rgba(35, 83, 71, 0.15); overflow: hidden; }
.v-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--c4); transition: width 0.2s; }
.v-pct { color: var(--muted); font-size: 13px; margin-top: 14px; }

.v-btn {
  position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); height: 42px; min-width: 42px; padding: 0 14px;
  display: flex; align-items: center; gap: 6px; border-radius: 999px; color: var(--c1); font-size: 13px; z-index: 2;
  background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.v-btn svg { width: 18px; height: 18px; }
.v-back { left: calc(12px + env(safe-area-inset-left, 0px)); padding: 0; justify-content: center; }
.v-mode { right: calc(12px + env(safe-area-inset-right, 0px)); }
.v-gyro { right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(62px + env(safe-area-inset-top, 0px)); }
.v-gyro.on { background: var(--c4); color: var(--c6); border-color: var(--c4); }

.v-room {
  position: absolute; top: calc(70px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; opacity: 0; padding: 10px 22px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.v-room b { display: block; font-weight: 400; font-size: 20px; letter-spacing: 0.15em; padding-left: 0.15em; }
.v-room span { color: var(--c4); font-size: 13px; }
.v-room.show { animation: roomTag 3s ease forwards; }
@keyframes roomTag { 0% { opacity: 0; transform: translate(-50%, 6px); } 15%, 70% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.v-joy {
  position: absolute; left: calc(28px + env(safe-area-inset-left, 0px)); bottom: calc(32px + var(--safe-b)); width: 116px; height: 116px; border-radius: 50%; display: none; place-items: center; z-index: 2;
  background: rgba(255, 255, 255, 0.35); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.v-joy i { width: 46px; height: 46px; border-radius: 50%; background: linear-gradient(180deg, #2f6a5a, var(--c4)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 12px rgba(5, 31, 32, 0.3); }
.joy-mode .v-joy { display: grid; }

.v-demo { position: absolute; right: calc(12px + env(safe-area-inset-right, 0px)); bottom: calc(14px + var(--safe-b)); font-size: 11px; color: var(--c1); padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.65); border: 1px solid var(--glass-border); pointer-events: none; }

.v-tutorial { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; background: rgba(5, 31, 32, 0.35); opacity: 0; pointer-events: none; transition: opacity 0.4s; z-index: 2; }
.v-tutorial.show { opacity: 1; }
.v-tutorial p { margin: 24px 0 0; font-size: 16px; letter-spacing: 0.12em; padding: 8px 18px; border-radius: 999px; background: rgba(255, 255, 255, 0.75); color: var(--c1); }
.v-hand { width: 38px; height: 38px; border-radius: 50%; border: 2px solid #fff; background: rgba(255, 255, 255, 0.35); animation: hand 2.4s ease-in-out infinite; }
@keyframes hand {
  0% { transform: translateX(0) scale(1); }
  12% { transform: translateX(0) scale(0.75); }
  24% { transform: translateX(0) scale(1); }
  45% { transform: translateX(-50px); }
  75% { transform: translateX(50px); }
  100% { transform: translateX(0); }
}

.v-demo { right: auto; left: 50%; transform: translateX(-50%); }
.v-mini {
  position: absolute; right: calc(12px + env(safe-area-inset-right, 0px)); bottom: calc(14px + var(--safe-b)); width: 136px; padding: 8px; z-index: 2;
  border-radius: 18px; background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow);
}
.v-mini svg { display: block; width: 100%; height: auto; max-height: 150px; }
.v-mini .room { fill: transparent; }
.v-mini .wall { stroke: var(--c2); stroke-width: 1.2px; vector-effect: non-scaling-stroke; }
.me .cone { fill: rgba(35, 83, 71, 0.3); }
.me .dot { fill: var(--c4); stroke: #fff; stroke-width: 7; }

.v-2d { position: absolute; inset: 0; z-index: 4; display: none; place-items: center; padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + var(--safe-b));
  background: rgba(218, 241, 222, 0.55); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.v-2d.open { display: grid; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } }
.v-2d-card { width: min(560px, 100%); max-height: 100%; display: flex; flex-direction: column; gap: 12px; padding: 18px 14px 14px; }
.v-2d-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 6px; font-size: 16px; letter-spacing: 0.15em; }
.v-2d-head small { color: var(--muted); font-size: 12px; letter-spacing: 0.03em; }
.v-2d svg { flex: 1; min-height: 0; max-height: calc(100dvh - 190px); }
@media (orientation: landscape) and (max-height: 500px) {
  .v-2d-card { flex-direction: row; flex-wrap: wrap; width: auto; }
  .v-2d svg { max-height: calc(100dvh - 130px); width: auto; }
  .v-2d-head, .v-2d-close { width: 100%; }
}

.v-measure { right: calc(12px + env(safe-area-inset-right, 0px)); top: calc(112px + env(safe-area-inset-top, 0px)); }
.v-measure.on { background: var(--c4); color: var(--c6); border-color: var(--c4); }
.measuring .v-joy, .measuring .v-mini, .measuring .v-demo, .measuring .v-room { display: none; }
.v-labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.v-label {
  position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 15px; color: var(--c1); padding: 5px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.88); border: 1px solid var(--glass-border); box-shadow: 0 4px 14px rgba(5, 31, 32, 0.2);
}
.v-label small { color: var(--c4); font-size: 11px; margin-right: 6px; }
.v-measure-bar {
  position: absolute; left: 12px; right: 12px; bottom: calc(14px + var(--safe-b)); z-index: 2; display: none; align-items: center; gap: 8px; padding: 10px 10px 10px 16px;
  border-radius: 20px; background: rgba(255, 255, 255, 0.78); backdrop-filter: blur(18px) saturate(160%); -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); max-width: 520px; margin: 0 auto;
}
.measuring .v-measure-bar { display: flex; }
.v-measure-text { flex: 1; min-width: 0; }
.v-measure-text b { display: block; font-weight: 400; font-size: 14px; color: var(--c1); }
.v-measure-text small { display: block; font-size: 11px; color: #9a5b2e; margin-top: 2px; }
.v-chip { flex-shrink: 0; height: 38px; padding: 0 14px; border-radius: 14px; border: 1px solid rgba(35, 83, 71, 0.25); background: rgba(255, 255, 255, 0.7); color: var(--c1); font-size: 14px; }
.v-chip-dark { background: var(--c4); border-color: var(--c4); color: var(--c6); }

.v-gallery { left: calc(12px + env(safe-area-inset-left, 0px)); top: calc(62px + env(safe-area-inset-top, 0px)); display: none; }
.has-gallery .v-gallery { display: flex; }
.measuring .v-gallery { display: none; }

.gallery { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--c6); animation: fadeIn 0.2s ease; padding-top: env(safe-area-inset-top, 0px); }
.g-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.g-head b { font-weight: 400; font-size: 20px; letter-spacing: 0.1em; margin-right: 10px; }
.g-head span { color: var(--muted); font-size: 12px; }
.g-close { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--glass-border); background: rgba(255, 255, 255, 0.7); box-shadow: var(--glass-shadow); color: var(--c1); padding: 0; }
.g-close svg { width: 18px; height: 18px; }
.g-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.g-track::-webkit-scrollbar { display: none; }
.g-slide { flex: 0 0 100%; scroll-snap-align: center; margin: 0; padding: 0 16px; display: grid; place-items: center; position: relative; }
.g-pic { position: relative; max-width: 100%; }
.g-slide img { display: block; max-width: 100%; max-height: calc(100dvh - 170px - env(safe-area-inset-top, 0px) - var(--safe-b)); border-radius: 18px; box-shadow: 0 12px 30px rgba(22, 56, 50, 0.18); user-select: none; -webkit-user-select: none; }
.g-slide figcaption { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 12px; color: var(--c6); background: rgba(5, 31, 32, 0.65); padding: 4px 12px; border-radius: 999px; letter-spacing: 0.1em; }
.g-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px calc(16px + var(--safe-b)); scrollbar-width: none; }
.g-tabs::-webkit-scrollbar { display: none; }
.g-tabs button { flex-shrink: 0; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid rgba(35, 83, 71, 0.2); background: rgba(255, 255, 255, 0.6); color: var(--c1); font-size: 14px; }
.g-tabs button.on { background: var(--c4); border-color: var(--c4); color: var(--c6); }

.reno { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; }
.reno::-webkit-scrollbar { display: none; }
.reno button { flex-shrink: 0; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: 999px; font-size: 14px; color: var(--c1); }
.reno svg { width: 16px; height: 16px; color: var(--c4); }
