/* Reset and box-sizing */

* {

  box-sizing: border-box;

  margin: 0;

  padding: 0;

}



/* CSS Variables for easy theme management */

:root {

  --primary-bg: #f0f8ff;

  --container-bg: #ffffff;

  --primary-color: #007bff;

  --primary-color-dark: #0056b3;

  --selected-color: #4caf50;

  --text-color: #333;

  --hint-bg: #ffe5b4;

  --hint-border: #ff8c00;

  --list-bg: #e0f7fa;

  --shadow: rgba(0, 0, 0, 0.2);

}



/* Base styling */
body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-color);
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 0 20px 20px;
}


/* Container styling with a max-width for readability */

.container {
  width: 90%;
  max-width: 1200px;
  margin-top: 0; /* Align container to the top of the page */
  padding: 0 20px 20px;
  position: relative;
  background-color: var(--container-bg);
  border: 0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  position: relative;
}

.practice-meters {
  width: 90%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto auto;
  gap: 10px;
  margin: 0 auto 16px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.meter-divider {
  width: 90%;
  max-width: 1200px;
  height: 1px;
  margin: 0 auto 28px;
  border: 0;
  background: rgba(0, 123, 255, 0.18);
}

.meter-toggle {
  display: none;
}

.meter-card,
.meter-readout {
  min-width: 0;
  border: 1px solid rgba(0, 123, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  padding: 9px 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.meter-label,
.meter-readout span {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  color: var(--primary-color-dark);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meter-info {
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  border: 1px solid rgba(0, 123, 255, 0.32);
  border-radius: 50%;
  background: #ffffff;
  color: var(--primary-color-dark);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.meter-info:hover,
.meter-info:focus-visible {
  background: var(--primary-color);
  color: #ffffff;
  outline: none;
}

.meter-info-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 35, 55, 0.42);
}

.meter-info-card {
  width: min(92vw, 360px);
  position: relative;
  padding: 22px 20px 18px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid rgba(0, 123, 255, 0.18);
  box-shadow: 0 16px 40px rgba(20, 35, 55, 0.22);
}

.meter-info-card h2 {
  margin: 0 34px 8px 0;
  color: var(--primary-color-dark);
  font-size: 1.25rem;
  text-align: left;
}

.meter-info-card p {
  margin: 0;
  color: var(--text-color);
  font-size: 0.98rem;
  line-height: 1.5;
}

.meter-info-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: var(--primary-color);
  color: #ffffff;
  font-size: 1rem;
}

.analog-face {
  position: relative;
  height: 44px;
  overflow: hidden;
  border-bottom: 3px solid rgba(0, 123, 255, 0.2);
}

.analog-face::before {
  content: '';
  display: block;
  width: 86px;
  height: 86px;
  margin: 0 auto;
  border-radius: 50%;
  background:
    conic-gradient(from 230deg, #dc3545 0deg 75deg, #ffc107 75deg 140deg, #4caf50 140deg 260deg, transparent 260deg);
  opacity: 0.86;
}

.analog-needle {
  position: absolute;
  left: 50%;
  bottom: -2px;
  width: 3px;
  height: 38px;
  background: #1f3557;
  border-radius: 999px;
  transform-origin: bottom center;
  transform: translateX(-50%) rotate(-70deg);
  transition: transform 0.25s ease;
}

.analog-center {
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary-color-dark);
  transform: translateX(-50%);
}

.signal-bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 44px;
}

.signal-bars span {
  flex: 1;
  min-width: 8px;
  border-radius: 5px 5px 2px 2px;
  background: #d8eefb;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.08);
  transition: background-color 0.25s ease, opacity 0.25s ease;
}

.signal-bars span:nth-child(1) { height: 28%; }
.signal-bars span:nth-child(2) { height: 44%; }
.signal-bars span:nth-child(3) { height: 60%; }
.signal-bars span:nth-child(4) { height: 76%; }
.signal-bars span:nth-child(5) { height: 92%; }

.signal-bars span.active {
  background: var(--selected-color);
}

.meter-track {
  height: 18px;
  border-radius: 999px;
  background: #e7f6f8;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 123, 255, 0.1);
}

.meter-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-color) 0%, #4caf50 100%);
  transition: width 0.25s ease;
}

.meter-value,
.meter-readout strong {
  display: block;
  margin-top: 6px;
  color: var(--text-color);
  font-size: 1rem;
  line-height: 1;
  font-weight: 700;
}

.meter-value {
  text-align: center;
}

.meter-readout strong {
  font-size: 1.15rem;
  white-space: nowrap;
}

.meter-value-hidden {
  display: none;
}

#xp-meter,
.meter-readout {
  text-align: center;
}

#xp-meter .meter-label,
.meter-readout span {
  justify-content: center;
}


/* Headings */

h1 {

  font-size: 2rem;

  margin-bottom: 1rem;

  text-align: center;

}



/* Question area */

#question-area {
  width: 100%;
  padding-top: 14px;
  margin-bottom: 1rem;
}

.practice-section-label {
  display: block;
  margin: 0 0 6px;
  color: var(--primary-color-dark);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}

#question-area > .practice-section-label {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--primary-color-dark);
  color: #ffffff;
}

.answer-label {
  margin-top: 18px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--primary-color-dark);
  color: #ffffff;
}


#question {

  font-size: 1.25rem;

  margin-bottom: 1rem;

}



/* Answer list styles */

#answers {

  width: 100%;

  list-style: none;

  overflow: visible;

  margin-bottom: 0.5rem; /* Reduce space below answer choices */

}



#answers li {

  background-color: var(--list-bg);

  padding: 12px 16px;

  margin-bottom: 0.5rem;

  border-radius: 6px;

  cursor: pointer;

  transition: background 0.3s ease;

}



#answers li:hover {

  background-color: #b2ebf2;

}



#answers li.selected {

  background-color: var(--selected-color);

  color: #fff;

}



/* Feedback container */

#feedback-container {
  min-height: 40px;
  margin: 1rem 0;
  text-align: center;
}

#feedback-modal-card {
  width: 100%;
}

#showSolution {
  display: none;
}

#feedback-container.feedback-modal-open {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  margin: 0;
  padding: 20px;
  width: 90%;
  max-width: 500px;
  border: 4px solid var(--hint-border);
  border-radius: 10px;
  background-color: var(--hint-bg);
}

#feedback-container.feedback-modal-open #feedback-modal-card {
  position: relative;
  width: 100%;
  text-align: center;
}

#feedback-container.feedback-modal-open #feedback-modal-card #feedback {
  margin: 0;
}

#feedback-container.feedback-modal-open #showSolution {
  display: inline-block !important;
  margin-top: 18px;
}


#feedback {

  font-size: 1.5rem;

  color: var(--selected-color);

}



/* Button container */

#button-container {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
  text-align: center;
  margin-top: 0.5rem; /* Move button closer to answers */
  margin-bottom: 0; /* Remove extra margin at the bottom */
  position: static;
}


button {

  font-size: 1rem;

  padding: 0.75rem 1.5rem;

  border: none;

  background-color: var(--primary-color);

  color: #fff;

  border-radius: 6px;

  cursor: pointer;

  transition: background-color 0.3s ease;

}



button:hover {

  background-color: var(--primary-color-dark);

}



/* Hint, Follow-up, and Solution Box Styles */

.hint-box,

.follow-up-box,

.solution-box {

  position: absolute;

  top: 24px;

  left: 50%;

  transform: translateX(-50%);

  background-color: var(--hint-bg);

  border: 4px solid var(--hint-border);

  border-radius: 10px;

  padding: 20px;

  width: 90%;

  max-width: 500px;

  z-index: 1000;

}

#help-solve {
  background-color: #4caf50;
}

#help-solve:hover {
  background-color: #3f9643;
}

.solution-box {
  width: min(88%, 760px);
  max-width: 760px;
  max-height: calc(100vh - 48px);
}



.hint-content,

.follow-up-content,

.solution-content {

  position: relative;

  text-align: center;

}

.hint-close {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: var(--primary-color);
  color: #ffffff;
  font-size: 1rem;
}

.solution-content .hint-close {
  width: 30px;
  min-width: 0;
  height: 30px;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.solution-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.solution-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: min(62vh, 560px);
  overflow-y: auto;
  padding: 0.25rem;
  text-align: left;
}

.solution-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.solution-actions button {
  min-width: 170px;
  margin: 0;
}

.solution-step {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 140, 0, 0.25);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.solution-step-label {
  color: var(--primary-color-dark);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
}

.solution-step-body {
  color: var(--text-color);
  font-size: 1rem;
  line-height: 1.5;
}



.hint-content #hintText,

.solution-content h1 {

  font-size: 1.5rem;

  margin-bottom: 1rem;

}



.hint-navigation button,

.solution-content button {

  background-color: var(--primary-color);

  color: #fff;

  border: none;

  padding: 0.5rem 1rem;

  border-radius: 5px;

  cursor: pointer;

  transition: background-color 0.3s ease;

  margin: 0.5rem;

}



.hint-navigation button:hover:not(:disabled),

.solution-content button:hover {

  background-color: var(--primary-color-dark);

}

.hint-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 0 0 1rem;
}

.hint-navigation button {
  width: 42px;
  min-width: 42px;
  height: 36px;
  margin: 0;
  padding: 0;
  font-size: 1.35rem;
  line-height: 1;
}

.hint-navigation button:disabled {
  background-color: #b8c0c9;
  color: #eef1f4;
  cursor: not-allowed;
  opacity: 0.75;
}

#hintIndicator {
  min-width: 48px;
  color: var(--primary-color-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.hint-context {
  margin: 0 0 8px;
  color: #c62828;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}



/* Media container */

#media {

  /*margin: 1.25rem 0;

  padding: 10px;*/

  text-align: center;

  max-width: 100%;

  /* max-height: 400px;  Remove fixed max-height, JS will set height/max-height */

  overflow: visible;

  margin-bottom: 1rem; /* Add spacing below media */

}



/* Responsive adjustments for smaller screens */

@media (max-width: 480px) {
  body {
    font-size: 15px;
    padding: 0 10px 10px;
  }

  .container {
    width: 100%;
    max-width: none;
    padding: 0 12px 12px;
  }

  .practice-meters {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 0;
    margin-bottom: 10px;
  }

  .meter-divider {
    margin-bottom: 14px;
  }

  .meter-toggle {
    display: block;
    grid-column: 1 / -1;
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--primary-color);
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
  }

  .practice-meters #xp-meter,
  .practice-meters .meter-readout {
    display: none;
  }

  .practice-meters.meters-expanded #xp-meter,
  .practice-meters.meters-expanded .meter-readout {
    display: block;
  }

  .meter-card,
  .meter-readout {
    padding: 6px;
  }

  .meter-label,
  .meter-readout span {
    font-size: 0.66rem;
  }

  .analog-face,
  .signal-bars {
    height: 36px;
  }

  .analog-face::before {
    width: 72px;
    height: 72px;
  }

  .analog-needle {
    height: 31px;
  }

  .meter-track {
    height: 13px;
  }

  .meter-value,
  .meter-readout strong {
    font-size: 0.9rem;
  }
  

  h1 {

    font-size: 1.75rem;

  }

  

  #question {

    font-size: 1.125rem;

  }

  

  button {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
  }

  .solution-box {
    left: 8px;
    right: 8px;
    transform: none;
    width: auto;
    max-width: none;
    max-height: calc(100vh - 24px);
    padding: 14px;
    overflow: hidden;
  }

  .solution-content h1 {
    font-size: 1.2rem;
    margin-bottom: 0.35rem;
  }

  .solution-actions {
    gap: 0.5rem;
  }

  .solution-actions button,
  .solution-content button {
    min-width: 0;
    width: 100%;
    margin: 0;
  }

  .solution-steps-list {
    max-height: calc(100vh - 220px);
    padding: 0.15rem;
    overflow-x: hidden;
  }

  .solution-step {
    width: 100%;
    max-width: 100%;
    padding: 0.8rem;
    overflow-x: auto;
    overflow-y: visible;
  }

  .solution-step-body {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .solution-step-body mjx-container {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
  }
}
#followUpAnswers {

  list-style: none;

  padding: 0;

  margin: 0;

}

#followUpAnswers li {

  background-color: var(--list-bg);

  padding: 12px 16px;

  margin-bottom: 0.5rem;

  border-radius: 6px;

  cursor: pointer;

  transition: background 0.3s ease;

}



#FollowUpAnswers li:hover {

  background-color: #b2ebf2;

}



#followUpAnswers li.selected {

  background-color: var(--selected-color);

  color: #fff;

}



#hintText {

    font-style: normal !important;

    white-space: normal !important;

    display: block !important;

    overflow: visible !important;

    word-spacing: 0.15em !important;

}

/* Mobile modal treatment: keep every practice dialog inside the viewport and
   let the dialog itself scroll when the question or solution is long. */
@media (max-width: 700px) {
  #feedback-container.follow-up-active {
    display: none !important;
  }

  #feedback-container.feedback-modal-open {
    position: fixed;
    top: 8px;
    right: 8px;
    bottom: auto;
    left: 8px;
    transform: none;
    width: auto;
    max-width: none;
    max-height: none;
    padding: 14px;
    border-width: 3px;
    border-radius: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 18px 44px rgba(20, 35, 55, 0.3), 0 0 0 100vmax rgba(20, 35, 55, 0.42);
  }

  #feedback-container.feedback-modal-open #feedback {
    font-size: 1.15rem;
    line-height: 1.4;
  }

  #feedback-container.feedback-modal-open #showSolution {
    width: 100%;
    margin-top: 12px;
  }

  .hint-box,
  .follow-up-box,
  .solution-box {
    position: fixed;
    top: 8px;
    right: 8px;
    bottom: auto;
    left: 8px;
    transform: none;
    width: auto;
    max-width: none;
    max-height: none;
    padding: 14px;
    border-width: 3px;
    border-radius: 12px;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 18px 44px rgba(20, 35, 55, 0.3), 0 0 0 100vmax rgba(20, 35, 55, 0.42);
  }

  .hint-content,
  .follow-up-content,
  .solution-content {
    min-width: 0;
    padding-top: 18px;
  }

  .hint-close,
  .solution-content .hint-close {
    top: 2px;
    right: 2px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin: 0;
    font-size: 1.2rem;
  }

  .hint-content h1,
  .follow-up-content h1,
  .solution-content h1 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    line-height: 1.2;
  }

  .hint-context {
    font-size: 0.86rem;
  }

  .hint-navigation {
    gap: 10px;
    margin-bottom: 0.75rem;
  }

  .hint-navigation button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    margin: 0;
  }

  #hintIndicator {
    min-width: 42px;
  }

  #hintText,
  #followUpScenario,
  #followUpFeedback {
    font-size: 1rem;
    line-height: 1.45;
  }

  #followUpAnswers li {
    padding: 11px 12px;
    margin-bottom: 0.45rem;
  }

  #followUpButtonContainer {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  #followUpButtonContainer button,
  .solution-actions button,
  .solution-content button {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
  }

  .solution-content {
    gap: 0.55rem;
  }

  .solution-box {
    overflow-y: auto;
  }

  .solution-steps-list {
    max-height: none;
    overflow: visible;
    padding: 0.1rem;
  }

  .solution-step {
    padding: 0.75rem;
  }

  #graphPopupOverlay {
    padding: 8px !important;
  }

  #graphPopupOverlay > div {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 16px) !important;
    padding: 12px !important;
    overflow: auto !important;
  }

  #graphPopupOverlay img {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: calc(100dvh - 74px) !important;
    object-fit: contain;
  }
}









