:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --bg: #0f172a;
  --panel-bg: #1e293b;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --input-bg: #0f172a;
  --accent: #c084fc;
  --sidebar-width: 380px;
  --sidebar-collapsed-width: 60px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Layout Overhaul */
.app-container {
  display: flex;
  flex-direction: row-reverse;
  flex: 1;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar (Controls) - 30% area aprox */
.sidebar {
  width: var(--sidebar-width);
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  transition:
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.5s;
  z-index: 100;
}

body.is-spinning .sidebar {
  pointer-events: none !important;
  opacity: 0.7 !important;
  filter: grayscale(0.3) !important;
}

/* Main Board (Results) - 70% area aprox */
.main-board {
  flex: 1;
  padding: 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: padding 0.5s;
  position: relative;
}

h1 {
  margin-bottom: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 2rem;
  text-align: center;
}

/* Wheel Animation */
.wheel-box {
  position: fixed;
  bottom: 30px;
  right: 410px;
  width: 220px;
  height: 220px;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(15, 23, 42, 0.95);
  border-radius: 50%;
  padding: 10px;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
  border: 3px solid var(--primary);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
}

body.is-spinning .wheel-box {
  opacity: 1;
  pointer-events: all;
  transform: scale(1);
}

#wheel-svg {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: transform 3s cubic-bezier(0.1, 0, 0, 1);
}

/* Full Screen Styles */
body.fullscreen h1 {
  display: none !important;
}

body.fullscreen .app-container {
  height: 100vh;
  width: 100vw;
}

body.fullscreen .main-board {
  flex: 1;
  padding: 20px;
}

.status-badge {
  position: absolute;
  font-weight: 800;
  font-size: 0.8rem;
  color: white;
  z-index: 60;
  text-align: center;
  pointer-events: none;
  background: var(--bg);
  padding: 6px 12px;
  border-radius: 20px;
  border: 2px solid var(--primary);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  white-space: nowrap;
}

.exit-fullscreen-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid var(--border);
  padding: 10px 15px;
  border-radius: 8px;
  cursor: pointer;
  z-index: 2000;
  display: none;
  backdrop-filter: blur(5px);
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

body.fullscreen .exit-fullscreen-btn {
  display: flex;
}

/* Controls Styling */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

textarea {
  width: 100%;
  height: 180px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: white;
  padding: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: none;
  outline: none;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--primary);
}

.settings-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.mode-toggle {
  display: flex;
  background: var(--bg);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}

.mode-btn {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
}

.mode-btn.active {
  background: var(--primary);
  color: white;
}

input[type="number"],
select {
  width: 100%;
  padding: 10px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: white;
  outline: none;
  font-size: 0.9rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
  justify-content: flex-start !important;
}

.primary-btn {
  width: 100%;
  padding: 14px;
  background: #16ac44;
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.secondary-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.2s;
}

/* Responsive Results Grid */
.results-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  align-content: flex-start;
}

.team-card {
  background: var(--panel-bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease backwards;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.team-header {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.team-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
}

.team-list {
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 50px;
}

.member-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  animation: slideIn 0.3s ease-out backwards;
}

.member-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.member-item i {
  font-size: 0.75rem;
  color: var(--primary);
}

.leader-badge {
  background: #fbbf24;
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: auto;
    position: relative;
    transform: none !important;
    opacity: 1 !important;
    pointer-events: all !important;
    padding: 20px;
  }

  .main-board {
    height: auto;
    overflow: visible;
    padding: 20px;
  }
  .placeholder-box {
    margin-top: 150px;
  }

  .wheel-box {
    width: 150px;
    height: 150px;
    bottom: 15px;
    left: 15px;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }
}

/* Summary Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.modal-content {
  background: var(--panel-bg);
  padding: 30px;
  border-radius: 24px;
  max-width: 900px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  position: relative;
}

.close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.close-modal:hover {
  color: white;
}

.placeholder-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--text-muted);
  border: 2px dashed var(--border);
  border-radius: 20px;
  width: 100%;
  text-align: center;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 300px;
  left: 50%;
  padding: 0 20px;
}

.placeholder-box i {
  font-size: 4rem;
  margin-bottom: 20px;
  opacity: 0.3;
}
