:root {
  --red: #dc2626;
  --yellow: #facc15;
  --blue: #1e40af;
  --dark-blue: #172554;
  --cream: #fef3c7;
}

body {
  background-color: var(--cream);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(220, 38, 38, 0.05),
    rgba(220, 38, 38, 0.05) 20px,
    transparent 20px,
    transparent 40px
  );
  font-family: 'Inter', sans-serif;
  color: var(--blue);
  margin: 0;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.error {
  background: #fee2e2;
  color: #ef4444;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 600;
  border: 1px solid #f87171;
  text-align: left;
}

h1, h2, h3 {
  font-family: 'Anton', sans-serif;
  text-transform: uppercase;
  color: var(--red);
  text-shadow: 2px 2px 0px var(--yellow);
  margin-top: 0;
}

.carnival-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding-bottom: 40px;
}

/* Header */
.header {
  text-align: center;
  padding: 40px 20px 20px;
}
.marquee-title h1 {
  font-size: 4rem;
  margin: 0;
  letter-spacing: 2px;
  color: var(--yellow);
  text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--blue);
}
.subtitle {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--blue);
  margin-top: 10px;
}

/* Layout */
.layout-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  padding: 20px;
}
@media(min-width: 800px) {
  .layout-grid {
    grid-template-columns: 350px 1fr;
    align-items: start;
  }
}

/* Sidebar */
.hero-img {
  width: 100%;
  border-radius: 20px;
  border: 6px solid var(--red);
  box-shadow: 0 10px 20px rgba(0,0,0,0.15);
  display: block;
  margin-bottom: 24px;
}
.leaderboard {
  background: white;
  border: 4px solid var(--blue);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 8px 8px 0 rgba(30, 64, 175, 0.15);
}
.leaderboard h3 {
  text-align: center;
  font-size: 1.75rem;
  margin-bottom: 20px;
}
.leaderboard ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.leaderboard li {
  padding: 12px 0;
  border-bottom: 2px dashed var(--cream);
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  display: flex;
  justify-content: space-between;
}
.leaderboard li:last-child {
  border-bottom: none;
}
.leaderboard li strong {
  color: var(--red);
}

/* Buttons */
.carnival-btn {
  background: linear-gradient(to bottom, var(--yellow), #eab308);
  border: 4px solid var(--red);
  border-radius: 999px;
  color: var(--red);
  font-family: 'Anton', sans-serif;
  font-size: 1.5rem;
  padding: 12px 32px;
  cursor: pointer;
  box-shadow: 0 8px 0 var(--red), 0 15px 20px rgba(0,0,0,0.2);
  transition: all 0.1s;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.carnival-btn:active {
  transform: translateY(8px);
  box-shadow: 0 0px 0 var(--red), 0 5px 10px rgba(0,0,0,0.2);
}
.carnival-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: translateY(8px);
  box-shadow: 0 0px 0 var(--red);
  filter: grayscale(0.3);
}
.carnival-btn.small-btn {
  font-size: 1.1rem;
  padding: 8px 20px;
  width: auto;
  box-shadow: 0 4px 0 var(--red);
}
.carnival-btn.small-btn:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 var(--red);
}

/* Container */
.step-container {
  background: white;
  border: 6px solid var(--yellow);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.1), inset 0 0 0 6px var(--red);
  text-align: center;
}
.step-container h2 {
  font-size: 3rem;
  margin-bottom: 30px;
}

/* Form */
.input-group {
  margin-bottom: 24px;
  text-align: left;
}
.input-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 1.1rem;
}
.input-group input {
  width: 100%;
  padding: 16px;
  font-size: 1.1rem;
  border: 3px solid #cbd5e1;
  border-radius: 12px;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.input-group input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.2);
}

/* Plinko Game */
.game-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  background: var(--cream);
  padding: 16px 24px;
  border-radius: 16px;
  border: 2px dashed var(--yellow);
}
.sound-toggle {
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
}
.sound-toggle input {
  width: 20px;
  height: 20px;
  cursor: pointer;
}
.drop-btn {
  width: auto;
  margin: 0;
}

.board-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: visible;
}
.plinko-board {
  width: 360px;
  height: 500px;
  background: linear-gradient(135deg, var(--blue), var(--dark-blue));
  border: 10px solid var(--red);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.6), 0 15px 35px rgba(0,0,0,0.25);
  flex-shrink: 0;
}

.pegs-container {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 60px;
}
.peg {
  width: 10px;
  height: 10px;
  background: #e2e8f0;
  border-radius: 50%;
  position: absolute;
  box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3), 2px 2px 4px rgba(0,0,0,0.8);
}

.slots-container {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 60px;
  display: flex;
  background: var(--dark-blue);
  box-shadow: 0 -4px 10px rgba(0,0,0,0.5);
}
.slot {
  flex: 1;
  border-left: 2px solid var(--red);
  border-top: 4px solid var(--red);
  color: var(--yellow);
  font-family: 'Anton', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  text-align: center;
  line-height: 1.1;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
.slot:nth-child(odd) {
  background: rgba(255,255,255,0.05);
}
.slot:first-child { border-left: none; }

.chip {
  width: 30px;
  height: 30px;
  background: radial-gradient(circle at 30% 30%, #fef08a, var(--yellow), #ca8a04);
  border-radius: 50%;
  position: absolute;
  top: -40px;
  left: 0;
  box-shadow: 0 4px 8px rgba(0,0,0,0.6), inset 0 -2px 4px rgba(0,0,0,0.3);
  z-index: 10;
}

/* Results */
.result-card h2 {
  font-size: 3.5rem;
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); text-shadow: 4px 4px 0 var(--yellow); }
  100% { transform: scale(1); }
}
.prize-display {
  font-family: 'Space Mono', monospace;
  font-size: 2.5rem;
  color: var(--red);
  margin: 30px 0;
  font-weight: 700;
  text-shadow: 2px 2px 0 var(--yellow);
  background: var(--cream);
  padding: 20px;
  border: 4px dashed var(--yellow);
  border-radius: 16px;
}
.code-box {
  background: white;
  border: 3px solid var(--blue);
  padding: 16px;
  font-family: 'Space Mono', monospace;
  font-size: 1.5rem;
  font-weight: bold;
  letter-spacing: 2px;
  margin: 10px auto;
  max-width: 300px;
  border-radius: 12px;
  user-select: all;
  color: var(--dark-blue);
}
.limit-text {
  font-size: 1rem;
  color: #64748b;
  margin-top: 30px;
  font-weight: 600;
}

/* Share Panel */
.share-panel {
  margin-top: 30px;
  padding: 30px;
  border-color: var(--blue);
  box-shadow: inset 0 0 0 6px var(--blue);
}
.share-panel h3 {
  font-size: 2rem;
  margin-bottom: 10px;
}
.share-input-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}
.share-input-group input {
  flex: 1;
  padding: 12px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  border: 2px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

#wbx-powered-by-slot {
  margin: 40px auto 20px auto;
  width: 100%;
}

@media(max-width: 600px) {
  .marquee-title h1 { font-size: 3rem; }
  .step-container { padding: 24px; }
  .step-container h2 { font-size: 2.2rem; }
  .game-controls { flex-direction: column; gap: 16px; }
  .plinko-board { transform: scale(0.85); transform-origin: top center; margin-bottom: -75px; }
  .prize-display { font-size: 1.8rem; }
}
