@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --success: #10b981;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* Header */
header {
  width: 100%;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

h1 {
  font-weight: 800;
  font-size: 1.8rem;
  background: linear-gradient(135deg, #a5b4fc, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

/* Main Layout */
main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem;
  width: 100%;
  max-width: 1200px;
  align-items: center;
}

@media (min-width: 900px) {
  main {
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    height: calc(100vh - 80px);
    /* Fill remaining height */
  }
}

/* Wheel Container */
.wheel-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  flex: 1;
}

canvas {
  width: 100%;
  /* Larger wheel */
  max-width: 700px;
  height: auto;
  aspect-ratio: 1/1;
  border-radius: 50%;
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.2);
  transition: transform 0.1s;
}

/* Pointer removed from DOM, drawn in Canvas */

/* Controls Area */
.controls {
  flex: 0 0 350px;
  background: var(--card-bg);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  height: fit-content;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

textarea {
  width: 100%;
  height: 150px;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  color: var(--text-main);
  font-family: inherit;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}

textarea:focus {
  border-color: var(--primary);
}

textarea[readonly] {
  background: rgba(15, 23, 42, 0.5);
  color: var(--text-muted);
  cursor: not-allowed;
  height: 100px;
}

/* Checkbox Style */
.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  user-select: none;
}

input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label {
  text-transform: none;
  color: var(--text-main);
  cursor: pointer;
}

.btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: auto;
}

button {
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-spin {
  grid-column: span 2;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.btn-spin:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-spin:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-secondary:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

/* Winner Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--card-bg);
  padding: 3rem;
  border-radius: 1.5rem;
  text-align: center;
  border: 1px solid var(--border);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 90%;
  width: 400px;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.winner-text {
  font-size: 3rem;
  font-weight: 800;
  margin: 1rem 0 2rem;
  background: linear-gradient(135deg, #fbbf24, #d97706);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  word-break: break-word;
}

.celebrate-text {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.close-btn {
  background: var(--border);
  color: var(--text-main);
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.close-btn:hover {
  background: #475569;
}