:root {
  --bg: #0a0a12;
  --panel: rgba(18, 18, 32, 0.94);
  --pink: #ff2d7a;
  --cyan: #00e5ff;
  --text: #f4f4ff;
  --muted: #9aa0c3;
  --radius: 14px;
  --font: "Segoe UI", system-ui, sans-serif;
  --topbar-h: 49px;
  --hero-h: calc(100dvh - var(--topbar-h));
  --lens-left: 2%;
  --lens-top: 3%;
  --lens-width: 96%;
  --lens-height: 94%;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
  overflow-y: auto;
}

#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(10, 10, 18, 0.92);
  border-bottom: 1px solid rgba(255, 45, 122, 0.25);
  z-index: 20;
  position: sticky;
  top: 0;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.brand-mark { color: var(--pink); font-size: 16px; }
.brand-name { font-size: 15px; }

.badge.alpha {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--cyan));
  color: #000;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.wallet-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid rgba(0, 229, 255, 0.35);
}
.wallet-label { font-size: 11px; color: var(--cyan); font-weight: 700; }
.wallet-value { font-variant-numeric: tabular-nums; font-weight: 600; }

.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hero-stage {
  position: relative;
  width: 100%;
  height: var(--hero-h);
  flex-shrink: 0;
  overflow: hidden;
  background: #050508;
}

.mr-scene {
  position: absolute;
  inset: 0;
}

/* Layer 0 — dim store outside the lens */
.mr-ambient {
  position: absolute;
  inset: 0;
  background:
    url("/static/img/fridge-drinks.png") center 35% / cover no-repeat,
    #050508;
  filter: blur(18px) brightness(0.12) saturate(0.5);
  transform: scale(1.1);
}

/* Layer 1 — fridge fills the lens (near full viewport) */
.mr-lens-window {
  position: absolute;
  left: var(--lens-left);
  top: var(--lens-top);
  width: var(--lens-width);
  height: var(--lens-height);
  border-radius: 32px 24px 34px 28px;
  overflow: hidden;
  z-index: 1;
  box-shadow:
    inset 0 0 0 3px rgba(0, 229, 255, 0.38),
    inset 0 0 80px rgba(0, 0, 0, 0.4),
    0 16px 60px rgba(0, 0, 0, 0.7);
}

.mr-fridge-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 36%;
}

/* Layer 2 — CSS glasses frame (partial, right-focused) */
.mr-frame-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.mr-bezel {
  position: absolute;
  left: var(--lens-left);
  top: var(--lens-top);
  width: var(--lens-width);
  height: var(--lens-height);
  border-radius: 32px 24px 34px 28px;
  border: 6px solid #0c0c10;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    0 0 0 1px rgba(0, 229, 255, 0.25);
}

.mr-bridge {
  position: absolute;
  top: calc(var(--lens-top) + 1%);
  left: calc(var(--lens-left) - 1%);
  width: 22%;
  height: 9%;
  border-top: 7px solid #0c0c10;
  border-right: 7px solid #0c0c10;
  border-radius: 0 20px 0 0;
  box-shadow: 2px -2px 0 rgba(0, 229, 255, 0.15);
}

.mr-temple {
  position: absolute;
  top: 42%;
  right: -1%;
  width: 14%;
  height: 7%;
  background: linear-gradient(90deg, #0c0c10 0%, #1a1a22 55%, #0c0c10 100%);
  border-radius: 0 10px 10px 0;
  box-shadow: 0 0 22px rgba(0, 229, 255, 0.14);
}

.mr-temple::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0, 229, 255, 0.55);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.mr-temple-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% center;
  z-index: 4;
  pointer-events: none;
  opacity: 0.9;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 18%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 18%, #000 100%);
}

/* Layer 3 — 3D product in front of fridge */
#product-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  touch-action: none;
  cursor: grab;
}
#product-canvas:active { cursor: grabbing; }

.hero-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    radial-gradient(ellipse 100% 90% at 50% 50%, transparent 55%, rgba(5, 5, 8, 0.55) 100%),
    linear-gradient(180deg, rgba(5, 5, 8, 0.35) 0%, transparent 12%, transparent 88%, rgba(5, 5, 8, 0.4) 100%);
}

.corner-hud {
  position: absolute;
  top: 16px;
  z-index: 12;
  max-width: 42vw;
}
.corner-hud[data-side="left"] { left: 12px; }
.corner-hud[data-side="right"] { right: 12px; left: auto; }
.corner-hud.hidden { display: none; }

.hud-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 45, 122, 0.5);
  background: rgba(255, 45, 122, 0.15);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(8px);
  width: 100%;
  text-align: left;
}
.hud-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 12px var(--pink);
  flex-shrink: 0;
}
.hud-title { font-size: 13px; font-weight: 600; flex: 1; }
.hud-dist { font-size: 11px; color: var(--muted); }

.ar-panel {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.ar-panel.hidden { display: none; }

.panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.panel-sheet {
  position: relative;
  width: min(420px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid rgba(0, 229, 255, 0.35);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.panel-head h2 { font-size: 18px; }
.panel-close {
  background: none; border: none; color: var(--muted);
  font-size: 24px; cursor: pointer; line-height: 1;
}
.panel-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.45;
}

.mission-steps {
  list-style: none;
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}
.mission-steps li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  font-size: 13px;
  border: 1px solid transparent;
}
.mission-steps li.active {
  border-color: var(--cyan);
  background: rgba(0, 229, 255, 0.08);
}
.mission-steps li.done {
  opacity: 0.55;
  border-color: rgba(255, 45, 122, 0.3);
}
.mission-steps li em { font-style: normal; font-size: 11px; color: var(--muted); }

.panel-actions { display: flex; flex-direction: column; gap: 8px; }
.panel-hint { margin-top: 12px; font-size: 12px; color: var(--muted); text-align: center; }

.dock {
  position: relative;
  z-index: 5;
  min-height: calc(100dvh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px 24px 64px;
  text-align: center;
  background: var(--bg);
  border-top: 1px solid rgba(0, 229, 255, 0.12);
  scroll-margin-top: var(--topbar-h);
}

.dock-tag {
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.dock h1 {
  font-size: clamp(22px, 4.5vw, 30px);
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.25;
}

.dock-sub {
  font-size: 15px;
  color: var(--muted);
  max-width: 560px;
  margin: 0 auto 20px;
  line-height: 1.55;
}

.dock-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.dock-status { font-size: 13px; color: var(--muted); }

.dock-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--pink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn {
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  font-family: var(--font);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(90deg, var(--pink), #ff6b9d);
  color: #fff;
}
.btn.ghost {
  background: transparent;
  border: 1px solid rgba(0, 229, 255, 0.5);
  color: var(--cyan);
}
.btn:not(:disabled):active { transform: scale(0.98); }

@media (max-width: 480px) {
  :root {
    --lens-left: 1%;
    --lens-top: 2%;
    --lens-width: 98%;
    --lens-height: 96%;
  }
  .mr-bridge { width: 18%; }
  .corner-hud { max-width: 55vw; }
  .dock { padding: 24px 16px 40px; }
}
