/*
 * LMS: тема с боковым меню (макет – docs/design). Без сборки и внешних шрифтов (CSP).
 * Ширина от 360 px (ТЗ 4.1.6). Дополняют: progress.css, quiz.css, h5p.css.
 */
:root {
    --bg: #f5f4f3;
    --surface: #fff;
    --surface-2: #faf9f8;
    --card: var(--surface); /* прежнее имя, используется в quiz.css */
    --text: #1d1a19;
    --muted: #6d6663;
    --faint: #9a928e;
    --line: #e8e3e0;
    --line-strong: #d6cfcb;

    --accent: #9e1b32;
    --accent-ink: #7f1528;
    --accent-soft: #f7e9eb;
    --accent-line: #ecc9cf;

    --ok: #1e7346;      --ok-soft: #e7f3ec;
    --warn: #9a5800;    --warn-soft: #fbf0df;
    --danger: #b42318;  --danger-soft: #fdeceb;
    --info: #2a5b9e;    --info-soft: #e9f0fa;

    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(29, 26, 25, .05), 0 1px 1px rgba(29, 26, 25, .03);
    --shadow-lg: 0 8px 24px rgba(29, 26, 25, .08);
    --sidebar-w: 256px;

    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    font-size: 15px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0; font-weight: 650; }
h3 { font-size: 1rem; margin: 0; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column;
    background: var(--surface); border-right: 1px solid var(--line);
    padding: 1rem .75rem;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: .25rem .5rem 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--text); }
.brand-mark {
    width: 36px; height: 36px; border-radius: 9px; flex: none;
    display: grid; place-items: center;
    background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem; letter-spacing: .02em;
}
.brand-name { font-weight: 650; line-height: 1.2; font-size: .95rem; }
.brand-name small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; }

.nav-group { margin-bottom: 1rem; }
.nav-title { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 0 .65rem .35rem; }
.nav-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .45rem .65rem; border-radius: var(--radius-sm);
    color: var(--text); font-size: .93rem;
}
.nav-link svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav-link.active svg { color: var(--accent); }
.nav-count { margin-left: auto; font-size: .75rem; font-weight: 600; min-width: 1.4rem; text-align: center; padding: 0 .4rem; border-radius: 999px; background: var(--danger); color: #fff; }

.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .75rem .5rem 0; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: #ece6e3; color: var(--muted); font-weight: 600; font-size: .8rem; }
.sidebar-user .who { flex: 1; min-width: 0; line-height: 1.25; }
.sidebar-user .who strong { display: block; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: .78rem; color: var(--muted); }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm); border: 0; background: none; color: var(--muted); cursor: pointer; position: relative; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.main { min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 5;
    display: flex; align-items: center; gap: .75rem;
    padding: .65rem 2rem; background: rgba(245, 244, 243, .9); backdrop-filter: blur(6px);
    border-bottom: 1px solid transparent;
}
.topbar .search { flex: 1; max-width: 420px; }
.topbar .spacer { flex: 1; }
.menu-btn { display: none; }

.container { max-width: 1180px; margin: 0 auto; padding: 1.25rem 2rem 3rem; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head p { margin: .3rem 0 0; color: var(--muted); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 2rem 0 .85rem; }
.section-head a { font-size: .9rem; }

/* Страницы без входа: вход, отказ в доступе */
.guest { max-width: 440px; margin: 0 auto; padding: 12vh 1rem 3rem; }
.guest > .brand { justify-content: center; padding-bottom: 1.5rem; }
.guest .card { padding: 2rem 1.75rem; }
.guest h1 { font-size: 1.35rem; margin-bottom: .5rem; }

/* ---------- Элементы ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.nowrap { white-space: nowrap; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .75rem; }

.button {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font: inherit; font-size: .92rem; font-weight: 550; line-height: 1.2;
    padding: .55rem 1rem; border-radius: var(--radius-sm);
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
    cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.button svg { width: 16px; height: 16px; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.button.ghost { border-color: transparent; background: none; color: var(--accent); padding-left: .5rem; padding-right: .5rem; }
.button.ghost:hover { background: var(--accent-soft); }
.button.sm { padding: .35rem .7rem; font-size: .85rem; }

input[type=text], input[type=search], input[type=url], input[type=date], input[type=number], select, textarea {
    font: inherit; font-size: .92rem; padding: .5rem .7rem;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search { position: relative; }
.search svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search input { width: 100%; padding-left: 2.2rem; }

.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 600; padding: .12rem .55rem; border-radius: 999px; background: #efebe9; color: var(--muted); white-space: nowrap; }
.badge:is(.ok, .warn, .danger, .info, .accent):not(.plain)::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }

.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .32rem .8rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: .86rem; }
.chip:hover { text-decoration: none; color: var(--text); border-color: var(--faint); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.chip span { color: var(--faint); font-size: .8rem; }
.chip.active span { color: #cfc8c4; }

.flash { display: flex; gap: .75rem; align-items: flex-start; border-radius: var(--radius); padding: .85rem 1.1rem; margin-bottom: 1.25rem; background: var(--info-soft); color: #1e3f6d; border: 1px solid #cfdcf0; }
.flash.error { background: var(--danger-soft); color: #7a1a12; border-color: #f3c9c5; }
.flash svg { width: 20px; height: 20px; flex: none; margin-top: .1rem; }
.flash .flash-body { flex: 1; }
.flash strong { display: block; }

/* Прогресс */
.progress { height: 6px; border-radius: 999px; background: #eee9e6; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.progress.ok > span { background: var(--ok); }

/* ---------- Главная ---------- */
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(4, 1fr); }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.15rem; }
.stat .label { font-size: .85rem; color: var(--muted); display: flex; align-items: center; gap: .4rem; }
.stat .label i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.stat .value { font-size: 1.75rem; font-weight: 650; line-height: 1.15; }
.stat .hint { font-size: .8rem; color: var(--faint); }
.stat.danger .label i { background: var(--danger); }
.stat.danger .value { color: var(--danger); }
.stat.warn .label i { background: var(--warn); }
.stat.info .label i { background: var(--info); }
.stat.ok .label i { background: var(--ok); }
a.stat { color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--line-strong); box-shadow: var(--shadow-lg); }

.course-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.course-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.course-card .cover {
    max-width: none; border-radius: 0;
    height: 84px; position: relative; padding: .8rem 1rem;
    display: flex; align-items: flex-start; justify-content: space-between;
    background: linear-gradient(135deg, var(--c1, #9e1b32), var(--c2, #c2475b));
}
.course-card .cover .badge { background: rgba(255, 255, 255, .92); }
.course-card .cover .glyph { position: absolute; right: 1rem; bottom: -18px; width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-lg); color: var(--c1, var(--accent)); }
.course-card .cover .glyph svg { width: 22px; height: 22px; }
.course-card .body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .55rem; flex: 1; }
.course-card .cat { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.course-card h3 { font-size: 1.02rem; line-height: 1.35; }
.course-card h3 a { color: var(--text); }
.course-card .meta { display: flex; justify-content: space-between; font-size: .83rem; color: var(--muted); }
.course-card .foot { margin-top: auto; padding-top: .4rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.due { font-size: .83rem; color: var(--muted); display: inline-flex; align-items: center; gap: .3rem; }
.due svg { width: 15px; height: 15px; }
.due.late { color: var(--danger); font-weight: 600; }
.due.soon { color: var(--warn); font-weight: 600; }

.split { display: grid; gap: 1rem; grid-template-columns: 1.4fr 1fr; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .85rem; padding: .8rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: .2rem; }
.list .ico { width: 36px; height: 36px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.list .ico svg { width: 18px; height: 18px; }
.list .ico.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.list .ico.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.list .ico.warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.list .txt { flex: 1; min-width: 0; line-height: 1.35; }
.list .txt strong { display: block; font-weight: 600; font-size: .93rem; }
.list .txt span { font-size: .82rem; color: var(--muted); }

/* ---------- Страница курса ---------- */
.course-head { display: grid; grid-template-columns: 1fr 260px; gap: 1.5rem; padding: 1.5rem; margin-bottom: 1.25rem; }
.course-head:not(:has(.course-head-side)) { grid-template-columns: 1fr; }
.course-head-main { display: flex; flex-direction: column; gap: .6rem; min-width: 0; }
.course-head .cat { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.course-head .content > :first-child { margin-top: 0; }
.course-head .content > :last-child { margin-bottom: 0; }
.course-head-side { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; padding-left: 1.5rem; border-left: 1px solid var(--line); }
.course-head-side .meta { width: 100%; display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); }
.course-head-side .meta strong { color: var(--text); font-size: 1rem; }
.course-head-side .progress { width: 100%; }
.course-section h2 { margin: 0 0 .5rem; }
.course-section .modules { margin: 0; }
.module { gap: .85rem; padding: .7rem 0; flex-wrap: nowrap; }
.module-ico { width: 34px; height: 34px; border-radius: 9px; flex: none; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.module-ico svg { width: 17px; height: 17px; }
.module-ico.state-completed { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.module-ico.state-in_progress { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.module-ico.state-failed { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.module-txt { flex: 1; min-width: 0; line-height: 1.35; }
.module-txt a { font-weight: 600; color: var(--text); }
.module-txt a:hover { color: var(--accent); }
.module-txt span { display: block; font-size: .8rem; color: var(--muted); }
.module-label { display: block; }

/* ---------- Каталог ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .9rem; }
.toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1.1rem; }
.segmented { display: inline-flex; padding: 3px; border-radius: var(--radius-sm); background: #ebe6e3; }
.segmented a { padding: .32rem .75rem; border-radius: 5px; font-size: .86rem; color: var(--muted); }
.segmented a:hover { text-decoration: none; color: var(--text); }
.segmented a.active { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding: .65rem 1rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfbfa; }
.table .code { font-family: Consolas, "Cascadia Mono", ui-monospace, monospace; font-size: .84rem; color: var(--muted); }
.table .title a { color: var(--text); font-weight: 600; }
.table .title a:hover { color: var(--accent); }
.table .title span { display: block; font-size: .82rem; color: var(--muted); }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { vertical-align: middle; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; border-top: 1px solid var(--line); font-size: .86rem; color: var(--muted); }
.pager { display: flex; gap: .3rem; }
.pager a, .pager span { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--text); padding: 0 .5rem; }
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager .current { background: var(--text); color: #fff; font-weight: 600; }

.empty { text-align: center; padding: 3rem 1.5rem; }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 1rem; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { font-size: 1.05rem; margin-bottom: .35rem; }
.empty p { color: var(--muted); margin: 0 auto 1.2rem; max-width: 420px; }

/* ---------- Формы и страницы курса ---------- */
.card { margin-bottom: 1rem; }
.back { display: inline-block; font-size: .9rem; color: var(--muted); margin-bottom: .75rem; }
.back:hover { color: var(--accent); }
.card.content { padding: 1.5rem 1.75rem; line-height: 1.65; }
.stats > .card, .course-grid > .card, .split > .card, .cards > .card, .grid2 > .card, .grid3 > .card, .table-wrap + .card { margin-bottom: 0; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.center { text-align: center; }
.grid2, .grid3 { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 720px) {
    .grid2 { grid-template-columns: 1fr 1fr; }
    .grid3 { grid-template-columns: repeat(3, 1fr); }
}
.container > h1 { margin-bottom: 1.25rem; }
/* Шапка страницы старого образца: <div class="row between"><h1>...</h1> кнопки</div> */
.container > .row:has(> h1) { margin-bottom: 1.5rem; gap: .75rem 1rem; }
.container > .row:has(> h1) > h1 { margin: 0; }
.container > p.muted:first-of-type { margin-top: -.75rem; }
.container > h2, .card > h2 { margin: 1.75rem 0 .75rem; }
.card > h2:first-child { margin-top: 0; }
label { display: flex; flex-direction: column; gap: .3rem; font-weight: 550; font-size: .92rem; }
label.check { flex-direction: row; align-items: center; font-weight: 400; gap: .5rem; }
input.short { width: 6rem; }
input[type=file] { font: inherit; font-size: .9rem; color: var(--muted); }
input[type=file]::file-selector-button { font: inherit; font-size: .88rem; font-weight: 550; margin-right: .75rem; padding: .45rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer; }
input[type=file]::file-selector-button:hover { background: var(--surface-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem 1rem; }
legend { font-weight: 600; padding: 0 .3rem; }
form .row + .row, form label + label { margin-top: .25rem; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.link:hover { text-decoration: underline; }
.danger { color: var(--danger); }
.flash ul { margin: .25rem 0 0; padding-left: 1.2rem; }

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.section { margin-bottom: 1rem; }
.section summary { cursor: pointer; font-weight: 600; }
.modules { list-style: none; padding: 0; margin: .5rem 0; }
.module { padding: .6rem .25rem; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.module:last-child { border-bottom: 0; }
.hidden-item { opacity: .6; }
.handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 .25rem; }
.dragging { opacity: .4; }
.add-module { font-size: .9rem; }
.state { font-size: .85rem; }
.state-completed { color: var(--ok); }
.state-in_progress { color: var(--warn); }

.content img { max-width: 100%; height: auto; }
.content table { border-collapse: collapse; }
.content td, .content th { border: 1px solid var(--line); padding: .25rem .5rem; }
.video { position: relative; padding-top: 56.25%; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.files { padding-left: 1.2rem; }
.cover { max-width: 240px; border-radius: var(--radius-sm); }
.props { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
.props dt { color: var(--muted); }
.props dd { margin: 0; }
.table-wrap + nav, .table-wrap + .pager-nav { margin-top: 1rem; }
.pagination { list-style: none; display: flex; align-items: center; gap: .3rem; padding: 0; margin: 1rem 0 0; }
.pagination li > a, .pagination li > span { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 .75rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: .9rem; }
.pagination li > a:hover { text-decoration: none; background: var(--surface-2); }
.table-foot .pagination { margin: 0; }
.pagination li.muted > span { color: var(--faint); background: none; border-color: transparent; }

/* ---------- Адаптив ---------- */
.nav-toggle, .scrim { display: none; }
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    .split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; z-index: 20; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    .nav-toggle:checked ~ .shell .sidebar { transform: none; }
    .nav-toggle:checked ~ .shell .scrim { display: block; }
    .scrim { position: fixed; inset: 0; z-index: 15; background: rgba(29, 26, 25, .35); }
    .menu-btn { display: inline-grid; }
    .topbar, .container { padding-left: 1rem; padding-right: 1rem; }
    .topbar .search { display: none; }
    .table .hide-sm { display: none; }
    .course-head { grid-template-columns: 1fr; }
    .course-head-side { padding-left: 0; border-left: 0; padding-top: 1rem; border-top: 1px solid var(--line); }
}
@media (max-width: 520px) {
    h1 { font-size: 1.35rem; }
    .stats { gap: .6rem; }
    .stat { padding: .8rem .9rem; }
    .stat .value { font-size: 1.45rem; }
    .page-head .button { width: 100%; }
}
