:root {
  color-scheme: light;
  --bg-1: #2b0f5e;
  --bg-2: #7b1fa2;
  --card-bg: #ffffff;
  --text-dark: #241a3a;
  --text-muted: #6a6280;
  --accent: #ff5a5f;
  --accent-dark: #d9363e;
  --yellow: #ffc107;
  --yellow-dark: #d39e00;
  --radius: 20px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(circle at 50% 0%, var(--bg-2), var(--bg-1) 70%);
  color: var(--text-dark);
  -webkit-tap-highlight-color: transparent;
}

.app {
  height: 100dvh;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px;
}

.screen {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ---------- Registration ---------- */

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: min(480px, 100%);
  box-shadow: 0 30px 60px rgba(0,0,0,0.35);
  text-align: center;
}

.title {
  margin: 0 0 6px;
  font-size: clamp(28px, 4vw, 40px);
  color: var(--bg-1);
}

.subtitle {
  margin: 0 0 28px;
  color: var(--text-muted);
  font-size: clamp(12px, 4.4vw, 18px);
  white-space: nowrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.field input {
  font-size: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 2px solid #e1dcef;
  outline: none;
  font-family: inherit;
}

.field input:focus {
  border-color: var(--bg-2);
}

.btn {
  border: none;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
  padding: 16px 28px;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 0.08s ease, filter 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  width: 100%;
  margin-top: 6px;
  background: var(--bg-1);
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

.error-text {
  margin-top: 14px;
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 14px;
}

/* ---------- Wheel screen ---------- */

#screen-wheel {
  gap: 28px;
  position: relative;
}

.wheel-stage {
  position: relative;
  width: min(88vw, 78vh, 560px);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheel-disc {
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
  transform: rotate(0deg);
  filter: drop-shadow(0 18px 30px rgba(0,0,0,0.45));
  touch-action: manipulation;
}

.wheel-disc.used {
  filter: grayscale(1) opacity(0.55) drop-shadow(0 12px 20px rgba(0,0,0,0.3));
  pointer-events: none;
}

.wheel-disc svg {
  width: 100%;
  height: 100%;
  display: block;
}

.wheel-pointer {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 22px solid transparent;
  border-right: 22px solid transparent;
  border-top: 40px solid var(--accent);
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
  z-index: 5;
}

.btn-spin {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  font-size: 22px;
  letter-spacing: 1px;
  padding: 20px 56px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(217,54,62,0.5);
}

.btn-spin:disabled {
  opacity: 0.5;
  cursor: default;
  box-shadow: none;
}

/* ---------- Used banner ---------- */

.used-banner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.used-message {
  background: rgba(255,255,255,0.95);
  color: var(--text-dark);
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  max-width: 520px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.25);
}

.btn-logout {
  background: linear-gradient(180deg, var(--yellow) 0%, var(--yellow-dark) 100%);
  color: #3a2a00;
  font-size: 18px;
  padding: 16px 40px;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(211,158,0,0.5);
}

/* ---------- Overlay ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 8, 45, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
  animation: fadeIn 0.25s ease;
}

.overlay-card {
  background: #fff;
  border-radius: 24px;
  padding: 40px 32px;
  text-align: center;
  width: min(440px, 100%);
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
  animation: popIn 0.3s cubic-bezier(0.17, 0.67, 0.32, 1.4);
}

.overlay-card h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 3.5vw, 30px);
  color: var(--bg-1);
}

.overlay-card p {
  margin: 0;
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.5;
}

.overlay-card .prize-name {
  display: block;
  margin: 16px 0;
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-dark);
}

.overlay-card .prize-image {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 18px;
  border: 4px solid var(--yellow);
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.overlay-card .prize-emoji {
  font-size: 80px;
  margin-bottom: 10px;
}

.overlay-card .btn-primary {
  margin-top: 24px;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
