/* ── Animated background canvas ───────────────────────────────────────────── */
#animated-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(160deg, #f1f8e9 0%, #e8f5e9 50%, #dcedc8 100%);
}
#animated-background canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Corner labels ────────────────────────────────────────────────────────── */
.corner-name {
    position: fixed;
    font-size: 1.1rem;
    color: #1b5e20;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}
.top-left  { top: 20px; left:  20px; }
.top-right { top: 20px; right: 20px; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.quiz-card {
    width: 100%;
    max-width: 560px;
    border: none;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    overflow: visible;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(56, 142, 60, 0.15) !important;
}

/* quiz screen inner padding tighter */
#quiz-screen.p-4,
#start-screen.p-4,
#result-screen.p-4 {
    padding: 1.2rem !important;
}

/* smaller question text */
#question-text {
    font-size: 1rem;
    margin-bottom: 0.75rem !important;
}

/* tighter counter row */
#quiz-screen .d-flex.mb-3 {
    margin-bottom: 0.5rem !important;
}

/* ── Answer buttons ───────────────────────────────────────────────────────── */
.btn-option {
    text-align: left;
    border: 2px solid #a5d6a7;
    background-color: white;
    color: #2e7d32;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}
.btn-option:hover {
    background-color: #e8f5e9;
    border-color: #4caf50;
    transform: translateX(5px);
}
.btn-option.correct {
    background-color: #c8e6c9 !important;
    border-color:     #2e7d32 !important;
    color:            #1b5e20;
    box-shadow: 0 0 10px #66bb6a;
}
.btn-option.wrong {
    background-color: #ffcdd2 !important;
    border-color:     #c62828 !important;
    color:            #b71c1c;
    box-shadow: 0 0 10px #e57373;
}

/* ── GIF images ───────────────────────────────────────────────────────────── */
.quiz-gif {
    max-height: 130px;
    object-fit: contain;
}

/* ── Clock Timer ──────────────────────────────────────────────────────────── */
.timer-container {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

#timer-text {
    position: absolute;
    font-size: 0.85rem;
    font-weight: 700;
    color: #1b5e20;
    z-index: 10;
    user-select: none;
}

.timer-svg {
    width: 64px;
    height: 64px;
    transform: rotate(-90deg);
    overflow: visible;
}

.timer-bg {
    fill:         none;
    stroke:       #e0e0e0;
    stroke-width: 7;
}

.timer-path {
    fill:           none;
    stroke-width:   7;
    stroke-linecap: round;
    stroke:         #4caf50;
    transition: stroke-dashoffset 1s linear, stroke 0.4s ease;
}

.timer-warning  .timer-path { stroke: #ffa726; }
.timer-critical .timer-path { stroke: #ef5350; }

/* ── Result screen layout ─────────────────────────────────────────────────── */
/* Card gets a fixed max-height on result screen so scroll is contained */
.quiz-card:has(#result-screen:not(.d-none)) {
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#result-screen {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* Top static section: title, gif, score, buttons — never scrolls */
.result-static {
    flex-shrink: 0;
}

/* ── Review scroll area ───────────────────────────────────────────────────── */
#review-section {
    flex: 1 1 auto;
    overflow-y: auto;
    margin-top: 1rem;
    border-radius: 14px;
    background: #f9fbe7;
    border: 1.5px solid #c5e1a5;
    padding: 0.75rem 0.9rem;
    max-height: 260px;
}

/* Custom scrollbar for review */
#review-section::-webkit-scrollbar        { width: 6px; }
#review-section::-webkit-scrollbar-track  { background: #f1f8e9; border-radius: 10px; }
#review-section::-webkit-scrollbar-thumb  { background: #81c784; border-radius: 10px; }
#review-section::-webkit-scrollbar-thumb:hover { background: #4caf50; }

#review-section h5 {
    font-size: 0.9rem;
    color: #2e7d32;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin-bottom: 0.6rem;
}

/* Each wrong-answer card */
#wrong-answers-list .list-group-item {
    background: white;
    border: 1px solid #e8f5e9;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
    line-height: 1.5;
    box-shadow: 0 1px 4px rgba(56, 142, 60, 0.07);
    transition: box-shadow 0.2s;
}
#wrong-answers-list .list-group-item:hover {
    box-shadow: 0 2px 8px rgba(56, 142, 60, 0.15);
}
#wrong-answers-list .list-group-item:last-child {
    margin-bottom: 0;
}