:root {
  color-scheme: dark;
  --bg: #150e28;
  --panel: #24183b;
  --line: #43325c;
  --cream: #fff5e5;
  --muted: #c0afd7;
  --yellow: #ffda64;
  --pink: #f591e0;
  --ink: #21102d;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--cream);
  background: radial-gradient(ellipse at 80% 0%, #271546 0, transparent 55%), var(--bg);
  min-height: 100svh;
}
button {
  color: inherit;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 5px; }
button:disabled { opacity: .43; cursor: default; }
[hidden] { display: none !important; }
.topbar, .shell { width: min(1160px, calc(100% - 72px)); margin-inline: auto; }
.topbar {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; gap: 11px; align-items: center; font-weight: 800; letter-spacing: -.03em; }
.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--pink);
  border-radius: 11px;
  box-shadow: 0 3px 0 #9b459e;
  font-size: 19px;
}
.utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 5px 12px;
  background: #2b1b45;
  color: var(--cream);
  border: 1px solid #533e70;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 730;
  white-space: nowrap;
}
.utility:hover:not(:disabled) { background: #413064; }
#sound-icon { color: var(--pink); font-size: 16px; }
.shell { padding-block: 33px 34px; }
.game {
  display: grid;
  grid-template-columns: minmax(265px, 342px) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  grid-template-areas: "intro stage" "stats stage";
  gap: 20px 27px;
}
.intro { grid-area: intro; align-content: center; padding: 10px 3px 1px; }
h1 {
  margin: 0;
  letter-spacing: -.065em;
  font-size: clamp(75px, 7.1vw, 112px);
  line-height: .88;
  font-weight: 1000;
}
h1 em { color: var(--yellow); font-style: normal; }
.intro p {
  max-width: 285px;
  margin: 24px 0 0;
  color: #ded1ee;
  font-size: 16px;
  line-height: 1.5;
}
.game-stats { grid-area: stats; display: grid; gap: 10px; }
.scorecard, .combo {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 15px 17px;
}
.scorecard { display: grid; grid-template-columns: 1fr 1fr; }
.scorecard > div { min-width: 0; display: grid; gap: 3px; }
.scorecard > div + div { padding-left: 17px; border-left: 1px solid var(--line); }
.caption {
  display: inline-block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 850;
  letter-spacing: .14em;
}
.scorecard strong {
  font-size: clamp(23px, 3.2vw, 38px);
  line-height: 1.07;
  font-weight: 900;
  letter-spacing: -.07em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.record-star, .bolt { color: var(--yellow); }
.bolt { font-size: 16px; line-height: 0; }
.combo-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
#combo-count { font-size: 12px; font-weight: 850; color: var(--yellow); font-variant-numeric: tabular-nums; }
.meter { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; height: 7px; margin-top: 10px; }
.meter i { background: #49365f; border-radius: 4px; }
.meter i.on { background: var(--pink); }
.meter.active i.on { background: var(--yellow); box-shadow: 0 0 9px #ffda6480; }
.combo p { color: var(--muted); font-size: 11px; margin: 8px 0 0; }

.stage {
  grid-area: stage;
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 544px;
  border: 1px solid #9768d8;
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle, #fff3 1px, transparent 1.5px) 0 0 / 19px 19px,
    radial-gradient(ellipse at 50% 46%, #c58cf0 0, #8250c7 55%, #592fa1 100%);
  box-shadow: inset 0 0 70px #2d125775, 0 9px 0 #2b1a48;
}
.stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(68%, 445px);
  aspect-ratio: 1;
  top: 46%;
  left: 50%;
  translate: -50% -50%;
  border-radius: 50%;
  background: linear-gradient(140deg, #f2a9f4 5%, #ba6df1 57%, #b861df);
  opacity: .91;
  box-shadow: 0 0 60px #fdaefa6e, inset 0 0 0 1px #ffd3fc9a;
}
.stage::after {
  content: "";
  position: absolute;
  z-index: 2;
  pointer-events: none;
  inset: auto 0 0;
  height: 43%;
  background: linear-gradient(transparent, #341950c4 72%, #2f194be8);
}
.stage.golden {
  border-color: var(--yellow);
  background:
    radial-gradient(circle, #fff5 1px, transparent 1.5px) 0 0 / 19px 19px,
    radial-gradient(ellipse at 50% 46%, #fbd978 0, #a457ad 64%, #65368a 100%);
}
.stage.golden::before { background: linear-gradient(135deg, #fff3a4, #ec9a70); }
.stage-top { z-index: 5; position: absolute; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dispatch, .photo-switch { background: #2b184ad9; border: 1px solid #f2d5ff52; }
.dispatch {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 8px 11px;
  border-radius: 99px;
  color: #fff7ec;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 850;
  white-space: nowrap;
}
.dispatch i { width: 7px; height: 7px; border-radius: 50%; background: #a6f8c1; box-shadow: 0 0 8px #a6f8c180; }
.golden .dispatch i { background: var(--yellow); box-shadow: 0 0 8px var(--yellow); }
.photo-switch { min-height: 37px; }
#photo-number { color: #ebc9fc; font-variant-numeric: tabular-nums; }
.orbit {
  position: absolute;
  inset: 46% auto auto 50%;
  width: min(79%, 527px);
  aspect-ratio: 1;
  border: 1px dashed #f7d1fc8c;
  border-radius: 50%;
  translate: -50% -50%;
  pointer-events: none;
}
.orbit-two { width: min(89%, 595px); border: 1px solid #efc9ff47; }
.spark, .decoration { position: absolute; pointer-events: none; }
.spark { color: #ffe5af; font-size: clamp(18px, 3.5vw, 40px); line-height: 1; text-shadow: 0 0 22px #ffdf87b0; }
.spark-a { top: 22%; left: 23%; }
.spark-b { top: 21%; right: 18%; }
.spark-c { bottom: 30%; right: 12%; font-size: 25px; }
.spark-d { bottom: 31%; left: 14%; font-size: 24px; }
.decoration {
  font-size: clamp(35px, 5vw, 66px);
  filter: drop-shadow(0 8px 4px #46236e60);
  animation: float 4s ease-in-out infinite alternate;
  user-select: none;
}
.deco-flower { top: 38%; left: 7%; --tilt: -18deg; }
.deco-present { top: 35%; right: 6%; --tilt: 17deg; animation-delay: -1.6s; }
.deco-disco { bottom: 22%; left: 7%; --tilt: -10deg; animation-delay: -2.4s; }
.deco-cake { bottom: 23%; right: 15%; --tilt: 12deg; animation-delay: -1s; }
@keyframes float {
  from { transform: translateY(3px) rotate(var(--tilt)); }
  to { transform: translateY(-8px) rotate(calc(var(--tilt) + 8deg)); }
}
.portrait {
  position: absolute;
  z-index: 1;
  bottom: 11%;
  left: 50%;
  translate: -50% 0;
  width: min(69%, 452px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 40% 40% 20% 20%;
  user-select: none;
}
.portrait img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(2px -2px 0 #ffe7fa) drop-shadow(-2px 1px 0 #ffe7fa) drop-shadow(0 8px 20px #3d165693);
  pointer-events: none;
  mask-image: linear-gradient(#000 89%, transparent 100%);
}
#photo-one {
  mask-image: linear-gradient(transparent, #000 3% 87%, transparent), linear-gradient(90deg, transparent, #000 4% 95%, transparent);
  mask-composite: intersect;
}
.portrait:active img { transform: scale(.98); }
.stage-bottom {
  position: absolute;
  z-index: 4;
  bottom: 19px;
  left: 50%;
  translate: -50% 0;
  width: min(95%, 500px);
  display: grid;
  justify-items: center;
  gap: 9px;
  pointer-events: none;
}
.reaction {
  margin: 0;
  max-width: 95%;
  min-height: 29px;
  border: 1px solid #b398c86e;
  border-radius: 99px;
  padding: 5px 12px;
  background: #28163cde;
  color: #fff4e8;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}
.deliver {
  pointer-events: auto;
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  background: var(--yellow);
  color: var(--ink);
  padding: 8px 16px;
  border: 1px solid #ffeaac;
  border-radius: 13px;
  box-shadow: 0 5px 0 #9e5428, 0 8px 20px #28152db0;
  font-weight: 900;
  font-size: 15px;
  transition: background-color 120ms, translate 120ms, box-shadow 120ms;
}
.deliver:hover { background: #ffe48e; translate: 0 -2px; }
.deliver:active { translate: 0 3px; box-shadow: 0 2px 0 #9e5428; }
kbd { font: 700 9px system-ui; border-radius: 5px; color: #613f39; background: #efba53; padding: 4px 5px; }
.effects { position: absolute; z-index: 3; inset: 0; pointer-events: none; overflow: hidden; }
.flying, .confetti, .points { position: absolute; top: 0; left: 0; will-change: transform, opacity; }
.flying { font-size: clamp(29px, 5vw, 52px); filter: drop-shadow(0 3px 6px #30134d9e); line-height: 1; }
.confetti { width: 8px; height: 10px; border-radius: 2px; }
.points { color: var(--yellow); font-weight: 950; font-size: 24px; text-shadow: 1px 2px 0 #371c50, -1px 0 0 #371c50; white-space: nowrap; }

.album { margin-top: 27px; border-top: 1px solid var(--line); padding-top: 11px; }
.album-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.album h2 { margin: 0; font-size: 18px; letter-spacing: -.035em; }
#collection-count { margin-left: 6px; color: var(--pink); font-size: 13px; font-variant-numeric: tabular-nums; }
.reset { background: transparent; border-color: transparent; color: var(--muted); }
.gifts { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); list-style: none; padding: 0; gap: 7px; margin: 0; }
.gifts li {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  min-height: 72px;
  border: 1px dashed #523d70;
  background: #231735;
  border-radius: 11px;
  color: var(--muted);
  text-align: center;
  font-weight: 730;
  font-size: 10px;
}
.gifts li.unlocked { border-style: solid; border-color: #8b58ae; background: #3b2455; color: #fff2f0; }
.gift-icon { font-size: 25px; line-height: 1; }
.locked .gift-icon { display: grid; width: 25px; height: 25px; place-items: center; background: #39274e; border-radius: 8px; font-size: 15px; font-weight: 850; }

@media (max-width: 960px) {
  .topbar, .shell { width: calc(100% - 44px); }
  .game { grid-template-columns: minmax(227px, 31%) minmax(0, 1fr); gap: 18px; }
  .stage { min-height: 474px; }
  .portrait { width: min(76%, 407px); bottom: 15%; }
  h1 { font-size: clamp(69px, 9vw, 100px); }
}
@media (max-width: 680px) {
  .topbar, .shell { width: calc(100% - 28px); }
  .topbar { height: 57px; }
  .brand-icon { width: 28px; height: 28px; font-size: 16px; border-radius: 8px; }
  .brand { gap: 8px; font-size: 13px; }
  #sound { font-size: 11px; min-height: 34px; padding-inline: 8px; }
  .shell { padding-top: 14px; }
  .game { grid-template-columns: 1fr; grid-template-rows: auto; grid-template-areas: "intro" "stage" "stats"; gap: 13px; }
  .intro { padding: 2px 0 0; }
  h1 { font-size: clamp(45px, 10vw, 68px); line-height: .92; letter-spacing: -.06em; }
  h1 br { display: none; }
  h1 em::before { content: " "; white-space: pre; }
  .intro p { margin-top: 7px; max-width: 400px; font-size: 13px; line-height: 1.35; }
  .stage { min-height: clamp(332px, 99vw, 430px); border-radius: 16px; box-shadow: 0 5px 0 #2b1a48; }
  .stage-top { inset: 9px 9px auto; }
  .photo-switch { padding: 4px 8px; min-height: 33px; }
  .portrait { bottom: 12%; width: min(83%, 363px); }
  .stage-bottom { bottom: 12px; gap: 6px; }
  .reaction { min-height: 26px; padding: 4px 9px; font-size: 11px; }
  .deliver { min-height: 44px; padding: 6px 13px; font-size: 13px; }
  kbd { display: none; }
  .game-stats { gap: 6px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .scorecard, .combo { padding: 9px; border-radius: 11px; }
  .scorecard > div + div { padding-left: 7px; }
  .scorecard strong { font-size: 22px; }
  .caption { font-size: 8px; letter-spacing: .07em; }
  .combo p { display: none; }
  .meter { margin-top: 5px; height: 5px; gap: 3px; }
  #combo-count { font-size: 10px; }
  .album { margin-top: 14px; padding-top: 3px; }
  .album-head { margin-bottom: 5px; }
  .album h2 { font-size: 15px; }
  .gifts { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .gifts li { min-height: 58px; }
  .gift-icon { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
