:root {
  --forest: #102b25;
  --forest-2: #1c493b;
  --mint: #9bdd75;
  --cream: #f6f2e8;
  --orange: #ffb14a;
  --ink: #173129;
  --muted: #728078;
  --card: #fffdf7;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--cream); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif; }
body { overscroll-behavior-y: none; }
button { font: inherit; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.hero { min-height: 158px; padding: calc(26px + env(safe-area-inset-top)) 22px 22px; color: white; background: var(--forest); display: flex; align-items: flex-end; justify-content: space-between; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; width: 190px; height: 190px; border: 1px solid rgba(155,221,117,.22); border-radius: 48% 52% 62% 38%; right: -60px; top: -80px; transform: rotate(22deg); box-shadow: 0 0 0 28px rgba(155,221,117,.04), 0 0 0 55px rgba(155,221,117,.03); }
.eyebrow { font-size: 10px; letter-spacing: .22em; color: var(--mint); font-weight: 800; }
.eyebrow.dark { color: #548462; }
h1 { font-family: Georgia, "Songti SC", serif; font-size: 34px; margin: 5px 0 4px; letter-spacing: .05em; }
.hero p { margin: 0; font-size: 12px; color: rgba(255,255,255,.68); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-pill { position: relative; z-index: 1; min-width: 82px; text-align: center; padding: 10px 12px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); backdrop-filter: blur(8px); border-radius: 16px; }
.score-pill span { display: block; font-size: 9px; color: rgba(255,255,255,.6); }
.score-pill strong { font: 700 24px Georgia, serif; color: var(--orange); }

.map-card { height: min(54vh, 470px); min-height: 360px; margin: 0; position: relative; overflow: hidden; background: #c9d8c4; }
#map, #camera { position: absolute; inset: 0; width: 100%; height: 100%; }
#camera { object-fit: cover; display: none; background: #101915; }
.map-shade { pointer-events: none; position: absolute; inset: 0; box-shadow: inset 0 50px 50px rgba(16,43,37,.12), inset 0 -100px 80px rgba(10,29,24,.4); }
.map-controls { position: absolute; right: 16px; top: 16px; z-index: 500; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.circle-btn, .camera-btn { border: 0; box-shadow: 0 5px 20px rgba(13,34,28,.18); background: rgba(255,253,247,.94); color: var(--forest); }
.circle-btn { width: 42px; height: 42px; border-radius: 50%; font-size: 24px; }
.camera-btn { border-radius: 22px; padding: 10px 14px; font-size: 12px; font-weight: 700; }
.camera-btn span { color: #df5f45; }
.radar-status { position: absolute; z-index: 500; left: 16px; top: 16px; padding: 8px 11px; border-radius: 16px; background: rgba(16,43,37,.82); color: white; font-size: 11px; backdrop-filter: blur(8px); }
.radar-status i { display: inline-block; width: 7px; height: 7px; background: var(--orange); border-radius: 50%; margin-right: 5px; }
.radar-status i.live { background: var(--mint); box-shadow: 0 0 0 4px rgba(155,221,117,.18); }
.nearest-panel { position: absolute; z-index: 500; left: 16px; right: 16px; bottom: 15px; border-radius: 18px; background: rgba(16,43,37,.9); color: white; padding: 13px 16px; backdrop-filter: blur(10px); display: grid; grid-template-columns: 1fr auto; gap: 1px 8px; align-items: center; }
.nearest-panel small { grid-column: 1; font-size: 9px; letter-spacing: .08em; color: rgba(255,255,255,.55); }
.nearest-panel strong { grid-column: 1; font-size: 15px; }
.nearest-panel span { grid-column: 2; grid-row: 1 / 3; font: 700 22px Georgia, serif; color: var(--mint); }

.progress-section { padding: 26px 18px; }
.section-title { display: flex; justify-content: space-between; align-items: flex-end; }
.section-title h2 { margin: 4px 0 0; font: 700 25px Georgia, "Songti SC", serif; }
#progressText { font: 700 16px Georgia, serif; color: #4f7860; }
.progress-track { height: 5px; border-radius: 4px; background: #dfe4d9; margin: 14px 0 18px; overflow: hidden; }
#progressBar { width: 0; height: 100%; background: linear-gradient(90deg, #4b8560, var(--mint)); transition: width .5s ease; }
.treasure-list { display: grid; gap: 11px; }
.treasure-card { border: 1px solid #e2e4da; background: var(--card); border-radius: 18px; padding: 13px; display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 12px; box-shadow: 0 5px 16px rgba(28,58,46,.05); }
.treasure-card.collected { opacity: .72; background: #eef1e9; }
.treasure-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 15px; color: var(--orange); background: #fff2d8; font-size: 25px; position: relative; }
.collected .treasure-icon { background: #dce9d8; color: #558165; }
.treasure-info h3 { font-size: 15px; margin: 0 0 5px; }
.treasure-info p { color: var(--muted); font-size: 11px; margin: 0; }
.treasure-state { text-align: right; }
.distance { display: block; font: 700 15px Georgia, serif; color: #50745e; margin-bottom: 5px; }
.pickup-btn { border: 0; border-radius: 13px; padding: 8px 11px; color: white; background: var(--forest-2); font-size: 11px; font-weight: 700; }
.pickup-btn:disabled { color: #869088; background: #e2e5df; }
.done-tag { color: #5a8668; font-size: 11px; font-weight: 700; }
.skeleton { height: 80px; border-radius: 18px; background: linear-gradient(100deg,#e4e5df 20%,#f1f0ea 45%,#e4e5df 70%); background-size: 300% 100%; animation: loading 1.4s infinite; }
@keyframes loading { to { background-position: -150% 0; } }

.wechat-tip { position: fixed; z-index: 2000; left: 10px; right: 10px; top: calc(8px + env(safe-area-inset-top)); background: #fff6d8; color: #5b471a; border: 1px solid #f0d88c; box-shadow: 0 5px 18px rgba(0,0,0,.16); border-radius: 12px; padding: 11px 38px 11px 13px; font-size: 12px; line-height: 1.5; }
.wechat-tip button { border: 0; background: none; position: absolute; right: 8px; top: 6px; font-size: 22px; color: #856f38; }
.toast { opacity: 0; pointer-events: none; position: fixed; z-index: 3000; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 15px); background: rgba(11,31,26,.92); color: white; border-radius: 20px; padding: 10px 16px; font-size: 12px; transition: .25s; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal { position: fixed; z-index: 2500; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(8,25,20,.78); backdrop-filter: blur(8px); }
.modal-card { position: relative; width: min(100%, 360px); text-align: center; background: var(--cream); border-radius: 28px; padding: 35px 25px 25px; animation: modalIn .5s cubic-bezier(.2,1.5,.5,1); overflow: hidden; }
@keyframes modalIn { from { opacity: 0; transform: translateY(35px) scale(.75) rotate(-3deg); } }
.modal-close { position: absolute; right: 13px; top: 10px; border: 0; background: none; color: #738078; font-size: 24px; }
.treasure-burst { width: 104px; height: 104px; margin: 0 auto 20px; border-radius: 50%; display: grid; place-items: center; background: repeating-conic-gradient(from 0deg, #f5d78d 0 12deg, transparent 12deg 24deg); animation: spin 10s linear infinite; }
.chest { width: 66px; height: 66px; border-radius: 20px; display: grid; place-items: center; background: var(--forest); border: 5px solid var(--orange); color: #fff4a8; font-size: 34px; transform: rotate(-5deg); box-shadow: 0 12px 25px rgba(16,43,37,.25); }
@keyframes spin { to { transform: rotate(360deg); } }
.modal-card h2 { font: 700 27px Georgia, "Songti SC", serif; margin: 7px 0 8px; }
.modal-card p { margin: 0 auto 15px; color: #68766e; font-size: 13px; line-height: 1.6; }
.reward-score { color: #b56b13; font-size: 13px; margin: 12px 0 20px; }
.reward-score b { font: 700 26px Georgia, serif; }
.primary-btn { border: 0; width: 100%; border-radius: 15px; padding: 14px; color: white; background: var(--forest); font-weight: 700; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 8px; height: 14px; animation: fall 1.8s linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); } }

.ar-overlay { display: none; position: absolute; inset: 0; z-index: 20; overflow: hidden; }
.ar-target { position: absolute; left: 50%; top: 48%; transform: translate(-50%,-50%); text-align: center; color: white; filter: drop-shadow(0 4px 9px rgba(0,0,0,.65)); transition: left .25s ease; }
.ar-target .ar-gem { width: 82px; height: 82px; margin: auto; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; display: grid; place-items: center; font-size: 38px; background: rgba(27,72,57,.55); box-shadow: 0 0 0 12px rgba(155,221,117,.12); animation: pulse 1.5s infinite; }
.ar-target b { display: block; margin-top: 12px; }
.ar-target span { font-size: 12px; }
.ar-hint { position: absolute; left: 0; right: 0; top: 25%; text-align: center; color: white; font-size: 12px; text-shadow: 0 2px 5px #000; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 22px rgba(155,221,117,0); } }

.treasure-marker { background: transparent; border: 0; }
.marker-pin { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50% 50% 50% 12%; transform: rotate(-45deg); background: var(--orange); border: 3px solid white; box-shadow: 0 3px 10px rgba(0,0,0,.25); color: var(--forest); }
.marker-pin span { transform: rotate(45deg); font-size: 17px; }
.marker-pin.done { background: #86a78b; }
.user-marker { width: 20px; height: 20px; border-radius: 50%; background: #397af1; border: 3px solid white; box-shadow: 0 0 0 9px rgba(57,122,241,.2); }
.leaflet-control-attribution { font-size: 8px !important; }

@media (min-width: 700px) {
  body { background: #dfe5dc; }
  .app-shell { max-width: 480px; margin: auto; background: var(--cream); box-shadow: 0 0 50px rgba(20,50,40,.15); }
}
