:root {
  --bg: #f1e8db;
  --card: #f1e8db;
  --text: #1f1b16;
  --accent: #c05c2e;
  --accent-2: #2e6f68;
  --border: #d9c9b2;
}

* {
  box-sizing: border-box;
  font-family: "Raleway", "Trebuchet MS", sans-serif;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 20%, #f7e7cc, transparent 35%),
    radial-gradient(circle at 80% 10%, #d2e8d9, transparent 30%),
    var(--bg);
}

.page {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px;
  min-height: 100vh;
  display: grid;
  align-content: start;
  gap: 10px;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: 0.02em;
  text-align: center;
}

.subtitle {
  margin-top: 0;
  opacity: 0.85;
}

.card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0;
}

input,
textarea,
button {
  width: 100%;
  margin: 6px 0;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 16px; /* prevents iOS auto-zoom on focus */
}

button {
  background: var(--accent);
  color: white;
  border: none;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation; /* prevents iOS double-tap delay */
}

button:hover {
  filter: brightness(0.95);
}

.wheel-wrap {
  display: none;
}

.slot-machine {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  margin: 6px auto 0;
  min-height: 220px;
  width: min(760px, 100%);
}

.light-frame {
  position: relative;
  border: 3px solid #402a1f;
  border-radius: 16px;
  min-height: 180px;
  background: linear-gradient(180deg, #2f2722, #4d3a2e);
  padding: 20px;
  overflow: hidden;
}

.light {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ff6f61;
  box-shadow: 0 0 8px #ff6f61;
}

.light.yellow {
  background: #ffd94a;
  box-shadow: 0 0 12px #ffd94a;
}

.slot-window {
  border: 3px solid #2b2520;
  border-radius: 12px;
  background: linear-gradient(180deg, #25353f, #182126);
  height: 146px;
  color: #f8fbff;
  overflow: hidden;
  position: relative;
}

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

.slot-window::before {
  top: 0;
  background: linear-gradient(180deg, rgba(10, 10, 10, 0.4), rgba(10, 10, 10, 0));
}

.slot-window::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(10, 10, 10, 0.4), rgba(10, 10, 10, 0));
}

.slot-reel {
  height: 146px;
}

.slot-item {
  height: 146px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 16px;
}

.slot-title {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.slot-author {
  margin-top: 8px;
  font-size: 0.9rem;
  opacity: 0.95;
  color: #c4ebff;
}

.wheel-label {
  width: 100%;
  border: 2px dashed var(--accent-2);
  min-height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: #f6fffb;
  font-weight: 700;
  text-align: center;
}

.slot-machine.rolling .slot-window {
  animation: pulse 0.18s linear infinite;
}

.lever-wrap {
  display: flex;
  justify-content: center;
}

.lever-track {
  width: 24px;
  height: 180px;
  border-radius: 999px;
  background: #3c2e24;
  position: relative;
  border: 2px solid #221912;
}

.lever-handle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff8f4a, #bf4f1f);
  border: 3px solid #632613;
  position: absolute;
  left: 50%;
  transform: translate(-50%, 0);
  top: 8px;
  cursor: grab;
  touch-action: none;
}

.lever-handle:active {
  cursor: grabbing;
}

@keyframes pulse {
  0% {
    transform: rotate(-0.5deg) scale(1);
  }
  50% {
    transform: rotate(0.5deg) scale(1.02);
  }
  100% {
    transform: rotate(-0.5deg) scale(1);
  }
}

.winner {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-2);
  text-align: center;
  min-height: 1.4em;
}

.status {
  margin-top: 2px;
  font-size: 0.95rem;
  text-align: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-card {
  width: min(420px, 90vw);
  background: #fffaf2;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid var(--border);
  box-sizing: border-box;
}

input[type="datetime-local"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  box-sizing: border-box;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.secondary {
  background: #6c6b68;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

ul {
  margin: 8px 0;
  padding-left: 20px;
}

.ghost {
  width: fit-content;
  justify-self: center;
  background: transparent;
  color: #6f4d35;
  border: 1px solid #cda47f;
  padding: 8px 12px;
}

.ghost:hover {
  background: #ead6c2;
}

@media (max-width: 680px) {
  .slot-machine {
    grid-template-columns: 1fr 70px;
  }

  .lever-track {
    height: 156px;
  }

  .page {
    padding: 14px;
  }
}
