/* Basic Resets & Animations */
body {
  font-family: 'Noto Sans', sans-serif;
  /* Fallback will handle scripts */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--bg1);
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background-color: var(--muted);
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}

/* Animations */
@keyframes blink-3-times {

  0%,
  16%,
  33%,
  50%,
  66%,
  83%,
  100% {
    opacity: 1
  }

  8%,
  25%,
  41%,
  58%,
  75%,
  91% {
    opacity: .3
  }
}

.blink-3-times {
  animation: blink-3-times 2s ease-in-out
}

@keyframes glow-3-times {

  0%,
  16%,
  33%,
  50%,
  66%,
  83%,
  100% {
    box-shadow: 0 0 20px rgba(37, 99, 235, .3)
  }

  8%,
  25%,
  41%,
  58%,
  75%,
  91% {
    box-shadow: 0 0 40px rgba(124, 58, 237, .6)
  }
}

.glow-3-times {
  animation: glow-3-times 2s ease-in-out
}

/* ================================
   THEME VARIABLES (UPDATED PALETTE)
   ================================ */

/* Light Mode Defaults */
:root {
  --g: #2563EB;
  --g2: #4F46E5;
  --line: #E2E8F0;
  --border: #E2E8F0;
  --panelA: #FFFFFF;
  --panelB: #F8FAFC;
  --bg0: #F1F5F9;
  /* Cooler background for better card contrast */
  --bg1: #FFFFFF;
  --text: #0F172A;
  /* Sharp Slate 900 */
  --muted: #475569;
  /* Darker Slate 600 for better label legibility */
  --input-text: #0F172A;

  --primary: #2563EB;
  --primary-2: #4F46E5;

  --surface: #F8FAFC;
  --card: #FFFFFF;
}

/* Dark Mode Overrides */
:root.dark {
  --g: #3B82F6;
  /* Blue 500 */
  --g2: #6366F1;
  /* Indigo 500 */
  --line: rgba(255, 255, 255, .05);
  --border: rgba(255, 255, 255, .10);
  --panelA: #0F172A;
  /* Slate 900 */
  --panelB: #020617;
  /* Slate 950 */
  --bg0: #0B0F17;
  /* Deeper clean dark */
  --bg1: #020617;
  /* Slate 950 */
  --text: #F1F5F9;
  /* Slate 100 */
  --muted: #94A3B8;
  /* Slate 400 */
  --input-text: #FFFFFF;

  --primary: #3B82F6;
  --primary-2: #6366F1;

  --surface: #0F172A;
  --card: #0F172A;
}

/* Body Background Logic - CLEAN & FLAT */
body {
  background-color: var(--bg0);
  color: var(--text);
}

.dark body {
  background-color: var(--bg0) !important;
  background-image: none !important;
}

header {
  background-color: var(--bg0) !important;
}

footer {
  background-color: var(--bg0) !important;
}

/* Buttons & Panels */
.bg-retro-accent {
  background: linear-gradient(180deg, var(--g), var(--g2)) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .2);
}

.dark button.bg-retro-accent {
  box-shadow: 0 4px 12px rgba(37, 99, 235, .15);
}

button.bg-retro-accent:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.custom-shadow-xl {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

input {
  color: var(--input-text) !important;
  background: var(--bg1);
  border-color: var(--border);
}

input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

select option {
  background-color: var(--card);
  color: var(--text);
}

/* Drawer & Overlay */
#page-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 49;
  backdrop-filter: blur(4px);
}

#page-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

#mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 85%;
  max-width: 320px;
  transform: translateX(-110%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--card);
  border-right: 1px solid var(--border);
  z-index: 50;
  display: flex;
  flex-direction: column;
}

#mobile-drawer.is-open {
  transform: translateX(0);
}

/* Center content in mobile links */
#mobile-drawer a,
#mobile-drawer button {
  justify-content: center;
  text-align: center;
}

/* ================================
   FAQ ACCORDION
   ================================ */
.faq-answer {
  transition: max-height 0.3s ease-in-out;
}

/* ================================
   SCORE CALCULATOR MODAL
   ================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation-fill-mode: both;
}

.fade-in {
  animation-name: fadeIn;
}

.zoom-in {
  animation-name: zoomIn;
}

.slide-in-from-bottom {
  animation-name: slideInUp;
}

.duration-300 {
  animation-duration: 300ms;
}

.duration-500 {
  animation-duration: 500ms;
}

/* Custom styles for calculator inputs */
#score-modal input::-webkit-outer-spin-button,
#score-modal input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

#score-modal input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ================================
   SCORE CALCULATOR PAGE
   ================================ */

/*.dark .whitespace-pre-wrap span,
.dark .whitespace-pre-wrap p,
.dark .whitespace-pre-wrap div,
.dark .whitespace-pre-wrap td,
.dark .whitespace-pre-wrap th,
.dark .whitespace-pre-wrap a,
.dark .whitespace-pre-wrap button,
.dark .prose span,
.dark .prose p,
.dark .prose div,
.dark .prose td,
.dark .prose th,
.dark .prose a,
.dark .prose button {
    color: var(--text) !important;
}

/* Specific fix for copied/pasted buttons from other sites using generic classes */
.dark .whitespace-pre-wrap .bg-white,
.dark .prose .bg-white,
.dark .whitespace-pre-wrap .bg-gray-50,
.dark .prose .bg-gray-50,
.dark .whitespace-pre-wrap .bg-gray-100,
.dark .prose .bg-gray-100,
.dark .whitespace-pre-wrap .bg-light,
.dark .prose .bg-light {
    background-color: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

.dark .whitespace-pre-wrap .text-gray-800,
.dark .prose .text-gray-800,
.dark .whitespace-pre-wrap .text-gray-900,
.dark .prose .text-gray-900,
.dark .whitespace-pre-wrap .text-black,
.dark .prose .text-black,
.dark .whitespace-pre-wrap .text-dark,
.dark .prose .text-dark {
    color: var(--text) !important;
}

/* Force border colors */
.dark .whitespace-pre-wrap * {
    border-color: var(--border) !important;
}

/* Retro-dark theme colors for calculator - Explicitly tied to CSS variables */
.bg-retro-dark {
  background-color: var(--card) !important;
  border: 1px solid var(--border) !important;
}

.bg-retro-darker {
  background-color: var(--surface) !important;
}

.border-retro-secondary {
  border-color: var(--border) !important;
}

/* Poll Progress Bar Shine */
.poll-bar-fill {
  position: relative;
  overflow: hidden;
}

.poll-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.2),
      transparent);
  animation: poll-shine 3s infinite;
}

@keyframes poll-shine {
  to {
    left: 200%;
  }
}


.text-retro-muted {
  color: var(--muted) !important;
}

/* Custom Inputs & Steppers Refinements */
.score-calc-input input::-webkit-outer-spin-button,
.score-calc-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.score-calc-input input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.score-calc-input div:focus-within {
  border-color: var(--primary) !important;
  box-shadow: none !important;
}

.score-calc-input input:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.text-retro-accent {
  color: var(--primary) !important;
}

/* EMERGENCY FIX: Strict 64px height and perfect alignment */
.score-calc-input-box {
  height: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
  display: flex !important;
  align-items: center !important;
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  padding: 0 16px !important;
  transition: all 0.2s ease;
  overflow: hidden !important;
}

.score-calc-input-box:focus-within {
  border-color: var(--primary) !important;
  box-shadow: none !important;
}

/* Select box mirroring the input box exactly */
.score-calc-select {
  height: 64px !important;
  min-height: 64px !important;
  max-height: 64px !important;
  appearance: none !important;
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394A3B8' viewBox='0 0 24 24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 1rem center !important;
  background-size: 1.25rem !important;
  padding: 0 3rem 0 1rem !important;
  font-size: 1rem !important;
  color: var(--text) !important;
  width: 100% !important;
  cursor: pointer;
  transition: all 0.2s ease;
}

.score-calc-select:focus {
  border-color: var(--primary) !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Pulse border for highlighted result */
@keyframes pulseBorder {

  0%,
  100% {
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.2);
  }

  50% {
    border-color: var(--primary-2);
    box-shadow: 0 0 16px rgba(79, 70, 229, 0.3);
  }
}

.pulse-border {
  animation: pulseBorder 2s ease-in-out infinite;
}

/* Poll bar fill animation */
@keyframes fillBar {
  from {
    width: 0%;
  }
}

.poll-bar-fill {
  animation: fillBar 0.8s ease-out forwards;
  transition: width 0.5s ease;
}

/* Score calculator stepper inputs */
.score-calc-input input::-webkit-outer-spin-button,
.score-calc-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

.score-calc-input input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Score calculator select arrow handled in main alignment section */