body.is-baking {
  overflow: hidden;
}

.bake-wait[hidden] {
  display: none;
}

.bake-wait {
  --bake-cycle: 8s;
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding: 22px;
  background:
    radial-gradient(circle at 18px 18px, rgba(132, 73, 45, .12) 0 2px, transparent 2.5px) 0 0 / 36px 36px,
    rgba(250, 239, 218, .92);
  backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity .18s ease;
}

.bake-wait.is-visible {
  opacity: 1;
}

.bake-wait-card {
  position: relative;
  box-sizing: border-box;
  width: min(460px, 100%);
  padding: 28px 34px 26px;
  overflow: hidden;
  border: 3px solid #6f3f2d;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.42) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(rgba(255,255,255,.42) 1px, transparent 1px) 0 0 / 20px 20px,
    #fff8e9;
  box-shadow: 8px 8px 0 #d39a65, 14px 14px 0 rgba(111, 63, 45, .12);
  text-align: center;
}

.bake-wait-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 10px;
  background: repeating-linear-gradient(90deg, #7c402c 0 22px, #e7aa6d 22px 44px, #f6cf91 44px 66px);
}

.bake-eyebrow {
  margin: 4px 0 10px;
  color: #a05438;
  font: 700 9px/1.4 "Courier New", monospace;
  letter-spacing: .16em;
}

.pixel-oven {
  width: 240px;
  max-width: 74%;
  margin: 0 auto -2px;
  filter: drop-shadow(0 7px 0 rgba(94, 48, 33, .16));
  image-rendering: pixelated;
}

.pixel-oven svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  shape-rendering: crispEdges;
}

.oven-shadow { fill: #d59d68; }
.oven-outline { fill: #633a2c; }
.oven-body { fill: #efbd7b; }
.oven-highlight { fill: #ffe0a5; }
.oven-panel { fill: #bf704c; }
.oven-knob { fill: #54332a; }
.oven-display { fill: #38453f; }
.oven-display-dot { fill: #d9f08a; animation: oven-display-blink 1.2s steps(1, end) infinite; }
.oven-display-dot-late { animation-delay: .6s; }
.oven-door-outline { fill: #59362c; }
.oven-window { fill: #2e302e; }
.oven-glow { fill: #8a4932; animation: oven-glow var(--bake-cycle) steps(5, end) infinite; }
.oven-foot { fill: #54332a; }

.pixel-loaf {
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: loaf-bake-bounce 1.1s steps(2, end) infinite;
}

.loaf-outline { fill: #573328; }
.loaf-stage { transform-box: fill-box; transform-origin: center; }
.loaf-dough { fill: #fff6dc; animation: loaf-dough-stage var(--bake-cycle) steps(1, end) infinite; }
.loaf-golden { fill: #edb85f; opacity: 0; animation: loaf-golden-stage var(--bake-cycle) steps(1, end) infinite; }
.loaf-toasted { fill: #c96f37; opacity: 0; animation: loaf-toasted-stage var(--bake-cycle) steps(1, end) infinite; }
.loaf-scores { fill: #70402c; }
.oven-heat {
  fill: #f4c94d;
  transform-box: fill-box;
  transform-origin: center bottom;
  animation: oven-flame .7s steps(2, end) infinite alternate;
}
.oven-heat-right { animation-delay: .35s; }
.pixel-steam {
  fill: #fff3d8;
  opacity: 0;
  transform-box: fill-box;
  animation: pixel-steam-rise 2.2s steps(5, end) infinite;
}
.steam-two { animation-delay: 1.1s; }

.bake-wait-card h2 {
  margin: 0;
  color: #4f3026;
  font-size: clamp(19px, 4vw, 25px);
  line-height: 1.25;
  letter-spacing: .04em;
}

.bake-wait-card > p:not(.bake-eyebrow) {
  max-width: 340px;
  margin: 9px auto 16px;
  color: #8a604b;
  font-size: 11px;
  line-height: 1.7;
}

.bake-progress {
  position: relative;
  height: 14px;
  overflow: hidden;
  border: 2px solid #6f3f2d;
  background: #f4dfbd;
  box-shadow: inset 0 0 0 2px #fff4dc;
}

.bake-progress span {
  position: absolute;
  inset: 2px;
  width: auto;
  background: repeating-linear-gradient(90deg, #e29c42 0 12px, #f3c86b 12px 24px);
  transform: scaleX(.04);
  transform-origin: left center;
  animation: bake-progress var(--bake-cycle) steps(18, end) infinite;
}

.bake-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
  color: #744833;
  font-size: 9px;
  letter-spacing: .04em;
}

.bake-steps i {
  width: 3px;
  height: 3px;
  background: #c47b4d;
  box-shadow: 5px 0 0 #e2aa6e;
}

.bake-wait-card > small {
  display: block;
  margin-top: 14px;
  color: #9c7b68;
  font-size: 9px;
  line-height: 1.6;
}

.bake-pixel-sprinkles i {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #db8f66;
  animation: sprinkle-pop 1.8s steps(2, end) infinite alternate;
}
.bake-pixel-sprinkles i:nth-child(1) { left: 24px; top: 43px; }
.bake-pixel-sprinkles i:nth-child(2) { right: 29px; top: 58px; background: #98bd87; animation-delay: .35s; }
.bake-pixel-sprinkles i:nth-child(3) { left: 44px; top: 150px; background: #e3b54b; animation-delay: .7s; }
.bake-pixel-sprinkles i:nth-child(4) { right: 46px; top: 171px; background: #c87379; animation-delay: 1.05s; }
.bake-pixel-sprinkles i:nth-child(5) { right: 22px; bottom: 60px; background: #98bd87; animation-delay: 1.4s; }

@keyframes loaf-dough-stage {
  0%, 27% { opacity: 1; }
  28%, 100% { opacity: 0; }
}
@keyframes loaf-golden-stage {
  0%, 27% { opacity: 0; }
  28%, 66% { opacity: 1; }
  67%, 100% { opacity: 0; }
}
@keyframes loaf-toasted-stage {
  0%, 66% { opacity: 0; }
  67%, 100% { opacity: 1; }
}
@keyframes loaf-bake-bounce {
  0% { transform: translateY(0) scale(1); }
  65% { transform: translateY(-1px) scale(1.02, .98); }
  100% { transform: translateY(-3px) scale(1.06, 1.02); }
}
@keyframes oven-glow {
  0% { fill: #7a4433; }
  32% { fill: #9d5531; }
  68% { fill: #b7662e; }
  100% { fill: #8d482f; }
}
@keyframes oven-flame {
  from { transform: scaleY(.75); opacity: .7; }
  to { transform: scaleY(1.15); opacity: 1; }
}
@keyframes pixel-steam-rise {
  0%, 12% { opacity: 0; transform: translateY(3px); }
  20%, 68% { opacity: .9; }
  100% { opacity: 0; transform: translateY(-10px); }
}
@keyframes oven-display-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: .25; }
}
@keyframes bake-progress {
  0% { transform: scaleX(.04); }
  40% { transform: scaleX(.48); }
  72% { transform: scaleX(.78); }
  100% { transform: scaleX(.96); }
}
@keyframes sprinkle-pop {
  from { transform: translateY(0) rotate(0); }
  to { transform: translateY(-4px) rotate(90deg); }
}

@media (max-width: 520px) {
  .bake-wait { padding: 16px; }
  .bake-wait-card { padding: 24px 20px 22px; box-shadow: 6px 6px 0 #d39a65; }
  .pixel-oven { width: 205px; }
  .bake-pixel-sprinkles i:nth-child(3),
  .bake-pixel-sprinkles i:nth-child(4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .bake-wait,
  .bake-wait *,
  .bake-wait *::before,
  .bake-wait *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .loaf-dough,
  .loaf-golden { opacity: 0; }
  .loaf-toasted { opacity: 1; }
  .bake-progress span { transform: scaleX(.82); }
}
