:root {
  --pink: #ff5c8a;
  --pink-deep: #d61f5c;
  --berry: #2a0a1a;
  --berry-2: #430d2a;
  --gold: #ffd166;
  --chrome: #e9edf2;
  --ink: #240513;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Bricolage Grotesque', sans-serif;
  color: #fff;
  background:
    radial-gradient(circle at 20% 10%, rgba(255,92,138,0.35), transparent 45%),
    radial-gradient(circle at 80% 90%, rgba(255,209,102,0.25), transparent 50%),
    linear-gradient(160deg, #1a0410 0%, #2a0a1a 45%, #430d2a 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

.app-wrap {
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 18px 60px;
  position: relative;
}

/* Header */
.header { text-align: center; margin-bottom: 22px; }
.title {
  font-weight: 800;
  font-size: clamp(1.9rem, 6vw, 3rem);
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, #fff, var(--gold), #fff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 10px rgba(255,209,102,0.25));
  animation: pop-in 0.6s ease both;
}
.tagline {
  margin: 0;
  font-size: 0.95rem;
  color: #ffc9dc;
  font-style: italic;
  min-height: 1.3em;
  animation: pop-in 0.7s ease both;
}

/* Cabinet */
.cabinet-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: pop-in 0.8s ease both;
}
.cabinet {
  width: 100%;
  padding: 18px;
  border-radius: 26px;
  background: linear-gradient(180deg, #f4f6f9, #b9c2cf 40%, #8a93a3);
  box-shadow:
    0 0 0 4px #6a3, /* placeholder overwritten below */
    0 18px 40px rgba(0,0,0,0.55),
    inset 0 2px 4px rgba(255,255,255,0.9);
  border: 4px solid var(--gold);
  position: relative;
}
.cabinet::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 20px;
  border: 2px dashed rgba(214,31,92,0.45);
  pointer-events: none;
}

.reels-row {
  display: flex;
  gap: 10px;
  position: relative;
  background: #17010c;
  padding: 8px;
  border-radius: 16px;
  box-shadow: inset 0 4px 12px rgba(0,0,0,0.8);
}

.reel {
  flex: 1;
  height: 192px; /* 3 items */
  overflow: hidden;
  position: relative;
  background: linear-gradient(180deg, #fff, #ffe9f1 50%, #fff);
  border-radius: 10px;
  box-shadow: inset 0 0 12px rgba(214,31,92,0.25);
}
.reel-inner { position: absolute; inset: 0; }
.reel-item {
  position: absolute;
  left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--berry);
  line-height: 1.1;
}
.reel-fade {
  position: absolute; left: 0; right: 0; height: 40px;
  pointer-events: none; z-index: 3;
}
.reel-fade.top { top: 0; background: linear-gradient(#fff, transparent); }
.reel-fade.bottom { bottom: 0; background: linear-gradient(transparent, #fff); }

.win-line {
  position: absolute;
  left: 8px; right: 8px;
  top: 50%;
  height: 64px;
  transform: translateY(-50%);
  border-top: 2px solid rgba(255,209,102,0.9);
  border-bottom: 2px solid rgba(255,209,102,0.9);
  background: rgba(255,209,102,0.12);
  pointer-events: none;
  border-radius: 4px;
  z-index: 2;
}

/* Lever */
.lever {
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: transparent;
  transition: transform 0.15s ease;
}
.lever:hover:not(.lever-disabled) { transform: translateY(-2px); }
.lever:active:not(.lever-disabled) { transform: translateY(2px) scale(0.97); }
.lever-knob {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9db8, var(--pink-deep));
  box-shadow: 0 6px 14px rgba(214,31,92,0.6), inset 0 -3px 6px rgba(0,0,0,0.3);
}
.lever-label {
  font-weight: 800;
  font-size: 1.1rem;
  padding: 10px 26px;
  border-radius: 40px;
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  color: var(--ink);
  box-shadow: 0 6px 0 #c99a1f, 0 10px 18px rgba(0,0,0,0.4);
  letter-spacing: 0.02em;
}
.lever-disabled { opacity: 0.65; cursor: not-allowed; }
.lever-disabled .lever-label {
  animation: pulse-glow 0.9s ease-in-out infinite;
}

.shaking { animation: shake 0.4s ease; }

/* Ticket */
.ticket {
  margin: 26px auto 0;
  max-width: 480px;
  background: #fff8ef;
  color: var(--ink);
  border: 3px dashed var(--pink-deep);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0,0,0,0.4);
  animation: pop-in 0.4s ease both;
}
.ticket-mega {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fffdf3, #fff2c9);
  box-shadow: 0 0 30px rgba(255,209,102,0.8), 0 12px 30px rgba(0,0,0,0.4);
}
.mega-banner {
  font-weight: 800;
  color: #c99a1f;
  letter-spacing: 0.2em;
  margin-bottom: 8px;
  animation: pulse-glow 1s ease-in-out infinite;
}
.ticket-idea {
  font-weight: 800;
  font-size: clamp(1.15rem, 4.5vw, 1.6rem);
  line-height: 1.15;
  margin-bottom: 14px;
}
.ticket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 2px dotted rgba(214,31,92,0.4);
  padding-top: 12px;
}
.feas { display: flex; flex-direction: column; align-items: flex-start; }
.feas-num { font-weight: 800; font-size: 1.4rem; }
.feas-label { font-size: 0.8rem; font-weight: 700; }
.ticket-actions { display: flex; gap: 8px; }
.mini-btn {
  border: none; cursor: pointer;
  font-family: inherit; font-weight: 700;
  padding: 8px 14px; border-radius: 10px;
  font-size: 0.85rem;
  transition: transform 0.1s ease, filter 0.1s ease;
}
.mini-btn:active { transform: scale(0.94); }
.mini-btn.save { background: var(--gold); color: var(--ink); }
.mini-btn.copy { background: var(--berry); color: #fff; }
.mini-btn:hover { filter: brightness(1.08); }

.hint {
  text-align: center;
  margin: 22px auto 0;
  color: #ffc9dc;
  font-size: 0.9rem;
}
.hint kbd {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255,255,255,0.15);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.3);
  font-size: 0.8rem;
}

/* Saved panel */
.saved-panel {
  margin-top: 34px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,209,102,0.3);
  border-radius: 16px;
  overflow: hidden;
}
.saved-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 800;
  background: rgba(255,255,255,0.05);
}
.chevron { color: var(--gold); }
.empty { padding: 18px; text-align: center; color: #ffb8ce; font-style: italic; }
.saved-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.saved-card {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 14px;
  animation: pop-in 0.3s ease both;
}
.saved-card-idea { font-weight: 700; margin-bottom: 8px; line-height: 1.2; }
.saved-card-bottom {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem;
}
.saved-score { font-weight: 700; }
.del-btn {
  background: transparent; border: none; cursor: pointer;
  font-size: 1rem; opacity: 0.6; transition: opacity 0.15s, transform 0.1s;
}
.del-btn:hover { opacity: 1; transform: scale(1.15); }

.footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.8rem;
  color: #ffb8ce;
  line-height: 1.7;
}
.footer a { color: var(--gold); font-weight: 700; text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* Confetti */
#confetti-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 999; overflow: hidden;
}
.confetti-piece {
  position: absolute; top: -20px;
  border-radius: 2px;
  animation-name: fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

/* Animations */
@keyframes pop-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-0.5deg); }
  40% { transform: translateX(6px) rotate(0.5deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes pulse-glow {
  0%,100% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
}
@keyframes fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.2; }
}

@media (max-width: 420px) {
  .reel-item { font-size: 0.78rem; }
  .reels-row { gap: 6px; }
}