:root {
  --sym: 110px;          /* 1コマの高さ */
  --gold: #ffd54a;
  --gold-deep: #c8900a;
  --red: #e2231a;
  --bg1: #1a0633;
  --bg2: #3b0a45;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: "M PLUS Rounded 1c", sans-serif;
  color: #fff;
  background: radial-gradient(ellipse at top, var(--bg2), var(--bg1) 70%) fixed;
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
  overflow-x: hidden;
}

.wrap { width: 100%; max-width: 520px; text-align: center; }

.title {
  font-family: "Dela Gothic One", sans-serif;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  letter-spacing: .06em;
  color: var(--gold);
  text-shadow: 0 0 10px #ff9d00, 0 4px 0 var(--gold-deep);
}
.title span { color: #ff4d6d; text-shadow: 0 0 10px #ff2255, 0 4px 0 #8a0022; }

.subtitle { margin: 6px 0 20px; font-weight: 800; }
.subtitle small { display: block; font-weight: 500; opacity: .75; margin-top: 2px; }

/* ===== 筐体 ===== */
.machine {
  position: relative;
  padding: 22px 18px 24px;
  border-radius: 24px;
  background: linear-gradient(160deg, #b3122b, #6d0718);
  border: 6px solid var(--gold);
  box-shadow: 0 0 0 4px var(--gold-deep), 0 20px 40px rgba(0,0,0,.6),
              inset 0 0 30px rgba(0,0,0,.5);
}

.bulbs { display: flex; justify-content: space-between; padding: 0 6px; }
.bulbs.top { margin-bottom: 14px; }
.bulbs.bottom { margin-top: 14px; }
.bulbs i {
  width: 12px; height: 12px; border-radius: 50%;
  background: #7a5a00;
  box-shadow: inset 0 -2px 3px rgba(0,0,0,.4);
}
.bulbs i.on { background: #fff6b0; box-shadow: 0 0 8px #ffe066, 0 0 16px #ffb300; }

.reels {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px;
  background: #111;
  border-radius: 14px;
  box-shadow: inset 0 0 20px #000;
}

.reel {
  position: relative;
  height: calc(var(--sym) * 3);
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(#bbb, #fff 25%, #fff 75%, #bbb);
}
.reel::after {  /* 上下の陰影 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.55), transparent 30%, transparent 70%, rgba(0,0,0,.55));
}

.strip { will-change: transform; }
.symbol {
  height: var(--sym);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--sym) * .6);
  line-height: 1;
  user-select: none;
}
.symbol.seven {
  font-family: "Dela Gothic One", sans-serif;
  font-size: calc(var(--sym) * .78);
  color: var(--red);
  -webkit-text-stroke: 3px #7a0000;
  text-shadow: 0 3px 0 #ffcc00;
}
.symbol.bar span {
  font-family: "Dela Gothic One", sans-serif;
  font-size: calc(var(--sym) * .3);
  background: #222; color: #fff;
  padding: 4px 10px; border-radius: 6px;
  border: 3px solid #666;
}

.payline {
  position: absolute; left: 4px; right: 4px;
  top: 50%; height: 3px; transform: translateY(-50%);
  background: rgba(255, 40, 60, .8);
  box-shadow: 0 0 8px #ff2040;
  pointer-events: none;
}

/* ===== ボタン ===== */
.spin-btn {
  margin-top: 20px;
  width: 100%;
  padding: 18px;
  font-family: "Dela Gothic One", sans-serif;
  font-size: 1.6rem;
  letter-spacing: .15em;
  color: #5a3400;
  background: linear-gradient(#fff3a0, var(--gold) 45%, #e9a600);
  border: none; border-radius: 999px;
  box-shadow: 0 6px 0 #8a5a00, 0 10px 20px rgba(0,0,0,.5);
  cursor: pointer;
  transition: transform .08s, box-shadow .08s;
}
.spin-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 #8a5a00; }
.spin-btn:disabled { filter: grayscale(.6) brightness(.8); cursor: default; }

.notice { margin-top: 14px; min-height: 1.4em; font-weight: 800; color: #ffe9a8; }

/* ===== 配当表 ===== */
.paytable {
  margin-top: 28px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,213,74,.35);
  border-radius: 16px;
  padding: 16px;
}
.paytable h2 { font-size: 1.1rem; color: var(--gold); margin-bottom: 10px; }
.paytable ul { list-style: none; display: grid; gap: 6px; }
.paytable li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; border-radius: 10px; background: rgba(0,0,0,.25);
}
.paytable .icons { display: flex; gap: 4px; }
.paytable .icons .symbol { --sym: 34px; height: 34px; width: 34px; }
.paytable .icons .symbol.seven { -webkit-text-stroke: 1px #7a0000; text-shadow: 0 1px 0 #ffcc00; }
.paytable .icons .symbol.bar span { padding: 1px 3px; border-width: 1px; border-radius: 3px; }
.paytable .prize { font-weight: 800; }
.paytable li.top .prize { color: var(--gold); text-shadow: 0 0 8px #ffae00; }

/* ===== 当たり時：筐体 ===== */
.reel.win .symbol.hit { animation: symPulse .6s ease-in-out infinite alternate; }
@keyframes symPulse {
  from { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
  to   { transform: scale(1.12); filter: drop-shadow(0 0 14px #ffd000) drop-shadow(0 0 28px #ff8800); }
}
.machine.jackpot { animation: machineGlow .5s ease-in-out infinite alternate; }
@keyframes machineGlow {
  from { box-shadow: 0 0 0 4px var(--gold-deep), 0 0 20px #ffcc00, 0 20px 40px rgba(0,0,0,.6); }
  to   { box-shadow: 0 0 0 4px #fff3a0, 0 0 60px 10px #ffcc00, 0 0 120px 30px #ff7b00; }
}
.machine.reach .reel:nth-child(3) { box-shadow: 0 0 0 3px #ff4d6d, 0 0 18px #ff2255; animation: reachBlink .25s steps(2, jump-none) infinite; }
.machine.reach ~ .notice, .machine.reach .notice { color: #ff6b85; font-size: 1.3rem; }
@keyframes reachBlink { 50% { box-shadow: 0 0 0 3px #ffd54a, 0 0 24px #ffb300; } }
body.flash::before {
  content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: #fff; animation: flash .9s ease-out forwards;
}
@keyframes flash { 0% { opacity: .95; } 100% { opacity: 0; } }

/* ===== 当たり演出オーバーレイ ===== */
.jackpot-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
  background: radial-gradient(circle, rgba(60,20,0,.75), rgba(0,0,0,.92));
  overflow: hidden;
  padding: 16px;
}
.jackpot-overlay.show { display: flex; animation: fadeIn .4s ease-out; }
@keyframes fadeIn { from { opacity: 0; } }

.rays {
  position: absolute; left: 50%; top: 50%;
  width: 250vmax; height: 250vmax;
  transform: translate(-50%, -50%);
  background: repeating-conic-gradient(from 0deg,
    rgba(255, 215, 80, .38) 0deg 8deg, transparent 8deg 20deg);
  -webkit-mask: radial-gradient(circle, #000 0%, transparent 45%);
          mask: radial-gradient(circle, #000 0%, transparent 45%);
  animation: spinRays 14s linear infinite;
}
@keyframes spinRays { to { transform: translate(-50%, -50%) rotate(360deg); } }

#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.jackpot-card {
  position: relative;
  width: 100%; max-width: 420px;
  padding: 28px 20px 24px;
  border-radius: 24px;
  text-align: center;
  background: linear-gradient(160deg, #3a1500, #120500);
  border: 4px solid var(--gold);
  box-shadow: 0 0 30px #ffb300, 0 0 80px #ff7b00, inset 0 0 30px rgba(255,200,0,.25);
  animation: cardPop .7s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes cardPop { from { transform: scale(.2) rotate(-8deg); opacity: 0; } }

.jp-label {
  font-family: "Dela Gothic One", sans-serif;
  font-size: 1.5rem; letter-spacing: .12em;
  color: #fff;
  text-shadow: 0 0 10px #ff4d6d, 0 0 20px #ff0040;
  animation: blink .5s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: .55; } }

.jp-amount {
  margin: 8px 0 2px;
  font-family: "Dela Gothic One", sans-serif;
  font-size: clamp(2.2rem, 12vw, 4rem);
  line-height: 1.1;
  white-space: nowrap;
  background: linear-gradient(100deg, #b37400 0%, #fff6c2 20%, #ffd54a 35%, #b37400 50%,
                                      #fff6c2 70%, #ffd54a 85%, #b37400 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 12px rgba(255, 190, 0, .9));
  animation: shine 1.6s linear infinite;
}
@keyframes shine { to { background-position: -200% center; } }

.jp-sub { font-size: 1.3rem; font-weight: 800; color: #fff3c4; }

.coupon {
  margin: 18px auto 6px;
  padding: 12px;
  border: 2px dashed var(--gold);
  border-radius: 12px;
  background: rgba(255, 213, 74, .08);
}
.coupon span { display: block; font-size: .85rem; opacity: .8; }
.coupon strong { font-size: 1.4rem; letter-spacing: .12em; color: var(--gold); }

.jp-note { font-size: .85rem; opacity: .8; }

.close-btn {
  margin-top: 16px;
  padding: 10px 28px;
  font: inherit; font-weight: 800;
  color: #5a3400;
  background: var(--gold);
  border: none; border-radius: 999px;
  cursor: pointer;
}

@media (max-width: 420px) {
  :root { --sym: 84px; }
  .machine { padding: 16px 12px 18px; }
  .reels { gap: 6px; padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .rays, .jp-amount, .jp-label, .machine.jackpot, .reel.win .symbol.hit { animation: none; }
}
