/* r4-learn: the course player on phones (its side panel as a sheet), quizzes and SCORM offline, the download's size. */
:root { --r4-scrim: rgba(17, 17, 31, .42); }
:root[data-theme="dark"] { --r4-scrim: rgba(0, 0, 0, .62); }

/* ---------- Phones: a bar with the way back and the course tools; the panel opens as a sheet ---------- */
.r4bar, .r4sheet__backdrop { display: none; }

@media (max-width: 900px) {
    .r4bar { display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 20; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
    .r4bar__back { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 12px; color: var(--ink); }
    .r4bar__back:hover, .r4bar__back:focus-visible { background: var(--surface-3); }
    .r4bar__title { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .r4bar__tools { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; }
    .r4bar__tools:hover { background: var(--surface-3); }
    .r4bar__tools[aria-expanded="true"] { background: var(--tint-brand); border-color: var(--tint-brand-line); color: var(--brand-ink); }
    .r4bar__tools:focus-visible, .r4bar__back:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

    .cplay__main { border-right: 0; }
    .cplay__maintop { padding-top: 14px; }
    .cplay__title { font-size: 21px; margin: 6px 0 14px; }
    .cplay__media { height: 190px; border-radius: 12px; margin-bottom: 18px; }
    .cplay__nav { flex-wrap: wrap; }
    .cplay__nav .btn { min-height: 44px; }

    .cplay__panel.cplay__panel--open {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1110;
        height: 86vh; height: 86dvh; background: var(--surface); color: var(--ink);
        border-radius: 18px 18px 0 0; box-shadow: var(--shadow); padding-bottom: env(safe-area-inset-bottom);
        animation: r4sheetIn .2s ease-out;
    }
    .cplay__panel--open:focus { outline: none; }
    .r4sheet__backdrop { display: block; position: fixed; inset: 0; z-index: 1105; background: var(--r4-scrim); }
    .cplay__panel--open .cplay__panelhead { align-items: flex-start; padding: 8px 8px 0 14px; border-bottom: 1px solid var(--line); }
    .cplay__panel--open .cplay__tabs { flex: 1; min-width: 0; flex-wrap: wrap; gap: 0 18px; }
    .cplay__panel--open .cplay__tab { flex: none; white-space: nowrap; min-height: 44px; padding-bottom: 10px; }
    .cplay__panel--open .cdlg__x { flex: none; width: 44px; height: 44px; }
    .cplay__panel--open .cplay__tree, .cplay__panel--open .cplay__disc { -webkit-overflow-scrolling: touch; }
    .cplay__panel--open .trch, .cplay__panel--open .trsec__head { min-height: 44px; }
}

@keyframes r4sheetIn { from { transform: translateY(28px); opacity: .5; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cplay__panel.cplay__panel--open { animation: none; } }

/* ---------- Offline: notes, what happened to answers sent later, the download's size ---------- */
.r4note { margin: 8px 0 14px; padding: 10px 12px; border: 1px solid var(--info-line); border-radius: 10px; background: var(--tint-info); color: var(--info-ink); font-size: 13.5px; line-height: 1.5; }

.r4reports { margin: 0 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.r4reports__title { margin: 0 0 8px; font-size: 14px; font-weight: 800; color: var(--ink); }
.r4reports__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.r4reports__item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 8px 10px; border: 1px solid transparent; border-radius: 10px; font-size: 13.5px; line-height: 1.5; }
.r4reports__item--ok { background: var(--tint-success); border-color: var(--success-line); color: var(--success-ink); }
.r4reports__item--refused { background: var(--tint-warn); border-color: var(--warn-line); color: var(--warn-ink); }
.r4reports__text { flex: 1 1 220px; min-width: 0; }
.r4reports__actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.r4reports__actions .link { color: inherit; font-weight: 700; text-decoration: underline; }
.r4take-reports { max-width: 760px; margin: 12px auto 0; padding: 0 16px; }
.r4take-reports:empty { display: none; }
.r4saved h1 { margin-top: 8px; }

.r4plan { margin: 10px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.r4plan p { margin: 0 0 6px; }
.r4plan__size { color: var(--ink); font-weight: 700; }
.r4plan__free { margin-left: 4px; color: var(--muted); font-weight: 400; }
.r4plan__warn { color: var(--warn-ink); }
.r4plan__hint { color: var(--muted); }
.r4plan__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@media print {
    .r4bar, .r4sheet__backdrop, .r4reports, .r4plan, .r4note { display: none !important; }
}
