:root {
  color-scheme: light;
  --bg-1: #ffe48f;
  --bg-2: #ffc7b7;
  --bg-3: #9debd1;
  --ink: #2b1d12;
  --ink-soft: #5f4b3b;
  --accent: #ff5e6c;
  --accent-2: #28c2b2;
  --accent-3: #ffcf4a;
  --cabinet-red-1: #ff3b3b;
  --cabinet-red-2: #c51622;
  --cabinet-blue-1: #2a47d5;
  --cabinet-blue-2: #1b2c8f;
  --cabinet-blue-3: #111c62;
  --gold-1: #ffd37a;
  --gold-2: #d59b3c;
  --gold-3: #ffefb3;
  --card: #fff6de;
  --card-strong: #ffeab6;
  --shadow: 0 18px 40px rgba(36, 20, 6, 0.18);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --app-max: 460px;
  --space-1: 10px;
  --space-2: 16px;
  --space-3: 24px;
  --title-size: 30px;
  --subtitle-size: 14px;
  --reel-cell: 82px;
  --reel-window: 246px;
  --item-size: 70px;
  --icon-size: 54px;
  --reel-pad: 10px;
  --reel-emoji-size: 36px;
  --result-pad: 14px;
  --result-icon: 60px;
  --result-icon-img: 42px;
  --result-emoji-size: 28px;
  --result-name-size: 18px;
  --btn-pad-y: 16px;
  --btn-pad-x: 28px;
  --btn-font-size: 18px;
  --history-chip: 52px;
  --history-img: 36px;
  --history-emoji: 24px;
  --overlay-pad: 24px;
  --overlay-icon: 96px;
  --overlay-icon-img: 62px;
  --overlay-emoji: 40px;
  --overlay-name: 22px;
  --summary-icon: 34px;
  --summary-emoji: 24px;
  --lever-offset: -42px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100svh;
  font-family: "M PLUS Rounded 1c", sans-serif;
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg-1) 5%, var(--bg-2) 45%, var(--bg-3) 100%);
  overflow-x: hidden;
  touch-action: manipulation;
}

.bg-sparkle {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.7;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.45), transparent 40%),
    radial-gradient(circle at 80% 15%, rgba(255, 255, 255, 0.4), transparent 45%),
    radial-gradient(circle at 10% 80%, rgba(255, 255, 255, 0.35), transparent 40%),
    radial-gradient(circle at 80% 75%, rgba(255, 255, 255, 0.3), transparent 35%);
  mix-blend-mode: soft-light;
}

.bg-sparkle::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='0.18'/%3E%3C/svg%3E");
  opacity: 0.4;
}

.app {
  max-width: var(--app-max);
  margin: 0 auto;
  padding: var(--space-2);
  padding-top: calc(var(--space-2) + env(safe-area-inset-top));
  padding-bottom: calc(var(--space-3) + env(safe-area-inset-bottom));
  position: relative;
  z-index: 2;
}

.top {
  display: grid;
  gap: var(--space-1);
}

.title-wrap {
  display: grid;
  gap: 6px;
}

.title {
  margin: 0;
  font-family: "Titan One", cursive;
  font-size: var(--title-size);
  letter-spacing: 0.5px;
  text-shadow: 0 6px 0 rgba(255, 255, 255, 0.7);
}

.subtitle {
  margin: 0;
  font-size: var(--subtitle-size);
  color: var(--ink-soft);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}

.spin-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-weight: 700;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7);
}

.spin-indicator strong {
  font-size: 16px;
}

.divider {
  color: var(--ink-soft);
}

.progress {
  display: grid;
  grid-auto-flow: column;
  gap: 6px;
}

.progress span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(43, 29, 18, 0.2);
  transition: transform 0.2s ease, background 0.2s ease;
}

.progress span.filled {
  background: var(--accent);
  transform: scale(1.2);
}

.slot-area {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.machine {
  position: relative;
  border-radius: 140px 140px 28px 28px;
  background: linear-gradient(180deg, var(--cabinet-red-1), var(--cabinet-red-2));
  box-shadow: 0 26px 50px rgba(45, 12, 16, 0.35);
  padding: var(--space-2);
  overflow: visible;
  border: 4px solid rgba(146, 10, 18, 0.65);
}

.machine.spinning {
  box-shadow: 0 30px 56px rgba(45, 12, 16, 0.45);
}

.cabinet-arch {
  position: relative;
  border-radius: 120px 120px 26px 26px;
  padding: 18px 18px 14px;
  background: linear-gradient(180deg, #ff3a3a 0%, #c21422 100%);
  box-shadow: inset 0 0 0 4px rgba(255, 214, 120, 0.65);
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
}

.arch-lights {
  position: absolute;
  top: 10px;
  left: 18px;
  right: 18px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}

.arch-lights span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-3), var(--gold-2));
  box-shadow: 0 0 10px rgba(255, 210, 120, 0.9);
  animation: twinkle 1.6s infinite;
}

.arch-lights span:nth-child(even) {
  animation-delay: 0.2s;
}

.arch-title {
  font-family: "Titan One", cursive;
  font-size: calc(var(--title-size) * 0.6);
  letter-spacing: 1px;
  padding: 6px 18px;
  background: linear-gradient(180deg, var(--cabinet-blue-1), var(--cabinet-blue-3));
  border-radius: 18px;
  border: 3px solid var(--gold-1);
  color: #ffd877;
  text-shadow: 0 3px 0 rgba(97, 44, 12, 0.6);
}

.arch-stars {
  color: #ffd877;
  font-size: 12px;
  letter-spacing: 6px;
}

.cabinet-body {
  margin-top: 12px;
  padding: 10px;
  background: linear-gradient(180deg, var(--cabinet-blue-1), var(--cabinet-blue-3));
  border-radius: 24px;
  box-shadow: inset 0 0 0 4px rgba(255, 214, 120, 0.6);
}

.cabinet-bezel {
  background: linear-gradient(180deg, var(--gold-3), var(--gold-2));
  padding: 10px;
  border-radius: 20px;
  box-shadow: inset 0 -6px 10px rgba(118, 60, 12, 0.35);
}

.cabinet-base {
  margin-top: 12px;
  background: linear-gradient(180deg, #e32a2a, #a40f1b);
  border-radius: 18px 18px 22px 22px;
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  box-shadow: inset 0 4px 10px rgba(255, 255, 255, 0.25);
}

.base-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.base-buttons span {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-3), var(--gold-2));
  box-shadow: inset 0 -4px 8px rgba(118, 60, 12, 0.35), 0 6px 10px rgba(45, 12, 16, 0.35);
}

.base-buttons span.big {
  width: 46px;
  height: 46px;
  margin-left: auto;
  box-shadow: inset 0 -6px 10px rgba(118, 60, 12, 0.35), 0 10px 14px rgba(45, 12, 16, 0.4);
}

.base-slot {
  height: 10px;
  border-radius: 999px;
  background: rgba(43, 29, 18, 0.3);
  box-shadow: inset 0 4px 6px rgba(43, 29, 18, 0.35);
}

.cabinet-feet {
  display: flex;
  justify-content: space-between;
  padding: 6px 28px 0;
}

.cabinet-feet span {
  width: 24px;
  height: 10px;
  border-radius: 6px;
  background: #7f0c15;
  box-shadow: inset 0 -3px 4px rgba(0, 0, 0, 0.35);
}

.marquee {
  position: absolute;
  background-image: radial-gradient(circle, #ffe7a3 35%, transparent 38%);
  background-size: 16px 12px;
  filter: drop-shadow(0 0 6px rgba(255, 222, 150, 0.9));
  opacity: 0.7;
  pointer-events: none;
}

.marquee.top,
.marquee.bottom {
  height: 12px;
  left: 16px;
  right: 16px;
}

.marquee.top {
  top: 8px;
  animation: marquee-x 1.1s linear infinite;
}

.marquee.bottom {
  bottom: 8px;
  animation: marquee-x 1.1s linear infinite reverse;
}

.marquee.left,
.marquee.right {
  width: 12px;
  top: 16px;
  bottom: 16px;
  background-size: 12px 16px;
}

.marquee.left {
  left: 8px;
  animation: marquee-y 1.1s linear infinite;
}

.marquee.right {
  right: 8px;
  animation: marquee-y 1.1s linear infinite reverse;
}

.machine.spinning .marquee {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(255, 190, 120, 0.9));
}

.reels {
  display: flex;
  gap: var(--space-1);
  position: relative;
  align-items: stretch;
}

.win-line {
  position: absolute;
  left: 6px;
  right: 6px;
  top: 50%;
  height: 6px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #ffe889 30%, #ff9fb0 50%, #ffe889 70%, rgba(255, 255, 255, 0) 100%);
  box-shadow: 0 0 12px rgba(255, 144, 168, 0.8);
  opacity: 0.85;
  pointer-events: none;
  z-index: 3;
}

.win-line::after {
  content: "";
  position: absolute;
  inset: -6px 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9), transparent 70%);
  opacity: 0.7;
}

.reel {
  background: linear-gradient(180deg, #fff9e6, #f2d8a3 85%);
  border-radius: var(--radius-md);
  padding: var(--reel-pad);
  position: relative;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7), inset 0 -8px 18px rgba(207, 153, 73, 0.35), 0 6px 14px rgba(61, 27, 6, 0.25);
  flex: 1;
  min-width: 0;
}

.reel::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}

.reel-window {
  height: var(--reel-window);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.92);
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)),
    linear-gradient(180deg, rgba(255, 229, 174, 0.8), rgba(255, 229, 174, 0.8));
  background-size: 100% 2px, 100% 2px;
  background-repeat: no-repeat;
  background-position: 0 calc(100% / 3), 0 calc(200% / 3);
  position: relative;
  width: 100%;
}

.reel-window::before,
.reel-window::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 30px;
  z-index: 2;
}

.reel-window::before {
  top: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), transparent);
}

.reel-window::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.95), transparent);
}

.reel-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(0);
  will-change: transform;
  width: 100%;
}

.strip-item {
  height: var(--reel-cell);
  display: grid;
  place-items: center;
  width: 100%;
}

.reel-face {
  width: var(--item-size);
  height: var(--item-size);
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #fffdf6;
  box-shadow: inset 0 -6px 12px rgba(230, 170, 90, 0.28), 0 4px 8px rgba(90, 45, 10, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.reel-img {
  width: var(--icon-size);
  height: var(--icon-size);
  object-fit: contain;
  display: block;
}

.reel-emoji {
  font-size: var(--reel-emoji-size);
}

.reel.spinning .reel-strip {
  filter: blur(0.6px) saturate(1.2);
}

.reel.stopped .strip-item.is-final .reel-face {
  animation: reel-stop 0.45s ease;
}

.reel.winner .strip-item.is-final .reel-face {
  box-shadow: 0 0 0 4px rgba(255, 95, 108, 0.35), 0 10px 24px rgba(255, 95, 108, 0.35);
  transform: scale(1.08);
}

.machine-bottom {
  display: grid;
  place-items: center;
  gap: 8px;
}

.machine-slot {
  width: 80%;
  height: 12px;
  border-radius: 999px;
  background: rgba(43, 29, 18, 0.25);
  box-shadow: inset 0 4px 6px rgba(43, 29, 18, 0.2);
}

.machine-shadow {
  width: 60%;
  height: 10px;
  border-radius: 50%;
  background: rgba(43, 29, 18, 0.2);
  filter: blur(6px);
}

.lever {
  position: absolute;
  right: var(--lever-offset);
  top: 50%;
  transform: translateY(-50%);
  width: 86px;
  height: 230px;
  display: grid;
  align-items: start;
  justify-items: center;
  cursor: pointer;
  touch-action: none;
  z-index: 6;
  perspective: 800px;
  perspective-origin: center 35%;
}

.lever-base {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #ffd59a);
  box-shadow: inset 0 -6px 10px rgba(207, 153, 73, 0.35), 0 6px 14px rgba(36, 20, 6, 0.25);
  position: absolute;
  bottom: 14px;
}

.lever-arm {
  position: relative;
  width: 20px;
  height: 154px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff0c7, #f3c47e 60%, #d9a24b);
  box-shadow: inset 0 -6px 10px rgba(171, 107, 22, 0.45);
  transform-origin: bottom center;
  transform: rotateX(-6deg) translateZ(0px);
  transform-style: preserve-3d;
}

.lever-knob {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #c9e2ff, #1e49d7);
  box-shadow: inset 0 -6px 10px rgba(18, 46, 148, 0.55), 0 8px 16px rgba(18, 46, 148, 0.35);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) translateZ(0px);
}

.lever:not(.pulling):not(.pulled) .lever-arm {
  animation: lever-idle 2.6s ease-in-out infinite;
}

.lever:not(.pulling):not(.pulled) .lever-knob {
  animation: lever-knob-idle 2.6s ease-in-out infinite;
}

.lever:not(.pulling):not(.pulled) .lever-knob::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 0 rgba(30, 73, 215, 0.4);
  opacity: 0;
  animation: lever-pulse 2.6s ease-in-out infinite;
}

.lever.pulling .lever-arm {
  transform: rotateX(-34deg) translateZ(18px);
}

.lever.pulled .lever-arm {
  animation: lever-pull 0.65s cubic-bezier(0.2, 0.7, 0.2, 1.2);
}

.lever.pulled .lever-knob {
  animation: lever-knob 0.65s ease;
}

.result-panel {
  background: var(--card);
  border-radius: var(--radius-md);
  padding: var(--result-pad);
  box-shadow: var(--shadow);
  display: grid;
  gap: var(--space-1);
}

.result-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-soft);
}

.result-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.result-icon {
  width: var(--result-icon);
  height: var(--result-icon);
  border-radius: 18px;
  background: var(--card-strong);
  display: grid;
  place-items: center;
}

.result-icon img {
  width: var(--result-icon-img);
  height: var(--result-icon-img);
  object-fit: contain;
}

.result-icon span {
  font-size: var(--result-emoji-size);
}

.result-name {
  font-weight: 700;
  font-size: var(--result-name-size);
}

.result-type {
  display: none;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cta {
  display: none;
}

.spin-btn {
  border: none;
  border-radius: 999px;
  padding: var(--btn-pad-y) var(--btn-pad-x);
  font-size: var(--btn-font-size);
  font-weight: 700;
  font-family: "M PLUS Rounded 1c", sans-serif;
  color: #fff;
  background: linear-gradient(180deg, var(--accent), #ff8fa0);
  box-shadow: 0 10px 0 #d54858, 0 18px 30px rgba(213, 72, 88, 0.35);
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease;
  touch-action: manipulation;
}

.spin-btn:active {
  transform: translateY(6px);
  box-shadow: 0 4px 0 #d54858, 0 12px 18px rgba(213, 72, 88, 0.25);
}

.spin-btn[disabled] {
  cursor: not-allowed;
  filter: grayscale(0.4) brightness(1.05);
  box-shadow: 0 6px 0 #b26a74, 0 12px 18px rgba(178, 106, 116, 0.3);
}

.spin-btn.small {
  padding: 12px 22px;
  font-size: 16px;
}

.cta-hint {
  font-size: 12px;
  color: var(--ink-soft);
}

.history {
  display: grid;
  gap: 8px;
}

.history {
  display: none;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.history-header h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
}

.history-list {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(58px, auto);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.history-list::-webkit-scrollbar {
  display: none;
}

.history-chip {
  display: grid;
  place-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--ink-soft);
}

.history-chip .chip-icon {
  width: var(--history-chip);
  height: var(--history-chip);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  display: grid;
  place-items: center;
  box-shadow: inset 0 -6px 12px rgba(255, 186, 110, 0.25);
}

.history-chip img {
  width: var(--history-img);
  height: var(--history-img);
  object-fit: contain;
}

.history-chip span.emoji {
  font-size: var(--history-emoji);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(34, 22, 12, 0.4);
  display: grid;
  place-items: center;
  padding: 20px;
  backdrop-filter: blur(6px);
  z-index: 10;
}

.overlay.effect-fireworks::before,
.overlay.effect-fireworks::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 234, 156, 0.85), transparent 45%),
    radial-gradient(circle at 80% 25%, rgba(255, 140, 160, 0.8), transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(255, 214, 120, 0.8), transparent 40%),
    radial-gradient(circle at 30% 75%, rgba(255, 255, 255, 0.85), transparent 45%);
  opacity: 0.85;
  animation: fireworks 1.2s ease-in-out infinite;
}

.overlay.effect-fireworks::after {
  animation-delay: 0.3s;
  opacity: 0.65;
  filter: blur(1px);
}

.overlay.effect-sparkle::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 30%, rgba(255, 255, 255, 0.7), transparent 40%),
    radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.65), transparent 35%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.7), transparent 38%),
    radial-gradient(circle at 25% 80%, rgba(255, 255, 255, 0.65), transparent 35%);
  animation: sparkle 1.6s ease-in-out infinite;
}

.overlay.effect-shake .overlay-card {
  animation: pop 0.35s ease, shake 0.65s ease;
}

.overlay.hidden {
  display: none;
}

.overlay-card {
  position: relative;
  background: #fff9e6;
  border-radius: 28px;
  padding: var(--overlay-pad);
  width: min(340px, 100%);
  display: grid;
  gap: var(--space-1);
  text-align: center;
  box-shadow: var(--shadow);
  animation: pop 0.35s ease;
}

.overlay-card > * {
  position: relative;
  z-index: 1;
}

.overlay-burst,
.overlay-fx {
  z-index: 0;
}

.overlay-card.fx-fireworks {
  background: linear-gradient(180deg, #fff8e0 0%, #fff1c8 100%);
}

.overlay-card.fx-shake {
  animation: pop 0.35s ease, overlay-shake 0.6s ease;
}

.overlay-fx {
  position: absolute;
  inset: -20px;
  pointer-events: none;
  opacity: 0;
}

.overlay-fx.confetti {
  opacity: 1;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  background: var(--confetti-color, #ffd166);
  border-radius: 2px;
  transform: rotate(var(--confetti-rotate, 0deg));
  animation-name: confetti-fall;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
  animation-iteration-count: infinite;
}

.overlay-fx.fireworks {
  opacity: 1;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 153, 102, 0.8), transparent 40%),
    radial-gradient(circle at 80% 25%, rgba(255, 211, 92, 0.85), transparent 42%),
    radial-gradient(circle at 30% 80%, rgba(120, 210, 255, 0.8), transparent 40%),
    radial-gradient(circle at 75% 75%, rgba(255, 120, 200, 0.75), transparent 42%);
  animation: fireworks-pop 1.4s ease-in-out infinite;
  filter: blur(0.3px);
}

.overlay-fx.sparkle {
  opacity: 1;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.85) 20%, transparent 22%),
    radial-gradient(circle, rgba(255, 211, 92, 0.8) 18%, transparent 20%);
  background-size: 40px 40px, 55px 55px;
  animation: sparkle-drift 1.6s linear infinite;
}

.overlay-fx.confetti {
  opacity: 1;
}

.confetti-piece {
  position: absolute;
  top: -12%;
  background: var(--confetti-color);
  border-radius: 2px;
  opacity: 0.9;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
  transform: rotate(var(--confetti-rotate));
}

.overlay-burst {
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.7) 0%, transparent 70%);
  z-index: -1;
}

.overlay-icon {
  width: var(--overlay-icon);
  height: var(--overlay-icon);
  border-radius: 24px;
  background: #fff1c8;
  display: grid;
  place-items: center;
  margin: 0 auto;
  box-shadow: inset 0 -8px 12px rgba(255, 186, 110, 0.25);
}

.overlay-icon img {
  width: var(--overlay-icon-img);
  height: var(--overlay-icon-img);
  object-fit: contain;
}

.overlay-icon span {
  font-size: var(--overlay-emoji);
}

.overlay-name {
  font-size: var(--overlay-name);
  font-weight: 700;
}

.overlay-tag {
  display: none;
  font-size: 12px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.overlay-card.end {
  gap: 12px;
}

.end-title {
  font-size: 24px;
  font-weight: 700;
}

.end-subtitle {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.summary-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  justify-items: stretch;
}

.summary-text {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.director-panel {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  background: #fffdf3;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 14px 14px 16px;
  transform: translateY(120%);
  transition: transform 0.3s ease;
  z-index: 12;
}

.director-panel.open {
  transform: translateY(0);
}

.director-header {
  font-weight: 700;
  margin-bottom: 10px;
}

.director-body {
  display: grid;
  gap: 12px;
  font-size: 12px;
}

.director-row {
  display: grid;
  gap: 6px;
}

.director-inline {
  display: flex;
  gap: 8px;
}

.director-panel input,
.director-panel textarea {
  border: 1px solid rgba(43, 29, 18, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: "M PLUS Rounded 1c", sans-serif;
}

.director-panel textarea {
  resize: vertical;
}

.toggle,
.mini,
.danger {
  border: none;
  border-radius: 10px;
  padding: 8px 10px;
  font-weight: 700;
  font-family: "M PLUS Rounded 1c", sans-serif;
  cursor: pointer;
}

.toggle {
  background: var(--accent-2);
  color: #fff;
}

.mini {
  background: #ffd271;
}

.danger {
  background: #ff7a7a;
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(43, 29, 18, 0.9);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes reel-spin {
  0% {
    transform: translateY(-4px) scale(0.96);
  }
  50% {
    transform: translateY(4px) scale(1);
  }
  100% {
    transform: translateY(-4px) scale(0.96);
  }
}

@keyframes reel-stop {
  0% {
    transform: scale(0.95);
  }
  60% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes pop {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes fireworks-pop {
  0% {
    transform: scale(0.85);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.95;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.5;
  }
}

@keyframes sparkle-drift {
  0% {
    background-position: 0 0, 10px 20px;
  }
  100% {
    background-position: 40px 80px, 60px 0;
  }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(var(--confetti-rotate, 0deg));
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(260px) rotate(calc(var(--confetti-rotate, 0deg) + 120deg));
    opacity: 0;
  }
}

@keyframes overlay-shake {
  0% {
    transform: translateX(0);
  }
  30% {
    transform: translateX(-4px);
  }
  60% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-20px) rotate(var(--confetti-rotate));
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    transform: translateY(280px) rotate(calc(var(--confetti-rotate) + 320deg));
    opacity: 0.2;
  }
}

@keyframes twinkle {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}

@keyframes fireworks {
  0% {
    transform: scale(0.8);
    opacity: 0.2;
  }
  50% {
    transform: scale(1);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.2);
    opacity: 0;
  }
}

@keyframes sparkle {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.9;
  }
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-3px);
  }
  80% {
    transform: translateX(3px);
  }
  100% {
    transform: translateX(0);
  }
}

@keyframes marquee-x {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 40px 0;
  }
}

@keyframes marquee-y {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 0 40px;
  }
}

@keyframes lever-pull {
  0% {
    transform: rotateX(-6deg) translateZ(0px);
  }
  40% {
    transform: rotateX(-38deg) translateZ(20px);
  }
  70% {
    transform: rotateX(-8deg) translateZ(4px);
  }
  100% {
    transform: rotateX(-6deg) translateZ(0px);
  }
}

@keyframes lever-idle {
  0%,
  100% {
    transform: rotateX(-6deg) translateZ(0px);
  }
  40% {
    transform: rotateX(2deg) translateZ(3px);
  }
  70% {
    transform: rotateX(-10deg) translateZ(4px);
  }
}

@keyframes lever-knob {
  0% {
    transform: translateX(-50%) translateZ(0px) scale(1);
  }
  40% {
    transform: translateX(-50%) translateZ(12px) scale(0.96);
  }
  70% {
    transform: translateX(-50%) translateZ(6px) scale(1.08);
  }
  100% {
    transform: translateX(-50%) translateZ(0px) scale(1);
  }
}

@keyframes lever-knob-idle {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) translateZ(0px) scale(1);
    box-shadow: inset 0 -6px 10px rgba(18, 46, 148, 0.55), 0 8px 16px rgba(18, 46, 148, 0.35);
  }
  45% {
    transform: translateX(-50%) translateY(-5px) translateZ(8px) scale(1.05);
    box-shadow: inset 0 -6px 10px rgba(18, 46, 148, 0.55), 0 12px 24px rgba(18, 46, 148, 0.4);
  }
  70% {
    transform: translateX(-50%) translateY(-2px) translateZ(4px) scale(1.02);
  }
}

@keyframes lever-pulse {
  0% {
    opacity: 0;
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(30, 73, 215, 0.35);
  }
  45% {
    opacity: 0.8;
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(30, 73, 215, 0.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.25);
    box-shadow: 0 0 0 18px rgba(30, 73, 215, 0);
  }
}

@media (max-width: 360px) {
  .reels {
    gap: 8px;
  }
}

@media (min-width: 640px) {
  :root {
    --app-max: 640px;
    --space-1: 12px;
    --space-2: 20px;
    --space-3: 28px;
    --title-size: 34px;
    --subtitle-size: 15px;
    --reel-cell: 94px;
    --reel-window: 282px;
    --item-size: 82px;
    --icon-size: 62px;
    --reel-pad: 12px;
    --reel-emoji-size: 42px;
    --result-pad: 18px;
    --result-icon: 72px;
    --result-icon-img: 50px;
    --result-emoji-size: 32px;
    --result-name-size: 20px;
    --btn-pad-y: 18px;
    --btn-pad-x: 34px;
    --btn-font-size: 20px;
    --history-chip: 60px;
    --history-img: 42px;
    --history-emoji: 28px;
    --overlay-pad: 28px;
    --overlay-icon: 112px;
    --overlay-icon-img: 74px;
    --overlay-emoji: 46px;
    --overlay-name: 24px;
    --summary-icon: 40px;
    --summary-emoji: 28px;
  }
}

@media (min-width: 900px) {
  :root {
    --app-max: 760px;
    --space-1: 14px;
    --space-2: 22px;
    --space-3: 32px;
    --title-size: 36px;
    --subtitle-size: 16px;
    --reel-cell: 102px;
    --reel-window: 306px;
    --item-size: 90px;
    --icon-size: 70px;
    --reel-pad: 12px;
    --reel-emoji-size: 46px;
    --result-pad: 20px;
    --result-icon: 78px;
    --result-icon-img: 54px;
    --result-emoji-size: 34px;
    --result-name-size: 22px;
    --btn-pad-y: 20px;
    --btn-pad-x: 38px;
    --btn-font-size: 21px;
    --history-chip: 66px;
    --history-img: 46px;
    --history-emoji: 30px;
    --overlay-pad: 30px;
    --overlay-icon: 120px;
    --overlay-icon-img: 80px;
    --overlay-emoji: 50px;
    --overlay-name: 26px;
    --summary-icon: 44px;
    --summary-emoji: 30px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
