/* The weekly prize: a full-screen reveal over everything (the gate is 400), the week's seven days and a basket that opens. */
#week {
  position: fixed;
  inset: 0;
  z-index: 450;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(16px + env(safe-area-inset-bottom, 0px));
  background: radial-gradient(ellipse at center, rgba(60, 38, 14, 0.78), rgba(20, 12, 5, 0.94) 75%);
  touch-action: auto;
  animation: wkFade 0.35s ease-out;
}
#week[hidden] {
  display: none;
}
/* While it is up the park's own cards and bars wait under it (they come back as they were when it closes). */
body.weekOn .hud,
body.weekOn .cmdbar,
body.weekOn #panel,
body.weekOn #daycard,
body.weekOn #toast,
body.weekOn #coach,
body.weekOn #nowChip,
body.weekOn .side,
body.weekOn #qsheet,
body.weekOn .alerts,
body.weekOn #goalStrip,
body.weekOn #evPop {
  visibility: hidden !important;
}
.wkBox {
  width: min(460px, 100%);
  box-sizing: border-box;
  border: 18px solid transparent;
  border-image: var(--hide-panel);
  padding: 14px 10px 14px;
  text-align: center;
  color: var(--ink);
  filter: drop-shadow(0 8px 0 rgba(36, 21, 9, 0.3)) drop-shadow(0 16px 20px rgba(0, 0, 0, 0.4));
  animation: wkRise 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.wkBox h2 {
  font-family: var(--display);
  font-size: 30px;
  line-height: 1.1;
  margin: 6px 0 2px;
  color: #2b1a0c;
  text-shadow: 0 1px 0 rgba(255, 250, 235, 0.8), 0 3px 10px rgba(224, 160, 60, 0.35);
  animation: wkTitle 0.6s 0.1s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.wkSub {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 15px;
}
.wkDays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 0 0 6px;
}
.wkDay {
  position: relative;
  border-radius: 10px;
  padding: 4px 0 3px;
  background: rgba(255, 250, 235, 0.55);
  border: 2px solid var(--stone-lo);
  font-size: 12px;
  line-height: 1.2;
  min-width: 0;
  animation: wkTile 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) both;
  animation-delay: calc(0.2s + var(--k) * 0.06s);
}
.wkDay b {
  display: block;
  font-size: 13px;
}
.wkDay img {
  width: 24px;
  height: 24px;
  display: block;
  margin: 2px auto 0;
}
.wkDay.got {
  background: rgba(127, 166, 74, 0.35);
  border-color: var(--leaf);
}
/* the tick or the cross in the corner (ui_check, ui_miss) */
.wkDay .wkMark {
  position: absolute;
  right: -7px;
  top: -9px;
  width: 17px;
  height: 17px;
  margin: 0;
  display: none;
}
.wkDay.got .wkMark,
.wkDay.lost .wkMark {
  display: block;
}
.wkDay.lost {
  opacity: 0.6;
  filter: grayscale(0.7);
}
.wkDay.now {
  background: #ffe7a8;
  border-color: var(--ember);
  box-shadow: 0 0 0 2px rgba(224, 103, 43, 0.35), 0 0 14px rgba(255, 196, 80, 0.9);
  animation: wkTile 0.4s cubic-bezier(0.2, 1.5, 0.4, 1) both, wkPulse 1.2s ease-in-out 0.9s infinite;
  animation-delay: calc(0.2s + var(--k) * 0.06s), 0.9s;
}
/* the claim stamps today's tick */
.wkDay.stamp .wkMark {
  animation: wkStamp 0.45s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}
.wkDay.stamp {
  animation: none;
  background: rgba(127, 166, 74, 0.45);
  border-color: var(--leaf);
}
.wkDay.sun {
  border-style: double;
  border-width: 3px;
}
.wkStage {
  position: relative;
  height: 150px;
  display: grid;
  place-items: center;
  margin: 4px 0;
}
.wkRays {
  position: absolute;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 214, 110, 0.55) 0 10deg, rgba(255, 214, 110, 0) 10deg 24deg);
  mask: radial-gradient(circle, #000 30%, transparent 70%);
  -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.4s, transform 0.6s cubic-bezier(0.2, 1.4, 0.4, 1);
}
#week.open .wkRays {
  opacity: 1;
  transform: scale(1);
  animation: wkSpin 9s linear infinite;
}
/* a white burst when the lid flies off, and sparks out of the basket */
.wkFlash {
  position: absolute;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 235, 0.95), rgba(255, 220, 120, 0) 68%);
  opacity: 0;
  pointer-events: none;
}
#week.open .wkFlash {
  animation: wkFlash 0.7s ease-out;
}
.wkSpark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: radial-gradient(circle, #fffbe0, #ffc84a 55%, rgba(255, 200, 74, 0) 70%);
  opacity: 0;
  pointer-events: none;
}
#week.open .wkSpark {
  animation: wkSpark 0.9s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  animation-delay: var(--d);
}
.wkShadow {
  position: absolute;
  bottom: 12px;
  width: 96px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(43, 23, 11, 0.35), rgba(43, 23, 11, 0) 70%);
}
.wkGift {
  position: relative;
  width: 120px;
  height: 120px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  animation: wkShake 0.9s ease-in-out infinite;
}
.wkGift img {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 0 rgba(36, 21, 9, 0.35));
}
#week.open .wkGift {
  animation: wkPop 0.5s ease-out, wkFloat 2.6s ease-in-out 0.5s infinite;
  pointer-events: none;
}
#week.open #wkGo {
  animation: wkGlow 1.4s ease-in-out infinite;
}
.wkNum {
  font-variant-numeric: tabular-nums;
}
.wkPrize {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 10px;
  min-height: 34px;
  margin: 0 0 6px;
}
.wkItem {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 250, 235, 0.8);
  border: 2px solid var(--stone-lo);
  font-weight: 700;
  font-size: 16px;
  opacity: 0;
  transform: translateY(14px) scale(0.6);
}
.wkItem img {
  width: 22px;
  height: 22px;
}
#week.open .wkItem {
  animation: wkIn 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) forwards;
  animation-delay: calc(0.25s + var(--k) * 0.14s);
}
.wkBig {
  margin: 0 0 6px;
  color: var(--ember);
  font-weight: 700;
}
.wkActs {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.wkActs .btn {
  min-width: 180px;
  min-height: 48px;
  font-size: 19px;
}
#week.taken .wkItem {
  animation: wkAway 0.55s ease-in forwards;
  animation-delay: calc(var(--k) * 0.05s);
}
#week.taken .wkGift {
  animation: wkJump 0.5s ease-out;
}
#week.closing {
  animation: wkFadeOut 0.35s ease-in forwards;
}
#week.closing .wkBox {
  animation: wkSink 0.35s ease-in forwards;
}
@keyframes wkFade {
  from {
    opacity: 0;
  }
}
@keyframes wkFadeOut {
  to {
    opacity: 0;
  }
}
@keyframes wkSink {
  to {
    transform: translateY(30px) scale(0.92);
  }
}
@keyframes wkTitle {
  from {
    opacity: 0;
    transform: scale(0.6) rotate(-4deg);
  }
}
@keyframes wkTile {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.7);
  }
}
@keyframes wkStamp {
  from {
    opacity: 0;
    transform: scale(2.6) rotate(-25deg);
  }
}
@keyframes wkFlash {
  0% {
    opacity: 0;
    transform: scale(0.3);
  }
  25% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.7);
  }
}
@keyframes wkSpark {
  0% {
    opacity: 1;
    transform: rotate(var(--a)) translateX(0) scale(0.4);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--a)) translateX(var(--r)) scale(1);
  }
}
@keyframes wkFloat {
  50% {
    transform: scale(1.1) translateY(-6px);
  }
  0%,
  100% {
    transform: scale(1.1);
  }
}
@keyframes wkJump {
  40% {
    transform: scale(1.2) translateY(-14px);
  }
}
@keyframes wkGlow {
  50% {
    box-shadow: 0 0 0 3px rgba(255, 214, 110, 0.55), 0 0 22px rgba(255, 196, 80, 0.9);
  }
}
@keyframes wkRise {
  from {
    transform: translateY(40px) scale(0.9);
    opacity: 0;
  }
}
@keyframes wkPulse {
  50% {
    transform: translateY(-2px);
  }
}
@keyframes wkShake {
  0%,
  60%,
  100% {
    transform: rotate(0);
  }
  70% {
    transform: rotate(-9deg) scale(1.04);
  }
  80% {
    transform: rotate(8deg) scale(1.06);
  }
  90% {
    transform: rotate(-5deg);
  }
}
/* the basket jumps open and stays in the light */
@keyframes wkPop {
  40% {
    transform: scale(1.35) rotate(-6deg);
  }
  100% {
    transform: scale(1.1);
  }
}
@keyframes wkSpin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes wkIn {
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes wkAway {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(-60px) scale(1.2);
  }
}
@media (max-width: 420px) {
  .wkBox {
    border-width: 14px;
    padding: 12px 6px 12px;
  }
  .wkBox h2 {
    font-size: 24px;
  }
  .wkDays {
    gap: 3px;
  }
  .wkDay {
    font-size: 10px;
  }
  .wkDay b {
    font-size: 11px;
  }
  .wkDay img {
    width: 20px;
    height: 20px;
  }
  .wkStage {
    height: 128px;
  }
  .wkGift {
    width: 100px;
    height: 100px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #week *,
  #week {
    animation-duration: 0.01s !important;
    animation-iteration-count: 1 !important;
  }
}
