:root {
  --panel-green: #00bf63;
  --forest-green: #004d26;
  --neon-green: #006400;
  --ink: #0a0f0c;
  --card: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button,
a {
  font: inherit;
}

#app {
  position: fixed;
  inset: 0;
}

.ar-link {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.ar-model {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
}

.screen--active {
  display: flex;
}

/* ── Start screen ───────────────────────────────────────── */

#start-screen {
  justify-content: flex-start;
  padding: calc(10px + var(--safe-top)) 0 calc(12px + var(--safe-bottom));
  background: #ffffff;
  color: #000000;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow-y: auto;
}

.start-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
  min-height: 100%;
  padding: 0 18px;
  max-width: 480px;
  margin: 0 auto;
}

.start-hero-panel {
  margin-top: 4px;
  padding: 8px 0 0;
}

.start-hero {
  margin: 0 auto 14px;
  max-width: 100%;
  text-align: center;
}

.start-hero__logo {
  display: block;
  height: clamp(78px, 21vw, 96px);
  width: clamp(78px, 21vw, 96px);
  margin: 0 auto 10px;
  object-fit: cover;
  border-radius: 22%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.start-hero__tagline {
  margin: 0 auto;
  max-width: 100%;
  font-size: clamp(14px, 3.8vw, 16px);
  line-height: 1.3;
  font-weight: 500;
  color: #3d3d3d;
  white-space: nowrap;
}

.start-hero__accent {
  color: var(--panel-green);
  font-weight: 700;
}

.discover-card {
  width: 100%;
  padding: 14px 14px 12px;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.08);
}

.start-alert {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.start-alert__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 191, 99, 0.14);
}

.start-alert__icon img {
  display: block;
  width: 22px;
  height: auto;
}

.start-alert__copy {
  flex: 1;
  min-width: 0;
}

.start-alert__headline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.start-alert__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  color: #111111;
}

.start-alert__dot {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--panel-green);
}

.start-alert__subtitle {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #666666;
}

#start-screen .btn--discover {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  background: var(--forest-green);
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  border: none;
  border-radius: 999px;
  min-height: 48px;
  padding: 13px 22px;
  box-shadow: 0 8px 20px rgba(0, 77, 38, 0.22);
  box-sizing: border-box;
  cursor: pointer;
}

#start-screen .btn--discover:active {
  background: #003d1f;
}

.btn--discover__spark {
  font-size: 14px;
  line-height: 1;
}

.btn--discover__label,
.btn--discover__arrow {
  white-space: nowrap;
}

.btn--discover__arrow {
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  font-weight: 400;
}

.section-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 16px 0;
  height: 1px;
  background: #e2e4e8;
}

.section-divider__heart {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--panel-green);
  font-size: 13px;
  line-height: 1;
}

.install-section {
  text-align: center;
  padding: 0 4px;
}

.install-section__title {
  margin: 0 0 6px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: #111111;
}

.install-section__subtitle {
  margin: 0 auto 12px;
  max-width: 300px;
  font-size: 13px;
  line-height: 1.4;
  font-weight: 500;
  color: #666666;
}

.store-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 8px 10px;
  margin: 0 auto 10px;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 140px;
  width: 140px;
  height: 44px;
  overflow: hidden;
  line-height: 0;
  text-decoration: none;
}

.store-badge img {
  display: block;
  width: 140px;
  height: 44px;
  object-fit: contain;
  object-position: center;
}

.store-badge--play img {
  transform: scale(1.34);
}

.discover-state {
  display: block;
}

.return-state {
  display: none;
}

#start-screen.start-screen--return .discover-state {
  display: none;
}

#start-screen.start-screen--return .return-state {
  display: block;
}

#start-screen.start-screen--return .leave-banner {
  display: flex;
}

.return-alert {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.return-alert__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--panel-green);
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.return-alert__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: #111111;
}

.return-alert__accent {
  color: var(--panel-green);
}

.return-alert__subtitle {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #666666;
}

.return-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #eef0f2;
}

.return-feature {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.return-feature__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 191, 99, 0.12);
  color: var(--panel-green);
  font-size: 13px;
  line-height: 1;
}

.return-feature__text {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  color: #555555;
}

.install-section__accent {
  color: var(--panel-green);
}

.install-section__note {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: #666666;
}

.install-note__item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.install-note__dot {
  color: #bbbbbb;
}

.leave-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0 0;
  padding: 14px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, #f0fbf5 0%, #f7fdf9 100%);
  border: 1px solid rgba(0, 191, 99, 0.12);
}

.leave-banner__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 191, 99, 0.14);
  font-size: 18px;
  line-height: 1;
}

.leave-banner__title {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  color: #111111;
}

.leave-banner__subtitle {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: #666666;
}

.memories-section {
  margin: 0 -4px 20px;
  padding-bottom: 4px;
}

.memories-section__head {
  text-align: center;
  margin-bottom: 10px;
}

.memories-section__heart {
  display: none;
}

.memories-section__title {
  margin: 0 0 4px;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 700;
  color: #111111;
}

.memories-section__subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: #777777;
}

.memories-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 4px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.memories-scroll::-webkit-scrollbar {
  display: none;
}

.memory-card {
  flex: 0 0 min(58vw, 188px);
  scroll-snap-align: start;
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.memory-card__image {
  display: block;
  width: 100%;
  height: auto;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--panel-green);
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 7vw, 36px);
  line-height: 1.1;
  font-weight: 800;
}

.lede {
  margin: 0 0 28px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--muted);
}

.fine-print {
  margin: 14px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
}

.install-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.install-row--start {
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 14px;
  border: none;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: var(--panel-green);
  color: #04210f;
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.btn--ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
}

.btn--text {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  min-height: auto;
  padding: 8px;
  font-size: 14px;
}

/* ── AR screen ──────────────────────────────────────────── */

#ar-screen {
  background: #000;
}

#camera {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #111;
}

.camera-fallback {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.55)),
    url("assets/demo-scene.svg") center / cover no-repeat;
}

.viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  perspective: 700px;
  perspective-origin: 50% 45%;
}

.world {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.demo-post {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(75vw, 320px);
  transform-style: preserve-3d;
  transform: translate3d(-50%, -50%, -320px);
  border-radius: 20px;
  background: var(--card);
  color: #111;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.demo-post--memory {
  background: transparent;
  aspect-ratio: 835 / 1024;
}

.demo-post--memory .demo-post__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}

.demo-post__image-wrap {
  aspect-ratio: 4 / 3;
  background: #dfe8e2;
}

.demo-post__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.demo-post__body {
  padding: 12px 14px 14px;
}

.demo-post__user {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 800;
  color: var(--neon-green);
}

.demo-post__caption {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  font-weight: 600;
}

.demo-post__meta {
  margin: 8px 0 0;
  font-size: 11px;
  color: rgba(0, 0, 0, 0.45);
  font-weight: 600;
}

.hud {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 18px calc(16px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.82) 35%);
  z-index: 2;
}

.hud__hint {
  margin: 0 0 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.hud__tagline {
  margin: 0 0 14px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
}

.error-banner {
  position: absolute;
  top: calc(12px + var(--safe-top));
  left: 16px;
  right: 16px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(120, 20, 20, 0.92);
  font-size: 13px;
  z-index: 3;
}

/* ── Post-AR install (iOS return from Quick Look) ───────── */

#post-ar-screen {
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(0, 191, 99, 0.28), transparent 60%),
    linear-gradient(180deg, #0d1a12 0%, var(--ink) 55%);
}

.post-ar-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

/* ── Fallback (desktop) ─────────────────────────────────── */

#fallback-screen {
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 24px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(0, 191, 99, 0.18), transparent 60%),
    linear-gradient(180deg, #0d1a12 0%, var(--ink) 55%);
  overflow-y: auto;
}

.fallback-card {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

.fallback-preview {
  margin: 24px 0;
  display: flex;
  justify-content: center;
}

.demo-post--static {
  position: relative;
  left: auto;
  top: auto;
  transform: none;
  animation: none;
  width: min(75vw, 320px);
}

@media (min-width: 900px) and (pointer: fine) {
  #start-screen {
    display: none !important;
  }

  #fallback-screen.screen--active {
    display: flex;
  }
}
