* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background: #f9f9f9;
    color: #333;
    line-height: 1.4;
    padding: 1rem;
}

.hidden {
    display: none !important;
}

/* HEADER */
header {
    text-align: center;
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.8rem
}

/* LOADING */
#loading {
    text-align: center;
    font-style: italic;
    margin: 1rem 0;
    color: #555;
}

/* CONTAINER */
#quiz-container {
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

label,
select,
button {
    font-size: 1rem
}

select,
button {
    margin-top: .5rem;
    padding: .5rem;
}

button {
    cursor: pointer;
    border: none;
    background: #007BFF;
    color: #fff;
    border-radius: 4px;
    transition: background-color .2s, transform .1s;
}

button:hover:not(:disabled) {
    background: #0056b3;
    transform: scale(1.02)
}

button:disabled {
    background: #aaa;
    cursor: not-allowed
}

.tips {
    margin-top: 1rem;
    white-space: pre-wrap;
    background: #eef;
    padding: .75rem;
    border-left: 4px solid #007BFF;
    border-radius: 4px;
}

/* NAV & PROGRESS */
#quiz-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

#progress-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

#progress-info div {
    font-weight: bold;
    margin-bottom: 0.1rem;
}

#progress-bar {
    flex: 1;
    margin: 0 .5rem;
    height: 8px;
    border-radius: 4px;
    transition: all .3s;
}

.nav-btn {
    background: #17a2b8;
    margin-left: .5rem
}

.nav-btn:hover {
    background: #117a8b
}

.end-btn {
    background: #6c757d
}

.end-btn:hover {
    background: #5a6268
}

/* QUESTION CARD */
@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.question-card.fade-in {
    animation: fadeIn .5s ease-in
}

.question-year {
    font-size: .9rem;
    color: #555;
    margin-bottom: .5rem
}

.passage-text {
    margin-bottom: 1rem;
    font-size: .95rem;
    color: #444
}

.prompt-text {
    background: #e7f1ff;
    border-left: 4px solid #007BFF;
    padding: .75rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    font-weight: bold;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: .5rem
}

.options-container button {
    text-align: left;
    background: #e1f0ff;
    color: #0056b3;
}

.options-container button:hover {
    background: #c3e0ff
}

/* FEEDBACK */
.feedback {
    margin-top: 1rem;
    padding: .75rem;
    border-radius: 4px;
    font-weight: normal;
}

.feedback-label {
    font-weight: normal;
}

.feedback-answer {
    font-weight: bold;
}

.feedback.correct {
    background: #d4edda;
    color: #155724
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24
}

/* NEXT & RESTART */
.next-btn,
#restart-btn {
    margin-top: 1rem
}

/* CERTIFICATE */
@keyframes popIn {
    0% {
        transform: scale(0.5);
        opacity: 0
    }

    100% {
        transform: scale(1);
        opacity: 1
    }
}

#result .certificate {
    border: 4px solid #FFD700;
    background: #fffbea;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    animation: popIn .6s ease-out;
}

#result .certificate h2 {
    font-family: 'Georgia', serif;
    font-size: 2rem;
    color: #B8860B;
    margin-bottom: .5rem;
}

#result .certificate p {
    margin: .5rem 0;
    font-weight: bold
}

#result .certificate button {
    margin-top: 1rem;
    padding: .5rem 1rem;
    font-size: 1rem;
    background: #007BFF;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color .2s;
}

#result .certificate button:hover {
    background: #0056b3
}

/* RESPONSIVE */
@media(max-width:480px) {
    #quiz-container {
        padding: .5rem
    }

    button,
    select {
        font-size: .9rem
    }

    .options-container button {
        font-size: .9rem
    }
}

#introduction {
    text-align: center;
    margin: 40px auto;
    max-width: 500px;
    padding: 24px;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 2px 10px #0001;
}

#introduction ul {
    text-align: left;
    display: inline-block;
    margin: 16px 0;
}

#intro-continue-btn {
    padding: 10px 24px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    margin-top: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

#intro-continue-btn:hover {
    background: #218838;
}

.open-answer {
    font-size: 1rem;
    padding: 0.5rem;
    margin-bottom: 0.7rem;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #007BFF;
    border-radius: 4px;
    margin-right: 8px;
}

/* --- Improved list styling for quiz content: tips, passage, prompt --- */

/* Tweak font size if you want for readability */
/* .tips, .passage-text, .prompt-text { font-size: 1.07em; } */

.tips ul,
.tips ol,
.passage-text ul,
.passage-text ol,
.prompt-text ul,
.prompt-text ol {
    margin: 0 0 .6em 1.5em;
    /* Only left indent, little bottom margin */
    padding: 0;
    /* Remove browser default padding */
}

.tips li,
.passage-text li,
.prompt-text li {
    margin: 0.16em 0;
    list-style-position: outside;
    padding-left: 0;
}

/* For unordered lists - main bullets */
.tips ul,
.passage-text ul,
.prompt-text ul {
    list-style-type: disc;
}

.tips ul ul,
.passage-text ul ul,
.prompt-text ul ul {
    list-style-type: circle;
}

/* For ordered lists - 1, 2, 3 */
.tips ol,
.passage-text ol,
.prompt-text ol {
    list-style-type: decimal;
}

.tips ol ol,
.passage-text ol ol,
.prompt-text ol ol {
    list-style-type: lower-alpha;
}

/* If you want second-level nesting of different types to indent a little more */
.tips ul ul,
.tips ol ul,
.passage-text ul ul,
.passage-text ol ul,
.prompt-text ul ul,
.prompt-text ol ul,
.tips ul ol,
.tips ol ol,
.passage-text ul ol,
.passage-text ol ol,
.prompt-text ul ol,
.prompt-text ol ol {
    margin-left: 1.2em;
}

#quiz-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5em;
}

#progress-info {
    display: flex;
    flex-direction: column;
    margin-right: 1em;
}

#shuffle-btn,
#end-btn {
    margin-left: 0.5em;
    white-space: nowrap;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    #quiz-nav {
        flex-direction: column;
        align-items: stretch;
    }

    #progress-info {
        margin-right: 0;
        margin-bottom: 0.5em;
    }

    #shuffle-btn,
    #end-btn {
        width: 100%;
        margin-left: 0;
        margin-bottom: 0.5em;
    }

    progress {
        width: 100%;
        margin-bottom: 0.5em;
    }
}

#end-btn,
.end-btn {
    background: none;
    border: 1px solid #bbb;
    color: #555;
    padding: 0.4em 1em;
    border-radius: 5px;
    font-size: 1em;
    margin-left: 0.5em;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#end-btn:hover,
.end-btn:hover {
    background: #eee;
    border-color: #888;
    color: #333;
}

#end-btn:focus,
.end-btn:focus {
    outline: 2px solid #aaa;
}

.question-source {
    font-size: 0.9em;
    color: #888;
    margin-bottom: 0.5em;
}

.modal.hidden {
    display: none;
}

.modal {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #fff;
    padding: 1.5em;
    border-radius: 12px;
    box-shadow: 0 4px 16px #3332;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 0.6em;
    right: 1em;
    background: none;
    border: none;
    font-size: 2em;
    color: #888;
    cursor: pointer;
}

#show-tips-btn {
    margin-left: 0.5em;
    background: #fff;
    border: 1px solid #2bb;
    color: #299;
    border-radius: 5px;
    padding: 0.4em 1em;
    font-size: 1em;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

#show-tips-btn:hover {
    background: #eafcfc;
    border-color: #088;
    color: #066;
}

.question-source {
    font-size: 1em;
    /* Matches passage text */
    font-style: italic;
    /* Optional: only if you want */
    color: #888;
    /* Optional: only if you want lighter */
    margin-bottom: 0.2em;
    margin-top: 0.2em;
}


/* ---- Sub-question multi-answer styles ---- */
.sub-question-block {
    margin-bottom: 1.1em;
}

.subq-prompt {
    margin-bottom: 0.3em;
    font-weight: bold;
}

.subq-input {
    width: 98%;
    margin-bottom: 0.3em;
    font-size: 1em;
    padding: 0.33em;
}

.subq-submit-all {
    margin-top: 1em;
    padding: 0.5em 1.5em;
    font-size: 1em;
    background: #1ab;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.subq-submit-all:disabled {
    background: #aaa;
}

.subq-feedback {
    margin-left: 0.5em;
    margin-top: 0.2em;
    margin-bottom: 0.6em;
    font-size: 0.97em;
}


.subq-mcq {
    margin-bottom: .4em;
}

.subq-mcq-btn {
    margin: 0 0.5em 0.4em 0;
    padding: .3em 1em;
    font-size: 1em;
    background: #f1fcfd;
    border: 1px solid #0ad;
    border-radius: 4px;
    cursor: pointer;
    transition: background .15s;
}

.subq-mcq-btn:disabled {
    background: #d0eaf2;
    color: #333;
    border-color: #aaa;
}

/* ---- Music Control (bottom-right corner) ---- */
#music-control {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
}

#music-control select,
#music-control button {
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
}

@media (max-width: 600px) {
    #music-control {
        bottom: 0.5rem;
        right: 0.5rem;
        flex-direction: column;
    }
}

#music-control input[type=range] {
    width: 6rem;
    cursor: pointer;
}

@media (max-width: 480px) {
    #music-control {
        flex-direction: column;
        align-items: stretch;
        bottom: 0.5rem;
        right: 0.5rem;
        padding: 0.6rem;
        gap: 0.4rem;
    }

    #music-control select,
    #music-control button,
    #music-control input[type=range] {
        width: 100%;
        font-size: 1rem;
    }

    #music-control input[type=range] {
        height: 1.2em;
    }
}

/* Music toggler (mobile only) */
#music-toggler {
    display: none;
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1001;
    background: #fff;
    border: none;
    font-size: 1.5rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

/* Override for small screens */
@media (max-width: 600px) {

    /* hide full panel by default on mobile */
    #music-control {
        display: none !important;
        flex-direction: column;
        align-items: stretch;
        gap: 0.4rem;
        padding: 0.6rem;
    }

    /* show toggler */
    #music-toggler {
        display: block;
    }

    /* when open, force-show the panel */
    #music-control.open {
        display: flex !important;
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        background: rgba(255, 255, 255, 0.95);
        border-radius: 0.6rem;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
        z-index: 1000;
        width: 90%;
        max-width: 300px;
    }

    /* enlarge touch targets */
    #music-control select,
    #music-control button,
    #music-control input[type=range] {
        width: 100%;
        font-size: 1rem;
    }

    #music-control input[type=range] {
        height: 1.2em;
    }
}

.answer-badge {
    display: inline-block;
    border: 1px solid #ccc;
    background: #f5f5f5;
    border-radius: 4px;
    padding: 2px 6px;
    margin: 2px 4px 2px 0;
    font-size: 0.95em;
}

/* Replace or augment your existing .selected rule */
.subq-mcq-btn.selected {
    background-color: #0056b3;
    /* darker blue */
    color: #fff;
    /* white text */
    border-color: #003f7f;
    /* darker border */
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: scale(1.02);
    /* slight “grow” effect */
    transition:
        background-color 0.15s,
        transform 0.1s,
        box-shadow 0.15s;
}

.subq-mcq-btn.selected:hover {
    background-color: #004494;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
}


/* --------------- NAV & PROGRESS --------------- */
.quiz-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 1rem;
}

.quiz-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.status-item {
    font-weight: bold;
    display: flex;
    align-items: center;
}

.status-item span {
    margin-left: 0.25rem;
    color: #0056b3;
}

.quiz-status progress {
    flex: 1 1 200px;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    appearance: none;
    background: #e5e5e5;
}

.quiz-status progress::-webkit-progress-bar {
    background: #e5e5e5;
}

.quiz-status progress::-webkit-progress-value {
    background: #007bff;
}

.quiz-status progress::-moz-progress-bar {
    background: #007bff;
}

.quiz-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* --------------- OUTLINE BUTTONS --------------- */
.outline-btn {
    border: 2px solid #17a2b8;
    background: none;
    color: #17a2b8;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.outline-btn:hover {
    background: #17a2b8;
    color: #fff;
}

.danger-btn {
    border-color: #dc3545;
    color: #dc3545;
}

.danger-btn:hover {
    background: #dc3545;
    color: #fff;
}

/* --------------- RESPONSIVE --------------- */
@media (max-width: 600px) {
    .quiz-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .quiz-actions {
        justify-content: space-around;
    }

    .quiz-status {
        justify-content: space-around;
    }
}


/* Applies to both the inline .tips block and the modal’s content */
.tips,
.modal-content {
    background: #f0f8ff;
    /* very light blue tint */
    color: #222;
    /* darker body text */
    font-size: 1.1rem;
    /* a bit bigger */
    line-height: 1.6;
    /* more vertical breathing room */
    padding: 1.25rem;
    /* extra space around the text */
    border-left: 6px solid #007bbc;
    border-radius: 6px;
    max-width: 32em;
    /* cap line length at ~500px */
    margin: 1em auto;
    /* center in modal or parent */
    white-space: pre-wrap;
    /* preserve any intentional line breaks */
}

/* If you want the popup window specifically even larger: */
.modal-content {
    max-width: 40em;
    max-height: 80vh;
    overflow-y: auto;
}

/* Optional: make lists within tips more spacious */
.tips ul,
.modal-content ul {
    margin: 0.5em 0 0.8em 1.5em;
    padding: 0;
}

.tips li,
.modal-content li {
    margin-bottom: 0.4em;
}

#start-practice-btn {
  display: block;
  width: 100%;
  margin: 1.5rem 0 0;    /* space above only */
  padding: 0.75rem;
  font-size: 1.1rem;
}