/* ============================================================
   MirAI User Manual — unified design system
   Brand source: MirAI-X desktop client (see brand-spec.md)
   Navy chrome · blue primary (#2563eb) · red signature (#e11d2a)
   Light paper body, print/PDF (A4) first. System fonts only.
   ============================================================ */

:root {
    /* Brand chrome */
    --navy:        #0c1a2e;
    --navy-2:      #13243d;
    --navy-line:   #24344c;

    /* Primary (interactive / structure) — app Log-In blue */
    --primary:        #2563eb;
    --primary-dark:   #1d4ed8;
    --primary-light:  #eef4ff;
    --primary-tint:   #dbe7fe;
    --primary-gradient: linear-gradient(135deg, #2f6bf0, #1d4ed8);

    /* Signature accent — the red crescent / X */
    --brand-red:       #e11d2a;
    --brand-red-dark:  #b91c22;
    --brand-red-light: #fef2f3;

    /* Ink + surfaces */
    --text:        #0f1b2d;   /* headings */
    --ink-body:    #2a3a4f;   /* paragraphs / list text */
    --text-muted:  #5b6b80;
    --text-light:  #93a1b3;
    --bg:          #ffffff;
    --bg-alt:      #f6f8fb;
    --surface:     #ffffff;
    --bg-code:     #eef2f7;
    --border:      #e3e8ef;
    --border-light:#eef2f7;

    /* Status */
    --accent:  #0ea5e9;
    --success: #16a34a;
    --warning: #d97706;
    --danger:  #e11d2a;

    /* Sidebar */
    --sidebar-width: 312px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(13,27,49,0.06);
    --shadow-md: 0 4px 10px -3px rgba(13,27,49,0.10), 0 2px 4px -2px rgba(13,27,49,0.06);
    --shadow-lg: 0 16px 32px -12px rgba(13,27,49,0.16), 0 4px 8px -4px rgba(13,27,49,0.08);

    --radius:    10px;
    --radius-sm: 7px;
    --base-font: 16px;
    --reading-scale: 1;          /* elder-readability multiplier — set by manual.js */

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Malgun Gothic", "Yu Gothic", "Hiragino Sans", sans-serif;
    --font-mono: "SF Mono", "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: calc(var(--base-font) * var(--reading-scale)); }
/* Reader-controlled text size — screen only (print keeps its fixed A4 scale). */
html[data-reading="l"]  { --reading-scale: 1.15; }
html[data-reading="xl"] { --reading-scale: 1.35; }
body {
    font-family: var(--font-sans);
    color: var(--ink-body);
    background: var(--bg);
    line-height: 1.7;
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* === GLOBAL SCROLLBAR === */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c2ccd9; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #9aa7b8; background-clip: padding-box; border: 2px solid transparent; }
* { scrollbar-width: thin; scrollbar-color: #c2ccd9 transparent; }

::selection { background: var(--primary-tint); color: var(--text); }

/* === LAYOUT === */
.skip-link { position: absolute; left: 16px; top: -52px; z-index: 1000; padding: 11px 16px; border-radius: var(--radius-sm); background: var(--primary); color: #fff; text-decoration: none; font-weight: 700; box-shadow: var(--shadow-md); transition: top 0.2s ease; }
.skip-link:focus { top: 16px; }
.wrapper { display: flex; min-height: 100vh; }

/* === SIDEBAR === */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width); height: 100vh;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 0 0 26px;
    z-index: 100;
    display: flex; flex-direction: column;
    transition: transform 0.3s ease;
}
.sidebar.collapsed { transform: translateX(-100%); }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #c2ccd9; border-radius: 10px; }

/* Masthead — navy brand block */
.sidebar-header {
    background: linear-gradient(168deg, var(--navy-2) 0%, var(--navy) 100%);
    color: #fff;
    padding: 26px 22px 22px;
    margin-bottom: 18px;
    border-bottom: 3px solid var(--brand-red);
    position: relative;
}
.sidebar-logo {
    font-size: 25px; font-weight: 800; letter-spacing: -0.02em;
    color: #ffffff; line-height: 1; display: flex; align-items: baseline;
}
/* the MirAI-X signature: red moon dot + red X */
.sidebar-logo::before {
    content: ""; width: 9px; height: 9px; border-radius: 50%;
    background: var(--brand-red); display: inline-block;
    margin-right: 7px; box-shadow: 0 0 10px rgba(225,29,42,0.55);
    align-self: center;
}
.sidebar-logo::after { content: "-X"; color: var(--brand-red); font-weight: 800; }
.sidebar-subtitle {
    font-family: var(--font-mono); font-size: 11px; color: #9fb2cc;
    text-transform: uppercase; letter-spacing: 0.08em; margin-top: 9px; font-weight: 500;
}
.language-switcher { display: flex; gap: 6px; margin-top: 16px; }
.language-switcher a {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; height: 28px; padding: 0 10px;
    border: 1px solid rgba(255,255,255,0.18); border-radius: var(--radius-sm);
    color: #c8d4e4; background: rgba(255,255,255,0.04);
    text-decoration: none; font-size: 12px; font-weight: 700;
    font-family: var(--font-mono); transition: all 0.18s ease;
}
.language-switcher a:hover { color: #fff; border-color: rgba(255,255,255,0.45); background: rgba(255,255,255,0.10); }
.language-switcher a[aria-current="page"] { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: 0 2px 10px rgba(37,99,235,0.4); }

/* Search */
.search-box { position: relative; margin: 0 16px 22px; }
.search-box input {
    width: 100%; padding: 11px 14px 11px 40px;
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: var(--font-sans);
    background: var(--bg-alt) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235b6b80' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 13px center;
    color: var(--text); outline: none; transition: all 0.18s ease;
}
.search-box input:focus { border-color: var(--primary); background-color: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,0.14); }
.search-box input::placeholder { color: var(--text-light); }

/* Navigation */
.toc-list { list-style: none; flex: 1; overflow-y: auto; padding: 0 12px; }
.toc-section { margin-bottom: 2px; }
.toc-section > a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; color: var(--text); text-decoration: none;
    border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
    transition: background 0.16s ease, color 0.16s ease;
    border-left: 3px solid transparent; line-height: 1.3;
}
.toc-section > a:hover { background: var(--primary-light); color: var(--primary-dark); }
.toc-section.active > a { background: var(--primary-light); color: var(--primary-dark); border-left-color: var(--primary); }
.toc-section > a .num {
    display: inline-flex; align-items: center; justify-content: center;
    width: 23px; height: 23px; border-radius: 6px;
    background: var(--bg-alt); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 12px; font-weight: 700;
    font-family: var(--font-mono); flex-shrink: 0; transition: all 0.16s;
}
.toc-section > a:hover .num,
.toc-section.active > a .num { background: var(--primary); border-color: var(--primary); color: #fff; }
.toc-sub { list-style: none; padding-left: 22px; margin: 3px 0 9px; border-left: 1px solid var(--border); margin-left: 23px; }
.toc-sub li { margin-bottom: 1px; }
.toc-sub li a {
    display: block; padding: 5px 12px; color: var(--text-muted);
    text-decoration: none; border-radius: 5px; font-size: 13px; font-weight: 500;
    transition: all 0.14s; position: relative;
}
.toc-sub li a:hover { color: var(--primary-dark); background: var(--primary-light); }

/* === MAIN CONTENT === */
.content {
    margin-left: var(--sidebar-width); flex: 1;
    padding: 56px 64px 100px;
    max-width: min(900px, calc(100vw - var(--sidebar-width) - 80px));
    margin-right: auto; transition: margin-left 0.3s ease;
}
.content h1 { font-size: 2.4rem; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.022em; color: var(--text); line-height: 1.12; text-wrap: balance; }
.content h2 {
    font-size: 1.7rem; font-weight: 750; margin-top: 68px; margin-bottom: 24px;
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
    scroll-margin-top: 24px; letter-spacing: -0.018em; color: var(--text);
    position: relative; line-height: 1.2; text-wrap: balance;
}
.content h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 52px; height: 3px; background: var(--primary); border-radius: 3px; }
.content h3 { font-size: 1.24rem; font-weight: 700; margin-top: 42px; margin-bottom: 14px; scroll-margin-top: 24px; color: var(--text); letter-spacing: -0.01em; }
.content h4 { font-size: 0.78rem; font-weight: 700; margin-top: 28px; margin-bottom: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); }
.content p { margin-bottom: 17px; color: var(--ink-body); font-size: 1rem; }
.content ul, .content ol { margin-bottom: 17px; padding-left: 24px; }
.content li { margin-bottom: 7px; color: var(--ink-body); font-size: 1rem; }
.content li::marker { color: var(--text-light); }
.content li > ul { margin-top: 7px; }
.content strong { color: var(--text); font-weight: 700; }
.content a { color: var(--primary-dark); text-decoration-color: var(--primary-tint); text-underline-offset: 2px; }

section[id] { scroll-margin-top: 24px; }

.version-badge {
    display: inline-flex; align-items: center; gap: 7px;
    background: var(--navy); color: #fff; padding: 6px 14px;
    border-radius: 7px; font-size: 11px; font-weight: 700; margin-bottom: 38px;
    letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--font-mono);
}
.version-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--brand-red); box-shadow: 0 0 8px rgba(225,29,42,0.6); }

/* Quick Start Card */
.quick-start-card {
    background: linear-gradient(180deg, #fbfcfe, var(--bg-alt));
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 26px 30px; margin-bottom: 48px; position: relative;
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.quick-start-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.quick-start-card h3 { margin: 0 0 18px; font-size: 1.05rem; color: var(--text); font-weight: 700; }
.quick-start-card h3 .qs-head-ico { width: 18px; height: 18px; color: var(--primary); vertical-align: -3px; margin-right: 7px; }
.quick-start-steps { list-style: none; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 6px; }
.quick-start-steps li { display: flex; align-items: center; gap: 6px; font-size: 0.92rem; font-weight: 600; color: var(--ink-body); }
.quick-start-steps li a { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; border-radius: var(--radius-sm); padding: 6px 12px; background: #fff; border: 1px solid var(--border); outline-offset: 4px; transition: all 0.16s; }
.quick-start-steps li a:hover { color: var(--primary-dark); border-color: var(--primary); box-shadow: 0 2px 8px rgba(37,99,235,0.14); transform: translateY(-1px); }
.quick-start-steps li .qs-icon { width: 26px; height: 26px; border-radius: 7px; background: var(--primary-light); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 0.16s, color 0.16s; }
.quick-start-steps li .qs-icon svg { width: 15px; height: 15px; }
.quick-start-steps li a:hover .qs-icon { background: var(--primary); color: #fff; }
.quick-start-steps li .qs-arrow { color: var(--text-light); font-size: 15px; margin: 0 2px; }

/* Inline line-icons (detection labels, etc.) + screen-chrome button icons */
.ico { display: inline-block; width: 1.05em; height: 1.05em; vertical-align: -0.16em; color: var(--primary); flex-shrink: 0; }
.btn-ico { width: 20px; height: 20px; display: block; }
.sidebar-toggle .btn-ico { width: 21px; height: 21px; }

/* Callout boxes */
.info-box, .warning-box, .tip-box { padding: 16px 20px 16px 50px; border-radius: var(--radius); margin: 24px 0; font-size: 0.95rem; line-height: 1.65; position: relative; border: 1px solid; }
.info-box  { background: var(--primary-light);  border-color: var(--primary-tint); }
.warning-box { background: #fffaf0; border-color: #fde6bf; }
.tip-box   { background: #f0fbf4; border-color: #bfe9cd; }
.info-box::before, .warning-box::before, .tip-box::before { position: absolute; left: 18px; top: 16px; font-size: 17px; line-height: 1.4; }
.info-box::before { content: "ℹ"; color: var(--primary); font-weight: 700; }
.warning-box::before { content: "⚠"; color: var(--warning); }
.tip-box::before { content: "✓"; color: var(--success); font-weight: 700; }
.info-box p, .warning-box p, .tip-box p { margin: 0; color: var(--text); }

/* Steps */
.step-list { counter-reset: step-counter; list-style: none; padding-left: 0; }
.step-list li { counter-increment: step-counter; position: relative; padding-left: 52px; margin-bottom: 22px; padding-bottom: 22px; border-bottom: 1px solid var(--border-light); font-size: 1rem; color: var(--ink-body); }
.step-list li:last-child { border-bottom: none; padding-bottom: 0; }
.step-list li::before { content: counter(step-counter); position: absolute; left: 0; top: -2px; width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; font-family: var(--font-mono); box-shadow: 0 2px 6px rgba(37,99,235,0.28); }

/* FAQ */
.faq-item { margin-bottom: 12px; padding: 20px 24px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); transition: all 0.18s ease; }
.faq-item:hover { border-color: var(--primary-tint); box-shadow: var(--shadow-md); }
.faq-item h3 { margin: 0 0 8px 0; color: var(--text); font-size: 1rem; font-weight: 700; padding-left: 22px; position: relative; }
.faq-item h3::before { content: "Q"; position: absolute; left: 0; top: 0; color: var(--primary); font-weight: 800; font-family: var(--font-mono); }
.faq-item p { margin: 0; font-size: 0.94rem; color: var(--ink-body); line-height: 1.65; }

/* Code */
code { background: var(--bg-code); padding: 2px 7px; border-radius: 5px; font-family: var(--font-mono); font-size: 0.86em; color: var(--primary-dark); border: 1px solid var(--border); }

/* Figures / screenshots — app-window capture frame */
.manual-figure {
    margin: 30px 0; border-radius: var(--radius); overflow: hidden;
    border: 1px solid var(--border); box-shadow: var(--shadow-md);
    background: var(--surface); break-inside: avoid;
}
.manual-figure::before {
    content: ""; display: block; height: 32px;
    background:
        radial-gradient(circle at 18px 16px, var(--brand-red) 0 4px, transparent 5px),
        radial-gradient(circle at 36px 16px, #4a5d78 0 4px, transparent 5px),
        radial-gradient(circle at 54px 16px, #4a5d78 0 4px, transparent 5px),
        linear-gradient(180deg, var(--navy-2), var(--navy));
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.manual-figure img { display: block; width: 100%; height: auto; border: none; border-radius: 0; box-shadow: none; background: var(--bg-alt); }
.manual-figure figcaption { padding: 11px 18px; font-size: 0.83rem; color: var(--text-muted); line-height: 1.5; background: var(--surface); border-top: 1px solid var(--border-light); font-family: var(--font-mono); }

/* Tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 22px 0; font-size: 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
th, td { padding: 12px 18px; text-align: left; border-bottom: 1px solid var(--border-light); }
th { background: var(--navy); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #d6e0ee; font-family: var(--font-mono); }
tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) td { background: var(--bg-alt); }
tbody tr:hover td { background: var(--primary-light); }
td strong { color: var(--text); }

/* Glossary */
.glossary-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.glossary-item { padding: 14px 20px; background: var(--bg-alt); border-radius: var(--radius-sm); border: 1px solid var(--border-light); border-left: 3px solid var(--primary); }
.glossary-item dt { font-weight: 700; color: var(--text); font-size: 0.95rem; margin-bottom: 3px; }
.glossary-item dd { color: var(--ink-body); font-size: 0.9rem; line-height: 1.6; margin: 0; }

/* Back to top + print buttons */
.back-to-top { position: fixed; bottom: 28px; right: 28px; width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff; border: none; cursor: pointer; font-size: 19px; display: none; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 999; transition: all 0.25s ease; }
.back-to-top:hover { background: var(--primary-dark); transform: translateY(-2px); }
.back-to-top.visible { display: flex; }
.print-btn { position: fixed; bottom: 28px; left: 28px; width: 46px; height: 46px; border-radius: 12px; background: var(--navy); color: #fff; border: none; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); z-index: 999; transition: all 0.25s ease; }
.print-btn:hover { background: var(--navy-2); transform: translateY(-2px); }

/* Sidebar toggle (hamburger) */
.sidebar-toggle { display: none; position: fixed; top: 16px; left: 16px; width: 42px; height: 42px; border-radius: 10px; background: var(--navy); border: none; color: #fff; cursor: pointer; z-index: 200; align-items: center; justify-content: center; box-shadow: var(--shadow-md); font-size: 19px; transition: all 0.18s; }
.sidebar-toggle:hover { background: var(--navy-2); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid rgba(37,99,235,0.4); outline-offset: 2px; }

/* Search no-results */
.search-empty { display: none; padding: 20px; text-align: center; color: var(--text-muted); font-size: 0.92rem; }
.search-empty.visible { display: block; }
mark { background: #fde68a; color: inherit; border-radius: 2px; padding: 0 1px; }

/* Footer */
footer { margin-top: 80px; padding: 28px 0; border-top: 1px solid var(--border); font-size: 0.84rem; color: var(--text-light); text-align: center; }

/* === PRINT / PDF (A4) === */
@page { size: A4; margin: 16mm 15mm; }
@media print {
    :root { --base-font: 10.5pt; }
    html { font-size: 10.5pt; }
    body { font-size: 10.5pt; line-height: 1.5; color: #1a2333; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .sidebar, .back-to-top, .print-btn, .sidebar-toggle, .skip-link, .a11y-rail, .lightbox, .fig-zoom-hint { display: none !important; }
    .wrapper { display: block; }
    .content { margin: 0 !important; padding: 0; max-width: 100%; }
    .content h1 { font-size: 24pt; }
    .content > section:not(:first-of-type) { break-before: page; }
    .content h2 { font-size: 15pt; margin-top: 26pt; break-after: avoid; }
    .content > section:not(:first-of-type) > h2 { margin-top: 0; }
    .content h3, .content h4 { break-after: avoid; }
    .content h3 { font-size: 12pt; margin-top: 16pt; }
    p, li { orphans: 3; widows: 3; }
    .manual-figure, table, .faq-item, .info-box, .warning-box, .tip-box, .glossary-item, .quick-start-card { break-inside: avoid; }
    .step-list li { break-inside: avoid; }
    .manual-figure { box-shadow: none; border: 1px solid #b8c2d0; }
    .manual-figure::before { height: 18px; background: #dce3ec; border-bottom: 1px solid #b8c2d0; background-image: radial-gradient(circle at 14px 9px, #c0392b 0 3px, transparent 4px), radial-gradient(circle at 28px 9px, #8a99ad 0 3px, transparent 4px), radial-gradient(circle at 42px 9px, #8a99ad 0 3px, transparent 4px); }
    .manual-figure img { border: none; width: auto; max-width: 100%; max-height: 165mm; height: auto; margin: 0 auto; }
    th { background: var(--navy) !important; color: #fff !important; }
    thead { display: table-header-group; }
    tr { break-inside: avoid; }
    a { color: var(--primary-dark) !important; }
    * { animation: none !important; transition: none !important; }
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
    /* Sidebar becomes an off-canvas drawer; the hamburger is the way in. */
    .sidebar {
        display: flex;
        width: min(86vw, 320px);
        transform: translateX(-100%);
        box-shadow: none;
    }
    .sidebar.open { transform: translateX(0); box-shadow: 18px 0 48px rgba(8,15,28,0.28); }
    .sidebar-toggle { display: flex; }
    .content { margin-left: 0; padding: 64px 20px 88px; max-width: 100%; }
    .content h1 { font-size: 1.9rem; }
    .content h2 { font-size: 1.4rem; }
    /* Wide tables scroll horizontally instead of breaking the page width. */
    .content table { display: block; width: max-content; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .toc-section > a { min-height: 44px; }
    :root { --base-font: 15px; }
}

/* Mobile drawer scrim — element injected by manual.js, tap to dismiss. */
.sidebar-scrim {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(10,18,32,0.46);
    opacity: 0; visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
    -webkit-tap-highlight-color: transparent;
}
.sidebar-scrim.visible { opacity: 1; visibility: visible; }
body.nav-open { overflow: hidden; }

/* Small phones */
@media (max-width: 480px) {
    :root { --base-font: 14.5px; }
    .content { padding: 58px 16px 80px; }
    .content h1 { font-size: 1.62rem; }
    .quick-start-card { padding: 22px 18px; }
    .step-list li { padding-left: 46px; }
    .info-box, .warning-box, .tip-box { padding-left: 44px; }
    .back-to-top, .print-btn { width: 44px; height: 44px; bottom: 18px; }
    .back-to-top { right: 18px; }
    .print-btn { left: 18px; }
}
@media (min-width: 901px) and (max-width: 1100px) {
    .sidebar-toggle { display: flex; }
    .sidebar.collapsed + .content, .content.sidebar-hidden { margin-left: 0; max-width: 100%; }
}
@media (min-width: 901px) and (max-width: 1199px) {
    .content { padding: 44px 44px 80px; max-width: calc(100vw - var(--sidebar-width) - 40px); margin-left: var(--sidebar-width); margin-right: auto; }
}
@media (min-width: 1200px) and (max-width: 1499px) {
    .content { padding: 52px 56px 100px; max-width: 820px; margin-left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width) - 820px) / 2); }
}
@media (min-width: 1500px) and (max-width: 1799px) {
    .content { max-width: 868px; margin-left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width) - 868px) / 2); }
}
@media (min-width: 1800px) {
    .content { max-width: 900px; margin-left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width) - 900px) / 2); }
    :root { --base-font: 17px; }
}

/* Motion */
@media (prefers-reduced-motion: no-preference) {
    @keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
    .content > section { animation: fadeInUp 0.4s ease both; }
}

/* === Elder-readability: text-size control + image lightbox (screen only) === */
/* Floating text-size rail, docked to the right edge, always reachable. */
.a11y-rail {
    position: fixed; right: 0; top: 50%; transform: translateY(-50%);
    z-index: 998; width: auto;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 12px 10px;
    background: var(--surface); border: 1px solid var(--border); border-right: none;
    border-radius: 14px 0 0 14px; box-shadow: var(--shadow-lg);
}
.a11y-rail .a11y-label {
    font-family: var(--font-mono); font-size: 9px; font-weight: 700;
    letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted);
    white-space: nowrap; text-align: center;
}
.a11y-sizes { display: flex; flex-direction: column; gap: 6px; }
.a11y-size {
    width: 42px; height: 42px; border: 1px solid var(--border); background: var(--bg-alt);
    color: var(--text); border-radius: 9px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-sans); font-weight: 800; line-height: 1;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.a11y-size:hover { border-color: var(--primary); color: var(--primary); }
.a11y-size[aria-pressed="true"] { background: var(--primary); color: #fff; border-color: var(--primary); box-shadow: 0 2px 6px rgba(37,99,235,0.30); }
.a11y-size.s1 { font-size: 13px; }
.a11y-size.s2 { font-size: 16px; }
.a11y-size.s3 { font-size: 21px; }

/* Screenshots read as clickable — cursor + a magnifier badge in the title bar. */
.manual-figure { position: relative; cursor: zoom-in; }
.fig-zoom-hint {
    position: absolute; top: 5px; right: 10px; z-index: 3;
    width: 22px; height: 22px; border-radius: 6px;
    background: rgba(255,255,255,0.14); color: #e7eefb;
    display: flex; align-items: center; justify-content: center;
    opacity: 0.85; transition: background 0.16s, opacity 0.16s; pointer-events: none;
}
.fig-zoom-hint svg { width: 13px; height: 13px; }
.manual-figure:hover .fig-zoom-hint, .manual-figure:focus-within .fig-zoom-hint { opacity: 1; background: rgba(255,255,255,0.26); }

/* Lightbox — full-screen screenshot viewer (built + toggled by manual.js). */
.lightbox {
    position: fixed; inset: 0; z-index: 1000; display: none;
    align-items: center; justify-content: center; padding: clamp(12px, 4vw, 36px);
    background: rgba(7,13,24,0.88); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.lightbox.open { display: flex; }
.lightbox-stage {
    position: relative; display: flex; flex-direction: column;
    max-width: 96vw; max-height: 92vh;
    background: var(--navy); border-radius: 14px; overflow: hidden;
    box-shadow: 0 30px 90px rgba(0,0,0,0.55);
}
.lightbox-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; background: #0a1320; }
.lightbox-img { display: block; margin: 0 auto; max-width: 100%; height: auto; cursor: zoom-in; transition: max-width 0.2s ease; }
.lightbox.zoomed .lightbox-img { max-width: 180%; cursor: zoom-out; }
.lightbox-caption { flex: none; padding: 12px 18px; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.5; color: #cdd8ea; background: var(--navy); border-top: 1px solid rgba(255,255,255,0.08); }
.lightbox-close {
    position: fixed; top: 16px; right: 16px; z-index: 2;
    width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
    background: #fff; color: var(--navy);
    display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.lightbox-close svg { width: 20px; height: 20px; }
.lightbox-close:hover { background: var(--brand-red); color: #fff; }

@media (max-width: 480px) {
    .a11y-rail { padding: 9px 7px; gap: 6px; border-radius: 12px 0 0 12px; }
    .a11y-size { width: 38px; height: 38px; }
    .a11y-size.s3 { font-size: 19px; }
}
