/* =========================================================
   BACH TO ROCK – QUIZ APP STYLES (v1)
   FINAL STABLE VERSION
   ========================================================= */

/* ---------- BRAND VARIABLES ---------- */
:root {
  --b2r-orange: #F67A30;
  --b2r-blue: #0D5CAB;
  --b2r-magenta: #B63E97;

  --b2r-dark: #1a1a1a;
  --b2r-gray-bg: #f4f4f4;
  --b2r-border: #dddddd;
}

/* ---------- PAGE BASICS ---------- */
html,
body {
  height: 100%;
}

body {
  font-family: "Work Sans", Arial, sans-serif;
  background: var(--b2r-gray-bg);
  margin: 0;
  padding: 40px;
  overflow-y: auto;
  /* allow scrolling for results */
  color: var(--b2r-dark);
}

/* ---------- MAIN APP CARD ---------- */
#app {
  max-width: 1100px;
  margin: auto;
  background: #ffffff;
  padding: 24px 30px 30px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}


/* ---------- HEADER ---------- */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(90deg,
      var(--b2r-blue),
      var(--b2r-magenta),
      var(--b2r-orange));
  padding: 16px 20px;
  margin-bottom: 16px;
  border-radius: 6px;
}

#header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  color: #ffffff;
}

#header button {
  background: #ffffff;
  color: var(--b2r-dark);
  border: none;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
}

/* ---------- VISIBILITY ---------- */
.hidden {
  display: none;
}

/* ---------- BUTTON GRID ---------- */
.button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* ---------- INSTRUMENT + QUIZ BUTTONS ---------- */
#instrumentButtons button,
#quizButtons button {
  font-family: "Work Sans", Arial, sans-serif;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;

  padding: 20px 22px;
  min-height: 88px;

  background: #ffffff;
  color: var(--b2r-blue);
  border: 2px solid #000000;
  border-radius: 10px;

  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
}

#instrumentButtons button:hover,
#quizButtons button:hover {
  color: var(--b2r-magenta);
}

/* ---------- QUIZ AREA (NO SCROLLING) ---------- */
#quiz-area {
  min-height: calc(100svh - 180px);
}

/* ---------- QUIZ LAYOUT ---------- */
#quiz-sidebar {
  flex: 0 0 180px;
  /* fixed width */
  border-left: 3px solid var(--b2r-blue);
  padding-left: 16px;
  background: #f0f6fb;
}

/* ---------- MAIN QUIZ COLUMN ---------- */
#quiz-main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- QUESTION PROGRESS ---------- */
#question-progress {
  margin-bottom: 8px;
}

#question-count {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

#progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--b2r-blue);
}

/* ---------- QUESTION IMAGE (FIXED + SAFE) ---------- */
#questionImage {
  display: block;
  margin: 8px auto 12px auto;

  max-width: 100%;
  max-height: 52vh;
  /* controlled height */
  width: auto;
  height: auto;

  object-fit: contain;

  visibility: hidden;
  /* 👈 ADD THIS */
}

/* ---------- ANSWER CHOICES ---------- */
#choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding-top: 12px;
}

#choices button {
  width: 100%;
  padding: 16px 18px;

  font-size: clamp(24px, 5.5vw, 30px);
  font-weight: 800;

  border-radius: 6px;
  border: 1px solid var(--b2r-border);
  background-color: #f1f1f1;
  cursor: pointer;
}

/* ---------- FEEDBACK ---------- */
#feedback-area {
  margin-top: 12px;
}

#feedback {
  font-size: 20px;
  font-weight: 700;
  min-height: 28px;
}

.correct {
  color: var(--b2r-blue);
}

.incorrect {
  color: var(--b2r-magenta);
}


/* ---------- SIDEBAR ---------- */
#quiz-sidebar {
  flex: 0 0 180px;
  /* fixed width */
  border-left: 3px solid var(--b2r-blue);
  padding-left: 16px;
  background: #f0f6fb;
}

.sidebar-block {
  margin-bottom: 18px;
}

.sidebar-label {
  font-size: 14px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.sidebar-value {
  font-size: 36px;
  font-weight: 800;
  color: var(--b2r-magenta);
}

.sidebar-small {
  font-size: 16px;
  font-weight: 700;
}

/* ---------- TIME BAR ---------- */
.time-bar {
  height: 8px;
  background-color: #ffe2bf;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

#time-bar-fill {
  height: 100%;
  background-color: var(--b2r-orange);
}

/* ---------- RESULTS ---------- */
#results {
  text-align: center;
  overflow-y: auto;
}

#perfect-score {
  margin-top: 20px;
  font-size: 20px;
  font-weight: 800;
  color: var(--b2r-magenta);
}

/* ---------- HOME SCORING BOX ---------- */
.home-scoring-box {
  margin-top: 24px;
  padding: 18px;
  background: #f0f6fb;
  border: 2px solid var(--b2r-blue);
  border-radius: 8px;
  text-align: center;
}

.home-scoring-box h3 {
  margin-top: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--b2r-magenta);
}

.home-scoring-box p {
  margin: 6px 0;
  font-size: 16px;
  font-weight: 600;
}

.instructions-button {
  margin-top: 12px;
  padding: 10px 16px;
  font-weight: 700;
  border-radius: 6px;
  border: 2px solid #000;
  background: #fff;
  color: var(--b2r-blue);
  cursor: pointer;
}

/* ---------- MODAL ---------- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: #ffffff;
  padding: 28px;
  border-radius: 10px;
  max-width: 600px;
  width: 90%;
  text-align: center;
}

.modal-content h2 {
  margin-top: 0;
  color: var(--b2r-magenta);
}

.modal-content button {
  margin-top: 16px;
  padding: 10px 16px;
  font-weight: 700;
  border: 2px solid #000;
  background: #fff;
  color: var(--b2r-blue);
  cursor: pointer;
}

/* ---------- TEACHER REQUEST MODAL FORM ---------- */
.modal-form {
  text-align: left;
  margin-top: 12px;
}

.modal-form label {
  display: block;
  margin-top: 12px;
  font-weight: 700;
}

.modal-form input,
.modal-form textarea {
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  border: 2px solid #000;
  border-radius: 8px;
  font-family: "Work Sans", Arial, sans-serif;
  font-size: 16px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.modal-error {
  margin-top: 10px;
  padding: 10px 12px;
  border: 2px solid #000;
  border-radius: 8px;
  background: #fff3f8;
  color: var(--b2r-magenta);
  font-weight: 700;
  text-align: center;
}

/* ---------- QUIZ LAYOUT WRAPPER ---------- */
#quiz-layout {
  display: flex;
  align-items: stretch;
  gap: 24px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 700px) {
  body {
    padding: 16px;
  }

  #quiz-layout {
    flex-direction: column;
  }

  #quiz-sidebar {
    width: 100%;
    border-left: none;
    border-top: 2px solid var(--b2r-blue);
    padding-left: 0;
    padding-top: 12px;
  }

  #questionImage {
    max-height: 35vh;
  }

  #instrumentButtons button,
  #quizButtons button {
    font-size: 20px;
    min-height: 76px;
  }
}

/* FORCE review images to be contained (override-proof) */
#results #review-list img {
  display: block !important;

  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 240px !important;

  object-fit: contain !important;

  margin: 0 auto 8px auto !important;
  /* CENTER IMAGE */
}


/* ---------- LEADERBOARD FORM LAYOUT ---------- */
#leaderboard-submit .lb-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 320px;
  margin: 0 auto;
}

#leaderboard-submit .lb-label {
  width: 100%;
  text-align: left;
  font-weight: 600;
}

#leaderboard-submit .lb-input {
  width: 100%;
  max-width: 320px;
  padding: 8px 10px;
  font-size: 16px;
}

#leaderboardList {
  list-style: none;
  padding-left: 0;
}

/* ---------- LOCATION DROPDOWN ---------- */
.location-dropdown {
  width: 100%;
  max-width: 320px;
  margin-top: 4px;

  border: 1px solid #ccc;
  border-radius: 6px;
  background: #ffffff;

  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  z-index: 10;
}

.location-option {
  padding: 8px 10px;
  cursor: pointer;
  font-size: 15px;
}

.location-option:hover {
  background-color: #f0f6fb;
}

/* Guitar Grid Layout */
#guitarContainer {
  margin: 16px 0 24px;
}

.guitar-grid {
  max-width: 100%;
  display: block;
}

/* Guitar toggle cursor */
#stringToggles text {
  cursor: pointer;
}

#fingerDots circle,
#fingerDots text {
  pointer-events: none;
  cursor: pointer;
}

.guitar-check-btn {
  margin-top: 16px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 700;
  border: 2px solid #000;
  background: #fff;
  color: var(--b2r-blue);
  border-radius: 6px;
  cursor: pointer;
}

#guitarContainer {
  display: flex;
  flex-direction: column;
  align-items: center;
}

#guitarContainer .guitar-check-btn {
  margin-top: 16px;
}

#progress-fill {
  transition: width 0.3s ease;
}

.guitar-grid {
  width: 100%;
  max-width: 720px;
  height: auto;
}

#stringToggles text.locked {
  cursor: not-allowed;
}

.cell.locked {
  cursor: not-allowed;
}

.home-actions {
  display: flex;
  justify-content: center;
  /* center horizontally */
  align-items: center;
  gap: 16px;
  /* space between buttons */
  margin-top: 16px;
  flex-wrap: wrap;
  /* keeps it responsive */
}

.home-actions .instructions-button {
  width: auto;
  /* prevent full-width stacking */
}

.home-actions .instructions-button {
  width: auto;
}

.teacher-request-note {
  margin: 10px 0 16px 0;
  font-size: 15px;
  line-height: 1.4;
  color: var(--b2r-blue);
}

.lb-search {
  margin: 12px auto 16px auto;
  padding: 8px 12px;
  font-size: 15px;
  width: 260px;
  border: 2px solid #000;
  border-radius: 6px;
  display: block;
}