:root {
  --berry-900: #35114f;
  --berry-800: #4b1d70;
  --berry-700: #5b2a86;
  --berry-600: #7641ad;
  --berry-500: #9565c5;
  --berry-200: #ddc8f1;
  --berry-100: #f3e9ff;
  --leaf-700: #4f8436;
  --leaf-500: #77ad4d;
  --leaf-200: #d9edc4;
  --cream: #fffaf2;
  --paper: #f7efdf;
  --ink: #2a1932;
  --muted: #786483;
  --white: #fff;
  --shadow-lg: 0 28px 70px rgba(65, 31, 91, .22);
  --shadow-md: 0 14px 34px rgba(65, 31, 91, .16);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--berry-100);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body { touch-action: manipulation; }

button {
  appearance: none;
  border: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  background: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

button:focus-visible { outline: 3px solid rgba(118, 65, 173, .38); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell, .screen {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.screen { display: none; }
.screen.is-active { display: block; animation: screen-in .55s cubic-bezier(.2, .85, .25, 1) both; }

@keyframes screen-in {
  from { opacity: 0; transform: scale(1.025); }
  to { opacity: 1; transform: scale(1); }
}

.unlock-screen {
  padding: calc(var(--safe-top) + 20px) 22px calc(var(--safe-bottom) + 20px);
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 255, 255, .92) 0 14%, transparent 15%),
    radial-gradient(circle at 92% 24%, rgba(205, 230, 184, .84) 0 13%, transparent 14%),
    radial-gradient(circle at 20% 78%, rgba(222, 196, 243, .68) 0 20%, transparent 21%),
    linear-gradient(155deg, #fbf4ff 0%, #f6edff 36%, #edf8e6 100%);
}

.unlock-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .28;
  background-image: radial-gradient(rgba(91, 42, 134, .26) .7px, transparent .7px);
  background-size: 15px 15px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

.unlock-auora {
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.auora-one {
  width: 220px; height: 220px; right: -92px; top: 90px;
  background: rgba(150, 101, 197, .18);
  animation: auora 8s ease-in-out infinite alternate;
}

.auora-two {
  width: 180px; height: 180px; left: -70px; bottom: 160px;
  background: rgba(133, 188, 91, .16);
  animation: auora 9s ease-in-out -2s infinite alternate-reverse;
}

@keyframes auora {
  from { transform: translate3d(0, 0, 0) scale(.96); }
  to { transform: translate3d(8px, -14px, 0) scale(1.08); }
}

.brand-lockup {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 36px auto;
  grid-template-rows: 20px 12px;
  column-gap: 9px;
  align-items: center;
  width: max-content;
}

.brand-mark {
  grid-row: 1 / 3;
  width: 36px; height: 36px;
  color: var(--berry-700);
}

.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; filter: drop-shadow(0 4px 5px rgba(53,17,79,.16)); }
.brand-name { align-self: end; color: var(--berry-800); font-size: 19px; font-weight: 800; letter-spacing: .08em; line-height: 1; }
.brand-sub { align-self: start; color: var(--berry-500); font-size: 8px; letter-spacing: .24em; font-weight: 700; line-height: 1; }

.unlock-copy { position: relative; z-index: 3; margin-top: 12vh; max-width: 390px; }
.eyebrow {
  margin: 0 0 12px;
  color: var(--leaf-700);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
}
.unlock-copy h1 {
  margin: 0;
  color: var(--berry-900);
  font-size: clamp(38px, 11vw, 58px);
  font-weight: 900;
  letter-spacing: -.045em;
  line-height: 1.04;
}
.unlock-copy h1 em { color: var(--berry-600); font-style: normal; }
.unlock-copy > p:last-child {
  max-width: 32em;
  margin: 18px 0 0;
  color: #644d70;
  font-size: 14px;
  line-height: 1.75;
}

.card-stage {
  position: absolute;
  z-index: 2;
  right: 16px;
  top: 42vh;
  width: min(58vw, 260px);
  height: min(78vw, 350px);
  perspective: 1000px;
}

.card-shadow {
  position: absolute;
  left: 12%; right: 9%; bottom: 4%; height: 18%;
  background: rgba(67, 31, 88, .22);
  filter: blur(20px);
  transform: rotate(-3deg);
}

.gift-card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid rgba(118, 65, 173, .18);
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.85), rgba(249,239,223,.97)),
    var(--paper);
  box-shadow: var(--shadow-lg), inset 0 0 0 6px rgba(255,255,255,.34);
  transform: rotate(-5deg) translateY(0);
  animation: card-float 5.2s ease-in-out infinite;
  overflow: hidden;
}

.gift-card::after {
  content: "";
  position: absolute;
  width: 170px; height: 170px;
  right: -76px; bottom: -82px;
  border-radius: 50%;
  background: rgba(119, 173, 77, .16);
}

@keyframes card-float {
  0%, 100% { transform: rotate(-5deg) translateY(0); }
  50% { transform: rotate(-3deg) translateY(-9px); }
}

.gift-card-top, .gift-card-bottom { position: relative; z-index: 2; display: flex; justify-content: space-between; gap: 8px; }
.gift-card-top { color: var(--berry-500); font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.gift-card-no { color: var(--muted); letter-spacing: .06em; }
.gift-card-center {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.card-qr-wrap {
  width: 118px; height: 118px;
  padding: 9px;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 9px 24px rgba(69, 35, 86, .12);
}
.card-qr-wrap img { display: block; width: 100%; height: 100%; object-fit: contain; }

.card-sprout { position: absolute; right: 4px; bottom: -4px; width: 52px; height: 66px; transform: rotate(8deg); }
.sprout-body { position: absolute; left: 22px; bottom: 0; width: 14px; height: 47px; border-radius: 12px; background: var(--berry-600); }
.sprout-leaf { position: absolute; width: 27px; height: 15px; border-radius: 100% 0 100% 0; background: var(--leaf-500); }
.leaf-a { left: 2px; top: 15px; transform: rotate(-25deg); }
.leaf-b { right: 1px; top: 4px; transform: rotate(24deg) scaleX(-1); }

.gift-card-bottom { display: block; color: var(--ink); }
.gift-card-bottom strong { display: block; font-size: 13px; letter-spacing: .02em; }
.gift-card-bottom span { display: block; margin-top: 5px; color: var(--muted); font-size: 9px; }

.mini-card {
  position: absolute;
  left: -36px; bottom: 6px;
  padding: 9px 13px;
  border: 1px solid rgba(118, 65, 173, .15);
  border-radius: 13px;
  background: rgba(255,255,255,.78);
  color: var(--berry-700);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(70, 38, 92, .12);
  transform: rotate(9deg);
}

.unlock-actions {
  position: absolute;
  left: 22px; right: 22px; bottom: calc(var(--safe-bottom) + 18px);
  z-index: 4;
}
.primary-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 58px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--berry-700), var(--berry-500));
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 16px 28px rgba(91, 42, 134, .28), inset 0 1px 0 rgba(255,255,255,.28);
  transition: transform .18s ease, box-shadow .18s ease;
}
.primary-button:active { transform: translateY(2px) scale(.99); box-shadow: 0 8px 18px rgba(91, 42, 134, .22); }
.button-spark { margin-right: 8px; color: #f8d777; font-size: 17px; }
.privacy-note { margin: 12px 0 0; color: #8c7893; text-align: center; font-size: 10px; }

.scene-screen {
  background: #eadcff;
  isolation: isolate;
}

#cameraVideo {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity .5s ease;
}

.desktop-skin {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 78% 11%, rgba(255, 255, 255, .89) 0 12%, transparent 13%),
    radial-gradient(circle at 10% 38%, rgba(219, 195, 244, .65) 0 19%, transparent 20%),
    radial-gradient(circle at 91% 68%, rgba(212, 238, 188, .47) 0 17%, transparent 18%),
    linear-gradient(155deg, #f9f1ff 0%, #efe2ff 48%, #f3f8e9 100%);
  transition: background .55s ease, opacity .55s ease;
}

.desktop-skin::before {
  content: "";
  position: absolute;
  z-index: 3;
  inset: 0;
  opacity: .25;
  pointer-events: none;
  background-image: radial-gradient(rgba(91, 42, 134, .24) .75px, transparent .75px);
  background-size: 18px 18px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

.scene-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  opacity: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  filter: saturate(.94) brightness(1.08);
  transform: scale(1.012);
  transition: opacity .5s ease, filter .5s ease, transform .5s ease;
}
.desktop-skin[data-scene]:not([data-scene="dream"]) .scene-backdrop { opacity: .31; }
.desktop-skin[data-scene="garden"] .scene-backdrop { opacity: .35; }
.desktop-skin[data-scene="cottage"] .scene-backdrop { opacity: .31; }
.desktop-skin[data-scene="meadow"] .scene-backdrop { opacity: .28; }
.desktop-skin[data-scene="swing"] .scene-backdrop { opacity: 0; }
.desktop-skin[data-scene]:not([data-scene="dream"])::before { opacity: .12; }

/* 深色 / 实景场景下把文字改成高对比白字，确保随时看得清 */
.desktop-skin[data-scene="swing"] .status-bar {
  color: #fff;
  text-shadow: 0 1px 3px rgba(24,10,40,.72), 0 0 2px rgba(24,10,40,.6);
}
.desktop-skin[data-scene="swing"] .status-icons i {
  background: rgba(255,255,255,.9);
  box-shadow: 0 1px 3px rgba(24,10,40,.5);
}
.desktop-skin[data-scene="swing"] .desktop-heading p {
  color: #fff;
  text-shadow: 0 1px 4px rgba(24,10,40,.8), 0 0 2px rgba(24,10,40,.65);
}
.desktop-skin[data-scene="swing"] .desktop-state span {
  background: rgba(22,9,36,.42);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
}
.desktop-skin[data-scene="swing"] .app-icon {
  color: #fff;
  text-shadow: 0 1px 4px rgba(24,10,40,.85), 0 0 2px rgba(24,10,40,.7);
}
.desktop-skin[data-scene="swing"] .desktop-note {
  color: #fff;
  text-shadow: 0 1px 4px rgba(24,10,40,.85);
}
.desktop-skin[data-scene="swing"] .desktop-note .note-dot {
  box-shadow: 0 0 0 4px rgba(255,255,255,.22), 0 0 6px rgba(0,0,0,.35);
}

.swing-stage {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: none;
  overflow: hidden;
  pointer-events: none;
}
.desktop-skin[data-scene="swing"] .swing-stage { display: block; }
.swing-artboard {
  position: absolute;
  top: 0;
  left: 50%;
  width: max(100%, calc(100vh * 2 / 3));
  aspect-ratio: 1024 / 1536;
  transform: translateX(-50%);
}
.swing-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: saturate(.9) brightness(1.08);
}
.swing-pendulum {
  position: absolute;
  z-index: 3;
  top: calc(31% - clamp(96px, 18vh, 210px));
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  transform-origin: 0 0;
  transform: rotate(0deg);
  will-change: transform;
}
.swing-rig {
  position: absolute;
  z-index: 3;
  top: clamp(96px, 18vh, 210px);
  left: 0;
  width: min(50vw, 196px);
  transform: translateX(-50%);
  pointer-events: none;
}
.swing-rope-ext {
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 100%;
  height: clamp(96px, 18vh, 210px);
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.swing-character {
  position: relative;
  -webkit-user-drag: none;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 18px 20px rgba(31, 15, 57, .22));
  -webkit-tap-highlight-color: transparent;
}
.swing-stage::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.03) 44%, rgba(255,255,255,.14));
}
.desktop-skin[data-scene="swing"] .fairy-layer { display: none; }
.desktop-skin[data-scene="swing"] .speech-bubble { bottom: calc(var(--safe-bottom) + 195px); }

.desktop-glow {
  position: absolute;
  width: 340px; height: 340px;
  right: -130px; bottom: 14%;
  border-radius: 50%;
  background: rgba(255, 255, 255, .38);
  filter: blur(3px);
}

.status-bar {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  left: 20px; right: 20px;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--berry-900);
  font-size: 12px;
  font-weight: 800;
}
.status-icons { display: flex; gap: 5px; align-items: center; }
.status-icons i { display: block; width: 12px; height: 8px; border-radius: 3px; background: rgba(53,17,79,.65); }
.status-icons i:nth-child(2) { width: 16px; border-radius: 8px 8px 3px 3px; height: 11px; }
.status-icons i:nth-child(3) { width: 18px; border-radius: 5px; }

.desktop-heading {
  position: absolute;
  top: calc(var(--safe-top) + 46px);
  left: 21px; right: 21px;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.desktop-heading p { margin: 0 0 0 30px; color: var(--berry-900); font-size: 13px; font-weight: 800; letter-spacing: .02em; }
.desktop-state { display: flex; gap: 6px; }
.desktop-state span {
  padding: 4px 7px;
  border-radius: 8px;
  background: rgba(255,255,255,.55);
  color: var(--berry-700);
  font-size: 9px;
  font-weight: 800;
  backdrop-filter: blur(8px);
}

.app-grid {
  position: absolute;
  z-index: 7;
  top: calc(var(--safe-top) + 88px);
  left: 18px; right: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  row-gap: 19px;
  column-gap: 13px;
}
.app-icon {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
  color: rgba(42, 25, 50, .9);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: -.015em;
  text-shadow: 0 1px 0 rgba(255,255,255,.62);
  transition: transform .16s ease, opacity .16s ease;
}
.app-icon:active, .app-icon.is-bumped { transform: scale(.92); opacity: .82; }
.app-glyph {
  position: relative;
  display: grid;
  place-items: center;
  width: min(15.5vw, 56px); height: min(15.5vw, 56px);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 23%;
  color: #fff;
  font-size: 22px;
  font-weight: 780;
  line-height: 1;
  box-shadow:
    0 5px 12px rgba(55, 32, 70, .16),
    0 1px 2px rgba(55, 32, 70, .08),
    inset 0 1px 1px rgba(255,255,255,.42),
    inset 0 -1px 1px rgba(0,0,0,.08);
  overflow: hidden;
}
.app-glyph::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,.2), rgba(255,255,255,0) 48%);
  pointer-events: none;
}
.icon-mint .app-glyph {
  color: #1689c9;
  background: radial-gradient(circle at 28% 22%, rgba(255,255,255,.98), rgba(255,255,255,.72) 38%, rgba(255,255,255,.94) 100%);
}
.icon-peach .app-glyph {
  color: #202124;
  background: linear-gradient(to bottom, #ff5b5f 0 21%, #fff 21% 100%);
}
.icon-lilac .app-glyph { background: radial-gradient(circle at 28% 18%, rgba(255,255,255,.42), transparent 37%), linear-gradient(145deg, #ff6688, #f13f63); }
.icon-sky .app-glyph { background: radial-gradient(circle at 28% 18%, rgba(255,255,255,.5), transparent 38%), linear-gradient(145deg, #58c7f4, #1c8fe6); }
.icon-berry .app-glyph { background: radial-gradient(circle at 28% 18%, rgba(255,255,255,.38), transparent 36%), linear-gradient(145deg, #ae72dc, #6940aa); }
.icon-sun .app-glyph { background: radial-gradient(circle at 28% 18%, rgba(255,255,255,.5), transparent 38%), linear-gradient(145deg, #ffd95d, #efb72f); }
.icon-blue .app-glyph { background: radial-gradient(circle at 28% 18%, rgba(255,255,255,.42), transparent 38%), linear-gradient(145deg, #719af7, #3f68df); }
.icon-coral .app-glyph {
  color: #ff375f;
  background: radial-gradient(circle at 28% 18%, #fff, #fff 70%);
  font-size: 25px;
}

.desktop-note {
  position: absolute;
  z-index: 7;
  top: calc(var(--safe-top) + 306px);
  left: 22px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #755f80;
  font-size: 10px;
  font-weight: 700;
}
.desktop-note p { margin: 0; }
.note-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--leaf-500); box-shadow: 0 0 0 5px rgba(119,173,77,.13); }

.speech-bubble {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 420px);
  width: max-content;
  max-width: min(72vw, 270px);
  padding: 10px 14px;
  border: 1px solid rgba(118,65,173,.16);
  border-radius: 16px 16px 16px 5px;
  background: rgba(255,255,255,.86);
  color: var(--berry-800);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 11px 25px rgba(63, 30, 86, .12);
  backdrop-filter: blur(10px);
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity .2s ease, transform .2s ease;
}
.speech-bubble.is-hidden { opacity: 0; pointer-events: none; transform: translate(-50%, 8px); }

.fairy-layer {
  --drag-x: 0px;
  --drag-y: 0px;
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 180px);
  width: min(34vw, 150px);
  transform: translate(calc(-50% + var(--drag-x)), var(--drag-y));
  touch-action: none;
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.fairy-layer.is-dragging { transition: none; cursor: grabbing; }
.fairy-bob { animation: fairy-float 3.8s ease-in-out infinite; transform-origin: 50% 78%; }
.fairy { display: block; -webkit-user-drag: none; width: 100%; height: auto; object-fit: contain; overflow: visible; filter: drop-shadow(0 20px 18px rgba(62, 31, 84, .18)); }
.fairy-shadow { animation: shadow-pulse 3.8s ease-in-out infinite; transform-origin: 150px 365px; }
.fairy-wing { transform-box: fill-box; transform-origin: 50% 20%; }
.wing-left { animation: wing-left 3.2s ease-in-out infinite; }
.wing-right { animation: wing-right 3.2s ease-in-out infinite; }
.fairy-eye { transform-box: fill-box; transform-origin: center; animation: blink 5.2s infinite; }
.fairy-mouth { transform-box: fill-box; transform-origin: center; }
.sparkle { transform-box: fill-box; transform-origin: center; }
.star-one { animation: twinkle 2.8s ease-in-out infinite; }
.star-two { animation: twinkle 2.8s .8s ease-in-out infinite; }

@keyframes fairy-float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-9px) } }
@keyframes shadow-pulse { 0%,100% { transform: scaleX(1); opacity: .18 } 50% { transform: scaleX(.78); opacity: .11 } }
@keyframes wing-left { 0%,100% { transform: rotate(-5deg) } 50% { transform: rotate(6deg) } }
@keyframes wing-right { 0%,100% { transform: rotate(5deg) } 50% { transform: rotate(-6deg) } }
@keyframes blink { 0%, 44%, 49%, 100% { transform: scaleY(1) } 46%, 47% { transform: scaleY(.12) } }
@keyframes twinkle { 0%,100% { opacity: .6; transform: scale(.86) rotate(0) } 50% { opacity: 1; transform: scale(1.1) rotate(10deg) } }

.fairy-layer.is-poked .fairy-bob { animation: happy-bounce .62s cubic-bezier(.2, .8, .2, 1); }
.fairy-layer.is-poked .arm-right { animation: wave .62s ease-in-out; }
.fairy-layer.is-happy .fairy-bob { animation: happy-bounce .82s ease-in-out; }
.fairy-layer.is-dancing .fairy-bob { animation: dance .72s ease-in-out infinite; }
.fairy-layer.is-dancing .fairy { filter: drop-shadow(0 20px 18px rgba(62,31,84,.18)) saturate(1.15); transform: rotate(-2deg); }
.fairy-layer.is-sleepy .fairy-eye { animation: sleepy .95s ease-in-out infinite alternate; }
.fairy-layer.is-sleepy .fairy-mouth { transform: translateY(3px) scaleY(.3); }

@keyframes happy-bounce { 0%,100% { transform: translateY(0) scale(1) } 35% { transform: translateY(-19px) scale(1.04) } 68% { transform: translateY(-6px) scale(.99) } }
@keyframes wave { 0%,100% { transform: rotate(0) } 30% { transform: rotate(-30deg) } 65% { transform: rotate(-12deg) } }
@keyframes dance { 0%,100% { transform: translateY(0) rotate(-2deg) } 25% { transform: translateY(-10px) rotate(3deg) } 75% { transform: translateY(-5px) rotate(-3deg) } }
@keyframes sleepy { from { transform: scaleY(1) } to { transform: scaleY(.2) } }

.fairy-nameplate {
  width: max-content;
  margin: -9px auto 0;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(53,17,79,.78);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  box-shadow: 0 8px 16px rgba(53,17,79,.17);
}
.fairy-nameplate span { color: #f7d77f; }

.dock {
  position: absolute;
  z-index: 9;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 94px);
  display: flex;
  gap: 13px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 22px;
  background: rgba(255,255,255,.5);
  box-shadow: 0 10px 24px rgba(70, 39, 89, .12);
  backdrop-filter: blur(14px);
  transform: translateX(-50%);
}
.dock-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  color: var(--berry-700);
  font-size: 19px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform .18s ease, background .18s ease;
}
.dock-icon:active, .dock-icon.is-bumped { transform: scale(.88); background: #fff; }
.dock-icon.shop-icon {
  color: #fff;
  background: linear-gradient(145deg, #38d879, #08b85b);
  box-shadow: 0 9px 18px rgba(8, 184, 91, .26), inset 0 1px 0 rgba(255,255,255,.44);
}
.dock-icon.shop-icon svg { display: block; width: 24px; height: 24px; }
.dock-icon.shop-icon:active, .dock-icon.shop-icon.is-bumped {
  background: linear-gradient(145deg, #31c86f, #06a852);
}

.control-tray {
  position: absolute;
  z-index: 16;
  left: 12px; right: 12px;
  bottom: calc(var(--safe-bottom) + 10px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 13px 30px rgba(65, 31, 91, .14);
  backdrop-filter: blur(18px);
}
.control-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 2px;
  min-height: 49px;
  border-radius: 15px;
  color: var(--muted);
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.control-button span { font-size: 17px; line-height: 1; }
.control-button b { font-size: 10px; font-weight: 800; }
.control-button.active { color: var(--berry-700); background: var(--berry-100); }
.control-button:active { transform: scale(.95); }
.control-button b { white-space: nowrap; }

.scene-picker {
  position: absolute;
  z-index: 24;
  left: 12px; right: 12px;
  bottom: calc(var(--safe-bottom) + 84px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 22px;
  background: rgba(255,255,255,.86);
  box-shadow: 0 18px 42px rgba(46, 21, 68, .2);
  backdrop-filter: blur(20px);
  animation: scene-picker-in .22s ease both;
}
@keyframes scene-picker-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.scene-option {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 62px;
  padding: 4px 2px;
  border-radius: 16px;
  color: var(--muted);
  transition: color .18s ease, background .18s ease, transform .18s ease;
}
.scene-swatch {
  display: block;
  width: 32px;
  height: 32px;
  border: 2px solid rgba(255,255,255,.88);
  border-radius: 10px;
  background-position: center;
  background-size: cover;
  box-shadow: 0 3px 8px rgba(64, 31, 86, .18);
}
.swatch-dream { background: linear-gradient(145deg, #ccb8ff, #f7d6f1 48%, #c8eedb); }
.swatch-garden { background-image: url("scene-assets/scene-garden.webp?v=20260913p"); }
.swatch-cottage { background-image: url("scene-assets/scene-cottage.webp?v=20260913p"); }
.swatch-meadow { background-image: url("scene-assets/scene-meadow.webp?v=20260913p"); }
.swatch-swing { background-image: url("scene-assets/scene-swing-bg.webp?v=20260913p"); }
.scene-option b { font-size: 10px; font-weight: 800; white-space: nowrap; }
.scene-option.active { color: var(--berry-700); background: var(--berry-100); }
.scene-option.active .scene-swatch { box-shadow: 0 0 0 2px rgba(140, 84, 190, .72), 0 3px 8px rgba(64, 31, 86, .16); }
.scene-option:active { transform: scale(.95); }

.back-button {
  position: absolute;
  z-index: 20;
  top: calc(var(--safe-top) + 47px);
  left: 16px;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.58);
  color: var(--berry-800);
  font-size: 27px;
  line-height: 25px;
  box-shadow: 0 7px 16px rgba(65,31,91,.1);
  backdrop-filter: blur(12px);
}

.camera-permission {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(45, 18, 63, .42);
  backdrop-filter: blur(8px);
}
.camera-permission > div {
  width: min(100%, 340px);
  padding: 25px 22px 20px;
  border-radius: 25px;
  background: rgba(255,255,255,.94);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.camera-mark { display: block; color: var(--berry-600); font-size: 38px; line-height: 1; }
.camera-permission strong { display: block; margin-top: 10px; color: var(--berry-900); font-size: 19px; }
.camera-permission p { margin: 8px 0 18px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.camera-permission button:not(.text-button) {
  width: 100%;
  min-height: 46px;
  border-radius: 15px;
  background: var(--berry-700);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.text-button { margin-top: 12px; color: var(--muted); font-size: 12px; }

.toast {
  position: absolute;
  z-index: 50;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 92px);
  max-width: min(82vw, 320px);
  padding: 10px 14px;
  border-radius: 13px;
  background: rgba(53,17,79,.87);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 26px rgba(53,17,79,.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .22s ease, transform .22s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.particle-layer { position: absolute; z-index: 15; inset: 0; pointer-events: none; overflow: hidden; }
.berry-particle {
  position: absolute;
  width: 13px; height: 16px;
  border-radius: 48% 48% 55% 55%;
  background: linear-gradient(145deg, #9a60cf, #57257e);
  box-shadow: inset -3px -3px 0 rgba(255,255,255,.17);
  animation: berry-fly .82s cubic-bezier(.2,.8,.2,1) both;
}
.berry-particle::after {
  content: "";
  position: absolute;
  left: 3px; top: -4px;
  width: 9px; height: 6px;
  border-radius: 100% 0 100% 0;
  background: var(--leaf-500);
  transform: rotate(-18deg);
}
@keyframes berry-fly {
  0% { opacity: 0; transform: translate(0,0) scale(.5) rotate(0); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1.18) rotate(210deg); }
}
.spark-particle {
  position: absolute;
  color: #f6c95d;
  font-size: 18px;
  animation: sparkle-fly .72s ease-out both;
}
@keyframes sparkle-fly { 0% { opacity: 0; transform: scale(.4) rotate(0) } 25% { opacity: 1 } 100% { opacity: 0; transform: translate(var(--tx), var(--ty)) scale(1.3) rotate(65deg) } }

.scene-screen.ar-active #cameraVideo { opacity: 1; }
.scene-screen.ar-active .desktop-skin { background: rgba(43,24,52,.18); }
.scene-screen.ar-active .desktop-skin::before { opacity: 0; }
.scene-screen.ar-active .desktop-glow { opacity: 0; }
.scene-screen.ar-active .status-bar,
.scene-screen.ar-active .desktop-heading,
.scene-screen.ar-active .app-grid,
.scene-screen.ar-active .desktop-note,
.scene-screen.ar-active .dock,
.scene-screen.ar-active .back-button { opacity: 0; pointer-events: none; }
.scene-screen.ar-active .desktop-skin { transition: background .5s ease, opacity .5s ease; }
.scene-screen.ar-active .speech-bubble { bottom: calc(var(--safe-bottom) + 318px); }
.scene-screen.ar-active .swing-stage { display: none !important; }
.scene-screen.ar-active .desktop-skin[data-scene="swing"] .fairy-layer { display: block; }
.scene-screen.ar-active .fairy-layer { bottom: calc(var(--safe-bottom) + 132px); width: min(38vw, 168px); }
.scene-screen.ar-active .fairy {
  filter: drop-shadow(0 26px 20px rgba(0,0,0,.4)) drop-shadow(0 0 10px rgba(151,101,197,.35));
}
.ar-hint {
  position: absolute;
  z-index: 30;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 156px);
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(28,12,45,.44);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(6px);
  transition: opacity .4s ease, transform .4s ease;
}
.scene-screen.ar-active .ar-hint { opacity: 1; transform: translateX(-50%) translateY(0); }


.entry-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 6px 10px;
  border: 1px solid rgba(79, 132, 54, .18);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  color: var(--leaf-700);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(75, 122, 53, .08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.entry-badge span {
  display: grid;
  place-items: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--leaf-500);
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.desktop-skin { z-index: 3; }
.ar-vignette,
.ar-ground-glow,
.ar-live-badge,
.ar-scan-frame {
  position: absolute;
  pointer-events: none;
}
.ar-vignette {
  z-index: 1;
  inset: 0;
  opacity: 0;
  background:
    linear-gradient(180deg, rgba(18,8,29,.28), transparent 22%, transparent 72%, rgba(18,8,29,.34)),
    radial-gradient(circle at 50% 58%, transparent 38%, rgba(18,8,29,.26) 100%);
  transition: opacity .5s ease;
}
.ar-ground-glow {
  z-index: 2;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 98px);
  width: min(72vw, 260px);
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.30), rgba(236,219,255,.14) 42%, transparent 72%);
  filter: blur(8px);
  opacity: 0;
  transform: translateX(-50%) scale(.82);
  transition: opacity .55s ease, transform .55s ease;
}
.ar-live-badge {
  z-index: 28;
  top: calc(var(--safe-top) + 12px);
  left: 50%;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 7px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.52);
  border-radius: 16px;
  background: rgba(24,12,35,.42);
  color: #fff;
  box-shadow: 0 10px 26px rgba(16,7,26,.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  transition: opacity .4s ease, transform .4s ease;
}
.ar-live-dot {
  grid-row: 1 / 3;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #91ef73;
  box-shadow: 0 0 0 5px rgba(145,239,115,.18), 0 0 12px rgba(145,239,115,.8);
}
.ar-live-badge b { font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.ar-live-badge small { color: rgba(255,255,255,.72); font-size: 9px; font-weight: 600; }
.ar-scan-frame {
  z-index: 26;
  left: 50%; top: 47%;
  width: min(72vw, 300px);
  aspect-ratio: 1;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.88);
  transition: opacity .34s ease, transform .5s cubic-bezier(.2,.8,.2,1);
}
.ar-scan-frame i {
  position: absolute;
  width: 26px; height: 26px;
  border-color: rgba(255,255,255,.95);
  border-style: solid;
  filter: drop-shadow(0 2px 7px rgba(35,16,48,.34));
}
.ar-scan-frame i:nth-child(1) { left: 0; top: 0; border-width: 2px 0 0 2px; border-radius: 8px 0 0 0; }
.ar-scan-frame i:nth-child(2) { right: 0; top: 0; border-width: 2px 2px 0 0; border-radius: 0 8px 0 0; }
.ar-scan-frame i:nth-child(3) { right: 0; bottom: 0; border-width: 0 2px 2px 0; border-radius: 0 0 8px 0; }
.ar-scan-frame i:nth-child(4) { left: 0; bottom: 0; border-width: 0 0 2px 2px; border-radius: 0 0 0 8px; }
.ar-scan-frame span {
  position: absolute;
  left: 50%; bottom: -34px;
  width: max-content;
  max-width: 88vw;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(24,12,35,.45);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.scene-screen.ar-active .ar-vignette { opacity: 1; }
.scene-screen.ar-active .ar-ground-glow { opacity: 1; transform: translateX(-50%) scale(1); }
.scene-screen.ar-active .ar-live-badge { opacity: 1; transform: translateX(-50%) translateY(0); }
.scene-screen.ar-calibrating .ar-scan-frame { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.scene-screen.ar-calibrating .ar-scan-frame::after {
  content: "";
  position: absolute;
  left: 8%; right: 8%; top: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(179,255,151,.95), transparent);
  box-shadow: 0 0 14px rgba(179,255,151,.8);
  animation: ar-scan-line 1.5s ease-in-out infinite;
}
@keyframes ar-scan-line {
  0%,100% { transform: translateY(0); opacity: .25; }
  50% { transform: translateY(min(72vw, 300px)); opacity: 1; }
}

.ar-contact-shadow {
  position: absolute;
  z-index: 0;
  left: 12%; right: 12%; bottom: -4px;
  height: 18px;
  border-radius: 50%;
  background: rgba(12,6,19,.52);
  filter: blur(8px);
  opacity: 0;
  transform: scale(.62);
  transform-origin: center;
  transition: opacity .45s ease, transform .45s ease;
}
.fairy-bob { position: relative; z-index: 1; }
.scene-screen.ar-active .ar-contact-shadow {
  opacity: .52;
  animation: ar-contact-breathe 3.8s ease-in-out infinite;
}
@keyframes ar-contact-breathe {
  0%,100% { transform: scale(.92); opacity: .42; }
  50% { transform: scale(.76); opacity: .3; }
}
.scene-screen.ar-active .fairy-bob { animation: ar-live-float 4.3s ease-in-out infinite; }
@keyframes ar-live-float {
  0%,100% { transform: translateY(0) rotate(-.5deg) scale(1); }
  50% { transform: translateY(-7px) rotate(.7deg) scale(1.012); }
}
.scene-screen.ar-active .fairy {
  filter:
    brightness(var(--ar-brightness, 1))
    saturate(var(--ar-saturation, 1))
    drop-shadow(0 24px 15px rgba(10,5,17,.36))
    drop-shadow(0 0 12px rgba(162,112,203,.22));
}
.scene-screen.ar-active .fairy-layer { bottom: calc(var(--safe-bottom) + 132px); width: min(34vw, 146px); }
.scene-screen.ar-active .ar-hint { bottom: calc(var(--safe-bottom) + 218px); }

.camera-capture {
  position: absolute;
  z-index: 24;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 82px);
  display: grid;
  grid-template-columns: 72px 76px 72px;
  gap: 10px;
  align-items: end;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  transition: opacity .35s ease, transform .35s ease;
}
.scene-screen.ar-active .camera-capture:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.capture-side {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 4px;
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  text-shadow: 0 1px 5px rgba(15,6,24,.72);
}
.capture-side b { line-height: 1; }
.capture-thumb,
.capture-glyph {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 13px;
  background: rgba(25,12,37,.34);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 19px rgba(13,6,22,.16);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}
.capture-thumb {
  background-position: center;
  background-size: cover;
}
.capture-thumb.has-photo {
  border-color: rgba(255,255,255,.92);
  box-shadow: 0 0 0 3px rgba(255,255,255,.18), 0 8px 19px rgba(13,6,22,.26);
}
.shutter-button {
  display: grid;
  place-items: center;
  width: 68px; height: 68px;
  border: 2px solid rgba(255,255,255,.9);
  border-radius: 50%;
  background: rgba(20,10,31,.2);
  box-shadow: 0 10px 28px rgba(11,5,18,.28), inset 0 0 0 4px rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .16s ease;
}
.shutter-button i {
  display: block;
  width: 50px; height: 50px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 -3px 8px rgba(56,34,67,.14), 0 2px 5px rgba(21,10,31,.2);
  transition: transform .16s ease;
}
.shutter-button:active { transform: scale(.94); }
.shutter-button:active i { transform: scale(.9); }

.capture-flash {
  position: absolute;
  z-index: 80;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.capture-flash.is-on { animation: capture-flash .42s ease-out both; }
@keyframes capture-flash {
  0% { opacity: 0; }
  16% { opacity: .82; }
  100% { opacity: 0; }
}

.gallery-panel {
  position: absolute;
  z-index: 70;
  left: 50%; bottom: 0;
  width: min(100%, 520px);
  max-height: 78%;
  overflow: auto;
  padding: 20px 18px calc(var(--safe-bottom) + 22px);
  border-radius: 28px 28px 0 0;
  background: rgba(255,252,255,.97);
  color: var(--berry-900);
  box-shadow: 0 -20px 60px rgba(26,10,38,.28);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transform: translateX(-50%);
}
.gallery-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.gallery-panel header div { display: grid; gap: 3px; }
.gallery-panel header small { color: var(--leaf-700); font-size: 10px; font-weight: 800; letter-spacing: .1em; }
.gallery-panel header strong { font-size: 19px; font-weight: 900; }
.gallery-panel header button {
  padding: 8px 13px;
  border-radius: 999px;
  background: var(--berry-100);
  color: var(--berry-700);
  font-size: 12px;
  font-weight: 800;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.gallery-empty {
  grid-column: 1 / -1;
  margin: 12px 0 8px;
  padding: 30px 18px;
  border: 1px dashed rgba(118,65,173,.24);
  border-radius: 18px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.gallery-photo {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 14;
  overflow: hidden;
  border-radius: 13px;
  background: var(--berry-100);
  box-shadow: 0 8px 18px rgba(53,17,79,.12);
}
.gallery-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-note { margin: 12px 0 0; color: var(--muted); font-size: 10px; text-align: center; }

@media (min-width: 700px) {
  .unlock-screen { padding-left: max(38px, calc(50vw - 360px)); padding-right: max(38px, calc(50vw - 360px)); }
  .unlock-copy { margin-top: 10vh; }
  .card-stage { right: max(38px, calc(50vw - 340px)); top: 36vh; width: 260px; height: 350px; }
  .unlock-actions { left: max(38px, calc(50vw - 360px)); right: max(38px, calc(50vw - 360px)); }
  .scene-screen, .desktop-skin { left: 50%; right: auto; width: 100%; max-width: 520px; transform: translateX(-50%); }
  .scene-screen {
    background:
      radial-gradient(circle at 50% -10%, rgba(151,101,197,.55), transparent 62%),
      linear-gradient(165deg, #3a1b55 0%, #4a2470 46%, #27113c 100%);
  }
  body {
    background: radial-gradient(circle at 50% 8%, #f4ecff 0%, #e6d5f7 44%, #d0b6ec 100%);
  }
  .desktop-skin {
    border-radius: 0;
    box-shadow: 0 40px 90px rgba(18,7,32,.5), 0 0 0 1px rgba(255,255,255,.1);
  }
  #cameraVideo { left: 50%; right: auto; width: 520px; transform: translateX(-50%); }
  .camera-permission { max-width: 520px; left: 50%; right: auto; transform: translateX(-50%); }
}

@media (max-height: 700px) {
  .scene-screen.ar-active .fairy-layer { bottom: calc(var(--safe-bottom) + 116px); width: min(30vw, 128px); }
  .scene-screen.ar-active .ar-hint { bottom: calc(var(--safe-bottom) + 188px); }
  .scene-screen.ar-active .speech-bubble { bottom: calc(var(--safe-bottom) + 294px); }
  .camera-capture { bottom: calc(var(--safe-bottom) + 74px); grid-template-columns: 64px 64px 64px; gap: 8px; }
  .shutter-button { width: 58px; height: 58px; }
  .shutter-button i { width: 42px; height: 42px; }
  .capture-thumb, .capture-glyph { width: 34px; height: 34px; }
}

@media (max-height: 620px) {
  .scene-screen.ar-active .fairy-layer { bottom: calc(var(--safe-bottom) + 168px); width: min(26vw, 112px); }
  .scene-screen.ar-active .ar-hint { bottom: calc(var(--safe-bottom) + 232px); }
  .scene-screen.ar-active .speech-bubble { bottom: calc(var(--safe-bottom) + 322px); }
  .camera-capture { bottom: calc(var(--safe-bottom) + 56px); }
  .ar-live-badge { padding: 6px 10px; }
}

@media (max-height: 700px) {
  .unlock-copy { margin-top: 8vh; }
  .unlock-copy h1 { font-size: clamp(34px, 10vw, 48px); }
  .unlock-copy > p:last-child { margin-top: 10px; font-size: 12px; line-height: 1.55; }
  .card-stage { top: 40vh; width: min(52vw, 230px); height: min(74vw, 306px); }
  .card-qr-wrap { width: 98px; height: 98px; }
  .desktop-note { top: calc(var(--safe-top) + 288px); }
  .speech-bubble { bottom: calc(var(--safe-bottom) + 331px); }
  .fairy-layer { width: min(34vw, 144px); bottom: calc(var(--safe-bottom) + 174px); }
}

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

/* 苹果风底部面板：角色切换、健康、回忆和系统应用降级入口统一在这里承载。 */
.app-sheet {
  position: absolute;
  z-index: 76;
  left: 50%;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(100%, 520px);
  max-height: min(84vh, 720px);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.86);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: rgba(250,248,255,.96);
  color: var(--berry-900);
  box-shadow: 0 -24px 70px rgba(31,13,47,.32);
  backdrop-filter: blur(28px) saturate(1.24);
  -webkit-backdrop-filter: blur(28px) saturate(1.24);
  transform: translateX(-50%);
  animation: app-sheet-in .28s cubic-bezier(.2,.85,.25,1) both;
}
.app-sheet > header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex: 0 0 auto;
  padding: 18px 18px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,.12));
}
.app-sheet > header::before {
  content: "";
  position: absolute;
  top: 7px; left: 50%;
  width: 38px; height: 4px;
  border-radius: 999px;
  background: rgba(74,43,98,.18);
  transform: translateX(-50%);
}
.app-sheet > header div { display: grid; gap: 3px; min-width: 0; }
.app-sheet > header small {
  color: var(--leaf-700);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .12em;
}
.app-sheet > header strong {
  overflow: hidden;
  color: var(--berry-900);
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-sheet > header button {
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--berry-100);
  color: var(--berry-700);
  font-size: 12px;
  font-weight: 850;
}
.app-sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 18px calc(var(--safe-bottom) + 24px);
  scrollbar-width: thin;
}
.sheet-intro,
.sheet-status-card,
.native-app-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid rgba(118,65,173,.10);
  border-radius: 18px;
  background: rgba(243,233,255,.68);
}
.sheet-intro > span,
.native-app-icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--berry-600), var(--berry-800));
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 7px 16px rgba(91,42,134,.18);
}
.sheet-intro p,
.native-app-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.sheet-note {
  margin: 13px 2px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  text-align: center;
}
.role-grid { display: grid; gap: 10px; margin-top: 14px; }
.role-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 10px 12px;
  border: 1px solid rgba(118,65,173,.11);
  border-radius: 19px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 8px 20px rgba(65,31,91,.06);
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.role-card:active { transform: scale(.985); }
.role-card.active {
  border-color: rgba(118,65,173,.42);
  background: rgba(243,233,255,.92);
  box-shadow: 0 0 0 2px rgba(118,65,173,.12), 0 10px 24px rgba(65,31,91,.09);
}
.role-card.is-coming { opacity: .72; }
.role-avatar {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(145deg, #f1e4ff, #d9edc4);
}
.role-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.role-coming {
  color: var(--berry-600);
  font-size: 22px;
  font-weight: 900;
}
.role-copy { display: grid; gap: 4px; min-width: 0; }
.role-copy strong { color: var(--berry-900); font-size: 15px; font-weight: 900; }
.role-copy small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.role-check { color: var(--berry-700); font-size: 12px; font-weight: 850; white-space: nowrap; }
.role-card:not(.active) .role-check { color: var(--muted); font-size: 10px; }
.sheet-status-card { margin-top: 14px; }
.sheet-status-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 46px; height: 46px;
  overflow: hidden;
  border-radius: 15px;
  background: linear-gradient(145deg, #f4e9ff, #e1f2d5);
}
.sheet-status-avatar img { display: block; width: 100%; height: 100%; object-fit: contain; }
.sheet-status-card div { display: grid; gap: 3px; min-width: 0; }
.sheet-status-card small { color: var(--muted); font-size: 10px; font-weight: 800; }
.sheet-status-card strong { color: var(--berry-800); font-size: 13px; line-height: 1.45; }
.sheet-stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.sheet-stat {
  padding: 13px 12px 12px;
  border: 1px solid rgba(118,65,173,.10);
  border-radius: 17px;
  background: rgba(255,255,255,.72);
}
.sheet-stat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.sheet-stat-head span { color: var(--muted); font-size: 11px; font-weight: 800; }
.sheet-stat-head b { color: var(--berry-900); font-size: 19px; font-weight: 900; }
.sheet-progress { height: 8px; overflow: hidden; border-radius: 999px; background: rgba(118,65,173,.12); }
.sheet-progress i { display: block; height: 100%; border-radius: inherit; transition: width .25s ease; }
.sheet-progress i.mood { background: linear-gradient(90deg, #a16bd3, #7042ad); }
.sheet-progress i.fullness { background: linear-gradient(90deg, #f3b85e, #e87961); }
.sheet-rules { display: grid; gap: 0; margin-top: 11px; padding: 2px 13px; border-radius: 17px; background: rgba(255,255,255,.64); }
.sheet-rules div { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 42px; border-bottom: 1px solid rgba(118,65,173,.08); }
.sheet-rules div:last-child { border-bottom: 0; }
.sheet-rules span { color: var(--muted); font-size: 11px; }
.sheet-rules b { color: var(--berry-800); font-size: 12px; font-weight: 850; }
.sheet-actions { display: grid; gap: 9px; margin-top: 14px; }
.sheet-actions.two-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sheet-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid rgba(118,65,173,.12);
  border-radius: 15px;
  background: rgba(255,255,255,.84);
  color: var(--berry-800);
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 6px 14px rgba(65,31,91,.06);
  transition: transform .16s ease, background .16s ease;
}
.sheet-actions button:active { transform: scale(.97); }
.sheet-actions button.primary { border-color: transparent; background: linear-gradient(145deg, var(--berry-600), var(--berry-800)); color: #fff; }
.sheet-actions button span { font-size: 16px; line-height: 1; }
.sheet-empty {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin-top: 14px;
  padding: 24px 18px;
  border: 1px dashed rgba(118,65,173,.22);
  border-radius: 19px;
  background: rgba(255,255,255,.54);
  text-align: center;
}
.sheet-empty > span { color: var(--berry-600); font-size: 24px; }
.sheet-empty strong { color: var(--berry-800); font-size: 14px; }
.sheet-empty p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.sheet-empty.compact { margin-top: 0; }
.sheet-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.sheet-gallery .gallery-photo { aspect-ratio: 9 / 14; border-radius: 13px; }
.native-app-card { margin-top: 14px; }
.native-app-card > div { display: grid; gap: 3px; min-width: 0; }
.native-app-card strong { color: var(--berry-900); font-size: 15px; font-weight: 900; }
.native-app-icon { color: #fff; }
@keyframes app-sheet-in {
  from { opacity: 0; transform: translate(-50%, 16px) scale(.985); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@media (max-height: 700px) {
  .app-sheet { max-height: 88vh; }
  .app-sheet > header { padding-top: 16px; padding-bottom: 10px; }
  .role-card { min-height: 68px; grid-template-columns: 48px minmax(0, 1fr) auto; }
  .role-avatar { width: 48px; height: 48px; }
  .sheet-status-card { margin-top: 10px; }
}
@media (max-height: 620px) {
  .app-sheet { max-height: 92vh; }
  .app-sheet-body { padding-bottom: calc(var(--safe-bottom) + 16px); }
  .sheet-intro,
  .sheet-status-card,
  .native-app-card { padding: 10px 12px; }
  .sheet-stat { padding: 10px; }
  .sheet-actions { margin-top: 10px; }
}

