:root {
  --sidebar-width: 250px;
  --sidebar-mobile-height: 80px;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  border-radius: 0 0 8px 8px;
  z-index: 1000;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.3s ease;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #6366f1;
  outline-offset: 2px;
}

/* Button loading state */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn.loading {
  position: relative;
  color: transparent;
}

.btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  top: 50%;
  left: 50%;
  margin-left: -10px;
  margin-top: -10px;
  border: 2px solid #000;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark Mode */
.dark {
  background: linear-gradient(135deg, #1e293b, #0f172a) !important;
}

.dark body {
  background: linear-gradient(135deg, #1e293b, #0f172a) !important;
}

.dark .glass {
  background: rgba(30, 41, 59, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark .title-glow {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.dark h1,
.dark h2,
.dark h3,
.dark .text-black {
  color: #e2e8f0 !important;
}

.dark .sidebar {
  background: rgba(30, 41, 59, 0.5) !important;
}

.dark .sidebar-header {
  color: #e2e8f0 !important;
}

.dark .preset-btn {
  background: rgba(50, 65, 90, 0.5) !important;
  color: #e2e8f0 !important;
}

.dark .preset-btn:hover {
  background: rgba(70, 90, 120, 0.6) !important;
}

.dark textarea {
  background: rgba(30, 41, 59, 0.5) !important;
  color: #e2e8f0 !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark textarea::placeholder {
  color: #94a3b8 !important;
}

.dark .winner-card {
  background: rgba(30, 41, 59, 0.5) !important;
}

.dark .canvas-center {
  background: #1e293b !important;
}

.dark .wheel-pointer {
  border-right-color: #e2e8f0 !important;
}

.dark hr {
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.dark .skip-link {
  background: #e2e8f0;
  color: #1e293b;
}

.dark .text-black\/60,
.dark .text-black\/70 {
  color: #94a3b8 !important;
}

.dark #taskLegend {
  color: #94a3b8 !important;
}

.dark #presetPreview {
  background: rgba(30, 41, 59, 0.5) !important;
}

.dark #previewTitle,
.dark #previewContent {
  color: #e2e8f0 !important;
}

body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #a5f3fc, #c7d2fe);
  color: #000;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

.glass {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2);
}

.title-glow {
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.7);
}

.animate-spin-slow {
  animation: spin 8s linear infinite;
}

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

.canvas-container {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 0 auto;
}

.wheel-pointer {
  position: absolute;
  top: 50%;
  right: -25px;
  width: 0;
  height: 0;
  border-top: 15px solid transparent;
  border-bottom: 15px solid transparent;
  border-right: 25px solid #111;
  transform: translateY(-50%);
  z-index: 10;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.7));
}

.canvas-center {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  z-index: 5;
}

.winner-card {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.5s ease-out;
}

.winner-card.show {
  opacity: 1;
  transform: translateY(0);
}

.btn {
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

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

.btn:focus,
.preset-btn:focus,
button:focus {
  outline: 3px solid #6366f1;
  outline-offset: 2px;
}

.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  height: 100vh;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 20;
}

.right-sidebar {
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 2rem;
  color: #000;
}

.preset-btn {
  width: 90%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 0.5rem;
  border: none;
  color: #000;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.main-content {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-y: auto;
  min-height: 100vh;
  max-width: 100%;
}

/* Mobile Styles */
@media (max-width: 1024px) {
  body {
    flex-direction: column;
  }
  
  .main-content {
    padding-top: calc(var(--sidebar-mobile-height) + 1rem);
    min-height: calc(100vh - var(--sidebar-mobile-height));
  }
  
  .sidebar {
    position: fixed;
    top: 0;
    width: 100%;
    height: var(--sidebar-mobile-height);
    flex-direction: row;
    overflow-x: auto;
    padding: 0.5rem;
  }
  
  .left-sidebar {
    left: 0;
    justify-content: flex-start;
  }
  
  .right-sidebar {
    bottom: 0;
    top: auto;
    justify-content: flex-start;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    border-left: none;
  }
  
  .sidebar-header {
    margin-bottom: 0;
    margin-right: 1rem;
    white-space: nowrap;
    font-size: 1.25rem;
  }
  
  .preset-btn {
    width: auto;
    margin: 0 0.5rem;
    padding: 0.5rem 1rem;
    white-space: nowrap;
  }
  
  h1.title {
    font-size: 2rem;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
  }
  
  .wheel-container {
    transform: scale(0.85);
    margin: -1rem 0;
  }
  
  .input-section {
    flex-direction: column;
  }
}

/* Medium screens */
@media (min-width: 768px) and (max-width: 1024px) {
  h1.title {
    font-size: 2.5rem;
  }
}

/* Additional responsive fixes */
@media (max-width: 640px) {
  .input-grid {
    grid-template-columns: 1fr !important;
  }
  
  .buttons-container {
    flex-direction: column;
    align-items: center;
  }
  
  .buttons-container button {
    margin: 0.5rem 0;
    width: 100%;
  }
  
  .wheels-grid {
    grid-template-columns: 1fr !important;
  }
  
  .wheel-container {
    transform: scale(0.8);
    margin: -2rem 0;
  }
}

/* This ensures the modal always stays on top of everything else */
#shareModal {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 9999 !important; /* Extremely high number to beat other elements */
}

/* Optional: Make the appearance smooth */
#shareModal:not(.hidden) {
  display: flex !important;
  animation: fadeIn 0.3s ease;
}

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