:root {
  color-scheme: light;
  --paper: #f8f7ff;
  --ink: #28234a;
  --soft-ink: #574d72;
  --lavender: #dedfff;
  --line: #dcd6ef;
  --gold: #ffda78;
  --display: ui-rounded, "Arial Rounded MT Bold", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 16px/1.55 var(--display);
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #6742be; outline-offset: 4px; }
.top, main, footer { width: min(1180px, calc(100% - 80px)); margin: auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0; }
.back { text-decoration: none; font-size: .88rem; font-weight: 750; }
.back:hover, footer a:hover { text-decoration: underline; }
.locale-switch { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 24px; flex: none; }
.locale-switch button { border: 0; background: transparent; border-radius: 24px; min-height: 34px; padding: 4px 12px; font-size: .78rem; font-weight: 760; }
.locale-switch button[aria-pressed="true"] { color: white; background: var(--ink); }
.hero { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6.6fr); gap: clamp(25px, 5vw, 76px); align-items: center; padding: 13px 0 38px; }
.intro { padding: 12px 0; }
.series { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #c4b3e5; background: #eee5ff; border-radius: 24px; padding: 4px 12px 4px 5px; font-weight: 760; font-size: .78rem; margin: 0 0 20px; }
.series span:first-child { background: #6a50a5; color: white; border-radius: 100%; display: grid; place-items: center; width: 25px; height: 25px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(3rem, 5.65vw, 5.4rem); line-height: 1.01; letter-spacing: -.068em; font-weight: 900; }
h1 span { display: block; }
:lang(zh-CN) h1 { letter-spacing: -.04em; }
:lang(en) h1 { font-size: clamp(2.65rem, 5.25vw, 4.95rem); }
.tagline { font-size: clamp(1.14rem, 1.95vw, 1.48rem); font-weight: 850; margin: 20px 0 6px; }
.instructions { color: var(--soft-ink); max-width: 32ch; }
:lang(en) .instructions { max-width: 37ch; }
.intro-bottom { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; margin-top: 23px; font-size: .83rem; }
.intro-bottom a { font-weight: 800; text-underline-offset: 4px; }
.intro-bottom > span { color: #423471; background: #ede8fb; border-radius: 20px; padding: 4px 10px; }
.machine {
  isolation: isolate; position: relative; display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 420px; padding: 22px 24px 14px; overflow: hidden; background: var(--lavender);
  border: 1px solid #c8c1e8; border-radius: 30px 30px 26px 26px; box-shadow: 0 6px 0 #e2d9f1;
}
.sky { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.stage-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stage-top h2 { font-weight: 850; font-size: 1.13rem; }
.stage-top span { background: #f8f5ff; color: #544878; border-radius: 18px; padding: 4px 11px; font-size: .75rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; justify-items: center; width: min(100%, 488px); margin: auto; padding: 12px 0 9px; }
.box { background: transparent; padding: 0; border: 0; width: min(100%, 156px); display: grid; justify-items: center; border-radius: 14px; }
.box img { width: 100%; display: block; transform: scale(.88) rotate(var(--tilt)); transition: transform .23s ease; }
.box-pink { --tilt: -8deg; }
.box-pink img { filter: hue-rotate(65deg) saturate(.85); }
.box-blue { --tilt: -2deg; }
.box-mint { --tilt: 8deg; }
.box-mint img { filter: hue-rotate(-105deg) saturate(.66); }
.box[aria-pressed="true"] img { transform: translateY(-8px) scale(1.09) rotate(0deg); }
.box span { display: grid; place-items: center; width: 33px; height: 25px; margin-top: 2px; border: 1px solid transparent; border-radius: 20px; font-weight: 850; font-size: .72rem; }
.box[aria-pressed="true"] span { background: #fff7df; border-color: #8870b5; }
@media (hover: hover) { .box[aria-pressed="false"]:hover img { transform: translateY(-4px) scale(.95) rotate(var(--tilt)); } }
.stage-bottom { text-align: center; }
.primary { background: var(--gold); box-shadow: 0 4px 0 #775179; border: 1.5px solid #54406b; border-radius: 28px; min-height: 47px; min-width: min(232px, 100%); padding: 9px 20px; font-weight: 900; }
.primary span { padding-left: 9px; }
.primary:hover { background: #ffe596; }
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #775179; }
.stage-bottom p { font-size: .75rem; color: #3f345e; margin-top: 11px; }
.reveal { display: grid; grid-template-columns: minmax(0, 235px) minmax(0, 230px); justify-content: center; align-items: center; gap: 10px; padding: 5px 0; }
.revealed-art { position: relative; display: grid; place-items: center; }
.revealed-art::before { content: ""; position: absolute; width: 83%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff 0 35%, #fff5cc 63%, #fff5cc00 72%); opacity: .93; }
.revealed-art img { position: relative; display: block; width: 100%; }
.badge { display: inline-block; background: #fbf2ff; border: 1px solid #b498d7; color: #513574; border-radius: 18px; padding: 3px 10px; font-size: .75rem; font-weight: 850; }
.revealed-copy h3 { font-size: clamp(1.45rem, 3.3vw, 2.48rem); line-height: 1.07; font-weight: 900; margin: 9px 0; }
.revealed-copy p { color: #4a4069; max-width: 24ch; font-size: .88rem; }
.machine.revealed .revealed-art img { animation: pop .52s cubic-bezier(.2,.7,.3,1.25) both; }
.machine.revealed .revealed-copy { animation: appear .35s .10s ease both; }
.machine.unsealing .box[aria-pressed="true"] img { animation: shake .32s ease both; }
@keyframes shake {
  0%, 100% { transform: translateY(-8px) scale(1.09) rotate(0deg); }
  25% { transform: translateY(-12px) scale(1.09) rotate(-10deg); }
  70% { transform: translateY(-17px) scale(1.09) rotate(9deg); }
}
@keyframes pop { from { transform: translateY(18px) rotate(-13deg) scale(.37); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes appear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.collection { padding: 21px 0 24px; border-top: 1px solid var(--line); scroll-margin-top: 16px; }
.collection-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.collection-header h2 { font-size: clamp(1.45rem, 3.5vw, 2rem); line-height: 1.18; font-weight: 900; letter-spacing: -.035em; }
.collection-header p { color: var(--soft-ink); margin-top: 6px; font-size: .88rem; }
.meter { display: flex; align-items: center; gap: 7px; padding: 5px 12px; border: 1px solid #d2c5ec; background: #eee7ff; border-radius: 22px; white-space: nowrap; color: #4b3874; font-size: .75rem; }
.meter strong { font-size: .94rem; font-variant-numeric: tabular-nums; }
.shelf { padding: 0; margin: 0; list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.sticker { --wash: #ffedb8; position: relative; min-width: 0; display: grid; grid-template-rows: auto 1fr auto; align-items: start; text-align: center; padding: 6px 5px 10px; background: var(--wash); border: 1px solid #6c4d852b; border-radius: 13px 13px 17px 17px; }
.sticker:nth-child(2) { --wash: #ece3fe; }
.sticker:nth-child(3) { --wash: #dcefff; }
.sticker:nth-child(4) { --wash: #d9f4e7; }
.sticker:nth-child(5) { --wash: #ffe4ed; }
.sticker:nth-child(6) { --wash: #e6edff; }
.sticker:nth-child(7) { --wash: #e8dcfb; }
.sticker small { justify-self: start; border-radius: 12px; background: #fff9; padding: 2px 7px; color: #534368; font-weight: 850; font-size: .69rem; }
.sticker img { display: block; width: min(100%, 144px); margin: auto; }
.sticker strong { font-size: .87rem; line-height: 1.25; font-weight: 850; }
.sticker em { display: block; color: #554766; font-size: .67rem; font-style: normal; margin-top: 3px; }
.sticker.unowned img:not(.mystery) { opacity: .67; }
.swap { margin-top: 16px; padding: 10px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px dashed #bfb0de; border-radius: 15px; }
.swap p { font-size: .82rem; color: var(--soft-ink); }
.swap #stamp-count, .swap #swap-status { color: var(--ink); font-weight: 850; }
.swap button { flex: none; min-height: 42px; padding: 6px 14px; background: #eae0ff; border: 1px solid #b39cdb; border-radius: 22px; font-size: .82rem; font-weight: 850; }
.swap button:disabled { background: #f3effb; color: #615671; border-color: var(--line); }
details, .save-warning { margin-top: 14px; color: var(--soft-ink); font-size: .81rem; }
details summary { cursor: pointer; min-height: 32px; width: fit-content; }
details p { max-width: 72ch; }
footer { padding: 12px 0 26px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); font-size: .76rem; color: var(--soft-ink); }
footer a { text-underline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 950px) {
  .top, main, footer { width: calc(100% - 48px); }
  .machine { min-height: 362px; }
  .hero { gap: 22px; }
}
@media (max-width: 720px) {
  .top, main, footer { width: calc(100% - 32px); }
  .top { padding: 13px 0; }
  .hero { display: block; padding: 5px 0 29px; }
  .intro { padding: 4px 0 19px; }
  .series { margin-bottom: 10px; }
  h1 { font-size: clamp(2.15rem, 9.5vw, 3.8rem); }
  :lang(zh-CN) h1 span { display: inline; }
  :lang(en) h1 { font-size: clamp(2.15rem, 8.7vw, 3.7rem); }
  .tagline { margin: 9px 0 3px; }
  .instructions { max-width: 42ch; font-size: .9rem; }
  .intro-bottom { margin-top: 10px; }
  .machine { min-height: 310px; padding: 13px 12px 12px; border-radius: 22px; }
  .boxes { width: min(100%, 402px); }
  .box { max-width: 118px; }
  .reveal { grid-template-columns: minmax(0, 170px) minmax(0, 190px); }
  .revealed-copy p { font-size: .78rem; }
  .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .sticker strong { font-size: .76rem; }
  .sticker em { font-size: .64rem; }
}
@media (max-width: 370px) {
  .shelf { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .back { font-size: .74rem; }
  .locale-switch button { padding-inline: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
.box { position: relative; }
.box-blue img { filter: hue-rotate(-21deg); }
.sticker img { height: auto; }
.machine.unsealing .box[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  width: 21%;
  height: 17%;
  left: 36%;
  top: 16%;
  border: 1px solid #776396;
  background: #fff6cf;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 82% 100%, 54% 81%, 30% 100%, 0 80%);
  animation: tear .32s ease-in both;
}
@keyframes tear {
  from { opacity: 1; transform: translateY(0) rotate(-8deg); }
  to { opacity: 0; transform: translate(35px,-48px) rotate(42deg); }
}
@media (prefers-reduced-motion: reduce) {
  .machine.unsealing .box[aria-pressed="true"]::after { display: none; }
}
