/*
 * The student website (M4-04), in Maaman's vault («الخزنة»): the same ink
 * hero, gold accent and sand signal as the app, so a student meets one
 * product on both. The teacher shows as their name and logo, and the
 * product's name is not on it (PM-084); the teacher's colour is left to a
 * branded app of their own, as in the app.
 *
 * Plain CSS with no build step (PM-056), written with logical properties so
 * right to left and left to right share one sheet. Text the teacher wrote
 * sits in <bdi>: it keeps its own direction inside, and the page's alignment
 * outside, as the app shows it.
 */

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/plex-arabic/IBMPlexSansArabic-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-weight: 500;
    font-display: swap;
    src: url("../fonts/plex-arabic/IBMPlexSansArabic-Medium.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-weight: 600;
    font-display: swap;
    src: url("../fonts/plex-arabic/IBMPlexSansArabic-SemiBold.woff2") format("woff2");
}

@font-face {
    font-family: "IBM Plex Sans Arabic";
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/plex-arabic/IBMPlexSansArabic-Bold.woff2") format("woff2");
}

/* The brand book's two themes; the device's own setting picks. */

:root {
    color-scheme: light dark;

    /* The vault: its ink, its gold and its sand. */
    --vault-900: #0b0a07;
    --vault: #14120e;
    --vault-700: #221f18;
    --gold: #f5b83d;
    --gold-hover: #f8c866;
    --gold-deep: #8a5a00;
    --sand: #e9d6ae;

    --ground: #fbf6ea;
    --card: #ffffff;
    --ink: #14120e;
    --ink-soft: #4a4437;
    /* A shade under the brand book's #7a715e, which is 4.45:1 on the
       ground; this is 4.7:1. */
    --muted: #766d5a;
    --line: rgb(20 18 14 / 0.12);
    --line-soft: rgb(20 18 14 / 0.07);
    /* The gold is a fill, with ink on it, never white (1.8:1). As text, a
       link, an icon or a focus ring on a light ground it is the deep gold:
       the gold itself does not read there. */
    --accent: var(--gold);
    --accent-hover: var(--gold-hover);
    --on-accent: var(--vault);
    --accent-strong: var(--gold-deep);
    --link: var(--gold-deep);
    --accent-soft: #fbefd2;
    --accent-ink: #6b4600;
    --danger: #dc2626;
    --danger-soft: #fdf1f1;
    --success: #15803d;
    --success-soft: #edf9f1;
    --shadow: 0 1px 2px rgb(20 18 14 / 0.06), 0 14px 32px -18px rgb(20 18 14 / 0.28);

    /* The hero is dark in both themes. */
    --hero: var(--vault);
    --hero-ink: #f6efe0;
    --hero-muted: #b5a887;
    --glass: rgb(245 184 61 / 0.08);
    --glass-line: rgb(245 184 61 / 0.18);
    --hero-alarm: #fca5a5;

    --field: #ffffff;
    --field-line: rgb(20 18 14 / 0.16);

    --radius: 16px;
    --page: 960px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --ground: #0f0e0b;
        --card: #1a1813;
        --ink: #f3ede0;
        --ink-soft: #d3cab7;
        --muted: #a79f8c;
        --line: rgb(243 237 224 / 0.12);
        --line-soft: rgb(243 237 224 / 0.06);
        /* On a dark ground the gold reads as text too. */
        --accent-strong: var(--gold);
        --link: var(--gold);
        --accent-soft: #2e2614;
        --accent-ink: var(--gold-hover);
        --danger: #f87171;
        --danger-soft: #2a1d2e;
        --success: #4ade80;
        --success-soft: #0f2e2e;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 22px 46px -24px rgb(0 0 0 / 0.7);
        --hero: var(--vault-900);
        --field: #13110d;
        --field-line: rgb(243 237 224 / 0.18);
    }
}

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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--ground);
    color: var(--ink);
    font-family: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--link);
}

p {
    margin: 0;
}

h1,
h2 {
    line-height: 1.4;
}

.icon {
    width: 22px;
    height: 22px;
    flex: none;
}

/* The hero: ink, the cover's 28-pixel grid in faint gold, and a glow of the
   gold from the top corner. The top of every page. */

.hero {
    background-color: var(--hero);
    background-image:
        radial-gradient(ellipse 70% 120% at 5% -20%, rgb(245 184 61 / 0.18), transparent 70%),
        linear-gradient(rgb(245 184 61 / 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgb(245 184 61 / 0.06) 1px, transparent 1px);
    background-size: auto, 28px 28px, 28px 28px;
    color: var(--hero-ink);
}

.hero-inner {
    max-width: var(--page);
    margin-inline: auto;
    padding: 14px 20px 34px;
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}

.topbar .site-nav {
    margin-inline-start: auto;
}

.teacher {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--hero-ink);
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
}

/* The teacher's logo in a ring of sand, or their initial in gold on the
   vault's ink, as the tab's icon has it. */
.teacher-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border: 2px solid var(--sand);
    border-radius: 50%;
    background: var(--vault-700);
    color: var(--gold);
    font-weight: 700;
    font-size: 1.15rem;
    overflow: hidden;
}

.teacher-mark .logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.teacher-mark.is-large {
    width: 84px;
    height: 84px;
    border-width: 3px;
    font-size: 2.1rem;
}

.site-nav,
.languages {
    display: flex;
    align-items: center;
    gap: 6px;
}

.site-nav {
    flex-wrap: wrap;
}

.site-nav a,
.sign-out,
.languages > * {
    padding: 6px 14px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: none;
    color: var(--hero-muted);
    font: inherit;
    font-size: 0.925rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.site-nav a:hover,
.sign-out:hover,
.languages a:hover {
    color: var(--hero-ink);
    background: var(--glass);
}

.site-nav [aria-current="page"],
.languages [aria-current] {
    color: var(--hero-ink);
    background: var(--glass);
    border-color: var(--glass-line);
}

.languages {
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--glass-line);
    border-radius: 999px;
}

.languages > * {
    padding: 3px 11px;
    font-size: 0.85rem;
}

.sign-out-form {
    margin: 0;
}

/* Signing out: the words on a wide screen, the door alone on a phone, where
   the courses, the inbox and the languages need the line. */
.sign-out {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sign-out svg {
    width: 18px;
    height: 18px;
}

[dir="rtl"] .sign-out svg {
    transform: scaleX(-1);
}

@media (max-width: 599px) {
    .hero-inner {
        padding-inline: 16px;
    }

    .site-nav {
        gap: 4px;
    }

    .site-nav a,
    .sign-out {
        padding: 5px 10px;
    }

    /* The teacher and the way out on the first line, the rest on the
       second. */
    .topbar {
        row-gap: 10px;
    }

    .topbar .teacher {
        order: 1;
    }

    .topbar .sign-out-form {
        order: 2;
        margin-inline-start: auto;
    }

    .topbar .site-nav {
        order: 3;
        flex-basis: 100%;
        margin-inline-start: 0;
    }

    .languages > * {
        padding: 3px 8px;
    }

    .sign-out .label {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .site-main {
        padding-inline: 16px;
    }
}

/* The page's own title, on the hero. */

.hero-title {
    padding-block: 26px 0;
}

.hero-title h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4.5vw, 2.4rem);
    font-weight: 700;
    color: var(--hero-ink);
}

.hero-title .sub {
    margin-block-start: 4px;
    color: var(--hero-muted);
    font-size: 1.05rem;
}

.crumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-block-end: 10px;
    color: var(--hero-muted);
    font-size: 0.925rem;
    text-decoration: none;
}

.crumb:hover {
    color: var(--hero-ink);
}

.crumb svg {
    width: 18px;
    height: 18px;
}

[dir="rtl"] .crumb svg {
    transform: scaleX(-1);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-block-start: 12px;
    color: var(--hero-muted);
    font-size: 0.9rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--glass);
    color: var(--hero-ink);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Sand is the brand's signal, and only that: an open course. On the hero it
   is the sand; on the light tint of a course's status the sand would not
   show, so the dot takes the status's own colour. */
.chip.is-open::before,
.status.is-open::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sand);
}

.status.is-open::before {
    background: currentColor;
}

/* The sign-in, sign-up and delete pages: the teacher, large, and the form on
   a card that rises into the hero. */

.hero.is-centred .hero-inner {
    padding-block-end: 92px;
}

.hero.is-centred .hero-title {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding-block-start: 8px;
    text-align: center;
}

.hero.is-centred .hero-title h1 {
    margin-block-start: 8px;
    font-size: clamp(1.5rem, 4vw, 1.9rem);
}

/* The page. */

.site-main {
    flex: 1;
    width: 100%;
    max-width: var(--page);
    margin: 0 auto;
    padding: 28px 20px 56px;
}

.site-main > h2,
.section-title {
    margin: 0 0 14px;
    font-size: 1.25rem;
    font-weight: 700;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 28px 24px 22px;
}

.narrow {
    max-width: 460px;
    margin-inline: auto;
}

.rises {
    margin-block-start: -92px;
}

/* Somebody signed into the teacher's panel is told so above the form: the
   card stays under that notice rather than rising over it. */
.site-main > .notice + .rises {
    margin-block-start: 0;
}

.form {
    display: grid;
    gap: 16px;
    margin-block: 4px 12px;
}

.field label {
    display: block;
    margin-block-end: 6px;
    font-weight: 600;
    font-size: 0.95rem;
}

.field input {
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid var(--field-line);
    border-radius: var(--radius);
    background: var(--field);
    color: var(--ink);
    /* Sixteen pixels, or iOS zooms the page on focus. */
    font-size: 16px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
    outline: none;
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 4px rgb(245 184 61 / 0.3);
}

.field input[aria-invalid="true"] {
    border-color: var(--danger);
}

/* A phone number reads left to right, but sits where Arabic text would. */
[dir="rtl"] .field input[dir="ltr"] {
    text-align: right;
}

.error {
    margin-block-start: 6px;
    color: var(--danger);
    font-size: 0.9rem;
}

.button {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--on-accent);
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    text-align: center;
    line-height: 54px;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, filter 0.15s;
}

.button:hover {
    background: var(--accent-hover);
}

.button:focus-visible {
    outline: 3px solid var(--accent-strong);
    outline-offset: 2px;
}

.button.is-quiet {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.button.is-quiet:hover {
    background: var(--accent-soft);
    filter: brightness(0.97);
}

/* Deleting an account (M5-03): the one button that cannot be undone, the
   same red in both themes. */
.button.danger,
.button.danger:hover {
    background: #dc2626;
    color: #ffffff;
}

.button.danger:hover {
    filter: brightness(1.08);
}

.confirm {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.confirm input {
    width: 20px;
    height: 20px;
    accent-color: var(--danger);
}

.deletion-terms {
    display: grid;
    gap: 8px;
    margin: 14px 0 18px;
    padding-inline-start: 20px;
    color: var(--ink-soft);
}

.switch {
    margin-block-start: 6px;
    text-align: center;
    color: var(--muted);
}

.switch a {
    font-weight: 700;
    text-decoration: none;
}

.notice {
    margin-block-end: 18px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--ink);
}

/* Why something is closed: the accent's tint, not an alarm. A refusal the
   student can do nothing about on the spot uses the red one. */
.callout {
    margin-block-end: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    background: var(--accent-soft);
    color: var(--ink-soft);
}

.callout.is-alert {
    background: var(--danger-soft);
}

.callout-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-block-end: 2px;
    color: var(--ink);
    font-weight: 700;
}

.callout-title .icon {
    color: var(--link);
}

.callout.is-alert .callout-title,
.callout.is-alert .callout-title .icon {
    color: var(--danger);
}

.muted,
.empty {
    color: var(--muted);
}

.muted {
    font-size: 0.9rem;
}

.empty {
    padding: 36px 16px;
    text-align: center;
}

/* An icon on a rounded tile: tinted when it leads somewhere, grey when not. */
.badge {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: none;
    border-radius: 13px;
    background: var(--line-soft);
    color: var(--muted);
}

.badge.is-open {
    background: var(--accent-soft);
    color: var(--link);
}

.badge.is-large {
    width: 54px;
    height: 54px;
    border-radius: 15px;
}

.badge.is-large .icon {
    width: 26px;
    height: 26px;
}

.chevron {
    width: 20px;
    height: 20px;
    flex: none;
    margin-inline-start: auto;
    color: var(--muted);
}

[dir="rtl"] .chevron {
    transform: scaleX(-1);
}

/* The syllabus. */

.courses,
.lessons,
.file-list,
.inbox {
    list-style: none;
    margin: 0;
    padding: 0;
}

.courses {
    display: grid;
    gap: 14px;
}

@media (min-width: 720px) {
    .courses {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.course-card {
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.course-card:hover,
.course-card:focus-visible {
    border-color: var(--accent-strong);
    transform: translateY(-1px);
}

.course-text {
    display: grid;
    justify-items: start;
    gap: 8px;
}

.course-title {
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.5;
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 1px 11px;
    border-radius: 999px;
    background: var(--line-soft);
    color: var(--muted);
    font-size: 0.825rem;
    font-weight: 600;
}

.status.is-open {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.latest {
    display: flex;
    gap: 12px;
    margin-block-start: 22px;
    padding: 18px;
    border-radius: var(--radius);
    background: var(--accent-soft);
    color: var(--ink);
    text-decoration: none;
}

.latest .icon {
    color: var(--link);
}

.latest-label {
    color: var(--link);
    font-size: 0.8rem;
    font-weight: 700;
}

.latest-title {
    font-weight: 700;
}

.latest-body {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--ink-soft);
    font-size: 0.925rem;
}

/* Where the student left off (PM-077): above the courses, the video they
   watched last and did not finish, and how far into it they got. */
.resume {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-block-end: 22px;
    padding: 16px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--ink);
    text-decoration: none;
}

.resume-text {
    flex: 1;
    min-width: 0;
}

.resume-label {
    display: block;
    color: var(--link);
    font-size: 0.8rem;
    font-weight: 700;
}

.resume-title {
    display: block;
    font-weight: 700;
}

.resume-course {
    display: block;
    color: var(--muted);
    font-size: 0.875rem;
}

.resume-bar {
    display: block;
    height: 4px;
    margin-block-start: 10px;
    border-radius: 2px;
    background: var(--line-soft);
    overflow: hidden;
}

.resume-bar > span {
    display: block;
    height: 100%;
    background: var(--accent);
}

/* A lesson watched to the end. */
.badge.is-done {
    background: var(--success-soft);
    color: var(--success);
}

.lesson-done {
    color: var(--success);
    font-weight: 600;
}

/* One course. */

.description {
    margin-block-end: 8px;
    color: var(--ink-soft);
    white-space: pre-line;
}

.unit {
    margin-block-start: 26px;
}

.unit h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 700;
}

.unit-number {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    flex: none;
    border-radius: 9px;
    background: var(--accent);
    color: var(--on-accent);
    font-size: 0.9rem;
}

.lessons,
.file-list {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.lesson,
.file {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
}

.lesson + .lesson,
.file + .file {
    border-block-start: 1px solid var(--line-soft);
}

.lesson:has(a):hover,
.file:has(a):hover {
    background: var(--line-soft);
}

.lesson:not(:has(a)) {
    opacity: 0.6;
}

.lesson-text,
.file-text {
    display: grid;
}

.lesson-title,
.file-title {
    color: var(--ink);
    font-weight: 600;
}

/* The whole row opens the lesson, not only its title. */
a.lesson-title,
a.file-title {
    text-decoration: none;
}

a.lesson-title::after,
a.file-title::after {
    content: "";
    position: absolute;
    inset: 0;
}

a.lesson-title:focus-visible,
a.file-title:focus-visible {
    outline: none;
}

.lesson:has(a:focus-visible),
.file:has(a:focus-visible) {
    box-shadow: inset 0 0 0 2px var(--accent-strong);
}

.lesson .muted,
.file .muted {
    font-size: 0.825rem;
}

/* The inbox (M4-06). */

.inbox {
    display: grid;
    gap: 14px;
}

.announcement {
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.announcement-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-size: 0.85rem;
}

.announcement-meta > span {
    padding: 1px 11px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.announcement h2 {
    margin: 10px 0 2px;
    font-size: 1.1rem;
    font-weight: 700;
}

.announcement-body {
    color: var(--ink-soft);
    white-space: pre-line;
}

/* A lesson's player (M4-05). The watermark and the controls sit inside the
   element that goes full screen, so full screen keeps them. */

.player {
    position: relative;
    aspect-ratio: 16 / 9;
    margin-block: 0 8px;
    background: #000000;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    color: #ffffff;
}

.player:focus-visible {
    outline: 3px solid var(--accent-strong);
    outline-offset: 3px;
}

.player:fullscreen {
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
}

.player [hidden] {
    display: none !important;
}

.player video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000000;
}

.watermark {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-start: 50%;
    margin: 0;
    color: rgb(255 255 255 / 0.38);
    font-size: clamp(12px, 1.6vw, 20px);
    font-weight: 600;
    white-space: nowrap;
    text-shadow: 0 0 2px rgb(0 0 0 / 0.45);
    pointer-events: none;
    user-select: none;
    transition: left 1.2s ease-in-out, top 1.2s ease-in-out, translate 1.2s ease-in-out;
}

/* Over a file or a quiz (PM-099): pinned to the screen, not the page, so a
   screenshot of any part of a long PDF carries it. The page's own ink, faint,
   so it reads on either theme. */
.page-watermark {
    position: fixed;
    z-index: 40;
    color: color-mix(in srgb, var(--ink) 28%, transparent);
    text-shadow: 0 0 2px var(--ground);
}

/* The teacher's material does not print: there is no print button, and the
   browser's own makes a copy with nothing moving over it. */
@media print {
    [data-protected],
    .page-watermark {
        display: none !important;
    }
}

.big-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 76px;
    height: 76px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: var(--gold);
    color: var(--vault);
    box-shadow: 0 10px 30px rgb(0 0 0 / 0.45);
    cursor: pointer;
    transition: transform 0.15s;
}

.big-play:hover {
    transform: scale(1.06);
}

.big-play svg {
    width: 38px;
    height: 38px;
}

.controls {
    position: absolute;
    inset-inline: 0;
    inset-block-end: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 28px 14px 10px;
    background: linear-gradient(transparent, rgb(11 10 7 / 0.85));
}

.player:not(.is-ready) .controls,
.player.has-failed .controls,
.player.has-failed .resume-offer {
    visibility: hidden;
}

.controls button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: none;
    color: #ffffff;
    cursor: pointer;
}

.controls button:hover {
    background: rgb(255 255 255 / 0.12);
}

.controls svg {
    width: 22px;
    height: 22px;
}

.controls input[type="range"] {
    flex: 1;
    min-width: 0;
    accent-color: var(--gold);
}

.time {
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.player .when-playing,
.player.is-playing .when-paused,
.player .when-muted,
.player.is-muted .when-sounding {
    display: none;
}

.player.is-playing .when-playing,
.player.is-muted .when-muted {
    display: block;
}

.resume-offer {
    position: absolute;
    inset-block-start: 14px;
    inset-inline-start: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 6px 8px 6px 16px;
    border: 1px solid var(--glass-line);
    border-radius: 999px;
    background: rgb(20 18 14 / 0.9);
    font-size: 0.875rem;
}

[dir="rtl"] .resume-offer {
    padding: 6px 16px 6px 8px;
}

.resume-offer button {
    padding: 3px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--gold);
    color: var(--vault);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.player-message {
    position: absolute;
    inset: 0;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 14px;
    padding: 24px;
    background: rgb(11 10 7 / 0.92);
    text-align: center;
}

.player-message button,
.player-message a {
    padding: 8px 18px;
    border: 0;
    border-radius: 12px;
    background: var(--gold);
    color: var(--vault);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

/* The rest of a lesson (M4-06): its files and its quiz. */

.files {
    margin-block-start: 28px;
}

.files h2 {
    margin: 0 0 12px;
    font-size: 1.1rem;
    font-weight: 700;
}

.pdf {
    display: grid;
    gap: 14px;
    min-height: 200px;
}

.pdf canvas {
    display: block;
    width: 100%;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.pdf.has-failed {
    min-height: 0;
    color: var(--danger);
}

.file-image {
    display: block;
    max-width: 100%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    pointer-events: none;
    user-select: none;
}

.quiz {
    display: grid;
    gap: 14px;
}

.quiz-standing {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
}

.quiz-result {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 26px 20px 22px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.quiz-result::before {
    content: "";
    width: 60px;
    height: 60px;
    margin-block-end: 10px;
    border-radius: 50%;
    background: var(--accent-soft) no-repeat center / 30px
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a37012' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 17l6-6 4 4 8-8M14 7h7v7'/%3E%3C/svg%3E");
}

.quiz-result.is-passed::before {
    background-color: var(--success-soft);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2316a34a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 21h8M12 17v4M7 4h10v5a5 5 0 0 1-10 0V4ZM17 5h3v2a3 3 0 0 1-3 3M7 5H4v2a3 3 0 0 0 3 3'/%3E%3C/svg%3E");
}

.quiz-score {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.3;
}

.quiz-verdict {
    color: var(--link);
    font-weight: 700;
}

.quiz-result.is-passed .quiz-verdict {
    color: var(--success);
}

.question {
    margin: 0;
    padding: 16px 18px 12px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-width: 0;
}

.question legend {
    float: inline-start;
    width: 100%;
    padding: 0;
    font-size: 0.85rem;
}

.question legend::before {
    content: counter(question);
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    margin-inline-end: 8px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--link);
    font-weight: 700;
}

.quiz form,
.quiz {
    counter-reset: question;
}

.question {
    counter-increment: question;
}

.question-body {
    clear: both;
    padding-block: 10px;
    font-weight: 700;
    font-size: 1.05rem;
}

.option {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-block-end: 8px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.option:hover {
    border-color: var(--accent);
}

.option:has(input:checked) {
    border-color: var(--accent-strong);
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 1px var(--accent-strong);
    font-weight: 600;
}

.option input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent-strong);
}

/* Marked: the student's own choice, right or wrong, and nothing about which
   option would have been right. */
.question:disabled .option {
    cursor: default;
}

.question:disabled .option:not(:has(input:checked)) {
    color: var(--muted);
}

.question.is-right .option:has(input:checked) {
    border-color: var(--success);
    background: var(--success-soft);
    box-shadow: inset 0 0 0 1px var(--success);
}

.question.is-wrong .option:has(input:checked) {
    border-color: var(--danger);
    background: var(--danger-soft);
    box-shadow: inset 0 0 0 1px var(--danger);
}

.question.is-right .option input {
    accent-color: var(--success);
}

.question.is-wrong .option input {
    accent-color: var(--danger);
}

.mark {
    display: inline-flex;
    margin-block: 2px 4px;
    padding: 1px 12px;
    border-radius: 999px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.85rem;
    font-weight: 700;
}

.mark.is-right {
    background: var(--success-soft);
    color: var(--success);
}

/* Asking the teacher about a lesson (M8-02): a box to ask, then each of the
   student's questions with the replies under it. */

.asks {
    margin-block-start: 28px;
}

.asks h2 {
    margin: 0 0 4px;
    font-size: 1.1rem;
    font-weight: 700;
}

.field textarea {
    width: 100%;
    min-height: 110px;
    padding: 12px 16px;
    border: 1px solid var(--field-line);
    border-radius: var(--radius);
    background: var(--field);
    color: var(--ink);
    /* Sixteen pixels, or iOS zooms the page on focus. */
    font-size: 16px;
    font-family: inherit;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgb(37 99 235 / 0.16);
}

.field textarea[aria-invalid="true"] {
    border-color: var(--danger);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.ask {
    padding: 14px 18px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.ask-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}

.ask-state {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-ink);
    font-weight: 600;
}

.ask-state.is-answered {
    background: var(--success-soft);
    color: var(--success);
}

.ask-state.is-closed {
    background: var(--line-soft);
    color: var(--muted);
}

.ask-body,
.reply-body {
    margin: 8px 0 0;
    white-space: pre-line;
}

.ask-body {
    font-weight: 600;
}

.reply {
    margin-block-start: 12px;
    padding-inline-start: 12px;
    border-inline-start: 3px solid var(--accent);
}

.reply-author {
    margin: 0;
    color: var(--muted);
    font-size: 0.85rem;
}
