/* ===========================================================
   幻廊 · Atelier XR · WebAR
   Design system — dark editorial gallery, metallic gold accent
   =========================================================== */

:root {
  /* Ink palette */
  --ink-0: #06080b;
  --ink-1: #0b0f15;
  --ink-2: #11161e;
  --ink-3: #1a212c;

  /* Hairlines */
  --rule:        rgba(255, 255, 255, 0.08);
  --rule-strong: rgba(255, 255, 255, 0.18);

  /* Foreground */
  --paper:       #ece4d4;
  --paper-2:     #fff8e8;
  --paper-soft:  rgba(236, 228, 212, 0.72);
  --silver:      #8a93a0;
  --silver-soft: rgba(138, 147, 160, 0.65);

  /* Metallic accent */
  --gold:        #c9a86a;
  --gold-2:      #e2c489;
  --gold-soft:   rgba(201, 168, 106, 0.55);
  --gold-glow:   rgba(201, 168, 106, 0.32);

  /* Type */
  --ff-display: 'Cormorant Garamond', 'Source Han Serif SC', 'Noto Serif SC', 'Songti SC', 'STSong', Georgia, serif;
  --ff-sans:    -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ff-mono:    'SF Mono', ui-monospace, Menlo, monospace;

  /* Motion */
  --ease-out:      cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-soft: cubic-bezier(0.16, 1, 0.3, 1);

  /* Safe area */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ===========================================================
   Reset
   =========================================================== */

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

html, body {
  width: 100%; height: 100%;
  background: var(--ink-1);
  color: var(--paper);
  font-family: var(--ff-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
}

button {
  background: none; border: none; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

img, svg { display: block; max-width: 100%; }

/* ===========================================================
   Screen base
   IMPORTANT: variants must NEVER override `position` here.
   =========================================================== */

.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 480ms var(--ease-out);
  will-change: opacity;
  overflow: hidden;
}
.screen.is-active { opacity: 1; pointer-events: auto; }

/* ===========================================================
   1. SPLASH — typographic hero on dark atmosphere
   =========================================================== */

.screen--splash {
  background: var(--ink-0);
  color: var(--paper);
  padding: calc(var(--safe-top) + 28px) 28px calc(var(--safe-bottom) + 28px);
}

.splash__bg { position: absolute; inset: 0; pointer-events: none; }

.splash__halo {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0;
  will-change: transform, opacity;
  transition: opacity 1700ms var(--ease-out);
}
.splash__halo--a {
  width: 460px; height: 460px;
  left: -110px; top: -90px;
  background: radial-gradient(circle, rgba(201, 168, 106, 0.40), transparent 60%);
  animation: haloDrift 16s ease-in-out infinite alternate;
}
.splash__halo--b {
  width: 380px; height: 380px;
  right: -120px; bottom: -120px;
  background: radial-gradient(circle, rgba(80, 110, 150, 0.26), transparent 60%);
  animation: haloDrift 22s ease-in-out infinite alternate-reverse;
}
.is-active .splash__halo { opacity: 1; }

@keyframes haloDrift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(20px, -16px) scale(1.06); }
  100% { transform: translate(-14px, 22px) scale(0.98); }
}

.splash__veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 50% 30%, transparent 0%, rgba(0,0,0,0.35) 70%, rgba(0,0,0,0.7) 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 90px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 90px);
}

.splash__noise {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.05) 0 0.8px, transparent 1px),
    radial-gradient(circle at 70% 70%, rgba(201,168,106,0.06) 0 0.8px, transparent 1px);
  background-size: 7px 7px, 11px 11px;
  opacity: 0.55;
  mix-blend-mode: screen;
}

.splash__inner {
  position: relative; z-index: 1;
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  justify-content: space-between;
  width: 100%;
  min-height: 0;
}

/* top mark + tagline */
.splash__top {
  display: flex; align-items: center; gap: 14px;
  opacity: 0; transform: translateY(-8px);
  transition: opacity 900ms var(--ease-out), transform 900ms var(--ease-out);
  transition-delay: 220ms;
}
.is-active .splash__top { opacity: 1; transform: none; }

.splash__mark {
  width: 32px; height: 32px;
  color: var(--gold);
  filter: drop-shadow(0 0 14px var(--gold-glow));
  animation: markBreath 6s ease-in-out infinite;
}
@keyframes markBreath {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  50%      { opacity: 1;    transform: scale(1.05); }
}

.splash__tag {
  flex: 1;
  font-size: 10px; letter-spacing: 0.42em;
  color: var(--paper-soft);
  text-transform: uppercase;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 6px;
}

/* hero typography block — centered editorial poster layout */
.splash__hero {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  gap: 16px;
  margin-top: -1vh;
  padding: 0 12px;
}

.splash__eyebrow {
  font-family: var(--ff-mono);
  font-size: 10px; letter-spacing: 0.42em;
  color: var(--gold);
  text-transform: uppercase;
  opacity: 0; transform: translateY(8px);
  transition: opacity 800ms var(--ease-out) 360ms, transform 800ms var(--ease-out) 360ms;
}
.is-active .splash__eyebrow { opacity: 1; transform: none; }

.splash__title {
  font-family: var(--ff-display);
  font-weight: 300;
  /* slimmer than before so the title doesn't read as a heavy bracketed block */
  font-size: clamp(76px, 22vw, 128px);
  line-height: 0.95;
  letter-spacing: 0.04em;
  color: var(--paper);
  display: inline-flex;
  gap: 0.06em;
}
.splash__title .ch {
  display: inline-block;
  opacity: 0; transform: translateY(28px) scale(0.96);
  transition: opacity 1100ms var(--ease-out-soft), transform 1100ms var(--ease-out-soft);
}
.is-active .splash__title .ch1 { transition-delay: 480ms; opacity: 1; transform: none; }
.is-active .splash__title .ch2 { transition-delay: 620ms; opacity: 1; transform: none; }

.splash__under {
  display: block;
  width: 0; height: 1px;
  background: var(--gold);
  box-shadow: 0 0 14px var(--gold-glow);
  transition: width 1100ms var(--ease-out-soft);
  transition-delay: 820ms;
}
.is-active .splash__under { width: 56px; }

.splash__sub {
  font-size: 11px; letter-spacing: 0.42em;
  color: var(--silver);
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 800ms var(--ease-out) 1000ms;
}
.is-active .splash__sub { opacity: 1; }

/* feature chips — mini-program-style trust signal row */
.splash__chips {
  list-style: none;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 8px;
  margin-top: 12px;
  padding: 0;
}
.splash__chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--rule);
  font-size: 11px; letter-spacing: 0.06em;
  color: var(--paper-soft);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0; transform: translateY(8px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
}
.splash__chip svg {
  width: 14px; height: 14px;
  color: var(--gold);
  flex: 0 0 auto;
}
.is-active .splash__chip:nth-child(1) { transition-delay: 1100ms; opacity: 1; transform: none; }
.is-active .splash__chip:nth-child(2) { transition-delay: 1200ms; opacity: 1; transform: none; }
.is-active .splash__chip:nth-child(3) { transition-delay: 1300ms; opacity: 1; transform: none; }

/* foot block: hint + big CTA + meta */
.splash__foot {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
}

.splash__hint {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.18em;
  color: var(--paper-soft);
  opacity: 0; transform: translateY(6px);
  transition: opacity 700ms var(--ease-out) 1500ms, transform 700ms var(--ease-out) 1500ms;
}
.is-active .splash__hint { opacity: 1; transform: none; }
.splash__hintArrow {
  display: inline-block;
  color: var(--gold);
  font-size: 13px;
  animation: hintBounce 1.6s ease-in-out infinite;
}
@keyframes hintBounce {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%      { transform: translateY(4px); opacity: 1; }
}

/* === Primary CTA — large gold pill button (the "tap me" beacon) === */
.splash__cta {
  position: relative;
  display: inline-flex; align-items: center;
  gap: 14px;
  padding: 14px 14px 14px 26px;
  width: 100%; max-width: 320px;
  min-height: 60px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f0d68f 0%, var(--gold) 60%, #b08940 100%);
  color: #1a140a;
  box-shadow:
    0 14px 38px -10px rgba(201, 168, 106, 0.55),
    0 2px 0 rgba(255, 255, 255, 0.18) inset,
    0 -2px 0 rgba(0, 0, 0, 0.18) inset;
  opacity: 0; transform: translateY(14px);
  transition:
    opacity 800ms var(--ease-out) 1300ms,
    transform 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out);
  overflow: hidden;
}
.is-active .splash__cta {
  opacity: 1;
  transform: none;
  transition:
    opacity 800ms var(--ease-out) 1300ms,
    transform 800ms var(--ease-out) 1300ms,
    box-shadow 220ms var(--ease-out);
}

/* breathing glow ring behind the button — strong "tap here" affordance */
.splash__ctaPulse {
  position: absolute; inset: -8px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  pointer-events: none;
  opacity: 0;
  animation: ctaPulse 2.4s ease-out infinite;
  animation-delay: 1800ms;
}
@keyframes ctaPulse {
  0%   { transform: scale(0.96); opacity: 0; }
  35%  { opacity: 0.55; }
  100% { transform: scale(1.18); opacity: 0; }
}

.splash__ctaInner {
  flex: 1 1 auto;
  display: flex; flex-direction: column; align-items: flex-start;
  gap: 2px;
  text-align: left;
}
.splash__ctaLabel {
  font-family: var(--ff-sans);
  font-size: 17px; font-weight: 600;
  letter-spacing: 0.18em;
  color: #1a140a;
  line-height: 1;
}
.splash__ctaSub {
  font-family: var(--ff-mono);
  font-size: 9px; letter-spacing: 0.3em;
  color: rgba(26, 20, 10, 0.62);
}

.splash__ctaIcon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(26, 20, 10, 0.16);
  color: #1a140a;
  flex: 0 0 auto;
  transition: transform 240ms var(--ease-out), background 240ms var(--ease-out);
}
.splash__ctaIcon svg { width: 20px; height: 20px; }

.splash__cta:active {
  transform: scale(0.97);
  box-shadow:
    0 6px 18px -6px rgba(201, 168, 106, 0.5),
    0 2px 0 rgba(255, 255, 255, 0.18) inset,
    0 -2px 0 rgba(0, 0, 0, 0.22) inset;
}
.splash__cta:active .splash__ctaIcon {
  background: #1a140a;
  color: var(--gold);
  transform: translateX(3px);
}

.splash__meta {
  font-family: var(--ff-mono);
  font-size: 10px; letter-spacing: 0.32em;
  color: var(--silver-soft);
  opacity: 0;
  transition: opacity 600ms var(--ease-out) 1700ms;
}
.is-active .splash__meta { opacity: 1; }

/* ===========================================================
   2. HOME — single-hero editorial card on dark gallery
   =========================================================== */

.screen--home {
  background:
    radial-gradient(160% 80% at 50% -20%, var(--ink-3) 0%, var(--ink-1) 55%, var(--ink-1) 100%);
  color: var(--paper);
}

.home__bg { position: absolute; inset: 0; pointer-events: none; }

.home__glow {
  position: absolute; border-radius: 50%; filter: blur(80px);
  opacity: 0;
  transition: opacity 1500ms var(--ease-out);
  will-change: transform;
}
.home__glow--a {
  width: 360px; height: 360px;
  top: -100px; left: -80px;
  background: radial-gradient(circle, rgba(201,168,106,0.22), transparent 60%);
  animation: haloDrift 18s ease-in-out infinite alternate;
}
.home__glow--b {
  width: 320px; height: 320px;
  bottom: -120px; right: -80px;
  background: radial-gradient(circle, rgba(80,100,140,0.22), transparent 60%);
  animation: haloDrift 22s ease-in-out infinite alternate-reverse;
}
.is-active .home__glow { opacity: 1; }

.home__noise {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 30% 40%, rgba(255,255,255,0.025) 0 1px, transparent 1px),
    radial-gradient(circle at 60% 80%, rgba(201,168,106,0.04) 0 1px, transparent 1px);
  background-size: 9px 9px, 13px 13px;
  background-position: 0 0, 4px 4px;
}

.home__header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 22px) 24px 14px;
  opacity: 0; transform: translateY(-8px);
  transition: opacity 700ms var(--ease-out) 120ms, transform 700ms var(--ease-out) 120ms;
}
.is-active .home__header { opacity: 1; transform: none; }

.home__brandRow {
  display: flex; align-items: center; gap: 10px;
}
.home__mark {
  width: 24px; height: 24px;
  color: var(--gold);
  filter: drop-shadow(0 0 10px var(--gold-glow));
}
.home__brand {
  font-family: var(--ff-display);
  font-size: 22px; font-weight: 300;
  letter-spacing: 0.04em;
  color: var(--paper);
}
.home__brandLatin {
  font-size: 9px; letter-spacing: 0.42em;
  color: var(--silver);
  border-left: 1px solid var(--rule);
  padding-left: 10px; margin-left: 2px;
}

.home__counter {
  display: flex; align-items: baseline; gap: 4px;
  font-family: var(--ff-mono);
  font-size: 11px; letter-spacing: 0.2em;
  color: var(--silver);
}
.home__counter em {
  font-style: normal; font-weight: 500;
  color: var(--gold);
}

.home__rule {
  position: relative; z-index: 1;
  height: 1px;
  margin: 0 24px;
  background: linear-gradient(90deg, transparent 0%, var(--rule-strong) 18%, var(--rule-strong) 82%, transparent 100%);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 900ms var(--ease-out) 220ms;
}
.is-active .home__rule { transform: scaleX(1); }

.home__stage {
  position: relative; z-index: 1;
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  padding: 22px 24px 16px;
  gap: 14px;
  min-height: 0;
}

.home__caption {
  font-size: 10px; letter-spacing: 0.42em;
  color: var(--silver);
  text-transform: uppercase;
  opacity: 0; transform: translateY(8px);
  transition: opacity 700ms var(--ease-out) 320ms, transform 700ms var(--ease-out) 320ms;
}
.is-active .home__caption { opacity: 1; transform: none; }

.home__list {
  flex: 1 1 auto;
  display: flex; flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  min-height: 0;
}
.home__list::-webkit-scrollbar { display: none; }

.home__empty {
  margin-top: 40px;
  text-align: center;
  font-size: 12px; letter-spacing: 0.28em;
  color: var(--silver);
}

/* hero card — softer mini-program flavor: rounded, tappable badge, clear CTA */
.card {
  display: block;
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 14px;
  text-align: left;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 48px -22px rgba(0, 0, 0, 0.7);
  opacity: 0; transform: translateY(22px);
  transition:
    opacity 900ms var(--ease-out) 480ms,
    transform 900ms var(--ease-out) 480ms,
    border-color 320ms var(--ease-out),
    box-shadow 320ms var(--ease-out);
}
.is-active .card { opacity: 1; transform: none; }
.card:active   { border-color: var(--gold-soft); box-shadow: 0 12px 28px -16px rgba(201, 168, 106, 0.5); }

/* circular gold tap badge — top-right pulse, mini-program affordance */
.card__tap {
  position: absolute; top: 14px; right: 14px;
  z-index: 3;
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f0d68f 0%, var(--gold) 60%, #b08940 100%);
  color: #1a140a;
  box-shadow:
    0 6px 18px -6px rgba(201, 168, 106, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.18) inset,
    0 -1px 0 rgba(0, 0, 0, 0.18) inset;
  pointer-events: none;
}
.card__tap::after {
  content: '';
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  opacity: 0;
  animation: ctaPulse 2.4s ease-out infinite;
  animation-delay: 1500ms;
}
.card__tap svg { width: 18px; height: 18px; }
.card:active .card__tap { transform: scale(0.94); }

.card__index {
  position: absolute; top: 14px; left: 14px;
  z-index: 2;
  font-family: var(--ff-mono);
  font-size: 10px; letter-spacing: 0.32em;
  color: var(--gold);
  background: rgba(7, 9, 12, 0.55);
  padding: 5px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.card__cover {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  display: block;
  filter: brightness(0.88) contrast(1.06);
  transition: transform 1200ms var(--ease-out), filter 600ms var(--ease-out);
}
.card:active .card__cover {
  transform: scale(1.03);
  filter: brightness(1) contrast(1.06);
}

.card__scrim {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 65%;
  background: linear-gradient(180deg, transparent 0%, rgba(7,9,12,0.55) 50%, rgba(7,9,12,0.94) 100%);
  pointer-events: none;
}

.card__body {
  position: absolute; left: 20px; right: 20px; bottom: 20px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 2;
}
.card__title {
  font-family: var(--ff-display);
  font-size: 30px; font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--paper);
  line-height: 1.08;
  text-shadow: 0 2px 14px rgba(0,0,0,0.4);
}
.card__sub {
  font-size: 11px; letter-spacing: 0.28em;
  color: var(--paper-soft);
  text-transform: uppercase;
}
.card__cta {
  margin-top: 14px;
  display: inline-flex; align-items: center; gap: 10px;
  align-self: flex-start;
  padding: 9px 16px 9px 18px;
  border-radius: 999px;
  background: rgba(201, 168, 106, 0.14);
  border: 1px solid var(--gold-soft);
  font-size: 11px; letter-spacing: 0.32em;
  color: var(--gold);
  text-transform: uppercase;
  transition: background 260ms var(--ease-out), border-color 260ms var(--ease-out);
}
.card__ctaText { font-weight: 500; }
.card__ctaArrow {
  display: inline-block;
  font-size: 14px; line-height: 1;
  transition: transform 260ms var(--ease-out);
}
.card:active .card__cta {
  background: rgba(201, 168, 106, 0.26);
  border-color: var(--gold);
}
.card:active .card__ctaArrow { transform: translateX(3px); }

.home__foot {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px calc(var(--safe-bottom) + 18px);
  border-top: 1px solid var(--rule);
  opacity: 0; transform: translateY(12px);
  transition: opacity 700ms var(--ease-out) 600ms, transform 700ms var(--ease-out) 600ms;
}
.is-active .home__foot { opacity: 1; transform: none; }

.home__footMark {
  width: 16px; height: 16px;
  color: var(--silver);
  flex: 0 0 auto;
}
.home__footMark svg { width: 16px; height: 16px; }

.home__footText {
  flex: 1;
  font-size: 11px; letter-spacing: 0.26em;
  color: var(--silver);
}

.home__footIndex {
  font-family: var(--ff-mono);
  font-size: 10px; letter-spacing: 0.24em;
  color: var(--gold);
}
.home__footIndex em { font-style: normal; opacity: 0.7; }

/* ===========================================================
   3. LOADING — concentric rings + counter
   =========================================================== */

.screen--loading {
  background: var(--ink-0);
  align-items: center; justify-content: center;
  padding: var(--safe-top) 28px var(--safe-bottom);
}

.loading__bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(closest-side at 50% 45%, rgba(201,168,106,0.14), transparent 60%),
    radial-gradient(closest-side at 50% 60%, rgba(80,100,140,0.10), transparent 70%);
  filter: blur(2px);
}

.loading__inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 22px;
  width: 84%; max-width: 320px;
}

.loading__ringWrap {
  position: relative;
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
}
.loading__ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  box-sizing: border-box;
}
.loading__ring--a {
  border-top-color: var(--gold);
  border-right-color: var(--gold);
  animation: loadingSpin 1.4s linear infinite;
  box-shadow: 0 0 24px var(--gold-glow);
}
.loading__ring--b {
  inset: 12px;
  border: 1px solid var(--rule);
  animation: loadingSpinReverse 4s linear infinite;
}
@keyframes loadingSpin        { to { transform: rotate(360deg);  } }
@keyframes loadingSpinReverse { to { transform: rotate(-360deg); } }

.loading__mark {
  position: relative; z-index: 1;
  width: 38px; height: 38px;
  color: var(--gold);
  animation: markBreath 2.6s ease-in-out infinite;
  filter: drop-shadow(0 0 10px var(--gold-glow));
}

.loading__cap {
  font-size: 10px; letter-spacing: 0.46em;
  color: var(--paper-soft);
  text-transform: uppercase;
  margin-top: 2px;
}

.loading__counter {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--ff-display);
  color: var(--paper);
  margin-top: -2px;
}
.loading__counter span {
  font-size: 56px; font-weight: 300;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.loading__counter em {
  font-style: normal; font-size: 13px;
  color: var(--silver);
  letter-spacing: 0.18em;
}

.loading__rail {
  width: 100%; height: 1px;
  background: rgba(255, 255, 255, 0.08);
  position: relative; overflow: hidden;
}
.loading__fill {
  position: absolute; left: 0; top: 0;
  width: 0%; height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--paper-2));
  transition: width 320ms var(--ease-out);
  box-shadow: 0 0 10px var(--gold-glow);
}

.loading__sub {
  font-size: 12px; letter-spacing: 0.28em;
  color: var(--silver);
}

/* ===========================================================
   4. SCANNER — viewfinder w/ thin gold corners
   =========================================================== */

.screen--scanner {
  background: #000;
  color: var(--paper);
}

.ar__stage {
  position: absolute; inset: 0;
  z-index: 0;
  overflow: hidden;
}
.ar__stage a-scene,
.ar__stage canvas {
  position: absolute !important;
  width: 100% !important; height: 100% !important;
  inset: 0 !important;
}

.ar__vignette {
  position: absolute; inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 50%, transparent 50%, rgba(0,0,0,0.55) 100%);
}

.ar__topbar {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 18px 0;
}

.ar__iconBtn {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(15, 18, 22, 0.55);
  color: var(--paper);
  border: 1px solid var(--rule);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ar__iconBtn svg { width: 18px; height: 18px; }

.ar__topRight { display: flex; gap: 8px; }

.ar__chip {
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(15, 18, 22, 0.55);
  color: var(--paper);
  font-size: 11px; letter-spacing: 0.32em;
  border: 1px solid var(--rule);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ar__guide {
  position: absolute; inset: 0;
  z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 30px;
  gap: 24px;
  pointer-events: none;
  transition: opacity 380ms var(--ease-out);
}
.ar__guide.is-hidden { opacity: 0; }

.ar__frame {
  position: relative;
  width: min(72vw, 320px);
  aspect-ratio: 3 / 4;
}

.corner {
  position: absolute;
  width: 32px; height: 32px;
  filter: drop-shadow(0 0 8px var(--gold-glow));
}
.corner.tl { top: -1px; left: -1px;
  border-top: 1.4px solid var(--gold);
  border-left: 1.4px solid var(--gold);
}
.corner.tr { top: -1px; right: -1px;
  border-top: 1.4px solid var(--gold);
  border-right: 1.4px solid var(--gold);
}
.corner.bl { bottom: -1px; left: -1px;
  border-bottom: 1.4px solid var(--gold);
  border-left: 1.4px solid var(--gold);
}
.corner.br { bottom: -1px; right: -1px;
  border-bottom: 1.4px solid var(--gold);
  border-right: 1.4px solid var(--gold);
}

.ar__crossH, .ar__crossV {
  position: absolute; left: 50%; top: 50%;
  background: rgba(201, 168, 106, 0.5);
  pointer-events: none;
}
.ar__crossH { width: 18px; height: 1px; transform: translate(-50%, -50%); }
.ar__crossV { width: 1px; height: 18px; transform: translate(-50%, -50%); }

.ar__sweep {
  position: absolute; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  box-shadow: 0 0 14px var(--gold-glow);
  animation: scanSweep 2.6s ease-in-out infinite;
}
@keyframes scanSweep {
  0%   { top: 0;    opacity: 0; }
  10%  {            opacity: 1; }
  90%  {            opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.ar__hint {
  font-size: 12px; letter-spacing: 0.36em;
  color: var(--paper);
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
  background: rgba(15, 18, 22, 0.55);
  border: 1px solid var(--rule);
  padding: 8px 18px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ar__tip {
  position: absolute;
  left: 50%; top: 22%;
  transform: translate(-50%, -10px);
  z-index: 6;
  background: rgba(15, 18, 22, 0.7);
  color: var(--paper);
  border: 1px solid var(--rule);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px; letter-spacing: 0.24em;
  opacity: 0;
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ar__tip.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Model-load diagnostic pill — visible at top-left whenever scanner is open */
.ar__diag {
  position: absolute;
  left: 12px; right: 12px; top: calc(var(--safe-top) + 64px);
  z-index: 6;
  display: none; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(15, 18, 22, 0.78);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--ff-mono);
  font-size: 10px; letter-spacing: 0.06em;
  color: var(--gold);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  width: max-content; max-width: calc(100% - 24px);
}
.ar__diagText {
  flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis;
}
.ar__diag.is-visible { display: inline-flex; }
.ar__diag.is-error   { color: #ff8b8b; border-color: rgba(255, 139, 139, 0.35); }
.ar__diag.is-ready   { color: #98e3a3; border-color: rgba(152, 227, 163, 0.35); }
.ar__diag.is-fading  { opacity: 0; transition: opacity 600ms var(--ease-out); }
.ar__diagDot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: diagPulse 1.2s ease-in-out infinite;
}
.ar__diag.is-ready .ar__diagDot,
.ar__diag.is-error .ar__diagDot { animation: none; }
@keyframes diagPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}

.ar__watermark {
  position: absolute;
  right: 16px; bottom: calc(var(--safe-bottom) + 20px);
  z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: rgba(15, 18, 22, 0.55);
  border: 1px solid var(--rule);
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ar__watermark svg { width: 16px; height: 16px; color: var(--gold); }
.ar__watermark span {
  font-size: 11px; letter-spacing: 0.32em;
  color: var(--paper);
}

.ar__muteBtn {
  position: absolute;
  left: 16px; bottom: calc(var(--safe-bottom) + 20px);
  z-index: 5;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(15, 18, 22, 0.55);
  color: var(--paper);
  border: 1px solid var(--rule);
  opacity: 0; pointer-events: none;
  transform: translateY(8px);
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.ar__muteBtn.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.ar__muteBtn svg { width: 18px; height: 18px; }

/* ===== Shutter button — capture current AR view ===== */
.ar__shutter {
  position: absolute;
  left: 50%; bottom: calc(var(--safe-bottom) + 18px);
  transform: translateX(-50%);
  z-index: 6;
  width: 68px; height: 68px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: none;
  padding: 0; margin: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ar__shutterRing {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 220ms var(--ease-out);
}
.ar__shutterDot {
  position: relative; z-index: 1;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff 0%, #f3eee2 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 6px rgba(0, 0, 0, 0.08);
  transition: transform 160ms var(--ease-out), background 220ms var(--ease-out);
}
.ar__shutter:active .ar__shutterDot { transform: scale(0.86); background: var(--gold); }
.ar__shutter:active .ar__shutterRing { transform: scale(1.04); }
.ar__shutter.is-busy { pointer-events: none; opacity: 0.6; }

/* white flash for shutter feedback */
.ar__flash {
  position: absolute; inset: 0;
  z-index: 9;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
}
.ar__flash.is-active {
  animation: arFlashAnim 380ms ease-out;
}
@keyframes arFlashAnim {
  0%   { opacity: 0; }
  18%  { opacity: 0.85; }
  100% { opacity: 0; }
}

/* toast feedback after snapshot */
.ar__toast {
  position: absolute;
  left: 50%; bottom: calc(var(--safe-bottom) + 110px);
  transform: translate(-50%, 8px);
  z-index: 8;
  padding: 9px 16px;
  background: rgba(15, 18, 22, 0.82);
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--paper);
  font-family: var(--ff-mono);
  font-size: 11px; letter-spacing: 0.24em;
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}
.ar__toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.ar__toast.is-error { color: #ff8b8b; border-color: rgba(255, 139, 139, 0.45); }

.ar__permDenied {
  position: absolute; inset: 0;
  z-index: 7;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  background: rgba(7, 9, 12, 0.92);
  padding: 0 32px;
  gap: 12px;
}
.ar__permDenied.is-visible { display: flex; }

.ar__permDenied h2 {
  font-family: var(--ff-display);
  font-size: 22px; font-weight: 400;
  color: var(--paper);
  letter-spacing: 0.04em;
}
.ar__permDenied p {
  font-size: 13px; color: var(--silver);
  letter-spacing: 0.06em; line-height: 1.6;
}
.ar__permActions {
  margin-top: 16px;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px;
  width: 100%; max-width: 320px;
}
.ar__permDenied button {
  width: 100%;
  padding: 12px 22px;
  font-size: 12px; letter-spacing: 0.28em;
  color: var(--paper);
  border-radius: 4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ar__permPrimary {
  background: rgba(201, 168, 106, 0.14);
  border: 1px solid var(--gold);
  color: var(--gold) !important;
}
.ar__permPrimary:active {
  background: rgba(201, 168, 106, 0.28);
}
.ar__permSecondary {
  background: transparent;
  border: 1px solid var(--rule);
}
.ar__permSecondary:active {
  background: rgba(255, 255, 255, 0.05);
}

/* ===========================================================
   Reduced motion: dampen non-essential animations
   =========================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
  .is-active .splash__under { width: 88px; }
}
