:root {
    --panel: rgba(247, 241, 223, 0.96);
    --line: #af7f4e;
    --brown: #6f4a2f;
    --title: #2e4f85;
    --ok: #2f9e44;
    --bad: #e03131;
    --ink: #3f2f1f;
}

* {
    box-sizing: border-box;
}

body.quiz-page {
    margin: 0;
    min-height: 100vh;
    padding: 24px 18px;
    font-family: 'Fredoka', sans-serif;
    color: var(--ink);
}

body.quiz-page::after {
    z-index: -1;
    top: -130px;
    opacity: 0.25;
    filter: drop-shadow(0 8px 10px rgba(36, 23, 8, 0.18));
}

.quiz-shell {
    max-width: 980px;
    margin: 0 auto;
    border: 5px solid var(--line);
    border-radius: 30px;
    background: var(--panel);
    padding: 24px;
    box-shadow: 0 18px 36px rgba(65, 45, 24, 0.24);
    backdrop-filter: blur(2px);
    position: relative;
    z-index: 2;
}

body.quiz-page .quiz-shell .sound-control {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 10;
}

body.quiz-page .quiz-shell .sound-slider-panel {
    max-width: min(60vw, 230px);
}

body.quiz-page .quiz-head {
    padding-top: 56px;
}

.quiz-head {
    text-align: center;
    margin-bottom: 20px;
}

.badge {
    display: inline-block;
    margin-bottom: 14px;
    background: var(--brown);
    color: #fff;
    border-radius: 999px;
    padding: 8px 20px;
    font-weight: 700;
    border: 3px solid #d2b089;
    letter-spacing: 0.3px;
}

.quiz-head h1 {
    margin: 10px 0 6px;
    font-family: 'Baloo 2', cursive;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--title);
    line-height: 0.95;
}

.quiz-head p {
    margin: 0;
    font-size: 1.2rem;
    color: #5e3d29;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.progress {
    font-weight: 700;
    color: #5e3d29;
}

.back-link {
    color: var(--ink);
    font-weight: 700;
    text-decoration: none;
    border: 2px solid #cfb18d;
    border-radius: 10px;
    padding: 8px 12px;
    background: #fffaef;
}

.back-link:hover {
    background: #fff3dc;
}

.tracker {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 18px;
}

.dot {
    border: 2px solid #c8a680;
    border-radius: 10px;
    padding: 8px 0;
    text-align: center;
    font-weight: 700;
    background: #f3e7cf;
    color: #7c6246;
    transition: transform 0.15s ease;
}

.dot.current {
    border-color: #365f9f;
    background: #deebff;
    color: #264d8b;
    transform: translateY(-1px);
}

.dot.correct {
    background: #dcfce7;
    color: #1f7a34;
    border-color: #34a853;
}

.dot.wrong {
    background: #ffe3e3;
    color: #b42323;
    border-color: #ef4444;
}

.question-card {
    border: 3px solid #d5b18a;
    border-radius: 20px;
    background: #fff8ea;
    padding: 18px;
    margin-bottom: 14px;
}

.question-media {
    margin: 0 0 14px;
    border-radius: 14px;
    border: 2px solid #d5b18a;
    overflow: hidden;
    background: #fff;
}

.question-media img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: contain;
}

.question-title {
    margin: 0;
    font-size: 1.35rem;
    color: var(--ink);
    font-weight: 700;
    line-height: 1.45;
}

.choices {
    margin-top: 16px;
    display: grid;
    gap: 10px;
}

.choice-btn {
    width: 100%;
    border: 2px solid #ceb38e;
    background: #fff;
    border-radius: 14px;
    text-align: left;
    padding: 12px 14px;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.choice-btn:hover {
    border-color: #7a5a36;
    background: #fff8e8;
}

.choice-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.88;
}

.choice-btn.selected-correct {
    background: #ddfbe5;
    border-color: #2f9e44;
}

.choice-btn.selected-wrong {
    background: #ffe4e6;
    border-color: #e03131;
}

.notice {
    min-height: 36px;
    border-radius: 12px;
    font-weight: 700;
    padding: 10px 12px;
    display: none;
    align-items: center;
    margin-bottom: 14px;
}

.notice.show {
    display: flex;
}

.notice.ok {
    background: #dff9e6;
    border: 2px solid #8ce3a1;
    color: #1f7a34;
}

.notice.bad {
    background: #ffe5e7;
    border: 2px solid #ffb5bd;
    color: #b42323;
}

.result-card {
    border: 3px solid #d5b18a;
    border-radius: 20px;
    background: #fff8ea;
    padding: 18px;
    display: none;
}

.result-card.show {
    display: block;
}

.result-card h2 {
    margin: 0 0 12px;
    color: var(--title);
    font-family: 'Baloo 2', cursive;
    font-size: 2rem;
    line-height: 1;
}

.totals {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.chip {
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
}

.chip.ok {
    background: #dcfce7;
    color: #1f7a34;
}

.chip.bad {
    background: #ffe3e3;
    color: #b42323;
}

.result-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 8px;
}

.result-item {
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 600;
    border: 2px solid transparent;
}

.result-item.correct {
    background: #ecfdf3;
    border-color: #9fe0b3;
    color: #1f7a34;
}

.result-item.wrong {
    background: #fff0f2;
    border-color: #ffc9d0;
    color: #b42323;
}

.actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 11px 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: #2e4f85;
    color: #fff;
}

.btn-secondary {
    background: #d8c3a4;
    color: #5b3e2a;
}

@media (max-width: 760px) {
    body.quiz-page {
        padding: 12px;
    }

    .quiz-shell {
        padding: 16px;
        border-radius: 22px;
    }

    body.quiz-page .quiz-shell .sound-control {
        top: 10px;
        left: 10px;
    }

    body.quiz-page .quiz-shell .sound-slider-panel {
        min-width: 170px;
    }

    body.quiz-page .quiz-head {
        padding-top: 58px;
    }

    .tracker {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }

    .quiz-head p {
        font-size: 1rem;
    }

    .question-title {
        font-size: 1.14rem;
    }
}
