@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700;800&display=swap');

/* Vườn Toán: use the shared palette and surfaces on every route. */
:root {
    --green: #1f6248;
    --green-hover: #184f3b;
    --orange: #ffbe73;
    --cream: #fff9ed;
    --ink: #203a32;
    --muted: #46594d;
    --paper: #fffef8;
    --garden: #f0f2df;
    --leaf: #dde8c6;
    --mint: #ddece6;
    --peach: #ffe4c6;
    --line: #dfe2cd;
    --edge: #879478;
    --warm-ink: #784018;
    --focus: #864819;
    --on-green: #f0f2df;
    --shadow: 0 12px 30px #203a3210;
    --radius-card: 22px;
    --radius-control: 13px;
    --gutter: clamp(16px, 4.5vw, 64px);
    --header-height: 78px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font: 15px/1.7 'Be Vietnam Pro', 'Segoe UI', sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Shared navigation, controls and containers. */
.site-header {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid var(--line);
    background: var(--cream);
    box-shadow: 0 4px 18px #203a320b;
}
.header-inner {
    max-width: 1440px;
    min-height: calc(var(--header-height) - 1px);
    margin: auto;
    padding: 8px clamp(16px, 2.5vw, 36px);
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.2vw, 18px);
}
.brand, .footer-brand { display: inline-flex; align-items: center; min-height: 44px; }
.brand img, .footer-brand img { display: block; max-width: 100%; height: auto; }
.brand img { width: clamp(150px, 13vw, 192px); }
.footer-brand img { width: 144px; }
#primary-nav { display: flex; flex: 1; justify-content: center; gap: 2px; font-size: 13px; font-weight: 650; white-space: nowrap; }
#primary-nav a { display: flex; align-items: center; min-height: 44px; padding: 5px clamp(7px, .7vw, 11px); border-radius: 999px; }
#primary-nav a:hover, #primary-nav a[aria-current] { color: var(--green); background: var(--leaf); }
#account { display: block; max-width: 160px; min-height: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menu { display: none; border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--paper); font-size: 22px; }
.wrap { max-width: 1440px; padding-inline: var(--gutter); margin-inline: auto; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 46px;
    padding: 10px 17px;
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
    transition: background-color .18s, border-color .18s;
}
.dark { background: var(--green); color: #fff; }
.dark:hover { background: var(--green-hover); }
.orange { background: var(--orange); color: var(--ink); }
.orange:hover { background: var(--peach); }
.outline { border-color: var(--edge); background: var(--paper); }
.outline:hover { background: var(--garden); border-color: var(--green); }
.small { font-size: 13px; padding: 9px 13px; }
.eyebrow { color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .075em; text-transform: uppercase; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 999px; background: var(--leaf); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--orange); margin-inline-end: 7px; }
.pill .dot { flex: 0 0 8px; margin: 0; background: var(--green); }
.panel, .card, .stat, .activity, dialog {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
}
.text-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 6px 0;
    border: 0;
    background: none;
    color: var(--green);
    font-size: 13px;
    font-weight: 700;
}
.text-link:hover, .crumb a:hover, .card h3 a:hover { text-decoration: underline; text-underline-offset: 3px; }
.muted, .modal-copy { color: var(--muted); }
.muted { font-size: 13px; }
.mb { margin-bottom: 42px; }
.panel-space { margin-bottom: 20px; }

/* Home: the approved Vườn Toán composition. */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
    align-items: center;
    gap: clamp(16px, 3vw, 44px);
    margin: 22px 0 36px;
    padding: clamp(20px, 2.3vw, 34px) clamp(22px, 3.4vw, 48px);
    background: var(--garden);
    border: 1px solid var(--line);
    border-radius: clamp(24px, 3vw, 40px);
}
.hero h1 { margin: 18px 0; font-size: clamp(30px, 4.05vw, 58px); line-height: 1.2; letter-spacing: -.045em; font-weight: 800; }
.hero h1 em {
    color: var(--green);
    font-style: normal;
    text-decoration: underline .085em var(--orange);
    text-decoration-skip-ink: none;
    text-underline-offset: .2em;
}
.hero p { max-width: 37ch; margin: 22px 0; color: var(--muted); font-size: clamp(15px, 1.5vw, 19px); }
.actions, .quiz-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.art { min-width: 0; }
.art svg { display: block; width: 100%; height: auto; }
.section { margin-bottom: 44px; }
.home-anchor { scroll-margin-top: calc(var(--header-height) + 14px); }
.section-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 19px; }
.section-head h2, .title { font-size: clamp(28px, 3.5vw, 44px); line-height: 1.22; letter-spacing: -.035em; margin: 6px 0; }
.section-head p, .page-head p { color: var(--muted); margin: 8px 0 0; }
.activity-grid, .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.activity { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 17px; }
.activity:hover { border-color: var(--edge); box-shadow: var(--shadow); }
.activity-icon, .activity-arrow { display: grid; place-items: center; background: var(--leaf); color: var(--green); }
.activity:nth-child(2) :is(.activity-icon, .activity-arrow) { background: var(--peach); }
.activity:nth-child(3) :is(.activity-icon, .activity-arrow) { background: var(--mint); }
.activity-icon { width: 46px; height: 46px; border-radius: 14px; }
.activity-icon svg { width: 23px; height: 23px; }
.activity-arrow { width: 34px; height: 34px; border-radius: 50%; font-weight: 800; }
.activity-copy { grid-column: 1 / -1; }
.activity strong { display: block; font-size: clamp(16px, 1.65vw, 21px); line-height: 1.35; }
.activity-copy span { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.learning-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.learning-steps li:nth-child(even) { background: var(--garden); }
.step-number { display: inline-grid; width: 44px; height: 44px; place-items: center; border-radius: 14px; background: var(--leaf); color: var(--green); font-weight: 800; }
.learning-steps li:nth-child(even) .step-number { background: var(--peach); color: var(--warm-ink); }
.learning-steps h3, .home-note :is(h2, h3) { margin: 12px 0 6px; }
.learning-steps p, .home-note p { max-width: 67ch; margin: 0; color: var(--muted); }
.home-note .btn { margin-top: 14px; }
#tuyen-sinh { background: var(--mint); }
.banner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 26px; padding: clamp(20px, 3vw, 36px); border-radius: var(--radius-card); background: var(--green); color: #fff; }
.banner .eyebrow { color: var(--orange); }
.banner h2 { font-size: clamp(23px, 3vw, 34px); line-height: 1.3; margin: 8px 0; }
.banner p { max-width: 48ch; color: var(--on-green); }
.banner :focus-visible { outline-color: var(--orange); }
.steps { display: flex; align-items: center; gap: 8px; color: var(--on-green); }
.step { flex: 1; font-size: 13px; text-align: center; }
.step i { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 8px; border-radius: 16px; background: #ffffff19; color: var(--orange); font-size: 25px; font-style: normal; }

/* Topic cards and page headings. */
.page-head {
    margin: 22px 0;
    padding: clamp(18px, 3vw, 34px);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--garden);
}
.page-head p { max-width: 65ch; }
.page-head h1 { overflow-wrap: anywhere; }
.crumb { margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.crumb a { text-decoration: underline; text-underline-offset: 3px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.filter { min-height: 44px; padding: 6px 14px; border: 1px solid var(--edge); border-radius: 999px; background: var(--paper); font-size: 13px; font-weight: 600; }
.filter:hover { background: var(--garden); }
.filter.active { background: var(--green); border-color: var(--green); color: #fff; }
.card { min-width: 0; display: flex; flex-direction: column; }
.card:hover { border-color: var(--edge); box-shadow: var(--shadow); }
.card-art { position: relative; display: flex; justify-content: center; align-items: center; gap: 12px; height: 146px; overflow: hidden; border-radius: calc(var(--radius-card) - 1px) calc(var(--radius-card) - 1px) 0 0; color: var(--green); }
.card-art:focus-visible { outline-offset: -5px; }
.card-art::before, .card-art::after { content: ''; position: absolute; inset: -48px -26px auto auto; width: 130px; height: 130px; border: 1px solid #ffffffa8; border-radius: 50%; }
.card-art::after { inset: auto auto -74px -40px; }
.art-green { background: var(--leaf); }
.art-peach { background: var(--peach); color: var(--warm-ink); }
.art-mint { background: var(--mint); }
.number { z-index: 1; font-size: clamp(32px, 5vw, 46px); font-weight: 800; line-height: 1.2; letter-spacing: -.05em; transform: rotate(-8deg); }
.number-symbol { font-size: clamp(26px, 3vw, 36px); }
.tile { padding: 9px 13px; border-radius: var(--radius-control); background: var(--paper); box-shadow: 3px 5px #203a3215; }
.mini-label { position: absolute; z-index: 1; bottom: 8px; left: 12px; padding: 2px 8px; border-radius: 999px; background: var(--paper); font-size: 10px; font-weight: 600; }
.card-body { flex: 1; display: flex; flex-direction: column; padding: 17px; }
.tag-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; background: var(--leaf); color: var(--green); font-size: 11px; font-weight: 700; }
.tag.warm { background: var(--peach); color: var(--warm-ink); }
.card h3 { font-size: 18px; line-height: 1.35; margin: 12px 0 6px; }
.card p { margin: 0 0 13px; color: var(--muted); font-size: 14px; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.round { display: grid; flex: 0 0 44px; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: var(--leaf); color: var(--green); font-size: 18px; }
.round:hover { background: var(--green); color: #fff; }

/* Reading, quizzes, progress and classroom. */
.panel { min-width: 0; padding: clamp(16px, 2.5vw, 28px); }
.panel h2, .panel h3 { line-height: 1.4; overflow-wrap: anywhere; }
.notice { margin: 14px 0; padding: 10px 14px; border-radius: var(--radius-control); background: var(--mint); color: var(--ink); font-size: 13px; }
.notice.mb { margin-bottom: 42px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(235px, 29%); align-items: start; gap: 19px; margin-bottom: 44px; }
.lesson h2 { font-size: clamp(22px, 2.6vw, 32px); }
.lesson h3 { font-size: 19px; margin-top: 24px; }
.lesson p, .lesson li { color: var(--muted); }
.lesson ol { padding-inline-start: 24px; }
.example { margin: 20px 0; padding: 15px 17px; border-inline-start: 4px solid var(--green); border-radius: 0 var(--radius-control) var(--radius-control) 0; background: var(--garden); }
.example p { margin: 6px 0 0; }
.math { margin: 18px 0; color: var(--green); text-align: center; font-size: clamp(22px, 6vw, 30px); font-weight: 800; }
.visual { display: flex; justify-content: center; align-items: center; gap: clamp(10px, 3vw, 30px); margin: 18px 0; padding: 16px 12px; border-radius: var(--radius-control); background: var(--garden); }
.visual-prices { flex-wrap: wrap; gap: 13px; }
.jump { min-width: 0; text-align: center; font-size: 13px; }
.jump span { display: block; font-size: 40px; }
.hint { padding: 12px 15px; border-radius: var(--radius-control); background: var(--peach); color: var(--ink); font-size: 14px; }
.hint summary { cursor: pointer; padding-block: 8px; font-weight: 700; }
.aside { background: var(--garden); }
.aside-title { color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .075em; }
.aside h3 { margin: 7px 0; }
.aside .btn { width: 100%; margin-top: 8px; }
.check-list { padding: 0; list-style: none; font-size: 14px; }
.check-list li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.progress { height: 9px; margin: 12px 0; overflow: hidden; border-radius: 999px; background: var(--leaf); }
.progress span { display: block; height: 100%; background: var(--green); }
.quiz-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.quiz-top h2 { margin: 0; font-size: clamp(19px, 2.3vw, 24px); }
.timer { padding: 6px 11px; border-radius: var(--radius-control); background: var(--peach); color: var(--warm-ink); font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.question { padding: 20px 0; border-bottom: 1px solid var(--line); }
.question h3 { margin: 0 0 11px; font-size: 15px; }
.question small { color: var(--muted); }
.question input[type="text"], .name-input {
    width: 100%;
    max-width: 320px;
    min-height: 46px;
    padding: 9px 12px;
    border: 1px solid var(--edge);
    border-radius: var(--radius-control);
    background: var(--paper);
    color: var(--ink);
    font-size: 16px;
}
input::placeholder { color: var(--muted); }
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.option { display: inline-flex; align-items: center; min-width: 58px; min-height: 44px; padding: 6px 10px; border: 1px solid var(--edge); border-radius: var(--radius-control); background: var(--paper); cursor: pointer; }
.option:has(input:checked) { background: var(--leaf); border-color: var(--green); }
.option input { accent-color: var(--green); margin-inline-end: 6px; }
.feedback { margin-top: 11px; padding: 10px 13px; border-radius: var(--radius-control); background: var(--leaf); font-size: 14px; }
.feedback.wrong { background: var(--peach); color: var(--warm-ink); }
.score { margin-top: 20px; padding: 16px; border-radius: var(--radius-card); background: var(--garden); text-align: center; }
.score strong { display: block; color: var(--green); font-size: 43px; }
.score small { font-size: 14px; color: var(--muted); }
.score strong small { font-size: 20px; }
.quiz-actions { margin-top: 20px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(6px, 2vw, 16px); margin-bottom: 19px; }
.stat { padding: clamp(8px, 2vw, 18px); background: var(--garden); }
.stat strong { display: block; color: var(--green); font-size: clamp(22px, 3vw, 32px); }
.stat strong small { font-size: 14px; }
.stat span { display: block; color: var(--muted); font-size: 12px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 19px; }
.task { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border: 0; }
.task > div { min-width: 0; }
.task b { display: block; font-size: 14px; }
.task small { color: var(--muted); font-size: 12px; }
.upload { margin-top: 14px; padding: 13px; border: 1px dashed var(--edge); border-radius: var(--radius-control); background: var(--garden); }
.upload label { font-size: 14px; font-weight: 600; }
.upload input { max-width: 100%; font-size: 13px; }
.upload input::file-selector-button { padding: 5px 9px; min-height: 44px; border: 1px solid var(--edge); border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }

/* Play area and dialogs use the same palette. */
.game-board { margin-top: 16px; padding: 23px 12px; min-height: 255px; border-radius: var(--radius-card); background: linear-gradient(var(--garden) 0 34%, var(--mint) 34% 74%, var(--garden) 74%); }
.game-sky { display: flex; justify-content: space-between; max-width: 400px; margin: auto; font-size: clamp(26px, 6vw, 40px); }
.game-sun { color: var(--warm-ink); }
.stones { display: flex; justify-content: center; flex-wrap: wrap; gap: clamp(7px, 2vw, 15px); margin-top: 20px; }
.stone { min-width: 62px; min-height: 46px; padding: 7px 12px; border: 1px solid var(--edge); border-radius: 999px; background: var(--paper); box-shadow: 0 4px var(--edge); font-size: clamp(15px, 3vw, 20px); font-weight: 800; }
.stone:not(:disabled):hover { background: var(--peach); }
.stone.passed { background: var(--leaf); border-color: var(--green); box-shadow: 0 4px var(--green); }
.game-status { min-height: 42px; margin-top: 22px; text-align: center; font-size: 14px; font-weight: 600; }
.game-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 16px; font-size: 13px; }
footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; max-width: 1440px; margin: 25px auto 0; padding: 20px max(var(--gutter), 82px) 20px var(--gutter); border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer small { margin-inline-start: auto; font-size: 12px; }
dialog { width: min(590px, calc(100vw - 28px)); max-height: 88dvh; overflow: auto; padding: clamp(16px, 4vw, 32px); color: var(--ink); box-shadow: 0 18px 64px #203a3240; }
dialog::backdrop { background: #203a3280; }
#close-modal { position: absolute; top: 9px; right: 9px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--leaf); color: var(--green); font-size: 22px; }
#modal-body { padding-top: 18px; }
.modal-title { margin: 8px 31px 12px 0; font-size: clamp(21px, 4vw, 28px); line-height: 1.3; letter-spacing: -.025em; }
.modal-mark { color: var(--green); font-size: 34px; }
.modal-copy, .modal-note { overflow-wrap: anywhere; }
.modal-note { margin-top: 13px; color: var(--muted); font-size: 12px; }
.name-input { display: block; margin: 7px 0 13px; }
.schedule { padding-inline-start: 21px; }
.schedule li { padding-block: 4px; }
#toast { position: fixed; z-index: 100; bottom: 16px; left: 50%; max-width: calc(100vw - 28px); padding: 11px 16px; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; border-radius: var(--radius-control); background: var(--green); color: #fff; box-shadow: var(--shadow); font-size: 13px; transition: opacity .18s, transform .18s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Fixed contact controls and their shared panel. */
.contact-dock {
    --dock-edge: 18px;
    --contact-size: 52px;
    position: fixed;
    z-index: 15;
    right: max(var(--dock-edge), env(safe-area-inset-right));
    bottom: max(var(--dock-edge), env(safe-area-inset-bottom));
}
.contact-actions { display: flex; flex-direction: column; gap: 10px; }
.contact-button {
    position: relative;
    display: grid;
    width: var(--contact-size);
    height: var(--contact-size);
    place-items: center;
    border: 2px solid var(--paper);
    border-radius: 50%;
    color: #fff;
    box-shadow: 0 5px 15px #203a3238;
    transition: transform .18s ease;
}
.contact-button svg { width: 30px; height: 30px; }
.contact-button:hover { transform: translateY(-3px); }
.contact-zalo { background: #0068ff; }
.contact-messenger { background: linear-gradient(145deg, #0866ff, #633deb 73%, #9637e4); }
.contact-chat { background: var(--green); }
.contact-button::after {
    content: '';
    position: absolute;
    inset: -3px;
    border: 2px solid var(--orange);
    border-radius: inherit;
    opacity: 0;
    pointer-events: none;
    animation: contact-pulse 1.8s ease-out 2;
}
.contact-zalo::after { animation-delay: .4s; }
.contact-messenger::after { animation-delay: .7s; }
.contact-chat::after { animation-delay: 1s; }
@keyframes contact-pulse {
    15% { opacity: 1; }
    75%, 100% { opacity: 0; transform: scale(1.32); }
}
.contact-panel {
    position: absolute;
    right: calc(100% + 12px);
    bottom: 0;
    width: min(410px, calc(100vw - 2 * var(--dock-edge) - var(--contact-size) - 12px));
    max-height: calc(100dvh - var(--header-height) - 2 * var(--dock-edge));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    background: var(--paper);
    box-shadow: 0 12px 32px #203a3238;
}
.contact-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px 6px 16px; background: var(--green); color: #fff; }
.contact-head h2 { margin: 0; font-size: 16px; }
.contact-close { flex: 0 0 44px; height: 44px; border: 0; border-radius: 50%; background: #ffffff19; color: inherit; font-size: 23px; }
.contact-close:focus-visible { outline-color: var(--orange); outline-offset: 1px; }
.contact-body { overflow: auto; overscroll-behavior: contain; padding: 14px 16px; font-size: 13px; }
.contact-note { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.chat-bubble { margin: 0; padding: 10px 13px; border-radius: var(--radius-control); background: var(--mint); }
.chat-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chat-topics button { min-height: 44px; padding: 4px 10px; border: 1px solid var(--edge); border-radius: 999px; background: var(--paper); color: var(--green); font-size: 12px; font-weight: 700; }
.chat-topics button:hover, .chat-topics button[aria-pressed="true"] { background: var(--garden); }
.chat-topics button[aria-pressed="true"] { border-color: var(--green); }

@media (max-width: 1120px) {
    :root { --header-height: 68px; }
    .header-inner { padding-inline: 14px; gap: 8px; }
    .brand { min-width: 0; }
    .brand img { width: clamp(120px, 39vw, 158px); }
    #account { max-width: min(40%, 160px); font-size: 12px; padding-inline: 8px; }
    #menu { display: grid; flex: 0 0 44px; height: 44px; place-items: center; margin-inline-start: auto; }
    #primary-nav {
        display: none;
        position: absolute;
        inset: 100% 0 auto;
        max-height: calc(100dvh - var(--header-height));
        overflow: auto;
        overscroll-behavior: contain;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 8px;
        padding: 10px 14px 14px;
        border-bottom: 1px solid var(--line);
        background: var(--cream);
        box-shadow: var(--shadow);
    }
    #primary-nav.open { display: grid; }
    #primary-nav a { padding-inline: 9px; white-space: normal; }
}
@media (max-width: 820px) {
    .split, .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .aside .btn { width: auto; max-width: 100%; margin-inline-end: 5px; }
    .learning-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
    .hero, .banner { grid-template-columns: minmax(0, 1fr); }
    .hero { margin: 14px 0 27px; }
    .hero h1 { font-size: clamp(28px, 8vw, 42px); }
    .hero p { margin: 16px 0; }
    .hero .art { width: 100%; max-width: 380px; margin-inline: auto; }
    .activity-grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .activity { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; padding: 11px; }
    .activity-copy { grid-area: 1 / 2; }
    .activity-arrow { grid-area: 1 / 3; width: 27px; height: 27px; }
    .section { margin-bottom: 30px; }
    footer small { margin-inline-start: 0; }
}
@media (max-width: 820px) and (orientation: portrait), (max-width: 520px) {
    .contact-dock { --dock-edge: 12px; --contact-size: 46px; }
    .contact-actions { flex-direction: row; gap: 7px; }
    .contact-button svg { width: 27px; height: 27px; }
    .contact-panel {
        right: 0;
        bottom: calc(100% + 10px);
        width: min(410px, calc(100vw - 2 * var(--dock-edge)));
        max-height: calc(100dvh - var(--header-height) - 2 * var(--dock-edge) - var(--contact-size) - 10px);
    }
    footer { padding-inline: var(--gutter); padding-bottom: 75px; }
}
@media (max-width: 540px) {
    .grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
    .actions > .btn { width: 100%; }
}
@media (max-width: 380px) {
    .hero { padding-inline: 16px; }
    .step i { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .btn, #toast, .contact-button { transition: none; }
    .contact-button::after { animation: none; }
}
