:root {
  color-scheme: dark;
  --ink: #edf1e7;
  --muted: #9ca99e;
  --forest: #101813;
  --forest-2: #16231b;
  --card: #1a2920;
  --line: rgba(230, 238, 221, .13);
  --lime: #cce977;
  --lime-deep: #9fbe4f;
  --sand: #d5b987;
  --ember: #e98159;
  --radius: 24px;
  --shadow: 0 24px 70px rgba(0, 0, 0, .3);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--forest); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 85% -10%, #2a3d29 0, transparent 30rem), var(--forest); color: var(--ink); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--lime); outline-offset: 3px; }

.app-shell { width: min(100%, 880px); min-height: 100vh; margin: 0 auto; padding: env(safe-area-inset-top) 18px calc(98px + env(safe-area-inset-bottom)); }
.topbar { height: 72px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 9px; padding: 0; border: 0; background: none; letter-spacing: .14em; font-weight: 800; font-size: .85rem; }
.brand-mark { display: grid; place-items: center; width: 29px; height: 29px; border: 1px solid var(--lime); border-radius: 50%; color: var(--lime); font-size: 1.2rem; }
.local-badge { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.local-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 5px rgba(204, 233, 119, .08); }

.screen { display: none; animation: appear .35s ease; }
.screen.active { display: block; }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } }
.hero-copy { padding: 54px 4px 30px; }
.eyebrow { margin: 0 0 10px; color: var(--lime); font-size: .67rem; line-height: 1.2; font-weight: 800; letter-spacing: .18em; }
h1, h2, p { text-wrap: balance; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 10vw, 5.6rem); font-weight: 400; line-height: .93; letter-spacing: -.045em; }
h1 em { color: var(--lime); font-weight: 400; }
.intro { max-width: 560px; margin: 24px 0 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }

.map-card { position: relative; min-height: 355px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #1c2b21; box-shadow: var(--shadow); isolation: isolate; }
.trail-map { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-grain { position: absolute; inset: 0; pointer-events: none; opacity: .28; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E"); mix-blend-mode: overlay; }
.map-topline { position: absolute; z-index: 2; top: 18px; left: 18px; right: 18px; display: flex; justify-content: space-between; }
.map-label, .map-scale { padding: 7px 10px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(12,20,15,.58); backdrop-filter: blur(8px); color: #dfe8dd; font-size: .62rem; letter-spacing: .12em; }
.map-caption { position: absolute; z-index: 2; left: 18px; right: 18px; bottom: 18px; display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; background: rgba(12,20,15,.7); backdrop-filter: blur(12px); }
.map-caption strong, .map-caption small { display: block; }
.map-caption strong { font-size: .86rem; }
.map-caption small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.pulse-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 6px rgba(204,233,119,.12); }

.primary-actions, .tracking-actions, .toolbar { display: flex; gap: 10px; margin: 16px 0; }
.btn { min-height: 54px; padding: 0 20px; border: 1px solid transparent; border-radius: 16px; background: var(--card); font-weight: 750; cursor: pointer; }
.btn-primary { flex: 1; display: flex; justify-content: space-between; align-items: center; background: var(--lime); color: #172010; }
.btn-primary b { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid rgba(0,0,0,.24); border-radius: 50%; }
.btn-ghost { border-color: var(--line); background: transparent; color: var(--ink); }
.btn-small { min-height: 44px; font-size: .77rem; }
.btn-finish { flex: 1; background: var(--ink); color: #172018; }

.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 50px; }
.feature-card { position: relative; min-height: 260px; padding: 25px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.feature-card.accent { background: #29331b; }
.feature-card h2 { max-width: 330px; margin: 14px 0; font-family: Georgia, serif; font-size: 1.65rem; font-weight: 400; line-height: 1.07; }
.feature-card > p:last-child { color: var(--muted); font-size: .82rem; line-height: 1.55; }
.feature-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 36px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; color: var(--lime); font-size: 1.3rem; }

.recent-block { padding: 64px 0 20px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 2rem; font-weight: 400; }
.text-button { padding: 8px 0; border: 0; background: none; color: var(--lime); font-size: .76rem; cursor: pointer; }
.tour-list { display: grid; gap: 10px; }
.empty-list { min-height: 126px; place-items: center; border: 1px dashed var(--line); border-radius: 18px; color: var(--muted); text-align: center; font-size: .82rem; line-height: 1.6; }
.tour-card { display: grid; grid-template-columns: 82px 1fr auto; gap: 16px; align-items: center; min-height: 112px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.025); cursor: pointer; }
.tour-thumb { position: relative; width: 82px; height: 82px; overflow: hidden; border-radius: 13px; background: #213225; }
.tour-thumb canvas { width: 100%; height: 100%; }
.tour-card h3 { margin: 0 0 7px; font-family: Georgia, serif; font-size: 1.15rem; font-weight: 400; }
.tour-card p { margin: 0; color: var(--muted); font-size: .71rem; }
.tour-card > span { padding-right: 8px; color: var(--lime); }

.tracking-header { display: flex; justify-content: space-between; align-items: center; padding: 32px 2px 20px; }
.tracking-header h1 { font-size: 2.7rem; }
.recording-pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--ember); box-shadow: 0 0 0 0 rgba(233,129,89,.5); animation: pulse 1.8s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 13px rgba(233,129,89,0); } }
.tracking-map-card { min-height: min(48vh, 430px); }
.backthread { position: absolute; z-index: 2; bottom: 18px; left: 18px; display: flex; align-items: center; gap: 12px; padding: 12px 15px; border-radius: 16px; background: rgba(12,20,15,.78); backdrop-filter: blur(12px); }
.back-arrow { display: grid; place-items: center; width: 39px; height: 39px; border: 1px solid var(--lime); border-radius: 50%; color: var(--lime); transition: transform .4s ease; }
.backthread small, .backthread strong, .backthread div > span { display: block; }
.backthread small { color: var(--muted); font-size: .54rem; letter-spacing: .12em; }
.backthread strong { margin-top: 2px; font-size: 1rem; }
.backthread div > span { color: var(--muted); font-size: .63rem; }
.live-stats { display: grid; grid-template-columns: repeat(3,1fr); margin: 14px 0; border: 1px solid var(--line); border-radius: 18px; }
.live-stats > div { padding: 17px 14px; border-right: 1px solid var(--line); }
.live-stats > div:last-child { border: 0; }
.live-stats span, .live-stats small { display: block; color: var(--muted); font-size: .59rem; }
.live-stats strong { display: inline-block; margin: 7px 3px 1px 0; font-family: Georgia, serif; font-size: 1.45rem; font-weight: 400; }
.live-stats small { display: inline; }
.moment-strip { display: flex; gap: 8px; padding: 8px 0 4px; overflow-x: auto; scrollbar-width: none; }
.moment-button { min-width: 75px; padding: 12px 8px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); color: var(--muted); font-size: .62rem; cursor: pointer; }
.moment-button span { display: block; margin-bottom: 4px; color: var(--lime); font-size: 1.1rem; }

.page-heading { padding: 55px 3px 26px; }
.page-heading h1 { font-size: clamp(3rem, 9vw, 5rem); }
.page-heading > p:last-child { max-width: 590px; margin: 23px 0 0; color: var(--muted); line-height: 1.6; }
.privacy-seal { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(135deg, #23321e, #18241c); }
.seal-ring { display: grid; place-items: center; width: 105px; height: 105px; border: 1px solid var(--lime); border-radius: 50%; box-shadow: inset 0 0 0 7px rgba(204,233,119,.05); }
.seal-ring span { grid-area: 1/1; font-family: Georgia, serif; color: var(--lime); font-size: 2.4rem; }
.seal-ring small { grid-area: 1/1; align-self: end; margin-bottom: 19px; color: var(--muted); font-size: .62rem; text-transform: uppercase; }
.privacy-seal h2 { margin: 0; font-family: Georgia, serif; font-size: 1.5rem; font-weight: 400; line-height: 1.25; }
.data-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 32px; }
.data-cards article { padding: 20px; border: 1px solid var(--line); border-radius: 18px; }
.data-cards span { display: block; color: var(--muted); font-size: .68rem; }
.data-cards strong { display: block; margin-top: 10px; font-family: Georgia, serif; font-size: 1.7rem; font-weight: 400; }
.settings-list { overflow: hidden; border: 1px solid var(--line); border-radius: 20px; }
.settings-list button { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.settings-list button:last-child { border: 0; }
.settings-list strong, .settings-list small { display: block; }
.settings-list strong { font-size: .83rem; }
.settings-list small { margin-top: 4px; color: var(--muted); font-size: .65rem; }
.settings-list b { color: var(--lime); font-size: 1.2rem; }
.settings-list .danger strong, .settings-list .danger b { color: var(--ember); }

.bottom-nav { position: fixed; z-index: 20; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 32px), 450px); display: grid; grid-template-columns: repeat(3,1fr); padding: 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 19px; background: rgba(18,28,21,.88); backdrop-filter: blur(18px); box-shadow: 0 10px 40px rgba(0,0,0,.38); }
.bottom-nav button { padding: 9px 6px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font-size: .62rem; cursor: pointer; }
.bottom-nav button span { display: block; margin-bottom: 2px; font-size: 1rem; }
.bottom-nav button.active { background: rgba(204,233,119,.11); color: var(--lime); }
body.is-tracking .bottom-nav { display: none; }

dialog { color: var(--ink); }
dialog::backdrop { background: rgba(5,9,6,.74); backdrop-filter: blur(5px); }
.sheet { width: min(calc(100% - 24px), 520px); padding: 0; border: 1px solid var(--line); border-radius: 26px; background: #19261d; box-shadow: var(--shadow); }
.sheet form { position: relative; padding: 32px 24px 24px; }
.sheet h2 { margin: 4px 0 8px; font-family: Georgia, serif; font-size: 2rem; font-weight: 400; }
.sheet p:not(.eyebrow) { color: var(--muted); font-size: .78rem; }
.sheet-close { position: absolute; top: 15px; right: 15px; z-index: 2; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; }
.sheet textarea, .sheet input { width: 100%; margin: 16px 0; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #111b15; color: var(--ink); resize: vertical; }
.sheet textarea { min-height: 110px; }
.sheet .btn { width: 100%; }
.finish-preview { display: flex; justify-content: space-between; padding: 13px 0 20px; color: var(--muted); font-size: .72rem; }
.tour-dialog { width: min(calc(100% - 24px), 620px); max-height: 88vh; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 26px; background: #19261d; box-shadow: var(--shadow); }
.tour-detail-map { position: relative; height: 290px; background: #213225; }
.tour-detail-map canvas { width: 100%; height: 100%; }
.tour-detail-copy { padding: 28px; }
.tour-detail-copy h2 { margin: 4px 0 7px; font-family: Georgia, serif; font-size: 2.2rem; font-weight: 400; }
.tour-detail-copy > p { color: var(--muted); font-size: .76rem; }
.dna { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin: 24px 0; }
.dna div { padding: 16px 10px; border: 1px solid var(--line); border-radius: 14px; text-align: center; }
.dna strong, .dna small { display: block; }
.dna strong { color: var(--lime); font-family: Georgia, serif; font-size: 1.3rem; }
.dna small { margin-top: 5px; color: var(--muted); font-size: .58rem; text-transform: uppercase; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 9px; }
.detail-stats span { padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.05); color: var(--muted); font-size: .68rem; }
.moment-list { margin-top: 22px; }
.moment-list article { padding: 12px 0; border-bottom: 1px solid var(--line); }
.moment-list strong { font-size: .75rem; }
.moment-list p { margin: 5px 0 0; color: var(--muted); font-size: .72rem; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 105px; transform: translate(-50%, 20px); max-width: calc(100% - 36px); padding: 11px 16px; border: 1px solid var(--line); border-radius: 999px; background: #26372a; color: var(--ink); font-size: .72rem; opacity: 0; pointer-events: none; transition: .25s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 620px) {
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { min-height: 225px; }
  .feature-icon { margin-bottom: 24px; }
  .privacy-seal { grid-template-columns: 1fr; }
  .seal-ring { width: 92px; height: 92px; }
  .local-badge { font-size: .54rem; }
  .tour-card { grid-template-columns: 72px 1fr auto; gap: 12px; }
  .tour-thumb { width: 72px; height: 72px; }
}

@media (display-mode: standalone) {
  .app-shell { padding-top: calc(env(safe-area-inset-top) + 4px); }
  #install-app { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
