/* ===================================================================
 *  DeDucktion – Manual
 *  Shares the theme tokens of index.css so the manual and the
 *  calculator always look like one product. Math is rendered by KaTeX.
 *  =================================================================== */

/*  Theme (identical tokens to index.css)  */
:root {
    --bg: #0f1726;
    --bg-soft: #141b2d;
    --bg-glass: #1a2238;
    --bg-grey: #222a42;

    --border-glass: #2f3a5f;

    --bg-title: #a6abc4;
    --bg-tree-line: #9aa0b5;

    --text: #e6edf3;
    --text-muted: #9da7b3;

    --accent: #4ea1ff;
    --accent-soft: #244468;

    --ok: #34d399;
    --err: #f87171;

    --radius: 14px;

    /* manual-only tokens */
    --serif: "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
    --sans: Inter, system-ui, sans-serif;
    --measure: min(80%, 80rem);

    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #f4f6fa;
    --bg-soft: #fafbfc;
    --bg-glass: #ffffff;
    --bg-grey: #eef1f6;

    --border-glass: #dde2ea;

    --bg-title: #1f2937;
    --bg-tree-line: #374151;

    --text: #111827;
    --text-muted: #6b7280;

    --accent: #2563eb;
    --accent-soft: #dbeafe;

    --ok: #059669;
    --err: #dc2626;

    color-scheme: light;
}

/*  Base  */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--serif);
    font-size: 1.0625rem;
    line-height: 1.65;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        transition: none;
    }
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/*  KaTeX sizing  */
.ktx .katex {
    font-size: 1.06em;
}

/*  Top bar  */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-glass);
    font-family: var(--sans);
}

.back-link {
    font-size: 0.9rem;
    color: var(--text-muted);
}
.back-link:hover {
    color: var(--accent);
    text-decoration: none;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
    border-radius: 40px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text);
    font-size: 0.95rem;
}

.icon-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    transform: scale(1.05);
}

/*  Page column  */
.page {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 32px 22px 60px;
}

/*  Title page  */
.titlepage {
    text-align: center;
    padding: 56px 16px 44px;
    margin-bottom: 36px;
    border-bottom: 1px solid var(--border-glass);
}

.kicker {
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgb(78, 75, 120);
    margin: 0 0 14px;
}

.titlepage h1 {
    margin: 0;
    font-size: clamp(2.6rem, 7vw, 3.8rem);
    font-weight: 800;
    letter-spacing: -0.01em;
    color: rgb(78, 75, 120);
    font-family: var(--sans);
}

.subtitle {
    margin: 8px 0 26px;
    font-size: 1.25rem;
    font-style: italic;
    color: var(--text-muted);
}

.authors {
    margin: 0 0 6px;
    font-size: 1.05rem;
}
.authors .dot {
    margin: 0 10px;
    color: var(--text-muted);
}

.meta {
    margin: 0;
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--text-muted);
}

/*  Headings  */
h2,
h3 {
    font-family: var(--sans);
    color: var(--bg-title);
    line-height: 1.25;
}

h2 {
    font-size: 1.7rem;
    font-weight: 800;
    margin: 56px 0 16px;
}
h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 38px 0 12px;
}

/*  Inline table of contents  */
.toc {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 18px 24px;
    margin-bottom: 44px;
    font-family: rgb(78, 75, 120);
}

.toc h2 {
    margin: 0 0 8px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgb(78, 75, 120);
}

.toc ol {
    list-style: none;
    margin: 0;
    padding-left: 0;
    line-height: 1.9;
}
.toc ol ol {
    padding-left: 1.3em;
}

.badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    vertical-align: middle;
}

/*  Floating side TOC  */
.side-toc {
    position: fixed;
    top: 90px;
    left: 20px;
    width: 200px;
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 0.82rem;
    line-height: 1.5;
    opacity: 0;
    transform: translateX(-8px);
    pointer-events: none;
    transition:
        opacity 0.25s ease,
        transform 0.25s ease;
    z-index: 15;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.side-toc.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* only on screens wide enough that it doesn't cover the text */
@media (max-width: 1400px) {
    .side-toc {
        display: none;
    }
}

.side-toc-title {
    margin: 0 0 6px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.side-toc ol {
    list-style: none;
    margin: 0;
    padding: 0;
}
.side-toc ol ol {
    padding-left: 14px;
}
.side-toc li {
    margin: 3px 0;
}

.side-toc a {
    display: block;
    padding: 2px 8px;
    border-radius: 6px;
    color: var(--text-muted);
}

.side-toc a:hover {
    color: var(--text);
    text-decoration: none;
    background: var(--bg-grey);
}

.side-toc a.active {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
}

.secno {
    color: var(--accent);
    margin-right: 0.35em;
}

section > p {
    margin: 0 0 1em;
}

/*  Environments (Definition / Example / Remark)  */
.env {
    border: 1px solid var(--border-glass);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    background: var(--bg-glass);
    padding: 16px 20px;
    margin: 22px 0;
}

.env-head {
    margin: 0 0 10px;
    font-family: var(--sans);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.env-name {
    font-weight: 400;
    color: var(--text-muted);
}

.env p:last-child,
.env ol:last-child,
.env ul:last-child {
    margin-bottom: 0;
}
.env ol,
.env ul {
    margin: 0 0 0.6em;
    padding-left: 1.4em;
}
.env li {
    margin-bottom: 0.35em;
}

.env-ex {
    border-left-color: var(--bg-tree-line);
}
.env-rem {
    border-left-color: var(--text-muted);
    background: var(--bg-soft);
}

.m-list {
    list-style: none;
    padding-left: 0.4em;
}
.m-list li {
    margin-bottom: 0.5em;
}

/*  Rule groups (Definition 2.2.1)  */
.rule-group {
    padding: 14px 0 18px;
}

.rule-group + .rule-group {
    border-top: 1px solid var(--border-glass);
}

.rule-group-title {
    margin: 0 0 12px;
    font-family: var(--sans);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.rule-group-title .ktx {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.95rem;
}

.rule-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}

.rule-row + .rule-row {
    margin-top: 10px;
}

.rule-card {
    background: var(--bg-soft);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 10px 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===================================================================
 *  Gentzen-style proof trees in pure HTML/CSS (KaTeX inside)
 *  =================================================================== */
.prf {
    font-size: 1rem;
    line-height: 1.3;
    overflow-x: auto;
    max-width: 100%;
    padding: 4px 2.6em 4px 4px; /* right padding leaves room for rule labels */
}

.rule-card .prf {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.rule-wide {
    grid-column: 1 / -1;
}

.rule-title {
    align-self: flex-start;
    margin: 0 0 10px;
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.prf-center {
    display: flex;
    justify-content: center;
}

.prf-big {
    font-size: 1.12rem;
    margin: 18px 0 8px;
}

.inf {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: bottom;
}

.prem {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1.6em;
    padding: 0 0.35em;
}

.fml {
    white-space: nowrap;
}

.hyp-col {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.05em;
}

.dots {
    color: var(--text-muted);
    line-height: 1;
}
.dots .katex {
    font-size: 0.85em;
}

.bar {
    align-self: stretch;
    position: relative;
    border-top: 1.5px solid var(--bg-tree-line);
    margin: 0.24em 0;
}

.lbl {
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.4em;
    white-space: nowrap;
    color: var(--text-muted);
}

.lbl .katex {
    font-size: 0.66em;
}

.concl {
    white-space: nowrap;
}

/*  Stepper  */
.example-hint {
    font-size: 0.92rem;
    color: var(--text-muted);
    font-style: italic;
}

.example .prf-big {
    background: var(--bg-soft);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 22px 3em 22px 16px;
}

[data-step] {
    transition:
        opacity 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease;
}

[data-step].future {
    opacity: 0;
}

/* highlight what the current step just added */
.fml.now,
.concl.now {
    color: var(--accent);
}

.bar.now {
    border-top-color: var(--accent);
}
.bar.now .lbl {
    color: var(--accent);
}

.stepper-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 12px;
    font-family: var(--sans);
}

.step-btn {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 40px;
    border: 1px solid var(--border-glass);
    background: var(--bg-grey);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.step-btn:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.step-btn:disabled {
    opacity: 0.35;
    cursor: default;
}

/*  Coming soon  */
.coming-soon {
    border: 1px dashed var(--border-glass);
    border-radius: var(--radius);
    background: var(--bg-glass);
    padding: 22px 24px;
    margin: 20px 0;
}

.coming-soon-title {
    margin: 0 0 8px;
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.coming-soon p:last-child {
    margin-bottom: 0;
}

/*  Footnotes  */
.fn a {
    font-family: var(--sans);
    font-size: 0.75em;
}

.footnotes {
    margin-top: 60px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.footnotes hr {
    border: none;
    border-top: 1px solid var(--border-glass);
    width: 30%;
    margin: 0 0 14px;
}

.footnotes ol {
    padding-left: 1.3em;
    margin: 0;
}
.footnotes li {
    margin-bottom: 0.4em;
}
.fn-back {
    margin-left: 4px;
}

.support-note {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/*  Small screens  */
@media (max-width: 560px) {
    body {
        font-size: 1rem;
    }
    .prf-big {
        font-size: 1rem;
    }
    .prem {
        gap: 1em;
    }
    .titlepage {
        padding: 36px 8px 30px;
    }
}

/* Chapter 3 – "Using the Calculator" */

/*  Shared figure / inline code  */
figure {
    margin: 0;
}

figure > figcaption {
    margin-top: 10px;
    font-family: var(--sans);
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
}

code {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82em;
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
    padding: 1px 6px;
    border-radius: 6px;
    color: var(--text);
}

.plain-list {
    padding-left: 0;
    list-style: none;
    margin: 0 0 1em;
}
.plain-list li {
    position: relative;
    padding-left: 1.25em;
    margin-bottom: 0.55em;
}
.plain-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.7em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

/*  3.1 Interface map  */
.ui-map-figure {
    margin: 22px 0;
}

.ui-map {
    display: grid;
    grid-template-columns: 116px 1fr 132px;
    gap: 12px;
    padding: 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    font-family: var(--sans);
}

.uim-region {
    position: relative;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px 10px;
}

.uim-pin {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    box-shadow: 0 0 0 3px var(--bg-soft);
    z-index: 2;
}

.uim-cap {
    margin: 0 0 8px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* sidebar */
.uim-sidebar {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.uim-chip {
    height: 16px;
    border-radius: 6px;
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
}

/* centre column */
.uim-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.uim-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.uim-btn {
    height: 16px;
    width: 52px;
    border-radius: 6px;
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
}

.uim-claim {
    display: flex;
    align-items: center;
    gap: 10px;
}
.uim-field {
    flex: 1;
    height: 18px;
    border-radius: 6px;
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
}
.uim-turnstile {
    font-weight: 700;
    color: var(--text);
}
.uim-turnstile .katex {
    font-size: 0.95em;
}

.uim-canvas {
    min-height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(var(--border-glass) 1px, transparent 1px) 0 0 / 16px 16px,
        var(--bg-glass);
}
.uim-canvas-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--bg-glass);
    padding: 2px 8px;
    border-radius: 6px;
}

/* right panel */
.uim-panel {
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.uim-line {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-grey);
}
.uim-line.short {
    width: 70%;
}

/* legend */
.ui-legend {
    list-style: none;
    margin: 16px 0 0;
    padding: 0;
    font-family: var(--sans);
    font-size: 0.92rem;
}
.ui-legend li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 7px 0;
    border-top: 1px solid var(--border-glass);
}
.ui-legend li:first-child {
    border-top: none;
}
.leg-num {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    transform: translateY(2px);
}
.ui-legend a {
    color: var(--text);
}
.ui-legend a:hover {
    color: var(--accent);
    text-decoration: none;
}

/*  3.2 Rule-button -> schema  */
.rule-schema {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 32px;
    margin: 12px 0;
}
.rs-cell {
    background: var(--bg-soft);
    border: 1px solid var(--border-glass);
    border-radius: 10px;
    padding: 12px 20px 16px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.rs-cap {
    margin: 0;
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-align: center;
}
.rs-rule-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 170px;
    padding: 7px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: var(--bg-grey);
    color: var(--text);
    font-family: var(--sans);
    font-size: 0.9rem;
}
.rs-arrow {
    color: var(--text);
}
.rs-arrow .katex {
    font-size: 1.4em;
}

/* Empty slot that looks like a calculator input field, but is not interactive. */
.ba-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 100px;
    height: 25px;
    padding: 8px 20px;
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    background: var(--bg-grey);
}

/*  Small UI shots (3.3 – 3.5)  */
.ui-shot {
    margin: 18px 0;
}

/* 3.3 claim bar */
.claim-mock {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    font-family: var(--sans);
}
.cm-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.cm-tag {
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.cm-tag .katex {
    font-size: 0.95em;
}
.cm-box {
    display: block;
    padding: 10px 12px;
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
}
.cm-text {
    color: var(--text);
}
.cm-turnstile {
    align-self: center;
    position: relative;
    top: 10px;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
}

/* 3.4 button bar */
.btnbar-mock {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    justify-content: center;
}
.bm-btn {
    font-family: var(--sans);
    font-size: 0.82rem;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: var(--bg-grey);
    color: var(--text-muted);
}
/* 3.4 button reference list */
.btn-ref {
    margin: 18px 0;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 18px;
    align-items: baseline;
    font-family: var(--sans);
}
.btn-ref dt {
    font-weight: 700;
    color: var(--text);
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
    border-radius: 7px;
    padding: 3px 10px;
    justify-self: start;
    white-space: nowrap;
    font-size: 0.9rem;
}
.btn-ref dd {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* 3.5 result, input help, and convert help panels */
.panel-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 18px 0;
}

.panel-col {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-desc {
    font-family: var(--sans);
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

@media (max-width: 760px) {
    .panel-grid {
        grid-template-columns: 1fr;
    }
}

.res-mock,
.help-mock,
.convert-mock {
    padding: 14px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    font-family: var(--sans);
    height: 100%;
}
.rm-title,
.hm-title {
    margin: 0 0 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.rm-line {
    margin: 6px 0;
    font-size: 0.9rem;
    padding-left: 16px;
    position: relative;
}
.rm-line::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.45em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.rm-ok {
    color: var(--ok);
    font-weight: 600;
}
.rm-ok::before {
    background: var(--ok);
}
.rm-err {
    color: var(--err);
    font-weight: 600;
}
.rm-err::before {
    background: var(--err);
}
.rm-ghost {
    color: var(--text-muted);
    font-style: italic;
}
.rm-ghost::before {
    background: var(--text-muted);
}

.hm-row {
    margin: 7px 0;
    font-size: 0.86rem;
    color: var(--text-muted);
}
.hm-row code {
    margin-right: 2px;
}
.hm-row .katex {
    font-size: 0.95em;
}

/* convert-help inside convert-mock (mirrors index.css) */
.convert-help {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.convert-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    padding: 8px 10px;
}

.convert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.convert-row a {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
}

.convert-row a:hover {
    text-decoration: underline;
}

.convert-tag {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid var(--border-glass);
}

.tag-typst {
    color: #3dbdd1;
    background: color-mix(in srgb, #3dbdd1 12%, transparent);
    border-color: color-mix(in srgb, #3dbdd1 25%, transparent);
}

.tag-latex {
    color: var(--ok);
    background: color-mix(in srgb, var(--ok) 12%, transparent);
    border-color: color-mix(in srgb, var(--ok) 25%, transparent);
}

.copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    background: var(--bg-grey);
    border: 1px solid var(--border-glass);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--sans);
    cursor: default;
    opacity: 0.65;
}

@media (max-width: 560px) {
    .ui-map {
        grid-template-columns: 80px 1fr 92px;
    }
    .btn-ref {
        grid-template-columns: 1fr;
        gap: 4px 0;
    }
    .btn-ref dt {
        margin-top: 10px;
    }
}

/*  4. Demo  */
.demo {
    margin: 24px 0;
    padding: 14px;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
}
.demo + .demo {
    margin-top: 20px;
}

.demo-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 2px 2px 12px;
    font-family: var(--sans);
}

.demo-num {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 9px;
    border-radius: 20px;
}

.demo-video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid var(--border-glass);
    background: #000;
}

.demo figcaption {
    text-align: left;
    margin-top: 10px;
}

.demo-fallback {
    margin: 0;
    padding: 16px;
    font-family: var(--sans);
    font-size: 0.9rem;
    color: var(--text-muted);
}
