/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--sf-font);
  background: var(--sf-bg);
  color: var(--sf-text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1;
  background: var(--sf-bg);
}

.screen.active {
  display: flex;
}

/* ── Loading Screen ── */
.loader-container {
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--sf-primary-lightest);
  border-top-color: var(--sf-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.loader-text {
  color: var(--sf-text-muted);
  font-size: 14px;
}

/* ── Error Screen ── */
.error-container {
  text-align: center;
  padding: 32px;
  max-width: 320px;
}

.error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.error-container h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.error-container p {
  color: var(--sf-text-muted);
  font-size: 14px;
  line-height: 1.5;
}

/* ── Main App Container ── */
.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  width: 100%;
  max-width: 420px;
  height: 100%;
  gap: 20px;
}

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

.logo-svg {
  width: auto;
  height: 220px;
  color: var(--sf-text);
  margin-bottom: 20px;
}

.header h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--sf-text);
}

.highlight {
  background: var(--sf-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--sf-text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* ── Wheel ── */
.wheel-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wheel-pointer {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 28px solid var(--sf-pointer-color);
  z-index: 10;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

#wheel-canvas {
  border-radius: 50%;
  box-shadow:
    0 0 0 6px var(--sf-wheel-border-color),
    0 0 0 10px var(--sf-wheel-outer-ring),
    0 0 30px rgba(101, 51, 49, 0.2);
  transition: transform 4s cubic-bezier(0.17, 0.67, 0.12, 0.99);
}

/* ── Spin Button ── */
.spin-button {
  width: 100%;
  max-width: 280px;
  padding: 16px 32px;
  border: none;
  border-radius: 50px;
  background: var(--sf-gradient-btn);
  color: white;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: var(--sf-shadow);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.spin-button:active {
  transform: scale(0.97);
}

.spin-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.spin-button.spinning .spin-text::after {
  content: '...';
  animation: dots 1.2s steps(3) infinite;
}

@keyframes dots {
  0% { content: '.'; }
  33% { content: '..'; }
  66% { content: '...'; }
}

/* ── Result Screen ── */
.result-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.result-content {
  text-align: center;
  padding: 40px 24px;
  background: white;
  border-radius: var(--sf-radius);
  border: 1px solid var(--sf-primary-lightest);
  max-width: 340px;
  width: calc(100% - 32px);
  z-index: 2;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.1);
}

.result-content h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--sf-text);
}

.result-prize {
  font-size: 22px;
  font-weight: 800;
  background: var(--sf-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  line-height: 1.3;
}

.result-note {
  color: var(--sf-text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.close-button {
  padding: 12px 40px;
  border: 1px solid var(--sf-primary-lightest);
  border-radius: 50px;
  background: transparent;
  color: var(--sf-primary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.close-button:active {
  background: var(--sf-primary-lightest);
}

/* ── Responsive ── */
@media (max-height: 680px) {
  .header h1 { font-size: 22px; }
  .subtitle { font-size: 12px; }
  .app-container { gap: 12px; padding: 16px; }
  .logo-svg { height: 160px; margin-bottom: 12px; }
}

@media (min-width: 768px) {
  .header h1 { font-size: 36px; }
  .app-container { gap: 28px; }
}
