@import url('https://fonts.googleapis.com/css2?family=Delius&family=Rancho&display=swap');

:root {
    /* Default palette: "Neutral Earth Tones" (light variant). Kept in sync with
       theme.js so the app matches the default even before/without JS. */
    --primary-color: #22333b;
    --primary-dark: #0a0908;
    --secondary-color: #22333b;
    --background-color: #ede4da;
    --surface-color: #f9f6f2;
    --card-color: #f3eee8;
    --chip-color: #e5dacd;
    --accent-color: #2f855a;
    --error-color: #c23a56;
    --border-color: #e3d6c7;
    --hover-border-color: #22333b;
    --hover-color: #6f7a80;
    --hover-bg-color: #e8ded2;
    --text-color: #0a0908;
    /* Text placed on the primary/secondary colored badges (question number,
       glossary tooltip). White works on the dark light-mode fills; the theme
       picker / dark scheme recompute these for contrast. */
    --on-primary: #ffffff;
    --on-secondary: #ffffff;
    --font-heading: "Rancho", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    --font-body: "Delius", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --box-shadow: 0 2px 4px rgba(10, 9, 8, 0.12);
    --box-shadow-hover: 0 4px 10px rgba(10, 9, 8, 0.22);
}

/* Default palette: "Neutral Earth Tones" (dark variant), for users on a dark
   system who haven't picked a palette. When a palette IS chosen, theme.js sets
   these variables inline (light or dark), overriding this block. Kept in sync
   with theme.js's computeVarsDark output for the default palette. */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #d7c5b1;
        --primary-dark: #c6ac8f;
        --secondary-color: #9e8a72;
        --background-color: #131c20;
        --surface-color: #1a262c;
        --card-color: #1f2e35;
        --chip-color: #404747;
        --accent-color: #57cc8b;
        --error-color: #f27a92;
        --border-color: #3f494e;
        --hover-border-color: #d7c5b1;
        --hover-color: #877561;
        --hover-bg-color: #2c373d;
        --text-color: #f1ebe4;
        --on-primary: #1c1c1c;
        --on-secondary: #1c1c1c;
        --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.45);
        --box-shadow-hover: 0 6px 16px rgba(0, 0, 0, 0.6);
    }
}



*, *::before, *::after {
    box-sizing: border-box;
}

/* Form controls don't inherit font-family by default — force them onto the
   body font so buttons, inputs, selects and textareas match the rest of the UI. */
button, input, select, textarea {
    font-family: var(--font-body);
}

body {
    font-family: var(--font-body);
    font-size: 16px;
    margin: 0;
    padding-top: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Header & Nav */
.nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--surface-color) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: var(--spacing-sm) 0;
    box-shadow: var(--box-shadow);
    border-bottom: 1px solid var(--border-color);
}

.quiz-options {
    display: flex;
    justify-content: center;
    margin: 0 auto;
    max-width: 800px;
    padding: 0 var(--spacing-sm);
}

.site-header {
    text-align: center;
    margin: var(--spacing-lg) 0;
    padding: 0 var(--spacing-md);
}

h1 {
    color: var(--primary-color);
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 2px 1px 5px rgba(138, 123, 216, 0.35);
}

/* Titles use the display font; question/body copy stays on the body font */
h1, h2, .lb-title, .hs-title, .review-title {
    font-family: var(--font-heading);
}

/* Main Container */
.quiz-container {
    max-width: 800px;
    margin: 0 auto var(--spacing-xl);
    padding: var(--spacing-lg);
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
}

/* Soft, kid-friendly rounding for the quiz-list container and the review modal.
   Large uniform radii on every corner — consistent on all four edges regardless
   of the box's size. */
.wavy-card, .review-modal .review-content {
    border-radius: 2.5rem;
}

@media (max-width: 600px) {
    .wavy-card, .review-modal .review-content {
        border-radius: 1.75rem;
    }
}

/* Front page quiz picker */
.quiz-picker {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.darjah-group {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-color);
    padding: var(--spacing-md);
}

.darjah-title {
    margin: 0 0 var(--spacing-sm) 0;
    color: var(--primary-color);
    font-size: 1.3rem;
}

.quiz-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quiz-badge {
    display: inline-block;
    text-decoration: none;
    cursor: pointer;
}

.quiz-badge:hover {
    background: var(--hover-bg-color);
    border-color: var(--hover-border-color);
    transform: translateY(-1px);
    box-shadow: var(--box-shadow-hover);
}

.quiz-empty {
    opacity: 0.7;
    font-size: 0.95rem;
}

/* Quiz top bar: return link | centered title | high-score button.
   Sticky, spanning the full page width. */
.quiz-topbar {
    position: sticky;
    top: 0;
    z-index: 400;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    margin: 0 0 var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: color-mix(in srgb, var(--surface-color) 94%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
}

.quiz-topbar .return-badge {
    justify-self: start;
    font-size: 0.9rem;
}

h1.topbar-title {
    font-size: 1.4rem;
    text-align: center;
    min-width: 0;
}

.topbar-scores {
    justify-self: end;
    position: relative;
}

#high-score-btn {
    padding: 6px 14px;
    background: var(--hover-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    white-space: nowrap;
    transition: all 0.2s ease;
}

#high-score-btn:hover {
    background: var(--hover-bg-color);
    border-color: var(--hover-border-color);
}

.high-score-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 240px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--box-shadow-hover);
    padding: var(--spacing-sm);
    z-index: 300;
}

.hs-title {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.hs-empty {
    color: var(--secondary-color);
    font-size: 0.95rem;
}

@media (max-width: 600px) {
    .quiz-topbar {
        grid-template-columns: 1fr auto;
    }
    h1.topbar-title {
        grid-column: 1 / -1;
        grid-row: 2;
        font-size: 1.2rem;
    }
}

/* Questions */
.question, .fill-blank-question {
    display: block;
    position: relative;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-lg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--card-color);
    transition: transform 0.2s ease;
}

/* Circled question number, halfway out of the container's top-left corner */
.question-number {
    position: absolute;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    background: var(--primary-dark);
    color: var(--on-primary);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1;
    border: 2px solid var(--surface-color);
    box-shadow: var(--box-shadow);
    z-index: 1;
}

@media (max-width: 600px) {
    .question-number {
        width: 2rem;
        height: 2rem;
        font-size: 0.9rem;
    }
}

.question-text {
    font-weight: 600;
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    font-size: 1.25rem;
    color: var(--text-color);
    line-height: 1.4;
}

/* Options */
.nav-menu select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    font-size: 1rem;
    font: var(--font-body);
    color: var(--text-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.nav-menu select::picker(select) {
  appearance: base-select; /* Unlocks customization */
}

select::picker-icon {
  color: #ff0000; /* Change the icon color */
  /* You can also add animations or rotations */
  transition: transform 0.3s;
}

select:open::picker-icon {
  transform: rotate(180deg); /* Rotate the icon when the select is open */
}

input[type="radio"] {
  box-shadow: var(--box-shadow); /* Horizontal offset, vertical offset, blur radius, color */
}

/* Add different shadows for different states */
input[type="radio"]:hover {
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

input[type="radio"]:checked {
  box-shadow: 0 0 2px 2px var(--accent-color, 0, 0, 0, 0.1); /* Example: a blue glow when checked */
}



.true-false-options, .mc-options {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.option-label {
    display: flex;
    align-items: center;
    padding: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--surface-color);
    transition: all 0.2s ease;
}

.option-label:hover {
    background: var(--hover-bg-color);
    border-color: var(--hover-color);
}

.option-text {
    margin-left: var(--spacing-sm);
    font-size: 1.1rem;
}

input[type="radio"] {
    accent-color: var(--primary-color);
    width: 1.2em;
    height: 1.2em;
    margin: 0;
}

/* Buttons and Inputs */
.quiz-selector {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text-color);
    cursor: pointer;
}

button[type="button"], button.review-btn, .quiz-btn {
    padding: 10px 20px;
    background-color: var(--hover-color);
    color: var(--text-color);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    font-weight: 600;
}

button[type="button"]:hover, button.review-btn:hover, .quiz-btn:hover {
    background-color: var(--hover-bg-color);
    transform: translateY(-1px);
}

#quiz-form button[type="button"] { /* Submit button */
    display: block;
    width: 100%;
    padding: 16px;
    margin-top: var(--spacing-xl);
    background: var(--primary-color);
    color: var(--on-primary);
    font-size: 1.2rem;
    box-shadow: var(--box-shadow);
}

#quiz-form button[type="button"]:hover {
    background: var(--primary-dark);
}

/* Section Indicator */
.section-indicator {
    text-align: center;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--box-shadow);
}

.instructions {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-color);
}

.section-heading {
    margin: 0 0 var(--spacing-sm) 0;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e4edf8;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: var(--spacing-xs);
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

/* Results */
.result {
    margin-top: 20px;
    padding: 15px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: bold;
}

.final-results {
    text-align: center;
    padding: var(--spacing-lg);
    background: var(--surface-color);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-lg);
    box-shadow: var(--box-shadow);
}

.final-results h2 {
    color: var(--primary-color);
    margin-bottom: var(--spacing-md);
}

.section-scores {
    margin: var(--spacing-md) 0;
    font-size: 1.1rem;
}

.section-scores > div {
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px dashed var(--border-color);
}

.review-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: var(--spacing-lg);
    flex-wrap: wrap;
}

/* Answer Key (for fill blanks) */
.answer-key {
    position: sticky;
    /* --topbar-h is set by JS so the key sticks just below the sticky top bar */
    top: calc(var(--topbar-h, 0px) + 8px);
    background: color-mix(in srgb, var(--surface-color) 95%, transparent);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--box-shadow);
    z-index: 99;
    border: 1px solid var(--border-color);
    /* Prevent the sticky answer key from covering the submit button on small screens */
    max-height: 40vh;
    overflow-y: auto;
    text-align: center;
}

.answer-key-title {
    font-weight: bold;
    margin-bottom: var(--spacing-sm);
    color: var(--primary-color);
}

.answer-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

}

.answer-option {
    background: var(--chip-color);
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    color: var(--text-color);
    position: relative;
    transition: all 0.2s ease;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}

.answer-option.used {
    opacity: 0.3;
    text-decoration: line-through;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
}

.fill-blank-select {
    padding: 6px 10px;
    margin: 4px 4px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface-color);
    font-size: 1rem;
    color: var(--text-color);
    appearance: initial;
    box-shadow: var(--box-shadow);
    font: var(--font-body);
    font-size: 1rem;
    font-weight: normal;
    text-align: center;
}

.fill-blank-question {
    line-height: 2.2;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 7rem;
}

.fill-blank-question .question-text {
    margin: 0;
}

/* Duplicate-answer warning (fill in the blanks) */
.duplicate-warning {
    margin-top: var(--spacing-sm);
    color: var(--error-color);
    font-weight: 700;
    font-size: 0.95rem;
}

.fill-blank-select.duplicate {
    border-color: var(--error-color);
    box-shadow: 0 0 8px rgba(214, 86, 107, 0.55);
}

.answer-option.duplicate {
    cursor: pointer;
    border-color: var(--error-color);
    animation: dup-glow 1.2s ease-in-out infinite;
}

.answer-option.duplicate:hover,
.answer-option.duplicate:focus {
    animation: none;
    box-shadow: 0 0 12px rgba(214, 86, 107, 0.9);
}

@keyframes dup-glow {
    0%, 100% { box-shadow: 0 0 4px rgba(214, 86, 107, 0.45); }
    50% { box-shadow: 0 0 12px rgba(214, 86, 107, 0.85); }
}

/* Small message modal (duplicate answer details) */
.message-modal-text {
    font-size: 1.1rem;
    text-align: center;
    padding: var(--spacing-sm) var(--spacing-md) var(--spacing-md);
}

/* Modals */
.review-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background: rgba(79, 74, 114, 0.45);
    backdrop-filter: blur(2px);
}

.review-content {
    background: var(--surface-color);
    padding: var(--spacing-lg) var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: var(--box-shadow);
    max-width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

.review-questions {
    margin: 20px 0;
}

.review-header {
    position: sticky;
    top: 0;
    display: flex;
    justify-content: flex-end;
    background: transparent;
    padding-bottom: var(--spacing-sm);
    z-index: 2;
}

.close-modal-btn {
    position: sticky;
    top: var(--spacing-sm);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    background: var(--surface-color);
    color: var(--primary-color);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 3;
}

.close-modal-btn:hover {
    background: var(--primary-color);
    color: var(--on-primary);
}

/* Utilities */
.correct { color: var(--accent-color); }
.incorrect { color: var(--error-color); }
.option-label.correct-answer {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}
.option-label.incorrect-answer {
    border-color: var(--error-color);
    box-shadow: 0 0 0 1px var(--error-color);
}
.fill-blank-select.correct {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}
.fill-blank-select.incorrect {
    border-color: var(--error-color);
    box-shadow: 0 0 0 1px var(--error-color);
}
.correct-answer::after, .fill-blank-select.correct::after {
    color: var(--accent-color);
}
.loading, .no-quizzes {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--primary-color);
}
.no-quizzes a { color: var(--accent-color); }

@media (max-width: 600px) {
    .quiz-container {
        padding: var(--spacing-sm);
    }
    .option-label {
        padding: var(--spacing-sm);
    }
}

@media (max-width: 600px) {
    /* Sticky can overlap content on very small viewports; keep it in normal flow. */
    .answer-key {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

/* Name gate (before quiz start) */
.name-gate {
    display: flex;
    justify-content: center;
    margin: var(--spacing-lg) 0;
}

.name-gate-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--box-shadow);
    padding: var(--spacing-lg);
    text-align: center;
}

.name-gate-title {
    margin: 0 0 var(--spacing-xs);
    color: var(--primary-color);
}

.name-gate-sub {
    margin: 0 0 var(--spacing-md);
    font-size: 0.95rem;
    color: var(--secondary-color);
}

.name-gate-label {
    display: block;
    text-align: left;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: var(--spacing-xs);
}

.name-gate-card input,
.name-gate-card select {
    width: 100%;
    padding: 12px;
    margin-bottom: var(--spacing-md);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface-color);
    font-size: 1rem;
    color: var(--text-color);
    font-family: var(--font-body);
}

.name-gate-card #start-quiz-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--box-shadow);
    transition: background 0.2s ease;
}

.name-gate-card #start-quiz-btn:hover {
    background: var(--primary-dark);
}

/* Leaderboard (end of quiz) */
.leaderboard {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background: var(--card-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.lb-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-sm);
}

.lb-loading {
    color: var(--secondary-color);
    font-size: 0.95rem;
}

.lb-you {
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: var(--spacing-sm);
}

.lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 1rem;
}

.lb-table td {
    padding: 8px 10px;
    border-bottom: 1px dashed var(--border-color);
    text-align: left;
}

.lb-table tr:last-child td {
    border-bottom: none;
}

.lb-rank {
    width: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.lb-score {
    text-align: right;
    font-weight: 700;
    color: var(--accent-color);
    white-space: nowrap;
}

.lb-darjah {
    display: inline-block;
    font-size: 0.75rem;
    background: var(--hover-color);
    color: var(--secondary-color);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
}

/* Glossary translation tooltips */
.glossary-term {
    position: relative;
    cursor: help;
    color: inherit;
    font-weight: inherit;
    border-bottom: 1px dotted var(--hover-border-color);
}

.glossary-term .glossary-bubble {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: max-content;
    max-width: 240px;
    white-space: normal;
    background: var(--secondary-color);
    color: var(--on-secondary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.3;
    box-shadow: var(--box-shadow-hover);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 200;
}

.glossary-term .glossary-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--secondary-color);
}

.glossary-term:hover .glossary-bubble,
.glossary-term:focus .glossary-bubble,
.glossary-term.active .glossary-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Compiled end-of-quiz review: all sections in one modal, list form */
.review-section-title {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin: var(--spacing-md) 0 var(--spacing-xs);
    padding-bottom: var(--spacing-xs);
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.review-list {
    margin: 0;
    padding-left: 1.6em;
    text-align: left;
}

.review-list li {
    margin-bottom: var(--spacing-sm);
    line-height: 1.7;
}

.review-answer {
    color: var(--accent-color);
    font-weight: 700;
}

.review-you-chose {
    color: var(--error-color);
    font-weight: 700;
}

/* Countdown to the next section after submitting answers */
.next-countdown {
    margin-top: var(--spacing-sm);
    font-size: 1.1rem;
    color: var(--secondary-color);
}

.next-countdown .countdown-num {
    display: inline-block;
    min-width: 1.6em;
    font-size: 1.4rem;
    font-weight: 700;
    font-family: var(--font-heading);
    color: var(--primary-color);
}

/* Review Specific Styles & Missing bits */
.correct-answer {
    position: relative;
    padding-right: 25px;
    color: var(--accent-color) !important;
}

.correct-answer::after {
    content: '✓';
    position: absolute;
    right: 10px;
    font-weight: bold;
    color: var(--accent-color);
}

.review-content .fill-blank-select {
    position: relative;
}

/* Pseudo-element on select might not work, but keeping for compatibility if it did somehow */
.fill-blank-select.correct::after {
    content: '✓';
    position: absolute;
    right: -20px;
    color: var(--accent-color);
    font-weight: bold;
}

.correct-answer-text {
    color: var(--accent-color);
    font-weight: bold;
    margin-top: 5px;
}

/* Inline chosen-value tokens shown in fill-in-the-blank review */
.fill-blank-review {
    display: inline-block;
    margin: 0 3px;
    padding: 1px 8px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
}

.fill-blank-review.correct {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.fill-blank-review.incorrect {
    color: var(--error-color);
    border-color: var(--error-color);
    text-decoration: line-through;
}

.review-content button[type="button"] {
    display: none;
}

/* ------------------------------------------------------------------ */
/* Theme picker — floating swatch menu, present on every page.        */
/* Selectors are scoped under .theme-picker so they outrank the       */
/* global button[type="button"] rule.                                 */
/* ------------------------------------------------------------------ */
.theme-picker {
    position: fixed;
    right: var(--spacing-md);
    bottom: var(--spacing-md);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: var(--spacing-xs);
}

.theme-picker .theme-fab {
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    box-shadow: var(--box-shadow-hover);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

.theme-picker .theme-fab:hover {
    background: var(--surface-color);
    transform: scale(1.06);
}

.theme-picker .theme-menu {
    width: 244px;
    max-height: 70vh;
    overflow-y: auto;
    padding: var(--spacing-sm);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--box-shadow-hover);
}

.theme-menu-title {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xs);
}

.theme-picker .theme-option {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    margin: 0 0 4px;
    padding: 8px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.theme-picker .theme-option:hover {
    background: var(--hover-bg-color);
    transform: none;
}

.theme-picker .theme-option.active {
    border-color: var(--primary-color);
    background: var(--card-color);
}

.theme-swatches {
    display: flex;
    gap: 4px;
}

.theme-swatch {
    flex: 1;
    height: 22px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.theme-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

@media (max-width: 600px) {
    .theme-picker .theme-fab {
        width: 46px;
        height: 46px;
        font-size: 1.3rem;
    }
    .theme-picker .theme-menu {
        width: 210px;
    }
}
