/* Wheel of Fortune - Styled Interface */

/* Import TwilioSansText font */
@font-face {
  font-family: "TwilioSansText";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: local(""), url("https://pages.twilio.com/rs/294-TKB-300/images/TwilioSansText-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "TwilioSansText";
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: local(""), url("https://pages.twilio.com/rs/294-TKB-300/images/TwilioSansText-Bold.woff2") format("woff2");
}

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

html {
  height: 100%;
  min-height: -webkit-fill-available;
}

body {
  font-family: 'TwilioSansText', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  position: relative;
  color: white;
  height: auto;
  min-height: 100%;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  overflow-y: auto;
  background: #000D25;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('/images/oc-background-1.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  pointer-events: none;
}

.prizes-shell {
  position: relative;
  z-index: 1;
  min-height: 100%;
}

.prizes-nav-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding:
    max(0.75rem, env(safe-area-inset-top, 0px))
    1rem
    0.75rem;
  background: transparent;
  border: none;
  box-shadow: none;
}

.prizes-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  justify-self: start;
}

.prizes-nav-back:active {
  background: rgba(255, 255, 255, 0.1);
}

.prizes-nav-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.prizes-nav-title {
  text-align: center;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  justify-self: center;
}

.prizes-nav-spacer {
  justify-self: end;
  width: 4.75rem;
  height: 1px;
}

.prizes-content {
  padding: 0 1rem calc(20px + env(safe-area-inset-bottom, 0px));
}

.container {
  width: min(100%, 500px);
  margin: 0 auto;
}

/* Content Sections */
.content {
  padding: 0;
}

.state-section {
  text-align: center;
  padding: 20px 0;
}

.hidden {
  display: none !important;
}

/* Loading */
.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #f22f46;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Titles */
.welcome-title {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  margin-bottom: 12px;
  color: white;
  line-height: 1;
  font-size: clamp(1.35rem, 5vw, 2.05rem);
  font-weight: 800;
}

.mission-count-value {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  color: #68d391;
  text-shadow: 0 0 16px rgba(104, 211, 145, 0.22);
  white-space: nowrap;
}

.mission-count-label {
  display: inline;
  font-size: inherit;
  font-weight: inherit;
  color: white;
  white-space: nowrap;
}

.wheel-subtitle {
  font-size: 16px;
  color: #cbd5e0;
  margin-bottom: 26px;
  line-height: 1.35;
}

.subtitle {
  color: #a0aec0;
  margin-bottom: 20px;
}

/* Wheel Container */
.wheel-container {
  position: relative;
  width: min(380px, calc(100vw - 4.5rem));
  height: min(380px, calc(100vw - 4.5rem));
  margin: 0 auto 30px;
}

/* Glassy background ring behind the wheel */
.wheel-container::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(255,255,255,0.12) 0%, rgba(255,255,255,0.06) 40%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow:
    0 0 40px rgba(255, 255, 255, 0.1),
    0 8px 40px rgba(0, 0, 0, 0.4),
    inset 0 0 30px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  z-index: 0;
}

/* Glass overlay on top of the wheel */
.wheel-container::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.08) 40%, rgba(255,255,255,0.02) 100%);
  border: 6px solid rgba(255, 255, 255, 0.3);
  pointer-events: none;
  z-index: 5;
}

.wheel-pointer {
  position: absolute;
  top: -17px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 36px;
  z-index: 10;
  filter:
    drop-shadow(0 0 8px rgba(255, 255, 255, 0.8))
    drop-shadow(0 0 15px rgba(79, 172, 254, 0.6))
    drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.wheel-pointer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 36px solid white;
  border-radius: 4px;
}

#wheel-canvas {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0s;
}

/* Full-row prize reel */
.prize-reel-container {
  position: relative;
  width: min(100%, 420px);
  margin: 0 auto 30px;
  padding: 16px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(79, 172, 254, 0.18), transparent 46%),
    linear-gradient(180deg, rgba(3, 27, 64, 0.96), rgba(2, 14, 38, 0.98));
  border: 1px solid rgba(0, 161, 253, 0.32);
  box-shadow:
    0 18px 48px rgba(2, 6, 23, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.prize-row-odometer {
  width: 100%;
}

.row-reel-window {
  position: relative;
  height: 6rem;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(31, 80, 153, 0.92), rgba(11, 49, 112, 0.96));
  border: 1px solid rgba(125, 211, 252, 0.24);
  box-shadow:
    inset 0 16px 28px rgba(255, 255, 255, 0.06),
    inset 0 -16px 28px rgba(2, 6, 23, 0.28),
    0 12px 28px rgba(2, 6, 23, 0.28);
}

.row-reel-window::before,
.row-reel-window::after {
  content: '';
  position: absolute;
  pointer-events: none;
}

.row-reel-window::before {
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.62), rgba(2, 6, 23, 0) 32%, rgba(2, 6, 23, 0) 68%, rgba(2, 6, 23, 0.72)),
    linear-gradient(90deg, rgba(2, 6, 23, 0.8), rgba(2, 6, 23, 0) 16%, rgba(2, 6, 23, 0) 84%, rgba(2, 6, 23, 0.8));
}

.row-reel-window::after {
  top: 50%;
  left: 28px;
  right: 28px;
  height: 1px;
  z-index: 1;
  background: rgba(255, 255, 255, 0.24);
  box-shadow:
    0 -26px 0 rgba(255, 255, 255, 0.07),
    0 26px 0 rgba(255, 255, 255, 0.07),
    0 0 14px rgba(125, 211, 252, 0.2);
  transform: translateY(-50%);
}

.reel-track {
  position: relative;
  z-index: 2;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.reel-item {
  height: 6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.2rem;
  color: rgba(255, 255, 255, 0.96);
  font-size: clamp(1.3rem, 5.8vw, 2.35rem);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(2, 6, 23, 0.36);
}

.reel-item--blank {
  color: transparent;
  text-shadow: none;
}

/* Spin Button - Matching main app glass-btn style */
.spin-button {
  width: 100%;
  max-width: 300px;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: white;
  background: linear-gradient(135deg, rgba(59,130,246,0.4), rgba(59,130,246,0.2));
  border: 1px solid rgba(59,130,246,0.3);
  box-shadow: 0 4px 20px rgba(59,130,246,0.15);
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 0 auto 10px;
  display: block;
}

.spin-button:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(59,130,246,0.5), rgba(59,130,246,0.3));
  transform: scale(1.02);
}

.spin-button:active:not(:disabled) {
  transform: scale(0.98);
}

.spin-button:disabled {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.4);
  cursor: not-allowed;
  box-shadow: none;
}

.spin-status {
  font-size: 14px;
  color: #a0aec0;
  min-height: 20px;
}

/* TEST BUTTON - Remove in production */
.test-spin-button {
  background: rgba(242, 47, 70, 0.2);
  color: #f22f46;
  border: 2px solid #f22f46;
  padding: 10px 30px;
  border-radius: 25px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s;
}

.test-spin-button:hover {
  background: rgba(242, 47, 70, 0.3);
  transform: scale(1.02);
}

/* Rewards Section */
.rewards-section {
  margin-top: 15px;
  padding-top: 10px;
}

.rewards-section h2 {
  font-size: 20px;
  margin-bottom: 15px;
}

.rewards-progress {
  margin-bottom: 25px;
}

.rewards-count {
  display: block;
  font-size: 14px;
  color: #a0aec0;
  margin-bottom: 8px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(59,130,246,0.8) 0%, rgba(59,130,246,0.6) 100%);
  border-radius: 10px;
  transition: width 0.5s ease;
}

.prize-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.prize-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow:
    -8px -8px 24px rgba(255,255,255,0.03),
    10px 14px 34px rgba(0,0,0,0.6),
    inset 1px 1px 0 rgba(255,255,255,0.02);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  gap: 15px;
  align-items: center;
  transition: all 0.2s;
}

.prize-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.prize-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.1);
}

.prize-info {
  flex: 1;
  text-align: left;
}

.prize-name {
  font-weight: bold;
  font-size: 16px;
  margin-bottom: 5px;
}

.prize-tier {
  font-size: 14px;
  color: #a0aec0;
}

.prize-status {
  padding: 8px 15px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
}

.prize-status.unclaimed {
  background: rgba(242, 47, 70, 0.2);
  color: white;
}

.prize-status.claimed {
  background: rgba(104, 211, 145, 0.2);
  color: white;
}

.no-prizes {
  color: #a0aec0;
  font-style: italic;
  padding: 40px;
}

/* Unlock Requirements */
.unlock-list {
  list-style: none;
  padding: 0;
  margin-top: 30px;
}

.unlock-list li {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
  text-align: left;
}

.unlock-list li.unlocked {
  border-color: #48bb78;
  background: rgba(72, 187, 120, 0.1);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  padding: 40px 30px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

.prize-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.prize-confetti.hidden {
  display: none;
}

.prize-confetti-piece {
  position: absolute;
  top: -18%;
  width: 0.55rem;
  height: 1rem;
  border-radius: 999px;
  opacity: 0.92;
  animation-name: prizeConfettiFall;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

@keyframes prizeConfettiFall {
  from {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  to {
    transform: translate3d(var(--drift, 0px), 125vh, 0) rotate(540deg);
  }
}

.modal-content > :not(.prize-confetti) {
  position: relative;
  z-index: 1;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content > .modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.sparkle {
  font-size: 50px;
  margin-bottom: 20px;
  animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
  0%, 100% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.2) rotate(10deg); }
}

#modal-title {
  font-size: 24px;
  font-weight: bold;
  margin-bottom: 15px;
}

#modal-description {
  font-size: 16px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 25px;
}

.claim-instruction {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
  margin-bottom: 20px;
  padding: 15px 20px;
  background: rgba(79, 172, 254, 0.15);
  border: 1px solid rgba(79, 172, 254, 0.3);
  border-radius: 12px;
}

.next-spin-text {
  font-size: 12px;
  color: #cbd5e0;
}

.prize-list-claim-instruction {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0.8rem 0 0;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(79, 172, 254, 0.32);
  border-radius: 14px;
  background: rgba(79, 172, 254, 0.13);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
}

/* Error State */
.error-text {
  color: #fc8181;
  background: rgba(252, 129, 129, 0.1);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(252, 129, 129, 0.3);
}

/* Offset page content when prize announcement banner is visible */
body.prize-banner-open .prizes-shell {
  margin-top: var(--prize-banner-height, 48px);
}
