:root {
  color-scheme: light;
  --green: #009944;
  --green-dark: #006f37;
  --navy: #10325f;
  --blue: #0b6dc7;
  --red: #d82435;
  --yellow: #f5cb35;
  --ink: #10243d;
  --muted: #5d6d7f;
  --line: rgba(16, 36, 61, 0.14);
  --white: #ffffff;
  --shadow: 0 18px 48px rgba(16, 36, 61, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Noto Sans JP", system-ui, sans-serif;
  background:
    linear-gradient(rgba(16, 36, 61, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16, 36, 61, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #f8fcff 0%, #eef8f3 48%, #ffffff 100%);
  background-size: 28px 28px, 28px 28px, auto;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    linear-gradient(120deg, transparent 0 72%, rgba(0, 153, 68, 0.1) 72% 76%, transparent 76%),
    linear-gradient(150deg, transparent 0 62%, rgba(245, 203, 53, 0.14) 62% 64%, transparent 64%);
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.top-page {
  --top-pink: #ed86a9;
  --top-pink-dark: #d95f8a;
  --top-pink-deep: #b94373;
  --top-pink-soft: rgba(237, 134, 169, 0.2);
  --top-pink-shadow: rgba(185, 67, 115, 0.24);
  min-height: 100svh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.94), rgba(255, 244, 249, 0.44) 30%, transparent 54%),
    linear-gradient(180deg, #fff5f9 0%, #fbd9e5 50%, #f4b8cf 100%);
}

.top-page::before {
  background:
    radial-gradient(circle at 16% 18%, rgba(237, 134, 169, 0.24), transparent 30%),
    radial-gradient(circle at 82% 82%, rgba(255, 214, 230, 0.72), transparent 34%),
    radial-gradient(circle at 78% 18%, rgba(255, 255, 255, 0.58), transparent 22%);
}

.top-simple {
  position: relative;
  width: min(100%, 560px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  --top-machine-width: min(88vw, 430px);
  --top-button-gap: clamp(16px, 2.2svh, 24px);
}

.top-viewer {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  width: min(100%, 560px);
  min-height: 0;
  perspective: 1100px;
  translate: -50% -50%;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  --viewer-tilt: 0deg;
  --machine-shift: 0px;
  --machine-scale: 1;
  --image-tilt: 0deg;
}

.top-viewer:focus-visible {
  outline: 3px solid var(--top-pink-soft);
  outline-offset: 6px;
  border-radius: 12px;
}

.top-viewer.is-dragging {
  cursor: grabbing;
}

.top-machine {
  display: grid;
  justify-items: center;
  width: var(--top-machine-width);
  min-height: 0;
  margin: 0;
}

.top-machine-rotator {
  position: relative;
  display: grid;
  justify-items: center;
  width: 100%;
  transform-style: preserve-3d;
  transform-origin: 50% 62%;
  transform: translateX(var(--machine-shift)) rotateY(var(--viewer-tilt)) scale(var(--machine-scale));
  will-change: transform;
}

.top-machine-image {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100svh - 164px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  object-fit: contain;
  filter: drop-shadow(0 24px 34px rgba(128, 44, 82, 0.2));
  transform: rotateY(var(--image-tilt)) scale(1);
  transform-origin: 50% 62%;
  will-change: transform;
  pointer-events: none;
  user-select: none;
}

.top-machine-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 24px 34px rgba(128, 44, 82, 0.2));
  pointer-events: none;
}

.top-viewer.is-3d-ready .top-machine-rotator {
  transform: none;
  will-change: auto;
}

.top-viewer.is-3d-ready .top-machine-image {
  visibility: hidden;
  transform: none;
  filter: none;
}

.peek-arrow {
  position: absolute;
  top: 50%;
  z-index: 6;
  display: grid;
  place-items: center;
  width: clamp(42px, 12vw, 54px);
  aspect-ratio: 1;
  padding: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(237, 134, 169, 0.42);
  border-radius: 50%;
  box-shadow: 0 12px 24px rgba(185, 67, 115, 0.18);
  cursor: pointer;
  transform: translateY(-50%);
}

.peek-arrow::before {
  width: 38%;
  aspect-ratio: 1;
  content: "";
  border-top: 4px solid var(--top-pink-dark);
  border-left: 4px solid var(--top-pink-dark);
}

.peek-arrow-left {
  left: 0;
}

.peek-arrow-left::before {
  transform: translateX(12%) rotate(-45deg);
}

.peek-arrow-right {
  right: 0;
}

.peek-arrow-right::before {
  transform: translateX(-12%) rotate(135deg);
}

.peek-arrow:hover,
.peek-arrow:focus-visible,
.peek-arrow[aria-pressed="true"] {
  background: var(--top-pink);
  border-color: rgba(255, 255, 255, 0.9);
  outline: none;
}

.peek-arrow:hover::before,
.peek-arrow:focus-visible::before,
.peek-arrow[aria-pressed="true"]::before {
  border-color: var(--white);
}

.gyro-button {
  position: absolute;
  top: clamp(6px, 1.8svh, 14px);
  right: clamp(16px, 5vw, 42px);
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  color: var(--top-pink-deep);
  font-size: 0.86rem;
  font-weight: 900;
  line-height: 1;
  background: rgba(255, 255, 255, 0.88);
  border: 2px solid rgba(237, 134, 169, 0.42);
  border-radius: 999px;
  box-shadow: 0 10px 20px rgba(185, 67, 115, 0.16);
  cursor: pointer;
  touch-action: manipulation;
}

.gyro-button[aria-pressed="true"] {
  color: var(--white);
  background: linear-gradient(180deg, var(--top-pink), var(--top-pink-dark));
  border-color: rgba(255, 255, 255, 0.9);
}

.gyro-button:focus-visible {
  outline: 3px solid var(--top-pink-soft);
  outline-offset: 4px;
}

.top-gacha-button {
  position: absolute;
  top: calc(100% + var(--top-button-gap));
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 340px);
  min-height: 58px;
  margin: 0;
  padding: 14px 22px;
  color: var(--white);
  font-size: 1.08rem;
  font-weight: 900;
  translate: -50% 0;
  cursor: pointer;
  touch-action: manipulation;
  background: linear-gradient(180deg, var(--top-pink), var(--top-pink-dark));
  border: 2px solid rgba(255, 255, 255, 0.94);
  border-radius: 8px;
  box-shadow:
    0 14px 28px var(--top-pink-shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.top-gacha-button:active {
  transform: translateY(2px);
}

.top-gacha-button:focus-visible {
  outline: 3px solid var(--top-pink-soft);
  outline-offset: 4px;
}

#play,
#lineup {
  scroll-margin-top: 16px;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.site-header {
  position: relative;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 12px 18px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(16, 36, 61, 0.1);
  backdrop-filter: blur(16px);
}

.brand,
.site-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
  color: var(--green-dark);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--white);
  background: var(--green);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0, 153, 68, 0.22);
}

.site-nav {
  gap: 8px;
}

.site-nav a {
  flex: 1;
  min-height: 40px;
  padding: 10px 12px;
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--navy);
  text-align: center;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 8px;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  background: rgba(0, 153, 68, 0.1);
  outline: none;
}

.hero {
  display: grid;
  gap: 24px;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 54px;
}

.machine-figure {
  position: relative;
  order: -1;
  margin: 0;
}

.machine-figure::before {
  position: absolute;
  inset: 5% 2% 0 10%;
  z-index: -1;
  content: "";
  background: repeating-linear-gradient(135deg, rgba(0, 153, 68, 0.16) 0 12px, rgba(16, 50, 95, 0.05) 12px 24px);
  border-radius: 8px;
  transform: rotate(2deg);
}

.machine-figure img {
  display: block;
  width: min(100%, 360px);
  max-height: 62svh;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 24px 32px rgba(16, 36, 61, 0.22));
}

.hero-copy {
  max-width: 650px;
}

.eyebrow,
.play-kicker,
.result-kicker {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(2.4rem, 13vw, 5.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.8rem, 8vw, 3rem);
  line-height: 1.16;
  letter-spacing: 0;
}

.lead {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.8;
}

.quick-facts {
  display: grid;
  gap: 10px;
  margin: 24px 0 0;
}

.quick-facts div,
.lineup-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16, 36, 61, 0.08);
}

.quick-facts div {
  min-height: 96px;
  padding: 15px;
}

.quick-facts span,
.card-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.quick-facts strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 1.14rem;
  line-height: 1.3;
}

.hero-actions,
.result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
}

.primary-action,
.secondary-action,
.ghost-button,
.skip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 13px 18px;
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  color: var(--white);
  background: var(--green);
  border: 0;
  box-shadow: 0 12px 28px rgba(0, 153, 68, 0.24);
}

.primary-action:focus-visible {
  background: var(--green-dark);
  outline: 3px solid rgba(0, 153, 68, 0.22);
  outline-offset: 3px;
}

.secondary-action,
.ghost-button {
  color: var(--navy);
  background: var(--white);
  border: 1px solid var(--line);
}

.secondary-action:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: rgba(0, 153, 68, 0.45);
  outline: 3px solid rgba(0, 153, 68, 0.14);
  outline-offset: 3px;
}

.compact {
  min-height: 44px;
}

.play-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100svh;
  padding: 0;
  color: var(--white);
  --touch-fade-duration: 0.52s;
  --roll-duration: 2.8s;
  background:
    radial-gradient(circle at 24% 14%, rgba(255, 255, 255, 0.44), transparent 32%),
    linear-gradient(135deg, #ed86a9 0%, #f6a6bd 44%, #ffd0ad 100%);
}

.gacha-page {
  overflow: hidden;
  background: #ed86a9;
}

.play-bg-media,
.video-fallback {
  position: absolute;
  inset: 0;
}

.play-bg-media {
  z-index: -1;
  display: block;
  overflow: hidden;
  pointer-events: none;
}

.play-bg-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  filter: saturate(1.08) contrast(1.04) brightness(0.98);
  transform: scale(1.06);
  animation: background-pan 10s ease-in-out infinite alternate;
}

.video-fallback {
  z-index: -2;
  background:
    radial-gradient(circle at 24% 14%, rgba(255, 255, 255, 0.44), transparent 32%),
    linear-gradient(135deg, #ed86a9 0%, #f6a6bd 44%, #ffd0ad 100%);
}

@media (max-width: 719px) {
  .play-bg-image {
    filter: saturate(1.06) contrast(1.02) brightness(1);
    transform: scale(1.02);
  }
}

.motion-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  opacity: 0.85;
}

.motion-bg::before,
.motion-bg::after,
.motion-bg span {
  position: absolute;
  display: block;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.52);
  transform: rotate(45deg);
  animation: drift 9s linear infinite;
}

.motion-bg::before {
  width: 86px;
  height: 86px;
  left: -22px;
  top: 16%;
}

.motion-bg::after {
  width: 128px;
  height: 128px;
  right: -46px;
  bottom: 14%;
  animation-duration: 12s;
}

.motion-bg span:nth-child(1) {
  width: 44px;
  height: 44px;
  left: 22%;
  top: 8%;
}

.motion-bg span:nth-child(2) {
  width: 30px;
  height: 30px;
  right: 18%;
  top: 18%;
  animation-delay: -2s;
}

.motion-bg span:nth-child(3) {
  width: 72px;
  height: 72px;
  left: 8%;
  bottom: 20%;
  animation-delay: -5s;
}

.motion-bg span:nth-child(4) {
  width: 24px;
  height: 24px;
  right: 24%;
  bottom: 10%;
  border-color: rgba(245, 203, 53, 0.74);
  animation-delay: -3s;
}

.motion-bg span:nth-child(5) {
  width: 180px;
  height: 2px;
  left: 58%;
  top: 42%;
  background: rgba(255, 255, 255, 0.38);
  border: 0;
  animation-delay: -6s;
}

.play-hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  pointer-events: none;
}

.ghost-button,
.skip-button {
  min-width: 64px;
  min-height: 42px;
  padding: 10px 12px;
}

.skip-button {
  pointer-events: auto;
  width: clamp(108px, 28vw, 144px);
  min-width: 0;
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 3px;
  box-shadow: none;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.skip-button img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  user-select: none;
}

.skip-button:active {
  filter: brightness(0.98);
  transform: translateY(2px);
}

.gacha-stage {
  position: relative;
  width: min(620px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(22px, 5svh, 44px) 0 calc(clamp(22px, 5svh, 44px) + env(safe-area-inset-bottom));
}

.play-machine {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(280px, 70vw, 306px);
  max-width: 82%;
  translate: -50% -50%;
  transform-origin: 50% 68%;
}

.play-screen:not(.is-touch-fading):not(.is-rolling):not(.is-capsule-ready):not(.is-opening):not(.has-result) .play-machine,
.play-screen.is-capsule-ready .play-machine {
  cursor: pointer;
}

.machine-frame {
  position: relative;
  z-index: 2;
}

.machine-frame img {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 22px 28px rgba(0, 63, 46, 0.36));
  user-select: none;
}

.machine-state {
  position: absolute !important;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.play-screen.is-rolling .play-machine {
  animation: machine-shake 0.5s ease-in-out 2;
}

.play-screen.is-rolling .machine-state-turn {
  animation: machine-frame-turn var(--roll-duration) linear forwards;
}

.play-screen.is-rolling .machine-state-capsules {
  animation: machine-frame-capsules var(--roll-duration) linear forwards;
}

.play-screen.is-capsule-ready .machine-state-open,
.play-screen.is-opening .machine-state-open {
  opacity: 1;
}

.play-screen.is-rolling .machine-state-open {
  animation: machine-frame-open var(--roll-duration) linear forwards;
}

.outlet-glow {
  position: absolute;
  left: 18%;
  top: 69%;
  z-index: 3;
  width: 32%;
  aspect-ratio: 1;
  border-radius: 8px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.75), rgba(0, 153, 68, 0.06) 64%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}

.play-screen.is-rolling .outlet-glow,
.play-screen.is-opening .outlet-glow {
  opacity: 1;
  animation: pulse 0.62s ease-in-out infinite alternate;
}

.touch-button {
  position: absolute;
  left: 50%;
  bottom: calc(clamp(20px, 5svh, 44px) + env(safe-area-inset-bottom));
  z-index: 6;
  width: min(350px, calc(100vw - 24px));
  min-height: 70px;
  padding: 0;
  background: transparent;
  border: 0;
  translate: -50% 0;
  animation: touch-bounce 1s ease-in-out infinite;
}

.touch-button img {
  display: block;
  width: 100%;
  height: auto;
  max-height: clamp(104px, 16svh, 128px);
  object-fit: contain;
  pointer-events: none;
}

.play-screen.is-rolling .touch-button,
.play-screen.is-capsule-ready .touch-button,
.play-screen.is-opening .touch-button,
.play-screen.has-result .touch-button {
  opacity: 0;
  pointer-events: none;
}

.play-screen.is-touch-fading .touch-button {
  pointer-events: none;
  animation: touch-fade-out var(--touch-fade-duration) ease forwards;
}

.capsule {
  position: absolute;
  left: 34%;
  top: 82%;
  z-index: 4;
  display: none;
  width: 74px;
  aspect-ratio: 1;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: default;
  transform: translate(-50%, -50%) scale(0.35);
}

.capsule img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(0, 63, 46, 0.28));
  pointer-events: none;
}

.capsule-closed {
  z-index: 1;
}

.capsule-focus-blur {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  display: block;
  width: 100vw;
  height: 100svh;
  border-radius: 0;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.14) 34%, transparent 66%),
    linear-gradient(135deg, rgba(240, 255, 249, 0.28), rgba(0, 115, 76, 0.3));
  opacity: 0;
  -webkit-backdrop-filter: blur(10px) saturate(1.18);
  backdrop-filter: blur(10px) saturate(1.18);
  transform: translate3d(-50%, -50%, 0);
  transition: opacity 1s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
  pointer-events: none;
  contain: paint;
}

.capsule-open-label {
  position: absolute;
  left: 50%;
  top: calc(58% - clamp(196px, 49vw, 254px));
  z-index: 6;
  display: none;
  width: clamp(210px, 52vw, 286px);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  user-select: none;
}

.play-screen.is-capsule-ready .capsule-open-label {
  cursor: pointer;
  pointer-events: auto;
}

.capsule-open {
  z-index: 2;
  opacity: 0;
}

.play-screen.is-rolling .capsule {
  display: block;
  animation: capsule-exit var(--roll-duration) cubic-bezier(0.18, 0.88, 0.21, 1) forwards;
}

.play-screen.is-capsule-ready .capsule,
.play-screen.is-opening .capsule {
  display: block;
  left: 50%;
  top: 58%;
  width: clamp(166px, 50vw, 232px);
  transform: translate(-50%, -50%) scale(1);
}

.play-screen.is-capsule-ready .capsule {
  cursor: pointer;
  animation: capsule-ready-bounce 1.2s ease-in-out infinite;
}

.play-screen.is-capsule-ready .capsule-open-label {
  display: block;
}

.play-screen.is-focus-blur .capsule-focus-blur {
  opacity: 1;
}

.play-screen.is-opening .capsule-closed {
  opacity: 0;
}

.play-screen.is-opening .capsule-open {
  opacity: 1;
  animation: capsule-open-pop 0.58s cubic-bezier(0.18, 0.88, 0.23, 1.25) both;
}

.play-screen.has-result .capsule {
  display: none;
}

.play-screen.has-result .capsule-closed {
  opacity: 0;
}

.play-screen.has-result .capsule-open {
  opacity: 1;
}

.result-panel {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: center;
  min-height: 100%;
  padding: max(22px, env(safe-area-inset-top)) 18px max(22px, env(safe-area-inset-bottom));
  overflow: hidden;
  color: var(--white);
  text-align: center;
  --rarity-main: #009944;
  --rarity-deep: #006f37;
  --rarity-accent: #caff59;
  --rarity-hot: #ffffff;
  --result-glow: rgba(0, 153, 68, 0.46);
  --result-ray-opacity: 0.25;
  --result-spark-opacity: 0.55;
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.2), transparent 24%),
    radial-gradient(circle at 50% 54%, var(--result-glow), transparent 54%),
    linear-gradient(180deg, rgba(0, 74, 45, 0.2), rgba(0, 45, 34, 0.58));
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  backdrop-filter: blur(10px) saturate(1.2);
}

.result-panel[data-rarity-tier="r"] {
  --rarity-main: #148dff;
  --rarity-deep: #074fa8;
  --rarity-accent: #94f0ff;
  --rarity-hot: #ffffff;
  --result-glow: rgba(20, 141, 255, 0.52);
  --result-ray-opacity: 0.34;
  --result-spark-opacity: 0.72;
}

.result-panel[data-rarity-tier="sr"] {
  --rarity-main: #ffcf35;
  --rarity-deep: #b67600;
  --rarity-accent: #fff4a8;
  --rarity-hot: #ffffff;
  --result-glow: rgba(255, 196, 33, 0.64);
  --result-ray-opacity: 0.48;
  --result-spark-opacity: 0.85;
}

.result-panel[data-rarity-tier="ssr"] {
  --rarity-main: #ff4fd8;
  --rarity-deep: #6725ff;
  --rarity-accent: #fff271;
  --rarity-hot: #ffffff;
  --result-glow: rgba(255, 255, 255, 0.72);
  --result-ray-opacity: 0.58;
  --result-spark-opacity: 1;
}

.result-panel::before,
.result-panel::after {
  position: absolute;
  inset: -28%;
  content: "";
  pointer-events: none;
}

.result-panel::before {
  z-index: 0;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.42), transparent 18%),
    radial-gradient(circle at 50% 52%, var(--result-glow), transparent 42%),
    radial-gradient(circle at 24% 22%, color-mix(in srgb, var(--rarity-accent) 50%, transparent), transparent 24%),
    radial-gradient(circle at 82% 78%, color-mix(in srgb, var(--rarity-main) 42%, transparent), transparent 28%);
  animation: result-aura 2.5s ease-in-out infinite;
}

.result-panel::after {
  z-index: 1;
  opacity: var(--result-ray-opacity);
  background: repeating-conic-gradient(from 0deg, transparent 0deg 9deg, rgba(255, 255, 255, 0.9) 10deg 12deg, transparent 13deg 20deg);
  -webkit-mask-image: radial-gradient(circle, #000 0 52%, transparent 72%);
  mask-image: radial-gradient(circle, #000 0 52%, transparent 72%);
  animation: result-rays 5.8s linear infinite;
}

.result-fx {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.result-burst,
.result-ring,
.result-sparkles {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
}

.result-burst {
  width: min(126vw, 620px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.72;
  background:
    conic-gradient(from 8deg, transparent 0 8deg, color-mix(in srgb, var(--rarity-hot) 82%, transparent) 9deg 11deg, transparent 12deg 23deg),
    radial-gradient(circle, color-mix(in srgb, var(--rarity-accent) 34%, transparent) 0 16%, transparent 62%);
  filter: blur(0.1px);
  animation: result-burst-spin 8s linear infinite;
}

.result-ring {
  width: min(88vw, 420px);
  aspect-ratio: 1;
  border: 3px solid color-mix(in srgb, var(--rarity-hot) 72%, transparent);
  border-radius: 50%;
  box-shadow:
    0 0 24px color-mix(in srgb, var(--rarity-accent) 54%, transparent),
    inset 0 0 24px color-mix(in srgb, var(--rarity-main) 36%, transparent);
  opacity: 0;
}

.result-ring-one {
  animation: result-ring 1.5s 0.08s ease-out both;
}

.result-ring-two {
  width: min(104vw, 500px);
  animation: result-ring 1.8s 0.24s ease-out both;
}

.result-sparkles {
  inset: 0;
  left: 0;
  top: 0;
  opacity: var(--result-spark-opacity);
  transform: none;
  background-image:
    radial-gradient(circle, var(--rarity-hot) 0 2px, transparent 2.5px),
    radial-gradient(circle, var(--rarity-accent) 0 2px, transparent 2.4px),
    radial-gradient(circle, rgba(255, 255, 255, 0.84) 0 1.6px, transparent 2px);
  background-position: 16% 25%, 82% 33%, 68% 72%;
  background-size: 112px 112px, 144px 144px, 96px 96px;
  animation: result-sparkle-drift 2.6s ease-in-out infinite;
}

.play-screen.has-result .result-panel {
  animation: result-panel-in 0.42s ease-out both;
}

.result-showcase {
  position: relative;
  z-index: 3;
  width: min(92vw, 480px);
  height: min(65svh, 560px);
  min-height: 410px;
  margin: 0 auto;
}

.result-showcase::before,
.result-showcase::after {
  position: absolute;
  left: 50%;
  top: 52%;
  content: "";
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.result-showcase::before {
  z-index: 0;
  width: min(106vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 0 20%, color-mix(in srgb, var(--rarity-accent) 26%, transparent) 42%, transparent 70%);
  filter: blur(6px);
  opacity: 0.78;
}

.result-showcase::after {
  z-index: 1;
  width: min(82vw, 410px);
  aspect-ratio: 1;
  border: 2px solid color-mix(in srgb, var(--rarity-hot) 58%, transparent);
  border-radius: 50%;
  box-shadow:
    0 0 18px color-mix(in srgb, var(--rarity-accent) 40%, transparent),
    inset 0 0 18px color-mix(in srgb, var(--rarity-main) 28%, transparent);
  opacity: 0.46;
}

.result-get-logo {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 6;
  display: block;
  width: min(74%, 360px);
  height: auto;
  object-fit: contain;
  margin: 0;
  filter:
    drop-shadow(0 12px 18px rgba(0, 39, 26, 0.3))
    drop-shadow(0 0 18px color-mix(in srgb, var(--rarity-accent) 50%, transparent));
  animation: result-get-pop 0.6s cubic-bezier(0.18, 0.88, 0.23, 1.25) both;
}

.result-panel[data-rarity-tier="ssr"] .result-get-logo {
  filter:
    drop-shadow(0 14px 22px rgba(0, 20, 48, 0.34))
    drop-shadow(0 0 24px rgba(255, 255, 255, 0.56));
}

.prize-rarity {
  position: absolute;
  left: 50%;
  top: 22.5%;
  z-index: 7;
  display: block;
  width: clamp(82px, 23vw, 122px);
  height: auto;
  max-height: 13svh;
  margin: 0;
  object-fit: contain;
  filter:
    drop-shadow(0 12px 18px rgba(0, 39, 26, 0.34))
    drop-shadow(0 0 18px color-mix(in srgb, var(--rarity-accent) 44%, transparent));
  animation: result-rarity-slam 0.55s 0.48s cubic-bezier(0.18, 0.88, 0.23, 1.25) both;
}

.result-panel[data-rarity-tier="sr"] .prize-rarity,
.result-panel[data-rarity-tier="ssr"] .prize-rarity,
.result-panel[data-rarity-tier="ur"] .prize-rarity {
  width: clamp(130px, 39vw, 220px);
  max-height: 14svh;
  top: 21%;
}

.result-open-capsule {
  position: absolute;
  left: 50%;
  top: 76%;
  z-index: 2;
  display: block;
  width: clamp(154px, 44vw, 230px);
  height: auto;
  opacity: 0.82;
  filter:
    drop-shadow(0 22px 26px rgba(0, 33, 24, 0.3))
    drop-shadow(0 0 18px color-mix(in srgb, var(--rarity-accent) 34%, transparent));
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: result-capsule-settle 0.68s 0.1s cubic-bezier(0.18, 0.88, 0.23, 1.16) both;
}

.prize-sticker {
  position: absolute;
  left: 50%;
  top: 68%;
  display: grid;
  z-index: 4;
  gap: 12px;
  align-content: center;
  justify-items: center;
  width: min(72vw, 318px);
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  perspective: 900px;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%) rotate(-1.5deg);
  animation: result-sticker-rise 0.92s 0.24s cubic-bezier(0.18, 0.88, 0.23, 1.16) both;
}

.prize-sticker::before {
  position: absolute;
  inset: 11% 2% 15%;
  z-index: -1;
  content: "";
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.28) 46%, transparent 70%),
    radial-gradient(circle, color-mix(in srgb, var(--rarity-accent) 48%, transparent), transparent 72%);
  border-radius: 999px;
  filter: blur(14px);
  opacity: 0.92;
  transform: scale(0.95);
}

.prize-sticker.is-secret::before {
  opacity: 1;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.92), rgba(255, 242, 113, 0.48) 40%, rgba(255, 79, 216, 0.24) 58%, transparent 74%);
}

.sticker-back-image,
.prize-sticker [data-prize-image] {
  display: block;
  width: min(68vw, 304px);
  max-height: min(35svh, 320px);
  margin: 0 auto;
  object-fit: contain;
  border-radius: 6px;
  backface-visibility: hidden;
  transform-origin: center;
}

.sticker-back-image {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  --sticker-back-filter:
    brightness(0) invert(1) saturate(0) contrast(0.88)
    drop-shadow(0 20px 24px rgba(0, 32, 24, 0.24))
    drop-shadow(0 0 14px color-mix(in srgb, var(--rarity-accent) 44%, transparent));
  transform: translate(-50%, -50%) rotateX(0deg);
  filter: var(--sticker-back-filter);
  opacity: 0.96;
  pointer-events: none;
  animation: result-sticker-back-flip 1.45s 0.34s cubic-bezier(0.18, 0.88, 0.23, 1.12) both;
}

.prize-sticker [data-prize-image] {
  position: relative;
  z-index: 4;
  filter:
    drop-shadow(0 18px 20px rgba(0, 32, 24, 0.28))
    drop-shadow(0 0 18px color-mix(in srgb, var(--rarity-accent) 60%, transparent));
  animation: result-sticker-front-flip 1.45s 0.34s cubic-bezier(0.18, 0.88, 0.23, 1.12) both;
}

.result-panel .result-actions {
  position: relative;
  z-index: 3;
  justify-content: center;
  width: min(92vw, 390px);
  margin-top: 8px;
}

.result-panel .primary-action,
.result-panel .secondary-action {
  min-height: 46px;
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0, 39, 26, 0.22);
}

.result-panel .primary-action {
  background: linear-gradient(180deg, var(--rarity-main), var(--rarity-deep));
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.result-panel .secondary-action {
  color: var(--rarity-deep);
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.9);
}

.section {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 54px 0;
}

.section-heading {
  margin-bottom: 22px;
}

.lineup-grid {
  display: grid;
  gap: 14px;
}

.lineup-card {
  min-height: 170px;
  padding: 22px;
}

.lineup-card h3 {
  margin: 12px 0 10px;
  color: var(--navy);
  font-size: 1.35rem;
  line-height: 1.3;
}

.lineup-card p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.secret-card {
  color: var(--white);
  background: linear-gradient(135deg, #162036 0%, #29364e 100%);
}

.secret-card .card-label,
.secret-card h3,
.secret-card p {
  color: var(--white);
}

.howto {
  display: grid;
  gap: 22px;
  padding-top: 20px;
}

.coin-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  min-height: 124px;
  color: var(--white);
  background: var(--ink);
  border: 6px solid #f8f8f8;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.coin-cell {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  padding: 16px 10px;
  text-align: center;
}

.coin-cell + .coin-cell {
  border-left: 2px solid rgba(255, 255, 255, 0.42);
}

.coin-cell span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(82px, 100%);
  aspect-ratio: 1;
  font-weight: 800;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.coin-cell strong {
  font-size: clamp(1.5rem, 8vw, 2.3rem);
  line-height: 1;
}

.blue {
  background: linear-gradient(145deg, #083f99, #0d68ce);
}

.red {
  background: linear-gradient(145deg, #b70f20, #df2938);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: min(360px, calc(100% - 36px));
  padding: 14px 16px;
  color: var(--white);
  font-weight: 800;
  background: var(--navy);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast.is-visible {
  animation: toast-in 180ms ease-out;
}

@keyframes drift {
  0% {
    transform: translate3d(-12px, 14px, 0) rotate(45deg);
  }
  50% {
    transform: translate3d(16px, -18px, 0) rotate(58deg);
  }
  100% {
    transform: translate3d(-12px, 14px, 0) rotate(45deg);
  }
}

@keyframes background-pan {
  from {
    transform: scale(1.06) translate3d(-1.2%, 0, 0);
  }
  to {
    transform: scale(1.1) translate3d(1.2%, -1.2%, 0);
  }
}

@keyframes touch-bounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes touch-fade-out {
  0% {
    filter: blur(0);
    opacity: 1;
    transform: scale(1.03);
  }
  100% {
    filter: blur(4px);
    opacity: 0;
    transform: scale(0.94);
  }
}

@keyframes machine-shake {
  0%,
  100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(-1.8deg);
  }
  75% {
    transform: rotate(1.8deg);
  }
}

@keyframes machine-frame-turn {
  0%,
  26% {
    opacity: 1;
  }
  27%,
  100% {
    opacity: 0;
  }
}

@keyframes machine-frame-capsules {
  0%,
  26% {
    opacity: 0;
  }
  27%,
  73% {
    opacity: 1;
  }
  74%,
  100% {
    opacity: 0;
  }
}

@keyframes machine-frame-open {
  0%,
  73% {
    opacity: 0;
  }
  74%,
  100% {
    opacity: 1;
  }
}

@keyframes pulse {
  from {
    transform: scale(0.9);
    opacity: 0.35;
  }
  to {
    transform: scale(1.08);
    opacity: 0.95;
  }
}

@keyframes capsule-exit {
  0% {
    left: 34%;
    top: 82%;
    transform: translate(-50%, -50%) scale(0.12) rotate(0deg);
    opacity: 0;
  }
  74% {
    left: 34%;
    top: 82%;
    transform: translate(-50%, -50%) scale(0.12) rotate(0deg);
    opacity: 0;
  }
  82% {
    left: 35%;
    top: 80%;
    transform: translate(-50%, -50%) scale(0.46) rotate(210deg);
    opacity: 1;
  }
  90% {
    left: 38%;
    top: 72%;
    transform: translate(-50%, -50%) scale(0.82) rotate(430deg);
    opacity: 1;
  }
  100% {
    left: 50%;
    top: 58%;
    transform: translate(-50%, -50%) scale(1) rotate(700deg);
    opacity: 1;
  }
}

@keyframes capsule-ready-bounce {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -54%) scale(1);
  }
}

@keyframes capsule-open-pop {
  0% {
    transform: scale(0.78) rotate(-5deg);
    opacity: 0;
  }
  58% {
    transform: scale(1.1) rotate(3deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes result-panel-in {
  from {
    opacity: 0;
    filter: brightness(1.2);
  }
  to {
    opacity: 1;
    filter: brightness(1);
  }
}

@keyframes result-aura {
  0%,
  100% {
    opacity: 0.78;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.06);
  }
}

@keyframes result-rays {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes result-burst-spin {
  from {
    transform: translate(-50%, -50%) rotate(0deg) scale(0.96);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg) scale(0.96);
  }
}

@keyframes result-ring {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.28);
  }
  28% {
    opacity: 0.94;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.34);
  }
}

@keyframes result-sparkle-drift {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
    filter: brightness(1);
  }
  50% {
    transform: translate3d(0, -10px, 0);
    filter: brightness(1.25);
  }
}

@keyframes result-get-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 18px) rotate(-8deg) scale(0.55);
  }
  62% {
    opacity: 1;
    transform: translate(-50%, -4px) rotate(-2deg) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) rotate(-2deg) scale(1);
  }
}

@keyframes result-rarity-slam {
  0% {
    opacity: 0;
    transform: translate(-50%, -18px) rotate(8deg) scale(1.45);
  }
  66% {
    opacity: 1;
    transform: translate(-50%, 3px) rotate(3deg) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, 0) rotate(3deg) scale(1);
  }
}

@keyframes result-capsule-settle {
  0% {
    opacity: 0;
    transform: translate(-50%, -34%) scale(0.72) rotate(8deg);
  }
  66% {
    opacity: 0.86;
    transform: translate(-50%, -50%) scale(1.06) rotate(-2deg);
  }
  100% {
    opacity: 0.82;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
}

@keyframes result-sticker-rise {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 96px)) rotate(-10deg) scale(0.42);
    filter: blur(5px);
  }
  54% {
    opacity: 1;
    transform: translate(-50%, calc(-50% - 10px)) rotate(2deg) scale(1.08);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(-1.5deg) scale(1);
    filter: blur(0);
  }
}

@keyframes result-sticker-back-flip {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotateX(0deg) scale(0.74);
    filter: var(--sticker-back-filter) blur(5px);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) rotateX(0deg) scale(0.98);
    filter: var(--sticker-back-filter);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) rotateX(-84deg) scale(1.04);
    filter: var(--sticker-back-filter);
  }
  51%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotateX(-100deg) scale(1.04);
    filter: var(--sticker-back-filter);
  }
}

@keyframes result-sticker-front-flip {
  0%,
  48% {
    opacity: 0;
    transform: rotateX(180deg) scale(0.96);
  }
  49% {
    opacity: 1;
    transform: rotateX(88deg) scale(1.02);
  }
  72% {
    opacity: 1;
    transform: rotateX(-10deg) scale(1.06);
  }
  100% {
    opacity: 1;
    transform: rotateX(0deg) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (max-height: 700px) {
  .gacha-stage {
    gap: clamp(34px, 6svh, 52px);
    padding-top: clamp(16px, 4svh, 28px);
    padding-bottom: calc(clamp(16px, 4svh, 28px) + env(safe-area-inset-bottom));
  }

  .touch-button {
    min-height: 64px;
  }

  .touch-button img {
    max-height: clamp(96px, 15svh, 116px);
  }

  .result-showcase {
    width: min(90vw, 420px);
    height: min(62svh, 450px);
    min-height: 360px;
  }

  .result-showcase::before {
    width: min(98vw, 430px);
    filter: blur(5px);
  }

  .result-showcase::after {
    width: min(76vw, 340px);
  }

  .result-get-logo {
    width: min(70%, 320px);
    max-height: 15svh;
  }

  .prize-rarity {
    top: 22%;
    width: clamp(72px, 22vw, 108px);
    max-height: 11svh;
  }

  .result-panel[data-rarity-tier="sr"] .prize-rarity,
  .result-panel[data-rarity-tier="ssr"] .prize-rarity,
  .result-panel[data-rarity-tier="ur"] .prize-rarity {
    top: 20.5%;
    width: clamp(112px, 35vw, 188px);
    max-height: 12svh;
  }

  .result-open-capsule {
    top: 74%;
    width: clamp(128px, 38vw, 184px);
  }

  .prize-sticker {
    top: 64%;
    width: min(72vw, 300px);
  }

  .sticker-back-image,
  .prize-sticker [data-prize-image] {
    width: min(66vw, 270px);
    max-height: 31svh;
  }

  .result-panel .result-actions {
    margin-top: 8px;
  }
}

@media (min-width: 720px) {
  #play,
  #lineup {
    scroll-margin-top: 82px;
  }

  .site-header {
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    min-height: 72px;
    padding: 14px clamp(18px, 4vw, 56px);
  }

  .site-nav a {
    flex: initial;
  }

  .hero {
    grid-template-columns: minmax(0, 0.92fr) minmax(320px, 0.78fr);
    align-items: center;
    gap: clamp(28px, 5vw, 72px);
    min-height: calc(100svh - 72px);
    padding: clamp(28px, 6vw, 76px) 0;
  }

  .machine-figure {
    order: initial;
  }

  .machine-figure img {
    width: min(100%, 490px);
    max-height: calc(100svh - 118px);
  }

  .lead {
    font-size: clamp(1rem, 1.8vw, 1.16rem);
  }

  .quick-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-actions,
  .result-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .play-machine {
    width: min(36vw, 380px);
    max-width: 78%;
  }

  .touch-button {
    width: min(66vw, 500px);
  }

  .touch-button img {
    max-height: 156px;
  }

  .lineup-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .howto {
    grid-template-columns: minmax(0, 0.8fr) minmax(280px, 0.7fr);
    align-items: center;
  }
}
