/* Koran: study glossary.
   Lapis and gold come from illuminated Quran manuscripts; the ۞ (rub el hizb)
   marks sections the way it marks divisions in the mushaf. */

:root,
[data-bs-theme="light"] {
    --k-paper: #f4f6f5;
    --k-surface: #ffffff;
    --k-ink: #16233b;
    --k-muted: #5b6577;
    --k-rule: #dde2e3;
    --k-lapis: #2a4d9b;
    --k-lapis-soft: #e6ecf8;
    --k-gold: #a87b1f;
    --k-gold-soft: #f6efdf;
    --k-mark: #fff1c2;
    --k-ok: #1f7a4d;
    --k-ok-soft: #e3f3ea;
    --k-bad: #b4372f;
    --k-bad-soft: #fbe9e7;

    --k-serif: "Literata", Georgia, serif;
    --k-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m4 10.5 4 4 8-9' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --k-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m5 5 10 10M15 5 5 15' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
    --k-sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --k-star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M5 5h14v14H5z M12 2.1 21.9 12 12 21.9 2.1 12z M12 8.6a3.4 3.4 0 1 0 0 6.8a3.4 3.4 0 1 0 0-6.8z'/%3E%3C/svg%3E");

    --bs-body-bg: var(--k-paper);
    --bs-body-color: var(--k-ink);
    --bs-body-font-family: var(--k-sans);
    --bs-link-color-rgb: 42, 77, 155;
    --bs-focus-ring-color: rgba(42, 77, 155, .35);
}

[data-bs-theme="dark"] {
    --k-paper: #0f1726;
    --k-surface: #162036;
    --k-ink: #e7ebf2;
    --k-muted: #9aa5b8;
    --k-rule: #263250;
    --k-lapis: #93b0f0;
    --k-lapis-soft: #1d2b4b;
    --k-gold: #d8ad55;
    --k-gold-soft: #33291a;
    --k-mark: #5a4614;
    --k-ok: #5fc596;
    --k-ok-soft: #173a2e;
    --k-bad: #f0877e;
    --k-bad-soft: #43201f;

    --bs-body-bg: var(--k-paper);
    --bs-body-color: var(--k-ink);
    --bs-link-color-rgb: 147, 176, 240;
    --bs-focus-ring-color: rgba(147, 176, 240, .4);
}

html { scroll-padding-top: 9rem; }

@media (min-width: 992px) {
    html { scroll-padding-top: 7.5rem; }
}

body {
    background-color: var(--k-paper);
    color: var(--k-ink);
    font-size: 1rem;
    line-height: 1.55;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

:focus-visible {
    outline: 2px solid var(--k-lapis);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    z-index: 1100;
    top: .5rem;
    left: .5rem;
    padding: .5rem .75rem;
    background: var(--k-surface);
    border-radius: .375rem;
}

/* Eight-point star (rub el hizb), drawn as a mask so it takes the gold colour. */
.star {
    display: inline-block;
    width: .8em;
    height: .8em;
    flex: none;
    background-color: var(--k-gold);
    -webkit-mask: var(--k-star) center / contain no-repeat;
    mask: var(--k-star) center / contain no-repeat;
}

/* Header */

.site-header {
    background: var(--k-surface);
    border-bottom: 1px solid var(--k-rule);
}

.site-header .container-fluid { min-height: 3.5rem; }

.brand {
    font-family: var(--k-serif);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--k-ink);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}

.brand-mark { width: 1.05rem; height: 1.05rem; }

.site-link {
    color: var(--k-muted);
    text-decoration: none;
    font-weight: 500;
    padding: 1.05rem 0;
    border-bottom: 2px solid transparent;
}

.site-link.active { color: var(--k-ink); border-bottom-color: var(--k-lapis); }

/* Intro */

.intro { padding: 3rem 0 2rem; max-width: 46rem; }

.intro h1 {
    font-family: var(--k-serif);
    font-weight: 500;
    font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.5rem);
    line-height: 1.08;
    letter-spacing: -.015em;
    font-variation-settings: "opsz" 72;
    margin-bottom: 1rem;
}

.lead-text {
    font-size: 1.125rem;
    color: var(--k-muted);
    max-width: 38rem;
    margin: 0;
}

/* Two-column layout */

.layout { display: block; padding-bottom: 4rem; }

@media (min-width: 992px) {
    .layout {
        display: grid;
        grid-template-columns: 15.5rem minmax(0, 1fr);
        gap: 3.5rem;
    }
}

.sidebar nav { position: sticky; top: 1.5rem; }

.sidebar-heading {
    font-size: .875rem;
    font-weight: 600;
    color: var(--k-muted);
    margin-bottom: .5rem;
}

.cat-list { list-style: none; padding: 0; margin: 0; }

.cat-link {
    display: grid;
    grid-template-columns: 1.1rem 1fr auto;
    align-items: baseline;
    gap: .5rem;
    padding: .45rem .6rem;
    margin-left: -.6rem;
    border-radius: .375rem;
    color: var(--k-muted);
    text-decoration: none;
    font-size: .925rem;
    line-height: 1.35;
}

.cat-link:hover { color: var(--k-ink); background: var(--k-lapis-soft); }

.cat-mark { width: .75rem; height: .75rem; align-self: center; opacity: 0; transition: opacity .2s ease; }

.cat-count { font-size: .8rem; font-variant-numeric: tabular-nums; }

.cat-link.active { color: var(--k-ink); font-weight: 600; }
.cat-link.active .cat-mark { opacity: 1; }

.cat-link.is-empty { opacity: .4; }

/* Toolbar: search, count, mobile chips */

.toolbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--k-paper);
    padding: .75rem 0 .5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--k-rule);
}

.search { position: relative; max-width: 40rem; }

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    width: 1.1rem;
    height: 1.1rem;
    transform: translateY(-50%);
    color: var(--k-muted);
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 3.1rem;
    padding: 0 3rem 0 2.75rem;
    font: inherit;
    font-size: 1.05rem;
    color: var(--k-ink);
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .625rem;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.search-input::placeholder { color: var(--k-muted); opacity: .85; }

.search-input:focus {
    outline: none;
    border-color: var(--k-lapis);
    box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
}

.search-key {
    position: absolute;
    right: .8rem;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--k-sans);
    font-size: .8rem;
    color: var(--k-muted);
    background: var(--k-paper);
    border: 1px solid var(--k-rule);
    border-radius: .3rem;
    padding: .05rem .45rem;
}

.search-input:focus ~ .search-key,
.search-input:not(:placeholder-shown) ~ .search-key { display: none !important; }

.result-count {
    font-size: .875rem;
    color: var(--k-muted);
    margin: .5rem 0 0;
    font-variant-numeric: tabular-nums;
}

.chips {
    display: flex;
    gap: .5rem;
    overflow-x: auto;
    margin: .6rem -1rem 0;
    padding: 0 1rem .25rem;
    scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
    flex: none;
    font-size: .85rem;
    padding: .35rem .8rem;
    border-radius: 999px;
    border: 1px solid var(--k-rule);
    background: var(--k-surface);
    color: var(--k-ink);
    text-decoration: none;
    white-space: nowrap;
}

.chip.is-empty { display: none; }

/* Sections and entries */

.term-section { margin-bottom: 3.5rem; }

.section-title {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    font-family: var(--k-serif);
    font-weight: 500;
    font-size: clamp(1.4rem, 1.2rem + .8vw, 1.85rem);
    line-height: 1.2;
    margin: 0 0 .4rem;
}

.section-mark { width: .7em; height: .7em; align-self: center; }

.section-count {
    font-family: var(--k-sans);
    font-size: .875rem;
    font-weight: 500;
    color: var(--k-muted);
    font-variant-numeric: tabular-nums;
}

.section-note {
    color: var(--k-muted);
    max-width: 38rem;
    margin: 0 0 .5rem 1.3em;
}

.entries {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    column-gap: 2.5rem;
    margin: 1.25rem 0 0;
}

.entry {
    padding: 1rem 0 1.1rem;
    border-top: 1px solid var(--k-rule);
}

.entry dt {
    font-family: var(--k-serif);
    font-weight: 600;
    font-size: 1.15rem;
    line-height: 1.3;
    margin-bottom: .3rem;
}

.entry dd {
    color: var(--k-muted);
    margin: 0;
    max-width: 34rem;
}

mark {
    padding: 0 .1em;
    border-radius: .2em;
    background: var(--k-mark);
    color: inherit;
}

/* Empty state */

.empty { padding: 2rem 0 4rem; max-width: 34rem; }

.empty-title {
    font-family: var(--k-serif);
    font-size: 1.35rem;
    font-weight: 500;
    margin-bottom: .4rem;
    overflow-wrap: anywhere;
}

.empty-text { color: var(--k-muted); margin-bottom: 1.25rem; }

.btn-clear {
    font: inherit;
    font-weight: 500;
    color: var(--k-surface);
    background: var(--k-lapis);
    border: 0;
    border-radius: .5rem;
    padding: .55rem 1.1rem;
}

[data-bs-theme="dark"] .btn-clear { color: var(--k-paper); }

/* Footer */

.site-footer {
    border-top: 1px solid var(--k-rule);
    padding: 1.25rem 0;
    font-size: .875rem;
    color: var(--k-muted);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto !important; }
    *, *::before, *::after { transition: none !important; }
}

/* Header navbar (Bootstrap): links in a row from md up, a hamburger menu below that */

.site-navbar { padding: 0; }

.site-navbar > .container-fluid { column-gap: 1.5rem; flex-wrap: wrap; }

.site-navbar .brand { margin-right: 0; padding: 0; }

.site-toggler {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    margin-left: -.5rem;
    border: 0;
    border-radius: .5rem;
    color: var(--k-ink);
}
.site-toggler:focus { box-shadow: 0 0 0 .2rem var(--k-lapis-soft); }
.site-toggler:hover { background: var(--k-lapis-soft); }
.site-toggler-icon { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.site-nav { gap: 1.5rem; }

/* Header: account links on the right */

.site-account { display: flex; gap: 1.5rem; margin-left: auto; align-items: center; min-width: 0; }

.site-account form { display: contents; }

.site-button { font: inherit; font-weight: 500; background: none; border: 0; border-bottom: 2px solid transparent; }

.site-link:hover { color: var(--k-ink); }

/* Signed-in account menu (Bootstrap dropdown) */

.site-account-toggle { display: inline-flex; align-items: center; gap: .45rem; min-width: 0; }
.site-account-toggle::after { margin-left: .1rem; }
.site-account-icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.site-account-label { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem; }

.site-account-dropdown {
    --bs-dropdown-bg: var(--k-surface);
    --bs-dropdown-border-color: var(--k-rule);
    --bs-dropdown-link-color: var(--k-ink);
    --bs-dropdown-link-hover-bg: var(--k-lapis-soft);
    --bs-dropdown-link-hover-color: var(--k-ink);
    --bs-dropdown-link-active-bg: var(--k-lapis-soft);
    --bs-dropdown-link-active-color: var(--k-ink);
    --bs-dropdown-header-color: var(--k-muted);
    min-width: 13rem;
    max-width: calc(100vw - 2rem);
    margin-top: -.35rem !important;
}
.site-account-dropdown .dropdown-item { font-weight: 500; padding-block: .5rem; }
.site-account-dropdown .dropdown-item.active { font-weight: 600; }
.site-account-dropdown form { display: block; }

.site-email { display: block; color: var(--k-ink); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Phones and small tablets: the menu opens below the top row as a full-width list. */
@media (max-width: 767.98px) {
    .site-navbar > .container-fluid { column-gap: .75rem; }
    .site-account { gap: 1.1rem; }
    .site-nav { gap: 0; padding: .25rem 0 .75rem; border-top: 1px solid var(--k-rule); }
    .site-nav .site-link {
        display: block;
        padding: .7rem .75rem;
        border-bottom: 0;
        border-left: 3px solid transparent;
        border-radius: 0 .375rem .375rem 0;
    }
    .site-nav .site-link:hover { background: var(--k-lapis-soft); }
    .site-nav .site-link.active { border-left-color: var(--k-lapis); background: var(--k-lapis-soft); }
}

/* Account pages: register, sign in, profile */

.account { max-width: 28rem; margin-inline: auto; padding-bottom: 4rem; }

.account .intro { padding-bottom: 1.5rem; text-align: center; }

.account .profile-facts { text-align: center; }

.account-card {
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .75rem;
    padding: 1.5rem;
}

.account-card .form-label { font-weight: 500; margin-bottom: .3rem; }

.account-card .form-control {
    background: var(--k-paper);
    border-color: var(--k-rule);
    color: var(--k-ink);
    min-height: 2.9rem;
    border-radius: .5rem;
}

.account-card .form-control:focus {
    border-color: var(--k-lapis);
    box-shadow: 0 0 0 3px var(--bs-focus-ring-color);
}

.account-card .form-control.is-invalid { border-color: var(--k-bad); }

.account-card .invalid-feedback { color: var(--k-bad); }

.account-card .form-text { color: var(--k-muted); }

.account-card .btn-quiz { width: 100%; }

.account-fieldset { border-top: 1px solid var(--k-rule); padding-top: 1.25rem; margin-top: 1.5rem; }

.account-fieldset legend { font-size: 1rem; font-weight: 600; float: none; margin-bottom: .25rem; }

.account-note {
    border-radius: .5rem;
    padding: .7rem .9rem;
    margin-bottom: 1.25rem;
    background: var(--k-lapis-soft);
    color: var(--k-ink);
}

.account-note.is-ok { background: var(--k-ok-soft); }
.account-note.is-bad { background: var(--k-bad-soft); }

.account-alt { color: var(--k-muted); margin: 1.25rem 0 0; text-align: center; }

.profile-facts { margin: 0 0 1.5rem; }
.profile-facts dt { font-size: .875rem; font-weight: 600; color: var(--k-muted); }
.profile-facts dd { font-family: var(--k-serif); font-size: 1.15rem; margin: 0; overflow-wrap: anywhere; }

/* Home, course, section and Exams pages: panels, topic cards, quiz lists */

.list-page { max-width: 52rem; margin-inline: auto; padding-bottom: 3rem; }

.list-page .intro { padding-bottom: 1.5rem; }

.panel {
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .875rem;
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.panel-title { font-size: 1.05rem; font-weight: 600; margin: 0; }
.panel-figure { font-size: 1.1rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.panel-text { color: var(--k-muted); font-size: .925rem; margin: .6rem 0 0; }
.panel-actions { display: flex; justify-content: flex-end; margin-top: .9rem; }

/* Thin progress bar */
.meter { height: 6px; border-radius: 999px; background: var(--k-rule); overflow: hidden; margin-top: .5rem; }
.meter-fill { height: 100%; background: var(--k-lapis); border-radius: inherit; }

/* Small rounded label: "In progress", "Resume" */
.pill {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex: none;
    padding: .15rem .65rem;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--k-lapis-soft);
    color: var(--k-lapis);
    font-variant-numeric: tabular-nums;
}

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.list-head { margin: 2rem 0 .75rem; }
.list-title { font-size: 1.15rem; font-weight: 600; margin: 0; }
.list-count { color: var(--k-muted); font-size: .875rem; font-variant-numeric: tabular-nums; }

.chevron { width: 1.15rem; height: 1.15rem; flex: none; color: var(--k-muted); }

.resume-name { font-family: var(--k-serif); font-size: 1.2rem; font-weight: 500; margin: 0; }

.sub-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }

/* Topic card (course page) and topic panel (section page) */
.topic-card {
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .875rem;
    margin-bottom: .9rem;
}

.topic-summary { display: block; list-style: none; padding: 1rem 1.25rem; cursor: pointer; border-radius: inherit; }
.topic-summary::-webkit-details-marker { display: none; }
.topic-summary:hover .topic-name { color: var(--k-lapis); }
.topic-summary:focus-visible { outline: 0; box-shadow: 0 0 0 .2rem var(--k-lapis-soft); }

.topic-head { display: flex; align-items: center; gap: .85rem; }
.topic-icon { width: 1.35rem; height: 1.35rem; flex: none; color: var(--k-gold); }
.topic-heading { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.topic-name { font-size: 1.1rem; font-weight: 600; line-height: 1.3; margin: 0; overflow-wrap: anywhere; }
h1.topic-name { font-family: var(--k-serif); font-weight: 500; font-size: clamp(1.5rem, 1.3rem + .8vw, 1.9rem); }
.topic-meta { color: var(--k-muted); font-size: .9rem; }
.topic-chevron { transition: transform .2s ease; }
.topic-card[open] .topic-chevron { transform: rotate(180deg); }

.topic-progress {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .75rem;
    color: var(--k-muted);
    font-size: .9rem;
    font-variant-numeric: tabular-nums;
}

.topic-body { border-top: 1px solid var(--k-rule); padding: .9rem 1.25rem 1.1rem; }
.topic-panel .topic-body { margin-top: 1.1rem; padding: .9rem 0 0; }
.topic-description { color: var(--k-muted); margin: 0 0 .5rem; }
.topic-panel .topic-description { margin: .9rem 0 0; }

.sub-title { font-size: 1rem; font-weight: 600; margin: .5rem 0 .6rem; }

.topic-open { display: inline-block; margin-top: .9rem; font-weight: 600; font-size: .925rem; text-decoration: none; color: var(--k-lapis); }
.topic-open:hover { text-decoration: underline; }

/* Subtopics: rows linking to their section page */
.unit-list { list-style: none; padding: 0; margin: 0 0 .75rem; }

.unit-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem .25rem;
    color: var(--k-ink);
    text-decoration: none;
    border-radius: .5rem;
}

.unit-list li + li .unit-row { border-top: 1px solid var(--k-rule); border-radius: 0; }
.unit-row:hover { color: var(--k-ink); }
.unit-row:hover .unit-title { color: var(--k-lapis); }
.unit-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.unit-title { font-weight: 600; }
.unit-meta { color: var(--k-muted); font-size: .875rem; }

/* Quiz list */
.quiz-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }

.quiz-row {
    display: flex;
    align-items: center;
    gap: .9rem;
    padding: .7rem .9rem .7rem .7rem;
    border-radius: .7rem;
    background: var(--k-paper);
    border: 1px solid transparent;
    color: var(--k-ink);
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease;
}

.quiz-row:hover { color: var(--k-ink); border-color: var(--k-lapis); }

.quiz-row-number {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: .5rem;
    background: var(--k-surface);
    font-weight: 600;
    font-size: 1.05rem;
    font-variant-numeric: tabular-nums lining-nums;
}

.quiz-row-body { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.quiz-row-title { font-weight: 600; overflow-wrap: anywhere; }
.quiz-row-meta { color: var(--k-muted); font-size: .875rem; }
.quiz-row-done { width: 1.3rem; height: 1.3rem; flex: none; color: var(--k-ok); }

/* Exams: rows sit on the page background, so give them the surface colour. */
#exams .quiz-row, #quizzes .quiz-row { background: var(--k-surface); border-color: var(--k-rule); }
#exams .quiz-row:hover, #quizzes .quiz-row:hover { border-color: var(--k-lapis); }
#exams .quiz-row-number, #quizzes .quiz-row-number { background: var(--k-paper); }

/* Breadcrumb on the course and section pages */
.crumbs ol { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 1.75rem 0 1rem; margin: 0; font-size: .9rem; color: var(--k-muted); }
.crumbs li + li::before { content: "›"; margin-right: .35rem; }
.crumbs a { color: var(--k-muted); text-decoration: none; }
.crumbs a:hover { color: var(--k-ink); text-decoration: underline; }
.crumbs [aria-current] { color: var(--k-ink); }

.sign-in-note .panel-text { margin-top: .3rem; }

/* Home page ("My learning"): stat tiles, continue learning, course cards */

.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }

@media (min-width: 768px) {
    .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.stat {
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .875rem;
    padding: .9rem 1rem 1rem;
}

.stat-label { color: var(--k-muted); font-size: .85rem; margin: 0 0 .2rem; }
.stat-value { font-size: 1.6rem; font-weight: 600; line-height: 1.2; margin: 0; font-variant-numeric: tabular-nums lining-nums; }

.course-head { display: flex; align-items: center; gap: .85rem; }
.resume-card .course-head { margin: .85rem 0 .35rem; }
.resume-card .panel-actions { margin-top: .75rem; }

.course-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .6rem;
    background: var(--k-gold-soft);
    color: var(--k-gold);
}

.course-icon svg { width: 1.3rem; height: 1.3rem; }
.course-icon-lapis { background: var(--k-lapis-soft); color: var(--k-lapis); }

.course-heading { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.course-name { font-size: 1.1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.course-meta { color: var(--k-muted); font-size: .875rem; overflow-wrap: anywhere; }

.resume-link { font-weight: 600; font-size: .95rem; text-decoration: none; color: var(--k-lapis); }
.resume-link:hover { text-decoration: underline; }

.course-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }

.course-card {
    display: block;
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .875rem;
    padding: 1rem 1.25rem 1.15rem;
    color: var(--k-ink);
    text-decoration: none;
    transition: border-color .15s ease;
}

.course-card:hover { color: var(--k-ink); border-color: var(--k-lapis); }
.course-card:hover .course-name { color: var(--k-lapis); }

.course-progress {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: .7rem;
    color: var(--k-muted);
    font-size: .875rem;
    font-variant-numeric: tabular-nums;
}

.course-card .meter { margin-top: .6rem; }

/* Quiz page */

/* The signed-in user's saved attempt, above the player */
.attempt-status {
    display: flex;
    align-items: baseline;
    gap: .6rem;
    margin: 0 0 1.25rem;
    padding: .7rem 1rem;
    border: 1px solid var(--k-rule);
    border-radius: .6rem;
    background: var(--k-surface);
    color: var(--k-muted);
    font-size: .925rem;
}

.attempt-text { margin: 0; }
.attempt-text strong { color: var(--k-ink); font-weight: 600; }

.attempt-dot {
    flex: none;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    background: var(--k-rule);
    transform: translateY(-.05rem);
}

.attempt-status[data-status="IN_PROGRESS"] .attempt-dot { background: var(--k-gold); }
.attempt-status[data-status="FINISHED"] .attempt-dot { background: var(--k-ok); }

.quiz-page { max-width: 44rem; margin-inline: auto; padding: 1.5rem 0 4rem; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-left: -.25rem;
    color: var(--k-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: .925rem;
}

.back-link svg { width: 1.1rem; height: 1.1rem; }
.back-link:hover { color: var(--k-ink); }

.quiz-progress { margin-bottom: 1rem; }

.quiz-step {
    font-size: .875rem;
    font-weight: 500;
    color: var(--k-muted);
    margin: 0 0 .5rem;
    font-variant-numeric: tabular-nums;
}

.progress-track { height: 4px; border-radius: 999px; background: var(--k-rule); overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--k-gold); border-radius: inherit; transition: width .35s ease; }

.quiz-card-panel {
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .875rem;
    padding: 1.5rem 1.25rem;
}

@media (min-width: 576px) {
    .quiz-card-panel { padding: 2rem; }
}

.slide.is-entering { animation: slide-in .3s ease both; }

@keyframes slide-in {
    from { opacity: 0; transform: translateX(1.25rem); }
    to { opacity: 1; transform: none; }
}

.question-text {
    font-family: var(--k-serif);
    font-size: clamp(1.3rem, 1.15rem + .6vw, 1.6rem);
    margin-bottom: .35rem;
}

/* Question text is rich HTML from the editor (paragraphs, lists, images, tables). */
.question-text > :last-child { margin-bottom: 0; }
.question-text p { margin-bottom: .5em; }
.question-text :is(h1, h2, h3, h4, h5, h6) { font-size: 1em; font-weight: 600; }
.question-text img { max-width: 100%; height: auto; }
.question-text table { width: 100%; font-size: 1rem; margin-bottom: .5em; }
.question-text :is(td, th) { border: 1px solid var(--bs-border-color); padding: .25rem .5rem; }

/* Gap between the question (or part) text and its inputs. */
.answers, .written { margin-top: 2.95rem; }

.answers { display: grid; gap: .6rem; }

/* Parts of a MULTIANSWER question: smaller sub-questions under the main question text. */
.parts { padding-left: 1.5rem; margin: 1.25rem 0 0; }
/* Every slide answers through .part elements; only MULTIANSWER parts sit in a numbered .parts list. */
.parts > .part + .part { margin-top: 1.5rem; }
.parts > .part { padding-top: 1.25rem; border-top: 1px solid var(--k-rule); }
.parts > .part::marker { color: var(--k-muted); font-family: var(--k-serif); font-size: 1.1rem; }
.parts > .part .part-text { font-size: 1.1rem; }
.part-feedback { font-size: .875rem; color: var(--k-muted); margin: .6rem 0 0; }

.answer {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .8rem;
    padding: .8rem 1rem;
    border: 1px solid var(--k-rule);
    border-radius: .625rem;
    background: var(--k-paper);
    cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}

.answer input { position: absolute; opacity: 0; pointer-events: none; }

.answer-key {
    display: grid;
    place-items: center;
    width: 1.9rem;
    height: 1.9rem;
    border-radius: .4rem;
    border: 1px solid var(--k-rule);
    background: var(--k-surface);
    font-size: .85rem;
    font-weight: 600;
    color: var(--k-muted);
}

input[type="radio"] + .answer-key { border-radius: 50%; }

.answer:hover { border-color: var(--k-lapis); }

.answer:has(input:focus-visible) { outline: 2px solid var(--k-lapis); outline-offset: 2px; }

.answer:has(input:checked) { border-color: var(--k-lapis); background: var(--k-lapis-soft); }
.answer:has(input:checked) .answer-key { background: var(--k-lapis); border-color: var(--k-lapis); color: var(--k-surface); }

.answer:has(input:disabled) { cursor: default; }
.answer:has(input:disabled):not(.is-correct):not(.is-wrong) { opacity: .6; }

.answer-state { width: 1.1rem; height: 1.1rem; }

.answer.is-correct { border-color: var(--k-ok); background: var(--k-ok-soft); }
.answer.is-correct .answer-key { background: var(--k-ok); border-color: var(--k-ok); color: var(--k-surface); }
.answer.is-correct .answer-state { background: var(--k-ok); -webkit-mask: var(--k-tick) center / contain no-repeat; mask: var(--k-tick) center / contain no-repeat; }

.answer.is-wrong { border-color: var(--k-bad); background: var(--k-bad-soft); }
.answer.is-wrong .answer-key { background: var(--k-bad); border-color: var(--k-bad); color: var(--k-surface); }
.answer.is-wrong .answer-state { background: var(--k-bad); -webkit-mask: var(--k-cross) center / contain no-repeat; mask: var(--k-cross) center / contain no-repeat; }

.written-input {
    width: 100%;
    padding: .75rem 1rem;
    font: inherit;
    font-size: 1.05rem;
    color: var(--k-ink);
    background: var(--k-paper);
    border: 1px solid var(--k-rule);
    border-radius: .625rem;
    resize: vertical;
}

.written-input:focus { outline: none; border-color: var(--k-lapis); box-shadow: 0 0 0 3px var(--bs-focus-ring-color); }
.written-input.is-correct { border-color: var(--k-ok); background: var(--k-ok-soft); }
.written-input.is-wrong { border-color: var(--k-bad); background: var(--k-bad-soft); }

.feedback {
    margin-top: 1.25rem;
    padding: .8rem 1rem;
    border-left: 3px solid var(--k-rule);
    border-radius: 0 .5rem .5rem 0;
    background: var(--k-paper);
}

.feedback[data-state="correct"] { border-left-color: var(--k-ok); }
.feedback[data-state="wrong"] { border-left-color: var(--k-bad); }
.feedback[data-state="neutral"] { border-left-color: var(--k-gold); }

.feedback-title { font-weight: 600; margin: 0; }
.feedback-text { color: var(--k-muted); margin: .2rem 0 0; white-space: pre-line; }
.feedback-text:empty { display: none; }

.quiz-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

.btn-quiz {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 8rem;
    min-height: 2.9rem;
    padding: .6rem 1.4rem;
    font: inherit;
    font-weight: 600;
    color: var(--k-surface);
    background: var(--k-lapis);
    border: 1px solid var(--k-lapis);
    border-radius: .625rem;
    text-decoration: none;
    transition: opacity .15s ease, transform .15s ease;
}

.btn-quiz:hover { color: var(--k-surface); opacity: .92; }
.btn-quiz:active { transform: translateY(1px); }
.btn-quiz:disabled { opacity: .4; cursor: not-allowed; }

.btn-quiz-quiet { color: var(--k-ink); background: transparent; border-color: var(--k-rule); }
.btn-quiz-quiet:hover { color: var(--k-ink); border-color: var(--k-lapis); }

[data-bs-theme="dark"] .btn-quiz:not(.btn-quiz-quiet) { color: var(--k-paper); }

@media (max-width: 575.98px) {
    .quiz-actions .btn-quiz { flex: 1; }
}

.quiz-summary { text-align: center; padding-top: 2.5rem; padding-bottom: 2.5rem; }
.quiz-summary:focus { outline: none; }
.quiz-summary .quiz-actions { justify-content: center; }

.summary-mark { width: 2.25rem; height: 2.25rem; margin-bottom: .75rem; }

.summary-title {
    font-family: var(--k-serif);
    font-weight: 500;
    font-size: 1.85rem;
    margin-bottom: .25rem;
}

.summary-score { font-size: 1.15rem; font-weight: 600; color: var(--k-lapis); margin-bottom: .35rem; }
.summary-text { color: var(--k-muted); margin: 0 auto; max-width: 28rem; }

/* Exam mode: per-question timer */
.quiz-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }

.quiz-timer {
    font-size: .875rem;
    font-weight: 600;
    color: var(--k-muted);
    margin: 0 0 .5rem;
    font-variant-numeric: tabular-nums;
}

.quiz-timer.is-low { color: var(--k-bad); }

.timer-track { height: 2px; margin-top: .35rem; border-radius: 999px; background: var(--k-rule); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--k-lapis); border-radius: inherit; transition: width .2s linear; }
.timer-track.is-low .timer-fill { background: var(--k-bad); }

/* Exam mode: review after the summary */
.review-filters { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.5rem; }

.review-filter {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .45rem .9rem;
    font: inherit;
    font-size: .925rem;
    font-weight: 500;
    color: var(--k-ink);
    background: var(--k-paper);
    border: 1px solid var(--k-rule);
    border-radius: 999px;
}

.review-filter:hover:not(:disabled) { border-color: var(--k-lapis); }
.review-filter:disabled { opacity: .45; cursor: not-allowed; }
.review-filter[aria-pressed="true"] { border-color: var(--k-lapis); background: var(--k-lapis-soft); }
.review-filter[data-status="correct"] .review-count { color: var(--k-ok); }
.review-filter[data-status="wrong"] .review-count { color: var(--k-bad); }
.review-filter[data-status="unanswered"] .review-count { color: var(--k-gold); }
.review-count { font-weight: 700; font-variant-numeric: tabular-nums; }

.quiz-review { display: grid; gap: 1rem; margin-top: 1rem; }
.quiz-review[hidden] { display: none; }

.quiz-review .slide {
    background: var(--k-surface);
    border: 1px solid var(--k-rule);
    border-radius: .875rem;
    padding: 1.5rem 1.25rem;
}

@media (min-width: 576px) {
    .quiz-review .slide { padding: 2rem; }
}

.slide-number { display: none; }

.quiz-review .slide-number {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--k-muted);
    margin: 0 0 .5rem;
}

@media (prefers-reduced-motion: reduce) {
    .timer-fill { transition: none; }
    .slide.is-entering { animation: none; }
    .topic-chevron { transition: none; }
}
