* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute !important;
  height: 1px;
  width: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  overflow-x: hidden; 
  overflow-y: auto;
  min-height: 100vh;
  width: 100%;
  font-family: 'Segoe UI', 'Roboto', 'Arial', sans-serif;
  background: url('aditya.png') center center / cover no-repeat scroll #f5f5f5;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

@media (max-width: 700px) {
  body {
    background: url('finalmobile.png') center center / cover no-repeat scroll #f5f5f5;
  }
}

/* Desktop: Use fixed background for better visual effect */
@media (min-width: 1024px) {
  body {
    background-attachment: fixed;
  }
}

@keyframes gradientBG {
  0% {background-position: 0% 50%;}
  50% {background-position: 100% 50%;}
  100% {background-position: 0% 50%;}
}

#site-header {
  margin: 0;
  padding: 0;
  width: 100%;
  height: auto; /* FIX: Changed from 100% to auto to remove the dead space */
  background: rgba(255, 255, 255, 0.05);
  border-bottom: none;
}

/* Header controls row for music, timer, language */
.header-controls-row.center-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 12px auto 8px auto;
  position: relative;
}

.music-timer-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.music-toggle-container {
  display: contents;
}

.music-label {
  margin-right: 4px;
  font-size: 0.95em;
  cursor: pointer;
}

.inline-timer {
  display: flex;
  align-items: center;
  margin-left: 18px;
  margin-right: 0;
}

.timer-row-center {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 8px;
}

#timer-center-below-title {
  display: none;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 20px;
  font-weight: bold;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1200px;
  margin: 0 auto;
}

.language-switcher {
  position: relative;
}

.language-switcher select {
  padding: 8px 32px 8px 12px;
  border-radius: 20px;
  border: 1px solid #656D3E;
  background: #ffffff;
  appearance: none;
}

/* arrow overlay */
.language-switcher::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid #656D3E;
  transform: translateY(-50%);
  pointer-events: none;
}

.language-switcher select:hover,
.language-switcher select:focus {
  border-color: #3cb30d;
  box-shadow: 0 0 5px rgba(107, 168, 26, 0.3);
  outline: none;
}

.logo-title {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  justify-content: center;
}

#logo {
  width: 100px;
  height: 100px;
  border-radius: 10px;
  flex-shrink: 0;
}

#title { 
  font-size: 2.8rem; 
  color: #6ba81a; 
  margin: 0; 
  line-height: 1.2;
}

#subtitle { 
  font-size: 2.1rem; 
  color: #8b5c37; 
  margin: 0; 
  line-height: 1.2;
}

.title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

h2 { color: rgb(0, 0, 0); }

.hidden { display: none !important; }

/* Main content container */
#main-content {
  width: 100%;
  padding: 2px 20px 20px 20px; 
  display: flex;
  justify-content: center;
}

/* ============================================
   CARD STYLES - Desktop First
   ============================================ */
.details-container, .results-container {
  background: #eef4e2;
  backdrop-filter: blur(16px);
  border : 2px solid rgba(145, 138, 138, 0.5);
  border-radius: 32px;
  padding: 16px 12px;
  width: 50%;
  max-width: 340px;
  min-width: 220px;
  margin: 0 auto 24px auto; 
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.quiz-card {
  background: #eef4e2 rgb(202, 209, 190);
  backdrop-filter: blur(16px);
  border: 2px solid rgba(101, 109, 62, 0.3);
  border-radius: 32px;
  padding: 16px 12px;
  width: 50%;
  max-width: 340px;
  min-width: 220px;
  margin: 0 auto 24px auto; 
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  position: relative; 
}

.details-form {
  width: 100%;
}

.form-group { 
  margin-bottom: 20px; 
  text-align: left; 
}

.form-group label { 
  display: block; 
  margin-bottom: 5px; 
  font-weight: bold;
  font-size: 1rem;
}

.form-group input { 
  width: 100%; 
  padding: 12px; 
  border-radius: 8px; 
  border: 1px solid #2fa30c; 
  box-sizing: border-box;
  font-size: 1rem;
  min-height: 44px; 
}

.form-group input:focus {
  outline: none;
  border-color: #3cb30d;
  box-shadow: 0 0 5px rgba(107, 168, 26, 0.3);
}

.submit-btn {
  width: 100%;
  padding: 15px;
  background: #656D3E;
  color: #fdfdfd;
  border: none;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  min-height: 48px; 
  font-family: inherit;
}

.submit-btn:hover { 
  background: #000000;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.submit-btn:active {
  transform: translateY(0);
}

/* Timer Styles (inside quiz card) */
.timer-display {
  position: absolute;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
  /* Reduced padding to shrink the box */
  padding: 8px 12px; 
  border-radius: 8px; /* Slightly smaller corners to match the smaller box */
  /* Reduced font size */
  font-size: 1rem; 
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
  z-index: 10;
  text-align: center;
  /* Reduced minimum width */
  min-width: 80px; 
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

#timer-text {
  display: inline-block;
}

/* Results view: make Restart/End buttons more prominent */
#results-view .submit-btn {
  padding: 18px 28px;
  width: auto;
  display: inline-block;
  margin: 10px 8px 0 0;
}

#results-view .actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Quiz Elements */
.score-header {
  text-align: center;
  margin-bottom: 20px;
}

.score-badge {
  background: #656D3E;
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  display: inline-block;
  font-size: 0.95rem;
}

.quiz-question { 
  color: black;
  font-size: 1.3rem;
  margin-bottom: 20px;
  line-height: 1.4;
}

.quiz-options { 
  display: grid; 
  grid-template-columns: 1fr; 
  gap: 10px; 
  margin-top: 20px;
}

.quiz-option {
  padding: 15px;
  background: white;
  border: 2px solid #acac77;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
  color: black;
  min-height: 48px;
  display: flex;
  align-items: center;
  font-size: 1rem;
}

.quiz-option:hover { 
  transform: scale(1.02); 
  border-color: #000000;
  background: #f9f9f9;
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-option.selected { 
  background: #656D3E; 
  color: white;
  border-color: #656D3E;
}

.quiz-feedback {
  margin-top: 20px;
  padding: 15px;
  border-radius: 8px;
  font-weight: bold;
  text-align: center;
  font-size: 1rem;
}

.quiz-feedback.correct {
  background: #c8e6c9;
  color: #2e7d32;
  border: 2px solid #4caf50;
}

/* FIXED INCORRECT FEEDBACK & NEXT BUTTON */
.quiz-feedback.incorrect {
  background: #fff;
  border-radius: 8px;
  padding: 8px 18px;
  color: #3b5e1e;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  font-size: 1rem;
  font-weight: bold;
  text-align: center;
}

.next-btn {
  background: #656D3E;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 30px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  transition: 0.3s;
  display: block;
  margin: 20px auto 0 auto;
  min-height: 48px;
}

.next-btn:hover:not(:disabled) {
  background: #5a6236;
  transform: scale(1.05);
}

.next-btn:disabled {
  background: #999999;
  cursor: not-allowed;
}

.next-btn.hidden {
  display: none;
}

/* Results */
.percentage-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 8px solid #f7f7f7;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  background: linear-gradient(135deg, #6ba81a 0%, #656D3E 100%);
  color: white;
}

.user-info {
  font-size: 1.05rem;
  line-height: 1.6;
  margin: 20px 0;
}

.user-info p {
  margin: 10px 0;
}

#spline-container {
  width: 100%;
  height: 300px;
  margin-top: 20px;
  border-radius: 10px;
  overflow: hidden;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 10000;
  pointer-events: none;
}

/* ============================================
   MEDIA QUERIES
   ============================================ */

/* Tablets & Large phones (768px - 1023px) */
@media (max-width: 1023px) {
  body {
    background-attachment: scroll;
  }

  #site-header {
    padding: 16px 16px 4px 16px; 
    width: 100%;
  }

  .header-content {
    gap: 15px;
    width: 100%;
  }

  .logo-title {
    gap: 12px;
  }

  #logo {
    width: 80px;
    height: 80px;
  }

  #title {
    font-size: 2rem;
  }

  #subtitle {
    font-size: 1.5rem;
  }

  .title-block {
    text-align: center;
  }

  #main-content {
    width: 100%;
    padding: 4px 16px 16px 16px; 
  }

  .details-container, 
  .quiz-card, 
  .results-container {
    width: calc(100% - 32px);
    max-width: 100%;
    padding: 0 20px 20px 20px;
    margin: 4px 16px 15px 16px; 
    border-radius: 40px;
  }

  .quiz-question {
    font-size: 1.1rem;
  }

  .percentage-circle {
    width: 100px;
    height: 100px;
    font-size: 1.2rem;
  }

  #spline-container {
    height: 250px;
  }
}

/* Tablets Portrait (600px - 767px) */
@media (max-width: 767px) {
  body {
    background-attachment: scroll;
    padding-bottom: 20px;
  }

  #site-header {
    padding: 12px 12px 2px 12px; 
    width: 100%;
  }

  .header-content {
    gap: 12px;
    width: 100%;
    padding: 0;
  }

  .logo-title {
    gap: 10px;
    flex-direction: column;
    width: 100%;
  }

  #logo {
    width: 70px;
    height: 70px;
  }

  #title {
    font-size: 1.6rem;
  }

  #subtitle {
    font-size: 1.2rem;
  }

  #main-content {
    width: 100%;
    padding: 2px 12px 12px 12px; 
  }

  .details-container, 
  .quiz-card, 
  .results-container {
    width: calc(100% - 24px);
    max-width: 100%;
    padding: 16px;
    margin: 2px 12px 12px 12px; 
    border-radius: 30px;
  }

  .form-group {
    margin-bottom: 18px;
  }

  .form-group label {
    font-size: 0.95rem;
  }

  .form-group input {
    font-size: 16px; 
    padding: 12px;
  }

  .submit-btn {
    padding: 14px;
    font-size: 1rem;
    min-height: 48px;
  }

  .quiz-question {
    font-size: 1rem;
  }

  .quiz-option {
    padding: 12px;
    font-size: 0.90rem;
    min-height: 4px;
  }

  .percentage-circle {
    width: 90px;
    height: 90px;
    font-size: 1.1rem;
    border-width: 6px;
  }

  #spline-container {
    height: 200px;
  }

  .score-badge {
    font-size: 0.85rem;
    padding: 6px 12px;
  }

  #results-view .actions {
    flex-direction: column;
    gap: 10px;
  }

  #results-view .submit-btn {
    width: 100%;
    margin: 0;
  }
}

/* Large phones (480px - 599px) */
@media (max-width: 599px) {
  body {
    background-attachment: scroll;
  }

  .header-controls-row.center-controls {
    max-width: 100vw;
    padding: 0 6px;
    gap: 0.2rem;
  }

  .music-label {
    font-size: 1em;
  }
  
  .timer-center {
    min-width: 90px;
  }
  
  .language-switcher select {
    font-size: 1em;
    padding: 7px 28px 7px 10px;
  }

  #site-header {
    padding: 10px 10px 2px 10px; 
    width: 100%;
  }

  .header-content {
    gap: 8px;
    width: 100%;
  }

  .logo-title {
    gap: 8px;
  }

  #logo {
    width: 60px;
    height: 60px;
  }

  #title {
    font-size: 1.4rem;
  }

  #subtitle {
    font-size: 1.1rem;
  }

  #main-content {
    width: 100%;
    padding: 2px 10px 10px 10px; 
  }

  .details-container, 
  .quiz-card, 
  .results-container {
    width: calc(100% - 20px);
    max-width: 100%;
    padding: 16px;
    margin: 2px 10px 12px 10px; 
    border-radius: 20px;
  }

  .details-form {
    text-align: center;
  }

  .details-form h2 {
    font-size: 1.3rem;
    margin: 0 0 10px 0;
  }

  .details-subtitle {
    font-size: 0.9rem;
    margin: 0 0 20px 0;
  }

  .form-group {
    margin-bottom: 16px;
    text-align: left;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input {
    font-size: 16px;
    padding: 10px;
  }

  .submit-btn {
    padding: 12px;
    font-size: 0.95rem;
    min-height: 44px;
  }

  .quiz-question {
    font-size: 0.95rem;
    margin-bottom: 16px;
  }

  .quiz-options {
    gap: 8px;
  }

  .quiz-option {
    padding: 10px;
    font-size: 0.9rem;
    min-height: 42px;
  }

  .percentage-circle {
    width: 80px;
    height: 80px;
    font-size: 1rem;
    border-width: 5px;
  }

  #spline-container {
    height: 150px;
    margin-top: 16px;
  }

  .score-header {
    margin-bottom: 16px;
  }

  .score-badge {
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .user-info {
    font-size: 0.95rem;
  }

  .user-info p {
    margin: 8px 0;
  }
}

/* Small phones (< 480px) */
@media (max-width: 479px) {
  html, body {
    font-size: 14px;
    width: 100%;
  }

  body {
    background-attachment: scroll;
  }

  #site-header {
    padding: 8px 8px 2px 8px; 
    width: 100%;
  }

  .header-content {
    gap: 6px;
    width: 100%;
  }

  .logo-title {
    gap: 6px;
  }

  #logo {
    width: 50px;
    height: 50px;
  }

  #title {
    font-size: 1.8rem;
  }

  #subtitle {
    font-size: 0.95rem;
  }

  #main-content {
    width: 100%;
    padding: 2px 8px 8px 8px; 
  }

  .details-container, 
  .quiz-card, 
  .results-container {
    width: calc(100% - 16px);
    max-width: 100%;
    padding: 12px;
    margin: 2px 8px 8px 8px; 
    border-radius: 16px;
  }

  .details-form h2 {
    font-size: 1.1rem;
    margin: 0 0 8px 0;
  }

  .details-subtitle {
    font-size: 0.85rem;
  }

  .form-group {
    margin-bottom: 14px;
  }

  .form-group label {
    font-size: 0.85rem;
    margin-bottom: 4px;
  }

  .form-group input {
    font-size: 16px;
    padding: 10px;
  }

  .submit-btn {
    padding: 11px;
    font-size: 0.9rem;
    min-height: 42px;
    border-radius: 6px;
  }

  .quiz-question {
    font-size: 0.9rem;
    margin-bottom: 14px;
  }

  .quiz-options {
    gap: 6px;
  }

  .quiz-option {
    padding: 8px;
    font-size: 0.85rem;
    border-radius: 8px;
    min-height: 30px;
  }

  .percentage-circle {
    width: 70px;
    height: 70px;
    font-size: 0.9rem;
    border-width: 4px;
  }

  #spline-container {
    height: 120px;
    margin-top: 12px;
  }

  .score-header {
    margin-bottom: 12px;
  }

  .score-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .user-info {
    font-size: 0.9rem;
  }

  .user-info p {
    margin: 6px 0;
  }

  #results-view .actions {
    gap: 8px;
    flex-direction: column;
  }

  #results-view .submit-btn {
    width: 100%;
    margin: 0;
    padding: 10px;
    font-size: 0.85rem;
  }
}



/* 1. Remove the text feedback message completely */
.quiz-feedback {
  display: none !important;
}

@media (max-width: 767px) {
  /* --- 1. Background Image Fix --- */
  body {
    background-size: 100% auto !important; 
    background-position: top center !important;
    padding-bottom: 120px !important; 
  }

  /* --- 2. Stack the Header Items Naturally --- */
  #site-header .header-content {
    display: flex !important;
    flex-direction: column !important; /* Stacks Logo -> Title -> Controls */
    align-items: center !important;
    padding-top: 50px !important; /* Clears top background logos */
    gap: 15px !important; /* Adds a clean 15px gap between title and controls */
  }

  /* --- 3. The Row Above the Container --- */
  .header-controls-row {
    width: 100% !important;
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    margin-bottom: 15px !important; /* Creates space right before the quiz card starts */
  }

  .music-timer-group {
    width: 100% !important;
    position: relative !important;
    display: flex !important;
    justify-content: center !important; /* Keeps timer centered */
    align-items: center !important;
    min-height: 40px !important;
  }

  /* --- 4. Pin Music Toggle to the Left of this Row --- */
  .music-label {
    position: absolute !important;
    left: 20px !important; /* Pins to the left edge */
    top: 50% !important;
    transform: translateY(-50%) !important;
    margin: 0 !important;
    z-index: 10 !important;
  }

  #musicToggle {
    position: absolute !important;
    left: 20px !important;
    opacity: 0 !important; /* Hides the ugly default checkbox */
    width: 80px !important;
    height: 30px !important;
    z-index: 15 !important;
    cursor: pointer;
  }

  /* --- 5. Center and Shrink the Timer --- */
  .timer-display.inline-timer {
    position: relative !important; /* Let flexbox center it naturally */
    top: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important; 
    
    /* Reduced size */
    padding: 6px 14px !important;
    font-size: 1rem !important;
    min-width: 80px !important;
    border-radius: 8px !important;
    z-index: 20 !important;
  }

  /* Hide the duplicate center timer from your HTML */
  .timer-row-center {
    display: none !important;
  }

  /* --- 6. Reset Main Container Spacing --- */
  .quiz-card, .details-container {
    margin-top: 0 !important; /* Let the header's natural spacing push this down */
    margin-bottom: 40px !important;
  }
}