.entry-overlay {
  --sky: #20162e;
  --ambient: #684875;
  --horizon: #3e364e;
  background: var(--sky);
  transition: background-color 1.2s ease;
  isolation: isolate;
}
[data-period="morning"] .entry-overlay {
  --sky: #453344; --ambient: #a47774; --horizon: #a66a50;
  --daylight: radial-gradient(ellipse at 12% 70%, #ffe4ae 0%, #e9aa79 9%, transparent 51%),
    linear-gradient(170deg, #423955, #8f7485 40%, #c58b79 74%, #87594e);
}
[data-period="day"] .entry-overlay {
  --sky: #745a39; --ambient: #b89a5b; --horizon: #926443;
  --daylight: radial-gradient(ellipse at 89% 3%, #fff5ce 0%, #f9d889 12%, transparent 54%),
    linear-gradient(155deg, #746b5a, #bb975c 40%, #a17544 72%, #76503a);
}
[data-period="dusk"] .entry-overlay {
  --sky: #492d47; --ambient: #9e5757; --horizon: #9c543a;
  --daylight: radial-gradient(ellipse at 92% 64%, #ffbd80 0%, #cc7356 15%, transparent 56%),
    linear-gradient(170deg, #3a2e55 5%, #704161 41%, #b8695c 65%, #603748 89%);
}
[data-period="night"] .entry-overlay {
  --sky: #171e37; --ambient: #485281; --horizon: #303d61;
  --daylight: radial-gradient(ellipse at 13% 10%, #d0d8e8 0%, #8998b5 5%, #4c5c83 16%, transparent 48%),
    linear-gradient(150deg, #283453, #1e2745 54%, #14182d);
}

.ritual-atmosphere, .deity-aura {
  position: absolute;
  pointer-events: none;
}
.ritual-atmosphere {
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.ritual-atmosphere::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 35%, var(--ambient), transparent 64%),
    radial-gradient(ellipse at 55% 95%, var(--horizon), transparent 65%);
  animation: ambient-breath 13s ease-in-out infinite alternate;
}
@keyframes ambient-breath {
  from { opacity: .50; transform: scale(1) }
  to { opacity: .83; transform: scale(1.045) }
}
.ritual-atmosphere::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 43%, #140d21, #090713 73%);
  opacity: 0;
  transition: opacity 480ms ease-out;
}
.entry-overlay[data-draw-focus] .ritual-atmosphere::after {
  opacity: .79;
  transition-duration: 300ms;
}
.entry-overlay :is(.petal-field, .entry-head, .entry-actions, .ritual-links, .book-note) {
  transition: opacity 420ms ease;
}
.entry-overlay[data-draw-focus] :is(.petal-field, .entry-head, .entry-actions, .ritual-links, .book-note) {
  opacity: .42;
  transition-duration: 300ms;
}
.ritual-atmosphere i {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #f7d78c;
  box-shadow: 0 0 7px 2px #efae56a6;
  animation: drift-gold 15s var(--delay, 0s) ease-in-out infinite;
}
.ritual-atmosphere i:nth-child(1) { top: 23%; left: 16%; --delay: -7s }
.ritual-atmosphere i:nth-child(2) { top: 58%; left: 82%; --delay: -11s }
.ritual-atmosphere i:nth-child(3) { top: 16%; left: 74%; --delay: -1s }
.ritual-atmosphere i:nth-child(4) { top: 76%; left: 23%; --delay: -6s }
[data-period="night"] .ritual-atmosphere i { border-radius: 1px; box-shadow: 0 0 7px 1px #fff0b4ad }
[data-period="dusk"] .ritual-atmosphere {
  background: radial-gradient(ellipse at 12% 80%, #ff9b383b, transparent 18%),
    radial-gradient(ellipse at 88% 80%, #ff9b383b, transparent 18%);
}
@keyframes drift-gold {
  0%, 100% { opacity: .16; transform: translate3d(0, 15px, 0) }
  50% { opacity: .73; transform: translate3d(13px, -24px, 0) }
}

[data-period="dusk"] .ritual-atmosphere i:is(:nth-child(2), :nth-child(4)) {
  width: 14px;
  height: 6px;
  background: #be7e5391;
  border-radius: 12% 12% 55% 55%;
  box-shadow: 0 -7px 16px 2px #ffab4d80;
}
[data-period="dusk"] .ritual-atmosphere i:is(:nth-child(2), :nth-child(4))::before {
  content: '';
  position: absolute;
  left: 5px;
  bottom: 5px;
  width: 5px;
  height: 8px;
  border-radius: 65% 40% 55% 55%;
  background: #ffcd8b;
}

.entry-dialog { animation: arrive 480ms ease-out both }
@keyframes arrive { from { opacity: .66 } to { opacity: 1 } }
.entry-card:not(.drawing):not(.is-drawing):not(.revealed):not(.covering) {
  animation: card-float 6s ease-in-out infinite;
}
@keyframes card-float { 0%, 100% { translate: 0 0 } 50% { translate: 0 -5px } }
.entry-overlay {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
:is(.entry-overlay .entry-card, .entry-overlay button, .entry-overlay a,
    .music-toggle, .haptics-toggle, .ritual-dialog button) {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
[data-card-touch] :is(.entry-card, .entry-overlay button, .entry-overlay a):focus {
  outline: none;
}
.entry-overlay[data-first-ritual] .blessing-button:not([data-completed]) {
  touch-action: none;
  user-select: none;
  -webkit-touch-callout: none;
}
@property --prayer-progress {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.prayer-progress {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: 150%;
  aspect-ratio: 1;
  z-index: 4;
  border: 1px solid #ffe7a62e;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}
[data-holding] .prayer-progress, [data-hold-complete] .prayer-progress { opacity: 1 }
.prayer-progress::before {
  content: '';
  position: absolute;
  inset: 0;
  border: 3px solid transparent;
  border-radius: inherit;
  background: conic-gradient(#fff6cb var(--prayer-progress), transparent 0deg) border-box;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
[data-holding] .prayer-progress {
  box-shadow: 0 0 16px #f2bc624f, inset 0 0 12px #ffc5662c;
}
[data-holding] .prayer-progress::before { animation: gather-light 2s linear both }
[data-hold-complete] .prayer-progress { animation: release-prayer-light 780ms ease-out both }
[data-hold-complete] .prayer-progress::before { --prayer-progress: 360deg }
.entry-overlay[data-hold-complete="prayer"] .entry-card:not(.revealed):not(.drawing):not(.is-drawing) {
  animation: lift-prayer-card 700ms ease-in-out both;
}
@keyframes release-prayer-light {
  from { opacity: 1; scale: 1; box-shadow: 0 0 27px #ffd17380 }
  to { opacity: 0; scale: 1.12 }
}
@keyframes lift-prayer-card {
  0%, 100% { translate: 0 0 }
  52% { translate: 0 -16px }
}
@keyframes gather-light { from { --prayer-progress: 0deg } to { --prayer-progress: 360deg } }
[data-holding] .ritual-atmosphere::before { animation: prayer-light 2s ease both }
@keyframes prayer-light { from { opacity: .63 } to { opacity: 1; transform: scale(1.08) } }
#touch-glow {
  position: fixed;
  z-index: 10000;
  width: clamp(112px, 33vw, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff7cb 0%, #ffdf7780 15%, #f9b84930 39%, transparent 59%),
    radial-gradient(circle, transparent 42%, #ffdb6866 46%, #fff1baaf 48%, #ffb34655 50%, transparent 55%);
  opacity: 0;
  pointer-events: none;
}
.entry-card .answer-face { -webkit-backface-visibility: hidden }
.entry-card.is-drawing .answer-card-inner { transition: none }
.entry-card.is-drawing::before { rotate: -8deg; translate: -6px 4px }
.entry-card.is-drawing::after { rotate: 8deg; translate: 6px 4px }
.entry-card::before, .entry-card::after { transition: opacity .6s, rotate .6s, translate .6s, transform .6s }
.entry-card.revealed:not(.fortune-card):not(.drawing):not(.covering) .answer-card-inner {
  transform: translate3d(0, 0, 25px) rotateY(180deg) scale(1.035);
}
.deity-aura {
  inset: -16% -38%;
  z-index: 0;
  opacity: 0;
  background: radial-gradient(ellipse, var(--deity-color, #ffe0a0) 0%, transparent 66%);
  transition: opacity .85s ease;
}
[data-deity-aura] .deity-aura { opacity: .72 }
.deity-aura::after {
  content: '';
  position: absolute;
  inset: 8% 4%;
  opacity: .68;
}
.deity-aura span {
  position: absolute;
  width: clamp(13px, 4vw, 23px);
  height: clamp(19px, 5.5vw, 29px);
  inset-inline-start: 7%;
  top: 55%;
  opacity: .82;
}
.deity-aura span + span { inset-inline-start: auto; inset-inline-end: 7%; top: 38%; opacity: .67 }
[data-deity-aura="lotus"] .deity-aura span {
  background: linear-gradient(#ffe8b9, var(--deity-color));
  clip-path: polygon(50% 0, 66% 24%, 67% 44%, 92% 24%, 92% 49%, 82% 77%, 50% 97%, 18% 77%, 8% 49%, 8% 24%, 33% 44%, 34% 24%);
  animation: lotus-drift 6s ease-in-out infinite alternate;
}
[data-deity-aura="petals"] .deity-aura span {
  top: 30%;
  background: linear-gradient(#fff1c4, var(--deity-color));
  border-radius: 65% 25% 62% 32%;
  animation: deity-petal-drift 6s ease-in-out infinite alternate;
}
[data-deity-aura="petals"] .deity-aura span + span { top: 17%; animation-delay: -2.5s }
@keyframes deity-petal-drift { from { transform: translateY(-12px) rotate(-17deg); opacity: .45 } to { transform: translateY(22px) rotate(13deg); opacity: .85 } }
@keyframes lotus-drift { from { transform: translateY(-10px) rotate(-8deg); opacity: .42 } to { transform: translateY(14px) rotate(9deg); opacity: .87 } }
[data-deity-aura="moon"] .deity-aura::after {
  background: radial-gradient(ellipse at 55% 70%, #d6e2ff99, transparent 50%);
  animation: mist-drift 8s ease-in-out infinite alternate;
}
[data-deity-aura="moon"] .deity-aura span:first-child {
  inset-inline-start: auto;
  inset-inline-end: 3%;
  top: 22%;
  height: clamp(13px, 4vw, 23px);
  border-radius: 50%;
  box-shadow: 5px 3px 0 #e9f1ff;
}
@keyframes mist-drift { from { transform: translateX(-5%); opacity: .4 } to { transform: translateX(5%); opacity: .7 } }
[data-deity-aura="feather"] .deity-aura span {
  border-radius: 65% 40% 68% 30%;
  background: radial-gradient(ellipse at 54% 41%, #151c52 0 12%, #489eaa 13% 25%, #cfb36b 26% 34%, #5ca887 35% 55%, #376a58 56%);
  rotate: 19deg;
}
[data-deity-aura="feather"] .deity-aura span + span { rotate: -26deg }
[data-deity-aura="rays"] .deity-aura::after {
  background: radial-gradient(ellipse at 8% 48%, var(--deity-color), transparent 26%),
    radial-gradient(ellipse at 92% 48%, var(--deity-color), transparent 26%);
}
.haptics-toggle[hidden] { display: none }
.card-reveal {
  position: relative;
  transition: translate 180ms ease-out;
  display: grid;
  justify-items: center;
  width: 100%;
}
[data-awaiting-draw] .card-reveal { translate: 0 -7px }
[data-card-touch] .entry-card:not(.is-drawing) .answer-card-inner {
  transition: transform 360ms cubic-bezier(.2,.77,.25,1);
}
.haptics-toggle { right: max(70px, calc(env(safe-area-inset-right) + 60px)); font-size: 1.15rem }
@media (max-width: 600px) {
  .haptics-toggle { right: calc(env(safe-area-inset-right) + 59px) }
}

.petal.chrysanthemum-petal {
  width: calc(var(--size) * .7);
  border-radius: 60% 50% 55% 25%;
  background: linear-gradient(135deg, #fff5aa 3%, #efc14c 46%, #a96a23 100%);
  box-shadow: inset 1px 1px 2px #fff3b6ba, 0 3px 6px #28132358;
}
.chrysanthemum-petal::after { border-color: #fff0ab70 }
.fortune-blooms {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.fortune-stage .fortune-blooms { display: block }
.chrysanthemum {
  position: absolute;
  width: clamp(24px, 8.5vw, 48px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: repeating-conic-gradient(from 8deg, #ad6019 0deg, #f5b83e 6deg, #ffe981 13deg, #bf771e 20deg);
  clip-path: polygon(
    50.0% 8.0%, 55.7% 1.3%, 61.3% 2.3%, 64.4% 10.5%, 72.0% 6.2%, 76.9% 9.1%,
    77.0% 17.8%, 85.6% 16.4%, 89.3% 20.7%, 86.4% 29.0%, 95.0% 30.6%, 96.9% 35.9%,
    91.4% 42.7%, 98.9% 47.2%, 98.9% 52.8%, 91.4% 57.3%, 96.9% 64.1%, 95.0% 69.4%,
    86.4% 71.0%, 89.3% 79.3%, 85.6% 83.6%, 77.0% 82.2%, 76.9% 90.9%, 72.0% 93.8%,
    64.4% 89.5%, 61.3% 97.7%, 55.7% 98.7%, 50.0% 92.0%, 44.3% 98.7%, 38.7% 97.7%,
    35.6% 89.5%, 28.0% 93.8%, 23.1% 90.9%, 23.0% 82.2%, 14.4% 83.6%, 10.7% 79.3%,
    13.6% 71.0%, 5.0% 69.4%, 3.1% 64.1%, 8.6% 57.3%, 1.1% 52.8%, 1.1% 47.2%,
    8.6% 42.7%, 3.1% 35.9%, 5.0% 30.6%, 13.6% 29.0%, 10.7% 20.7%, 14.4% 16.4%,
    23.0% 17.8%, 23.1% 9.1%, 28.0% 6.2%, 35.6% 10.5%, 38.7% 2.3%, 44.3% 1.3%
  );
}
.chrysanthemum::before, .chrysanthemum::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.chrysanthemum::before {
  inset: 13%;
  background: repeating-conic-gradient(from 13deg, #b76f1b 0deg, #ffd35e 8deg, #fff3a0 17deg, #cd861f 27deg);
  mask-image: radial-gradient(circle, #000 57%, transparent 73%);
}
.chrysanthemum::after {
  inset: 29%;
  background: radial-gradient(circle, #845016 5%, #d78b1d 33%, #ffd862 53%, #ffe287 60%, transparent 71%);
}
.chrysanthemum:first-child { left: 0; top: 35% }
.chrysanthemum:last-child { right: 0; top: 66%; rotate: -17deg }
@media (orientation: landscape) and (max-height: 550px) {
  .chrysanthemum:first-child { left: -13px }
  .chrysanthemum:last-child { right: -13px }
}
.entry-overlay.fortune-stage { background: #240b13 }
.fortune-stage .ritual-atmosphere { display: none }
.rare-meaning { margin: 0 0 8px; font-size: .78rem; color: #fff1cf }
#streak-lamps li {
  position: relative;
  display: grid;
  min-height: 44px;
  padding: 0;
  place-items: center;
  overflow: hidden;
  filter: none;
  opacity: .72;
}
#streak-lamps .lit { opacity: 1; background: #533424 }
#streak-lamps .lit::before {
  content: '';
  position: absolute;
  inset: -25%;
  background: radial-gradient(ellipse at 50% 46%, #f8ab458c, transparent 64%);
  opacity: .6;
  pointer-events: none;
}
.prayer-lamp-action {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 44px;
  padding: 0;
  background: #51382133;
  border: 1px solid #e1b36486;
  border-radius: inherit;
}
.prayer-lamp-action:focus-visible {
  outline: 2px solid #ffdd9a;
  outline-offset: -3px;
}
.diya {
  display: block;
  position: relative;
  z-index: 1;
  margin-top: 13px;
  width: min(28px, calc(100% - 4px));
  height: 11px;
  background: linear-gradient(#bd997a 0 24%, #a16f5b 28%, #65424a);
  border-radius: 15% 15% 58% 58%;
  border-top: 2px solid #a78b77;
}
.diya::before, .diya::after {
  content: '';
  position: absolute;
  left: 50%;
  translate: -50% 0;
}
.diya::before {
  bottom: 100%;
  width: 3px;
  height: 7px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(#eed6af, #977456 72%, #5d473a);
  rotate: -8deg;
}
.diya::after {
  bottom: calc(100% + 3px);
  width: 10px;
  height: 15px;
  border-radius: 82% 18% 62% 38%;
  background: radial-gradient(ellipse at 57% 79%, #fff5ba, #ffc46e 56%, #ee7d40);
  transform-origin: center bottom;
  opacity: 0;
}
.lit .diya { background: linear-gradient(#ffda90 0 24%, #d87b4b 28%, #8d4840); border-color: #ffe1a1 }
.lit .diya::before { background: linear-gradient(#fff2a8, #eaae68 46%, #7d4c30) }
.lit .diya::after {
  opacity: 1;
  box-shadow: 0 0 7px #ffbd679c;
}
@keyframes diya-sway {
  0%, 100% { transform: rotate(-13deg) scale(.94, 1); opacity: .93 }
  40% { transform: rotate(14deg) scale(1.02, .92); opacity: 1 }
  72% { transform: rotate(-7deg) scale(.97, 1.08); opacity: .89 }
}
@keyframes diya-warm-glow {
  0%, 100% { opacity: .50 }
  46% { opacity: .83 }
  72% { opacity: .63 }
}
@keyframes diya-ignite {
  from { opacity: 0; transform: scale(.3) }
  55% { opacity: 1; transform: scale(1.17) }
  to { opacity: 1; transform: scale(1) }
}
.blessing-button:not([data-completed]) svg path:nth-child(-n+2) { opacity: .27 }
.lamp-igniting svg path:nth-child(-n+2) { animation: diya-ignite 700ms ease-out both }

[data-quiet-effects] .ritual-atmosphere i:nth-child(n+3) { display: none }
[data-quiet-effects] .deity-aura span,
[data-quiet-effects] .deity-aura::after { animation: none }
[data-quiet-effects] .entry-card { filter: none }
[data-quiet-effects] .prayer-icon,
[data-quiet-effects] .blessing-button svg { animation: none }
[data-suspended] *, [data-suspended] *::before, [data-suspended] *::after {
  animation-play-state: paused !important;
}
@media (prefers-reduced-motion: reduce) {
  .entry-overlay *, .entry-overlay *::before, .entry-overlay *::after,
  .ritual-atmosphere::before, .ritual-atmosphere::after {
    animation: none !important;
    transition: none !important;
  }
  [data-awaiting-draw] .card-reveal { translate: none }
  [data-holding] .prayer-progress::before { animation: gather-light 2s linear both !important }
  .ritual-atmosphere::before { opacity: .66 }
  .ritual-atmosphere i { opacity: .37 }
}

.prayer-lamp-repeat { background: transparent; border: 0 }
#streak-lamps li:last-child:not(.lit) { overflow: visible }
.lamp-question {
  position: absolute;
  z-index: 2;
  inset: -5px 0 auto;
  color: #ffe4a0;
  text-shadow: 0 1px 2px #613927, 0 0 5px #e9a34c;
  text-align: center;
  font: bold 27px/1 Georgia, serif;
  transform-origin: center bottom;
  pointer-events: none;
}
@keyframes lamp-question-pulse {
  0%, 68%, 100% { transform: translateY(3px) scale(.94); opacity: .84 }
  28% { transform: translateY(-5px) scale(1.1) rotate(4deg); opacity: 1 }
  48% { transform: translateY(3px) scale(.97); opacity: .91 }
  57% { transform: translateY(1px); opacity: .95 }
}
@media (prefers-reduced-motion: no-preference) {
  #collection-dialog #streak-lamps .lamp-question { animation: lamp-question-pulse 1.9s ease-in-out infinite !important }
  #collection-dialog #streak-lamps .lit .diya::after { animation: diya-sway 2.4s ease-in-out infinite !important }
  #collection-dialog #streak-lamps .lit::before { animation: diya-warm-glow 3s ease-in-out infinite !important }
  #collection-dialog #streak-lamps .lit:nth-child(even) { --flame-delay: -1.1s }
  #collection-dialog #streak-lamps .lit:not(.igniting) .diya::after,
  #collection-dialog #streak-lamps .lit:not(.igniting)::before { animation-delay: var(--flame-delay, 0s) !important }
  #collection-dialog #streak-lamps .lit.igniting .diya::after {
    animation: diya-ignite 850ms ease-out both, diya-sway 2.4s 850ms ease-in-out infinite !important;
  }
}

[data-quiet-effects] [data-draw-focus] :is(.petal, .ritual-atmosphere i, .entry-card, .pose-folded, .pose-open) { animation-play-state: paused }

[data-period] .entry-overlay:not(.fortune-stage) {
  background: linear-gradient(180deg, #21162477, transparent 33%, transparent 50%, #241925a8),
    var(--daylight), var(--sky);
}
[data-period] .entry-head { text-shadow: 0 1px 4px #211320 }
