:root {
  --gold: #ffd34d;
  --pink: #ff4d9d;
  --cyan: #3ce0ff;
  --vio: #7b5cff;
  --rainbow: #ff3b6b, #ff9f1c, #ffe14d, #3ddc84, #3cc8ff, #7b6bff, #ff6bf0, #ff3b6b;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --c1: #fff; --c2: #b9a8ff; --c3: #5b3fd6; --glow: #b9a8ff;
}
[data-tier="5"] { --c1: #fff; --c2: #ff8df3; --c3: #7b6bff; --glow: #ff9ff3; }
[data-tier="4"] { --c1: #fff7c2; --c2: #ffd34d; --c3: #c98300; --glow: #ffd34d; }
[data-tier="3"] { --c1: #fff; --c2: #cfd8e6; --c3: #7c8aa3; --glow: #dfe9ff; }
[data-tier="2"] { --c1: #ffe0c2; --c2: #e89a5b; --c3: #8f4a1c; --glow: #ffb37a; }
[data-tier="1"] { --c1: #d6f3ff; --c2: #49b9ff; --c3: #1560b8; --glow: #6fd0ff; }
[data-tier="0"] { --c1: #dcffe6; --c2: #4fd68a; --c3: #17824a; --glow: #7df0ae; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  height: 100%; margin: 0; background: #07031a; color: #fff;
  font-family: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-weight: 500; line-height: 1.5;
  -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}
p, h1, h2 { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }

#app {
  position: relative; max-width: 480px; height: 100vh; height: 100dvh; margin: 0 auto; overflow: hidden; overflow: clip;
  background: radial-gradient(120% 80% at 50% 0%, #4a1fa8 0%, #1f0d52 45%, #0b0524 100%);
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 80; }
#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 90; }
#flash.go { animation: flash .55s ease-out; }
.shake { animation: shake .45s; }

/* twinkling stars */
#ambient, .result-stars { position: absolute; inset: 0; pointer-events: none; }
#ambient i, .result-stars i {
  position: absolute; width: var(--s); height: var(--s); background: #fff;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: twinkle 2.6s ease-in-out infinite;
}
#ambient i:nth-child(3n) { background: var(--gold); }
#ambient i:nth-child(4n) { background: var(--cyan); }

/* rotating light rays */
.rays {
  position: absolute; left: 50%; top: 36%; width: 64vmax; height: 64vmax; pointer-events: none;
  background: repeating-conic-gradient(rgba(255, 255, 255, .22) 0 7deg, transparent 9deg 18deg, rgba(255, 255, 255, .22) 20deg);
  -webkit-mask: radial-gradient(circle, #000 0, transparent 68%); mask: radial-gradient(circle, #000 0, transparent 68%);
  will-change: transform; animation: rays 28s linear infinite;
}

/* ---------- topbar ---------- */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; height: 52px; padding: 0 10px; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; pointer-events: none;
}
.tb-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; pointer-events: auto;
  background: rgba(255, 255, 255, .14); font-size: 20px; font-weight: 900; line-height: 1;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.tb-btn:active { transform: scale(.9); }
.tb-btn.off { opacity: .4; text-decoration: line-through; }
#tb-sound { margin-left: auto; }
.steps { position: absolute; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; font-size: 11px; font-weight: 800; }
.steps span { padding: 3px 10px; border-radius: 99px; background: rgba(255, 255, 255, .1); opacity: .55; }
.steps span.on { background: var(--gold); color: #3a1d00; opacity: 1; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; overflow: clip;
  padding: 64px 20px calc(20px + var(--safe-b));
  opacity: 0; visibility: hidden; transform: translateY(18px) scale(.98);
  transition: opacity .35s, transform .35s cubic-bezier(.2, 1.2, .4, 1), visibility 0s .35s;
}
.screen.active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.h { font-size: 24px; font-weight: 900; text-align: center; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.sub { margin: 6px 0 18px; font-size: 13px; text-align: center; opacity: .8; }
.mini-note { margin-top: 10px; font-size: 11px; opacity: .7; text-align: center; }

.btn {
  position: relative; overflow: hidden; border: 0; border-radius: 999px; padding: 14px 22px;
  font-weight: 900; font-size: 16px; color: #3a1d00;
  background: linear-gradient(#fff6c2, #ffd34d 45%, #ffab00);
  box-shadow: 0 6px 0 #b86e00, 0 12px 24px rgba(255, 180, 0, .3), inset 0 2px 0 rgba(255, 255, 255, .8);
  transition: transform .08s, box-shadow .08s, filter .2s;
}
.btn::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: skewX(-20deg); animation: sweep 2.8s ease-in-out infinite;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b86e00, inset 0 2px 0 rgba(255, 255, 255, .8); }
.btn:disabled { filter: grayscale(.9) brightness(.75); box-shadow: 0 4px 0 #444; }
.btn:disabled::after { display: none; }
.btn-xl { padding: 18px 28px; font-size: 19px; }
.btn-ghost { color: #fff; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4); }
.btn-ghost::after { display: none; }
.btn-ghost:active { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .4); }
.btn-red { color: #fff; background: linear-gradient(#ff8a8a, #ff3b4e 45%, #c2102a); box-shadow: 0 6px 0 #7a0a1a, inset 0 2px 0 rgba(255, 255, 255, .6); }
.btn-line { color: #fff; background: linear-gradient(#5be07f, #06c755 50%, #05a045); box-shadow: 0 6px 0 #04692d, inset 0 2px 0 rgba(255, 255, 255, .6); }
.link-btn { border: 0; background: none; padding: 8px; font-weight: 800; font-size: 14px; text-decoration: underline; opacity: .9; }

#toast {
  position: absolute; left: 50%; bottom: calc(110px + var(--safe-b)); z-index: 70; max-width: 86%;
  padding: 10px 18px; border-radius: 99px; background: rgba(20, 8, 50, .92); border: 2px solid var(--gold);
  font-weight: 800; font-size: 14px; text-align: center; pointer-events: none;
  opacity: 0; transform: translate(-50%, 20px);
}
#toast.show { animation: toast 2.4s both; }

/* ---------- medal ---------- */
.medal {
  position: relative; width: 150px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: radial-gradient(circle at 30% 25%, var(--c1), var(--c2) 45%, var(--c3));
  box-shadow: inset 0 0 0 6px rgba(255, 255, 255, .55), inset 0 -10px 20px rgba(0, 0, 0, .2), 0 0 44px var(--glow), 0 8px 0 rgba(0, 0, 0, .25);
  font-weight: 900; font-size: 46px; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .3), 0 0 14px rgba(0, 0, 0, .25);
}
.medal span { position: relative; z-index: 1; }
.medal[data-tier="5"]::before {
  content: ''; position: absolute; inset: 6px; border-radius: 50%;
  background: conic-gradient(var(--rainbow)); animation: spin 2.4s linear infinite; opacity: .85;
}
.medal[data-tier="5"]::after {
  content: ''; position: absolute; inset: 18px; border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #fff, #ff8df3 55%, #7b6bff);
}
.medal.sm { width: 104px; font-size: 32px; }
.medal.lg { width: 180px; font-size: 56px; }
.medal.spin { animation: flipy .28s linear infinite; }
.medal.pop { animation: pop .4s; }
.medal.shake-x { animation: shakex .4s; }
.pop { animation: pop .35s; }

/* ---------- title ---------- */
#s-title { align-items: center; justify-content: center; text-align: center; }
.title-rays { top: 40%; opacity: .5; }
.title-inner { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.title-kicker { padding: 4px 14px; border-radius: 99px; background: rgba(255, 255, 255, .14); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.logo {
  font-size: clamp(52px, 17vw, 82px); font-weight: 900; letter-spacing: .02em; line-height: 1;
  background: linear-gradient(100deg, #fff, #ffe14d, #ff4d9d, #7b6bff, #3ce0ff, #fff) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .35)) drop-shadow(0 0 22px rgba(255, 77, 157, .7));
  animation: slide 3.5s linear infinite;
}
.title-copy { font-size: 19px; font-weight: 900; }
.title-orbs { position: relative; width: 220px; height: 92px; }
.title-orbs i {
  position: absolute; width: 54px; height: 54px; border-radius: 50%; top: 20px; left: calc(var(--n) * 42px);
  background: linear-gradient(var(--col) 50%, #f4f1ff 50%);
  box-shadow: inset -5px -6px 10px rgba(0, 0, 0, .2), inset 5px 6px 8px rgba(255, 255, 255, .6), 0 0 22px var(--col);
  animation: float 2.4s ease-in-out infinite; animation-delay: calc(var(--n) * -.45s);
}
.title-orbs i:nth-child(1) { --n: 0; --col: #ff5c8a; }
.title-orbs i:nth-child(2) { --n: 1; --col: #ffb23d; }
.title-orbs i:nth-child(3) { --n: 2; --col: #4fd68a; }
.title-orbs i:nth-child(4) { --n: 3; --col: #49b9ff; }
.title-orbs i:nth-child(5) { --n: 4; --col: #a77bff; }
.kv { display: none; width: 78vw; max-width: 340px; height: 30vh; background: var(--img-kv) center / contain no-repeat; animation: float 3s ease-in-out infinite; }
.img-kv .kv { display: block; }
.img-kv .title-orbs { display: none; }
#btn-start { margin-top: 14px; animation: pulse 1.1s ease-in-out infinite alternate; }
.note { max-width: 280px; font-size: 11px; opacity: .7; }
.credit { position: absolute; left: 0; right: 0; bottom: calc(14px + var(--safe-b)); font-size: 11px; opacity: .6; text-align: center; }

/* ---------- loading ---------- */
#s-loading { align-items: center; justify-content: center; }
.loader { width: 78%; text-align: center; }
.loader-capsule { width: 72px; height: 72px; margin: 0 auto 18px; animation: bounce .55s cubic-bezier(.3, 0, .7, 1) infinite alternate; }
.loader-capsule i {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(var(--pink) 50%, #f4f1ff 50%);
  box-shadow: inset -6px -8px 12px rgba(0, 0, 0, .2), inset 6px 8px 10px rgba(255, 255, 255, .6), 0 0 26px var(--pink);
  animation: spin 1.1s linear infinite;
}
.loader-text { font-weight: 900; font-size: 18px; margin-bottom: 12px; }
.bar { height: 14px; border-radius: 99px; background: rgba(255, 255, 255, .15); overflow: hidden; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .4); }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--rainbow)) 0 0 / 200% 100%; animation: slide 1.2s linear infinite; }
.loader-tip { margin-top: 18px; font-size: 13px; opacity: .85; min-height: 3em; }

/* ---------- type ---------- */
.type-list { display: flex; flex-direction: column; gap: 16px; margin-top: 6px; }
.type-card {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left; padding: 22px 16px; border: 0; border-radius: 24px;
  background: linear-gradient(140deg, #ff6aa9, #c2389b 55%, #7b3fd6);
  box-shadow: 0 7px 0 #4d1a7a, 0 16px 30px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .5);
  transition: transform .08s, box-shadow .08s;
}
.type-card[data-type="mileage"] { background: linear-gradient(140deg, #3ce0ff, #2d8fe8 55%, #5b3fd6); box-shadow: 0 7px 0 #24206e, 0 16px 30px rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .5); }
.type-card:active { transform: translateY(5px); box-shadow: 0 2px 0 #4d1a7a; }
.tc-icon { flex: none; width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; font-size: 34px; background: rgba(255, 255, 255, .25); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5); }
.tc-body b { display: block; font-size: 20px; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.tc-body span { font-size: 12.5px; font-weight: 800; opacity: .95; }
.tc-tag { position: absolute; top: -10px; right: 14px; padding: 3px 12px; border-radius: 99px; background: var(--gold); color: #3a1d00; font-size: 11px; font-weight: 900; box-shadow: 0 3px 0 rgba(0, 0, 0, .25); }

/* ---------- effect select ---------- */
.fx-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; overflow-y: auto; padding: 4px 2px 8px; }
.fx-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 16px 8px 12px; border: 0; border-radius: 20px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, .07));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .28), 0 5px 0 rgba(0, 0, 0, .3);
  transition: transform .08s;
}
.fx-card:active { transform: translateY(4px) scale(.98); }
.fx-ico { font-size: 40px; line-height: 1.15; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .35)); animation: float 2.6s ease-in-out infinite; }
.fx-card:nth-child(even) .fx-ico { animation-delay: -1.3s; }
.fx-card b { font-size: 16px; font-weight: 900; }
.fx-desc { font-size: 11px; opacity: .85; }
.fx-cat { margin-top: 6px; padding: 2px 8px; border-radius: 99px; background: rgba(255, 211, 77, .2); color: var(--gold); font-size: 10px; font-weight: 800; }

/* ---------- grade select ---------- */
.grade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grade-btn {
  padding: 16px 10px; border: 0; border-radius: 18px; font-weight: 900; font-size: 24px;
  background: linear-gradient(160deg, var(--c2), var(--c3)); text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  box-shadow: 0 5px 0 rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 255, 255, .55);
  transition: transform .08s;
}
.grade-btn:active { transform: translateY(4px); }
.grade-btn[data-tier="5"] { grid-column: 1 / -1; font-size: 30px; background: linear-gradient(100deg, var(--rainbow)) 0 0 / 200% 100%; animation: slide 3s linear infinite; }
.grade-btn.random { grid-column: 1 / -1; font-size: 20px; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5), 0 5px 0 rgba(0, 0, 0, .4); }
.grade-btn small { display: block; font-size: 11px; font-weight: 800; opacity: .8; }

/* ---------- play ---------- */
#s-play { padding: 52px 0 calc(8px + var(--safe-b)); }
.play-head { text-align: center; font-size: 12px; font-weight: 800; opacity: .75; }
#stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
#hint { height: 56px; padding: 0 16px; text-align: center; font-weight: 900; font-size: 17px; color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, .4); }

/* gacha */
.gacha-cv { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.gm-dome-back { position: absolute; z-index: 1; border-radius: 50%; background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, .16), rgba(255, 255, 255, .05)); }
.gm-dome {
  position: absolute; z-index: 3; border-radius: 50%; pointer-events: none; border: 4px solid rgba(255, 255, 255, .6);
  background: radial-gradient(circle at 28% 22%, rgba(255, 255, 255, .6) 0 6%, transparent 22%);
  box-shadow: inset 0 0 30px rgba(255, 255, 255, .25), 0 0 34px rgba(123, 92, 255, .7);
}
.gm-body {
  position: absolute; z-index: 4; border-radius: 22px 22px 28px 28px; background: linear-gradient(#ff5c8a, #c2185b);
  box-shadow: 0 8px 0 #7a0c38, inset 0 3px 0 rgba(255, 255, 255, .5), 0 20px 40px rgba(0, 0, 0, .4);
}
.img-gacha-body .gm-body { background: var(--img-gacha-body) center / 100% 100% no-repeat; box-shadow: none; }
.img-gacha-body .gm-plate, .img-gacha-body .gm-chute { display: none; }
.gm-plate { position: absolute; top: 7%; left: 50%; transform: translateX(-50%); padding: 2px 12px; border-radius: 99px; background: var(--gold); color: #7a0c38; font-weight: 900; font-size: 11px; letter-spacing: .15em; }
.gm-handle {
  position: absolute; left: 31%; top: 27%; width: 38%; aspect-ratio: 1; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle at 35% 30%, #fff, #cfcfe2); box-shadow: 0 5px 0 rgba(0, 0, 0, .3), inset 0 -4px 8px rgba(0, 0, 0, .15);
}
.gm-handle i { position: absolute; left: 37%; top: 8%; bottom: 8%; width: 26%; border-radius: 99px; background: linear-gradient(#ffe14d, #ffab00); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .7); }
.gm-handle.pulse { animation: glowpulse .7s ease-in-out infinite alternate; }
.gm-chute { position: absolute; left: 30%; bottom: 5%; width: 40%; height: 13%; border-radius: 10px; background: #3b0519; box-shadow: inset 0 4px 8px #000; }

.capsule { position: absolute; z-index: 6; width: var(--cs); height: var(--cs); transition: top .45s cubic-bezier(.3, 1.3, .5, 1), scale .45s; filter: drop-shadow(0 0 16px var(--glow)); }
.capsule.drop { animation: capdrop .65s cubic-bezier(.3, 0, .6, 1) both; }
.capsule.ready { animation: readybob .5s ease-in-out infinite alternate; }
.capsule.center { scale: 1.9; z-index: 9; }
.capsule.rattle, .chest.rattle { animation: rattle .12s linear infinite; }
.cap-top, .cap-bot { position: absolute; left: 0; width: 100%; height: 50%; transition: translate .25s ease-out, rotate .25s, opacity .25s; }
.cap-top { top: 0; border-radius: 999px 999px 0 0; background: linear-gradient(160deg, var(--c1), var(--c2) 40%, var(--c3)); box-shadow: inset 6px 8px 10px rgba(255, 255, 255, .55); }
.cap-bot { bottom: 0; border-radius: 0 0 999px 999px; background: linear-gradient(#f4f1ff, #c9c3e6); box-shadow: inset 0 4px 0 rgba(0, 0, 0, .15); }
.capsule[data-tier="plain"] { --c1: #d6f3ff; --c2: #8fd3ff; --c3: #3a8fe0; --glow: transparent; }
.capsule[data-tier="5"] .cap-top { background: linear-gradient(100deg, var(--rainbow)) 0 0 / 200% 100%; animation: slide 1.2s linear infinite; }
.capsule.open .cap-top { translate: 0 -70%; rotate: -24deg; opacity: 0; }
.capsule.open .cap-bot { translate: 0 70%; opacity: 0; }

.cutin {
  position: absolute; left: -20%; right: -20%; top: 38%; height: 96px; z-index: 8; display: grid; place-items: center; rotate: -7deg;
  background: linear-gradient(90deg, transparent, var(--c2) 20%, #fff 50%, var(--c2) 80%, transparent);
  box-shadow: 0 0 0 200vh rgba(0, 0, 0, .55); animation: cutin .9s both;
}
.cutin[data-tier="5"] { background: linear-gradient(90deg, transparent, var(--rainbow), transparent); }
.cutin span { font-size: 54px; font-weight: 900; font-style: italic; color: #fff; text-shadow: 0 4px 0 #3a1d00, 0 0 20px #fff; }

/* slot */
.slot {
  --ch: 68px; width: min(88%, 340px); padding: 14px 14px 18px; border-radius: 28px; text-align: center;
  background: linear-gradient(#ff5c8a, #b3124a); box-shadow: 0 10px 0 #6d0a2c, 0 0 44px rgba(255, 77, 157, .55), inset 0 3px 0 rgba(255, 255, 255, .5);
}
.slot-top { font-weight: 900; letter-spacing: .2em; color: var(--gold); text-shadow: 0 2px 0 #6d0a2c; }
.slot-lamps { display: flex; justify-content: space-between; margin: 8px 6px; }
.slot-lamps i { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); animation: lamp .6s steps(1) infinite; }
.slot-lamps i:nth-child(even) { animation-delay: -.3s; }
.slot-win { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; border-radius: 16px; background: #1a0626; box-shadow: inset 0 4px 12px #000; }
.reel { height: calc(var(--ch) * 3); overflow: hidden; border-radius: 10px; background: linear-gradient(#b9b9cc, #fff 28%, #fff 72%, #b9b9cc); }
.reel-strip { will-change: transform; }
.reel.blur .reel-strip { filter: blur(3px); }
.reel-cell { height: var(--ch); display: grid; place-items: center; font-weight: 900; font-size: 28px; color: var(--c3); }
.reel-cell[data-tier="5"] { background: linear-gradient(100deg, var(--rainbow)); -webkit-background-clip: text; background-clip: text; color: transparent; font-size: 30px; }
.payline { position: absolute; left: 2px; right: 2px; top: 50%; height: var(--ch); margin-top: calc(var(--ch) / -2); border: 3px solid var(--gold); border-radius: 12px; box-shadow: 0 0 14px var(--gold), inset 0 0 14px rgba(255, 211, 77, .4); pointer-events: none; }
.slot-win.hit .payline { animation: blink .15s 6; }
.reach { height: 44px; font-size: 30px; font-weight: 900; font-style: italic; color: var(--gold); text-shadow: 0 3px 0 #6d0a2c; opacity: 0; }
.reach.on { opacity: 1; animation: pulse .3s ease-in-out infinite alternate; }
.slot .btn { width: 80%; }
.slot .mini-note { margin-top: 14px; }

/* scratch */
.scratch-card {
  width: min(88%, 340px); padding: 16px; border-radius: 24px; text-align: center;
  background: linear-gradient(150deg, #ffe14d, #ff9f1c 60%, #ff4d9d); box-shadow: 0 8px 0 #a13a00, 0 0 40px rgba(255, 159, 28, .5), inset 0 3px 0 rgba(255, 255, 255, .6);
}
.sc-head { font-weight: 900; font-size: 20px; color: #5a1d00; letter-spacing: .1em; }
.sc-foot { font-weight: 800; font-size: 12px; color: #5a1d00; }
.sc-area { position: relative; height: 240px; margin: 10px 0; border-radius: 16px; overflow: hidden; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .7); }
.scratch-under {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: radial-gradient(circle at 50% 40%, var(--c2), #1f0d52 85%); font-weight: 900; font-size: 15px;
}
.scratch-under[data-tier="5"] { background: linear-gradient(120deg, var(--rainbow)) 0 0 / 300% 300%; animation: bgmove 4s ease-in-out infinite alternate; }
.scratch-cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; transition: opacity .45s, transform .45s; }
.scratch-cv.gone { opacity: 0; transform: scale(1.08); pointer-events: none; }

/* chest */
.chest-wrap { width: 100%; text-align: center; }
.big-q { height: 2em; font-size: 26px; font-weight: 900; margin-bottom: 40px; text-shadow: 0 3px 0 rgba(0, 0, 0, .3); }
.chest-row { display: flex; justify-content: center; gap: 4%; padding: 0 5%; }
.chest {
  position: relative; width: 28%; aspect-ratio: 1 / .92; padding: 0; border: 0; background: none;
  animation: float 2s ease-in-out infinite; animation-delay: calc(var(--i) * -.6s);
  transition: translate .5s cubic-bezier(.3, 1.3, .5, 1), scale .5s cubic-bezier(.3, 1.3, .5, 1), opacity .35s;
}
.chest.gone { opacity: 0; scale: .6; pointer-events: none; }
.chest.picked { translate: var(--dx) 20px; scale: 1.7; animation: none; z-index: 2; }
.chest.picked.rattle { animation: rattle .12s linear infinite; }
.chest.picked.ready { animation: readybob .5s ease-in-out infinite alternate; }
.chest-base { position: absolute; left: 4%; right: 4%; bottom: 0; height: 52%; border-radius: 6px 6px 12px 12px; border: 3px solid var(--gold); background: linear-gradient(#a8551c, #6e3410); box-shadow: inset 0 -8px 0 rgba(0, 0, 0, .2); }
.chest-base i { position: absolute; left: 50%; top: -12px; width: 20px; height: 24px; margin-left: -10px; border-radius: 5px; background: linear-gradient(#fff3b0, #ffb300); box-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.chest-lid { position: absolute; left: 0; right: 0; top: 8%; height: 42%; border-radius: 50% 50% 6px 6px / 70% 70% 6px 6px; border: 3px solid var(--gold); background: linear-gradient(#d4772c, #8a4315); transform-origin: 10% 100%; transition: transform .45s cubic-bezier(.3, 1.6, .5, 1); }
.chest.open .chest-lid { transform: translateY(-30%) rotate(-28deg); }
.chest-glow { position: absolute; inset: -30%; border-radius: 50%; background: radial-gradient(circle, var(--glow), transparent 62%); opacity: 0; transition: opacity .6s; }
.chest[data-tier="5"] .chest-glow { background: conic-gradient(var(--rainbow)); -webkit-mask: radial-gradient(circle, #000 20%, transparent 66%); mask: radial-gradient(circle, #000 20%, transparent 66%); animation: spin 2s linear infinite; }
.chest.leak .chest-glow { opacity: .9; }
.chest-beam { position: absolute; left: 8%; right: 8%; bottom: 48%; height: 180%; background: linear-gradient(to top, #fff, var(--glow) 30%, transparent); clip-path: polygon(22% 100%, 78% 100%, 100% 0, 0 0); opacity: 0; transform-origin: 50% 100%; transform: scaleY(0); transition: transform .4s ease-out, opacity .3s; }
.chest.open .chest-beam { opacity: .9; transform: none; }
.img-chest .chest { background: var(--img-chest-closed) center / contain no-repeat; }
.img-chest .chest.open { background-image: var(--img-chest-open); }
.img-chest .chest-lid, .img-chest .chest-base { display: none; }

/* mash */
.mash { width: 86%; text-align: center; }
.mash-time { font-size: 16px; font-weight: 800; }
.mash-time b { display: inline-block; min-width: 2.2em; font-size: 44px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.mash-meter { height: 30px; margin-top: 6px; border-radius: 99px; background: rgba(0, 0, 0, .4); overflow: hidden; box-shadow: inset 0 3px 6px rgba(0, 0, 0, .5), 0 0 0 3px rgba(255, 255, 255, .3); }
.mash-meter i { display: block; width: 0; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--rainbow)) 0 0 / 200% 100%; animation: slide 1s linear infinite; transition: width .12s; box-shadow: 0 0 16px #fff; }
.mash-label { margin-top: 6px; font-size: 13px; font-weight: 800; }
.mash-combo { height: 44px; margin-top: 8px; font-size: 30px; font-weight: 900; font-style: italic; color: var(--gold); text-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.mash-btn {
  width: 190px; height: 190px; margin-top: 8px; border: 0; border-radius: 50%; touch-action: none;
  background: radial-gradient(circle at 35% 28%, #ffb0c0, #ff3b4e 50%, #a80a24);
  box-shadow: 0 12px 0 #6d0616, 0 0 0 8px rgba(255, 255, 255, .25), 0 0 50px rgba(255, 59, 78, .7), inset 0 6px 0 rgba(255, 255, 255, .45);
  font-size: 38px; font-weight: 900; text-shadow: 0 3px 0 rgba(0, 0, 0, .3);
}
.mash-btn.hit { animation: mashhit .12s; }
.mash-btn.charged { animation: charge .95s ease-in both; }

/* rank up */
.rank { width: 88%; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rank-main { display: flex; align-items: center; gap: 18px; width: 100%; }
.ladder { display: flex; flex-direction: column; gap: 6px; width: 76px; }
.ladder div { padding: 5px 0; border-radius: 10px; text-align: center; font-weight: 900; font-size: 14px; background: rgba(255, 255, 255, .1); opacity: .5; transition: all .25s; }
.ladder div.on { opacity: 1; scale: 1.15; background: linear-gradient(160deg, var(--c2), var(--c3)); box-shadow: 0 0 18px var(--glow); }
.rank-center { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.rank-msg { height: 1.4em; font-size: 24px; font-weight: 900; font-style: italic; color: var(--gold); text-shadow: 0 3px 0 rgba(0, 0, 0, .35); }
.pips { display: flex; gap: 10px; }
.pips i { width: 18px; height: 18px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px var(--gold); transition: all .3s; }
.pips i.used { background: rgba(255, 255, 255, .2); box-shadow: none; scale: .7; }
.rank .btn { width: 100%; }

/* ---------- result ---------- */
#result { position: absolute; inset: 0; z-index: 20; overflow: hidden; display: flex; align-items: center; justify-content: center; }
#result.show { animation: fadein .3s both; }
.result-bg { position: absolute; inset: 0; background: radial-gradient(circle at 50% 36%, var(--c3), #150a3d 60%, #0b0524); }
#result[data-tier="5"] .result-bg { background: radial-gradient(circle at 50% 40%, transparent 20%, rgba(24, 6, 70, .6)) 0 0 / 100% 100%, linear-gradient(120deg, var(--rainbow)) 0 0 / 300% 300%; animation: bgmove 3.5s ease-in-out infinite alternate; }
#result[data-tier="5"] .rays { background: repeating-conic-gradient(rgba(255, 255, 255, .34) 0 7deg, transparent 9deg 18deg, rgba(255, 255, 255, .34) 20deg); animation-duration: 12s; }
#result[data-tier="4"] .rays { animation-duration: 16s; }
#result[data-tier="0"] .rays, #result[data-tier="1"] .rays { opacity: .35; }
.result-inner { position: relative; width: 100%; padding: 0 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.result-kicker { font-size: 18px; font-weight: 900; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); animation: riseup .5s .5s both; }
#result .medal { animation: stamp .6s cubic-bezier(.2, 1.6, .4, 1) both; margin: 6px 0 10px; }
.res-prize-img { width: 120px; height: 120px; background: center / contain no-repeat; animation: riseup .5s .6s both; }
.res-prize { font-size: 24px; font-weight: 900; text-shadow: 0 3px 0 rgba(0, 0, 0, .4), 0 0 16px rgba(0, 0, 0, .35); animation: riseup .5s .65s both; }
.res-sub { font-size: 12px; font-weight: 800; opacity: .9; animation: riseup .5s .75s both; }
.result-actions { width: 100%; margin-top: 14px; display: flex; flex-direction: column; gap: 12px; animation: riseup .5s 1.1s both; }

/* ---------- mileage home ---------- */
#s-home { padding: 56px 0 0; }
.home-head { padding: 0 20px; text-align: center; }
.hm-label { font-size: 12px; font-weight: 800; opacity: .8; }
.hm-val { position: relative; display: inline-block; }
.hm-val b { font-size: 46px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; background: linear-gradient(#fff6c2, #ffd34d 50%, #ffab00); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.hm-val small { margin-left: 4px; font-size: 14px; font-weight: 900; }
.hm-gain { position: absolute; right: -8px; top: -6px; font-size: 20px; font-weight: 900; color: #7df0ae; opacity: 0; text-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
.hm-gain.show { animation: gain 1.6s both; }
.tabs { display: flex; gap: 6px; margin: 8px 20px 0; padding: 5px; border-radius: 99px; background: rgba(0, 0, 0, .3); }
.tabs button { flex: 1; padding: 9px 0; border: 0; border-radius: 99px; background: none; font-weight: 900; font-size: 15px; opacity: .7; transition: all .2s; }
.tabs button.on { background: linear-gradient(#fff6c2, #ffd34d 45%, #ffab00); color: #3a1d00; opacity: 1; box-shadow: 0 3px 0 #b86e00; }
.tab-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 20px 16px; -webkit-overflow-scrolling: touch; }
.boost { padding: 7px 12px; border-radius: 12px; background: linear-gradient(90deg, #ff3b6b, #ff9f1c); font-size: 12px; font-weight: 800; text-align: center; box-shadow: 0 0 18px rgba(255, 59, 107, .5); animation: pulse 1s ease-in-out infinite alternate; }
.boost b { margin-right: 8px; padding: 1px 8px; border-radius: 99px; background: #fff; color: #ff3b6b; font-weight: 900; }
.boost span { font-variant-numeric: tabular-nums; }
.panel { margin-top: 12px; padding: 12px; border-radius: 18px; background: rgba(255, 255, 255, .1); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18); }
.panel-h { font-weight: 900; font-size: 15px; margin-bottom: 8px; }
.panel-h small { margin-left: 8px; font-size: 11px; font-weight: 800; opacity: .7; }
#map svg { display: block; width: 100%; border-radius: 14px; background: linear-gradient(#3cc8ff, #2d6fe8); }
.map-path { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1 10; }
.map-node { fill: #fff; stroke: rgba(0, 0, 0, .2); stroke-width: 2; }
.map-check { fill: var(--gold); stroke: #fff; stroke-width: 3; }
.map-label { font-size: 10px; font-weight: 900; fill: #fff; stroke: #1f0d52; stroke-width: 3; paint-order: stroke; }
.piece { transition: transform .24s cubic-bezier(.3, 1.4, .5, 1); filter: drop-shadow(0 3px 2px rgba(0, 0, 0, .4)); }
.piece-in.hop { animation: hop .28s; }
.grow { display: flex; align-items: center; gap: 14px; }
.tree { position: relative; flex: none; width: 92px; height: 96px; --g: .5; }
.trunk { position: absolute; left: 50%; bottom: 0; width: 14px; height: 42%; margin-left: -7px; border-radius: 4px; background: #9a6532; }
.leaf { position: absolute; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #a8f5b3, #2fae5a); transform-origin: 50% 100%; transform: scale(calc(.3 + var(--g) * .7)); transition: transform .8s cubic-bezier(.3, 1.5, .5, 1); }
.l1 { left: 18%; top: 4%; width: 64%; height: 58%; }
.l2 { left: 0; top: 26%; width: 52%; height: 44%; }
.l3 { right: 0; top: 26%; width: 52%; height: 44%; }
.fruit { position: absolute; width: 15px; height: 15px; border-radius: 50%; background: radial-gradient(circle at 30% 30%, #ffd0d0, #ff3b4e); transform: scale(0); transition: transform .5s cubic-bezier(.3, 1.9, .5, 1); box-shadow: 0 0 10px #ff3b4e; }
.tree.done .fruit { transform: scale(1); }
.f1 { left: 22%; top: 40%; } .f2 { left: 58%; top: 22%; transition-delay: .12s; } .f3 { left: 66%; top: 50%; transition-delay: .24s; }
.grow-main { flex: 1; min-width: 0; }
.grow-pct { font-size: 14px; font-weight: 900; }
.grow-pct b { font-size: 34px; color: #7df0ae; font-variant-numeric: tabular-nums; }
.grow-bar { height: 16px; border-radius: 99px; background: rgba(0, 0, 0, .4); overflow: hidden; }
.grow-bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #4fd68a, #ffe14d); transition: width .9s cubic-bezier(.3, 1.2, .5, 1); }
.grow-cta { width: 100%; margin-top: 10px; padding: 11px 4px; font-size: 12px; animation: pulse .7s ease-in-out infinite alternate; }
.grow-done { margin-top: 8px; font-weight: 900; color: var(--gold); }
.apply-lead { font-size: 13px; font-weight: 800; text-align: center; opacity: .9; }
.course { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 14px 12px; border-radius: 18px; background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .2); }
.course-info { flex: 1; min-width: 0; }
.course-info b { padding: 1px 10px; border-radius: 99px; background: var(--pink); font-size: 12px; font-weight: 900; }
.course-info p { margin-top: 4px; font-weight: 900; font-size: 14.5px; line-height: 1.35; }
.course-info small { font-size: 11px; opacity: .8; }
.course .btn { flex: none; padding: 11px 12px; font-size: 13px; }
.home-foot { display: flex; gap: 10px; padding: 12px 16px calc(16px + var(--safe-b)); background: rgba(11, 5, 36, .85); box-shadow: 0 -8px 20px rgba(0, 0, 0, .35); }
.home-foot .btn { flex: 1; padding: 13px 4px; font-size: 13px; }

/* ---------- share card ---------- */
#share { position: absolute; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 24px; background: rgba(8, 3, 28, .86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#share.show .share-card { animation: stamp .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.share-card {
  position: relative; overflow: hidden; width: min(100%, 300px); padding: 22px 18px; border-radius: 22px; text-align: center; color: #2a1650;
  background: linear-gradient(160deg, #fff, #f1e9ff); background-size: cover; box-shadow: 0 0 0 4px var(--c2), 0 0 44px var(--glow);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.img-share .share-card { background-image: var(--img-share); }
.share-card::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .5) 45%, rgba(255, 141, 243, .35) 50%, rgba(60, 224, 255, .35) 55%, transparent 70%) 0 0 / 250% 100%; animation: holo 2.6s linear infinite; pointer-events: none; }
.sh-brand { font-size: 11px; font-weight: 900; letter-spacing: .2em; color: var(--vio); }
.sh-name { font-size: 15px; font-weight: 900; }
.sh-text { font-size: 21px; font-weight: 900; }
.sh-cta { margin-top: 4px; padding: 8px 20px; border-radius: 99px; background: #06c755; color: #fff; font-size: 13px; font-weight: 900; }
.share-actions { display: flex; flex-direction: column; gap: 12px; width: min(100%, 300px); }

/* ---------- keyframes ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rays { from { transform: translate(-50%, -50%) scale(2.6) rotate(0); } to { transform: translate(-50%, -50%) scale(2.6) rotate(360deg); } }
@keyframes twinkle { 0%, 100% { transform: scale(.2) rotate(0); opacity: .1; } 50% { transform: scale(1) rotate(45deg); opacity: 1; } }
@keyframes slide { to { background-position: 200% 0; } }
@keyframes holo { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes bgmove { to { background-position: 100% 100%; } }
@keyframes sweep { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes bounce { to { transform: translateY(-26px); } }
@keyframes pulse { to { transform: scale(1.05); } }
@keyframes glowpulse { from { box-shadow: 0 5px 0 rgba(0, 0, 0, .3), 0 0 0 0 rgba(255, 225, 77, .9); } to { box-shadow: 0 5px 0 rgba(0, 0, 0, .3), 0 0 0 14px rgba(255, 225, 77, 0); } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes stamp { 0% { transform: scale(3.2) rotate(-18deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes riseup { from { transform: translateY(22px); opacity: 0; } }
@keyframes fadein { from { opacity: 0; } }
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }
@keyframes shake { 10%, 50%, 90% { transform: translate(-6px, 3px); } 30%, 70% { transform: translate(6px, -3px); } }
@keyframes shakex { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
@keyframes flipy { to { transform: rotateY(360deg); } }
@keyframes rattle { 0%, 100% { rotate: -7deg; } 50% { rotate: 7deg; } }
@keyframes readybob { to { translate: 0 -8px; } }
@keyframes capdrop { 0% { translate: 0 -140%; scale: .5; opacity: 0; } 55% { translate: 0 0; scale: 1; opacity: 1; } 75% { translate: 0 -22%; } 100% { translate: 0 0; } }
@keyframes cutin { 0% { translate: -110% 0; } 18%, 82% { translate: 0 0; } 100% { translate: 110% 0; } }
@keyframes lamp { 50% { opacity: .25; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes mashhit { 50% { transform: translateY(8px) scale(.94); } }
@keyframes charge { 0% { transform: scale(1); } 70% { transform: scale(.8); filter: brightness(2.2); } 100% { transform: scale(6); opacity: 0; filter: brightness(3); } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 20px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -10px); } }
@keyframes gain { 0% { opacity: 0; transform: translate(100%, 14px); } 20%, 70% { opacity: 1; transform: translate(100%, 0); } 100% { opacity: 0; transform: translate(100%, -14px); } }
@keyframes hop { 50% { transform: translateY(-12px) scale(1.15); } }

@media (max-height: 640px) {
  .slot { --ch: 54px; }
  .sc-area { height: 190px; }
  .mash-btn { width: 150px; height: 150px; }
  .medal.lg { width: 140px; font-size: 44px; }
  .big-q { margin-bottom: 20px; }
}
