header {
  text-align: center;
}

body.state-loader > main > :not(#loader-wrapper),
body.state-quiz > main > :not(#quiz-wrapper),
body.state-result > main > :not(#result-wrapper) {
  display: none !important;
}

/* ........................................
   ...........SETTINGS & CONFIGURATION
   ........................................ */
/*
 * Settings panel and options:
 * - Accordion-style settings menu
 * - Checkbox and select controls
 * - Shuffle and repeat options
 * - Custom numpad toggle
*/
#accordion-quiz-settings .accordion-button {
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}
#accordion-quiz-settings .settings-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
}
#accordion-quiz-settings .setting-item {
  font-weight: 500;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 35px;
  padding: 0 0.5rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
}
#accordion-quiz-settings .setting-item:hover {
  background-color: var(--color-background-muted);
}
#accordion-quiz-settings .setting-item:hover .setting-label {
  color: var(--color-primary);
}

.queue-preset-list {
  overflow-x: auto;
  gap: 0.5rem;
}

#quiz-list {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  gap: 0.75rem;
  overflow-y: auto;
  /* overscroll-behavior: contain; */
  scrollbar-width: thin;
  contain: paint; /* TODO-FUTURE: Change if didn't work */
}
#quiz-list > .quiz-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--color-white);
  padding: 0.5rem;
  border-radius: var(--radius);
  border-width: 2px;
  content-visibility: auto;
  contain-intrinsic-size: 0 70px;
}
#quiz-list > .quiz-item.hidden {
  display: none !important;
}
#quiz-list > .quiz-item label {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  border-right-width: 2px;
  padding-right: 0.25rem;
  cursor: pointer;
}
#quiz-list > .quiz-item .quiz-info {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
}
#quiz-list > .quiz-item .tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.65rem;
  font-weight: 500;
  line-height: 0.75rem;
  letter-spacing: -0.3px;
  text-transform: capitalize;
  color: var(--color-text-muted);
}
#quiz-list > .quiz-item .tag-list > li {
  background-color: var(--color-background-muted);
  padding: 1px 2px;
  padding: 2px 5px;
  border-width: 2px;
  border-width: 0;
  border-radius: 4px;
}
#quiz-list > .quiz-item .quiz-start-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-content: center;
  padding: 0;
  border-radius: calc(var(--radius) / 2);
}

/* ............................................. */
/* ............ JSON INPUT SECTION ............. */
/* ............................................. */
#json-input-wrapper > #json-input-textarea {
  flex: 1;
  border-radius: calc(var(--radius) - 2px);
  /* min-height: 200px; */
}
#json-input-wrapper button {
  flex: 1;
}
#json-input-wrapper #json-input-button {
  flex: 2;
}

/* ........................................
   ...........QUIZ TAKING INTERFACE
   ........................................ */
/*
 * Styles for the active quiz experience:
 * - Question display and formatting
 * - Answer input methods (number input, MCQ options)
 * - Timer display and positioning
 * - Navigation between questions
 * - Progress indicators
 */
#questions-wrapper {
  gap: 1.5rem;
  margin-bottom: 1rem;
  /* opacity: 0; */
  /* transform: translateY(20px); */
  /* .card have the animation, no need here */
}

/* ........................................
   ...........ANSWER INPUT COMPONENTS
   ........................................ */
/*
 * Different answer input types:
 * - Number input with custom numpad
 * - Multiple choice question options
 * - Input validation and feedback
 * - Wrong answer animations and effects
 */
.answer-input-number {
  display: flex;
  gap: 1rem;
}

#number-input {
  font-size: 1.125rem;
  line-height: 1.75rem;
  width: 100%;
  height: 2.5rem;
  padding: 1rem;
  border-width: 1px;
  border-radius: calc(var(--radius) - 2px);
}
#number-input.wrong-input {
  background-color: var(--color-red-10);
  border-color: var(--color-red);
}

.answer-input-mcq {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem 2rem;
}

.mcq-option-button {
  font-size: 1rem;
  text-align: left;
  background-color: var(--color-white);
  padding: 1rem;
  transition-property: color, background-color, border-color;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 0.15s;
}
.mcq-option-button:active {
  background-color: var(--color-background-hover);
}
@media (any-pointer: fine) {
  .mcq-option-button:hover {
    background-color: var(--color-background-hover);
  }
}
.mcq-option-button.wrong-input {
  background-color: var(--color-red-10);
  border-color: var(--color-red);
  cursor: not-allowed;
  pointer-events: none;
  animation: shake 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.mcq-option-button {
  /* TODO-FUTURE: correct-input */
}

.animate-shake {
  animation: shake 0.2s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
#number-input.correct-input,
.mcq-option-button.correct-input {
  animation: ripple-green 0.5s ease-out forwards;
}

@keyframes ripple-green {
  0% {
    outline: 0px solid rgba(34, 197, 94, 0.5);
  }
  100% {
    outline: 12px solid rgba(34, 197, 94, 0);
  }
}
/* ........................................
   ...........RESULTS & SUMMARY
   ........................................ */
/*
 * Results page styling:
 * - Score display and statistics
 * - Question-by-question breakdown
 * - Time taken and performance metrics
 * - Action buttons (retry, new quiz)
*/
#result-wrapper > .card {
  gap: 1.5rem;
}

#stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}
#stats-grid > div {
  text-align: center;
  background-color: var(--color-background-muted);
  flex: 1 0 calc(50% - 0.5rem);
  min-width: fit-content;
  padding: 1rem;
  border-radius: var(--radius);
}
#stats-grid > div > strong {
  font-size: 1.75rem;
}

#stats-summary {
  gap: 0.5rem;
  height: 300px;
  border-width: 2px;
  border-radius: calc(var(--radius) + 0.5rem);
  padding: 0.5rem;
  overflow: auto;
}

.answer {
  font-size: 16px;
  padding: 0.5rem 0.75rem;
  border-width: 1px;
  border-radius: var(--radius);
}
.answer.answer-wrong {
  background-color: var(--color-red-10);
  border-color: var(--color-red-30);
}
.answer.answer-correct {
  background-color: var(--color-green-10);
  border-color: var(--color-green-30);
}
.answer.answer-skipped {
  background-color: rgba(164, 164, 164, 0.1);
  border-color: rgba(164, 164, 164, 0.3);
}
.answer strong {
  font-weight: 500;
}
.answer span {
  font-size: 14px;
}
.answer > .flex {
  margin-top: 0.5rem;
  justify-content: space-between;
}

/* ........................................
   ............. TEST HISTORY ............
   ........................................ */
/*
 * Test history display:
 * - Accordion for history section
 * - Table layout for test records
 * - Date formatting and relative time
 * - Score and time display
*/
/* ............................................. */
/* ............. ADVANCE SETTINGS  ............. */
/* ............................................. */
#accordion-advance-settings .advance-settings-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.5rem;
}

#stopwatch {
  display: none;
}

body.state-quiz #stopwatch {
  position: fixed;
  top: 1rem;
  right: calc((100% - min(100%, 800px)) / 2 + var(--dyn-padding-inline));
  background-color: var(--color-white);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.5rem 0.65rem;
  border-width: 1px;
  border-radius: var(--radius-full);
  box-shadow: var(--box-shadow);
  cursor: pointer;
  user-select: none;
}
body.state-quiz #stopwatch.running {
  animation: ripple-blue 0.6s ease-out forwards;
}
body.state-quiz #stopwatch.paused {
  color: darkorange;
  outline: 0px solid rgba(255, 140, 0, 0.4);
  animation: ripple-amber 0.6s cubic-bezier(0.6, 0.9, 0.4, 1) forwards;
}
body.state-quiz #stopwatch.paused > svg {
  stroke: currentColor;
}
body.state-quiz #stopwatch > #stopwatch-text {
  contain: paint;
}

@keyframes ripple-blue {
  0% {
    outline: 0px solid rgba(59, 130, 246, 0.4);
  }
  100% {
    outline: 15px solid rgba(59, 130, 246, 0);
  }
}
@keyframes ripple-amber {
  0% {
    outline-width: 0px;
  }
  70% {
    outline-width: 15px;
  }
  100% {
    outline-width: 5px;
  }
}
#numpad {
  position: fixed;
  inset: auto 0.6rem 0.6rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  background-color: var(--color-background-muted);
  max-width: 420px;
  padding: 1rem;
  margin: auto;
  border-radius: 30px;
  outline: 2px solid var(--color-border);
  corner-shape: superellipse(1.5);
  corner-shape: superellipse(1.2);
  user-select: none;
  touch-action: none;
  overscroll-behavior: none;
  visibility: hidden;
  transform: translateY(120%);
  transition: transform 500ms var(--ionic-easing), visibility 500ms;
  z-index: 1;
  /* TODO-FUTURE: Maybe we could add/remove box-shadow after/before transition completes */
}
#numpad.show {
  visibility: visible;
  transform: translateY(0);
}
#numpad > .numpad-key {
  height: 70px;
  font-size: 26px;
  font-weight: bold;
  border-width: 0px;
  border-radius: 60px;
  border-radius: 20px;
  corner-shape: superellipse(1.2);
  background-color: var(--color-white);
  border-width: 1.5px 1.5px 3px 1.5px;
  border-width: 2px 2px 4px 2px;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}
#numpad > .numpad-key[data-key="0"] {
  grid-column: 2;
}
#numpad > .numpad-key[data-key=del] {
  background-color: #ffebee;
  color: #d32f2f;
  border-color: #ffcdd2;
}
#numpad > .numpad-key[data-key=del].active {
  background-color: #ffcdd2;
}
#numpad > .numpad-key.active {
  background-color: var(--color-border);
  transform: translateY(2px);
}
