body[data-state="init"] .progress-container,
body[data-state="init"] .score-display,
body[data-state="init"] .final-screen {
    display: none !important;
}


:root {
    --primary: #4a148c;
    --secondary: #7b1fa2;
    --light: #f3e5f5;
    --dark: #12005e;
    --success: #2e7d32;
    --danger: #c62828;
    --warning: #f9a825;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}



body {
  font-family: 'Latin Modern Roman', serif;
  background-color: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem 0;
    text-align: center;
    border-radius: 0 0 16px 16px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    margin-bottom: 1rem;
}

.header-content h1 {
    font-size: 2rem;
    margin-bottom: 0.2rem;
    font-weight: 700;
}

.header-content .subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

header h1 {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 2.5rem;
  letter-spacing: -0.5px;
}

header .subtitle {
  font-family: 'Manrope', sans-serif;
  font-weight: 400;
  font-size: 1rem;
  opacity: 0.85;
}


h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.quiz-container {
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    padding: 2rem;
    margin-bottom: 2rem;
}

.question-number {
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.question {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.options {
    margin-bottom: 1.5rem;
}

.site-logo {
  text-decoration: none;
  color: inherit;
}

.site-logo:hover {
  opacity: 0.85;
  cursor: pointer;
}


.option {
    background-color: var(--light);
    border: 2px solid #e1bee7;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
}

.option:hover {
    background-color: #e1bee7;
    border-color: var(--primary);
}

.option.selected {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.option.correct {
    background-color: var(--success);
    color: white;
    border-color: var(--success);
}

.option.incorrect {
    background-color: var(--danger);
    color: white;
    border-color: var(--danger);
}

.option input {
    margin-right: 10px;
    cursor: pointer;
}

.option-label {
    font-weight: bold;
    margin-right: 8px;
    min-width: 24px;
}

.explanation {
    background-color: #e8f5e9;
    border-left: 4px solid var(--success);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
    display: none;
}

.explanation h3 {
    color: var(--success);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    margin-top: 1.5rem;
}

button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:hover {
    background-color: var(--secondary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:disabled {
  background-color: #ddd;
  color: #888;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  opacity: 0.6;
}


button i {
    margin-right: 8px;
}

.progress-container {
    margin-bottom: 2rem;
}

.progress-bar {
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 0%;
    transition: width 0.3s ease;
}

.score-display {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.score-value {
    font-weight: bold;
    color: var(--primary);
}

.final-screen {
    text-align: center;
    padding: 2rem;
    display: none;
}

.final-score {
  font-size: 2rem;
  margin: 0.3rem 0 1rem; /* changed from 1rem 0 to this */
  color: var(--primary);
}

.feedback {
  font-size: 1.2rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.restart-btn {
    background-color: var(--warning);
    color: #212121;
}

.restart-btn:hover {
    background-color: #fbc02d;
}

.performance-gauge {
    width: 150px;
    height: 150px;
    margin: 0 auto 2rem;
    position: relative;
}

.gauge-background {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 10;
    stroke-linecap: round;
}

.gauge-progress {
    fill: none;
    stroke: var(--primary);
    stroke-width: 10;
    stroke-linecap: round;
    stroke-dasharray: 440;
    stroke-dashoffset: 440;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    transition: stroke-dashoffset 1s ease-in-out;
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    header {
        padding: 1.5rem 0;
    }

    h1 {
        font-size: 1.8rem;
    }

    .quiz-container {
        padding: 1rem;
    }

    button {
        padding: 0.6rem 1rem;
    }
}

.streak-container {
    text-align: center;
    margin-bottom: 1rem;
}

.streak-label {
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.streak-bar {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.streak-cell {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background-color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
    color: #444;
    cursor: default;
    transition: background-color 0.3s ease;
}

.streak-cell.filled {
    background-color: var(--primary);
    color: white;
}

.share-box {
    background: #f5f5f5;
    padding: 1rem;
    border-radius: 10px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    margin-top: 2rem;
}

.share-box h3 {
    margin-bottom: 0.5rem;
    color: var(--primary);
    font-size: 1.2rem;
}

#share-preview {
  background-color: #ffffff;
  border: 1px solid #ddd;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  font-family: monospace;
  text-align: left;
  max-width: 100%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  margin: 1rem auto;
}

#copy-share-btn {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.2s ease;
}

#copy-share-btn:hover {
    background-color: var(--secondary);
}

.copy-status {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: green;
}

.bmc-button-container {
    margin-top: 2rem;
    text-align: center;
}

.bmc-button {
    background-color: #ffdd00;
    color: #111;
    padding: 1rem 0.5rem;
    font-weight: bold;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1.3rem;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.bmc-button:hover {
    background-color: #ffc107;
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  margin-top: 0.5rem;
}

.share-buttons button {
  background-color: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 0.8rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.share-buttons button:hover {
  background-color: var(--secondary);
}

.share-buttons button {
    margin: 0 4px;
}

.share-buttons button i {
  font-size: 1.2rem;
}
.review-toggle {
    margin-top: 2rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #f9f9f9;
    font-family: var(--main-font);
    overflow: hidden;
}

.review-toggle summary {
    padding: 1rem;
    cursor: pointer;
    font-weight: bold;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
}

.review-toggle summary::-webkit-details-marker {
    display: none;
}

.review-toggle summary i {
    transition: transform 0.3s ease;
}

.review-toggle[open] summary i {
    transform: rotate(90deg);
}

.review-container {
    padding: 1rem;
    border-top: 1px solid #ddd;
}

.review-question {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed #ccc;
}

.review-question .question-text {
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.review-question .answer-info {
    margin-left: 1rem;
    font-size: 0.95rem;
    color: #333;
}

.review-question .answer-info strong {
    color: var(--primary);
}

#review-summary[open] .review-container {
    max-height: 600px; /* or however tall you want */
    overflow-y: auto;
    padding-right: 8px; /* for scroll buffer */
}

.answer-info div {
    margin: 0.2rem 0;
}

.explanation-text {
    margin-top: 0.5rem;
    font-style: italic;
}

/* Explanation block container */
.explanation-scrollable {
    padding: 6px 10px;
    background-color: #f0f9f0; /* soft green */
    border: 1px solid #cde8cd;
    border-left: 4px solid #72b372; /* accent stripe */
    border-radius: 6px;
    font-size: 0.95em;
    display: block;
    overflow: visible;
}

/* Display math only: allow horizontal scrolling, prevent vertical */
.explanation-scrollable mjx-container[jax="CHTML"][display="true"] {
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
}

/* Scrollbar styles for block math */
.explanation-scrollable mjx-container[jax="CHTML"][display="true"]::-webkit-scrollbar {
    height: 6px;
}
.explanation-scrollable mjx-container[jax="CHTML"][display="true"]::-webkit-scrollbar-thumb {
    background-color: #aaa;
    border-radius: 3px;
}

/* Default: inline math wraps normally, no scrollbars */
.explanation-scrollable mjx-container {
    max-width: 100%;
    display: inline-block;
    vertical-align: baseline;
    white-space: normal !important;
    overflow-x: hidden;
    overflow-y: hidden;
    position: relative;
    top: -3px; /* nudges it up slightly */
}


.explanation-scrollable mjx-container {
    vertical-align: middle;
}

/* Block math: scroll horizontally if needed */
.explanation-scrollable mjx-container[display="true"] {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding-bottom: 0.5rem; /* optional: space below for scroll */
}

.explanation-scrollable mjx-container[display="true"] {
    -webkit-overflow-scrolling: touch;
}

.card-container {
    perspective: 1000px;
    max-width: 800px;
    margin: 2rem auto;
}

.card {
    position: relative;
    width: 100%;
    transition: transform 1s;
    transform-style: preserve-3d;
}

.card.flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    backface-visibility: hidden;
    padding: 2rem;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.card-front {
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 220px;
    text-align: center;
}

.card-back {
    transform: rotateY(180deg);
    min-height: 220px;
}

.card-front {
    transform: rotateY(0deg);
}

#copy-share-btn {
    display: flex;
    align-items: center;
    gap: 6px; /* space between icon and text */
}