:root {
  color-scheme: light;
  --sky-1: #7dd8ce;
  --sky-2: #4bb8c8;
  --sky-3: #255f7c;
  --button-blue: #62bde8;
  --button-blue-deep: #3d9fd0;
  --button-mint: #7bdcc8;
  --button-mint-deep: #42bfa8;
  --button-pink: #ffa6b2;
  --soft-shadow: 0 7px 18px rgba(70, 147, 177, 0.22);
  --ink: #20303c;
  --gold: #ffe06f;
  --coral: #ff6f61;
  --cream: #fffaf0;
  --bubble: rgba(216, 250, 255, 0.5);
  --rank-color: #6fcfe0;
  --bubble-scale: 1;
  --stage-pad-x: 24px;
  --stage-pad-y: 28px;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #fff;
  font-family:
    "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, system-ui,
    sans-serif;
  background: var(--sky-2);
}

img {
  max-width: 100%;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.gacha-app {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 224, 111, 0.45), transparent 24%),
    radial-gradient(circle at 82% 14%, rgba(255, 111, 97, 0.28), transparent 22%),
    radial-gradient(circle at 50% 56%, rgba(255, 255, 255, 0.2), transparent 28%),
    linear-gradient(155deg, var(--sky-1), var(--sky-3));
}

.gacha-stage {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  place-items: center;
  padding: var(--stage-pad-y) var(--stage-pad-x) 36px;
  isolation: isolate;
}

.burst {
  position: absolute;
  inset: -20vh -15vw;
  z-index: -2;
  background: conic-gradient(
    from -8deg at 50% 48%,
    rgba(255, 255, 255, 0.18) 0 8deg,
    transparent 8deg 22deg,
    rgba(255, 224, 111, 0.14) 22deg 30deg,
    transparent 30deg 50deg,
    rgba(255, 111, 97, 0.1) 50deg 56deg,
    transparent 56deg 78deg
  );
  opacity: 0.8;
}

.stage-header {
  position: relative;
  z-index: 4;
  justify-self: start;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.kicker {
  margin: 0 0 4px;
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.1rem, 4vw, 4.4rem);
  line-height: 1;
}

.bubble-layer,
.gold-burst-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.gold-burst-layer {
  z-index: 5;
}

.prize-bubble {
  --size: 120px;
  --x: 50%;
  --y: 50%;
  --delay: 0s;
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: calc(var(--size) * var(--bubble-scale));
  height: calc(var(--size) * var(--bubble-scale));
  display: grid;
  place-items: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: floatBubble 4.4s ease-in-out infinite;
  animation-delay: var(--delay);
  transition:
    left 900ms cubic-bezier(0.2, 0.88, 0.18, 1),
    top 900ms cubic-bezier(0.2, 0.88, 0.18, 1),
    width 900ms ease,
    height 900ms ease,
    opacity 500ms ease,
    transform 900ms ease;
}

.prize-bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.9), transparent 15%),
    radial-gradient(circle at 68% 74%, rgba(255, 255, 255, 0.36), transparent 26%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.48), var(--bubble));
  border: 2px solid rgba(255, 255, 255, 0.52);
  box-shadow:
    inset 11px 10px 24px rgba(255, 255, 255, 0.62),
    inset -12px -16px 28px rgba(55, 130, 210, 0.28),
    0 8px 24px rgba(0, 24, 76, 0.24);
}

.prize-bubble img {
  position: relative;
  z-index: 1;
  display: block;
  width: 72%;
  height: 72%;
  object-fit: contain;
  filter: drop-shadow(0 8px 6px rgba(0, 30, 80, 0.26));
}

.bubble-fallback {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 58%;
  aspect-ratio: 1;
  border-radius: 16px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  background: var(--rank-color);
  color: #fff;
  font-size: 1.7rem;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.gacha-app.is-gathering .prize-bubble,
.gacha-app.is-a-freeze .prize-bubble,
.gacha-app.is-a-overload .prize-bubble {
  left: 50%;
  top: 48%;
  width: 54px;
  height: 54px;
  opacity: 0.82;
  transform: translate(-50%, -50%) rotate(1turn);
}

.gacha-app.is-a-burst .prize-bubble {
  left: 50%;
  top: 48%;
  width: 14px;
  height: 14px;
  opacity: 0;
  transform: translate(-50%, -50%) scale(2.6) rotate(1.5turn);
}

.gacha-app.is-puzzle .prize-bubble,
.gacha-app.is-a-puzzle .prize-bubble,
.gacha-app.is-opening .prize-bubble,
.gacha-app.is-a-opening .prize-bubble,
.gacha-app.is-revealed .prize-bubble,
.gacha-app.is-a-revealed .prize-bubble {
  opacity: 0.16;
}

.legend-flash {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  color: #fff7a8;
  padding: 0 18px;
  font-size: clamp(3.8rem, 14vw, 14rem);
  font-weight: 900;
  text-shadow:
    0 0 16px #fff,
    0 0 28px var(--gold),
    0 8px 0 rgba(0, 0, 0, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: scale(0.7);
}

.gacha-app.is-a-freeze .legend-flash {
  animation: legendFlash 0.72s ease-out forwards;
}

.gold-particle {
  --angle: 0deg;
  --distance: 180px;
  position: absolute;
  left: 50%;
  top: 48%;
  width: 12px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(#fff7c2, var(--gold));
  box-shadow: 0 0 16px rgba(255, 224, 111, 0.9);
  transform: translate(-50%, -50%) rotate(var(--angle));
  animation: goldBurst 900ms ease-out forwards;
}

.machine-wrap {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(50vw, 460px);
  min-width: 300px;
  aspect-ratio: 1 / 1.06;
  margin-top: 12px;
}

.machine-image {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-image: var(--machine-image);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.machine-image.has-custom-machine .machine-fallback {
  display: none;
}

.gacha-app.is-a-freeze .machine-image,
.gacha-app.is-a-overload .machine-image {
  filter:
    saturate(1.45)
    brightness(1.18)
    drop-shadow(0 0 22px rgba(255, 224, 111, 0.82))
    drop-shadow(0 0 48px rgba(255, 111, 97, 0.36));
}

.machine-fallback {
  position: relative;
  width: 100%;
  height: 100%;
}

.machine-dome {
  position: absolute;
  left: 7%;
  top: 1%;
  width: 86%;
  height: 62%;
  border: 4px solid #111;
  border-radius: 50% 50% 44% 44%;
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.82), transparent 18%),
    linear-gradient(105deg, rgba(255, 255, 255, 0.22), transparent 48%),
    rgba(112, 194, 255, 0.68);
  overflow: hidden;
}

.gacha-app.is-a-freeze .machine-dome,
.gacha-app.is-a-overload .machine-dome {
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.95), transparent 18%),
    radial-gradient(circle at 50% 50%, rgba(255, 242, 176, 0.95), transparent 44%),
    rgba(255, 224, 111, 0.74);
  box-shadow: 0 0 48px rgba(255, 224, 111, 0.92);
}

.gacha-app.is-a-overload .machine-wrap {
  animation: overloadShake 0.12s linear infinite;
}

.mini-capsules {
  position: absolute;
  left: 16%;
  right: 16%;
  bottom: 8%;
  display: flex;
  gap: 8px;
  align-items: end;
  justify-content: center;
}

.mini-capsules span {
  width: 46px;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.76);
  background: linear-gradient(145deg, #fff, #6fcfe0 45%, #fff 48%, #ff8a78 52%);
  opacity: 0.86;
}

.gacha-app.is-gathering .mini-capsules span,
.gacha-app.is-a-freeze .mini-capsules span,
.gacha-app.is-a-overload .mini-capsules span {
  animation: capsuleRattle 0.56s ease-in-out;
}

.gacha-app.is-gathering .mini-capsules span:nth-child(3),
.gacha-app.is-a-freeze .mini-capsules span:nth-child(3),
.gacha-app.is-a-overload .mini-capsules span:nth-child(3) {
  animation: capsuleDrop 1.05s cubic-bezier(0.28, 0.9, 0.34, 1) forwards;
}

.gacha-app.is-gathering .mini-capsules span:nth-child(2),
.gacha-app.is-a-freeze .mini-capsules span:nth-child(2),
.gacha-app.is-a-overload .mini-capsules span:nth-child(2) {
  animation-delay: 80ms;
}

.gacha-app.is-gathering .mini-capsules span:nth-child(4),
.gacha-app.is-a-freeze .mini-capsules span:nth-child(4),
.gacha-app.is-a-overload .mini-capsules span:nth-child(4) {
  animation-delay: 120ms;
}

.machine-neck {
  position: absolute;
  left: 36%;
  top: 58%;
  width: 28%;
  height: 23%;
  background: #0d4fb8;
  border-left: 4px solid #111;
  border-right: 4px solid #111;
}

.machine-base {
  position: absolute;
  left: 27%;
  bottom: 4%;
  width: 46%;
  height: 28%;
  border: 4px solid #111;
  border-radius: 18px 18px 10px 10px;
  background: linear-gradient(180deg, #2aa7b8, #255f7c);
}

.gacha-app.is-a-overload .machine-base,
.gacha-app.is-a-freeze .machine-base {
  background: linear-gradient(180deg, var(--gold), #ff9f5f);
}

.knob {
  position: absolute;
  left: 50%;
  top: 16%;
  width: 30%;
  aspect-ratio: 1;
  border: 6px solid #111;
  border-radius: 50%;
  background:
    linear-gradient(#fff 0 38%, #777 38% 50%, #fff 50%);
  transform: translateX(-50%);
}

.gacha-app.is-gathering .knob,
.gacha-app.is-puzzle .knob {
  animation: knobTurn 0.72s cubic-bezier(0.2, 0.9, 0.16, 1);
}

.gacha-app.is-a-overload .knob {
  animation: knobTurn 0.36s linear infinite;
}

.drop-hole {
  position: absolute;
  left: 50%;
  bottom: -4px;
  width: 32%;
  height: 38%;
  border: 4px solid #111;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  background: #07070a;
  transform: translateX(-50%);
}

.capsule-prize {
  position: absolute;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 130px;
  height: 150px;
  transform: translate(-50%, -50%) scale(0);
  filter: drop-shadow(0 18px 18px rgba(0, 20, 70, 0.32));
  opacity: 0;
  pointer-events: none;
}

.gacha-app.is-puzzle .capsule-prize,
.gacha-app.is-a-puzzle .capsule-prize,
.gacha-app.is-opening .capsule-prize,
.gacha-app.is-a-opening .capsule-prize {
  animation: capsulePop 0.8s cubic-bezier(0.18, 1.22, 0.24, 1) forwards;
}

.gacha-app.is-a-puzzle .capsule-prize,
.gacha-app.is-a-opening .capsule-prize {
  filter: drop-shadow(0 0 22px rgba(255, 216, 23, 0.95)) drop-shadow(0 18px 18px rgba(0, 20, 70, 0.32));
}

.gacha-app.is-opening .capsule-prize,
.gacha-app.is-a-opening .capsule-prize {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.gacha-app.is-opening .capsule-prize::after,
.gacha-app.is-a-opening .capsule-prize::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  box-shadow:
    0 0 0 12px color-mix(in srgb, var(--rank-color) 36%, transparent),
    0 0 42px color-mix(in srgb, var(--rank-color) 72%, transparent);
  transform: translate(-50%, -50%) scale(0.2);
  animation: capsuleLightPop 0.62s ease-out forwards;
  z-index: 1;
}

.gacha-app.is-revealed .capsule-prize,
.gacha-app.is-a-revealed .capsule-prize {
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
}

.capsule-top,
.capsule-bottom {
  position: absolute;
  left: 10%;
  width: 80%;
  height: 48%;
  border: 4px solid #111;
  background: #fff;
}

.capsule-top {
  top: 4%;
  border-radius: 70px 70px 18px 18px;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.9), transparent 18%),
    var(--rank-color);
}

.gacha-app.is-a-puzzle .capsule-top {
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.95), transparent 18%),
    conic-gradient(var(--gold), #ff8a78, #a7b7ff, #6fcfe0, #7bdc9a, var(--gold));
}

.gacha-app.is-opening .capsule-top,
.gacha-app.is-a-opening .capsule-top {
  animation: capsuleTopOpen 0.68s cubic-bezier(0.2, 0.92, 0.24, 1) forwards;
}

.gacha-app.is-a-opening .capsule-top {
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.95), transparent 18%),
    conic-gradient(var(--gold), #ff8a78, #a7b7ff, #6fcfe0, #7bdc9a, var(--gold));
}

.capsule-bottom {
  bottom: 4%;
  border-radius: 18px 18px 70px 70px;
}

.gacha-app.is-opening .capsule-bottom,
.gacha-app.is-a-opening .capsule-bottom {
  animation: capsuleBottomOpen 0.68s cubic-bezier(0.2, 0.92, 0.24, 1) forwards;
}

.capsule-band {
  position: absolute;
  left: 6%;
  top: 45%;
  width: 88%;
  height: 16%;
  border: 4px solid #111;
  border-radius: 999px;
  background: var(--gold);
  z-index: 2;
}

.gacha-app.is-opening .capsule-band,
.gacha-app.is-a-opening .capsule-band {
  animation: capsuleBandBreak 0.54s ease-out forwards;
}

.result-prize {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 50%;
  width: min(360px, calc(100vw - 40px));
  max-height: calc(100svh - 150px);
  overflow: auto;
  padding: 18px;
  border: 3px solid #111;
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 18px 0 rgba(0, 0, 0, 0.18), 0 24px 45px rgba(0, 20, 80, 0.38);
  text-align: center;
  transform: translate(-50%, -38%) scale(0.72);
  opacity: 0;
  pointer-events: none;
}

.gacha-app.is-revealed .result-prize,
.gacha-app.is-a-revealed .result-prize {
  animation: prizeReveal 0.72s cubic-bezier(0.18, 1.28, 0.24, 1) forwards;
  pointer-events: auto;
}

.gacha-app.is-a-revealed .result-prize {
  background:
    linear-gradient(var(--cream), var(--cream)) padding-box,
    linear-gradient(135deg, #fff7c2, var(--gold), #ff8a78) border-box;
  border: 5px solid transparent;
  box-shadow:
    0 18px 0 rgba(0, 0, 0, 0.18),
    0 0 42px rgba(255, 224, 111, 0.82),
    0 24px 45px rgba(0, 20, 80, 0.38);
}

.result-image-wrap {
  display: grid;
  place-items: center;
  width: 176px;
  height: 176px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.9), transparent 15%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.66), rgba(166, 226, 255, 0.42));
  border: 2px solid rgba(80, 150, 220, 0.46);
}

.gacha-app.is-a-revealed .result-image-wrap {
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.96), transparent 15%),
    radial-gradient(circle, rgba(255, 224, 111, 0.62), rgba(255, 255, 255, 0.4));
  border-color: var(--gold);
}

.result-image-wrap img {
  max-width: 78%;
  max-height: 78%;
  object-fit: contain;
}

.result-rank {
  display: inline-grid;
  place-items: center;
  min-width: 78px;
  min-height: 34px;
  margin: 0 0 8px;
  border: 3px solid #111;
  border-radius: 999px;
  background: var(--rank-color);
  color: #111;
  font-weight: 900;
}

.result-prize h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.result-prize p {
  line-height: 1.6;
}

.puzzle-panel {
  position: absolute;
  z-index: 7;
  left: 50%;
  bottom: 116px;
  width: min(520px, calc(100vw - 34px));
  max-height: calc(100svh - 142px);
  overflow: auto;
  padding: 18px;
  border: 3px solid #111;
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.2), 0 22px 40px rgba(0, 20, 80, 0.35);
  transform: translateX(-50%);
}

.gacha-app.is-a-puzzle .puzzle-panel {
  box-shadow: 0 14px 0 rgba(0, 0, 0, 0.2), 0 0 30px rgba(255, 216, 23, 0.78);
}

.panel-label {
  margin: 0 0 6px;
  color: #2a7f89;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gacha-app.is-a-puzzle .panel-label {
  color: #b46f1b;
}

.puzzle-panel h2 {
  margin: 0 0 8px;
}

.puzzle-panel p {
  margin-top: 0;
}

.puzzle-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.puzzle-card {
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 3px solid #111;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 900;
  touch-action: manipulation;
  box-shadow: 0 5px 12px rgba(32, 83, 92, 0.14);
  transition:
    transform 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

.puzzle-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 8px rgba(32, 83, 92, 0.12);
}

.puzzle-card.is-correct {
  background: #c9ffd9;
  border-color: #087a42;
}

.puzzle-card.is-wrong {
  background: #ffd5d5;
  border-color: #a00000;
  animation: answerShake 0.28s linear;
}

.puzzle-card:disabled {
  cursor: default;
  opacity: 0.9;
}

.answer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.small-button,
.hint-button,
.plain-button {
  min-height: 46px;
  border: 3px solid #111;
  border-radius: 8px;
  padding: 0 14px;
  color: #111;
  background: #fff;
  font-weight: 900;
}

.small-button {
  background: var(--gold);
}

.answer-message {
  margin: 10px 0 0;
  color: #555;
  font-weight: 800;
}

.answer-message.is-correct {
  color: #087a42;
}

.answer-message.is-wrong {
  color: #a00000;
}

.action-bar {
  position: relative;
  z-index: 8;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.gacha-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: min(320px, calc(100vw - 44px));
  min-height: 78px;
  padding: 0 28px;
  border: 3px solid #fff3b0;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--button-blue), var(--button-blue-deep));
  color: #fff;
  box-shadow: var(--soft-shadow);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 900;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.gacha-button span {
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 13px solid #fff;
}

.gacha-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.gacha-app.is-puzzle .gacha-button,
.gacha-app.is-a-puzzle .gacha-button {
  display: none !important;
}

.plain-button {
  background: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes floatBubble {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -18px;
  }
}

@keyframes knobTurn {
  to {
    transform: translateX(-50%) rotate(1turn);
  }
}

@keyframes capsuleRattle {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(-4px, -8px) rotate(-12deg);
  }
  55% {
    transform: translate(4px, 3px) rotate(10deg);
  }
  78% {
    transform: translate(-2px, -4px) rotate(-6deg);
  }
}

@keyframes capsuleDrop {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 0.9;
  }
  24% {
    transform: translate(0, -16px) rotate(-18deg) scale(1.05);
  }
  62% {
    transform: translate(0, 116px) rotate(210deg) scale(0.92);
    opacity: 0.9;
  }
  100% {
    transform: translate(0, 172px) rotate(360deg) scale(0.58);
    opacity: 0;
  }
}

@keyframes capsulePop {
  0% {
    opacity: 0;
    transform: translate(-50%, -26%) scale(0.2) rotate(-18deg);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12) rotate(10deg);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

@keyframes capsuleTopOpen {
  to {
    transform: translate(-22px, -52px) rotate(-28deg);
    opacity: 0.92;
  }
}

@keyframes capsuleBottomOpen {
  to {
    transform: translate(24px, 46px) rotate(24deg);
    opacity: 0.92;
  }
}

@keyframes capsuleBandBreak {
  45% {
    transform: scaleX(1.16);
    opacity: 1;
  }
  100% {
    transform: scaleX(0.28) translateY(20px);
    opacity: 0;
  }
}

@keyframes capsuleLightPop {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(4.2);
  }
}

@keyframes answerShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  75% {
    transform: translateX(5px);
  }
}

@keyframes prizeReveal {
  to {
    opacity: 1;
    transform: translate(-50%, -52%) scale(1);
  }
}

@keyframes legendFlash {
  0% {
    opacity: 0;
    transform: scale(0.55);
  }
  28% {
    opacity: 1;
    transform: scale(1.04);
  }
  72% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@keyframes legendPreviewPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55) rotate(-8deg);
  }
  26% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.14) rotate(2deg);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(-3deg);
  }
  100% {
    opacity: 0.58;
    transform: translate(-50%, -50%) scale(0.9) rotate(-3deg);
  }
}

@keyframes previewBubbleGather {
  72% {
    left: 50%;
    top: 48%;
    width: 24px;
    height: 24px;
    opacity: 0.84;
    transform: translate(-50%, -50%) rotate(1turn);
  }
  100% {
    left: 50%;
    top: 48%;
    width: 8px;
    height: 8px;
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.2) rotate(1.5turn);
  }
}

@keyframes previewMachineGlow {
  0%,
  100% {
    filter: none;
    transform: translateX(-50%);
  }
  45% {
    filter: drop-shadow(0 0 22px rgba(255, 224, 111, 0.9));
    transform: translateX(-50%) rotate(-1.2deg) scale(1.04);
  }
  62% {
    transform: translateX(-50%) rotate(1.2deg) scale(1.04);
  }
}

@keyframes previewMachineRattle {
  0%,
  100% {
    transform: translateX(-50%) rotate(0deg);
  }
  25% {
    transform: translateX(calc(-50% - 4px)) rotate(-1.6deg);
  }
  50% {
    transform: translateX(calc(-50% + 3px)) rotate(1.2deg);
  }
  75% {
    transform: translateX(calc(-50% + 4px)) rotate(-0.8deg);
  }
}

@keyframes previewGoldBurst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(0);
  }
  24% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--angle)) translateX(116px) rotate(1turn);
  }
}

@keyframes overloadShake {
  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(-4px, 2px) rotate(-0.9deg);
  }
  50% {
    transform: translate(3px, -3px) rotate(0.8deg);
  }
  75% {
    transform: translate(4px, 2px) rotate(-0.5deg);
  }
}

@keyframes goldBurst {
  to {
    opacity: 0;
    transform:
      translate(-50%, -50%)
      rotate(var(--angle))
      translateX(var(--distance))
      rotate(1.25turn);
  }
}

@media (max-width: 760px) {
  :root {
    --bubble-scale: 0.62;
    --stage-pad-x: 14px;
    --stage-pad-y: 18px;
  }

  .gacha-stage {
    grid-template-rows: auto minmax(330px, 1fr) auto;
    padding-bottom: 22px;
  }

  .stage-header {
    justify-self: stretch;
  }

  .kicker {
    font-size: 0.76rem;
  }

  h1 {
    font-size: clamp(1.8rem, 9vw, 3rem);
  }

  .machine-wrap {
    width: min(86vw, 390px);
    min-width: 0;
    margin-top: -20px;
  }

  .legend-flash {
    font-size: clamp(2.6rem, 14vw, 6rem);
    line-height: 1.05;
    text-align: center;
  }

  .puzzle-panel {
    bottom: max(112px, env(safe-area-inset-bottom));
    max-height: calc(100svh - 176px);
    padding: 14px;
  }

  .gacha-app.is-puzzle .action-bar,
  .gacha-app.is-a-puzzle .action-bar {
    margin-top: 18px;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .gacha-app.is-puzzle .gacha-button,
  .gacha-app.is-a-puzzle .gacha-button {
    display: none;
  }

  .answer-row {
    grid-template-columns: 1fr;
  }

  .gacha-button {
    min-height: 64px;
    min-width: min(290px, calc(100vw - 28px));
    padding: 0 18px;
  }

  .plain-button {
    min-height: 42px;
  }
}

@media (max-width: 520px) {
  :root {
    --bubble-scale: 0.48;
  }

  .gacha-stage {
    grid-template-rows: auto minmax(300px, 1fr) auto;
  }

  .stage-header {
    text-align: center;
  }

  .machine-wrap {
    width: min(96vw, 350px);
    margin-top: -120px;
  }

  .prize-bubble img {
    width: 76%;
    height: 76%;
  }

  .gacha-app.is-gathering .prize-bubble,
  .gacha-app.is-a-freeze .prize-bubble,
  .gacha-app.is-a-overload .prize-bubble {
    width: 42px;
    height: 42px;
  }

  .capsule-prize {
    width: 104px;
    height: 122px;
  }

  .puzzle-panel {
    bottom: max(144px, env(safe-area-inset-bottom));
    width: calc(100vw - 22px);
    max-height: calc(100svh - 204px);
    border-width: 2px;
    box-shadow: 0 9px 0 rgba(0, 0, 0, 0.2), 0 18px 32px rgba(0, 20, 80, 0.35);
  }

  .puzzle-cards {
    gap: 6px;
  }

  .puzzle-card {
    min-height: 54px;
    border-width: 2px;
    font-size: 1rem;
  }

  .small-button,
  .hint-button,
  .plain-button {
    min-height: 42px;
    border-width: 2px;
  }

  .result-prize {
    width: calc(100vw - 24px);
    padding: 14px;
  }

  .result-image-wrap {
    width: 136px;
    height: 136px;
  }

  .result-prize h2 {
    font-size: 1.18rem;
  }

  .action-bar {
    gap: 8px;
  }

  .gacha-button {
    min-height: 58px;
    font-size: 1.08rem;
  }

  .gacha-app.is-puzzle .gacha-button,
  .gacha-app.is-a-puzzle .gacha-button {
    display: none !important;
  }
}

@media (max-height: 680px) and (max-width: 760px) {
  :root {
    --bubble-scale: 0.42;
  }

  .gacha-stage {
    grid-template-rows: auto minmax(250px, 1fr) auto;
    padding-top: 10px;
    padding-bottom: 12px;
  }

  .machine-wrap {
    width: min(82vw, 300px);
    margin-top: -24px;
  }

  .puzzle-panel {
    bottom: max(106px, env(safe-area-inset-bottom));
    max-height: calc(100svh - 138px);
  }

  .result-image-wrap {
    width: 118px;
    height: 118px;
  }

  .gacha-button {
    min-height: 52px;
  }
}

.maker-app {
  min-height: 100vh;
  padding: 28px;
  color: #18314f;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 224, 111, 0.42), transparent 26%),
    radial-gradient(circle at 88% 8%, rgba(255, 132, 118, 0.28), transparent 24%),
    radial-gradient(circle at 52% 86%, rgba(111, 207, 224, 0.34), transparent 28%),
    linear-gradient(135deg, #fbfffc 0%, #e8fbf8 50%, #fff5ed 100%);
}

.maker-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, 100%);
  margin: 0 auto 20px;
}

.maker-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  color: #2a7f89;
  text-transform: uppercase;
}

.maker-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
}

.maker-header p {
  margin: 10px 0 0;
  font-weight: 700;
  color: #5a6d76;
}

.header-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
  width: min(500px, 100%);
}

.maker-preview-link,
.primary-action,
.secondary-action,
.danger-action,
.google-action,
.auth-open-button,
.text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.maker-preview-link,
.auth-open-button {
  color: #fff;
  background: linear-gradient(180deg, var(--button-blue), var(--button-blue-deep));
  box-shadow: var(--soft-shadow);
}

.maker-preview-link {
  background: linear-gradient(180deg, var(--button-mint), var(--button-mint-deep));
  box-shadow: 0 7px 18px rgba(66, 191, 168, 0.22);
}

.primary-action {
  color: #fff;
  background: linear-gradient(180deg, var(--button-mint), var(--button-mint-deep));
  box-shadow: 0 7px 18px rgba(66, 191, 168, 0.22);
}

.auth-open-button {
  max-width: min(280px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secondary-action {
  color: #34708a;
  background: #f8feff;
  border: 2px solid rgba(98, 189, 232, 0.28);
}

.google-action {
  color: #26323a;
  background: #fff;
  border: 2px solid rgba(42, 127, 137, 0.22);
}

.google-action::before {
  content: "G";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  color: #fff;
  background: #4285f4;
  font-size: 0.82rem;
  font-weight: 900;
}

.danger-action {
  color: #9c5864;
  background: #fff2f5;
  border: 2px solid rgba(255, 166, 178, 0.34);
}

.text-action {
  min-height: 34px;
  padding: 0 10px;
  color: #3d8aaa;
  background: transparent;
}

.danger-text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: #d75668;
  background: transparent;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.danger-text-action:hover {
  background: #fff2f5;
}

.maker-shell {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  width: min(1180px, 100%);
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid rgba(42, 127, 137, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 44px rgba(32, 83, 92, 0.12);
}

.maker-sidebar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: rgba(111, 207, 224, 0.12);
  border-right: 1px solid rgba(42, 127, 137, 0.14);
}

.maker-tab {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #2e5962;
  background: transparent;
  font: inherit;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.maker-tab.is-active {
  color: #fff;
  background: linear-gradient(180deg, var(--button-blue), var(--button-blue-deep));
  box-shadow: 0 7px 18px rgba(70, 147, 177, 0.18);
}

.maker-form {
  min-width: 0;
  padding: 24px;
}

.auth-modal[hidden],
.share-modal[hidden] {
  display: none;
}

.auth-modal,
.share-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-backdrop,
.share-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 83, 92, 0.34);
  backdrop-filter: blur(4px);
}

.maker-auth {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: center;
  width: min(440px, 100%);
  margin-bottom: 0;
  padding: 28px 22px 22px;
  border: 1px solid rgba(42, 127, 137, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 224, 111, 0.34), transparent 28%),
    radial-gradient(circle at 86% 8%, rgba(255, 132, 118, 0.22), transparent 26%),
    #fffaf0;
  color: #18314f;
  box-shadow: 0 20px 54px rgba(32, 83, 92, 0.18);
}

.auth-dialog {
  z-index: 1;
}

.share-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  width: min(520px, 100%);
  padding: 28px 22px 22px;
  border: 1px solid rgba(42, 127, 137, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 224, 111, 0.26), transparent 28%),
    #fffaf0;
  color: #18314f;
  box-shadow: 0 20px 54px rgba(32, 83, 92, 0.18);
}

.share-dialog h2 {
  margin: 0;
  text-align: center;
}

.share-help {
  margin: 0;
  color: #5a6d76;
  font-weight: 800;
  line-height: 1.7;
}

.share-dialog input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 2px solid rgba(42, 127, 137, 0.18);
  border-radius: 8px;
  color: #20303c;
  background: #fff;
  font: inherit;
  font-weight: 700;
}

.share-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.share-icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid rgba(42, 127, 137, 0.16);
  border-radius: 14px;
  color: #4f6874;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(32, 83, 92, 0.1);
}

.share-icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.share-icon-button:active {
  transform: translateY(1px);
  box-shadow: 0 4px 10px rgba(32, 83, 92, 0.1);
}

.share-dialog-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.social-share-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.social-share-button {
  display: inline-grid;
  min-height: 46px;
  place-items: center;
  border-radius: 12px;
  color: #fff;
  font-weight: 900;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(32, 83, 92, 0.12);
}

.line-share {
  background: #06c755;
}

.x-share {
  background: #1b1f23;
}

.maker-auth h2 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1;
  text-align: center;
}

.maker-auth p {
  margin: 0;
  color: #5a6d76;
  font-weight: 800;
}

.auth-kicker {
  justify-self: center;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  margin: 0;
  padding: 0 10px;
  border-radius: 999px;
  color: #2a7f89;
  background: rgba(111, 207, 224, 0.18);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
}

.auth-close-button {
  position: absolute;
  right: 14px;
  top: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  color: #5a6d76;
  background: transparent;
  font-size: 1.4rem;
}

.auth-close-button:hover {
  color: #18314f;
  background: rgba(42, 127, 137, 0.1);
}

.auth-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}

.auth-controls > [hidden] {
  display: none;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: #2e5962;
  font-size: 0.92rem;
  font-weight: 900;
}

.auth-field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid rgba(42, 127, 137, 0.18);
  border-radius: 8px;
  color: #20303c;
  background: #fff;
  font: inherit;
  font-weight: 700;
}

.account-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(42, 127, 137, 0.18);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
}

.account-label {
  color: #2a7f89;
  font-size: 0.78rem;
  font-weight: 900;
}

.account-email {
  overflow-wrap: anywhere;
  color: #18314f;
  font-size: 1rem;
}

.auth-field input:focus {
  border-color: #94a9c4;
  outline: 2px solid rgba(111, 207, 224, 0.22);
}

.password-wrap {
  position: relative;
  display: block;
}

.password-wrap input {
  padding-right: 70px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  color: #60737a;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
  transform: translateY(-50%);
}

.forgot-action {
  justify-self: end;
  color: #2a7f89;
}

.login-submit-button {
  min-height: 48px;
  margin-top: 18px;
  color: #fff;
  background: linear-gradient(180deg, var(--button-blue), var(--button-blue-deep));
  box-shadow: var(--soft-shadow);
}

.signup-submit-button {
  min-height: 50px;
  margin-top: 18px;
  color: #123a40;
  background: linear-gradient(180deg, #ffe8a8, #ffc9a6);
  box-shadow: var(--soft-shadow);
}

.auth-dialog .google-action {
  min-height: 44px;
  border-color: rgba(98, 189, 232, 0.26);
  color: #34708a;
  background: #f8feff;
}

.signup-prompt {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(42, 127, 137, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.56);
  text-align: center;
  font-size: 0.9rem;
}

.signup-prompt .text-action {
  display: inline;
  min-height: auto;
  padding: 0;
  color: #2a7f89;
}

body.is-auth-open {
  overflow: hidden;
}

.maker-panel {
  display: none;
}

.maker-panel.is-active {
  display: block;
}

.maker-panel-head {
  margin-bottom: 18px;
}

.maker-panel-head h2 {
  margin: 0;
  font-size: 1.45rem;
}

.maker-panel-head p {
  margin: 6px 0 0;
  color: #60737a;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 900;
  color: #2e5962;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid rgba(42, 127, 137, 0.18);
  border-radius: 8px;
  color: #20303c;
  background: #fff;
  font: inherit;
  font-weight: 700;
}

.field textarea {
  resize: vertical;
  line-height: 1.6;
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.rate-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(42, 127, 137, 0.14);
  border-radius: 8px;
  background: #fff;
  font-weight: 900;
}

.rate-field input {
  width: 100%;
  min-height: 44px;
  border: 2px solid rgba(42, 127, 137, 0.18);
  border-radius: 8px;
  text-align: center;
  font: inherit;
  font-weight: 900;
}

.maker-total {
  display: inline-flex;
  margin: 18px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: #e8f8ef;
  color: #177044;
  font-weight: 900;
}

.maker-total.is-error {
  background: #fff2df;
  color: #9b4d00;
}

.setting-preview {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(42, 127, 137, 0.14);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(232, 251, 248, 0.82), rgba(255, 245, 237, 0.78));
}

.preview-label {
  margin: 0 0 10px;
  color: #2a7f89;
  font-size: 0.82rem;
  font-weight: 900;
}

.mini-stage-preview {
  position: relative;
  min-height: 132px;
  padding: 18px;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 224, 111, 0.4), transparent 26%),
    radial-gradient(circle at 82% 14%, rgba(255, 111, 97, 0.24), transparent 22%),
    linear-gradient(155deg, var(--sky-1), var(--sky-3));
}

.mini-stage-preview p {
  margin: 0 0 4px;
  font-size: 0.74rem;
  font-weight: 900;
}

.mini-stage-preview h3 {
  margin: 0;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  line-height: 1.05;
}

.legend-text-preview {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(92%, 360px);
  color: #fff7c2;
  font-size: clamp(1.5rem, 5vw, 2.6rem);
  font-weight: 900;
  text-align: center;
  text-shadow: 0 0 16px #fff, 0 0 24px var(--gold), 0 5px 0 rgba(0, 0, 0, 0.22);
  opacity: 0.58;
  transform: translate(-50%, -50%) scale(0.9) rotate(-3deg);
}

.legend-text-preview.is-playing {
  animation: legendPreviewPop 1.1s ease-out;
}

.legend-sequence-preview {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 224, 111, 0.4), transparent 26%),
    radial-gradient(circle at 82% 14%, rgba(255, 111, 97, 0.24), transparent 22%),
    linear-gradient(155deg, var(--sky-1), var(--sky-3));
}

.legend-sequence-preview::before {
  content: "";
  position: absolute;
  inset: -24%;
  background: conic-gradient(
    from -8deg at 50% 48%,
    rgba(255, 255, 255, 0.2) 0 8deg,
    transparent 8deg 22deg,
    rgba(255, 224, 111, 0.16) 22deg 30deg,
    transparent 30deg 52deg
  );
  opacity: 0.62;
}

.sequence-bubbles span {
  position: absolute;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, 0.9), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(179, 237, 255, 0.34));
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 8px 8px 16px rgba(255, 255, 255, 0.48), 0 8px 18px rgba(0, 40, 80, 0.22);
}

.sequence-bubbles span:nth-child(1) { left: 12%; top: 28%; }
.sequence-bubbles span:nth-child(2) { left: 24%; top: 64%; width: 34px; height: 34px; }
.sequence-bubbles span:nth-child(3) { right: 20%; top: 22%; width: 48px; height: 48px; }
.sequence-bubbles span:nth-child(4) { right: 12%; top: 62%; width: 36px; height: 36px; }
.sequence-bubbles span:nth-child(5) { left: 48%; top: 14%; width: 30px; height: 30px; }

.legend-sequence-preview.is-playing .sequence-bubbles span {
  animation: previewBubbleGather 1.35s cubic-bezier(0.2, 0.88, 0.18, 1) 0.2s forwards;
}

.sequence-machine {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 132px;
  height: 150px;
  transform: translateX(-50%);
}

.sequence-dome {
  position: absolute;
  left: 5%;
  top: 0;
  width: 90%;
  height: 66%;
  border: 3px solid #112;
  border-radius: 50% 50% 42% 42%;
  background:
    radial-gradient(circle at 76% 24%, rgba(255, 255, 255, 0.88), transparent 20%),
    rgba(126, 207, 246, 0.7);
  overflow: hidden;
}

.sequence-dome i {
  position: absolute;
  bottom: 9px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff, #6fcfe0 45%, #fff 48%, #ff8a78 52%);
}

.sequence-dome i:nth-child(1) { left: 20px; }
.sequence-dome i:nth-child(2) { left: 42px; }
.sequence-dome i:nth-child(3) { left: 64px; }
.sequence-dome i:nth-child(4) { left: 52px; bottom: 28px; }

.sequence-base {
  position: absolute;
  left: 28%;
  bottom: 0;
  width: 44%;
  height: 42%;
  border: 3px solid #112;
  border-radius: 10px 10px 8px 8px;
  background: linear-gradient(180deg, #2aa7b8, #255f7c);
}

.sequence-base b {
  position: absolute;
  left: 50%;
  top: 14%;
  width: 34px;
  height: 34px;
  border: 4px solid #112;
  border-radius: 50%;
  background: linear-gradient(#fff 0 38%, #777 38% 50%, #fff 50%);
  transform: translateX(-50%);
}

.legend-sequence-preview.is-playing .sequence-base b {
  animation: knobTurn 0.72s cubic-bezier(0.2, 0.9, 0.16, 1) 0.18s;
}

.legend-sequence-preview.is-playing .sequence-machine {
  animation:
    previewMachineRattle 0.12s linear 0.68s 9,
    previewMachineGlow 1.2s ease-out 1.55s forwards;
}

.legend-sequence-preview .legend-text-preview {
  opacity: 0;
  z-index: 3;
}

.legend-sequence-preview.is-playing .legend-text-preview {
  animation: legendPreviewPop 1.05s ease-out 1.62s forwards;
}

.sequence-gold-burst {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 0;
  height: 0;
  pointer-events: none;
}

.sequence-gold-burst i {
  --angle: 0deg;
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 18px;
  border-radius: 999px;
  opacity: 0;
  background: linear-gradient(#fff7c2, var(--gold));
  box-shadow: 0 0 14px rgba(255, 224, 111, 0.86);
  transform: translate(-50%, -50%) rotate(var(--angle));
}

.sequence-gold-burst i:nth-child(1) { --angle: 0deg; }
.sequence-gold-burst i:nth-child(2) { --angle: 45deg; }
.sequence-gold-burst i:nth-child(3) { --angle: 90deg; }
.sequence-gold-burst i:nth-child(4) { --angle: 135deg; }
.sequence-gold-burst i:nth-child(5) { --angle: 180deg; }
.sequence-gold-burst i:nth-child(6) { --angle: 225deg; }
.sequence-gold-burst i:nth-child(7) { --angle: 270deg; }
.sequence-gold-burst i:nth-child(8) { --angle: 315deg; }

.legend-sequence-preview.is-playing .sequence-gold-burst i {
  animation: previewGoldBurst 0.76s ease-out 1.88s forwards;
}

.sequence-status {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 4;
  width: calc(100% - 24px);
  margin: 0;
  padding: 8px 10px;
  border-radius: 999px;
  color: #24566a;
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
  transform: translateX(-50%);
}

.preview-action-button {
  width: 100%;
  margin-top: 12px;
}

.rate-template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.rate-template-button {
  min-height: 48px;
  border: 2px solid rgba(42, 127, 137, 0.2);
  border-radius: 8px;
  color: #225b65;
  background: #fff;
  font: inherit;
  font-weight: 900;
}

.rate-template-button:hover {
  border-color: #2a9aaa;
  background: rgba(232, 251, 248, 0.78);
}

.rate-preview-list {
  display: grid;
  gap: 8px;
}

.rate-preview-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
  color: #20303c;
  font-weight: 900;
}

.rate-preview-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(42, 127, 137, 0.12);
}

.rate-preview-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6fcfe0, #ffb1a5);
}

.prize-result-preview {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  color: #20303c;
}

.prize-result-image,
.sample-prize-icon {
  display: grid;
  place-items: center;
  position: relative;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.95), transparent 18%),
    linear-gradient(135deg, rgba(220, 251, 248, 0.88), rgba(255, 244, 237, 0.88));
  border: 2px solid rgba(42, 127, 137, 0.16);
}

.sample-prize-icon::before {
  content: "";
  width: 58px;
  height: 50px;
  border-radius: 10px;
  background:
    linear-gradient(90deg, transparent 42%, #fff 42% 58%, transparent 58%),
    linear-gradient(#ffa6b2 0 48%, #ff8396 48% 100%);
  box-shadow: 0 -20px 0 -8px #ffe06f, 0 10px 22px rgba(70, 147, 177, 0.16);
}

.sample-prize-icon::after {
  content: "";
  position: absolute;
  top: 25px;
  width: 72px;
  height: 14px;
  border-radius: 999px;
  background: #fff7c2;
  box-shadow: inset 0 0 0 3px rgba(255, 166, 178, 0.28);
}

.prize-result-image img {
  max-width: 76%;
  max-height: 76%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  display: none;
}

.prize-result-image img.has-image {
  display: block;
}

.prize-result-image span {
  padding: 0 14px;
  color: #60737a;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.45;
  text-align: center;
}

.mini-rank {
  min-width: 58px;
  min-height: 30px;
  margin: 0 0 8px;
  border: 0;
  font-size: 0.82rem;
}

.prize-result-preview h3 {
  margin: 0 0 6px;
  font-size: 1.24rem;
}

.prize-result-preview p {
  margin: 0;
  color: #60737a;
  font-weight: 800;
}

.maker-list {
  display: grid;
  gap: 16px;
}

.prize-add-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(42, 127, 137, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.compact-field {
  margin-bottom: 0;
}

.prize-count-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.prize-count-chip {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  color: #17232c;
  font-size: 0.9rem;
  font-weight: 900;
  border: 1px solid rgba(32, 48, 60, 0.12);
}

.prize-count-chip.rank-A,
.rank-chip.rank-A {
  background: #ffe06f;
}

.prize-count-chip.rank-B,
.rank-chip.rank-B {
  background: #c7b5ff;
}

.prize-count-chip.rank-C,
.rank-chip.rank-C {
  background: #9ee8b7;
}

.prize-count-chip.rank-D,
.rank-chip.rank-D {
  background: #8edfee;
}

.prize-count-chip.rank-E,
.rank-chip.rank-E {
  background: #ffb1a5;
}

.prize-count-chip.rank-F,
.rank-chip.rank-F {
  background: #f4f8fa;
}

.edit-item {
  padding: 16px;
  border: 1px solid rgba(42, 127, 137, 0.14);
  border-radius: 8px;
  background: #fff;
}

.edit-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.edit-item-head strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
}

.edit-item-head strong span {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(180deg, var(--button-blue), var(--button-blue-deep));
  font-size: 0.9rem;
}

.edit-item-head span {
  color: #789;
  font-weight: 800;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quiz-edit-item {
  border-color: rgba(98, 189, 232, 0.22);
  background:
    linear-gradient(90deg, rgba(111, 207, 224, 0.16) 0 8px, transparent 8px),
    #fff;
}

.quiz-question-field {
  padding: 12px;
  border-radius: 8px;
  background: rgba(232, 251, 248, 0.72);
}

.quiz-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.quiz-choice-field {
  min-width: 0;
  margin-bottom: 0;
  padding: 12px;
  border-radius: 8px;
}

.quiz-choice-field.choice-1 {
  background: rgba(111, 207, 224, 0.16);
}

.quiz-choice-field.choice-2 {
  background: rgba(255, 224, 111, 0.22);
}

.quiz-choice-field.choice-3 {
  background: rgba(255, 166, 178, 0.18);
}

.quiz-answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(248, 254, 255, 0.92);
  border: 1px solid rgba(98, 189, 232, 0.16);
}

.quiz-answer-grid .field {
  margin-bottom: 0;
}

.prize-editor-layout {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.prize-image-preview {
  display: grid;
  place-items: center;
  position: relative;
  min-height: 148px;
  border: 2px solid rgba(42, 127, 137, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 28% 22%, rgba(255, 255, 255, 0.95), transparent 18%),
    linear-gradient(135deg, rgba(220, 251, 248, 0.88), rgba(255, 244, 237, 0.88));
  overflow: hidden;
}

.prize-image-preview img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  position: relative;
  z-index: 1;
  display: none;
}

.prize-image-preview.has-image img {
  display: block;
}

.prize-image-preview em {
  width: 72%;
  color: #60737a;
  font-style: normal;
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1.5;
  text-align: center;
}

.prize-image-preview.has-image em {
  display: none;
}

.prize-image-preview span {
  position: absolute;
  left: 8px;
  top: 8px;
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 999px;
  color: #17232c;
  background: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.prize-editor-fields {
  min-width: 0;
}

.image-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 2px solid rgba(98, 189, 232, 0.32);
  border-radius: 8px;
  color: #34708a;
  background: #f8feff;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(70, 147, 177, 0.12);
}

.image-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.image-picker-note {
  margin: 8px 0 0;
  color: #60737a;
  font-size: 0.88rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.maker-actions-row,
.share-box {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.maker-status {
  min-height: 1.5em;
  color: #2a7f89;
  font-weight: 900;
}

.sponsor-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  width: min(1180px, 100%);
  margin: 18px auto 0;
  padding: 14px 16px;
  border: 1px solid rgba(98, 189, 232, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.sponsor-label {
  display: inline-flex;
  margin: 0 0 4px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #34708a;
  background: rgba(98, 189, 232, 0.14);
  font-size: 0.78rem;
  font-weight: 900;
}

.sponsor-copy {
  margin: 0;
  color: #60737a;
  font-size: 0.9rem;
  font-weight: 800;
}

.sponsor-box a {
  display: block;
  line-height: 0;
}

.sponsor-box img {
  display: block;
  max-width: min(468px, 100%);
  height: auto;
  border-radius: 6px;
}

.sponsor-tracker {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.admin-tools[hidden] {
  display: none;
}

.admin-tools {
  margin-top: 18px;
  padding: 16px;
  border: 1px dashed rgba(42, 127, 137, 0.32);
  border-radius: 8px;
  background: rgba(232, 251, 248, 0.52);
}

.portal-page {
  min-height: 100vh;
  color: #18314f;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 204, 112, 0.2), transparent 26%),
    radial-gradient(circle at 82% 20%, rgba(128, 219, 211, 0.26), transparent 28%),
    linear-gradient(135deg, #fff7df, #e7fbf7 58%, #f3f0ff);
}

.portal-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 28px;
}

.portal-hero {
  max-width: 720px;
}

.portal-kicker,
.portal-service-label {
  margin: 0 0 10px;
  color: #2a7f89;
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.portal-hero h1 {
  margin: 0 0 16px;
  color: #18314f;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  line-height: 1.08;
}

.portal-hero p,
.portal-service-card p {
  margin: 0;
  color: #5a6d76;
  font-weight: 800;
  line-height: 1.8;
}

.portal-services {
  margin-top: 34px;
}

.portal-service-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px;
  border: 1px solid rgba(42, 127, 137, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 44px rgba(32, 83, 92, 0.1);
}

.portal-service-card h2 {
  margin: 0 0 8px;
  color: #18314f;
  font-size: 1.6rem;
}

.portal-service-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid rgba(42, 127, 137, 0.22);
  border-radius: 999px;
  color: #123a40;
  background: linear-gradient(135deg, #d8fbf5, #a9eee6);
  box-shadow: 0 8px 18px rgba(32, 83, 92, 0.12);
  font-weight: 900;
  text-decoration: none;
}

.maker-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  width: min(1180px, 100%);
  margin: 18px auto 0;
  color: #5a6d76;
  font-size: 0.86rem;
  font-weight: 800;
}

.maker-footer a {
  color: inherit;
  text-decoration: none;
}

.maker-footer a:hover {
  color: #2a7f89;
  text-decoration: underline;
}

.legal-page {
  width: min(840px, calc(100% - 32px));
  margin: 32px auto;
  padding: 28px;
  border: 1px solid rgba(42, 127, 137, 0.16);
  border-radius: 8px;
  color: #18314f;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 44px rgba(32, 83, 92, 0.1);
}

.legal-page h1 {
  margin: 10px 0 20px;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
}

.legal-page h2 {
  margin: 26px 0 8px;
  font-size: 1.15rem;
}

.legal-page p {
  color: #5a6d76;
  font-weight: 700;
  line-height: 1.8;
}

.legal-back {
  color: #2a7f89;
  font-weight: 900;
  text-decoration: none;
}

@media (max-width: 820px) {
  .maker-app {
    padding: 16px;
  }

  .maker-header {
    display: grid;
    align-items: start;
  }

  .header-actions {
    justify-items: stretch;
    width: 100%;
  }

  .maker-shell {
    grid-template-columns: 1fr;
  }

  .maker-auth,
  .auth-controls,
  .share-dialog-actions {
    grid-template-columns: 1fr;
  }

  .maker-sidebar {
    flex-direction: row;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(35, 82, 120, 0.12);
  }

  .maker-tab {
    flex: 0 0 auto;
    min-width: 88px;
    text-align: center;
  }

  .rate-grid,
  .edit-grid,
  .quiz-choice-grid,
  .quiz-answer-grid,
  .prize-editor-layout,
  .prize-add-row,
  .rate-template-grid,
  .prize-result-preview {
    grid-template-columns: 1fr;
  }

  .prize-result-image {
    margin: 0 auto;
  }

  .prize-image-preview {
    min-height: 190px;
  }

  .image-picker {
    width: 100%;
  }

  .portal-shell {
    width: min(100% - 24px, 1040px);
    padding-top: 34px;
  }

  .portal-service-card {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .portal-service-link {
    width: 100%;
  }

  .maker-footer {
    justify-content: center;
    text-align: center;
  }

  .sponsor-box {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .sponsor-box a {
    justify-self: center;
    width: 100%;
    max-width: 468px;
  }
}
