:root {
  --ink: #59361f;
  --ink-soft: #856044;
  --gold: #e4a53d;
  --gold-bright: #ffd77a;
  --gold-deep: #a45218;
  --cream: #fff9e9;
  --shadow: 0 18px 55px rgba(107, 63, 27, .2);
  --scene-height: 100vh;
  --header-height: 66px;
  --age-note-space: 24px;
}
@supports (height: 100dvh) { :root { --scene-height: 100dvh; } }

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body {
  color: var(--ink);
  font-family: "STKaiti", "KaiTi", "Songti SC", "Noto Serif SC", serif;
  background: radial-gradient(circle at 50% 0, #fffdf7, #ead1ad 72%);
  overscroll-behavior-y: none;
}
button { font: inherit; touch-action: manipulation; }
button:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 5px; }

.app-shell {
  position: relative;
  width: 100%;
  min-height: var(--scene-height);
  margin: 0 auto;
  overflow: clip;
  isolation: isolate;
  background: radial-gradient(ellipse at 50% 42%, #fffaf0, #fff1d9 76%, #f6deb8);
}
.celestial-background {
  position: absolute;
  inset: 0;
  z-index: -10;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .18;
  transition: filter .8s ease, opacity .8s ease;
}
.golden-atmosphere {
  position: absolute;
  inset: 0;
  z-index: -9;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 34%, rgba(255,253,225,.56) 0 13%, rgba(255,216,106,.2) 30%, transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,.16), transparent 68%, rgba(255,235,181,.18));
}
.app-shell[data-screen="game"] .celestial-background {
  opacity: .1;
}
.app-shell[data-screen="game"] .golden-atmosphere {
  background: linear-gradient(180deg, rgba(255,249,233,.35), rgba(255,240,211,.25));
}

.topbar {
  position: relative;
  z-index: 40;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: calc(var(--header-height) + env(safe-area-inset-top));
  padding: calc(9px + env(safe-area-inset-top)) 14px 8px;
  background: linear-gradient(180deg, rgba(255,250,237,.7), rgba(255,250,237,0));
  width: min(100%, 540px);
  margin: 0 auto;
}
.app-shell:is([data-screen="welcome"], [data-screen="complete"]) .topbar { position: absolute; top: 0; left: 50%; transform: translateX(-50%); }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #fff8d4;
  background: linear-gradient(145deg, #f5c45f, #b96520);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.34), 0 5px 18px rgba(181,100,31,.24), 0 0 18px rgba(255,213,111,.56);
}
.brand-copy h1 {
  margin: 2px 0 0;
  font-size: clamp(15px, 3.9vw, 19px);
  letter-spacing: .06em;
  font-weight: 700;
  text-shadow: 0 1px rgba(255,255,255,.7);
}
.eyebrow {
  margin: 0;
  color: var(--gold-deep);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
}
.counter-pill {
  min-width: 76px;
  padding: 7px 9px;
  text-align: center;
  border: 1px solid rgba(198,122,42,.44);
  border-radius: 999px;
  background: rgba(255,250,236,.76);
  box-shadow: inset 0 0 18px rgba(255,255,255,.86), 0 5px 20px rgba(132,76,27,.1);
  backdrop-filter: blur(13px);
  font-family: ui-serif, Georgia, serif;
}
.counter-pill strong { font-size: 23px; color: var(--gold-deep); }
.counter-pill span { margin-left: 3px; font-size: 12px; color: var(--ink-soft); }

.screen {
  position: relative;
  min-height: calc(var(--scene-height) - var(--header-height) - env(safe-area-inset-top));
  padding: 0 18px calc(52px + env(safe-area-inset-bottom));
  animation: screenIn .72s cubic-bezier(.22,.75,.2,1) both;
}
.screen[hidden] { display: none !important; }
@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.welcome-screen, .game-screen, .completion-screen {
  height: var(--scene-height);
  min-height: var(--scene-height);
  padding: 0;
  overflow: hidden;
  animation-name: sceneIn;
}
@keyframes sceneIn { from { opacity: 0; } to { opacity: 1; } }
.scene-backdrop {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}
.welcome-screen .hero-art, .completion-screen .hero-art {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.completion-screen .hero-art { pointer-events: auto; }
.welcome-screen .hero-art, .completion-screen .hero-art, .image-stage {
  width: min(100vw, calc(var(--scene-height) * 941 / 1672));
  height: min(calc(100vw * 1672 / 941), var(--scene-height));
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 3%, #000 97%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 3%, #000 97%, transparent);
}
@media (min-aspect-ratio: 941/1672) {
  .welcome-screen .hero-art, .completion-screen .hero-art, .image-stage {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent);
    mask-image: linear-gradient(to right, transparent, #000 3%, #000 97%, transparent);
  }
}

.radiant-mandorla {
  position: absolute;
  z-index: -3;
  left: 50%;
  top: -4px;
  width: min(112vw, 470px);
  aspect-ratio: 1;
  transform: translateX(-50%);
  border-radius: 50%;
  background: repeating-conic-gradient(from -4deg, rgba(255,221,116,.38) 0 5deg, transparent 5deg 13deg);
  animation: rayTurn 42s linear infinite;
  pointer-events: none;
}
.radiant-mandorla::before {
  content: "";
  position: absolute;
  inset: 32px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffef2 0 20%, rgba(255,238,169,.92) 37%, rgba(241,178,61,.28) 56%, transparent 72%);
  box-shadow: 0 0 40px rgba(255,205,91,.5);
}
.radiant-mandorla i {
  position: absolute;
  inset: 58px;
  border: 1px solid rgba(221,148,39,.25);
  border-radius: 50%;
}
.radiant-mandorla i:nth-child(2) { inset: 82px; border-style: dashed; }
.radiant-mandorla i:nth-child(3) { inset: 104px; border-color: rgba(255,255,255,.62); }
@keyframes rayTurn { to { transform: translateX(-50%) rotate(360deg); } }

.hero-art {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  background: transparent;
  overflow: hidden;
}
.hero-art::after {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  bottom: 8%;
  width: 74%;
  height: 28%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,238,174,.68), transparent 70%);
  filter: blur(9px);
}
.hero-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  user-select: none;
}
.hero-cloud {
  position: absolute;
  z-index: 3;
  top: 315px;
  width: 165px;
  height: 34px;
  border-top: 3px solid rgba(255,255,250,.84);
  border-radius: 50%;
  filter: drop-shadow(0 8px 10px rgba(255,255,255,.76));
  pointer-events: none;
}
.hero-cloud::before, .hero-cloud::after {
  content: "";
  position: absolute;
  border: 3px solid rgba(255,255,250,.82);
  border-bottom: 0;
  border-radius: 60px 60px 0 0;
}
.hero-cloud::before { width: 70px; height: 34px; left: 26px; top: -29px; }
.hero-cloud::after { width: 50px; height: 24px; right: 16px; top: -20px; }
.hero-cloud-left { left: -54px; }
.hero-cloud-right { right: -54px; transform: scaleX(-1); }

.welcome-copy {
  position: absolute;
  z-index: 6;
  top: calc(var(--header-height) + env(safe-area-inset-top));
  left: 50%;
  width: calc(100% - 24px);
  max-width: 420px;
  margin: 0;
  padding: 6px 4px 2px;
  transform: translateX(-50%);
  text-align: center;
  background: radial-gradient(ellipse at center, rgba(255,249,230,.88), rgba(255,249,230,.25) 62%, transparent 78%);
}
.seal {
  display: inline-block;
  margin: 0 0 6px;
  padding: 4px 13px;
  color: var(--gold-deep);
  border: 1px solid rgba(183,95,24,.38);
  border-radius: 99px;
  background: rgba(255,250,233,.75);
  font-size: 10px;
  letter-spacing: .3em;
}
.welcome-copy h2, .completion-copy h2 {
  margin: 0;
  font-size: clamp(19px, 5vw, 24px);
  line-height: 1.25;
  letter-spacing: .08em;
  text-shadow: 0 2px rgba(255,255,255,.66);
}
.welcome-copy h2 span { color: var(--gold-deep); font-size: .77em; }
.welcome-copy h2 { font-size: 18px; line-height: 1.35; letter-spacing: .11em; font-weight: 600; color: #71451f; }
.welcome-copy > p:last-child, .completion-copy > p:last-child {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
  letter-spacing: .04em;
}
.welcome-copy > p:last-child { font-size: 10px; color: #94734f; letter-spacing: .055em; }

.lotus-button {
  position: relative;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 168px;
  height: 48px;
  min-height: 48px;
  margin: 0 auto;
  padding: 0 16px;
  color: #795025;
  border: 1px solid rgba(175,119,46,.68);
  border-radius: 25px;
  background: linear-gradient(180deg, #fffbed 0%, #fff6df 70%, #f6e6c3 100%);
  box-shadow: inset 0 0 0 2px rgba(255,253,241,.68), 0 4px 12px rgba(135,86,29,.1);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  -webkit-tap-highlight-color: transparent;
}
.lotus-button:active {
  transform: translateY(1px) scale(.985);
  filter: brightness(1.025);
  box-shadow: inset 0 0 0 2px rgba(255,253,241,.8), 0 2px 7px rgba(135,86,29,.1), 0 0 16px rgba(240,202,112,.22);
}
.lotus-button:disabled { filter: grayscale(.5); opacity: .68; cursor: default; }
.small-lotus { display: block; width: 22px; height: 22px; flex: 0 0 22px; }
.button-copy { display: block; margin: 0; white-space: nowrap; }
.button-copy b { font-size: 16px; line-height: 1; letter-spacing: .11em; font-weight: 600; }
.button-caption {
  margin: 7px 0 0;
  color: #8a6b44;
  font-size: 10px;
  line-height: 15px;
  letter-spacing: .09em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(255,252,236,.85);
}
.welcome-actions, .completion-actions {
  position: absolute;
  z-index: 12;
  bottom: calc(60px + var(--age-note-space) + env(safe-area-inset-bottom));
  left: 50%;
  width: min(calc(100% - 24px), 420px);
  transform: translateX(-50%);
}
.welcome-notes {
  position: absolute;
  z-index: 12;
  left: 12px;
  right: 12px;
  bottom: calc(8px + var(--age-note-space) + env(safe-area-inset-bottom));
  padding: 4px 8px;
  background: radial-gradient(ellipse, rgba(255,249,230,.82), transparent 78%);
}

/* 同一幅完整观音画面由 108 组柔边渐亮，缩放不改变布局尺寸。 */
.app-shell[data-screen="game"] .topbar { display: none; }
.game-screen {
  z-index: 2;
}
.game-heading {
  position: absolute;
  z-index: 10;
  top: calc(9px + env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100% - 20px), 520px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 8px;
  align-items: center;
  text-align: center;
}
.game-heading h2 { margin: 3px 0 0; font-size: 21px; font-weight: 500; letter-spacing: .12em; }
.glass-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(170,113,48,.22);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255,252,242,.65);
  box-shadow: inset 0 0 12px rgba(255,255,255,.62);
  font-size: 26px;
  cursor: pointer;
}
.progress-section { position: absolute; z-index: 10; top: calc(62px + env(safe-area-inset-top)); left: 50%; width: min(calc(100% - 24px), 500px); min-width: 0; transform: translateX(-50%); }
.progress-card {
  display: grid;
  min-height: 34px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 4px 12px;
  border: 1px solid rgba(186,130,60,.2);
  border-radius: 999px;
  background: rgba(255,251,238,.62);
}
.progress-card div:first-child { display: flex; align-items: baseline; white-space: nowrap; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; }
.progress-card span { margin-right: 5px; color: var(--ink-soft); font-size: 10px; }
.progress-card strong { color: var(--gold-deep); font-size: 20px; }
.progress-card em { color: var(--ink-soft); font-size: 10px; font-style: normal; }
.progress-track { height: 5px; overflow: hidden; border-radius: 99px; background: #e5d6bc; }
.progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #bd7b31, #e6b654, #ffe39b); transition: width .5s ease; }
.progress-card small { min-width: 32px; color: var(--gold-deep); text-align: right; font-family: ui-monospace, monospace; font-size: 11px; }
.sync-notice {
  position: absolute;
  z-index: 10;
  bottom: calc(4px + var(--age-note-space) + env(safe-area-inset-bottom));
  left: 50%;
  width: min(calc(100% - 24px), 420px);
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  padding: 0 9px;
  border-radius: 18px;
  background: rgba(255,249,230,.92);
  color: var(--ink-soft);
  font: 11px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}
.sync-notice span { min-width: 0; overflow-wrap: anywhere; }
.recovery-button {
  flex: none;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  color: var(--gold-deep);
  background: transparent;
  font: 12px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.recovery-button:hover { background: rgba(181,113,37,.08); }
.recovery-button:disabled { opacity: .55; cursor: default; }
.zoom-hint { position: absolute; z-index: 10; left: 12px; right: 12px; bottom: calc(5px + var(--age-note-space) + env(safe-area-inset-bottom)); color: #967957; text-align: center; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 10px; line-height: 14px; letter-spacing: .04em; }
.sync-notice:not([hidden]) ~ .zoom-hint { visibility: hidden; }
.image-viewport {
  --light-progress: 0;
  position: absolute;
  z-index: 2;
  inset: 0;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  touch-action: pan-y;
  border: 0;
  border-radius: 0;
  background: transparent;
  isolation: isolate;
}
.image-viewport::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 6px;
  border: 0;
  border-radius: 8px;
  pointer-events: none;
}
.image-load-state { position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; padding: 18px; }
.image-load-card {
  width: min(100%, 270px);
  padding: 22px 16px 18px;
  border: 1px solid rgba(183,130,59,.25);
  border-radius: 20px;
  text-align: center;
  color: var(--ink-soft);
  background: radial-gradient(ellipse at 50% 0, #fffdf2, #f7ead2);
  box-shadow: 0 12px 35px rgba(115,80,36,.08);
}
.image-load-mark { display: block; color: #c28c3c; font-size: 28px; line-height: 1; }
.image-load-card p { margin: 12px 0 6px; font: 13px/1.8 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; overflow-wrap: anywhere; }
.image-load-card .recovery-button { min-height: 40px; padding: 8px 14px; }
.image-load-state[hidden], .sync-notice[hidden], .recovery-button[hidden], #devotionalImage[hidden], #mosaicCanvas[hidden], #completionImage[hidden] { display: none !important; }
.image-stage {
  --scale: 1;
  --tx: 0px;
  --ty: 0px;
  --image-gray: 1;
  --image-brightness: .64;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(var(--scale));
  transform-origin: center;
  transition: transform .65s cubic-bezier(.22,.78,.2,1);
}
.image-stage.dragging { transition: none; }
.devotional-image {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: grayscale(var(--image-gray)) brightness(var(--image-brightness));
  transition: filter .75s cubic-bezier(.2,.7,.25,1);
  user-select: none;
  -webkit-user-drag: none;
}
.mosaic-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}
.image-stage.mosaic-ready .devotional-image { visibility: hidden; }
.image-stage.mosaic-ready .devotional-halo { display: none; }
.devotional-halo {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 29%;
  width: 64%;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  opacity: calc(.04 + var(--light-progress) * .1);
  background: radial-gradient(circle, rgba(255,251,216,.65), rgba(255,222,119,.22) 38%, transparent 68%);
  transform: translate(-50%, -50%);
  animation: haloBreath 5.5s ease-in-out infinite;
  transition: opacity 1.1s ease;
}
.fully-lit .devotional-image { filter: none; }
.fully-lit .devotional-halo { opacity: 0; }
@keyframes haloBreath { 50% { transform: translate(-50%, -50%) scale(1.06); } }
.light-ripples { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.light-ripple {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 0;
  height: 0;
  animation: offeringFade 1.85s ease-out both;
}
.light-wave {
  position: absolute;
  left: -70px;
  top: -70px;
  width: 140px;
  height: 140px;
  border: 1px solid rgba(255,241,177,.85);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255,222,132,.2), inset 0 0 18px rgba(255,238,174,.12);
  animation: lightWave 1.85s cubic-bezier(.15,.5,.25,1) both;
}
.light-wave::after { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(255,247,205,.42); border-radius: 50%; }
.light-lotus {
  position: absolute;
  left: -37px;
  top: -35px;
  width: 74px;
  height: 54px;
  filter: drop-shadow(0 0 9px rgba(255,218,109,.6));
  animation: offeringBloom 1.85s cubic-bezier(.2,.7,.25,1) both;
}
.light-lotus i {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 20px;
  height: 39px;
  border: 1px solid rgba(255,233,161,.86);
  border-radius: 75% 12% 70% 20%;
  background: linear-gradient(160deg, rgba(255,255,239,.56), rgba(255,219,120,.23));
  transform-origin: 50% 100%;
}
.light-lotus i:nth-child(1) { transform: translateX(-50%) rotate(-67deg) scale(.78); }
.light-lotus i:nth-child(2) { transform: translateX(-50%) rotate(-44deg) scale(.91); }
.light-lotus i:nth-child(3) { transform: translateX(-50%) rotate(-22deg); }
.light-lotus i:nth-child(4) { transform: translateX(-50%) scale(1.09); }
.light-lotus i:nth-child(5) { transform: translateX(-50%) rotate(22deg); }
.light-lotus i:nth-child(6) { transform: translateX(-50%) rotate(44deg) scale(.91); }
.light-lotus i:nth-child(7) { transform: translateX(-50%) rotate(67deg) scale(.78); }
.light-mote {
  position: absolute;
  left: -2px;
  top: -2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff4c3;
  box-shadow: 0 0 7px 2px rgba(255,220,111,.52);
  transform: rotate(var(--angle)) translateX(20px);
  animation: moteOffering 1.5s ease-out var(--delay) both;
}
@keyframes offeringFade { 0%, 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes lightWave { 0% { opacity: 0; transform: scale(.35); } 18% { opacity: .7; } 100% { opacity: 0; transform: scale(2.3); } }
@keyframes offeringBloom { 0% { opacity: 0; transform: translateY(12px) scale(.62); } 24% { opacity: .8; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-28px) scale(1.1); } }
@keyframes moteOffering { 0% { opacity: 0; transform: rotate(var(--angle)) translateX(20px) scale(.6); } 20% { opacity: .75; } 100% { opacity: 0; transform: rotate(var(--angle)) translateX(var(--travel)) scale(.2); } }
.game-actions {
  position: absolute;
  z-index: 10;
  bottom: calc(60px + var(--age-note-space) + env(safe-area-inset-bottom));
  left: 50%;
  width: min(calc(100% - 24px), 420px);
  transform: translateX(-50%);
  text-align: center;
}
.game-actions #nextHint {
  margin: 0 0 8px;
  color: #826644;
  font-size: 11px;
  line-height: 16px;
  letter-spacing: .04em;
}
.mantra-layer { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; min-width: 0; pointer-events: none; }
.mantra {
  position: relative;
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 12px 20px;
  color: #74511e;
  background: radial-gradient(ellipse, rgba(255,247,217,.94), rgba(255,236,181,.55) 48%, transparent 75%);
  font-size: clamp(16px, 4.3vw, 19px);
  font-weight: 600;
  line-height: 1.8;
  letter-spacing: .12em;
  text-align: center;
  text-shadow: 0 1px 3px rgba(255,252,232,.95);
  animation: mantraReveal 3.4s ease-out both;
}
.mantra::before { content: ""; position: absolute; z-index: -1; left: 50%; bottom: -34px; width: 70px; height: 84px; border-radius: 50%; background: linear-gradient(transparent, rgba(255,230,157,.5), transparent); filter: blur(13px); transform: translateX(-50%) rotate(8deg); }
@keyframes mantraReveal {
  0% { opacity: .3; transform: translateY(24px) scale(.97); filter: blur(1px); }
  12% { opacity: 1; filter: blur(0); }
  60% { opacity: 1; transform: translateY(-12px) scale(1); filter: blur(0); }
  100% { opacity: 0; transform: translateY(-62px) scale(1.04); filter: blur(3px); }
}
@keyframes mantraFade { 0% { opacity: .3; } 12%, 70% { opacity: 1; } 100% { opacity: 0; } }
.completion-flash { position: absolute; z-index: 8; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 47%, transparent 25%, rgba(255,236,175,.12) 57%, rgba(255,231,141,.38)); }
.completion-flash.play { animation: completeFlash 3s ease-in-out forwards; }
@keyframes completeFlash { 0% { opacity: 0; } 38% { opacity: .75; } 100% { opacity: 0; } }

.completion-screen { text-align: center; }
.completion-rays { top: -4px; opacity: .98; }
.complete-art { margin-top: 0; }
.completion-copy {
  position: absolute;
  z-index: 6;
  bottom: calc(150px + var(--age-note-space) + env(safe-area-inset-bottom));
  left: 50%;
  width: min(calc(100% - 24px), 420px);
  margin: 0;
  transform: translateX(-50%);
  padding: 4px;
  background: radial-gradient(ellipse, rgba(255,249,230,.9), rgba(255,249,230,.24) 65%, transparent 80%);
}
.completion-copy h2 { color: var(--gold-deep); }

.bottom-lotus { position: absolute; z-index: -1; left: 50%; bottom: -20px; width: 360px; height: 90px; transform: translateX(-50%); opacity: .5; }
.bottom-lotus span { position: absolute; left: 50%; bottom: 0; width: 100px; height: 72px; border: 1px solid rgba(196,117,33,.5); border-radius: 75% 10% 75% 10%; background: linear-gradient(135deg,rgba(255,252,232,.9),rgba(246,193,136,.55)); transform-origin: bottom left; }
.bottom-lotus span:nth-child(1) { transform: rotate(-54deg) translateX(-20px); }
.bottom-lotus span:nth-child(2) { transform: rotate(-27deg) translateX(-8px); }
.bottom-lotus span:nth-child(3) { transform: rotate(0deg) translateX(-50px); }
.bottom-lotus span:nth-child(4) { transform: scaleX(-1) rotate(-27deg) translateX(-8px); }
.bottom-lotus span:nth-child(5) { transform: scaleX(-1) rotate(-54deg) translateX(-20px); }
.petals { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.petal { position: absolute; top: -30px; width: 12px; height: 8px; border-radius: 80% 10% 80% 10%; background: linear-gradient(135deg,#fff8ed,#efb692); opacity: .66; animation: petalFall var(--duration) linear infinite; animation-delay: var(--delay); }
@keyframes petalFall { to { transform: translate(var(--drift),110vh) rotate(540deg); } }

.award-dialog { position: fixed; inset: 0; width: min(92vw,420px); min-width: 0; max-width: calc(100% - 24px); max-height: calc(100svh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); margin: auto; padding: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border: 0; border-radius: 30px; color: var(--ink); background: transparent; }
.award-dialog::backdrop { background: rgba(79,53,32,.3); }
.award-card { position: relative; padding: 30px 24px 24px; border: 1px solid rgba(205,132,43,.5); border-radius: 30px; text-align: center; background: linear-gradient(165deg,#fffdf5,#f8e7cd 68%,#e8eee5); box-shadow: 0 28px 90px rgba(66,37,18,.35); }
.award-card::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(208,145,57,.28); border-radius: 23px; pointer-events: none; }
.close-dialog { position: absolute; z-index: 2; right: 10px; top: 8px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: #75462a; background: rgba(137,91,51,.1); font-size: 24px; cursor: pointer; }
.award-lotus { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 8px; border-radius: 50%; color: #fff8dc; background: linear-gradient(145deg,#f8c85e,#c16d22); box-shadow: 0 0 24px rgba(229,163,60,.46); font-size: 26px; }
.award-card h2 { margin: 7px 0; color: var(--gold-deep); font-size: 31px; letter-spacing: .14em; }
.award-message { color: #785640; font-size: 14px; line-height: 1.8; }
.qr-frame { width: min(198px, 100%); aspect-ratio: 1; display: grid; place-items: center; margin: 16px auto 9px; padding: 10px; border: 6px solid #fff; outline: 1px solid rgba(178,106,31,.34); border-radius: 18px; background: #fff; box-shadow: 0 9px 24px rgba(107,65,26,.15); }
.qr-frame canvas { display: block; width: 100%; min-width: 0; max-width: 100%; height: auto; aspect-ratio: 1; }
.award-code { margin: 8px 0 14px; overflow-wrap: anywhere; color: #8b6748; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 11px; letter-spacing: .08em; }
.award-code strong { color: #8a4515; }
.save-button { position: relative; z-index: 1; width: 90%; min-height: 44px; padding: 12px; border: 1px solid #cd8630; border-radius: 999px; color: #fffaf0; background: linear-gradient(135deg,#d99a3b,#a9561a); box-shadow: 0 8px 20px rgba(158,82,25,.2); font-weight: 700; letter-spacing: .1em; cursor: pointer; }
.privacy-note { margin: 12px 0 0; color: #96775f; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 10px; }
.practice-dialog { width: min(88vw, 368px); }
.practice-dialog::backdrop { background: rgba(79,53,32,.24); }
.practice-card { padding: 36px 24px 24px; background: radial-gradient(ellipse at 50% 5%, #fff3ce, transparent 58%), linear-gradient(160deg, #fffdf5, #fcf0dc 72%, #f0ead8); }
.practice-dialog[open] { animation: practiceRise .5s cubic-bezier(.2,.8,.2,1) both; }
.practice-halo { position: relative; display: grid; place-items: center; width: 104px; height: 104px; margin: 0 auto 20px; border: 1px solid rgba(208,145,57,.26); border-radius: 50%; background: radial-gradient(circle, #fff9e4 22%, #f9df9a77 50%, transparent 72%); }
.practice-halo::before { content: ""; position: absolute; inset: 10px; border: 1px solid rgba(208,145,57,.38); border-radius: 50%; }
.practice-halo::after { content: ""; position: absolute; inset: -9px; border: 1px solid rgba(208,145,57,.14); border-radius: 50%; }
.practice-halo img { filter: drop-shadow(0 4px 8px #c68d3a33); }
.practice-card .eyebrow { margin: 0 0 12px; letter-spacing: .2em; }
.practice-card h2 { margin: 0; font-size: 30px; letter-spacing: .12em; }
.practice-blessing { margin: 20px 0 0; color: var(--ink-soft); font-size: 16px; line-height: 2; }
.practice-divider { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 22px auto; color: #c59344; font-size: 12px; }
.practice-divider span { width: 54px; height: 1px; background: linear-gradient(90deg, transparent, #d9b375); }
.practice-divider span:last-child { transform: rotate(180deg); }
.practice-continue { width: 100%; min-height: 50px; font-size: 22px; }
.practice-continue:disabled { cursor: wait; }
.practice-status { margin: 12px 0 0; color: var(--gold-deep); font: 13px/1.6 -apple-system, "PingFang SC", sans-serif; }
.practice-status[hidden] { display: none; }
@keyframes practiceRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.toast { position: fixed; z-index: 90; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); max-width: calc(100vw - 32px); padding: 10px 18px; text-align: center; opacity: 0; border-radius: 999px; color: #fff; background: rgba(86,54,30,.9); transform: translate(-50%,20px); transition: .3s ease; pointer-events: none; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-height: 740px) {
  :root { --header-height: 64px; }
  .topbar { min-height: calc(64px + env(safe-area-inset-top)); padding-top: calc(7px + env(safe-area-inset-top)); padding-bottom: 7px; }
  .completion-copy h2 { font-size: 19px; }
  .welcome-copy > p:last-child { font-size: 10px; line-height: 1.5; }
  .game-heading h2 { font-size: 19px; }
  .game-heading .eyebrow { font-size: 9px; }
  .progress-card { min-height: 32px; padding-top: 4px; padding-bottom: 4px; }
  .zoom-hint { font-size: 9px; line-height: 12px; }
  .game-actions #nextHint { font-size: 10px; line-height: 14px; }
  .mantra { font-size: 16px; letter-spacing: .08em; }
  .award-card { padding: 26px 18px 20px; }
  .award-card h2 { font-size: 28px; }
  .award-message { font-size: 13px; }
}
@media (max-width: 359px) {
  .topbar { grid-template-columns: 29px minmax(0, 1fr) auto; gap: 6px; padding-left: 12px; padding-right: 12px; }
  .brand-mark { width: 29px; height: 29px; }
  .brand-copy h1 { font-size: 14px; letter-spacing: .04em; }
  .eyebrow { font-size: 8px; letter-spacing: .14em; }
  .counter-pill { min-width: 62px; padding: 6px; }
  .counter-pill strong { font-size: 20px; }
  .counter-pill span { font-size: 10px; }
  .completion-copy h2 { font-size: 18px; }
  .welcome-copy h2 { font-size: 16px; }
  .game-heading { grid-template-columns: 44px minmax(0, 1fr) 44px; }
  .progress-card { gap: 7px; padding-left: 9px; padding-right: 9px; }
  .progress-card span { font-size: 9px; }
  .progress-card strong { font-size: 18px; }
  .award-message { font-size: 12px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .radiant-mandorla { width: 350px; }
  .award-dialog { width: min(90vw, 420px); }
}
@media (orientation: portrait) and (max-height: 700px) {
  .welcome-copy h2 { font-size: 16px; }
  .welcome-copy > p:last-child { margin-top: 2px; }
}
@media (min-aspect-ratio: 4/3) and (min-width: 800px) {
  .app-shell:is([data-screen="welcome"], [data-screen="complete"]) .topbar { left: 14px; width: min(280px, calc(50% - 165px)); margin: 0; padding-left: 0; padding-right: 0; transform: none; grid-template-columns: minmax(0, 1fr) auto; }
  .app-shell:is([data-screen="welcome"], [data-screen="complete"]) .brand-mark { display: none; }
  .app-shell:is([data-screen="welcome"], [data-screen="complete"]) .brand-copy h1 { font-size: 16px; }
  .welcome-copy { top: calc(98px + env(safe-area-inset-top)); left: 14px; width: min(280px, calc(50% - 165px)); transform: none; }
  .welcome-actions, .completion-actions, .completion-copy { left: auto; right: 14px; width: min(280px, calc(50% - 165px)); transform: none; }
  .welcome-notes { left: auto; right: 14px; width: min(280px, calc(50% - 165px)); }
  .welcome-actions { bottom: calc(76px + var(--age-note-space) + env(safe-area-inset-bottom)); }
  .game-heading, .progress-section { left: 14px; width: min(280px, calc(50% - 165px)); transform: none; }
  .game-heading h2 { font-size: 17px; }
  .game-heading .eyebrow { font-size: 8px; letter-spacing: .06em; }
  .game-actions { left: auto; right: 14px; width: min(280px, calc(50% - 165px)); transform: none; }
  .sync-notice { left: auto; right: 14px; width: min(280px, calc(50% - 165px)); transform: none; }
  .zoom-hint { left: auto; right: 14px; width: min(280px, calc(50% - 165px)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .mantra { animation: mantraFade 3.4s ease-out both !important; transform: none; filter: none; }
  .mantra::before { display: none; }
}


.participation-note { position: relative; z-index: 6; margin: 0 auto; max-width: 340px; color: var(--ink-soft); font: 10px/1.6 -apple-system, "PingFang SC", sans-serif; text-align: center; }
.age-note { position: absolute; z-index: 12; left: 12px; right: 12px; bottom: calc(8px + env(safe-area-inset-bottom)); margin: 0; color: var(--ink-soft); background: radial-gradient(ellipse, rgba(255,249,230,.82), transparent 78%); font: 11px/18px -apple-system, "PingFang SC", sans-serif; text-align: center; pointer-events: none; }
.award-code strong { overflow-wrap: anywhere; }

/* 保存凭证使用真实图片，保留手机原生长按菜单。 */
#awardDetails[hidden], .award-save-panel[hidden], .award-download[hidden] { display: none !important; }
.award-dialog.saving-image .award-lotus, .award-dialog.saving-image .eyebrow { display: none; }
.award-dialog.saving-image h2 { margin: 8px 0 18px; font-size: 25px; }
.award-save-image { display: block; width: min(100%, 248px); height: auto; max-height: 46svh; object-fit: contain; margin: 0 auto; border-radius: 9px; box-shadow: 0 5px 22px #9c6b3220; user-select: auto; -webkit-touch-callout: default; }
.award-save-hint { margin: 16px auto; color: var(--ink-soft); font: 13px/1.8 -apple-system, "PingFang SC", sans-serif; }
.award-download { display: block; margin: 0 auto; text-decoration: none; }
.award-save-back { display: block; margin: 12px auto 0; padding: 8px 16px; border: 0; background: transparent; color: var(--gold-deep); font: 13px/1.5 -apple-system, "PingFang SC", sans-serif; cursor: pointer; }
#dialogContinueButton { min-height: 44px; padding: 8px 24px; font-size: 20px; font-weight: 600; letter-spacing: .04em; }

/* 续玩入口沿用莲花按钮，领奖入口保持轻巧，不参与主图尺寸计算。 */
.award-peek { display: block; min-height: 36px; margin: 8px auto 0; padding: 7px 18px; border: 1px solid rgba(198,122,42,.35); border-radius: 999px; color: var(--gold-deep); background: rgba(255,250,236,.82); font: 12px/1.5 -apple-system, "PingFang SC", sans-serif; cursor: pointer; }
#showAwardButton { color: var(--ink); font-size: 14px; font-weight: 600; }
.award-peek[hidden], #roundStatus[hidden], #dialogContinueButton[hidden] { display: none !important; }
.game-award { position: absolute; top: calc(100% + 4px); left: 50%; margin: 0; transform: translateX(-50%); white-space: nowrap; }
.completion-copy { bottom: calc(215px + var(--age-note-space) + env(safe-area-inset-bottom)); }
#roundStatus { max-width: 290px; margin: 8px auto; color: var(--ink-soft); font: 12px/1.6 -apple-system, "PingFang SC", sans-serif; }
.lotus-button:disabled { cursor: wait; }

.award-collection-note { margin: 12px 0 16px; color: var(--gold-deep); font: 13px/1.7 -apple-system, "PingFang SC", sans-serif; }
