/* ---------------------------------------------------------------------------
   SVG Sanitizer Playground
   Dark by default, light on request. Every colour is a token so the two themes
   stay in step; nothing is defined only inside a media query.
   --------------------------------------------------------------------------- */

:root {
    --bg:            #0a0d13;
    --surface:       #10151e;
    --surface-2:     #151c27;
    --surface-3:     #1b2432;
    --border:        #222c3c;
    --border-strong: #31405a;

    --text:    #e6ebf4;
    --text-2:  #aab6c8;
    --muted:   #7888a0;

    --accent:      #3ddc84;
    --accent-dim:  #1f9f5c;
    --accent-ink:  #052112;
    --accent-soft: rgba(61, 220, 132, 0.12);

    --danger:      #ff7a7a;
    --danger-soft: rgba(255, 122, 122, 0.12);
    --warn:        #f4c15d;
    --warn-soft:   rgba(244, 193, 93, 0.12);
    --info:        #6aa9ff;

    --add-bg:       rgba(61, 220, 132, 0.10);
    --add-bg-hi:    rgba(61, 220, 132, 0.28);
    --add-border:   rgba(61, 220, 132, 0.45);
    --add-text:     #8ef0b6;

    --del-bg:       rgba(255, 122, 122, 0.10);
    --del-bg-hi:    rgba(255, 122, 122, 0.30);
    --del-border:   rgba(255, 122, 122, 0.45);
    --del-text:     #ffb0b0;

    --shadow:  0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .28);
    --radius:  10px;
    --radius-sm: 7px;

    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;

    --code-size: 12.5px;
    --code-line: 1.65;

    --topbar-h: 60px;

    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg:            #f4f6fa;
    --surface:       #ffffff;
    --surface-2:     #f7f9fc;
    --surface-3:     #eef2f8;
    --border:        #dde3ed;
    --border-strong: #c3ccdb;

    --text:   #16202e;
    --text-2: #45546a;
    --muted:  #6b7a91;

    --accent:      #12a35a;
    --accent-dim:  #0c7a42;
    --accent-ink:  #ffffff;
    --accent-soft: rgba(18, 163, 90, 0.12);

    --danger:      #cf2f3f;
    --danger-soft: rgba(207, 47, 63, 0.10);
    --warn:        #9a6a05;
    --warn-soft:   rgba(244, 193, 93, 0.20);
    --info:        #1d64c9;

    --add-bg:     rgba(18, 163, 90, 0.10);
    --add-bg-hi:  rgba(18, 163, 90, 0.26);
    --add-border: rgba(18, 163, 90, 0.40);
    --add-text:   #0a6d3b;

    --del-bg:     rgba(207, 47, 63, 0.09);
    --del-bg-hi:  rgba(207, 47, 63, 0.24);
    --del-border: rgba(207, 47, 63, 0.38);
    --del-text:   #9d1421;

    --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 8px 24px rgba(16, 32, 56, .07);

    color-scheme: light;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg:            #f4f6fa;
        --surface:       #ffffff;
        --surface-2:     #f7f9fc;
        --surface-3:     #eef2f8;
        --border:        #dde3ed;
        --border-strong: #c3ccdb;

        --text:   #16202e;
        --text-2: #45546a;
        --muted:  #6b7a91;

        --accent:      #12a35a;
        --accent-dim:  #0c7a42;
        --accent-ink:  #ffffff;
        --accent-soft: rgba(18, 163, 90, 0.12);

        --danger:      #cf2f3f;
        --danger-soft: rgba(207, 47, 63, 0.10);
        --warn:        #9a6a05;
        --warn-soft:   rgba(244, 193, 93, 0.20);
        --info:        #1d64c9;

        --add-bg:     rgba(18, 163, 90, 0.10);
        --add-bg-hi:  rgba(18, 163, 90, 0.26);
        --add-border: rgba(18, 163, 90, 0.40);
        --add-text:   #0a6d3b;

        --del-bg:     rgba(207, 47, 63, 0.09);
        --del-bg-hi:  rgba(207, 47, 63, 0.24);
        --del-border: rgba(207, 47, 63, 0.38);
        --del-text:   #9d1421;

        --shadow: 0 1px 2px rgba(16, 32, 56, .06), 0 8px 24px rgba(16, 32, 56, .07);

        color-scheme: light;
    }
}

*, *::before, *::after { box-sizing: border-box; }

/* Several components set their own display, which would otherwise beat the
   hidden attribute and leave every tab panel on screen at once. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

h1, h2, h3, p { margin: 0; }

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

code, kbd, pre { font-family: var(--mono); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 100;
    padding: 10px 14px;
    background: var(--accent);
    color: var(--accent-ink);
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: top .15s;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* --- Top bar ------------------------------------------------------------- */

.topbar {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px;
    min-height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.topbar__brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.topbar__mark { width: 30px; height: 30px; color: var(--accent); flex: 0 0 auto; }

.topbar__text { min-width: 0; }

.topbar h1 {
    font-size: 15px;
    font-weight: 650;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.topbar__text p {
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar__meta { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 550;
    color: var(--text-2);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    white-space: nowrap;
}

.tag--accent {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: transparent;
    font-family: var(--mono);
    font-size: 11.5px;
}

.tag--link { color: var(--text-2); }
.tag--link:hover { color: var(--text); border-color: var(--border-strong); text-decoration: none; }
.tag--link svg { width: 11px; height: 11px; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    padding: 0;
    color: var(--text-2);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
}
.icon-button:hover { color: var(--text); border-color: var(--border-strong); }
.icon-button svg { width: 15px; height: 15px; }

/* --- Banner -------------------------------------------------------------- */

.banner {
    padding: 12px 20px;
    background: var(--warn-soft);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 13px;
}
.banner code { color: var(--warn); }

/* --- Layout -------------------------------------------------------------- */

.layout {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 286px minmax(0, 1fr);
    min-height: 0;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    min-height: 0;
}

.workspace {
    display: grid;
    grid-template-rows: minmax(160px, 34%) minmax(0, 1fr);
    min-width: 0;
    min-height: 0;
}

/* --- Sidebar panels ------------------------------------------------------ */

.panel {
    background: var(--surface);
    padding: 14px 16px 16px;
}

.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.panel__head h2 {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.panel__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 10px;
}

.link-button {
    padding: 0;
    font: inherit;
    font-size: 12px;
    color: var(--accent);
    background: none;
    border: 0;
    cursor: pointer;
}
.link-button:hover { text-decoration: underline; }

.hint { font-size: 11.5px; color: var(--muted); }

.field { display: block; margin-bottom: 8px; }
.field__label {
    display: block;
    font-size: 11.5px;
    color: var(--muted);
    margin-bottom: 4px;
}

input[type="search"],
input[type="number"],
select {
    width: 100%;
    padding: 7px 10px;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
input[type="search"]::placeholder { color: var(--muted); }
input[type="search"]:focus,
input[type="number"]:focus { border-color: var(--border-strong); outline-offset: 0; }

/* --- Version picker ------------------------------------------------------ */

.version-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 244px;
    overflow-y: auto;
    padding: 4px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.version {
    display: grid;
    grid-template-columns: 16px 1fr auto;
    align-items: center;
    gap: 9px;
    padding: 5px 7px;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
}
.version:hover { background: var(--surface-3); }
.version.is-selected { background: var(--accent-soft); }

.version input { margin: 0; accent-color: var(--accent); cursor: pointer; }

.version__name {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text);
}
.version.is-selected .version__name { color: var(--accent); font-weight: 600; }

.version__date { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.version.is-unusable { opacity: .45; cursor: not-allowed; }
.version.is-unusable:hover { background: none; }

.version__empty { padding: 10px; text-align: center; }

/* --- Options ------------------------------------------------------------- */

.options { display: flex; flex-direction: column; gap: 3px; }

.option {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
}
.option:hover { background: var(--surface-2); }

.option__name { font-size: 12.5px; }
.option__hint { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; }

.option input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; }
.option input[type="number"] { width: 78px; font-size: 12px; padding: 4px 7px; font-family: var(--mono); }

/* --- Samples ------------------------------------------------------------- */

.samples { display: flex; flex-direction: column; gap: 4px; }

.sample {
    display: block;
    width: 100%;
    padding: 8px 10px;
    text-align: left;
    font: inherit;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
}
.sample:hover { border-color: var(--border-strong); background: var(--surface-3); }
.sample.is-active { border-color: var(--accent); background: var(--accent-soft); }

.sample__title { display: block; font-size: 12.5px; font-weight: 550; }
.sample__desc { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 1px; }

/* --- Panes --------------------------------------------------------------- */

.pane {
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    background: var(--surface);
}

.pane--input { border-bottom: 1px solid var(--border); }

.pane__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    min-height: 43px;
}

.pane__head h2 {
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.pane__head--tabs { padding: 0 14px 0 0; gap: 8px; }

.pane__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.pane__foot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* --- Buttons ------------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 13px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
}
.button:hover:not(:disabled) { border-color: var(--border-strong); }
.button:disabled { opacity: .5; cursor: not-allowed; }

.button--primary {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: transparent;
    font-weight: 650;
}
.button--primary:hover:not(:disabled) { background: var(--accent-dim); }

.button--ghost { background: transparent; }

.button.is-busy { pointer-events: none; opacity: .75; }

.button kbd {
    font-size: 10.5px;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, .18);
    border: 1px solid rgba(0, 0, 0, .12);
}
:root[data-theme="light"] .button--primary kbd { background: rgba(255, 255, 255, .22); border-color: rgba(255, 255, 255, .3); }

/* --- Editor -------------------------------------------------------------- */

.editor {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
    position: relative;
    background: var(--surface);
}

.editor__gutter {
    flex: 0 0 auto;
    padding: 10px 8px 10px 12px;
    font-family: var(--mono);
    font-size: var(--code-size);
    line-height: var(--code-line);
    color: var(--muted);
    text-align: right;
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    overflow: hidden;
    user-select: none;
    font-variant-numeric: tabular-nums;
    white-space: pre;
}

.editor textarea {
    flex: 1 1 auto;
    display: block;
    width: 100%;
    padding: 10px 14px;
    font-family: var(--mono);
    font-size: var(--code-size);
    line-height: var(--code-line);
    color: var(--text);
    background: transparent;
    border: 0;
    resize: none;
    white-space: pre;
    overflow: auto;
    tab-size: 2;
}
.editor textarea:focus { outline: none; }
.editor textarea::placeholder { color: var(--muted); }

/* --- Tabs ---------------------------------------------------------------- */

.tabs { display: flex; align-items: stretch; overflow-x: auto; }

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 14px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 550;
    color: var(--muted);
    background: none;
    border: 0;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
}
.tab:hover { color: var(--text-2); }
.tab.is-active { color: var(--text); border-bottom-color: var(--accent); }

.tab__badge {
    padding: 0 6px;
    font-size: 10.5px;
    font-weight: 650;
    line-height: 16px;
    color: var(--warn);
    background: var(--warn-soft);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

/* --- Version strip ------------------------------------------------------- */

.version-strip {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    overflow-x: auto;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.vchip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 550;
    color: var(--text-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.vchip:hover { border-color: var(--border-strong); color: var(--text); }
.vchip.is-active { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }

.vchip__dot {
    width: 7px; height: 7px;
    border-radius: 999px;
    background: var(--muted);
    flex: 0 0 auto;
}
.vchip.is-pending .vchip__dot { animation: pulse 1s ease-in-out infinite; }
.vchip.is-error .vchip__dot { background: var(--danger); }

@keyframes pulse { 0%, 100% { opacity: .3; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .vchip.is-pending .vchip__dot { animation: none; }
}

.vchip__group {
    font-size: 10px;
    padding: 0 5px;
    line-height: 15px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
}

/* --- Results ------------------------------------------------------------- */

.results-body {
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    display: flex;
}

.view {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

.empty {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--muted);
    text-align: center;
    padding: 24px;
}
.empty svg { width: 44px; height: 44px; opacity: .35; margin-bottom: 4px; }
.empty p { font-size: 13.5px; }

/* --- Result summary ------------------------------------------------------ */

.summary {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.stat {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 3px 9px;
    font-size: 11.5px;
    background: var(--surface-3);
    border-radius: 999px;
    color: var(--text-2);
}
.stat b { font-family: var(--mono); font-size: 12px; color: var(--text); font-weight: 650; }
.stat--add b { color: var(--add-text); }
.stat--del b { color: var(--del-text); }
.stat--warn { background: var(--warn-soft); color: var(--warn); }
.stat--clean { background: var(--accent-soft); color: var(--accent); }
.stat--clean b { color: var(--accent); }

/* --- Diff ---------------------------------------------------------------- */

.diff {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    font-family: var(--mono);
    font-size: var(--code-size);
    line-height: var(--code-line);
}

.diff__header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    font-size: 10.5px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-family: var(--font);
}
.diff__header span { padding: 6px 12px; }
.diff__header span + span { border-left: 1px solid var(--border); }

.diff--split .diff__header { grid-template-columns: 1fr 1fr; }
.diff--unified .diff__header { grid-template-columns: 1fr; }

.diff__row {
    display: grid;
    min-height: calc(var(--code-size) * var(--code-line));
}
.diff--split .diff__row { grid-template-columns: 1fr 1fr; }
.diff--unified .diff__row { grid-template-columns: 1fr; }

.diff__side {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    min-width: 0;
}
.diff--split .diff__side + .diff__side { border-left: 1px solid var(--border); }

.diff__num {
    padding: 0 8px;
    text-align: right;
    color: var(--muted);
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    user-select: none;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
}

.diff__code {
    padding: 0 10px;
    min-width: 0;
    overflow: hidden;
}

/* Wrapping keeps both halves of a split row the same height, so the two sides
   stay aligned however long the lines get. */
.diff--wrap .diff__codeinner {
    display: block;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Without wrapping, every code cell is slid by the same shared offset, so one
   scrollbar moves the whole diff and the two columns never drift apart. */
.diff--nowrap .diff__codeinner {
    display: inline-block;
    white-space: pre;
    transform: translateX(calc(var(--scroll-x, 0px) * -1));
}

.diff__hscroll {
    position: sticky;
    bottom: 0;
    z-index: 3;
    height: 15px;
    overflow-x: auto;
    overflow-y: hidden;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

/* Overlay scrollbars fade out when idle, which would leave no hint that the
   diff scrolls at all. Draw this one permanently. */
.diff__hscroll::-webkit-scrollbar {
    height: 14px;
    -webkit-appearance: none;
}

.diff__hscroll::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border: 4px solid var(--surface-2);
    border-radius: 999px;
}

.diff__hscroll::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.diff__hscroll-spacer { height: 1px; }

.diff__side--del .diff__code { background: var(--del-bg); }
.diff__side--del .diff__num  { background: var(--del-bg); color: var(--del-text); }
.diff__side--add .diff__code { background: var(--add-bg); }
.diff__side--add .diff__num  { background: var(--add-bg); color: var(--add-text); }
.diff__side--empty .diff__code,
.diff__side--empty .diff__num { background: var(--surface-2); opacity: .5; }

.diff__code mark {
    padding: 1px 0;
    border-radius: 2px;
    background: transparent;
    color: inherit;
}
.diff__side--del mark { background: var(--del-bg-hi); box-shadow: 0 0 0 1px var(--del-border); }
.diff__side--add mark { background: var(--add-bg-hi); box-shadow: 0 0 0 1px var(--add-border); }

.diff__sign {
    display: inline-block;
    width: 1ch;
    margin-right: 6px;
    color: var(--muted);
    user-select: none;
}
.diff__side--del .diff__sign { color: var(--del-text); }
.diff__side--add .diff__sign { color: var(--add-text); }

.diff__fold {
    grid-column: 1 / -1;
    padding: 4px 12px;
    font-family: var(--font);
    font-size: 11.5px;
    color: var(--muted);
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    text-align: left;
    width: 100%;
    border-left: 0;
    border-right: 0;
}
.diff__fold:hover { color: var(--text-2); background: var(--surface-3); }

/* --- Code view ----------------------------------------------------------- */

.code {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    overflow: auto;
    font-family: var(--mono);
    font-size: var(--code-size);
    line-height: var(--code-line);
}

.code__gutter {
    padding: 10px 8px;
    text-align: right;
    color: var(--muted);
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    user-select: none;
    white-space: pre;
    font-variant-numeric: tabular-nums;
    font-size: 11px;
}

.code__body {
    margin: 0;
    padding: 10px 14px;
    white-space: pre;
    overflow-x: auto;
}

.code--wrap .code__body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    overflow-x: visible;
}

/* --- Preview ------------------------------------------------------------- */

.preview-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--border);
    min-height: 0;
}

.preview {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    min-height: 0;
}

.preview__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    font-size: 11px;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
}

.preview__stage {
    flex: 1 1 auto;
    min-height: 220px;
    position: relative;
    background-color: var(--surface-3);
    background-image:
        linear-gradient(45deg, rgba(128, 128, 128, .10) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, .10) 75%),
        linear-gradient(45deg, rgba(128, 128, 128, .10) 25%, transparent 25%, transparent 75%, rgba(128, 128, 128, .10) 75%);
    background-size: 18px 18px;
    background-position: 0 0, 9px 9px;
}

.preview__stage iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.preview__note {
    padding: 8px 12px;
    font-size: 11.5px;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

/* --- Issues -------------------------------------------------------------- */

.issues { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }

.issue {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: baseline;
    padding: 9px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--warn);
    border-radius: var(--radius-sm);
}

.issue__line {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.issue__message { font-size: 12.5px; word-break: break-word; }

/* --- Compare / matrix ---------------------------------------------------- */

.compare { padding: 14px; display: flex; flex-direction: column; gap: 14px; }

.compare__intro { font-size: 12.5px; color: var(--text-2); }

.bands { display: flex; flex-direction: column; gap: 8px; }

.band {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
}

.band__head {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 9px 12px;
    background: var(--surface-3);
    border-bottom: 1px solid var(--border);
}

.band__label {
    font-size: 12px;
    font-weight: 650;
}

.band__versions { display: flex; flex-wrap: wrap; gap: 5px; padding: 10px 12px; }

.band__version {
    font-family: var(--mono);
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-2);
}

.compare__picker {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.compare__picker select { width: auto; min-width: 110px; }
.compare__picker span { font-size: 12.5px; color: var(--text-2); }

.compare__result {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 220px;
}

/* --- Notices ------------------------------------------------------------- */

.notice {
    margin: 12px 14px;
    padding: 11px 13px;
    font-size: 12.5px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-2);
}
.notice--error { border-left: 3px solid var(--danger); color: var(--text); }
.notice--error strong { color: var(--danger); }
.notice--warn { border-left: 3px solid var(--warn); }
.notice code { font-size: 11.5px; color: var(--text); }

/* --- Segmented control --------------------------------------------------- */

.segmented {
    display: inline-flex;
    padding: 2px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 999px;
}

.segmented button {
    padding: 4px 11px;
    font: inherit;
    font-size: 11.5px;
    font-weight: 550;
    color: var(--muted);
    background: none;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    white-space: nowrap;
}
.segmented button:hover { color: var(--text-2); }
.segmented button.is-active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }

.toggle-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    font-size: 11.5px;
    color: var(--text-2);
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.toggle-chip input { accent-color: var(--accent); margin: 0; }
.toggle-chip:hover { border-color: var(--border-strong); }

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

.sitefoot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 20px;
    font-size: 12px;
    color: var(--text-2);
    background: var(--surface);
    border-top: 1px solid var(--border);
}

/* --- Responsive ---------------------------------------------------------- */

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

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        overflow: visible;
    }
    .sidebar .panel { flex: 1 1 260px; }

    .workspace { grid-template-rows: minmax(200px, 40vh) minmax(0, 1fr); }

    body { height: auto; }
    .layout { min-height: 0; }
}

@media (max-width: 720px) {
    .topbar { flex-wrap: wrap; gap: 10px; }
    .topbar__text p { display: none; }

    .sidebar { flex-direction: column; }
    .sidebar .panel { flex: 1 1 auto; }

    .diff--split .diff__row { grid-template-columns: 1fr; }
    .diff--split .diff__header { grid-template-columns: 1fr; }
    .diff--split .diff__side + .diff__side { border-left: 0; border-top: 1px solid var(--border); }

    .preview-grid { grid-template-columns: 1fr; }

    .pane__head { flex-wrap: wrap; }
}
