/*
 * RE:HOME doctor website: plain, high-contrast look (white pages, black
 * header, one green accent, square corners, underlined links).
 *
 * Loaded after Bootstrap by base.html. Many pages still carry their own
 * <style> from the old dark theme: the "html body" prefix below gives these
 * rules a higher priority so the old dark colors don't come back.
 */

:root {
    --ink: #0B0C0C;
    --accent: #0B6B5D;
    --accent-dark: #063F37;
    --border: #B1B4B6;
    --panel: #F3F2F1;
    --muted: #505A5F;
    --muted-strong: #383F43;
    --danger: #B42318;
    --focus: #FFDD00;
    --bg: #FFFFFF;              /* page and field background */
    --on-accent: #FFFFFF;       /* text on green or red buttons */
    --header-bg: #0B0C0C;       /* the header stays black in both themes */
    --font: "Source Sans 3", Arial, sans-serif;
    --font-mono: "IBM Plex Mono", monospace;

    /* Names used by the exercise and assignment forms (their dark fallbacks are then ignored) */
    --bg3: var(--bg);
    --text: var(--ink);
    --text2: var(--muted);
    --accent3: var(--accent);
    --mono: var(--font-mono);
}

/* Dark theme: chosen in the header (data-theme="dark"), or automatic when the
 * computer is set to dark and nothing was chosen. Same names, darker values. */
:root[data-theme="dark"] {
    --ink: #F3F2F1; --bg: #121414; --panel: #1F2424; --border: #59636A;
    --muted: #AEB7BC; --muted-strong: #CBD2D5; --accent: #5CC6B3; --accent-dark: #3FA592;
    --danger: #FF8F86; --on-accent: #0B0C0C; --header-bg: #000000;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ink: #F3F2F1; --bg: #121414; --panel: #1F2424; --border: #59636A;
        --muted: #AEB7BC; --muted-strong: #CBD2D5; --accent: #5CC6B3; --accent-dark: #3FA592;
        --danger: #FF8F86; --on-accent: #0B0C0C; --header-bg: #000000;
    }
}
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

/* ---------- Page ---------- */

html body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 18px;
    line-height: 1.45;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

html body h1, html body h2, html body h3, html body h4, html body h5, html body h6 {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.01em;
}
html body h1 { font-size: 2.6rem; line-height: 1.08; }
html body h2 { font-size: 2rem; }
html body h3 { font-size: 1.5rem; }
html body h4 { font-size: 1.3rem; }

html body a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
html body a:hover { color: var(--accent-dark); text-decoration-thickness: 3px; }
html body a.btn { text-decoration: none; }

html body :focus-visible { outline: 3px solid var(--focus); outline-offset: 0; box-shadow: inset 0 0 0 2px var(--ink); }

html body .text-muted { color: var(--muted) !important; }
.mono { font-family: var(--font-mono); }

.content-wrapper { flex: 1; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 8px; z-index: 2000; background: var(--focus); color: var(--ink); padding: 8px 12px; }

/* ---------- Header ---------- */

/* The header slides away while scrolling down and comes back on scroll up (script in base.html) */
.site-header {
    position: sticky; top: 0; z-index: 1030;
    background: var(--header-bg); border-bottom: 6px solid var(--accent);
    transition: transform 0.25s ease;
}
.site-header.is-hidden { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { .site-header { transition: none; } }
html { scroll-padding-top: 96px; }   /* links to #anchors land below the header */
.site-header .inner {
    padding: 12px 40px;
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px;
}
.site-header .brand { color: #FFFFFF; font-weight: 700; font-size: 1.5rem; text-decoration: none; letter-spacing: -0.01em; }
.site-header .brand:hover { color: #FFFFFF; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 4px 22px; flex: 1 1 auto; }
.site-header nav a { color: #FFFFFF; font-weight: 600; font-size: 1rem; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: #FFFFFF; text-decoration-thickness: 3px; }
.site-header .tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.site-header .user { color: #B1B4B6; font-size: 0.95rem; }
/* White Interreg logo, set apart from the name by a thin line */
.site-header .partner-logo { height: 46px; width: auto; padding-left: 20px; border-left: 1px solid rgba(255, 255, 255, 0.35); }
@media (max-width: 640px) { .site-header .partner-logo { height: 36px; padding-left: 14px; } }

.header-button {
    background: transparent; color: #FFFFFF; border: 2px solid #FFFFFF; border-radius: 0;
    padding: 3px 10px; font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer;
}
.header-button:hover { background: #FFFFFF; color: #0B0C0C; }

/* Language selector */
.language-selector-container { position: relative; }
.language-selector-menu {
    display: none; position: absolute; right: 0; top: calc(100% + 4px); z-index: 1000;
    background: var(--bg); border: 2px solid var(--ink); min-width: 160px; list-style: none; margin: 0; padding: 4px 0;
}
.language-selector-menu.show { display: block; }
.language-selector-menu button {
    display: block; width: 100%; text-align: left; background: none; border: 0; padding: 6px 12px;
    font: inherit; font-size: 0.95rem; color: var(--accent); text-decoration: underline;
}
.language-selector-menu button:hover { text-decoration-thickness: 3px; }
.language-selector-menu button.active { color: var(--ink); text-decoration: none; font-weight: 700; }

/* ---------- Footer ---------- */

.footer-banner { background: #FFFFFF; border-top: 1px solid var(--border); padding: 12px 0; text-align: center; }

/* ---------- Building blocks ---------- */

.page { padding: 0 0 64px; width: 100%; }
.breadcrumbs { padding-top: 16px; font-size: 0.95rem; }
.breadcrumbs .sep { color: var(--muted); margin: 0 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 28px 0 32px; }
.page-head h1 { margin: 0; }
.page-head > div:first-child { flex: 1 1 auto; min-width: 0; }
.eyebrow { margin: 0 0 6px; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.lede { margin: 10px 0 0; font-size: 1.15rem; color: var(--muted-strong); max-width: 720px; }

.section-title { margin: 0 0 4px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); font-size: 1.5rem; }
.section-title .count { font-family: var(--font-mono); font-size: 1rem; font-weight: 400; color: var(--muted); }

.columns { display: flex; flex-wrap: wrap; gap: 40px 56px; align-items: flex-start; }
.columns > .main { flex: 999 1 560px; min-width: 0; }
.columns > .side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 40px; }

.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.rows .grow { flex: 1 1 220px; min-width: 0; }
.rows .meta { font-size: 0.95rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 0; white-space: nowrap; }
.actions .sep { color: var(--border); margin: 0 8px; }
.link-danger, html body a.link-danger { color: var(--danger); }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); border-top: 2px solid var(--ink); margin: 0 0 40px; }
.figures > div { padding: 14px 20px 14px 0; border-bottom: 1px solid var(--border); }
.figures dt { font-size: 1rem; font-weight: 400; color: var(--muted-strong); }
.figures dd { margin: 2px 0 0; font-size: 2.6rem; font-weight: 700; line-height: 1; }

.empty { color: var(--muted); padding: 14px 0; margin: 0; }

.thumb { width: 96px; aspect-ratio: 4 / 3; background: var(--panel); flex-shrink: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Bootstrap components, restyled ---------- */

/* Pages use the full screen width */
html body .container { max-width: none; padding-left: 0; padding-right: 0; }
html body main.container { padding-left: 40px; padding-right: 40px; margin-top: 0 !important; }

html body .card, html body .glass-card {
    background: var(--bg); color: var(--ink); border: 1px solid var(--border); border-radius: 0;
    box-shadow: none !important; backdrop-filter: none;
}
html body .card-header {
    background: transparent !important; color: var(--ink) !important; border-bottom: 2px solid var(--ink) !important;
    border-radius: 0 !important;
}
html body .card-footer { background: var(--panel); border-top: 1px solid var(--border); }

html body .text-gradient {
    background: none; -webkit-text-fill-color: currentColor; color: var(--ink); text-align: left !important;
}
html body .content-wrapper .text-light:not(.btn),
html body .content-wrapper .text-white:not(.btn) { color: var(--ink) !important; }
html body .content-wrapper .bg-dark { background: var(--panel) !important; color: var(--ink) !important; }
html body .content-wrapper .border-secondary { border-color: var(--border) !important; }
html body .shadow, html body .shadow-lg, html body .shadow-sm { box-shadow: none !important; }
html body .rounded, html body .rounded-lg, html body .rounded-pill { border-radius: 0 !important; }

/* Buttons: one green primary style, everything else outlined */
html body .btn {
    border-radius: 2px; font-weight: 700; font-size: 1rem; padding: 8px 16px; text-decoration: none;
    transition: none; box-shadow: none;
}
html body .btn-sm { font-size: 0.9rem; padding: 4px 10px; }
html body .btn-lg { font-size: 1.1rem; padding: 10px 20px; }
html body .btn-primary, html body .btn-success, html body .btn-accent, html body .btn-custom, html body .btn-info {
    background: var(--accent); border: 0; color: var(--on-accent); box-shadow: 0 3px 0 var(--accent-dark);
}
html body .btn-primary:hover, html body .btn-success:hover, html body .btn-accent:hover,
html body .btn-custom:hover, html body .btn-info:hover { background: var(--accent-dark); color: var(--on-accent); opacity: 1; }
html body .btn-secondary, html body .btn-light, html body .btn-dark, html body .btn-warning,
html body .btn-outline-light, html body .btn-outline-secondary, html body .btn-outline-primary,
html body .btn-outline-info, html body .btn-outline-success, html body .btn-outline-dark {
    background: var(--bg); border: 2px solid var(--ink); color: var(--ink);
}
html body .btn-secondary:hover, html body .btn-light:hover, html body .btn-dark:hover, html body .btn-warning:hover,
html body .btn-outline-light:hover, html body .btn-outline-secondary:hover, html body .btn-outline-primary:hover,
html body .btn-outline-info:hover, html body .btn-outline-success:hover, html body .btn-outline-dark:hover {
    background: var(--panel); color: var(--ink); border-color: var(--ink);
}
html body .btn-danger, html body .btn-outline-danger { background: var(--bg); border: 2px solid var(--danger); color: var(--danger); }
html body .btn-danger:hover, html body .btn-outline-danger:hover { background: var(--danger); color: var(--on-accent); }

/* Forms */
html body .form-control, html body select, html body textarea, html body input[type="text"],
html body input[type="number"], html body input[type="email"], html body input[type="password"],
html body input[type="search"], html body input[type="url"] {
    background: var(--bg); color: var(--ink); border: 2px solid var(--ink); border-radius: 0; font-size: 1rem;
}
html body .form-control:focus, html body select:focus, html body textarea:focus, html body input:focus {
    background: var(--bg); color: var(--ink); border-color: var(--ink);
    outline: 3px solid var(--focus); outline-offset: 0; box-shadow: inset 0 0 0 1px var(--ink);
}
html body .form-control::placeholder { color: var(--muted); }
html body label { font-weight: 700; color: var(--ink); }
html body .form-text, html body small.text-muted { color: var(--muted) !important; }
html body .invalid-feedback, html body .text-danger, html body .errorlist { color: var(--danger) !important; }
html body .errorlist { list-style: none; padding: 0; margin: 4px 0; font-weight: 700; }

/* Tables */
html body .table { color: var(--ink); background: var(--bg); }
html body .table th { border-top: 0; border-bottom: 2px solid var(--ink); font-weight: 700; }
html body .table td { border-top: 1px solid var(--border); vertical-align: middle; }
html body .table-dark, html body .table-dark th, html body .table-dark td,
html body .thead-dark th { background: var(--bg) !important; color: var(--ink) !important; border-color: var(--border) !important; }
html body .table-striped tbody tr:nth-of-type(odd) { background: var(--panel); }
html body .table-hover tbody tr:hover { background: var(--panel); color: var(--ink); }

/* Lists, badges, alerts, modals, pagination */
html body .list-group-item { background: var(--bg); color: var(--ink); border-color: var(--border); border-radius: 0 !important; }
html body .badge { border-radius: 0; font-weight: 700; font-size: 0.8rem; padding: 3px 7px; text-transform: uppercase; letter-spacing: 0.03em; }
html body .badge-success { background: #CCE2D8; color: #005A30; }
html body .badge-secondary, html body .badge-light { background: var(--panel); color: var(--muted-strong); }
html body .badge-primary, html body .badge-info { background: #D2E2F1; color: #0C2D4A; }
html body .badge-danger { background: #F6D7D2; color: #2A0B06; }
html body .badge-warning { background: #FFF7BF; color: #594D00; }

html body .alert { border-radius: 0; border: 3px solid var(--accent); background: var(--bg); color: var(--ink); font-weight: 600; }
html body .alert-danger, html body .alert-error { border-color: var(--danger); }
html body .alert-warning { border-color: #B58A00; }
html body .alert .close { color: var(--ink); opacity: 1; text-shadow: none; }

html body .modal-content { border-radius: 0; border: 2px solid var(--ink); background: var(--bg); color: var(--ink); }
html body .modal-header { border-bottom: 2px solid var(--ink); }

html body .page-link { color: var(--accent); border-radius: 0 !important; border-color: var(--border); }
html body .page-item.active .page-link { background: var(--ink); border-color: var(--ink); color: var(--bg); }

html body .nav-tabs { border-bottom: 1px solid var(--border); }
html body .nav-tabs .nav-link { border-radius: 0; color: var(--accent); background: var(--panel); margin-right: 4px; font-weight: 700; text-decoration: underline; }
html body .nav-tabs .nav-link.active { color: var(--ink); background: var(--bg); border-color: var(--border) var(--border) var(--bg); text-decoration: none; }

html body .progress { background: #DEE0E2; border-radius: 0; height: 8px; }
html body .progress-bar { background: var(--ink); }

/* Tabs used by the patient file (links styled as tabs) */
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.tabs a {
    display: inline-block; padding: 10px 18px; margin: 0 4px -1px 0; font-weight: 700;
    background: var(--panel); border: 1px solid transparent;
}
.tabs a[aria-current="page"] { background: var(--bg); color: var(--ink); border-color: var(--border) var(--border) var(--bg); text-decoration: none; }

@media (max-width: 640px) {
    html body { font-size: 17px; }
    html body h1 { font-size: 2rem; }
    html body main.container { padding-left: 16px; padding-right: 16px; }
    .site-header .inner { padding: 12px 16px; }
}

/* ---------- Form widgets shared by the exercise and assignment pages ---------- */

html body .tag-section {
    background: var(--bg); border: 0; border-top: 2px solid var(--ink); border-radius: 0; padding: 14px 0 18px;
}
html body .tag-section-label { color: var(--ink); font-family: var(--font); font-size: 1rem; font-weight: 700; letter-spacing: 0; text-transform: none; }
html body .tag-pill {
    background: var(--bg); border: 2px solid var(--ink); border-radius: 0; color: var(--ink);
    font-family: var(--font); font-size: 0.95rem; padding: 6px 14px;
}
html body .tag-pill:hover { background: var(--panel); border-color: var(--ink); }
/* !important: some pills have their own pastel colors per category, unreadable on white */
html body .tag-pill { border-color: var(--ink) !important; color: var(--ink) !important; background: var(--bg) !important; }
html body .tag-pill:hover { background: var(--panel) !important; }
html body .tag-pill.active, html body .tag-pill.active-extra { background: var(--ink) !important; border-color: var(--ink) !important; color: var(--bg) !important; }
html body .category-breadcrumb { color: var(--muted); font-size: 0.95rem; }
html body .category-breadcrumb .crumb { color: var(--ink); }

html body .exercise-item {
    background: var(--bg); border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
    padding: 12px 4px; margin: 0; color: var(--ink);
}
html body .exercise-item:hover { background: var(--panel); transform: none; }
html body .exercise-item.selected { background: var(--bg); box-shadow: inset 4px 0 0 var(--ink); }
html body .exercise-item input[type="checkbox"] { accent-color: var(--ink); }
html body .selected-exercises-list { background: var(--panel); border-radius: 0; padding: 16px; }
html body .selected-exercise-item { background: var(--bg); border: 1px solid var(--border); border-radius: 0; color: var(--ink); }

/* Forms rendered by Django ({{ form.as_p }}): label above its field */
html body form p > label { display: block; margin-bottom: 4px; }
html body form p > input:not([type="checkbox"]):not([type="radio"]), html body form p > select, html body form p > textarea { width: 100%; max-width: 480px; padding: 6px 10px; }
html body form p .helptext { display: block; color: var(--muted); font-size: 0.95rem; }

/* ---------- Older pages (Bootstrap "centered card" layout) ----------
 * Pages not rebuilt yet put their content in a small centered card.
 * These rules give them the same layout as the new pages: left-aligned,
 * full width, no box, title like a page title, labels above fields. */
html body main .row.justify-content-center { justify-content: flex-start !important; }
html body main .row.justify-content-center > [class*="col-md-"],
html body main .row.justify-content-center > [class*="col-lg-"] { flex: 0 0 100%; max-width: 100%; }
html body main > .container > h2:first-child, html body main > .container > h1:first-child {
    font-size: 2.6rem; line-height: 1.08; text-align: left !important; margin: 28px 0 32px !important;
}
html body main h2.text-center, html body main h1.text-center { text-align: left !important; }
html body main .card { border: 0; }
html body main .card-body { padding: 0; }
html body main .card-header { padding: 0 0 8px; margin-bottom: 16px; }
html body main form .text-center { text-align: left !important; }
html body main form .mb-3 > label, html body main form .form-group > label, html body main form .form-label { display: block; margin-bottom: 4px; }
html body main form .mb-3 > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html body main form .mb-3 > select, html body main form .mb-3 > textarea,
html body main form .form-group > input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
html body main form .form-group > select, html body main form .form-group > textarea {
    display: block; width: 100%; max-width: 640px; padding: 6px 10px;
}

/* Fields and lists built by older scripts carry inline dark styles (light text on
 * a dark see-through background): force readable colors inside pages. */
html body main input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
html body main textarea, html body main select {
    background: var(--bg) !important; color: var(--ink) !important; border: 2px solid var(--ink) !important; border-radius: 0 !important;
}
html body main input::placeholder, html body main textarea::placeholder { color: var(--muted) !important; }
html body main .exercise-item, html body main .selected-exercise-item,
html body main .exercise-item *, html body main .selected-exercise-item *:not(.btn) { color: var(--ink); }

/* Patient list: today's daily tasks as blocks, progress as a bar */
.patient-table td { vertical-align: top; padding-top: 14px; padding-bottom: 14px; }
.patient-table .meta { font-size: 0.95rem; color: var(--muted); }
.cells { display: flex; gap: 3px; margin-top: 6px; }
.cells span { flex: 0 0 auto; }
.cells span { width: 18px; height: 8px; background: var(--border); }
.cells span.done { background: #F2B705; }
.bar { width: 120px; height: 8px; background: var(--border); margin-top: 6px; }
.bar span { display: block; height: 8px; background: var(--ink); }
.patient-status { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 10px 0 0; color: var(--muted-strong); font-size: 1.05rem; }
.patient-status > span { display: inline-flex; align-items: center; gap: 10px; }
.patient-status .cells { display: inline-flex; margin-top: 0; vertical-align: middle; }
.patient-status .bar { display: inline-block; margin-top: 0; vertical-align: middle; }

/* ---------- Line icons (templates/icon.html) ---------- */

.icon { width: 1.05em; height: 1.05em; vertical-align: -0.17em; margin-inline-end: 0.4em; flex-shrink: 0; }
.icon-only .icon { margin-inline-end: 0; }
.tag-error .icon, .alert .icon { color: var(--danger); }

/* ---------- Feedback ratings: blue = too easy, green = perfect, red = too hard ---------- */

:root {
    --easy: #2F74C0; --easy-bg: #E8F1FB; --easy-ink: #134A85;
    --right: #13845F; --right-bg: #E3F3EC; --right-ink: #0B553D;
    --hard: #D0442F; --hard-bg: #FCEBE8; --hard-ink: #8F2416;
}
:root[data-theme="dark"] {
    --easy: #6AA6E8; --easy-bg: #13263B; --easy-ink: #B5D3F4;
    --right: #45C496; --right-bg: #0E2C23; --right-ink: #A6E2CB;
    --hard: #F07462; --hard-bg: #3A1814; --hard-ink: #F8BBB1;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --easy: #6AA6E8; --easy-bg: #13263B; --easy-ink: #B5D3F4;
        --right: #45C496; --right-bg: #0E2C23; --right-ink: #A6E2CB;
        --hard: #F07462; --hard-bg: #3A1814; --hard-ink: #F8BBB1;
    }
}

.rating {
    --c: var(--muted); --c-bg: var(--panel); --c-ink: var(--muted-strong);
    display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; white-space: nowrap;
    padding: 5px 12px 5px 10px; border-radius: 999px;
    background: var(--c-bg); color: var(--c-ink);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 35%, transparent);
    font-size: 0.9rem; font-weight: 700; line-height: 1.2;
}
.rating-easy { --c: var(--easy); --c-bg: var(--easy-bg); --c-ink: var(--easy-ink); }
.rating-right { --c: var(--right); --c-bg: var(--right-bg); --c-ink: var(--right-ink); }
.rating-hard { --c: var(--hard); --c-bg: var(--hard-bg); --c-ink: var(--hard-ink); }

/* Three bars, filled 1, 2 or 3 times: easy, perfect, hard */
.rating-meter { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; }
.rating-meter i { width: 3px; border-radius: 1px; background: color-mix(in srgb, var(--c) 28%, transparent); }
.rating-meter i:nth-child(1) { height: 5px; }
.rating-meter i:nth-child(2) { height: 8.5px; }
.rating-meter i:nth-child(3) { height: 12px; }
.rating-easy .rating-meter i:nth-child(-n+1),
.rating-right .rating-meter i:nth-child(-n+2),
.rating-hard .rating-meter i { background: var(--c); }

/* Share of each rating for one exercise */
.rating-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 12px 0 6px; }
.rating-bar { display: flex; gap: 2px; flex: 0 1 320px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--panel); }
.rating-bar span { min-width: 6px; }
.seg-easy { background: var(--easy); }
.seg-right { background: var(--right); }
.seg-hard { background: var(--hard); }
.rating-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; font-size: 0.9rem; color: var(--muted-strong); }
.rating-legend li::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0.02em; }
.rating-legend b { color: var(--ink); }
.key-easy::before { background: var(--easy); }
.key-right::before { background: var(--right); }
.key-hard::before { background: var(--hard); }

.media-frame {
    position: relative; overflow: hidden; isolation: isolate;
    display: flex; align-items: center; justify-content: center;
    background: var(--panel);
}
.media-frame::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: var(--media, none) center / cover no-repeat;
    filter: blur(18px) saturate(1.1); transform: scale(1.15); opacity: 0.55;
}
.media-frame img, .media-frame video {
    display: block; max-width: 100%; max-height: 100%;
    width: auto; height: auto; object-fit: scale-down;
}
.media-frame video { width: 100%; height: 100%; object-fit: contain; background: #000; }

/* The exercise page: big frame, the picture keeps its own proportions */
.detail-media { margin-bottom: 28px; }
.detail-media img { max-height: min(520px, 70vh); }
.detail-media video { height: min(520px, 70vh); }

/* Buttons at the top right of a page, side by side */
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.page-actions form { margin: 0; }

/* Password rules of the signup form: grey square, then a green tick once met */
.password-rules { margin: 4px 0 28px; padding: 16px 20px; background: var(--panel); border-left: 6px solid var(--border); transition: border-color 0.2s; }
.password-rules:not(:has(li:not(.is-met))) { border-left-color: var(--accent); }
.password-rules-title { margin: 0 0 8px; font-weight: 700; }
.password-rules ul { list-style: none; margin: 0; padding: 0; }
.password-rules li { display: flex; align-items: center; gap: 12px; padding: 3px 0; color: var(--muted); transition: color 0.2s; }
.password-rules li.is-met { color: var(--ink); }
.rule-mark { position: relative; width: 20px; height: 20px; flex-shrink: 0; border: 2px solid var(--border); background: var(--bg); transition: background 0.2s, border-color 0.2s; }
.rule-mark::after { content: ""; position: absolute; left: 5px; top: 1px; width: 6px; height: 11px; border: solid var(--on-accent); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0); transition: transform 0.2s; }
.password-rules li.is-met .rule-mark { background: var(--accent); border-color: var(--accent); }
.password-rules li.is-met .rule-mark::after { transform: rotate(45deg) scale(1); }
.password-rules.show-missing li:not(.is-met) { color: var(--danger); }
.password-rules.show-missing li:not(.is-met) .rule-mark { border-color: var(--danger); }
.password-rules-note { margin: 10px 0 0; font-size: 0.9rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .password-rules *, .password-rules *::after { transition: none; } }

/* ---------- Patient feedback in the Exercise Library ---------- */

.filter-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 0.05em; background: var(--border); }
.dot-easy { background: var(--easy); }
.dot-right { background: var(--right); }
.dot-hard { background: var(--hard); }

/* Side card of the exercise page */
.feedback-card { margin-top: 32px; }
.feedback-total { display: flex; align-items: baseline; gap: 10px; margin: 14px 0 12px; color: var(--muted-strong); }
.feedback-total .big { font-size: 2.2rem; font-weight: 500; line-height: 1; color: var(--ink); }
.feedback-levels { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.level-row { display: grid; grid-template-columns: 7.5em 1fr 3.2em; align-items: center; gap: 10px; font-size: 0.95rem; }
.level-row .track { height: 10px; border-radius: 999px; background: var(--panel); overflow: hidden; }
.level-row .track span { display: block; height: 100%; border-radius: 999px; background: var(--c); min-width: 0; }
.level-row .value { text-align: right; color: var(--muted-strong); }
.level-easy { --c: var(--easy); }
.level-right { --c: var(--right); }
.level-hard { --c: var(--hard); }
.feedback-hint { display: flex; gap: 6px; margin: 16px 0 0; padding: 10px 12px; background: var(--panel); border-left: 4px solid var(--ink); font-size: 0.95rem; }
.feedback-hint .icon { margin-top: 0.2em; }
.feedback-scope { margin: 14px 0 0; font-size: 0.9rem; color: var(--muted); }

/* Comments: chips to filter by rating, then one card per comment */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--ink); font: inherit; font-size: 0.95rem; cursor: pointer; }
.chip .mono { font-size: 0.85rem; color: var(--muted); }
.chip:hover:not(:disabled) { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip[aria-pressed="true"] .mono { color: inherit; }
.chip:disabled { opacity: 0.45; cursor: default; }
.chip .filter-dot { margin-right: 0; }

.comment-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.comment { padding: 14px 18px; background: var(--panel); border-left: 4px solid var(--c, var(--border)); }
.comment[hidden] { display: none; }
.comment-easy { --c: var(--easy); }
.comment-right { --c: var(--right); }
.comment-hard { --c: var(--hard); }
.comment-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.comment-who { font-weight: 600; }
.comment-who .mine { font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.comment-date { margin-left: auto; font-size: 0.85rem; color: var(--muted); font-family: var(--font-mono); }
.comment-text { margin: 10px 0 0; font-size: 1.05rem; line-height: 1.5; }
.comment-extra { margin: 14px 0 0; font-size: 0.95rem; }
#more-comments { margin-top: 16px; }
