:root {
  --bg: #0d0f1a;
  --surface: #141829;
  --surface2: #1c2035;
  --gold: #f5c842;
  --gold-dim: #c9a030;
  --text: #e8eaf0;
  --text-dim: #7a7f99;
  --slot-height: 60px;
  --viewport-height: 420px;
  --window-height: 60px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Georgia', 'Times New Roman', serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* Radial glow behind the wheel */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(245, 200, 66, 0.06) 0%, transparent 65%);
  pointer-events: none;
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  padding: 40px 20px;
  width: 100%;
  max-width: 1200px;
}

/* --- Wheels container --- */
.wheels-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 32px;
  width: 100%;
}

/* --- Individual wheel instance --- */
.wheel-instance {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  position: relative;
}

/* --- Remove button --- */
.remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.remove-btn:hover:not(:disabled) {
  background: rgba(255, 80, 80, 0.25);
  color: #ff6b6b;
  border-color: #ff6b6b;
}

.remove-btn:disabled {
  opacity: 0;
  pointer-events: none;
}

/* --- Add Wheel button --- */
.add-wheel-btn {
  appearance: none;
  background: transparent;
  border: 2px dashed rgba(245, 200, 66, 0.35);
  border-radius: 8px;
  color: var(--gold-dim);
  padding: 12px 32px;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.add-wheel-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245, 200, 66, 0.05);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  width: 100%;
}

/* --- Header --- */
header {
  text-align: center;
}

h1 {
  font-size: 2.6rem;
  font-weight: normal;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 0 40px rgba(245, 200, 66, 0.35);
}

.subtitle {
  margin-top: 6px;
  font-size: 0.95rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
  font-style: italic;
}

/* --- Wheel wrapper (provides shadow + border) --- */
.wheel-wrapper {
  width: 300px;
  border-radius: 16px;
  overflow: hidden;
  border: 2px solid rgba(245, 200, 66, 0.2);
  box-shadow:
    0 0 0 1px rgba(245, 200, 66, 0.08),
    0 8px 60px rgba(0, 0, 0, 0.7),
    inset 0 0 40px rgba(0, 0, 0, 0.4);
  background: var(--surface);
  height: var(--viewport-height);
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.5s ease,
              box-shadow 0.5s ease;
}

.wheel-wrapper.collapsed {
  height: 0;
  border-color: transparent;
  box-shadow: none;
}

/* --- Wheel viewport (the visible window into the drum) --- */
.wheel-viewport {
  position: relative;
  height: var(--viewport-height);
  overflow: hidden;
  /* Subtle 3D perspective so slots curve toward the edges */
  perspective: 600px;
}

/* --- Drum (the scrolling column of movie slots) --- */
.wheel-drum {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  will-change: transform;
  transform: translateY(0);
}

/* --- Individual movie slot --- */
.movie-slot {
  height: var(--slot-height);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  font-size: 0.9rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.25;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: color 0.15s;
  user-select: none;
}

.movie-slot.active {
  color: var(--text);
  font-size: 1rem;
}

/* --- Gradient fades at top and bottom --- */
.fade-top,
.fade-bottom {
  position: absolute;
  left: 0;
  width: 100%;
  height: 38%;
  pointer-events: none;
  z-index: 2;
}

.fade-top {
  top: 0;
  background: linear-gradient(to bottom, var(--surface) 0%, transparent 100%);
}

.fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--surface) 0%, transparent 100%);
}

/* --- Center selection window --- */
.center-window {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--window-height);
  top: calc(50% - var(--window-height) / 2);
  pointer-events: none;
  z-index: 3;
  border-top: 2px solid var(--gold);
  border-bottom: 2px solid var(--gold);
  box-shadow:
    0 0 20px rgba(245, 200, 66, 0.15),
    inset 0 0 20px rgba(245, 200, 66, 0.05);
}

/* Notch arrows on the sides of the center window */
.center-window::before,
.center-window::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-style: solid;
}

.center-window::before {
  left: 8px;
  border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent var(--gold);
}

.center-window::after {
  right: 8px;
  border-width: 7px 12px 7px 0;
  border-color: transparent var(--gold) transparent transparent;
}

/* --- Spin button --- */
.spin-btn {
  appearance: none;
  display: block;
  width: 220px;
  background: var(--gold);
  color: #0d0f1a;
  border: none;
  border-radius: 8px;
  padding: 16px 0;
  font-size: 1.1rem;
  font-weight: bold;
  letter-spacing: 0.2em;
  /* Offset trailing letter-spacing so text is visually centered */
  text-indent: 0.2em;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 4px 24px rgba(245, 200, 66, 0.3);
}

.spin-btn:hover:not(:disabled) {
  background: #ffd84a;
  box-shadow: 0 4px 32px rgba(245, 200, 66, 0.5);
}

.spin-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.spin-btn:disabled {
  background: var(--gold-dim);
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

/* --- Result area --- */
.result-area {
  text-align: center;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.result-area.visible {
  opacity: 1;
  transform: translateY(0);
}

.result-label {
  font-size: 0.85rem;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-title {
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 0.03em;
  text-shadow: 0 0 30px rgba(245, 200, 66, 0.4);
  line-height: 1.3;
}

.result-title.hidden {
  filter: blur(10px);
  user-select: none;
}

.reveal-btn {
  appearance: none;
  background: transparent;
  border: 1px solid rgba(245, 200, 66, 0.4);
  border-radius: 6px;
  color: var(--gold-dim);
  padding: 8px 24px;
  font-size: 0.85rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  display: none;
}

.reveal-btn.visible {
  display: block;
}

.reveal-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(245, 200, 66, 0.05);
}

.result-poster {
  width: 180px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s ease 0.2s, transform 0.4s ease 0.2s;
  display: block;
}

.result-poster.loaded {
  opacity: 1;
  transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 400px) {
  .wheel-wrapper {
    width: 100%;
  }

  h1 {
    font-size: 2rem;
  }
}
