.stage {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  align-self: center;
  isolation: isolate;
  background: #fcf6ed;
}
.take {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  translate: var(--match-x, 0%) var(--match-y, 0%);
  transition: opacity 65ms linear, translate 175ms ease-out;
  object-fit: contain;
}
.take.underlay { z-index: 1; opacity: 1; }
.take.visible { z-index: 2; opacity: 1; }
.take.snap { transition: none; }
.bubble, .pop { position: absolute; z-index: 3; pointer-events: none; }
.bubble {
  width: 6%;
  aspect-ratio: 1.22;
  border: 1.5px solid #8eb6c5;
  border-radius: 48% 58% 54% 47%;
  background: radial-gradient(ellipse at 31% 26%, #fffdf1 0 9%, transparent 21%), linear-gradient(135deg, #f5fdffcf, #b9dce496);
  transform-origin: left center;
  translate: 0 -48%;
  opacity: 0;
}
.stage[data-state="sleep"] .bubble { opacity: 1; }
.pop i {
  position: absolute;
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a4cbd7;
  opacity: 0;
}
.pop.popping i { animation: scatter 190ms ease-out both; }
.pop.popping i:nth-child(1) { --x: 17px; --y: -14px; }
.pop.popping i:nth-child(2) { --x: 27px; --y: 1px; }
.pop.popping i:nth-child(3) { --x: 14px; --y: 12px; }
@keyframes scatter {
  from { opacity: .9; transform: scale(.7); }
  to { opacity: 0; transform: translate(var(--x), var(--y)) scale(.4); }
}

:root {
  color-scheme: light;
  font: 16px/1.5 "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  color: #43282c;
  background: #f6eee4;
}
* { box-sizing: border-box; }
body { margin: 0; padding: 0 20px; }
[hidden] { display: none !important; }
.page { width: min(100%, 680px); margin: auto; padding-bottom: 2rem; }
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 14px; border-bottom: 1px solid #e4cfbc;
}
.brand { color: #743951; text-decoration: none; font-weight: 750; }
#shop { margin: 0; font-size: .91rem; }
.welcome {
  text-align: center; padding: clamp(45px, 9vw, 82px) 24px;
  margin-top: 28px; background: #fff9ef; border: 1px solid #e4cfbc; border-radius: 24px;
}
.seal {
  display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  background: #743951; color: #fff9ef; font: 600 1.45rem "Songti TC", serif;
}
h1 { margin: .5rem 0 .25rem; font: 700 clamp(2.3rem, 7vw, 3.7rem)/1.2 "Songti TC", serif; }
.welcome > p { margin: .7rem 0 1.45rem; }
.welcome > .disclosure { margin: 1rem 0 0; font-size: .85rem; color: #775659; }
button {
  min-height: 46px; padding: 0 20px; border: 1px solid #cfae9e; border-radius: 11px;
  color: #683849; background: #fff8f0; font: inherit; font-weight: 700; cursor: pointer;
}
button:disabled { opacity: .65; cursor: default; }
button:focus-visible, a:focus-visible { outline: 3px solid #a35271; outline-offset: 3px; }
.primary { background: #743951; color: #fff8f0; border-color: #743951; }
#connection, #error { text-align: center; margin: 1rem 0; }
#connection:empty, #error:empty { margin: 0; }
#error { color: #922d3f; }
#active { margin-top: 20px; opacity: 0; transition: opacity 400ms ease; }
#active.entered { opacity: 1; }
@starting-style { #active.entered { opacity: 0; } }
.stage { width: min(100%, 390px); margin: 0 auto; border-radius: 20px; border: 1px solid #e4cfbc; }
.cart { margin-top: 16px; background: #fff9ef; border: 1px solid #e4cfbc; border-radius: 20px; padding: 18px; }
.cart h2 { margin: 0 0 .45rem; font-size: 1.06rem; }
.cart p { margin: 0 0 .65rem; color: #775659; }
#items { padding: 0; margin: 0; list-style: none; }
#items li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px;
  padding: .65rem 0; border-bottom: 1px solid #eddccd;
}
#items li > strong { grid-column: 1; }
#items li > span:not(.unit-price) { grid-column: 1; color: #775659; font-size: .87rem; }
.unit-price { grid-column: 2; grid-row: 1 / 3; align-self: center; text-align: end; font-weight: 650; }
.unit-price small { display: block; color: #775659; font-weight: 400; }
.cart-footer { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-top: 15px; }
.total { margin-left: auto; background: #743951; color: #fff8ef; border-radius: 13px; padding: 9px 16px; text-align: right; }
.total span { display: block; font-size: .8rem; }
.total output { display: block; font-size: 1.2rem; font-weight: 750; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  #active, .take { transition: none; }
  .pop.popping i { animation: none; }
}
