:root {
  --pink: #d50070;
  --ink: #100c10;
  --white: #f8f4f1
}
* {
  box-sizing: border-box
}

button, a {
  touch-action: manipulation
}
button:focus-visible, a:focus-visible {
  outline: 2px solid white;
  outline-offset: 5px
}
a {
  color: inherit;
  text-decoration: none
}
button {
  font: inherit;
  cursor: pointer
}
.mast {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 50px 6% 28px 6%;
  z-index: 2
}
.logo img{
  width: 200px;
}
@media (max-width: 575.98px) {
  .logo img{
    width: 150px;
  }
 }
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 0 6% 30px;
  max-width: 1800px;
  width: 100%;
  margin: auto
}
.row {
  display: flex;
  flex-wrap: wrap;
  width: 100%;
  align-items: center
}

.intro {
  position: relative;
  z-index: 1;
  padding: 25px 0;
  max-width: 610px
}


.intro p:not(.eyebrow) {
  font-size: clamp(14px, 1.15vw, 18px);
  line-height: 1.65;
  max-width: 540px
}
.action {
  border: 1px solid var(--pink);
  background: var(--pink);
  color: white;
  padding: 15px 25px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  transition: background .2s, transform .2s
}
.action:hover {
  background: #a80058;
  transform: translateY(-2px)
}
.outline {
  background: transparent;
  border-color: #aaa
}

.visual {
  position: relative;
  min-width: 0
}
.cookie {
  display: block;
  border: 0;
  background: none;
  width: 100%;
  padding: 0;
  transition: transform .3s
}
.cookie:hover {
  transform: scale(1.025)
}
.cookie img {
  width: 100%;
  display: block;
  mask-image: radial-gradient(ellipse 70% 67% at 52% 51%, #000 52%, transparent 99%)
}
.floating {
  position: absolute;
  width: 20%;
  pointer-events: none;
  filter: blur(5px);
  opacity: .8
}
.one {
  top: -12%;
  left: 18%;
  transform: rotate(35deg)
}
.two {
  right: -9%;
  top: 12%;
  transform: rotate(-35deg);
  width: 16%
}
#result {
  width: 100%;
  margin: auto
}
#result h3 {
  text-align: center
}

.reveal {
  position: relative;
  width: min(100%, 590px, 56vh);
  margin: -3% auto -2%;
  aspect-ratio: 1;
  container-type: inline-size
}
.reveal img {
  width: 100%;
  height: 100%;
  display: block;
  mask-image: radial-gradient(ellipse 76% 72% at 51% 52%, black 57%, transparent 100%)
}
.paper {
  position: absolute;
  left: 24%;
  top: 35%;
  width: 45%;
  height: 29%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #241817;
  padding: 2%;
  overflow: hidden
}
.paper p {
  font-family: Caveat, "Segoe Print", cursive;
  font-size: 6cqw;
  line-height: 1.03;
  margin: 0;
  overflow-wrap: break-word
}
.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  position: relative;
  margin-bottom: 50px
}
.subactions {
  text-align: center
}
.closing {
  margin: 20px 0 8px;
  color: #d5c8cf
}
.back {
  background: none;
  border: 0;
  color: #c9b9c3;
  font-size: 12px;
  padding: 8px
}
#status {
  font-size: 12px;
  min-height: 1em;
  margin: 0
}
footer {
  margin-top: auto;
  border-top: 1px solid #9b155b;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 6%;
  font-size: 11px;
  background: #100c10
}
footer nav {
  display: flex;
  gap: 20px
}
[hidden] {
  display: none !important
}
.cracking {
  animation: crack .42s ease both
}
.arrive {
  animation: arrive .65s ease both
}
@keyframes crack {
  20%, 60% {
    transform: rotate(-3deg) scale(1.02)
  }
  40% {
    transform: rotate(3deg)
  }
  100% {
    opacity: 0;
    transform: scale(1.08)
  }
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: scale(.96) translateY(10px)
  }
  to {
    opacity: 1;
    transform: none
  }
}
@media(min-width:992px) {
  .col-lg-5 {
    width: 41.6667%
  }
  .col-lg-7 {
    width: 58.3333%
  }
}
@media(max-width:991px) {
  .stage {
    padding: 0 6% 25px
  }
  .intro, .visual {
    width: 100%;
    max-width: none
  }
  .intro {
    padding: 10px 0 0
  }
  .visual {
    max-width: 480px;
    margin: -15px auto 0
  }
  .mastnote {
    display: none
  }
  .floating {
    display: none
  }
  .reveal {
    width: min(100%, 480px);
    margin: 0 auto
  }
  .intro p {
    margin-bottom: 12px
  }
 
  .closing {
    font-size: 9px
  }
  footer {
    flex-wrap: wrap
  }
  .mast {
    padding-bottom: 28px
  }
}
@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important
  }
}
.floating {
  mask-image: radial-gradient(ellipse at center, black 35%, transparent 73%)
}


.reveal {
  width: min(100%, 690px, 70vh);
  margin: 12px auto 4px;
  aspect-ratio: 1;
}
.paper {
  left: 23%;
  top: 35%;
  width: 44%;
  height: 29%;
  padding: 1.5%;
}
.paper p {
  width: 100%;
  font-size: clamp(16px, 5.8cqw, 42px);
  line-height: 1.12;
  text-wrap: balance;
  overflow-wrap: normal;
}
#result .actions {
  margin-top: 0
}
@media(max-width:991px) {
  .reveal {
    width: min(100%, 540px);
    margin: 10px auto 4px
  }
}
/* One consistent type size for every fortune; scales only with the image. */
.paper {
  left: 23%;
  top: 35%;
  width: 44%;
  height: 29%;
  padding: 1.5%;
  overflow: visible;
  display: grid;
  place-items: center;
}
.paper p {
  font-size: 3.5cqw;
  line-height: 1.12;
  width: 100%;
  margin: 0;
  text-wrap: balance;
  overflow-wrap: normal;
  font-weight: 600;
}
/* 1.2.0: photographic opening sequence */
.reveal {
  width: min(100%, 760px, 72vh);
  isolation: isolate;
  overflow: visible
}

.paper {
  left: 23%;
  top: 35%;
  width: 44%;
  height: 29%;
  padding: 1.5%
}
.paper p {
  font-size: 4.1cqw;
  line-height: 1.08
}
.motion-layers {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(ellipse at 50% 65%, #670b38 0%, transparent 65%);
  z-index: 1
}
.reveal .piece {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mask-image: none;
  -webkit-mask-image: none;
  transform-origin: 50% 70%
}
.reveal.play .motion-layers {
  animation: layerfade 1s both
}
.reveal.play .final-photo {
  animation: photoappear 1s both
}
.reveal.play .paper {
  animation: paperappear 1s both;
  z-index: 2
}
.reveal.play .left-back,
.reveal.play .left-front {
  animation: leftopen .7s both
}
.reveal.play .right-back,
.reveal.play .right-front {
  animation: rightopen .7s both
}
.reveal.play .hand {
  animation: handlift .8s both
}
.reveal.play .crumbs {
  animation: crumbfall .65s both
}
@keyframes leftopen {
  0% {
    transform: translate(19%, -4%) rotate(13deg)
  }
  18% {
    transform: translate(19%, -4%) rotate(13deg)
  }
  75%, 100% {
    transform: none
  }
}
@keyframes rightopen {
  0%, 18% {
    transform: translate(-19%, -4%) rotate(-13deg)
  }
  75%, 100% {
    transform: none
  }
}
@keyframes handlift {
  0%, 25% {
    opacity: 0;
    transform: translate(12%, 19%) scale(.55)
  }
  75%, 100% {
    opacity: 1;
    transform: none
  }
}
@keyframes crumbfall {
  0%, 20% {
    opacity: 0;
    transform: translateY(-8%)
  }
  75%, 100% {
    opacity: 1;
    transform: none
  }
}
@keyframes layerfade {
  0%, 75% {
    opacity: 1
  }
  100% {
    opacity: 0
  }
}
@keyframes photoappear {
  0%, 65% {
    opacity: 0
  }
  100% {
    opacity: 1
  }
}
@keyframes paperappear {
  0%, 70% {
    opacity: 0
  }
  100% {
    opacity: 1
  }
}
@media(max-width:991px) {
  .reveal {
    width: min(100%, 540px)
  }
}
@media(prefers-reduced-motion:reduce) {
  .reveal.play .motion-layers {
    animation: none;
    opacity: 0
  }
  .reveal.play .final-photo, .reveal.play .paper {
    animation: none;
    opacity: 1
  }
}
/* 1.3.1: split cookie halves into back/front occlusion layers */
/* 1.2.1: distinct opening phases, no parent fade */
.reveal .closed-motion {
  position: absolute;
  inset: 0;
  z-index: 3;
  object-fit: contain;
}
.reveal.play .closed-motion {
  animation: closedPhase 2.2s both
}
.reveal.play .motion-layers {
  animation: motionPhase 2.2s both
}
.reveal.play .final-photo {
  animation: finalPhase 2.2s both
}
.reveal.play .paper {
  animation: fortunePhase 2.2s both
}
.reveal .cookie-back {
  z-index: 1
}
.reveal .hand {
  z-index: 2
}
.reveal .cookie-front {
  z-index: 3
}
.reveal .crumbs {
  z-index: 0
}
.reveal.play .left-back,
.reveal.play .left-front {
  animation: splitLeft 2.2s both
}
.reveal.play .right-back,
.reveal.play .right-front {
  animation: splitRight 2.2s both
}
.reveal.play .hand {
  animation: liftPaper 2.2s both
}
.reveal.play .crumbs {
  animation: fallCrumbs 2.2s both
}
@keyframes closedPhase {
  0%, 15% {
    opacity: 1;
    transform: none
  }
  20% {
    opacity: 1;
    transform: rotate(-3deg) scale(1.025)
  }
  25% {
    opacity: 1;
    transform: rotate(3deg)
  }
  32%, 100% {
    opacity: 0;
    transform: scale(.98)
  }
}
@keyframes motionPhase {
  0%, 82% {
    opacity: 1
  }
  100% {
    opacity: 0
  }
}
@keyframes finalPhase {
  0%, 82% {
    opacity: 0
  }
  100% {
    opacity: 1
  }
}
@keyframes fortunePhase {
  0%, 82% {
    opacity: 0
  }
  100% {
    opacity: 1
  }
}
@keyframes splitLeft {
  0%, 25% {
    opacity: 0;
    transform: translate(19%, -4%) rotate(13deg)
  }
  30% {
    opacity: 1
  }
  60%, 100% {
    opacity: 1;
    transform: none
  }
}
@keyframes splitRight {
  0%, 25% {
    opacity: 0;
    transform: translate(-19%, -4%) rotate(-13deg)
  }
  30% {
    opacity: 1
  }
  60%, 100% {
    opacity: 1;
    transform: none
  }
}
@keyframes liftPaper {
  0%, 42% {
    opacity: 0;
    transform: translate(0%, 0%) scale(.55)
  }
  50% {
    opacity: 1
  }
  82%, 100% {
    opacity: 1;
    transform: none
  }
}
@keyframes fallCrumbs {
  0%, 30% {
    opacity: 0;
    transform: translateY(-8%)
  }
  65%, 100% {
    opacity: 1;
    transform: none
  }
}
#again:disabled {
  opacity: .6;
  cursor: wait;
  transform: none
}
@media(prefers-reduced-motion:reduce) {
  body:not(.force-motion) .reveal.play .motion-layers {
    animation: none;
    opacity: 0
  }
  body:not(.force-motion) .reveal.play .final-photo, body:not(.force-motion) .reveal.play .paper {
    animation: none;
    opacity: 1
  }
  body.force-motion .reveal.play .motion-layers, body.force-motion .reveal.play .final-photo, body.force-motion .reveal.play .paper, body.force-motion .reveal.play .piece, body.force-motion .reveal.play .closed-motion {
    animation-duration: 2.2s !important
  }
  body.force-motion .reveal.play .motion-layers {
    animation-name: motionPhase
  }
  body.force-motion .reveal.play .final-photo {
    animation-name: finalPhase
  }
  body.force-motion .reveal.play .paper {
    animation-name: fortunePhase
  }
}


