:root {
    --blue: #2549d8;
    --blue-ink: #0f2266;
    --coral: #ff6a4d;
    --ink: #1c2340;
    --muted: #5a6178;
    --line: #e4e7f2;
    --defbg: #eef2ff;
    --defborder: #2549d8;
    --methodbg: #eafaf1;
    --methodborder: #1f9d63;
    --realbg: #fff4ea;
    --realborder: #ff6a4d;
    --pitfallbg: #fdecec;
    --pitfallborder: #e0403f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Poppins", Helvetica, Arial, sans-serif;
    background: #eef0f7;
    color: var(--ink);
}

doc-page:not(:defined) {
    visibility: hidden;
}

.dl-btn {
    background: var(--coral);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.dl-btn:hover {
    background: #e5573c;
}

.fiche-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}

.level-badge {
    background: var(--lvl-color, var(--blue));
    color: white;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 100px;
}

.fiche-header .subject {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
}

h1.fiche-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--blue-ink);
    margin: 8px 0 28px;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.box {
    border-radius: 14px;
    padding: 20px 22px;
    margin-bottom: 18px;
    border: 2px solid;
}

.box-title {
    font-weight: 800;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.box p {
    margin: 0;
    font-size: 15.5px;
    line-height: 1.6;
}

.box.def {
    background: var(--defbg);
    border-color: var(--defborder);
}

.box.def .box-title {
    color: var(--defborder);
}

.box.method {
    background: var(--methodbg);
    border-color: var(--methodborder);
}

.box.method .box-title {
    color: var(--methodborder);
}

.box.real {
    background: var(--realbg);
    border-color: var(--realborder);
}

.box.real .box-title {
    color: var(--realborder);
}

.box.pitfall {
    background: var(--pitfallbg);
    border-color: var(--pitfallborder);
}

.box.pitfall .box-title {
    color: var(--pitfallborder);
}

.diagram-box {
    background: white;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.diagram-box svg {
    max-width: 320px;
    margin: 0 auto;
}

h2.section-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--blue);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 32px 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--blue);
}

ol.exercises {
    margin: 0;
    padding-left: 22px;
}

ol.exercises li {
    margin-bottom: 10px;
    font-size: 15px;
}

.corrections {
    background: #fff6f2;
    border-radius: 8px;
    padding: 16px 20px;
    margin-top: 8px;
}

.corrections summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--coral);
    font-size: 14px;
}

.corrections ol {
    margin: 12px 0 0;
    padding-left: 22px;
}

.corrections li {
    margin-bottom: 6px;
    font-size: 14.5px;
    color: var(--ink);
}

.quiz {
    margin-top: 10px;
}

.quiz-q {
    background: white;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 14px;
}

.quiz-q .q-text {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 12px;
}

.quiz-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-opt {
    text-align: left;
    background: #f4f6fc;
    border: 1.5px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14.5px;
    font-family: inherit;
    cursor: pointer;
    color: var(--ink);
}

.quiz-opt:hover {
    background: #e8ecfb;
}

.quiz-opt.correct {
    background: #eafaf1;
    border-color: #1f9d63;
    color: #0d7a45;
    font-weight: 700;
}

.quiz-opt.wrong {
    background: #fdecec;
    border-color: #e0403f;
    color: #b3241f;
    font-weight: 700;
}

.quiz-opt[disabled] {
    cursor: default;
}

.fiche-footer {
    margin-top: 44px;
    padding: 28px 24px;
    background: var(--blue-ink);
    border-radius: 16px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.fiche-footer .ff-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fiche-footer .logo-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--coral);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.fiche-footer p {
    margin: 0;
    font-size: 14.5px;
    opacity: 0.9;
    max-width: 360px;
}

.fiche-footer .cta {
    background: var(--coral);
    color: white;
    padding: 12px 22px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    white-space: nowrap;
}

.fiche-footer .cta:hover {
    background: #e5573c;
}

@media print {
    .topbar {
        display: none;
    }

    body {
        background: white;
    }

    .quiz-opt {
        border: 1px solid #ccc;
    }
}

@media (max-width: 600px) {
    .fiche-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}
