/* Annotation: Root CSS variables — bright, playful palette for kids, high contrast */
:root {
    --sky: #dff3ff;
    --sky-deep: #1a3a6b;
    --sun: #ffd166;
    --sun-dark: #e0a800;
    --grass: #2ea043;
    --coral: #ef476f;
    --white: #ffffff;
    --text: #1f2a44;
    --text-light: #5a6b8c;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 4px 14px rgba(26, 58, 107, 0.15);
    --transition: 0.2s ease;
    --d1: #ffe08a;
    --d2: #a9d8ff;
    --d3: #a8e6a1;
    --d4: #ffc8a2;
    --d5: #8fd6f0;
    --d6: #f4b48a;
    --d7: #d9c6f5;
    --dman: #d6d6d6;
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Nunito', 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, var(--sky) 0%, #ffffff 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

/* Annotation: Top bar with title and language toggle */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}
.topbar .brand {
    font-weight: 800;
    color: var(--sky-deep);
    font-size: 1.05rem;
    text-decoration: none;
}
.lang-toggle { display: flex; gap: 6px; }
.lang-toggle button {
    border: 2px solid var(--sky-deep);
    background: var(--white);
    color: var(--sky-deep);
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    cursor: pointer;
}
.lang-toggle button.active { background: var(--sky-deep); color: var(--white); }

/* Annotation: Main content container */
main {
    flex: 1;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 8px 16px 32px;
}

h1 { font-size: 2rem; color: var(--sky-deep); text-align: center; line-height: 1.15; }
h2 { font-size: 1.4rem; color: var(--sky-deep); text-align: center; margin-bottom: 12px; }
.subtitle { text-align: center; color: var(--text-light); font-size: 1.1rem; margin-top: 6px; }
.intro { text-align: center; font-size: 1.05rem; line-height: 1.5; margin: 20px 0; }

.hero { display: flex; justify-content: center; gap: 10px; margin: 16px 0 8px; }
.hero img { width: 64px; height: 64px; border-radius: 16px; box-shadow: var(--shadow); object-fit: cover; }

/* Annotation: Primary/secondary buttons */
.btn {
    display: block;
    width: 100%;
    border: none;
    border-radius: var(--radius);
    padding: 16px;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: var(--shadow);
    margin-top: 12px;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--sun); color: var(--sky-deep); }
.btn-secondary { background: var(--white); color: var(--sky-deep); border: 2px solid var(--sky-deep); }
.btn-ghost { background: transparent; color: var(--text-light); box-shadow: none; font-size: 0.95rem; padding: 10px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* Annotation: Card used for review, results and question panels */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    margin-top: 12px;
}

/* Annotation: Day list on review page and result poster */
.day-list { display: grid; gap: 10px; margin-top: 12px; }
.day-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--white);
    box-shadow: var(--shadow);
}
.day-row .icon { width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0; object-fit: cover; }
.day-row .label { font-weight: 800; color: var(--sky-deep); }
.day-row .desc { color: var(--text-light); font-size: 0.95rem; }

/* Annotation: Progress bar */
.progress-wrap { margin: 4px 0 12px; }
.progress-text { display: flex; justify-content: space-between; font-weight: 700; color: var(--text-light); font-size: 0.95rem; margin-bottom: 6px; }
.progress-bar { height: 10px; background: #e6eef8; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--grass); width: 0; transition: width 0.3s ease; border-radius: 999px; }

/* Annotation: Question display */
.question-card { text-align: center; padding: 16px; }
.question-img { width: 100%; max-width: 300px; aspect-ratio: 1; height: auto; border-radius: 24px; box-shadow: var(--shadow); object-fit: cover; background: #e6eef8; }
.question-name { font-size: 1.6rem; font-weight: 900; color: var(--sky-deep); margin-top: 10px; }

/* Annotation: Answer grid — 2 columns of big colored buttons */
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.answer-btn {
    border: 3px solid transparent;
    border-radius: var(--radius-sm);
    padding: 12px 8px;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: transform var(--transition), border-color var(--transition), opacity var(--transition);
    min-height: 58px;
    justify-content: center;
    font-size: 1.1rem;
}
.answer-btn:active { transform: scale(0.96); }
.answer-btn[data-key="1"] { background: var(--d1); }
.answer-btn[data-key="2"] { background: var(--d2); }
.answer-btn[data-key="3"] { background: var(--d3); }
.answer-btn[data-key="4"] { background: var(--d4); }
.answer-btn[data-key="5"] { background: var(--d5); }
.answer-btn[data-key="6"] { background: var(--d6); }
.answer-btn[data-key="7"] { background: var(--d7); }
.answer-btn[data-key="man"] { background: var(--dman); }
.answers.locked .answer-btn { pointer-events: none; opacity: 0.45; }
.answers.locked .answer-btn.is-correct { opacity: 1; border-color: var(--grass); box-shadow: 0 0 0 3px rgba(46, 160, 67, 0.3); }
.answers.locked .answer-btn.is-wrong { opacity: 1; border-color: var(--coral); box-shadow: 0 0 0 3px rgba(239, 71, 111, 0.3); }

/* Annotation: Feedback panel shown after answering */
.feedback { margin-top: 14px; padding: 14px; border-radius: var(--radius-sm); font-size: 1.05rem; line-height: 1.45; display: none; }
.feedback.show { display: block; animation: pop 0.25s ease; }
.feedback.ok { background: #e6f7ea; border: 2px solid var(--grass); }
.feedback.bad { background: #fde8ee; border: 2px solid var(--coral); }
.feedback .verdict { font-weight: 900; font-size: 1.2rem; display: block; margin-bottom: 4px; }
.feedback .verdict.ok { color: var(--grass); }
.feedback .verdict.bad { color: var(--coral); }
@keyframes pop { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Annotation: Result page */
.score-circle {
    width: 170px; height: 170px;
    border-radius: 50%;
    margin: 12px auto;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: conic-gradient(var(--grass) var(--pct, 0%), #e6eef8 0);
    position: relative;
}
.score-circle::before { content: ''; position: absolute; inset: 14px; background: var(--white); border-radius: 50%; }
.score-circle .pct { position: relative; font-size: 2.6rem; font-weight: 900; color: var(--sky-deep); line-height: 1; }
.score-circle .count { position: relative; font-size: 0.9rem; color: var(--text-light); font-weight: 700; margin-top: 4px; }
.score-message { text-align: center; font-size: 1.2rem; font-weight: 800; color: var(--sky-deep); margin: 8px 0 4px; }
.best-score { text-align: center; color: var(--text-light); font-size: 0.95rem; }

.mistake { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid #eef2f8; }
.mistake:last-child { border-bottom: none; }
.mistake .thumb { width: 56px; height: 56px; border-radius: 12px; flex-shrink: 0; object-fit: cover; }
.mistake .name { font-weight: 900; color: var(--sky-deep); }
.mistake .line { font-size: 0.95rem; margin-top: 2px; }
.mistake .chose { color: var(--coral); font-weight: 700; }
.mistake .right { color: var(--grass); font-weight: 700; }
.mistake .why { color: var(--text-light); font-size: 0.92rem; margin-top: 4px; line-height: 1.4; }

.footer-actions { margin-top: 20px; }

@media (min-width: 480px) {
    .answers { grid-template-columns: repeat(4, 1fr); }
    .answer-btn { font-size: 0.95rem; }
}

/* Annotation: Credits page and footer link */
.credits-link { text-align: center; margin-top: 24px; font-size: 0.85rem; }
.credits-link a { color: var(--text-light); }
.credit { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef2f8; font-size: 0.9rem; }
.credit img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.credit a { color: var(--sky-deep); }
.credit .lic { color: var(--text-light); }
