/* ABC Tools — technical graph-paper theme */

:root {
    --paper: #f6f4ee;
    --card: #fffdf8;
    --ink: #191919;
    --muted: #6b6b66;
    --blue: #1d4ed8;
    --blue-deep: #16368f;
    --orange: #e8590c;
    --line: #dcd9d0;
    --grid: rgba(25, 25, 25, 0.045);
    --surface: #fff;
    --paper-2: #f6f5f1;
    --tint-green: #ebfbee;
    --tint-green-strong: #d3f9d8;
    --tint-red: #fff5f5;
    --tint-red-strong: #ffe3e3;
    --tint-orange: #fff4e6;
    --tint-yellow: #fff3bf;
    --tint-blue: #e7f1ff;
    --mark: #ffe066;
    --mark-soft: rgba(240, 230, 140, 0.9);
    --shadow: 4px 4px 0 var(--ink);
    --shadow-sm: 2px 2px 0 var(--ink);
    --font-display: 'Space Grotesk', -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
    color-scheme: light;
}

/* ------------------------------------------------- dark theme
   Same graph-paper look at night: ink and paper swap, hard shadows
   go black, status tints get deep equivalents. Canvases and mocks of
   external light UIs (SERP/social previews, charts drawn with fixed
   ink) intentionally stay light, like paper artifacts on a desk. */
html[data-theme='dark'] {
    --paper: #16171b;
    --card: #1f2127;
    --ink: #e6e4dd;
    --muted: #9b998f;
    --blue: #6d8dff;
    --blue-deep: #5877e8;
    --orange: #ff8a3d;
    --line: #383a41;
    --grid: rgba(230, 228, 221, 0.05);
    --surface: #262930;
    --paper-2: #24262c;
    --tint-green: #1d3323;
    --tint-green-strong: #245231;
    --tint-red: #3b2325;
    --tint-red-strong: #4c2a2a;
    --tint-orange: #3e2e1c;
    --tint-yellow: #3f3a1e;
    --tint-blue: #1e2c48;
    --mark: #806c15;
    --mark-soft: rgba(128, 108, 21, 0.9);
    --shadow: 4px 4px 0 rgba(0, 0, 0, 0.6);
    --shadow-sm: 2px 2px 0 rgba(0, 0, 0, 0.6);
    color-scheme: dark;
}

html[data-theme='dark'] .btn-primary {
    background: #d9d6cc;
    color: #17181c;
}

html[data-theme='dark'] .btn-primary:hover {
    background: var(--blue);
    color: #fff;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.6);
}

html[data-theme='dark'] .btn-secondary:hover {
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.6);
}

/* charts draw their text with fixed dark ink — keep their surface
   light so they stay readable, like a printed figure */
html[data-theme='dark'] .wiki-widget-canvas,
html[data-theme='dark'] .wiki-chart-holder,
html[data-theme='dark'] .chart-holder {
    background: #fffdf8;
}

/* heatmap cells get light inline heat colours from JS */
html[data-theme='dark'] .heatmap td { color: #191919; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-display);
    background-color: var(--paper);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--ink);
    line-height: 1.55;
}

.container {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

a { color: var(--blue); }

/* anchored category sections land below the sticky header */
.group[id] { scroll-margin-top: 74px; }

/* ------------------------------------------------------------ header */
.site-header {
    background: var(--card);
    border-bottom: 2px solid var(--ink);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 58px;
}

.brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.brand-mark {
    display: inline-block;
    background: var(--blue);
    color: var(--card);
    font-family: var(--font-mono);
    padding: 0.1rem 0.45rem;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin-right: 0.3rem;
    transform: rotate(-2deg);
}

.site-nav a {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    text-decoration: none;
    margin-left: 1.4rem;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}

.site-nav a:hover { border-bottom-color: var(--orange); }

/* ------------------------------------------------- theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: 30px;
    height: 30px;
    margin-left: 1.4rem;
    padding: 0;
    border: 1.5px solid var(--ink);
    background: var(--card);
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:hover svg { transform: rotate(40deg); }

.theme-toggle:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.theme-toggle .icon-sun { display: none; }

html[data-theme='dark'] .theme-toggle .icon-sun { display: block; }
html[data-theme='dark'] .theme-toggle .icon-moon { display: none; }

/* ------------------------------------------------------- nav dropdown */
.nav-menu {
    display: inline-block;
    position: relative;
    margin-left: 1.4rem;
}

.nav-menu > summary {
    list-style: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
    user-select: none;
}

.nav-menu > summary::-webkit-details-marker { display: none; }

.nav-menu > summary:hover,
.nav-menu[open] > summary { border-bottom-color: var(--orange); }

/* font-independent triangle: the ▾ glyph rendered near-invisibly
   small in the mono nav font */
.nav-menu-caret {
    display: inline-block;
    margin-left: 0.4rem;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid currentColor;
    vertical-align: middle;
    transition: transform 0.15s;
}

.nav-menu[open] .nav-menu-caret { transform: rotate(180deg); }

.nav-menu-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 0.55rem);
    min-width: 11rem;
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 0.35rem 0;
    z-index: 20;
}

.nav-menu-panel a {
    display: block;
    margin: 0;
    padding: 0.45rem 0.9rem;
    border-bottom: none;
}

.nav-menu-panel a:hover {
    background: var(--orange-soft, rgba(232, 89, 12, 0.12));
    border-bottom: none;
}

/* ------------------------------------------------------------- search */
.site-search {
    position: relative;
    flex: 1;
    max-width: 340px;
    margin: 0 1.4rem;
}

#search-input {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.42rem 0.65rem;
    border: 1.5px solid var(--ink);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
}

#search-input:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
    background: var(--surface);
}

#search-input::placeholder { color: var(--muted); }

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow);
    max-height: 420px;
    overflow-y: auto;
    z-index: 50;
}

.search-item {
    display: block;
    padding: 0.55rem 0.75rem;
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px dashed var(--line);
}

.search-item:last-child { border-bottom: 0; }

.search-item.active { background: rgba(29, 78, 216, 0.09); }

.search-item-name {
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.search-item-meta {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 0.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-item mark {
    background: none;
    color: var(--orange);
    font-weight: 700;
}

.search-empty {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    padding: 0.7rem 0.75rem;
}

/* ---------------------------------------------------------- favorites */
.fav-menu > summary {
    font-size: 1rem;
    line-height: 1;
}

.fav-count {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    /* raised without vertical-align: super, which inflates line height
       and knocks the nav row out of alignment */
    position: relative;
    top: -0.45em;
    margin-left: 0.15rem;
    color: var(--orange);
}

.fav-menu .nav-menu-panel {
    min-width: 16rem;
    max-height: 60vh;
    overflow-y: auto;
}

.fav-empty {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted);
    padding: 0.7rem 0.9rem;
    white-space: normal;
}

.fav-item {
    display: flex;
    align-items: center;
    border-bottom: 1px dashed var(--line);
}

.fav-item:last-child { border-bottom: 0; }

.fav-menu .fav-item-link {
    flex: 1;
    min-width: 0;
    display: block;
    padding: 0.45rem 0 0.45rem 0.9rem;
    margin: 0;
    text-decoration: none;
    color: var(--ink);
    text-transform: none;
    letter-spacing: 0;
    border-bottom: none;
}

.fav-menu .fav-item-link:hover {
    background: rgba(29, 78, 216, 0.09);
    border-bottom: none;
}

.fav-item-name {
    display: block;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: -0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fav-item-meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 0.1rem;
}

.fav-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 1rem;
    line-height: 1;
    color: var(--muted);
    padding: 0.45rem 0.7rem;
}

.fav-remove:hover { color: var(--orange); }

.fav-star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--muted);
    padding: 0 0.2rem;
    margin-left: 0.35rem;
    vertical-align: baseline;
}

.fav-star:hover { color: var(--orange); }

.fav-star.on { color: var(--orange); }

@media (max-width: 700px) {
    /* keep the .container side padding: this element carries both classes */
    .header-inner { flex-wrap: wrap; height: auto; padding: 0.6rem 1.25rem; gap: 0.5rem; }
    .site-search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
    /* even nav spacing via flex gap instead of ragged margin-left;
       the Home link is redundant with the brand, so hiding it lets the
       whole nav share the brand row even on small phones */
    .site-nav { display: flex; align-items: center; gap: 0.85rem; }
    .site-nav a, .site-nav .nav-menu, .site-nav .theme-toggle { margin-left: 0; }
    .theme-toggle { width: 26px; height: 26px; }
    .theme-toggle svg { width: 14px; height: 14px; }
    .site-nav > a:first-child { display: none; }
    .site-nav a, .nav-menu > summary { font-size: 0.78rem; }
    .fav-menu > summary { font-size: 0.95rem; }
    /* dropdown panels anchor right of their summary and would hang off
       the left viewport edge on narrow screens; pin them to the viewport
       instead (top: auto keeps them right under the header) */
    .nav-menu-panel,
    .fav-menu .nav-menu-panel {
        position: fixed;
        left: 0.75rem;
        right: 0.75rem;
        top: auto;
        min-width: 0;
    }
}

/* -------------------------------------------------------------- hero */
.hero {
    padding: 3.2rem 0 1.8rem;
    max-width: 720px;
}

.hero h1 {
    font-size: clamp(1.9rem, 4.5vw, 3rem);
    line-height: 1.08;
    margin: 0 0 0.6rem;
    letter-spacing: -0.03em;
}

.hero h1::after {
    content: '';
    display: block;
    width: 72px;
    height: 5px;
    background: var(--orange);
    margin-top: 0.7rem;
}

.lead {
    color: var(--muted);
    font-size: 1.02rem;
    margin: 0;
}

/* ------------------------------------------------------ groups/cards */
.group { margin: 2.2rem 0; }

.group-head h2 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.95rem;
    border-bottom: 2px solid var(--ink);
    display: inline-block;
    padding-bottom: 0.2rem;
    margin-bottom: 0.3rem;
}

.group-head p { color: var(--muted); margin-top: 0.2rem; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.1rem;
    margin: 1.4rem 0 3rem;
    counter-reset: toolcard;
}

.card {
    position: relative;
    display: block;
    background: var(--card);
    border: 1.5px solid var(--ink);
    padding: 1rem 1.1rem 1.05rem;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    counter-increment: toolcard;
}

.card::before {
    content: counter(toolcard, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    display: block;
    margin-bottom: 0.4rem;
}

.card:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow);
}

.card .badge {
    position: absolute;
    top: 0.7rem;
    right: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--orange);
    border: 1px solid var(--orange);
    border-radius: 2px;
    padding: 0.1rem 0.35rem;
    line-height: 1.4;
}

.card:hover h3 { color: var(--blue); }

.card h3 {
    margin: 0 0 0.3rem;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.card p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

/* tool illustration: hidden on the classic cards, shown in the
   compact image+name view (html[data-toolview='compact']) */
.card-art { display: none; }

html[data-toolview='compact'] .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.9rem;
}

html[data-toolview='compact'] .card {
    padding: 0.55rem 0.55rem 0.7rem;
    text-align: center;
}

html[data-toolview='compact'] .card::before { display: none; }
html[data-toolview='compact'] .card p { display: none; }
html[data-toolview='compact'] .card .badge { display: none; }

html[data-toolview='compact'] .card-art {
    display: block;
    width: 100%;
    height: auto;
    border: 1.5px solid var(--ink);
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: #f7f5ef;
}

html[data-toolview='compact'] .card h3 {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.25;
}

/* related tools: cap at 3 columns of normal-size cards, so six related
   tools wrap into two rows instead of one long strip */
html[data-toolview='compact'] .related-tools .card-grid {
    grid-template-columns: repeat(3, minmax(0, 175px));
}

@media (max-width: 560px) {
    html[data-toolview='compact'] .related-tools .card-grid {
        grid-template-columns: repeat(2, minmax(0, 175px));
    }
}

/* category/tool illustration, in a column left of the title so wrapped
   text keeps one consistent edge (no float indent jumps) */
.cat-art, .tool-art {
    border: 2px solid var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    background: #f6f4ee;
}

/* the illustrations are decoration: drop them on narrow screens */
@media (max-width: 767px) {
    .cat-art, .tool-art { display: none; }
}

/* soften the cream artwork against the dark background */
html[data-theme='dark'] .card-art,
html[data-theme='dark'] .tool-art,
html[data-theme='dark'] .cat-art,
html[data-theme='dark'] .cat-card-art img {
    filter: brightness(0.82) contrast(1.05);
}

@media (min-width: 768px) {
    .hero:has(> .cat-art) {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 1.6rem;
    }
    .hero > .cat-art {
        width: 128px;
        height: 128px;
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: center;
    }
    .hero:has(> .cat-art) > :not(.cat-art) { grid-column: 2; }

    .tool:has(> .tool-art) {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 1.6rem;
    }
    .tool > .tool-art {
        width: 132px;
        height: 132px;
        grid-column: 1;
        grid-row: 1 / span 2;
        align-self: start;
        margin: 0.2rem 0 0.8rem;
    }
    /* only the title + lead sit beside the image; everything after
       returns to full width below it */
    .tool:has(> .tool-art) > h1,
    .tool:has(> .tool-art) > .lead { grid-column: 2; }
    .tool:has(> .tool-art) > :not(.tool-art):not(h1):not(.lead) {
        grid-column: 1 / -1;
    }
}

/* category-page layout switch (choice stored globally) */
.view-switch {
    display: flex;
    justify-content: flex-end;
    gap: 0;
    margin: 1rem 0 -0.6rem;
}

.view-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    background: var(--card);
    border: 1.5px solid var(--ink);
    padding: 0.32rem 0.65rem;
    cursor: pointer;
}

.view-switch-btn + .view-switch-btn { border-left: 0; }

.view-switch-btn svg { width: 13px; height: 13px; }

.view-switch-btn.is-active {
    background: var(--ink);
    color: var(--card);
}

/* -------------------------------------------------------- breadcrumbs */
.breadcrumbs {
    margin: 1.4rem 0 1.6rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--orange); }

/* ---------------------------------------------------------- tool page */
.tool h1 {
    font-size: clamp(1.5rem, 3.5vw, 2.2rem);
    letter-spacing: -0.02em;
    margin: 0 0 0.4rem;
}

.tool > .lead { margin-bottom: 1.6rem; max-width: 760px; }

.tool-form {
    background: var(--card);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    /* row-gap must stay 0: each .form-row subgrids across 4 tracks
       (label/control/help/error), and a non-zero row-gap would pad
       BETWEEN those tracks — huge empty bands under every field */
    column-gap: 1.25rem;
    row-gap: 0;
    max-width: 780px;
}

/* Each row subgrids onto four shared tracks (label / control / help /
   error) so a label wrapping to two lines never pushes its input out of
   line with the neighbouring fields. */
.form-row {
    display: grid;
    grid-template-rows: subgrid;
    grid-row: span 4;
    row-gap: 0;
    position: relative;
    /* vertical rhythm between fields (replaces the old form row-gap) */
    margin-bottom: 1rem;
    /* allow shrinking below the widest option/intrinsic control size,
       otherwise long selects and textareas overflow on small screens */
    min-width: 0;
}
.form-row[hidden] { display: none; margin-bottom: 0; }
.form-row.row-break { grid-column-start: 1; }
/* slider rows get the whole form width — a 200px track is unusable */
.form-row:has(.range-wrap) { grid-column: 1 / -1; }

.form-row label { grid-row: 1; align-self: end; }
.form-row input,
.form-row select,
.form-row textarea,
.form-row .expr-wrap,
.form-row .range-wrap { grid-row: 2; }
.form-row .help { grid-row: 3; }
.form-row .error { grid-row: 4; }

.form-row label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 500;
    margin-bottom: 0.35rem;
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    width: fit-content;
    max-width: 100%;
}

/* click/hover info tip next to a field label (opt-in via Field.info) */
.field-info {
    flex-shrink: 0;
    width: 0.85rem;
    height: 0.85rem;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    line-height: 0;
    cursor: help;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.55;
    transition: color 0.12s ease, opacity 0.12s ease;
}
.field-info svg {
    display: block;
    width: 0.78rem;
    height: 0.78rem;
}
.field-info:hover,
.field-info:focus-visible,
.field-info[aria-expanded='true'] {
    color: var(--blue);
    opacity: 1;
    outline: none;
    transform: none;
    box-shadow: none;
    background: transparent;
}
.field-info:focus-visible {
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.28);
}
.field-info-tip {
    display: block;
    position: absolute;
    z-index: 8;
    /* out of grid flow; anchor under the label */
    top: 1.55rem;
    left: 0;
    width: min(24rem, 90vw);
    box-sizing: border-box;
    padding: 0.7rem 0.85rem;
    margin: 0;
    background: var(--card);
    color: var(--ink);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-display);
    font-size: 0.88rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: none;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
}
.field-info-tip[hidden] { display: none !important; }
.field-info-tip > :first-child { margin-top: 0; }
.field-info-tip > :last-child { margin-bottom: 0; }
.field-info-tip p { margin: 0 0 0.45rem; }
.field-info-tip ul,
.field-info-tip ol {
    margin: 0.15rem 0 0;
    padding-left: 1.15rem;
}
.field-info-tip li + li { margin-top: 0.3rem; }
.field-info-tip li::marker { color: var(--muted); }
.field-info-tip strong { font-weight: 700; }
.field-info-tip mark {
    background: transparent;
    color: inherit;
    font-weight: 600;
    box-shadow: inset 0 -0.45em var(--mark-soft);
    padding: 0 0.08em;
}
.field-info-tip code {
    font-family: var(--font-mono);
    font-size: 0.86em;
    background: var(--paper-2);
    padding: 0.05em 0.25em;
}

.form-row input,
.form-row select,
.form-row textarea {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    padding: 0.55rem 0.65rem;
    border: 1.5px solid var(--ink);
    border-radius: 0;
    background: var(--surface);
    color: var(--ink);
    max-width: 100%;
    min-width: 0;
}

.form-row:has(textarea) { grid-column: 1 / -1; }
.form-row textarea { resize: vertical; }
.form-row textarea.is-dropping {
    outline: 2px dashed var(--blue);
    outline-offset: 2px;
    background: rgba(29, 78, 216, 0.06);
}

/* selects get a full row and size to their longest option so the
   text is never clipped */
.form-row:has(select) { grid-column: 1 / -1; }

.form-row select {
    width: fit-content;
    max-width: 100%;
    padding-right: 2.2rem;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
}

/* range sliders (e.g. momentum strength) */
.range-wrap {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0;
}
.range-wrap input[type=range] {
    flex: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: transparent;
    accent-color: var(--blue);
}
.range-wrap .range-value {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    min-width: 3.2em;
    text-align: right;
}

.help { color: var(--muted); margin-top: 0.3rem; font-size: 0.78rem; }
.error { color: var(--orange); margin-top: 0.3rem; font-family: var(--font-mono); font-size: 0.75rem; min-height: 0; }
.error:not(:empty) { min-height: 1em; }
.form-error { color: var(--orange); font-family: var(--font-mono); font-size: 0.85rem; grid-column: 1 / -1; margin: 0; }

/* wrap Calculate + demo buttons with uniform gap (same idea as
   .img-actions) so long demo labels never overlap on wrap */
.form-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
}
.form-actions > .btn-primary,
.form-actions > .btn-secondary { margin: 0; }

.btn-primary {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.03em;
    font-weight: 500;
    background: #45443f;
    color: var(--paper);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 0.65rem 1.4rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.1s ease;
}

.btn-primary:hover {
    background: var(--blue-deep);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
}

.btn-primary:disabled { opacity: 0.55; cursor: wait; transform: none; }

.btn-secondary {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 0.65rem 1.4rem;
    margin-left: 0.7rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}

.btn-secondary:hover {
    color: var(--orange);
    border-color: var(--orange);
    transform: translate(-1px, -1px);
    box-shadow: 3px 3px 0 var(--ink);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
    box-shadow: var(--shadow-sm);
    color: var(--ink);
    border-color: var(--ink);
}

@media (max-width: 520px) {
    .btn-secondary { margin-left: 0; margin-top: 0.6rem; }
}

/* ------------------------------------------------------------ results */
.results,
.chart-card,
.table-card {
    margin-top: 1.6rem;
    background: var(--card);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow);
    padding: 1.2rem 1.4rem;
    max-width: 780px;
}

.results h2 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    margin: 0 0 0.7rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--ink);
}

.results-table { width: 100%; border-collapse: collapse; }

.results-table td {
    padding: 0.45rem 0.4rem;
    border-bottom: 1px dashed var(--line);
    vertical-align: top;
    font-size: 0.92rem;
}

.results-table tr:last-child td { border-bottom: 0; }
.results-table td:first-child { color: var(--muted); width: 55%; }

.results-table td:last-child {
    font-family: var(--font-mono);
    font-weight: 500;
    word-break: break-word;
}

/* ---------------------------------------------- final-grade what-if */
.whatif-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem 1rem;
    margin: 0.4rem 0 0.8rem;
}
.whatif-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    flex: 0 0 auto;
}
.whatif-row input[type="range"] {
    flex: 1 1 12rem;
    min-width: 10rem;
    accent-color: var(--accent, #1d4ed8);
}
.whatif-score {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.05rem;
    min-width: 4.2rem;
    text-align: right;
}
.whatif-overall {
    margin: 0.2rem 0 0.35rem;
    font-size: 1.15rem;
}
.whatif-overall-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-right: 0.4rem;
}
.whatif-overall-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.45rem;
}
.whatif-note {
    margin: 0;
    font-size: 0.9rem;
    color: var(--muted);
}
.whatif-note[data-tone="hit"] { color: #15803d; }
.whatif-note[data-tone="above"] { color: #15803d; }
.whatif-note[data-tone="below"] { color: #c2410c; }

/* ------------------------------------------- grade-curve print bar */
.curve-actions {
    margin-top: 0.9rem;
    max-width: 780px;
}

/* ------------------------------------------------- expression builder */
/* expression fields get a full form row and a roomier input so longer
   expressions stay readable */
.form-row:has(.expr-wrap) { grid-column: 1 / -1; }

.expr-wrap {
    display: flex;
    align-items: stretch;
    gap: 0.4rem;
}

.expr-wrap input {
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    padding: 0.6rem 0.7rem;
}

.expr-open {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0 0.7rem;
    background: var(--paper);
    border: 1px solid var(--ink);
    cursor: pointer;
    white-space: nowrap;
}

.expr-open i { font-style: italic; }

.expr-open:hover {
    background: var(--blue);
    color: #fff;
    border-color: var(--blue);
}

body.exprb-lock { overflow: hidden; }

.exprb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(25, 25, 25, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 90;
}

/* display: flex above would otherwise override the hidden attribute */
.exprb-overlay[hidden] { display: none; }

.exprb {
    background: var(--paper);
    border: 1px solid var(--ink);
    box-shadow: 6px 6px 0 rgba(25, 25, 25, 0.85);
    width: min(560px, 94vw);
    max-height: 88vh;
    overflow-y: auto;
    padding: 1.1rem 1.2rem 1.2rem;
}

.exprb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.8rem;
}

.exprb-head h3 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin: 0;
}

.exprb-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.1rem 0.35rem;
}

.exprb-close:hover { color: var(--blue); }

.exprb-input {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 1rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--ink);
    background: var(--surface);
}

.exprb-preview {
    margin-top: 0.7rem;
    border: 1px dashed var(--line);
    background: rgba(29, 78, 216, 0.03);
    padding: 0.55rem 0.7rem;
}

.exprb-preview-label {
    display: block;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.68rem;
    color: var(--muted);
    margin-bottom: 0.3rem;
}

.exprb-preview-body {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    min-height: 1.8rem;
    overflow-x: auto;
    overflow-y: hidden;
}

.exprb-preview-body .katex { font-size: 1.25em; }
.exprb-preview-body.is-idle { color: var(--muted); }

/* space is always reserved so errors appear without shifting the modal */
.exprb-error {
    color: #b42318;
    font-size: 0.85rem;
    margin: 0.5rem 0 0;
    min-height: 2.1em;
    visibility: hidden;
}

.exprb-error.is-visible { visibility: visible; }

.exprb-groups { margin-top: 0.9rem; }

.exprb-group { margin-bottom: 0.75rem; }

.exprb-group h4 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.66rem;
    color: var(--muted);
    margin: 0 0 0.35rem;
}

.exprb-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.exprb-btn {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.3rem 0.6rem;
    background: var(--surface);
    border: 1px solid var(--line);
    cursor: pointer;
}

.exprb-btn:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.exprb-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}

/* KaTeX-rendered result values (symbolic calculators) */
.results-table td.math-value {
    overflow-x: auto;
    overflow-y: hidden;
}

.results-table td.math-value .katex { font-size: 1.15em; }

/* ------------------------------------------------------------- charts */
.chart-card h3,
.table-card h3 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    font-weight: 500;
    margin: 0 0 0.8rem;
    color: var(--muted);
}

.csv-download {
    margin-top: 1rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    padding: 0.45rem 0.9rem;
    background: var(--card);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.csv-download:hover { background: var(--accent); }

.chart-holder { position: relative; height: 300px; }

/* heatmap grid (e.g. scoreline probabilities) */
.heatmap {
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin: 0 auto;
}
.heatmap th,
.heatmap td {
    border: 1px solid var(--ink);
    padding: 0.45rem 0.6rem;
    text-align: center;
    min-width: 3em;
}
.heatmap thead th:first-child {
    font-size: 0.68rem;
    color: var(--muted);
    font-weight: 500;
}
.heatmap th {
    background: var(--card);
    font-weight: 600;
}

/* interval visual */
.interval-row { margin: 1rem 0 1.4rem; }

.interval-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.interval-track {
    position: relative;
    height: 26px;
    background: repeating-linear-gradient(90deg, transparent 0 23px, var(--grid) 23px 24px);
    border: 1px solid var(--line);
}

.interval-range {
    position: absolute;
    top: 6px;
    bottom: 6px;
    background: rgba(29, 78, 216, 0.25);
    border-left: 2px solid var(--blue);
    border-right: 2px solid var(--blue);
}

.interval-center {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--orange);
    transform: translateX(-1px);
}

.interval-bounds {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    margin-top: 0.4rem;
    white-space: pre;
}

/* bin packing visual */
.bins-viz {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    align-items: flex-end;
    margin: 0.8rem 0 0.4rem;
}

.bins-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 96px;
}

.bins-box {
    display: flex;
    flex-direction: column-reverse;
    justify-content: flex-start;
    width: 100%;
    height: 200px;
    border: 2px solid var(--ink);
    background:
        repeating-linear-gradient(0deg, transparent 0 24px,
                                  var(--grid) 24px 25px);
    box-shadow: var(--shadow-sm);
}

.bins-seg {
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1.1;
    text-align: center;
    color: #1a1a1a;
    border-top: 1px solid rgba(0, 0, 0, 0.25);
    padding: 0 2px;
    box-sizing: border-box;
    flex: none;
}

.bins-name {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

.bins-fill {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}

.bins-col-3d { width: auto; }

.bins3d-canvas {
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
}

.bins-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.1rem;
    margin: 0.5rem 0 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.bins-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.bins-legend-swatch {
    width: 11px;
    height: 11px;
    flex: none;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.25);
}

/* -------------------------------------------------------------- tables */
.table-scroll { overflow-x: auto; }

/* Tables hug their content: columns get an even gap instead of the
   browser stretching them unevenly across the full card width. */
.data-table {
    width: auto;
    min-width: 60%;
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.data-table th {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.7rem;
    font-weight: 500;
    border-bottom: 2px solid var(--ink);
    padding: 0.4rem 0.6rem 0.35rem;
    white-space: nowrap;
}

.data-table td {
    padding: 0.35rem 0.6rem;
    border-bottom: 1px dashed var(--line);
    white-space: nowrap;
}

.data-table th:not(:last-child),
.data-table td:not(:last-child) { padding-right: 2.4rem; }

.data-table tbody tr:hover { background: rgba(29, 78, 216, 0.05); }

/* --------------------------------------------------------------- notes */
.notes {
    margin: 1.8rem 0 3rem;
    max-width: 780px;
    color: var(--muted);
    font-size: 0.9rem;
    border-left: 3px solid var(--orange);
    padding-left: 1rem;
}

.notes h2 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    color: var(--ink);
    margin: 0 0 0.4rem;
}

.notes ul { margin: 0; padding-left: 1.1rem; }

/* ------------------------------------------- tool-page widget embed */
.tool-explore { margin: 2.2rem 0 3rem; max-width: 780px; }

.tool-explore h2 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin: 0 0 0.6rem;
}

.tool-explore .guide-link { font-size: 0.9rem; }

/* ----------------------------------------------------- related tools */
.related-tools { margin: 2.2rem 0 0; }

.related-tools h2 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    margin: 0 0 0.6rem;
}

.related-tools .card-grid { margin: 1rem 0 1.5rem; }

/* ------------------------------------------------ section index intro */
.seo-intro {
    max-width: 780px;
    margin: 0 0 3rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.seo-intro h2 {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    color: var(--ink);
    margin: 0 0 0.6rem;
}

/* -------------------------------------------------------------- footer */
.site-footer {
    border-top: 2px solid var(--ink);
    background: var(--card);
    padding: 1.2rem 0 1.8rem;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    margin-top: 2.5rem;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-legal {
    display: flex;
    gap: 1rem;
}

.footer-legal a {
    color: var(--muted);
    text-decoration: underline;
}

.footer-legal a:hover {
    color: var(--ink);
}

/* ------------------------------------------------------------ feedback */
.feedback-website {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.feedback-sent {
    background: var(--card);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow);
    padding: 1.2rem 1.5rem;
    max-width: 780px;
    font-family: var(--font-mono);
}

/* ------------------------------------------------------- wiki article */
.guide-link {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-top: -0.4rem;
}

.wiki-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 2rem;
    align-items: start;
    margin-top: 1.5rem;
}

.wiki-toc {
    position: sticky;
    top: 78px;
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.1rem 1.2rem;
    font-size: 0.82rem;
}

.wiki-toc h2 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 0.5rem;
    font-family: var(--font-mono);
    color: var(--muted);
}

.wiki-toc ol {
    margin: 0 0 1rem;
    padding-left: 1.1rem;
}

.wiki-toc li { margin: 0.3rem 0; }
.wiki-toc a { color: var(--ink); text-decoration: none; }
.wiki-toc a:hover { color: var(--blue); text-decoration: underline; }

.wiki-toc a.wiki-toc-tool {
    display: block;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--blue);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: var(--paper);
    padding: 0.5rem 0.6rem;
    text-decoration: none;
}

.wiki-toc a.wiki-toc-tool:hover {
    background: var(--blue);
    color: var(--paper);
}

/* button-styled anchors need link resets */
a.btn-primary {
    display: inline-block;
    color: var(--paper);
    text-decoration: none;
}

.wiki {
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow);
    padding: 2rem 2.4rem 2.5rem;
    max-width: 760px;
    min-width: 0;
    overflow-wrap: break-word;
}

/* long hex/Base64 strings must never force horizontal page scroll */
.wiki code { overflow-wrap: anywhere; }

.wiki h1 { margin-top: 0; line-height: 1.2; }

.wiki h2 {
    margin-top: 2.2rem;
    padding-bottom: 0.3rem;
    border-bottom: 2px solid var(--line);
}

.wiki h3 { margin-top: 1.6rem; }

.wiki-lede {
    font-size: 1.12rem;
    color: var(--ink);
    border-left: 4px solid var(--blue);
    padding-left: 0.9rem;
}

.wiki-formula {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    background:
        linear-gradient(rgba(29, 78, 216, 0.035), rgba(29, 78, 216, 0.035)),
        var(--paper);
    border: 1px solid var(--line);
    border-left: 4px solid var(--blue);
    padding: 1.25rem 1.4rem;
    margin: 1.4rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    text-align: center;
}

.wiki-formula .katex-display {
    margin: 0;
    /* keep tall delimiters/superscripts clear of the box edges */
    padding: 0.15rem 0;
}

/* display math reads better a step larger than body text */
.wiki-formula .katex { font-size: 1.45em; }

/* verbatim code blocks (SQL, Python, shell) in articles */
.wiki-code {
    font-family: var(--font-mono);
    font-size: 0.92rem;
    background:
        linear-gradient(rgba(232, 89, 12, 0.04), rgba(232, 89, 12, 0.04)),
        var(--paper);
    border: 1px solid var(--line);
    border-left: 4px solid var(--orange);
    padding: 0.9rem 1.1rem;
    margin: 1.4rem 0;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.wiki-callout {
    border: 1.5px solid var(--ink);
    border-left-width: 6px;
    padding: 0.7rem 1rem;
    margin: 1.1rem 0;
    background: var(--paper);
    font-size: 0.95rem;
}

.wiki-callout[data-kind="info"] { border-left-color: var(--blue); }
.wiki-callout[data-kind="tip"] { border-left-color: #0f766e; }
.wiki-callout[data-kind="warning"] { border-left-color: var(--orange); }
.wiki-callout p { margin: 0.3rem 0; }

.wiki-table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.1rem 0;
    font-size: 0.88rem;
    font-family: var(--font-mono);
}

.wiki-table caption {
    caption-side: top;
    text-align: left;
    font-family: var(--font-display);
    font-weight: 600;
    padding-bottom: 0.4rem;
}

.wiki-table th, .wiki-table td {
    border: 1px solid var(--line);
    padding: 0.4rem 0.6rem;
    text-align: left;
}

.wiki-table thead th {
    background: var(--paper);
    border-bottom: 2px solid var(--ink);
}

.wiki-example {
    border: 2px dashed var(--ink);
    padding: 1rem 1.3rem;
    margin: 1.3rem 0;
    background: rgba(29, 78, 216, 0.03);
}

.wiki-example > h3 { margin-top: 0; }

.wiki-steps { padding-left: 1.4rem; }
.wiki-steps li { margin: 0.45rem 0; }

.wiki-terms dt { font-weight: 600; margin-top: 0.7rem; }
.wiki-terms dd { margin-left: 1rem; color: var(--ink); }

.wiki-kbd {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--paper);
    border: 1px solid var(--ink);
    border-bottom-width: 2px;
    border-radius: 3px;
    padding: 0 0.35em;
}

.wiki-chart {
    margin: 1.3rem 0;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: var(--card);
    padding: 0.9rem 1rem;
}

.wiki-chart-title {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.wiki-chart-holder {
    position: relative;
    height: 300px;
}

.wiki-chart figcaption {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.6rem;
    font-family: var(--font-mono);
}

.wiki-widget {
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: var(--paper);
    padding: 1rem 1.2rem;
    margin: 1.3rem 0;
}

.wiki-widget-root { margin-top: 0.4rem; }

.wiki-widget-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.6rem;
    align-items: center;
    margin-bottom: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.wiki-widget-controls label {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
}
.wiki-widget-controls output { font-weight: 600; min-width: 3.5ch; }
.wiki-widget-controls input[type="range"] { max-width: 100%; }

.wiki-widget-canvas {
    position: relative;
    height: 300px;
    background: var(--card);
    border: 1px solid var(--line);
}

.wiki-widget-note {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 0.6rem;
}

/* number-line canvas used by widgets (dot strips, CI lines) */
.wiki-numline {
    position: relative;
    height: 110px;
    margin: 0.6rem 0 0.4rem;
    background: var(--card);
    border: 1px solid var(--line);
}

.wiki-numline::before {
    content: '';
    position: absolute;
    left: 2%;
    right: 2%;
    top: 50%;
    border-top: 1.5px solid var(--ink);
}

.wiki-numline-dot {
    position: absolute;
    top: 50%;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--blue);
    border: 1px solid var(--ink);
    opacity: 0.75;
}

.wiki-numline-dot.is-moving {
    background: var(--orange);
    opacity: 1;
    z-index: 2;
}

.wiki-numline-marker {
    position: absolute;
    top: 18%;
    bottom: 18%;
    width: 0;
    border-left: 2.5px solid var(--ink);
}

.wiki-numline-marker.is-mean { border-color: var(--orange); }
.wiki-numline-marker.is-alt { border-color: var(--orange); }
.wiki-numline-marker.is-median { border-color: var(--blue); }
.wiki-numline-marker.is-zero { border-left-style: dashed; }

.wiki-numline-label {
    position: absolute;
    top: -1.15rem;
    left: -1ch;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    white-space: nowrap;
}

.wiki-numline-label.is-below { top: auto; bottom: -1.15rem; }

.wiki-numline-range {
    position: absolute;
    top: 42%;
    bottom: 42%;
    background: rgba(29, 78, 216, 0.25);
    border: 1px solid var(--blue);
}

.wiki-numline.is-significant .wiki-numline-range {
    background: rgba(232, 89, 12, 0.3);
    border-color: var(--orange);
}

.wiki-widget input[type="range"] { accent-color: var(--blue); width: 180px; }

.wiki-widget-canvas.sm { height: 220px; }

.wiki-widget-controls select {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.15rem 0.3rem;
    border: 1px solid var(--ink);
    background: var(--paper);
}

.wiki-widget-toggle {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.55rem;
    border: 1.5px solid var(--ink);
    background: rgba(232, 89, 12, 0.15);
    cursor: pointer;
}

.wiki-widget-toggle.is-positive { background: rgba(29, 78, 216, 0.18); }

/* HTML readout widgets (math bundle) */
.wiki-widget-html {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.4rem 0;
}
.wiki-fsm-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: center; gap: 0.6rem 1.4rem; padding: 0.5rem 0; }
.wiki-fsm-cell { text-align: center; }
.wiki-fsm-word { font-family: Impact, "Arial Black", sans-serif; font-weight: 700; letter-spacing: 0.01em; }
.wiki-fsm-meta { font-size: 0.7rem; color: var(--muted); margin-top: 0.25rem; }

.wiki-readout {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.8rem;
    align-items: baseline;
    padding: 0.18rem 0;
}

.wiki-readout-label { color: var(--muted); min-width: 11rem; }
.wiki-readout strong.is-hot { color: var(--orange); }

.wiki-hbar {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.2rem 0;
}

.wiki-hbar-label { min-width: 6.5rem; color: var(--muted); }

.wiki-hbar-track {
    flex: 1;
    height: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    overflow: hidden;
}

.wiki-hbar-fill {
    display: block;
    height: 100%;
    background: var(--blue);
    transition: width 0.15s ease-out;
}

.wiki-hbar-value { min-width: 6ch; font-weight: 600; }

.wiki-digit-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    padding: 0.25rem 0;
}

.wiki-chip {
    display: inline-block;
    min-width: 1.6ch;
    padding: 0.2rem 0.45rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    text-align: center;
    font-weight: 600;
}

.wiki-chip.is-carry { background: rgba(232, 89, 12, 0.25); border-color: var(--orange); }

.wiki-place {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.35rem 0.55rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
}

.wiki-place small { color: var(--muted); font-size: 0.68rem; }
.wiki-place.is-invalid { opacity: 0.45; border-style: dashed; }

.wiki-matrix {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0.3rem 0;
    background: var(--card);
    border: 1px solid var(--line);
    padding: 0.5rem 0.8rem;
    display: inline-block;
}

.wiki-mini-table {
    border-collapse: collapse;
    font-size: 0.8rem;
    margin: 0.3rem 0 0.6rem;
}

.wiki-mini-table th,
.wiki-mini-table td {
    border: 1px solid var(--line);
    padding: 0.25rem 0.7rem;
    text-align: center;
}

.wiki-mini-table th { background: var(--card); }

.wiki-bignum { font-size: 1.15rem; letter-spacing: 0.12em; }
.wiki-bignum strong.is-kept { color: var(--blue); }
.wiki-bignum strong.is-dropped { color: var(--orange); }

/* image-widget helpers: digit steppers, char bars, swatches, canvases */
.wiki-digit {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    font-size: 0.7rem;
    color: var(--muted);
}

.wiki-digit input {
    width: 2.6ch;
    padding: 0.15rem 0.1rem;
    text-align: center;
    border: 1.5px solid var(--ink);
    background: var(--card);
    font-family: var(--font-mono);
    font-weight: 600;
}

.wiki-cellbar {
    display: flex;
    gap: 2px;
    margin: 0.3rem 0 0.5rem;
    flex-wrap: wrap;
}

.wiki-cell {
    display: inline-block;
    min-width: 2ch;
    padding: 0.3rem 0.2rem;
    border: 1px solid var(--line);
    text-align: center;
    font-family: var(--font-mono);
    font-weight: 600;
}

.wiki-cell.is-hot { border: 2px solid var(--blue); font-weight: 700; }

.wiki-swatch-row {
    display: flex;
    gap: 0.4rem;
    margin: 0.3rem 0 0.5rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.wiki-swatch-row .wiki-swatch-chip {
    width: 42px;
    height: 42px;
    display: inline-block;
    border: 1px solid var(--line);
}

.wiki-swatch {
    display: inline-flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.78rem;
    font-family: var(--font-mono);
}

.wiki-swatch-row.wide .wiki-swatch-chip { width: 96px; height: 56px; }
.wiki-swatch-sub { color: var(--muted); font-size: 0.72rem; }

/* letter tiles: one per typed letter, tinted by the version used */
.wiki-alt-row { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0 0.7rem; }
.wiki-alt-tile {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 2.1rem;
    padding: 0.2rem 0.25rem 0.15rem;
    border: 2px solid var(--alt-color, var(--line));
    background: var(--surface);
}
.wiki-alt-letter { font-size: 1.35rem; font-weight: 700; line-height: 1.1; }
.wiki-alt-version {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--alt-color, var(--muted));
}
.wiki-alt-tile.is-clash { background: var(--tint-red-strong); }

.wiki-canvas-row {
    display: flex;
    gap: 0.9rem;
    margin: 0.3rem 0 0.5rem;
    flex-wrap: wrap;
}

.wiki-canvas-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.wiki-canvas-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}

/* labelled rows of small number lines (grouped strip plots) */
.wiki-strip-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0.3rem 0;
}

.wiki-strip-row .wiki-numline { flex: 1; margin: 0; }

.wiki-strip-label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    min-width: 5.5rem;
}

/* horizontal fill meter (e.g. kappa scale) */
.wiki-meter {
    position: relative;
    height: 16px;
    margin: 0.8rem 0 0.3rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
}

.wiki-meter-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--blue);
    transition: width 120ms linear;
}

.wiki-cta { margin-top: 2rem; }

.wiki-faq h3 { margin-bottom: 0.3rem; }
.wiki-faq h3::before { content: 'Q. '; color: var(--blue); }

@media (max-width: 900px) {
    /* minmax(0, …) lets the column shrink below its content's min width */
    .wiki-layout { grid-template-columns: minmax(0, 1fr); }
    .wiki-toc { position: static; }
    .wiki { padding: 1.3rem 1.1rem 1.6rem; }
    /* wide tables scroll inside the article instead of stretching the page */
    .wiki-table { display: block; overflow-x: auto; }
    .wiki-table caption { display: block; }
}

@media (max-width: 560px) {
    .tool-form { grid-template-columns: 1fr; padding: 1.1rem; }
    .hero { padding: 2.2rem 0 1.2rem; }
    .nav-menu-panel a { margin-left: 0; }
    .chart-holder { height: 240px; }
    .results, .chart-card, .table-card { padding: 1rem; }
}

/* ------------------------------------------------------- poker picker */
.poker-picker { grid-column: 1 / -1; }

.picker-section { margin-bottom: 1.4rem; }

.picker-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.55rem;
}

.picker-head h2 {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin: 0;
}

.picker-optional {
    color: var(--muted);
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.btn-small {
    padding: 0.3rem 0.7rem;
    font-size: 0.72rem;
    margin-left: 0.5rem;
    box-shadow: none;
}
.btn-small:first-child { margin-left: 0; }

.gear-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: 1.5px solid transparent;
    color: var(--muted);
    padding: 0;
    margin-left: 0.5rem;
    cursor: pointer;
    vertical-align: middle;
    transition: color 0.1s ease;
}

.gear-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    transition: transform 0.2s ease;
}

.gear-btn:hover { color: var(--ink); }

.gear-btn.is-open { color: var(--blue); }

.gear-btn.is-open svg { transform: rotate(45deg); }

.sim-panel {
    margin: 0 0 0.9rem;
    padding: 0.7rem 0.9rem;
    border: 1.5px dashed var(--line);
    background: var(--paper);
    max-width: 26rem;
}

.sim-panel label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

.sim-panel select {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
}

.sim-panel .help {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    margin-top: 0.35rem;
}

.sim-panel .check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.sim-panel .check-row input { accent-color: var(--blue); }

/* boxed group inside a simulator; .sim-panel is the poker settings
   dropdown and restyles every label and select inside it */
.sim-box {
    margin: 0 0 0.9rem;
    padding: 0.7rem 0.9rem;
    border: 1.5px dashed var(--line);
    background: var(--paper);
}

.sim-box > strong:first-child {
    display: block;
    margin-bottom: 0.6rem;
}

.sim-box > .img-row + .img-row { margin-top: 0.7rem; }

/* card faces shared by deck buttons and slots */
.pcard-face {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
    pointer-events: none;
}

.pcard-face b {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
}

.pcard-face i {
    font-style: normal;
    font-size: 1.25rem;
    margin-top: -0.1rem;
}

/* standard deck: hearts and diamonds red; four-colour deck adds
   blue diamonds and green clubs (body.four-color, saved per browser) */
.suit-h, .suit-d { color: #c0392b; }

.four-color .suit-d { color: #1d4ed8; }
.four-color .suit-c { color: #1e7e34; }

.pcard-face.is-mini b { font-size: 0.92rem; }
.pcard-face.is-mini i { font-size: 1.1rem; }

/* deck grid */
.deck-grid {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.2rem 0.2rem 0.4rem;
}

.deck-row {
    display: flex;
    gap: 0.35rem;
}

.pcard {
    width: 2.55rem;
    height: 3.4rem;
    flex: 0 0 auto;
    background: var(--card);
    border: 1.5px solid var(--ink);
    border-radius: 5px;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.08s ease;
}

.pcard:hover {
    transform: translate(-1px, -2px);
    box-shadow: 3px 4px 0 var(--ink);
}

.pcard.is-used {
    opacity: 0.22;
    box-shadow: none;
    transform: none;
    background: var(--paper);
}

.pcard.is-used:hover { opacity: 0.45; }

/* slots (hands and board) */
.hand-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.55rem;
    flex-wrap: wrap;
}

.hand-chip {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    width: 5.2rem;
    flex: 0 0 auto;
}

.pcard-slot {
    width: 2.9rem;
    height: 3.8rem;
    background: var(--card);
    border: 1.5px dashed var(--muted);
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.08s ease, box-shadow 0.08s ease;
}

.pcard-slot.is-filled {
    border-style: solid;
    border-color: var(--ink);
    box-shadow: var(--shadow-sm);
}

.pcard-slot.is-active {
    border-color: var(--blue);
    border-width: 2px;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.18);
}

.pcard-slot.is-locked {
    cursor: default;
    opacity: 0.45;
}

.pcard-empty {
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
}

.hand-remove {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.45rem;
}

.hand-remove:hover { color: var(--orange); }

/* equity shown inline next to each hand after a calculation */
.hand-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
    font-family: var(--font-mono);
    line-height: 1.25;
    text-align: right;
}

.hand-stats b {
    font-size: 1.05rem;
    color: var(--blue);
}

.hand-stats.is-best b { color: var(--orange); }

.hand-stats small {
    font-size: 0.68rem;
    color: var(--muted);
    white-space: nowrap;
}

.sim-note {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
    margin-top: 0.4rem;
}

/* board */
.board-row {
    display: flex;
    gap: 1.1rem;
    flex-wrap: wrap;
}

.board-group { display: flex; flex-direction: column; gap: 0.3rem; }

.board-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.board-slots { display: flex; gap: 0.45rem; flex-wrap: wrap; }

@media (max-width: 560px) {
    .pcard { width: 2.1rem; height: 2.85rem; }
    .pcard-face b { font-size: 0.85rem; }
    .pcard-face i { font-size: 1rem; }
    .pcard-slot { width: 2.5rem; height: 3.3rem; }
}

/* --------------------------------------------- hand vs range equity */
.range-tool { grid-column: 1 / -1; }

.range-count {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
    align-self: center;
}

.range-slider-row {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-bottom: 0.55rem;
}

.range-slider-row label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    white-space: nowrap;
}

.range-slider-row input[type='range'] {
    flex: 1;
    max-width: 24rem;
    accent-color: var(--blue);
}

.range-slider-row output {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    min-width: 3.4rem;
}

.range-presets {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}

.range-presets-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.range-grid {
    display: grid;
    grid-template-columns: repeat(13, minmax(0, 1fr));
    gap: 2px;
    max-width: 34rem;
    touch-action: none;
    user-select: none;
}

.range-cell {
    aspect-ratio: 1 / 1;
    min-width: 0;
    padding: 0;
    border: 1px solid rgba(25, 25, 25, 0.25);
    border-radius: 3px;
    background: var(--card);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--ink);
    cursor: pointer;
    transition: background 0.06s ease, color 0.06s ease;
}

.range-cell.is-pair { background: rgba(25, 25, 25, 0.07); }
.range-cell.is-offsuit { background: var(--paper); }

.range-cell:hover { border-color: var(--ink); }

.range-cell.is-selected {
    background: var(--blue);
    border-color: var(--ink);
    color: #fff;
    font-weight: 700;
}

.range-cell.is-blocked {
    background: repeating-linear-gradient(45deg,
        rgba(25, 25, 25, 0.28), rgba(25, 25, 25, 0.28) 3px,
        rgba(25, 25, 25, 0.12) 3px, rgba(25, 25, 25, 0.12) 6px);
    color: var(--ink);
}

.range-summary[hidden] { display: none; }

.range-summary {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    flex-wrap: wrap;
    margin-top: 0.9rem;
    padding: 0.85rem 1.1rem;
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    max-width: 34rem;
}

.range-summary-hand {
    display: flex;
    gap: 0.5rem;
}

.range-summary-hand .pcard-face {
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--ink);
    border-radius: 4px;
    background: var(--surface);
}

.range-summary-eq {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}

.range-summary-eq b {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--blue);
    line-height: 1;
}

.range-summary-eq span {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
}

.range-summary-detail {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--ink);
}

.range-legend[hidden] { display: none; }

.range-legend {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin-top: 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.range-legend-title { font-weight: 700; }

.range-legend-scale {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
}

.range-legend-swatch {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border: 1px solid var(--ink);
    border-radius: 2px;
}

@media (max-width: 560px) {
    .range-cell { font-size: 0.5rem; border-radius: 2px; }
    .range-grid { gap: 1px; }
}

/* ------------------------------------------------------- image tools */

.img-privacy {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1e7e34;
    border: 1.5px solid #1e7e34;
    padding: 0.3rem 0.65rem;
    margin: 0 0 1rem;
}

.img-privacy svg { width: 14px; height: 14px; flex: 0 0 auto; }

.image-tool { margin-bottom: 1.4rem; }

/* display rules below would otherwise override the hidden attribute */
.image-tool [hidden] { display: none !important; }

.img-controls {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

/* the column layout stretches every button full width; the horizontal
   spacing margin on secondary buttons would otherwise inset them */
.img-controls > .btn-secondary { margin-left: 0; }

/* buttons dropped straight into the controls column keep their natural
   width instead of stretching edge to edge (button rows should use
   .img-actions instead, this is the safety net for loose buttons) */
.img-controls > .btn-primary,
.img-controls > .btn-secondary { align-self: flex-start; }

/* action rows (export/embed buttons under tool output): flex-wrap
   with a uniform gap, so wrapped rows stay aligned and spaced */
.img-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 0.7rem;
    margin: 0.7rem 0;
}

.img-actions > .btn-primary,
.img-actions > .btn-secondary { margin: 0; }

.img-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem 1.1rem;
    align-items: stretch;
}

.img-row > .btn-primary,
.img-row > .btn-secondary { margin: 0; }

/* loose row items (buttons, checkboxes) sit on the control baseline */
.img-row > :not(.img-ctl) { align-self: flex-end; }

.img-ctl {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

/* labels line up along the top of the row, controls along the
   bottom, even when neighbouring controls differ in height */
.img-row > .img-ctl { justify-content: space-between; }

.img-ctl-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
}

/* grouped controls + key/value result rows (crafts tools) */
.img-ctl-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
    align-items: flex-end;
    margin: 0.5rem 0;
}

.img-ctl-group > .img-ctl-label {
    flex-basis: 100%;
    margin-bottom: -0.2rem;
}

/* planetarium: tight button clusters under one label, fixed-width
   play/pause so the label swap does not move neighbours */
.pl-btns { display: flex; gap: 0.35rem; }
.pl-btns > .btn-small { margin-left: 0; }
.pl-play {
    min-width: 7.5em;
    text-align: center;
    /* same type size and vertical padding as the selects/inputs beside it */
    font-size: 0.85rem;
    padding: 0.43rem 0.9rem;
    line-height: normal;
}

/* ------------------------------------------------- geometry board
   toolbar of icon buttons, canvas beside a tabbed side panel (steps /
   algebra / relations), slider strip above, view options below */
.gb-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.2rem;
    padding: 0.35rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
}
.gb-tool {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1.5px solid transparent;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    border-radius: 2px;
}
.gb-tool:hover { border-color: var(--ink); background: var(--tint-blue); }
.gb-tool.is-active { background: var(--ink); color: var(--card); border-color: var(--ink); }
.gb-tool svg { display: block; }
.gb-sep { width: 1.5px; height: 24px; background: var(--line); margin: 0 0.3rem; }

.gb-ask {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.8rem;
    padding: 0.5rem 0.7rem;
    border: 1.5px dashed var(--orange);
    background: var(--tint-orange);
}
.gb-ask-title { font-weight: 600; font-size: 0.9rem; }
.gb-ask-field { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.82rem; }
.gb-ask-field input {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.25rem 0.4rem;
    border: 1.5px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
}
.gb-ask .btn-small { margin: 0; }
.gb-ask-help { flex-basis: 100%; font-size: 0.75rem; color: var(--muted); }

.gb-sliders {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.2rem;
    padding: 0.4rem 0.7rem;
    border: 1.5px solid var(--line);
    background: var(--card);
}
.gb-slider { display: inline-flex; align-items: center; gap: 0.45rem; }
.gb-slider.is-hidden { opacity: 0.55; }
.gb-slider-name {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.85rem;
    border: 0;
    background: transparent;
    color: var(--blue);
    cursor: pointer;
    padding: 0 0.15rem;
}
.gb-slider-name:hover { text-decoration: underline; }
.gb-slider input[type='range'] { width: 150px; accent-color: var(--blue); }
.gb-slider-val { font-family: var(--font-mono); font-size: 0.8rem; min-width: 3.2em; }
.gb-slider-play {
    border: 1.5px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.7rem;
    line-height: 1;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    min-width: 2.1em;
}
.gb-slider-play:hover { background: var(--tint-yellow); }

.gb-main { display: flex; gap: 0.8rem; align-items: stretch; }
.gb-canvas-wrap { flex: 1 1 auto; min-width: 0; position: relative; }
.gb-canvas {
    display: block;
    border: 1.5px solid var(--ink);
    background: #fff;
    cursor: default;
    outline: none;
    user-select: none;
    -webkit-user-select: none;
}
.gb-canvas:focus-visible { box-shadow: 0 0 0 2px var(--blue); }
.gb-coords {
    position: absolute;
    right: 6px;
    bottom: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #6b6b66;
    background: rgba(255, 255, 255, 0.8);
    padding: 0.05rem 0.35rem;
    pointer-events: none;
}

.gb-panel {
    flex: 0 0 300px;
    min-width: 0;
    max-height: 640px;
    display: flex;
    flex-direction: column;
    border: 1.5px solid var(--ink);
    background: var(--card);
    font-size: 0.83rem;
    min-height: 0;
}
.gb-tabs { display: flex; border-bottom: 1.5px solid var(--ink); }
.gb-tab {
    flex: 1;
    border: 0;
    border-right: 1.5px solid var(--line);
    background: transparent;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.5rem 0.2rem;
    cursor: pointer;
}
.gb-tab:last-child { border-right: 0; }
.gb-tab.is-active { color: var(--ink); background: var(--tint-yellow); font-weight: 600; }
.gb-tabbody { overflow: auto; flex: 1 1 auto; padding: 0.4rem 0.5rem; min-height: 0; }
.gb-empty { color: var(--muted); margin: 0.4rem 0; font-size: 0.82rem; }

.gb-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    flex: 0 0 auto;
}
.gb-steps { list-style: none; margin: 0; padding: 0; }
.gb-step {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0.1rem;
    border-bottom: 1px dashed var(--line);
}
.gb-step.is-selected { background: var(--tint-orange); }
.gb-step.is-hidden .gb-step-main { opacity: 0.5; }
.gb-step-num { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); min-width: 1.4em; text-align: right; }
.gb-step-main {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    font: inherit;
    padding: 0.15rem 0.2rem;
    cursor: pointer;
    min-width: 0;
}
.gb-step-main:hover { background: var(--tint-blue); }
.gb-step-main b { font-family: var(--font-mono); font-size: 0.82rem; flex: 0 0 auto; }
.gb-step-desc { flex: 1 1 auto; min-width: 0; color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-step-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.1rem 0.25rem;
}
.gb-step-btn:hover { color: var(--orange); }

.gb-alg-head {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin: 0.6rem 0 0.2rem;
    border: 0;
}
.gb-alg-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--ink);
    text-align: left;
    padding: 0.15rem 0.2rem;
    cursor: pointer;
}
.gb-alg-row code { font-size: 0.78rem; background: transparent; padding: 0; white-space: nowrap; }
.gb-alg-row:hover { background: var(--tint-blue); }
.gb-alg-row.is-selected { background: var(--tint-orange); }
.gb-alg-row.is-hidden { opacity: 0.5; }

.gb-rel-help, .gb-rel-foot { color: var(--muted); font-size: 0.76rem; margin: 0.3rem 0 0.5rem; }
.gb-rels { list-style: none; margin: 0; padding: 0; }
.gb-rel {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.45rem;
    padding: 0.35rem 0.2rem;
    border-bottom: 1px dashed var(--line);
}
.gb-rel-mark { font-weight: 700; }
.gb-rel.is-true .gb-rel-mark { color: #15803d; }
.gb-rel.is-coincidence .gb-rel-mark { color: var(--orange); }
.gb-rel.is-false .gb-rel-mark { color: var(--muted); }
.gb-rel.is-false .gb-rel-text { color: var(--muted); }
.gb-rel-text { font-weight: 600; flex: 1 1 0; min-width: 0; }
.gb-rel-tag { flex-basis: 100%; font-size: 0.74rem; color: var(--muted); padding-left: 1.2rem; }
.gb-rel.is-true .gb-rel-tag { color: #15803d; }
.gb-rel.is-coincidence .gb-rel-tag { color: var(--orange); }
.gb-rel-detail { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }

.gb-props {
    padding: 0.45rem 0.55rem 0.5rem;
    border-bottom: 1.5px solid var(--ink);
    background: var(--tint-yellow);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.gb-props-title { display: flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; min-width: 0; }
.gb-props-title b { font-family: var(--font-mono); }
.gb-props-desc { color: var(--muted); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 3D board: live value (coordinates / equation) under the title */
.gb-props-value { font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink); word-break: break-word; }
.gb-props-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.7rem; }
.gb-props-row .btn-small { margin: 0; }
.gb-props-row .img-check { font-size: 0.8rem; }
.gb-prop { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.78rem; }
.gb-prop input {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.15rem 0.3rem;
    border: 1.5px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
}
.gb-colors { display: inline-flex; gap: 0.25rem; }
.gb-color {
    width: 16px;
    height: 16px;
    border: 1.5px solid transparent;
    cursor: pointer;
    padding: 0;
}
.gb-color.is-active { border-color: var(--ink); box-shadow: 0 0 0 1.5px var(--card) inset; }

.gb-bottom { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.4rem; }
.gb-bottom-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; }
.gb-bottom-row .btn-small, .gb-bottom-row .btn-secondary { margin: 0; }
.gb-bottom-row .img-check { font-size: 0.82rem; }
.gb-bottom-row select { font-size: 0.82rem; padding: 0.3rem 0.5rem; }

/* fullscreen: the whole board (toolbar, sliders, canvas + panel, view and
   file rows) becomes a viewport-filling column; only the canvas row may
   grow, so every control stays in reach. Used both for the native
   Fullscreen API (root:fullscreen) and as a fixed overlay fallback. */
body.gb-fs-lock { overflow: hidden; }
.gb-root.is-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0.6rem 0.8rem;
    background: var(--surface);
    overflow: hidden;
}
.gb-root.is-fullscreen > .img-controls,
.gb-root.is-fullscreen > .img-status,
.gb-root.is-fullscreen > .img-outputs { flex: 0 0 auto; margin: 0; }
.gb-root.is-fullscreen > .img-status { min-height: 0; }
.gb-root.is-fullscreen > .img-stage { flex: 1 1 auto; min-height: 0; display: flex; margin: 0; }
.gb-root.is-fullscreen .gb-main { flex: 1 1 auto; min-height: 0; min-width: 0; }
.gb-root.is-fullscreen .gb-canvas-wrap { min-height: 0; }
/* the canvas is sized by script from the wrap's box, so it must not
   dictate that box's height in return */
.gb-root.is-fullscreen .gb-canvas { position: absolute; top: 0; left: 0; }
.gb-root.is-fullscreen .gb-panel { max-height: none; }
.gb-root.is-fullscreen .gb-help { display: none; }
.gb-root.is-fullscreen .gb-share { max-height: 30vh; overflow: auto; }
@media (max-width: 860px) {
    /* on phones the panel stacks under the canvas; keep it scrollable */
    .gb-root.is-fullscreen > .img-stage { overflow: auto; }
    .gb-root.is-fullscreen .gb-canvas { position: static; }
}

/* share panel: publish → short link + iframe snippet */
.gb-share {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border: 1.5px dashed var(--blue);
    background: var(--tint-blue);
    font-size: 0.84rem;
}
.gb-share-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.8rem; }
.gb-share-help { color: var(--muted); font-size: 0.78rem; flex-basis: 100%; }
.gb-share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.7rem; }
.gb-share-row .btn-small, .gb-share-row .btn-primary { margin: 0; }
.gb-share-row .gb-prop input { font-family: inherit; }
.gb-share-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    min-width: 3.5em;
}
.gb-share-field {
    flex: 1 1 200px;
    min-width: 0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.3rem 0.45rem;
    border: 1.5px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
}
.gb-share-result { display: flex; flex-direction: column; gap: 0.4rem; }
.gb-share-result:empty { display: none; }
.gb-share-open { font-size: 0.82rem; align-self: flex-start; }

/* right-click menu: fixed to the viewport, one column of buttons */
.gb-menu {
    position: fixed;
    z-index: 1100; /* above the fullscreen overlay */
    min-width: 200px;
    max-width: 320px;
    max-height: calc(100vh - 16px);
    overflow: auto;
    padding: 0.25rem 0;
    border: 1.5px solid var(--ink);
    background: var(--card);
    color: var(--ink);
    box-shadow: 4px 4px 0 var(--ink);
    font-size: 0.83rem;
    outline: none;
}
.gb-menu-head {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.7rem 0.2rem;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
}
.gb-menu-obj { text-transform: none; letter-spacing: 0; font-size: 0.83rem; color: var(--ink); min-width: 0; }
.gb-menu-obj b { font-family: var(--font-mono); }
.gb-menu-desc { color: var(--muted); font-size: 0.76rem; font-family: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-menu-sep { height: 1px; margin: 0.25rem 0; background: var(--line); }
.gb-menu-item, .gb-menu-colors {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.32rem 0.7rem 0.32rem 0.4rem;
    border: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.gb-menu-colors { cursor: default; }
.gb-menu-item:hover, .gb-menu-item:focus-visible { background: var(--tint-blue); outline: none; }
.gb-menu-item[disabled] { color: var(--muted); cursor: default; background: transparent; }
.gb-menu-item.is-danger:hover, .gb-menu-item.is-danger:focus-visible { background: var(--tint-orange); }
.gb-menu-check { flex: 0 0 1em; text-align: center; font-size: 0.8rem; }
.gb-menu-label { flex: 1 1 auto; white-space: nowrap; }
.gb-menu-hint {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 11em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}
.gb-menu-colors .gb-color { width: 15px; height: 15px; }

.gb-help { margin-top: 1rem; font-size: 0.86rem; }
.gb-help summary { cursor: pointer; font-weight: 600; }
.gb-help ul { margin: 0.5rem 0 0 1.2rem; color: var(--muted); }
.gb-help li { margin-bottom: 0.3rem; }
.gb-help p { margin: 0.5rem 0 0; color: var(--muted); }

@media (max-width: 860px) {
    .gb-main { flex-direction: column; }
    .gb-panel { flex-basis: auto; max-height: 340px; }
}

/* ------------------------------------------------- wallpaper designer
   reuses the geometry-board chrome; adds the 17-group grid, the group
   fact box and the symmetry legend */
.wp-canvas { cursor: crosshair; touch-action: none; }
.wp-panel .gb-tabbody { display: flex; flex-direction: column; gap: 0.5rem; }
.wp-panel .img-ctl { margin: 0; }
.wp-groups { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.wp-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.3rem 0.1rem 0.25rem;
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    line-height: 1.15;
}
.wp-group b { font-family: var(--font-mono); font-size: 0.78rem; }
.wp-group span { font-size: 0.62rem; color: var(--muted); }
.wp-group:hover { border-color: var(--ink); background: var(--tint-blue); }
.wp-group.is-active { background: var(--ink); border-color: var(--ink); color: var(--card); }
.wp-group.is-active span { color: rgba(255, 255, 255, 0.7); }
.wp-info { padding: 0.45rem 0.55rem; border: 1.5px solid var(--ink); background: var(--tint-yellow); }
.wp-info-title { font-family: var(--font-mono); font-weight: 600; font-size: 0.86rem; }
.wp-info-desc { margin: 0.3rem 0 0.35rem; font-size: 0.78rem; }
.wp-facts { margin: 0; padding: 0 0 0 1rem; font-size: 0.76rem; color: var(--muted); }
.wp-facts li { margin: 0.1rem 0; white-space: pre-wrap; }
.wp-legend { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; font-size: 0.74rem; color: var(--muted); }
.wp-legend span { display: inline-flex; align-items: center; gap: 0.3rem; }
.wp-legend i { display: inline-block; width: 18px; height: 0; border-top: 2px solid #e8590c; }
.wp-legend .wp-leg-glide { border-top: 2px dashed #1d4ed8; }
.wp-legend .wp-leg-centre {
    width: 9px;
    height: 9px;
    border: 0;
    background: #1d4ed8;
    transform: rotate(45deg);
}
.wp-lattice { display: flex; flex-direction: column; gap: 0.4rem; }
.wp-lattice .img-slider input[type='range'] { width: 150px; }
.wp-colors { display: inline-flex; flex-wrap: wrap; gap: 0.25rem; align-items: center; }
.wp-colors .gb-color { width: 20px; height: 20px; }
.wp-colorpick { width: 24px; height: 22px; padding: 0; border: 1.5px solid var(--line); background: transparent; cursor: pointer; }
.wp-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.wp-presets .btn-small { margin: 0; }
.wp-export { display: flex; flex-direction: column; gap: 0.4rem; align-items: stretch; }
.wp-export .btn-secondary { margin: 0; }
.wp-root .gb-toolbar .btn-small { margin: 0 0.1rem; }
@media (max-width: 400px) {
    .wp-groups { grid-template-columns: repeat(4, 1fr); }
}

/* word cloud: text box above, toolbar of quick pickers, canvas beside
   the tabbed options panel */
.wc-input { display: flex; flex-direction: column; gap: 0.35rem; }
.wc-text {
    width: 100%;
    box-sizing: border-box;
    min-height: 7.5rem;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
    border: 1.5px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
}
.wc-root.is-dragover .wc-text { border-style: dashed; background: var(--tint-blue); }
.wc-input-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.wc-input-row .btn-small { margin: 0; }
.wc-input-row select { font-size: 0.82rem; padding: 0.3rem 0.5rem; }
.wc-count { margin-left: auto; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.wc-toolbar { gap: 0.4rem 0.6rem; }
.wc-toolbar .img-ctl { flex-direction: row; align-items: center; gap: 0.35rem; }
.wc-toolbar .img-ctl select { font-size: 0.8rem; padding: 0.25rem 0.4rem; max-width: 11rem; }
.wc-toolbar .btn-small, .wc-toolbar .btn-primary { margin: 0; }
.wc-toolbar .btn-primary { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.wc-canvas-wrap { display: flex; justify-content: center; align-items: flex-start; }
.wc-canvas { max-width: 100%; }
.wc-tip {
    position: absolute;
    pointer-events: none;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--ink);
    color: var(--card);
    padding: 0.15rem 0.45rem;
    white-space: nowrap;
    z-index: 2;
}
.wc-busy {
    position: absolute;
    top: 8px;
    right: 8px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: rgba(25, 25, 25, 0.8);
    color: #fff;
    padding: 0.15rem 0.5rem;
    pointer-events: none;
}
.wc-panel .gb-tabbody { display: flex; flex-direction: column; gap: 0.5rem; }
.wc-panel .img-ctl { margin: 0; }
.wc-panel .img-slider input[type='range'] { width: 140px; }
.wc-sect {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    border-bottom: 1.5px solid var(--line);
    padding-bottom: 0.15rem;
    margin-top: 0.3rem;
}
.wc-sect:first-child { margin-top: 0; }
.wc-custom, .wc-masktext {
    width: 100%;
    box-sizing: border-box;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    padding: 0.3rem 0.45rem;
    border: 1.5px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
}
.wc-checks { display: flex; flex-direction: column; gap: 0.2rem; }
.wc-checks .img-check { font-size: 0.82rem; }
.wc-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.wc-chip {
    border: 1.5px solid var(--ink);
    background: var(--tint-yellow);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    padding: 0.1rem 0.45rem;
    cursor: pointer;
    text-decoration: line-through;
}
.wc-chip:hover { background: var(--ink); color: var(--card); }
.wc-chip-all { text-decoration: none; background: transparent; }
.wc-list { display: flex; flex-direction: column; gap: 1px; }
.wc-row {
    position: relative;
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.4rem;
    padding: 0.12rem 0.35rem;
    font-size: 0.8rem;
    overflow: hidden;
}
.wc-row.is-dropped { opacity: 0.5; }
.wc-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--tint-blue); z-index: 0; }
.wc-row > span:not(.wc-bar), .wc-row > button { position: relative; z-index: 1; }
.wc-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wc-num { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.wc-x {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    padding: 0 0.2rem;
}
.wc-x:hover { color: var(--red, #c0392b); }
.wc-shapes { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; }
.wc-shape {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    border: 1.5px solid var(--line);
    background: var(--surface);
    cursor: pointer;
}
.wc-shape canvas { display: block; width: 32px; height: 32px; }
.wc-shape:hover { border-color: var(--ink); background: var(--tint-blue); }
.wc-shape.is-active { background: var(--ink); border-color: var(--ink); }
.wc-swatches { display: flex; gap: 2px; }
.wc-swatch { flex: 1; height: 12px; border: 1px solid rgba(0, 0, 0, 0.15); }
.wc-root .gb-toolbar .btn-small { margin: 0; }
.wc-root.is-fullscreen .wc-text { min-height: 3.2rem; max-height: 5rem; }
.wc-root.is-fullscreen .gb-canvas { position: static; }
.wc-root.is-fullscreen .wc-canvas-wrap { align-items: center; overflow: hidden; }
@media (max-width: 860px) {
    .wc-panel { max-height: 420px; }
}

/* algebra solver: the worked solution, one numbered line per step,
   sub-steps (cases, factors) indented with a rule on the left */
.alg-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 0.7rem;
}
.alg-head h2 { border-bottom: 0; margin-bottom: 0.4rem; }
.alg-count {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
}
.alg-list { list-style: none; margin: 0; padding: 0; }
.alg-step {
    padding: 0.55rem 0 0.5rem;
    border-bottom: 1px dashed var(--line);
}
.alg-step:last-child { border-bottom: 0; }
.alg-step[data-level='1'] { margin-left: 1.4rem; border-left: 2px solid var(--line); padding-left: 0.9rem; }
.alg-step[data-level='2'] { margin-left: 2.8rem; border-left: 2px solid var(--line); padding-left: 0.9rem; }
.alg-step[data-level='3'] { margin-left: 4.2rem; border-left: 2px solid var(--line); padding-left: 0.9rem; }
.alg-step[data-level='4'] { margin-left: 5.6rem; border-left: 2px solid var(--line); padding-left: 0.9rem; }
.alg-step-head { display: flex; gap: 0.6rem; align-items: baseline; }
.alg-step-num {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    min-width: 1.6em;
    text-align: right;
}
.alg-step-title { font-weight: 600; font-size: 0.95rem; }
.alg-step-math {
    margin: 0.35rem 0 0.1rem 2.2em;
    overflow-x: auto;
    overflow-y: hidden;
    font-size: 1.05rem;
}
.alg-step-math .katex-display { margin: 0.3rem 0; text-align: left; }
.alg-step-math .katex-display > .katex { text-align: left; }
.alg-step-note {
    margin: 0.15rem 0 0 2.2em;
    font-size: 0.85rem;
    color: var(--muted);
}
.alg-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }
.alg-actions .btn-secondary { margin-left: 0; }
@media (max-width: 520px) {
    .alg-step[data-level='1'], .alg-step[data-level='2'],
    .alg-step[data-level='3'], .alg-step[data-level='4'] { margin-left: 0.6rem; padding-left: 0.6rem; }
    .alg-step-math, .alg-step-note { margin-left: 0; }
}
@media print {
    .alg-actions { display: none; }
}

.img-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0.35rem 0;
    max-width: 34rem;
}

.img-subhead {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1.1rem 0 0.4rem;
}

.img-results {
    max-width: 30rem;
    margin: 0.8rem 0;
}

.img-result-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--line);
}

.img-result-label { color: var(--muted); }

.img-result-value {
    font-family: var(--font-mono);
    font-weight: 700;
    white-space: nowrap;
}

.img-ctl select,
.img-ctl input[type="text"],
.img-ctl input[type="password"],
.img-ctl input[type="number"] {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 0.4rem 0.5rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
}

/* Selects size to their widest option instead of stretching to fill
   the whole control column (which made short dropdowns look huge).
   Tools that want a full-width select set an explicit width in a
   scoped rule (e.g. the data/viz forms below). */
.img-ctl select { align-self: flex-start; max-width: 100%; }

.img-ctl input[type="color"] {
    width: 3rem;
    height: 2.1rem;
    padding: 2px;
    border: 1.5px solid var(--ink);
    background: var(--card);
    cursor: pointer;
}

.img-ctl input[type="file"] { font-size: 0.8rem; max-width: 24rem; }

/* native file pickers: dashed "attach" look, same family as the
   upload dropzones — deliberately distinct from action buttons */
input[type="file"] {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
}

input[type="file"]::file-selector-button {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    background: var(--card);
    color: var(--ink);
    border: 1.5px dashed var(--muted);
    border-radius: 0;
    box-shadow: none;
    padding: 0.3rem 0.75rem;
    margin-right: 0.6rem;
    cursor: pointer;
    transition: color 0.1s ease, border-color 0.1s ease,
        background 0.1s ease;
}

input[type="file"]::file-selector-button:hover {
    color: var(--blue);
    border-color: var(--blue);
}

.img-slider {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.img-slider input[type="range"] {
    width: 9.5rem;
    accent-color: var(--blue);
}

.img-slider-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    min-width: 3.2rem;
}

.img-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
}

.img-check input { accent-color: var(--blue); }

.img-dropzone {
    border: 2px dashed var(--muted);
    background: var(--card);
    padding: 2.2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.1s ease, background 0.1s ease;
    margin-bottom: 0.9rem;
}

.img-dropzone:hover, .img-dropzone.is-drag {
    border-color: var(--blue);
    background: #f4f7ff;
}

.img-dropzone-icon {
    font-size: 1.7rem;
    color: var(--muted);
    line-height: 1;
    margin-bottom: 0.4rem;
}

.img-dropzone p {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
}

.img-status {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0.5rem 0;
}

.img-status.is-error { color: var(--orange); }

.img-note {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}

p.img-note { margin: 0.4rem 0; }

.img-outputs { margin-top: 0.9rem; }

.img-outputs h2 {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.1rem 0 0.5rem;
}

.img-outputs > .btn-primary,
.img-outputs > .btn-secondary { margin: 0.5rem 0.6rem 0.5rem 0; }

.img-output-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.6rem;
}

.img-thumb {
    width: 64px;
    height: 64px;
    object-fit: contain;
    flex: 0 0 auto;
    background:
        repeating-conic-gradient(#e8e6e0 0% 25%, #fdfcf9 0% 50%) 0 0 / 16px 16px;
    border: 1px solid var(--line);
}

.img-output-meta {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.img-output-meta strong {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    word-break: break-all;
}

.img-checker {
    background:
        repeating-conic-gradient(#e8e6e0 0% 25%, #fdfcf9 0% 50%) 0 0 / 16px 16px;
}

.img-preview-canvas, .img-crop-canvas {
    max-width: 100%;
    height: auto;
    display: block;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.6rem 0;
}

.img-crop-canvas { touch-action: none; cursor: crosshair; }

.img-crop-wrap { display: inline-block; }

.img-code-block {
    border: 1.5px solid var(--line);
    background: var(--card);
    padding: 0.6rem 0.8rem;
    margin-bottom: 0.7rem;
}

.img-code-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.img-code-block textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    border: 1px solid var(--line);
    background: var(--paper);
    padding: 0.45rem;
    resize: vertical;
}

.img-b64-input {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    padding: 0.55rem;
    margin-bottom: 0.6rem;
}

.img-tabs { display: flex; gap: 0; margin-bottom: 0.4rem; }

.img-tab {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--paper);
    border: 1.5px solid var(--ink);
    padding: 0.45rem 0.9rem;
    cursor: pointer;
    margin-right: -1.5px;
}

.img-tab.is-active {
    background: var(--ink);
    color: var(--card);
}

.img-svg-preview {
    max-width: 420px;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem;
    margin: 0.6rem 0;
}

.img-svg-preview svg { max-width: 100%; height: auto; display: block; }

.img-favicon-strip {
    display: flex;
    align-items: flex-end;
    gap: 0.9rem;
    margin: 0.6rem 0 1rem;
    flex-wrap: wrap;
}

.img-favicon-strip canvas {
    border: 1px solid var(--line);
    image-rendering: auto;
}

.img-exif-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin: 0.6rem 0 1rem;
}

.img-exif-table th, .img-exif-table td {
    border: 1px solid var(--line);
    padding: 0.3rem 0.55rem;
    text-align: left;
    vertical-align: top;
}

.img-exif-table th {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    background: var(--paper);
    white-space: nowrap;
}

.img-exif-table td { word-break: break-word; font-family: var(--font-mono); }

.img-loupe {
    position: absolute;
    z-index: 30;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 0.35rem 0.5rem;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    pointer-events: none;
}

.img-swatch-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin: 0.5rem 0 1rem;
}

.img-swatch {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    border: 1.5px solid var(--line);
    background: var(--card);
    padding: 0.4rem 0.6rem;
}

.img-swatch-chip {
    width: 2.2rem;
    height: 2.2rem;
    flex: 0 0 auto;
    border: 1.5px solid var(--ink);
}

.img-swatch-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.img-swatch-info code { font-size: 0.85rem; font-weight: 600; }

.img-diff-zones {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.img-diff-zone .img-dropzone { padding: 1.4rem 0.8rem; }

/* ----------------------------- image tools: stable status line */

/* Image tools flash the status line ("Working…") via the hidden
   attribute on every recompute; keep the line in flow reserving one
   text line so toggling it never reflows the stage below. Scoped to
   #image-tool: the .image-tool class is shared by other tool
   families (dev, edu, time, …) whose layouts are out of scope. */
#image-tool .img-status {
    display: block;
    /* min-height must equal one text line exactly, so pin line-height */
    line-height: 1.4;
    min-height: 1.4em;
}

/* !important needed to beat `.image-tool [hidden]` above */
#image-tool .img-status[hidden] {
    display: block !important;
    visibility: hidden;
}

.img-swipe {
    position: relative;
    display: inline-block;
    max-width: 100%;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.5rem 0;
    overflow: hidden;
}

.img-swipe img {
    display: block;
    max-width: 100%;
    height: auto;
}

.img-swipe-top {
    position: absolute;
    inset: 0 auto 0 0;
    width: 50%;
    overflow: hidden;
    border-right: 2px solid var(--orange);
}

.img-swipe-top img { max-width: none; }

.img-swipe-slider { display: flex; margin-bottom: 1rem; }

/* --------------------- image compressor: before/after swipe */

#image-tool .imgc-compare { margin-top: 0.9rem; }

#image-tool .imgc-compare h2 { margin-bottom: 0.2rem; }

#image-tool .imgc-swipe {
    touch-action: none;
    cursor: ew-resize;
    user-select: none;
}

#image-tool .imgc-swipe canvas { display: block; max-width: none; }

#image-tool .imgc-swipe-label {
    position: absolute;
    top: 0.45rem;
    padding: 0.1rem 0.45rem;
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--line);
    font-size: 0.72rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
}

#image-tool .imgc-swipe-label-a { left: 0.45rem; }

#image-tool .imgc-swipe-label-b { right: 0.45rem; }

#image-tool .imgc-swipe-scroll { max-width: 100%; }

#image-tool .imgc-compare.is-full .imgc-swipe-scroll { overflow: auto; }

#image-tool .imgc-compare.is-full .img-swipe img { max-width: none; }

#image-tool .imgc-swipe-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
}

#image-tool .imgc-swipe-tools .img-swipe-slider { margin-bottom: 0; }

#image-tool .imgc-warn { color: var(--muted); font-style: italic; }

.img-qr-out { margin: 0.4rem 0; }

.img-qr-canvas {
    display: block;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.5rem 0;
    max-width: 100%;
    height: auto;
}

.img-frame-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.6rem 0;
}

.img-frame {
    border: 1px solid var(--line);
    background:
        repeating-conic-gradient(#e8e6e0 0% 25%, #fdfcf9 0% 50%) 0 0 / 12px 12px;
    max-width: 96px;
    max-height: 96px;
    width: auto;
    height: auto;
}

.img-sprite-preview {
    display: inline-block;
    padding: 0.5rem;
    margin: 0.5rem 0;
}

.img-ascii-out {
    background: #14151a;
    color: #e8e6e0;
    padding: 0.9rem;
    overflow-x: auto;
    line-height: 1.05;
    font-family: var(--font-mono);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.6rem 0;
}

@media (max-width: 640px) {
    .img-diff-zones { grid-template-columns: 1fr; }
    .img-slider input[type="range"] { width: 7rem; }
}

/* ------------------------------------------------------ media tools */

.media-wave {
    display: block;
    width: 100%;
    height: auto;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.6rem 0;
    background: var(--card);
}

.media-player { width: 100%; max-width: 420px; }

.media-video {
    display: block;
    max-width: 100%;
    max-height: 360px;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.6rem 0;
    background: #14151a;
}

.media-output { flex-wrap: wrap; }

.media-textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.6rem 0.8rem;
    margin: 0.6rem 0;
    resize: vertical;
}

.media-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0.6rem 0;
}

.media-stat {
    border: 1.5px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.45rem 0.7rem;
    min-width: 7rem;
}

.media-stat dt {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.media-stat dd {
    margin: 0.15rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
}

.media-tap {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 0.6rem 0 1rem;
}

.media-tap-btn {
    min-width: 8rem;
    min-height: 4rem;
    font-size: 1.1rem;
}

.media-tap-bpm {
    font-family: var(--font-mono);
    font-size: 2.2rem;
    font-weight: 700;
    min-width: 6rem;
}

.media-beats {
    display: flex;
    gap: 0.6rem;
    margin: 0.8rem 0;
}

.media-beat {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    border: 2px solid var(--ink);
    background: var(--card);
    transition: background 60ms;
}

.media-beat.is-accent { border-width: 3px; }

.media-beat.is-on { background: var(--orange); }

/* ---------------------------------------------- wiki cell strips */

.wiki-cellstrip {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
    margin: 0.3rem 0;
}

.wiki-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.55rem;
    height: 1.55rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    border: 1px solid rgba(25, 25, 25, 0.3);
}

.wiki-cell.is-hot {
    outline: 2px solid var(--ink);
    outline-offset: -2px;
    font-weight: 700;
}

/* ------------------------------------------------------- time tools */

.time-zone-list { display: flex; flex-direction: column; gap: 0.5rem; }

.time-zone-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.55rem 0.9rem;
}

.time-zone-row.is-source { border-color: var(--orange); }

.time-zone-name {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.time-zone-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
}

.time-zone-time strong {
    font-family: var(--font-mono);
    font-size: 1.5rem;
}

.time-zone-remove { padding: 0.1rem 0.5rem; }

.time-grid-holder { overflow-x: auto; }

.time-grid {
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.time-grid th {
    text-align: left;
    padding: 0.25rem 0.6rem 0.25rem 0;
    white-space: nowrap;
}

.time-cell {
    width: 1.7rem;
    min-width: 1.7rem;
    text-align: center;
    padding: 0.35rem 0;
    border: 1px solid rgba(25, 25, 25, 0.25);
}

.time-cell-work { background: rgba(47, 158, 68, 0.35); }
.time-cell-fringe { background: rgba(232, 89, 12, 0.25); }
.time-cell-night { background: rgba(25, 25, 25, 0.12); }
.time-cell.is-overlap { outline: 2px solid var(--ink); outline-offset: -2px; }

.time-cell-demo {
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    border: 1px solid rgba(25, 25, 25, 0.4);
    vertical-align: middle;
}

.time-weekend-picks { display: inline-flex; flex-wrap: wrap; gap: 0.7rem; }

.time-holidays textarea { min-width: 16rem; }

.time-count {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin: 0.8rem 0;
}

.time-count-box {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.7rem 1rem;
    min-width: 5.2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.time-count-box strong {
    font-family: var(--font-mono);
    font-size: 2rem;
    line-height: 1;
}

.time-count-box span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.time-count.is-past .time-count-box { border-color: var(--orange); }

.time-count-label {
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0.4rem 0 0;
}

.time-big {
    font-family: var(--font-mono);
    font-size: clamp(2.6rem, 12vw, 5rem);
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
}

.time-big.is-done { color: var(--accent); }

.time-phase {
    text-align: center;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.9rem;
    color: var(--muted);
}

.time-phase.is-phaseWork { color: var(--ink); font-weight: 700; }
.time-phase.is-phaseShort,
.time-phase.is-phaseLong { color: var(--accent); font-weight: 700; }

.time-worldclock {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.9rem;
    margin-top: 1rem;
}

.time-wc-card {
    position: relative;
    background: var(--card);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow);
    padding: 0.9rem 1rem;
}

.time-wc-city {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    color: var(--muted);
}

.time-wc-time {
    font-family: var(--font-mono);
    font-size: 1.7rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.time-wc-date { font-size: 0.82rem; color: var(--muted); }

.time-wc-remove {
    position: absolute;
    top: 0.3rem;
    right: 0.3rem;
    padding: 0 0.4rem;
    line-height: 1.4;
}

.time-cal-holder { overflow-x: auto; }

.time-cal {
    border-collapse: collapse;
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.4rem 0;
}

.time-cal caption {
    font-weight: 700;
    padding: 0.5rem;
    border: 2px solid var(--ink);
    border-bottom: none;
    background: var(--card);
}

.time-cal th, .time-cal td {
    border: 1px solid rgba(25, 25, 25, 0.3);
    padding: 0.45rem 0;
    text-align: center;
    width: 2.6rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.time-cal th {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.time-cal td.is-empty { background: rgba(25, 25, 25, 0.05); }

.time-cal td.is-today {
    background: var(--orange);
    color: var(--card);
    font-weight: 700;
}

.time-cal .time-cal-wk {
    background: rgba(25, 25, 25, 0.07);
    font-size: 0.68rem;
    color: var(--muted);
    width: 1.9rem;
}

.time-cal.is-mini th, .time-cal.is-mini td {
    width: 1.9rem;
    padding: 0.25rem 0;
    font-size: 0.7rem;
}

.time-cal-title { margin: 0 0 0.6rem; }

.time-cal-months {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 1rem;
}

@media print {
    body.has-time-cal .site-header,
    body.has-time-cal .site-footer,
    body.has-time-cal .breadcrumbs,
    body.has-time-cal .tool > h1,
    body.has-time-cal .tool > .lead,
    body.has-time-cal .guide-link,
    body.has-time-cal .notes,
    body.has-time-cal .tool-explore,
    body.has-time-cal .img-controls,
    body.has-time-cal .img-status { display: none !important; }
    body.has-time-cal .time-cal,
    body.has-time-cal .time-cal caption { box-shadow: none; }
}

/* -------------------------------------------- random wiki widgets */

.wiki-widget-caption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 0.7rem 0 0.2rem;
}

.wiki-widget-pie {
    display: block;
    margin: 0.5rem auto;
    max-width: 100%;
    height: auto;
}

.wiki-stackbar {
    display: flex;
    width: 100%;
    height: 2.1rem;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin: 0.5rem 0 0.8rem;
}

.wiki-stackbar-seg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    transition: width 120ms;
}

.wiki-bracket-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0.3rem 0 0.7rem;
}

.wiki-bracket-match {
    display: inline-flex;
    border: 1.5px solid var(--ink);
}

.wiki-swatch-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5rem;
    height: 2.2rem;
    padding: 0 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 600;
    border: 1.5px solid var(--ink);
}

/* ----------------------------------------------------- random tools */

.random-tool textarea {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 0.7rem;
    min-width: 15rem;
    resize: vertical;
}

.rnd-pass-list { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.6rem 0; }

.rnd-pass {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.55rem 0.9rem;
}

.rnd-pass-text {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 1.05rem;
    word-break: break-all;
}

.rnd-pass-text.is-large { font-size: 1.25rem; }

.rnd-strength-input {
    font-family: var(--font-mono);
    min-width: 20rem;
    max-width: 100%;
}

.rnd-meter {
    height: 0.8rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    margin: 0.6rem 0;
    overflow: hidden;
}

.rnd-meter-fill {
    display: block;
    height: 100%;
    width: 0;
    background: var(--orange);
    transition: width 160ms, background 160ms;
}

.rnd-warnings ul { margin: 0.3rem 0 0; padding-left: 1.2rem; }
.rnd-warnings li { margin: 0.15rem 0; }
.rnd-warnings li.is-ok { list-style: none; margin-left: -1.2rem; color: var(--muted); }

.rnd-big-result {
    display: flex;
    align-items: baseline;
    gap: 0.9rem;
    margin: 0.6rem 0;
}

.rnd-big-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.rnd-big-result strong {
    font-family: var(--font-mono);
    font-size: 2.6rem;
    line-height: 1;
}

.rnd-big-result.is-huge strong { font-size: 3.4rem; }

.rnd-dice-detail { display: flex; flex-direction: column; gap: 0.35rem; margin: 0.5rem 0; }

.rnd-dice-group { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }

.rnd-dice-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
    min-width: 4.4rem;
}

.rnd-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.45rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-mono);
    font-weight: 600;
}

.rnd-chip.is-dropped {
    opacity: 0.4;
    text-decoration: line-through;
    box-shadow: none;
}

.rnd-chip.is-winner { border-color: var(--orange); }

.rnd-chip-set { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.6rem 0; }

.rnd-dist {
    display: block;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: var(--card);
    margin: 0.6rem 0;
}

.rnd-history { margin: 0.3rem 0 0; padding-left: 1.2rem; font-family: var(--font-mono); font-size: 0.82rem; }

/* blackjack strategy grids */

.bj-grids { margin: 1.2rem 0; }

.bj-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0 0 0.6rem;
}

.bj-chip {
    padding: 0.12rem 0.5rem;
    border: 1.5px solid var(--ink);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.bj-detail {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.5rem 0.7rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    margin-bottom: 0.7rem;
}

.bj-grid-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    align-items: flex-start;
}

.bj-grid h3 {
    font-size: 0.95rem;
    margin: 0 0 0.3rem;
}

.bj-grid table {
    border-collapse: collapse;
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.bj-grid th, .bj-grid td {
    border: 1px solid var(--ink);
    padding: 0.14rem 0.32rem;
    text-align: center;
    min-width: 1.7rem;
}

.bj-grid thead th {
    background: var(--ink);
    color: #fff;
    font-weight: 400;
}

.bj-grid thead th:first-child {
    font-size: 0.6rem;
    max-width: 3.5rem;
}

.bj-grid tbody th {
    background: var(--card);
    font-weight: 700;
}

.bj-grid td { cursor: default; }

/* push/fold chart */

.pf-pos .is-active {
    background: var(--ink);
    color: #fff;
}

.range-cell.is-hero {
    outline: 3px solid var(--blue);
    outline-offset: -2px;
}

.pf-hand-label {
    font-family: var(--font-display);
    font-size: 1.5rem;
}

/* anagram finder + wordle solver */

.ana-group-head {
    font-size: 0.85rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin: 0.9rem 0 0.3rem;
}

.ana-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.ana-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.15rem 0.5rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.ana-chip i {
    font-style: normal;
    font-size: 0.7rem;
    color: var(--muted);
}

.wdl-row {
    display: flex;
    gap: 0.3rem;
    margin: 0.35rem 0;
}

.wdl-tile {
    width: 2.4rem;
    height: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    border: 2px solid var(--ink);
    background: var(--surface);
    user-select: none;
}

.wdl-tile.is-clickable { cursor: pointer; }
.wdl-tile.is-0 { background: #9aa0a6; color: #fff; }
.wdl-tile.is-1 { background: #c9b458; color: #fff; }
.wdl-tile.is-2 { background: #6aaa64; color: #fff; }
.wdl-tile.is-empty { border-style: dashed; }

.wdl-guess {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.wdl-count {
    font-family: var(--font-mono);
    font-weight: 700;
    margin: 0.7rem 0 0.2rem;
}

.wdl-solved {
    font-size: 1.1rem;
    margin: 0.3rem 0;
}

.time-sky-head {
    font-size: 1.05rem;
    margin: 1rem 0 0.3rem;
}

.time-sky-chart {
    display: block;
    width: 100%;
    max-width: 760px;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: #fff;
    margin: 0.4rem 0;
}

.rnd-lab-chart {
    display: block;
    width: 100%;
    max-width: 760px;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: #fff;
    margin: 0.6rem 0;
}

.rnd-coin {
    width: 6.5rem;
    height: 6.5rem;
    border-radius: 50%;
    border: 3px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 2.6rem;
    font-weight: 700;
    margin: 0.8rem 0 0.4rem;
}

.rnd-coin.is-spinning { animation: rnd-coin-spin 140ms linear infinite; }
.rnd-coin.is-heads { background: #ffe8cc; }
.rnd-coin.is-tails { background: #d0ebff; }

@keyframes rnd-coin-spin {
    0% { transform: scaleX(1); }
    50% { transform: scaleX(0.15); }
    100% { transform: scaleX(1); }
}

.rnd-coin-result {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0.2rem 0 0.6rem;
}

.rnd-wheel-wrap { position: relative; display: inline-block; margin: 0.6rem 0; }

.rnd-wheel { display: block; max-width: 100%; height: auto; }

.rnd-wheel-pointer {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-top: 26px solid var(--ink);
    z-index: 2;
}

.rnd-winner {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 700;
    min-height: 1.6rem;
}

.rnd-order { columns: 12rem auto; font-size: 1rem; }
.rnd-order li { margin: 0.2rem 0; }

.rnd-teams {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.8rem;
    margin: 0.6rem 0;
}

.rnd-team {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.6rem 0.9rem;
}

.rnd-team h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.rnd-team ul { margin: 0; padding-left: 1.1rem; }
.rnd-team li { margin: 0.15rem 0; }

.rnd-bracket {
    display: flex;
    gap: 1.2rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin: 0.6rem 0;
}

.rnd-round {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    gap: 0.7rem;
    min-width: 11rem;
}

.rnd-round h3 {
    margin: 0;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
}

.rnd-match {
    position: relative;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.rnd-match.is-bye { opacity: 0.65; box-shadow: none; }

.rnd-player {
    padding: 0.32rem 0.6rem;
    font-size: 0.88rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rnd-player + .rnd-player { border-top: 1px solid var(--line); }

.rnd-player.is-bye { color: var(--muted); font-style: italic; }

.rnd-match-no {
    position: absolute;
    top: -0.65rem;
    right: 0.4rem;
    background: var(--paper);
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted);
    padding: 0 0.25rem;
}

.rnd-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
    gap: 0.8rem;
    margin: 0.6rem 0;
}

.rnd-swatch {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.rnd-swatch-face {
    display: block;
    width: 100%;
    height: 5.2rem;
    border: none;
    border-bottom: 2px solid var(--ink);
    cursor: pointer;
    padding: 0;
}

.rnd-swatch-face.is-copied { outline: 3px solid var(--orange); outline-offset: -3px; }

.rnd-swatch-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.45rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}

.rnd-swatch-meta code {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--ink);
}

@media print {
    body.has-rnd-bracket .site-header,
    body.has-rnd-bracket .site-footer,
    body.has-rnd-bracket .breadcrumbs,
    body.has-rnd-bracket .guide-link,
    body.has-rnd-bracket .notes,
    body.has-rnd-bracket .tool-explore,
    body.has-rnd-bracket .img-controls,
    body.has-rnd-bracket .img-privacy,
    body.has-rnd-bracket .img-status { display: none !important; }
    body.has-rnd-bracket .rnd-match { box-shadow: none; }
}

/* -------------------------------------------------------- seo tools */

.seo-tool textarea,
.seo-tool input[type="text"] {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    min-width: 15rem;
}

.seo-tool textarea { resize: vertical; }

.seo-tool .img-ctl { flex: 1 1 14rem; }
.seo-tool .img-ctl input[type="text"],
.seo-tool .img-ctl textarea { width: 100%; box-sizing: border-box; }

.seo-output {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    margin: 0.8rem 0;
}

.seo-output-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.5rem 0.8rem;
    border-bottom: 2px solid var(--ink);
}

.seo-output-head h3 { margin: 0; font-size: 0.95rem; flex: 1; }

.seo-output-info {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--muted);
}

.seo-code {
    margin: 0;
    padding: 0.7rem 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    overflow-x: auto;
    max-height: 22rem;
    overflow-y: auto;
    white-space: pre;
}

.seo-code-wrap { white-space: pre-wrap; word-break: break-all; }

.seo-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    align-items: flex-start;
    margin: 0.8rem 0;
}

.seo-preview-caption {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    margin: 0 0 0.3rem;
}

.seo-serp {
    width: 600px;
    max-width: 100%;
    background: #fff;
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.2rem;
    font-family: arial, sans-serif;
}

.seo-serp-mobile { width: 400px; border-radius: 0; }

.seo-serp-head { display: flex; align-items: center; gap: 0.7rem; }

.seo-serp-favicon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #f1f3f4;
    color: #202124;
    font-size: 13px;
    flex: none;
}

.seo-serp-site { display: flex; flex-direction: column; min-width: 0; }

.seo-serp-sitename { color: #202124; font-size: 14px; line-height: 1.3; }

.seo-serp-url {
    color: #4d5156;
    font-size: 12px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seo-serp-title {
    color: #1a0dab;
    font-size: 20px;
    line-height: 1.3;
    margin: 0.35rem 0 0.15rem;
    white-space: nowrap;
    overflow: hidden;
}

.seo-serp-desc { color: #4d5156; font-size: 14px; line-height: 1.58; }

/* mobile snippets wrap over two lines instead of one long line */
.seo-serp-mobile .seo-serp-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.seo-social-wrap { min-width: 0; }

.seo-social {
    width: 500px;
    max-width: 100%;
    border: 2px solid var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.seo-social-img {
    height: 260px;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    overflow: hidden;
}

.seo-social-img img { width: 100%; height: 100%; object-fit: cover; }

.seo-social-sm { display: flex; width: 500px; }
.seo-social-sm .seo-social-img { width: 130px; height: 130px; flex: none; }
.seo-social-sm .seo-social-body { min-width: 0; }

.seo-social-body { padding: 0.6rem 0.8rem; background: #f2f3f5; }

.seo-social-domain {
    color: #606770;
    font-size: 0.72rem;
    text-transform: uppercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.seo-social-title {
    font-weight: 700;
    font-size: 1rem;
    margin: 0.15rem 0;
    color: #1d2129;
}

.seo-social-desc { color: #606770; font-size: 0.85rem; }

.seo-gauges { margin: 0.4rem 0 0.8rem; }

.seo-gauge { margin: 0.5rem 0; max-width: 40rem; }

.seo-gauge-head {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    margin-bottom: 0.2rem;
}

.seo-gauge-ok { color: var(--green, #2f9e44); }
.seo-gauge-over { color: #e03131; font-weight: 700; }

.seo-gauge-track {
    height: 0.7rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    overflow: hidden;
}

.seo-gauge-fill {
    display: block;
    height: 100%;
    background: #2f9e44;
    transition: width 120ms;
}

.seo-gauge-fill.is-over { background: #e03131; }

.seo-audit { margin: 0.8rem 0; }
.seo-audit h3 { margin: 0 0 0.4rem; }

.seo-audit-table {
    border-collapse: collapse;
    width: 100%;
    max-width: 46rem;
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
}

.seo-audit-table th,
.seo-audit-table td {
    text-align: left;
    padding: 0.45rem 0.8rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.88rem;
    vertical-align: top;
}

.seo-audit-table th {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

.seo-audit-ok { color: #2f9e44; }
.seo-audit-missing { color: #e03131; }

.seo-robots-group {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    margin: 0.6rem 0 0.4rem;
}

.seo-robots-note { font-size: 0.88rem; margin: 0.6rem 0 0.2rem; }

.seo-robots-warn {
    color: #e8590c;
    font-size: 0.85rem;
    margin: 0.25rem 0;
}

.seo-density-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
    gap: 1.2rem;
    margin: 0.8rem 0;
    align-items: start;
}

.seo-density-block h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }

.seo-density-block td:first-child { position: relative; min-width: 9rem; }
.seo-density-block td:first-child span { position: relative; z-index: 1; }

.seo-density-bar {
    position: absolute;
    left: 0;
    bottom: 0.2rem;
    height: 0.25rem;
    background: var(--orange);
    opacity: 0.7;
}

.seo-utm-warnings { margin: 0.4rem 0; }

/* ----------------------------------------------------- seo wiki widgets */

.wiki-serp-line {
    font-family: arial, sans-serif;
    font-size: 20px;
    color: #1a0dab;
    background: #fff;
    border: 1.5px solid var(--ink);
    padding: 0.5rem 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    margin: 0.4rem 0 0.7rem;
}

.wiki-og-stage {
    display: flex;
    align-items: flex-start;
    gap: 0.9rem;
    margin: 0.5rem 0 0.8rem;
    flex-wrap: wrap;
}

.wiki-og-card {
    position: relative;
    overflow: hidden;
    border: 2px solid var(--ink);
    background: rgba(25, 25, 25, 0.35);
    flex: none;
}

.wiki-og-img {
    position: absolute;
    background: repeating-linear-gradient(45deg, #74c0fc, #74c0fc 10px,
        #4dabf7 10px, #4dabf7 20px);
    opacity: 0.9;
}

.wiki-og-body { min-width: 9rem; }

.wiki-og-title { font-weight: 700; }

.wiki-og-desc {
    color: var(--muted);
    font-size: 0.82rem;
}

.wiki-files {
    display: flex;
    gap: 0.4rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin: 0.5rem 0 0.8rem;
}

.wiki-file {
    position: relative;
    width: 3.4rem;
    height: 4.6rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.wiki-file-fill {
    width: 100%;
    background: var(--orange);
    opacity: 0.75;
}

.wiki-file.is-partial .wiki-file-fill { background: #4dabf7; }

.wiki-file-count {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 700;
}

.wiki-hops {
    display: flex;
    gap: 2px;
    width: 100%;
    height: 2rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 2px;
    margin: 0.5rem 0 0.8rem;
    box-sizing: border-box;
}

.wiki-hop {
    background: var(--orange);
    min-width: 1.6rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    overflow: hidden;
}

.wiki-hop.is-final { background: #2f9e44; }

.wiki-hop.is-dead {
    background: repeating-linear-gradient(45deg, #adb5bd, #adb5bd 6px,
        #868e96 6px, #868e96 12px);
}



/* ------------------------------------------------------- data tools */

.data-tool textarea,
.data-tool input[type="text"],
.games-tool textarea,
.games-tool input[type="text"] {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

.data-tool textarea,
.games-tool textarea {
    width: 100%;
    box-sizing: border-box;
    resize: vertical;
}

.data-paste {
    display: flex;
    gap: 0.6rem;
    align-items: flex-start;
    margin: 0.7rem 0;
}

.data-paste textarea { flex: 1; }

.data-duo {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
    gap: 1rem;
    align-items: start;
}

.data-duo h3 { margin: 0 0 0.35rem; font-size: 0.95rem; }

.data-table-wrap { margin: 0.7rem 0; }

.data-table-scroll {
    overflow-x: auto;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    max-height: 30rem;
    overflow-y: auto;
}

.data-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.84rem;
}

.data-table th,
.data-table td,
.data-table-slim th,
.data-table-slim td {
    text-align: left;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
}

.data-table th,
.data-table-slim th {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: none;
    letter-spacing: 0.02em;
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table td input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.84rem;
    padding: 0.1rem 0.25rem;
}

.data-table-slim {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    border-collapse: collapse;
    font-size: 0.84rem;
    width: auto;
    min-width: 24rem;
    max-width: 100%;
    margin: 0.6rem 0;
}

.data-th-name { cursor: pointer; user-select: none; }
.data-th-name:hover { text-decoration: underline; }

.data-sort { color: var(--orange); }

.data-th-del {
    border: none;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0 0.2rem;
}

.data-th-del:hover { color: #e03131; }

.data-pager {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}

.data-pager-info {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}

.data-section { margin: 1rem 0; }
.data-section h3 { margin: 0 0 0.4rem; }

.data-meta {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.2rem 1rem;
    margin: 0.4rem 0;
    font-size: 0.88rem;
}

.data-meta dt {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted);
    text-transform: uppercase;
    align-self: center;
}

.data-meta dd { margin: 0; }

.data-anon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: 0.5rem 1.2rem;
    margin: 0.6rem 0 0.9rem;
}

.data-anon-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    border: 1.5px solid var(--line);
    background: var(--card);
    padding: 0.4rem 0.6rem;
}

.data-anon-name {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.data-anon-sample {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-filelist { margin: 0.6rem 0; }

.data-file-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.45rem 0.8rem;
    margin: 0.35rem 0;
    flex-wrap: wrap;
}

.data-file-name {
    flex: 1;
    min-width: 10rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.data-file-info {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
}

.data-file-btns { display: flex; gap: 0.3rem; }

.data-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin: 0.8rem 0;
    align-items: flex-start;
}

.data-thumb {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.4rem;
    cursor: pointer;
    text-align: center;
    max-width: 170px;
}

.data-thumb canvas,
.data-thumb img {
    display: block;
    max-width: 150px;
    height: auto;
    margin: 0 auto;
    transition: transform 150ms;
}

.data-thumb.is-selected {
    outline: 3px solid var(--orange);
    outline-offset: 1px;
}

.data-thumb-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    margin-top: 0.3rem;
    color: var(--muted);
}

.data-thumb-btns {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    margin-top: 0.3rem;
}

.data-verdict {
    font-weight: 700;
    font-size: 1.05rem;
    margin: 0.6rem 0;
}

.data-verdict.is-match { color: #2f9e44; }
.data-verdict.is-mismatch { color: #e03131; }

.data-hash {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    word-break: break-all;
    white-space: normal;
    max-width: 34rem;
}

.data-hex { margin: 0.7rem 0; }

.data-hex-pre {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.55;
    background: #14181d;
    color: #d6dde4;
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 0.8rem 1rem;
    overflow-x: auto;
    margin: 0;
}

.data-fake-fields { margin: 0.6rem 0; }
.data-fake-fields h3 { margin: 0 0 0.4rem; }

.data-check-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: 0.25rem 1rem;
    margin-bottom: 0.8rem;
}

.dev-gi-cat {
    margin: 1rem 0 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
}

.dev-gi-cat:first-of-type { margin-top: 0.25rem; }

.dev-gi-grid {
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}

.dev-gi-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.15rem 0.35rem;
    padding: 0.15rem 0;
    cursor: pointer;
}

.dev-gi-name {
    font-size: 0.9rem;
    font-weight: 500;
}

.dev-gi-src {
    flex: 1 1 100%;
    font-size: 0.72rem;
    font-family: var(--mono);
    color: var(--ink-muted);
    padding-left: 1.35rem;
}

.data-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
    gap: 0.6rem 1.2rem;
    margin: 0.6rem 0 1rem;
}

.data-form-grid .img-ctl input,
.data-form-grid .img-ctl textarea {
    width: 100%;
    box-sizing: border-box;
}

.data-form-wide { grid-column: 1 / -1; }

.data-chart-wrap {
    border: 2px solid var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
    margin: 0.8rem 0;
    max-width: 900px;
}

/* ---- owner dashboard ---- */

.dash-login {
    max-width: 22rem;
    margin: 3rem auto;
    padding: 1.4rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}

.dash-login form { display: flex; flex-direction: column; gap: 0.8rem; }
.dash-login input { width: 100%; box-sizing: border-box; }

.dash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.dash-head form { display: flex; align-items: center; gap: 0.7rem; }
.dash-user { color: var(--muted); font-size: 0.9rem; }

.dash-flash {
    padding: 0.5rem 0.8rem;
    border: 1.5px solid var(--ink);
    font-weight: 600;
}

.dash-flash-ok { background: #d8ecd9; }
.dash-flash-err { background: #f6d5d2; }

.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: 0.8rem;
    margin: 1rem 0 1.4rem;
}

.dash-card {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.8rem 1rem;
    display: flex;
    flex-direction: column;
}

.dash-card-num { font-size: 1.7rem; font-weight: 700; }
.dash-card-label { color: var(--muted); font-size: 0.85rem; }

.dash-chart {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    padding: 0.8rem 1rem;
    margin: 0.8rem 0;
}

.dash-chart h3 { margin: 0 0 0.6rem; }

.dash-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

@media (max-width: 800px) {
    .dash-chart-row { grid-template-columns: 1fr; }
}

.dash-table-wrap { margin: 1rem 0; }
.dash-table-wrap > summary { cursor: pointer; font-weight: 700; }

.dash-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border: 2px solid var(--ink);
    margin: 0.6rem 0 1rem;
    font-size: 0.9rem;
}

.dash-table th, .dash-table td {
    border-bottom: 1px solid var(--ink);
    padding: 0.4rem 0.7rem;
    text-align: left;
    vertical-align: top;
}

.dash-table th { background: var(--paper); }
.dash-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table code { font-size: 0.75rem; color: var(--muted); }

.dash-feedback-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.6rem;
}

.dash-msgs {
    margin: 0.4rem 0;
    padding-left: 1.1rem;
    font-size: 0.88rem;
}

.dash-msgs li { margin: 0.25rem 0; }
.dash-msg-date { color: var(--muted); font-size: 0.78rem; margin-right: 0.4rem; }

.dash-kind {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.05rem 0.4rem;
    border: 1.5px solid var(--ink);
    background: #e7eef7;
    margin-right: 0.3rem;
}

.dash-kind-issue { background: #f7e7e7; }

.dash-count { color: var(--muted); font-size: 0.85rem; font-weight: 400; }

.dash-urgency {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 0.1rem 0.5rem;
    border: 1.5px solid var(--ink);
}

.dash-urgency-low { background: #e6e6e6; }
.dash-urgency-medium { background: #ffe9a8; }
.dash-urgency-high { background: #ffc9a3; }
.dash-urgency-critical { background: #ff9d94; }

.dash-report-tool h4 { margin: 1rem 0 0.2rem; }
.dash-empty { color: var(--muted); }
.dash-unprocessed { border-left: 3px solid var(--ink); padding-left: 1rem; }

/* ---- data visualizer ---- */

.viz-sec {
    border: 1.5px solid var(--ink);
    background: var(--card);
}

.viz-sec summary {
    padding: 0.45rem 0.75rem;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    user-select: none;
}

.viz-sec[open] summary { border-bottom: 1.5px solid var(--ink); }

.viz-sec-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    gap: 0.5rem 1.1rem;
    padding: 0.6rem 0.75rem 0.75rem;
}

.viz-sec-body .img-ctl select,
.viz-sec-body .img-ctl input[type="text"] {
    width: 100%;
    box-sizing: border-box;
}

.viz-data-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.7rem;
}

.viz-data-head h3 { margin: 0.4rem 0; }

.viz-chart-wrap {
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    margin: 0.8rem 0;
    line-height: 0;
}

.viz-chart-wrap svg {
    display: block;
    width: 100%;
    height: auto;
}

.viz-chart-wrap { position: relative; }

.viz-tip {
    display: none;
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: var(--ink);
    color: var(--paper, #fdfaf3);
    font-size: 0.82rem;
    line-height: 1.35;
    padding: 0.3rem 0.55rem;
    border-radius: 4px;
    max-width: 18rem;
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.viz-presets {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 0.6rem;
}

.viz-preset-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.viz-preset {
    padding: 0.25rem 0.7rem;
    font-size: 0.85rem;
}

.viz-swatches {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.viz-swatch {
    display: inline-flex;
    gap: 2.5px;
    padding: 0.28rem 0.4rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    cursor: pointer;
    border-radius: 4px;
    line-height: 0;
}

.viz-swatch:hover { transform: translateY(-1px); }

.viz-swatch.active {
    outline: 2.5px solid var(--ink);
    outline-offset: 1.5px;
}

.viz-swatch-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    display: inline-block;
}

/* ---- data & files wiki widgets ---- */

.wiki-chip-col {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
    margin: 0.4rem 0 0.7rem;
}

.wiki-mono-pre {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    background: var(--surface);
    border: 1.5px solid var(--ink);
    padding: 0.5rem 0.7rem;
    margin: 0.4rem 0 0.7rem;
    overflow-x: auto;
    line-height: 1.6;
}

.wiki-mono-pre mark {
    background: rgba(232, 89, 12, 0.22);
    border: 1px solid var(--orange);
    padding: 0 0.1rem;
}

.wiki-rotate-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 150px;
    margin: 0.4rem 0 0.7rem;
}

.wiki-rotate-page {
    width: 66px;
    height: 86px;
    border: 2px solid var(--ink);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    transition: transform 180ms;
}

.wiki-tile-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0.4rem 0 0.7rem;
}

.wiki-page-tile {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 2.2rem;
    height: 2.7rem;
    border: 1.5px solid var(--ink);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.wiki-page-tile small {
    font-size: 0.58rem;
    color: var(--muted);
}

.wiki-page-tile.is-picked {
    background: rgba(29, 78, 216, 0.16);
    border-width: 2px;
    font-weight: 700;
}

.wiki-page-tile.is-invalid {
    text-decoration: line-through;
    opacity: 0.45;
    border-style: dashed;
}

.wiki-leak-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin: 0.4rem 0 0.7rem;
}

.wiki-leak-item {
    border: 1.5px solid var(--orange);
    border-left-width: 5px;
    background: var(--surface);
    padding: 0.35rem 0.6rem;
    font-size: 0.82rem;
}

.wiki-leak-item.is-clean {
    border-color: #0f766e;
    color: var(--muted);
}

.wiki-fit-page {
    position: relative;
    border: 2px solid var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
    margin: 0.4rem 0 0.7rem;
}

.wiki-fit-box {
    position: absolute;
    border: 1.5px dashed var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.wiki-fit-img {
    background: rgba(29, 78, 216, 0.3);
    border: 1.5px solid var(--blue);
}

.wiki-clock {
    position: relative;
    width: 84px;
    height: 84px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    background: var(--surface);
    margin: 0.4rem 0;
}

.wiki-clock-hand {
    position: absolute;
    left: calc(50% - 2px);
    bottom: 50%;
    width: 4px;
    height: 32px;
    background: var(--ink);
    transform-origin: 50% 100%;
    transition: transform 180ms;
}

.wiki-clock-pin {
    position: absolute;
    left: calc(50% - 4px);
    top: calc(50% - 4px);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--orange);
}

.wiki-vbars {
    display: flex;
    align-items: flex-end;
    gap: 2rem;
    height: 195px;
    padding: 0 1rem;
    border-bottom: 2px solid var(--ink);
    width: max-content;
    margin: 0.4rem 0 0.2rem;
}

.wiki-vbar-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.wiki-vbar {
    width: 3.2rem;
    border: 1.5px solid var(--ink);
    border-bottom: none;
    transition: height 120ms;
}

/* ---------------------------------------------------- developer tools */

.dev-tool textarea {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.85rem;
}

/* ------------------------------------------------ JSON formatter view */

.json-viewwrap { margin-top: 0.9rem; }

.json-viewbar {
    display: none;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.json-viewbar.is-visible { display: flex; }

.json-tree-tools { display: flex; gap: 0.5rem; }

.json-viewbar.is-minified .json-tree-tools { visibility: hidden; }

.btn-mini {
    padding: 0.3rem 0.8rem;
    font-size: 0.72rem;
    margin-left: 0;
}

.json-view {
    background: var(--card);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.55;
    padding: 0.9rem 0.4rem;
    overflow: auto;
    tab-size: 2;
}

/* the tree can be dragged taller; minified/empty just size to content */
.json-view:not(.is-empty):not(.is-minified) {
    height: 26rem;
    min-height: 9rem;
    resize: vertical;
}

.json-view.is-empty {
    padding: 1.4rem;
    color: var(--muted);
    box-shadow: none;
    background: var(--paper);
    border-style: dashed;
}

.json-empty { margin: 0; font-size: 0.85rem; }

.json-view.is-minified { padding: 0.9rem; max-height: 30rem; }

/* ---------------------------------------------- fullscreen overlay */

body.json-fs-lock { overflow: hidden; }

.json-viewwrap.is-fullscreen {
    position: fixed;
    inset: 1.2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1.5px solid var(--ink);
    /* Spread shadow rather than a negative-z-index pseudo-element: such
       a child paints above its own stacking context's background and
       would tint the panel along with the page behind it. */
    box-shadow: var(--shadow), 0 0 0 100vmax rgba(25, 25, 25, 0.45);
    padding: 0.9rem;
    margin: 0;
}

.json-viewwrap.is-fullscreen .json-viewbar { margin-bottom: 0.7rem; }

.json-viewwrap.is-fullscreen .json-view {
    flex: 1 1 auto;
    height: auto;
    max-height: none;
    min-height: 0;
    resize: none;
    margin: 0;
}

.dev-path-wrap { margin-top: 1.7rem; }

.json-code {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
}

.jf-line {
    white-space: pre-wrap;
    word-break: break-word;
}

.jf-head {
    cursor: pointer;
    border-radius: 3px;
}

.jf-head:hover { background: rgba(29, 78, 216, 0.08); }

.jf-toggle {
    display: inline-block;
    width: 1.1rem;
    margin-left: -1.1rem;
    color: var(--muted);
    text-align: center;
    user-select: none;
}

.jf-toggle::before {
    content: '\25be';
    display: inline-block;
    transition: transform 0.12s ease;
}

.jf-node.is-collapsed > .jf-head .jf-toggle::before {
    transform: rotate(-90deg);
}

.jf-node.is-collapsed > .jf-children,
.jf-node.is-collapsed > .jf-close { display: none; }

.jf-preview { display: none; margin-left: 0.15rem; }

.jf-node.is-collapsed > .jf-head .jf-preview { display: inline; }

.jf-count {
    color: var(--muted);
    font-style: italic;
    margin: 0 0.35rem;
    opacity: 0.85;
}

.jf-key { color: var(--blue-deep); font-weight: 600; }
.jf-str { color: #0a7d2c; }
.jf-num { color: var(--orange); }
.jf-bool { color: #8a2be2; font-weight: 600; }
.jf-null { color: var(--muted); font-weight: 600; }
.jf-punct { color: var(--muted); }

.dev-mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: var(--paper-2, #f6f5f1);
    border: 1px solid var(--line, #ddd);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.dev-mono-cell {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    word-break: break-all;
}

.dev-search {
    width: 100%;
    max-width: 34rem;
}

.dev-regex-in {
    min-width: 22rem;
    font-family: var(--font-mono);
}

.dev-flags {
    display: inline-flex;
    gap: 0.7rem;
    font-family: var(--font-mono);
}

.dev-hl mark {
    background: var(--mark);
    outline: 1px solid #f59f00;
    border-radius: 2px;
    color: inherit;
}

.dev-hl mark.dev-hl-b {
    background: var(--mark-soft);
    outline-color: #e8590c;
}

.dev-rx-caveat {
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--tint-orange);
    color: var(--ink);
    font-size: 0.88rem;
}

.dev-rx-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

/* long option labels would otherwise stretch the closed select */
.dev-rx-bar select.dev-rx-lib {
    max-width: 14rem;
    padding: 0.45rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--paper-2);
    color: var(--ink);
    cursor: pointer;
    box-sizing: border-box;
}

.dev-rx-flavor {
    margin: 1rem 0 0.4rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.dev-rx-hint {
    margin: 0.3rem 0 0;
    font-size: 0.82rem;
    color: var(--muted);
}

.dev-rx-sheet {
    margin-top: 0.8rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper-2);
}

.dev-rx-sheet summary {
    cursor: pointer;
    font-weight: 600;
}

.dev-rx-cheat {
    margin-top: 0.6rem;
}

.dev-rx-cheat th.dev-rx-cheat-cat {
    padding-top: 0.7rem;
    text-align: left;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
}

.dev-rx-cheat td.dev-rx-cheat-tok {
    cursor: pointer;
    white-space: nowrap;
}

.dev-rx-cheat td.dev-rx-cheat-tok:hover {
    background: var(--mark-soft);
}

.dev-diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 700px) {
    .dev-diff-grid { grid-template-columns: 1fr; }
}

.dev-diff-table tr.is-added .dev-diff-kind { color: #2f9e44; }
.dev-diff-table tr.is-removed .dev-diff-kind { color: #e03131; }
.dev-diff-table tr.is-changed .dev-diff-kind { color: #e8590c; }
.dev-diff-kind { font-weight: 700; white-space: nowrap; }

.dev-diff-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    margin: 0 0 0.75rem;
    font-weight: 600;
}
.dev-diff-summary .is-added { color: #2f9e44; }
.dev-diff-summary .is-removed { color: #e03131; }
.dev-diff-summary .is-changed { color: #e8590c; }

.dev-diff-tree {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88rem;
    line-height: 1.6;
    margin: 0.5rem 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    padding: 0.75rem 1rem;
}
.dev-diff-tree-node { margin: 0; }
.dev-diff-tree-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.55rem;
    align-items: baseline;
    padding: 0.16rem 0;
}
.dev-diff-tree-row.is-group {
    margin-top: 0.35rem;
}
.dev-diff-tree-row.is-group:first-child { margin-top: 0; }
.dev-diff-tree-row.is-group .dev-diff-tree-path {
    color: var(--ink);
    font-weight: 700;
}
.dev-diff-tree-path {
    color: var(--muted);
    min-width: 0;
    word-break: break-all;
}
.dev-diff-tree .dev-diff-kind {
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.08rem 0.5rem;
    border-radius: 999px;
    border: 1px solid;
    align-self: center;
}
.dev-diff-tree-row.is-added .dev-diff-kind {
    color: #2f9e44;
    border-color: #2f9e44;
    background: var(--tint-green);
}
.dev-diff-tree-row.is-removed .dev-diff-kind {
    color: #e03131;
    border-color: #e03131;
    background: var(--tint-red);
}
.dev-diff-tree-row.is-changed .dev-diff-kind {
    color: #e8590c;
    border-color: #e8590c;
    background: var(--tint-orange);
}
.dev-diff-unchanged {
    color: var(--muted);
    font-style: italic;
    font-size: 0.85em;
    padding: 0.1rem 0;
}
.dev-diff-val {
    word-break: break-all;
    padding: 0.02rem 0.4rem;
    border-radius: 5px;
}
.dev-diff-val.is-old {
    color: #c92a2a;
    background: var(--tint-red);
    text-decoration: line-through;
}
.dev-diff-val.is-new {
    color: #2b8a3e;
    background: var(--tint-green);
}
html[data-theme='dark'] .dev-diff-val.is-old { color: #ff8787; }
html[data-theme='dark'] .dev-diff-val.is-new { color: #69db7c; }
html[data-theme='dark'] .dev-diff-tree-row.is-added .dev-diff-kind { color: #69db7c; border-color: #69db7c; }
html[data-theme='dark'] .dev-diff-tree-row.is-removed .dev-diff-kind { color: #ff8787; border-color: #ff8787; }
html[data-theme='dark'] .dev-diff-tree-row.is-changed .dev-diff-kind { color: #ffa94d; border-color: #ffa94d; }
.dev-diff-arrow { color: var(--muted); }
.dev-diff-patch {
    margin-top: 1rem;
}

.dev-note-list {
    margin: 0.4rem 0 0.4rem 1.2rem;
    font-size: 0.9rem;
}

.dev-claim-note {
    color: var(--muted);
    font-size: 0.82rem;
}

.dev-bcrypt {
    margin-top: 1.2rem;
    border-top: 1px solid var(--line, #ddd);
    padding-top: 0.8rem;
}

.dev-bcrypt-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
    align-items: flex-end;
    margin: 0.6rem 0;
}

.dev-bcrypt-row > .img-ctl:first-child { flex: 1 1 18rem; }

.dev-bcrypt-row > .img-ctl:first-child input {
    width: 100%;
    box-sizing: border-box;
}

.dev-bcrypt-row > .btn-primary { margin: 0; }

.dev-hmac-banner { margin-bottom: 0.6rem; }

.dev-hmac-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.dev-hmac-presets .btn-secondary { margin: 0; }

.dev-hmac-keyrow { margin-top: 0.6rem; }

.dev-hmac-keyrow > .img-ctl:first-child { flex: 1 1 18rem; }

.dev-hmac-keyrow > .img-ctl:first-child input {
    width: 100%;
    box-sizing: border-box;
}
.dev-hmac-note {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0.4rem 0 0.8rem;
    max-width: 42rem;
}

.dev-hash-warn {
    margin: 0 0 0.8rem;
    padding: 0.7rem 0.9rem;
    border: 2px solid #e03131;
    border-radius: 8px;
    background: var(--tint-red, #fff5f5);
}

.dev-hash-warn .data-verdict { margin: 0.25rem 0; font-size: 0.95rem; }

.dev-hash-table tr.is-match td.dev-mono-cell { color: #2f9e44; font-weight: 600; }
.dev-hash-table tr.is-mismatch td.dev-mono-cell { color: #e03131; font-weight: 600; }

.dev-bytes-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.4rem;
    max-width: 40rem;
}

.dev-fp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.4rem;
    margin: 0.6rem 0 1rem;
}

.dev-fp-presets {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem 1rem;
    flex-wrap: wrap;
    margin: 0.2rem 0 0.6rem;
}

.dev-fp-presets-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--muted);
    padding-top: 0.55rem;
    flex: 0 0 auto;
}

.dev-fp-preset-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    flex: 1 1 14rem;
}

.dev-fp-preset-btns .btn-secondary { margin: 0; }

.dev-fp-ml {
    border-top: 1px solid var(--line, #ddd);
    padding-top: 0.8rem;
}

.dev-fp-panel-title {
    margin: 0 0 0.4rem;
    font-size: 0.95rem;
}

.dev-fp-bits {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

.dev-fp-bit-label {
    font-size: 0.7rem;
    color: var(--muted);
    margin-bottom: 2px;
}

.dev-viz-canvas {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.dev-fp-bit-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
}

.dev-fp-bit {
    display: inline-block;
    width: 15px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    font-family: ui-monospace, monospace;
    font-size: 12px;
    border: 1px solid #9ca3af;
    user-select: none;
}

.dev-fp-bit.is-sign { background: #fee2e2; }
.dev-fp-bit.is-exp { background: #e0f2fe; }
.dev-fp-bit.is-man { background: #dcfce7; }
.dev-fp-bit.is-on { font-weight: 700; color: #111827; }
.dev-fp-bit.is-off { color: #9ca3af; }

@media (max-width: 720px) {
    .dev-fp-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .dev-bytes-grid { grid-template-columns: 1fr; }
}

.dev-swatch {
    width: 100%;
    max-width: 22rem;
    height: 64px;
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    margin: 0.5rem 0;
}

.dev-contrast {
    margin-top: 1.4rem;
    border-top: 1px solid var(--line, #ddd);
    padding-top: 0.8rem;
}

.dev-contrast-sample {
    max-width: 26rem;
    padding: 1rem 1.2rem;
    border-radius: 8px;
    border: 1px solid var(--line, #ddd);
    font-size: 1.05rem;
    margin: 0.7rem 0;
}

.dev-pass { color: #2f9e44; font-weight: 700; }
.dev-fail { color: #e03131; font-weight: 700; }

.data-verdict.is-ok { color: #2f9e44; }
.data-verdict.is-warn { color: #e8590c; }
.data-verdict.is-bad { color: #e03131; }

tr.is-plausible td { background: var(--tint-green); }

.dev-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}

.dev-tab {
    padding: 0.4rem 1rem;
    border: 1.5px solid var(--ink);
    border-radius: 999px;
    background: transparent;
    cursor: pointer;
    font-weight: 600;
}

.dev-tab.is-active {
    background: var(--ink);
    color: var(--paper, #fff);
}

.dev-css-preview {
    width: 100%;
    max-width: 30rem;
    height: 190px;
    border: 1px solid var(--line, #ddd);
    border-radius: 10px;
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper-2);
}

.dev-shadow-box,
.dev-radius-box {
    width: 55%;
    height: 60%;
    background: var(--surface);
    border: 1px solid var(--line, #eee);
    border-radius: 10px;
}

.dev-stop-row,
.dev-shadow-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin: 0.4rem 0;
    padding: 0.4rem 0.6rem;
    border: 1px dashed var(--line, #ddd);
    border-radius: 8px;
}

.dev-grad-strip {
    position: relative;
    height: 34px;
    max-width: 30rem;
    border: 1px solid var(--line, #ccc);
    border-radius: 8px;
    margin: 1.4rem 0 0.9rem;
    cursor: copy;
}

.dev-grad-handle {
    position: absolute;
    top: -7px;
    width: 14px;
    height: 48px;
    transform: translateX(-50%);
    border: 2px solid #fff;
    border-radius: 5px;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
    cursor: ew-resize;
    touch-action: none;
}

.dev-css-preset-row {
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
    margin: 0.6rem 0 1rem;
}

.dev-css-preset-card {
    width: 8.5rem;
    height: 5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--line, #ddd);
    user-select: none;
}

.dev-ts-preview {
    font-size: 1.6rem;
    font-weight: 700;
    padding: 1.4rem 1rem;
    text-align: center;
}

.dev-ref-table td { vertical-align: top; }
.dev-ref-table .btn-secondary {
    margin-left: 0.6rem;
    padding: 0.05rem 0.5rem;
    font-size: 0.75rem;
}

.dev-status-tabs { margin-top: 0.5rem; }

.dev-status-band {
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    font-weight: 700;
    margin: 1rem 0 0.5rem;
}
.dev-status-band-1 { background: rgba(29, 78, 216, 0.12); }
.dev-status-band-2 { background: var(--tint-green); }
.dev-status-band-3 { background: rgba(29, 78, 216, 0.08); }
.dev-status-band-4 { background: var(--tint-orange); }
.dev-status-band-5 { background: var(--tint-red); }

.dev-status-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.55rem;
    background: var(--surface);
}

.dev-status-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.35rem;
}

.dev-status-code {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.05rem;
}

.dev-status-summary {
    margin: 0 0 0.55rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.dev-status-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem 1rem;
    margin-bottom: 0.55rem;
    font-size: 0.88rem;
}
@media (max-width: 640px) {
    .dev-status-detail { grid-template-columns: 1fr; }
}
.dev-status-block p { margin: 0.2rem 0 0; }
.dev-status-block strong {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
}

.dev-status-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
    border-top: 1px solid var(--line);
    padding-top: 0.5rem;
    font-size: 0.85rem;
}
.dev-status-foot .btn-secondary {
    padding: 0.15rem 0.55rem;
    font-size: 0.75rem;
}

.dev-status-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.08rem 0.45rem;
    border-radius: 999px;
    border: 1px solid;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.dev-status-badge-retry-yes {
    color: #2b8a3e;
    border-color: #2b8a3e;
    background: var(--tint-green);
}
.dev-status-badge-retry-no {
    color: #e03131;
    border-color: #e03131;
    background: var(--tint-red);
}
.dev-status-badge-cache-yes {
    color: #1d4ed8;
    border-color: #1d4ed8;
    background: rgba(29, 78, 216, 0.1);
}
.dev-status-badge-cache-no {
    color: var(--muted);
    border-color: var(--line);
    background: var(--paper-2);
}
.dev-status-badge-vendor {
    color: #9333ea;
    border-color: #9333ea;
    background: rgba(147, 51, 234, 0.1);
}

.dev-status-tab-1.is-active { background: rgba(29, 78, 216, 0.85); }
.dev-status-tab-2.is-active { background: #2b8a3e; }
.dev-status-tab-3.is-active { background: rgba(29, 78, 216, 0.65); }
.dev-status-tab-4.is-active { background: #e8590c; }
.dev-status-tab-5.is-active { background: #e03131; }

.dev-code { font-weight: 700; white-space: nowrap; }
.dev-strong { font-weight: 600; white-space: nowrap; }

.dev-entity-char {
    font-size: 1.3rem;
    text-align: center;
    min-width: 2.4rem;
}

.dev-ent-callout {
    border: 1.5px solid var(--orange);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    margin-bottom: 1rem;
    background: rgba(232, 89, 12, 0.08);
}

.dev-ent-callout-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.dev-ent-xss-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--line, #ddd);
    border-radius: 8px;
    background: var(--paper, #fff);
}

.dev-ent-xss-chip .dev-entity-char {
    font-size: 1.1rem;
    min-width: auto;
    padding: 0;
}

.dev-ent-mini { margin-bottom: 1.2rem; }

.dev-ent-mini textarea {
    width: 100%;
    max-width: 34rem;
}

.dev-ent-mini .img-row {
    margin: 0.5rem 0;
    gap: 0.5rem;
}

.dev-ent-mini .img-row .btn-secondary { margin-left: 0; }

.dev-ent-star {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.3rem;
    line-height: 1;
    color: var(--muted);
}

.dev-ent-star.is-on { color: var(--orange); }

td.dev-entity-char:hover { color: var(--orange); }

.dev-ent-clickhint {
    margin: 0.5rem 0 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.dev-ent-copycell {
    font-family: var(--font-mono);
    font-size: inherit;
    background: none;
    border: none;
    border-bottom: 1px dashed var(--muted);
    color: inherit;
    padding: 0 0.1rem 0.1rem;
    cursor: pointer;
}

.dev-ent-copycell::after {
    content: '⧉';
    margin-left: 0.35rem;
    font-size: 0.85em;
    color: var(--muted);
}

.dev-ent-copycell:hover,
.dev-ent-copycell:hover::after {
    color: var(--orange);
    border-bottom-color: var(--orange);
}

.dev-ent-copycell.is-copied,
.dev-ent-copycell.is-copied::after {
    color: var(--green, #2f9e44);
    border-bottom-color: var(--green, #2f9e44);
}

.dev-key-zone {
    border: 2px dashed var(--ink);
    border-radius: 10px;
    padding: 2rem 1rem;
    text-align: center;
    font-weight: 600;
    cursor: pointer;
    outline: none;
}

.dev-key-zone.is-focused {
    border-style: solid;
    background: var(--tint-yellow);
}

.dev-key-big {
    display: flex;
    gap: 0.8rem;
    margin: 0.9rem 0;
    flex-wrap: wrap;
}

.dev-key-chip {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    padding: 0.5rem 1.1rem;
    border: 2px solid var(--ink);
    border-radius: 10px;
    box-shadow: 0 3px 0 var(--ink);
}

.dev-key-chip.is-code {
    font-size: 1.1rem;
    align-self: center;
    color: var(--muted);
    border-color: var(--muted);
    box-shadow: 0 3px 0 var(--muted);
}

.dev-now {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0.2rem 0 0.8rem;
}

.dev-ts-back {
    margin-top: 1.4rem;
    border-top: 1px solid var(--line, #ddd);
    padding-top: 0.8rem;
}

.dev-run-list {
    font-size: 0.92rem;
    margin: 0.4rem 0 0.4rem 1.4rem;
}

.dev-run-list li { margin: 0.15rem 0; }

.dev-chmod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.8rem;
    max-width: 44rem;
    margin-bottom: 0.6rem;
}

.dev-chmod-col {
    border: 1px solid var(--line, #ddd);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
}

.dev-chmod-col h3 {
    margin: 0.1rem 0 0.4rem;
    font-size: 0.95rem;
}

.dev-chmod-col .img-check { display: block; margin: 0.2rem 0; }

/* ------------------------------------------------------ text tools */

.text-diff-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 0.9rem;
}

@media (max-width: 700px) {
    .text-diff-grid { grid-template-columns: 1fr; }
}

.text-diff-out {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    border: 1px solid var(--line, #ddd);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    overflow-x: auto;
    margin-top: 0.6rem;
}

.text-diff-line {
    white-space: pre-wrap;
    word-break: break-word;
    padding: 0.05rem 0.3rem;
}

.text-diff-line.is-removed { background: var(--tint-red-strong); }
.text-diff-line.is-added { background: var(--tint-green-strong); }

.text-diff-line mark.text-diff-del {
    background: #ffa8a8;
    text-decoration: line-through;
}

.text-diff-line mark.text-diff-ins { background: #8ce99a; }

.text-preview {
    border: 1px solid var(--line, #ddd);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    min-height: 2.5rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    font-size: 0.9rem;
}

.text-preview mark {
    background: var(--mark);
    border-radius: 3px;
    padding: 0 0.1rem;
    color: inherit;
}

.text-md-preview {
    white-space: normal;
    font-family: inherit;
    font-size: 0.95rem;
}

.text-md-preview h1, .text-md-preview h2, .text-md-preview h3 {
    margin: 0.6rem 0 0.3rem;
}

.text-md-preview blockquote {
    border-left: 3px solid var(--line, #ddd);
    margin: 0.5rem 0;
    padding-left: 0.8rem;
    color: var(--muted);
}

.text-case-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.text-case-cell .btn-secondary {
    flex-shrink: 0;
    padding: 0.15rem 0.7rem;
    font-size: 0.82rem;
}

.text-mono-cell {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    word-break: break-word;
}

.text-fancy-cell {
    font-size: 1.15rem;
    word-break: break-word;
}

.text-freq-cell {
    display: block;
    width: 8rem;
    max-width: 25vw;
    background: #f1f3f5;
    border-radius: 4px;
    overflow: hidden;
}

.text-freq-bar {
    display: block;
    height: 0.9rem;
    background: var(--accent, #4dabf7);
    border-radius: 4px;
}

tr.text-suspect td { background: var(--tint-yellow); }

.text-warn { color: #d9480f; font-weight: 600; }
.text-ok { color: #2b8a3e; font-weight: 600; }

/* ------------------------------------------------ text wiki widgets */

.wtext-cellrow {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    margin: 0.4rem 0;
}

.wtext-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding: 0.25rem 0.35rem;
    border: 2px solid rgba(25, 25, 25, 0.35);
    border-radius: 6px;
    font-family: var(--font-mono);
}

.wtext-cell-glyph { font-size: 1.05rem; font-weight: 700; }

.wtext-cell-label {
    font-size: 0.62rem;
    color: var(--muted);
    white-space: nowrap;
}

.wtext-cell.is-ok { border-color: #2b8a3e; background: var(--tint-green); }
.wtext-cell.is-bad { border-color: #e03131; background: var(--tint-red); }

.wtext-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin: 0.4rem 0;
}

@media (max-width: 600px) {
    .wtext-cols { grid-template-columns: 1fr; }
}

.wtext-col strong {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.wtext-line {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    padding: 0.1rem 0.35rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.wtext-line.is-removed { background: var(--tint-red-strong); }
.wtext-line.is-added { background: var(--tint-green-strong); }

.wtext-zalgo {
    font-size: 1.6rem;
    line-height: 3.2;
    text-align: center;
    padding: 1.2rem 0.5rem;
    overflow: hidden;
}

/* ----------------------------------------------------- cryptography tools */

.crypto-out { margin-top: 0.9rem; }

.crypto-out > .img-ctl-label {
    display: block;
    margin-bottom: 0.25rem;
}

.crypto-out > .btn-secondary { margin: 0.4rem 0 0; }

#crypto-tool .dev-code-in,
#crypto-tool .dev-code-out {
    width: 100%;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    word-break: break-all;
}

#crypto-tool .dev-code-out { background: var(--paper); }

#crypto-tool .img-stage > .img-ctl-label {
    display: block;
    margin: 0.6rem 0 0.2rem;
}

.totp-code {
    font-family: var(--font-mono);
    font-size: 2.6rem;
    font-weight: 600;
    letter-spacing: 0.35rem;
    color: var(--blue-deep);
    text-align: center;
    padding: 0.6rem 0;
    border: 1.5px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    margin: 0.9rem 0 0.3rem;
}

.crypto-guesses {
    margin: 0.3rem 0 1rem;
    padding-left: 1.2rem;
}

.crypto-guesses li {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin: 0.2rem 0;
}

.crypto-h3 {
    font-size: 0.95rem;
    margin: 1rem 0 0.3rem;
}

.crypto-mapping {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    word-break: break-word;
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 0.6rem 0.8rem;
    margin-top: 0.6rem;
}

/* ------------------------------------------- cryptography wiki widgets */

.wiki-widget-btn {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.25rem 0.7rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    cursor: pointer;
}

.wiki-widget-btn:hover { background: var(--paper); }

.wcrypto-lbl {
    color: var(--muted);
    font-size: 0.76rem;
    margin: 0.55rem 0 0.2rem;
}

.wcrypto-cellrow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin: 0.15rem 0;
}

.wcrypto-cellrow.is-tight { gap: 1px; }

.wcrypto-cell {
    min-width: 1.4rem;
    padding: 0.15rem 0.1rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid var(--line);
    background: var(--card);
}

.wcrypto-cell.is-wrap { background: var(--tint-orange); border-color: var(--orange); }
.wcrypto-cell.is-bad { background: var(--tint-red); border-color: #e03131; color: #c92a2a; }

.wcrypto-char {
    min-width: 1rem;
    padding: 0.1rem 0.15rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    border: 1px solid transparent;
}

.wcrypto-char.is-wrap { background: var(--tint-orange); color: var(--orange); font-weight: 700; }
.wcrypto-char.is-pass { color: var(--muted); }
.wcrypto-char.is-same { background: var(--tint-green); color: #2b8a3e; }
.wcrypto-char.is-diff { background: var(--tint-red); color: #e03131; }

.wcrypto-hex {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    word-break: break-all;
    line-height: 1.5;
}

.wcrypto-hex .wcrypto-diff {
    background: var(--orange);
    color: #fff;
}

.wcrypto-token {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    word-break: break-all;
    background: var(--paper);
    border: 1px solid var(--line);
    padding: 0.4rem 0.5rem;
    line-height: 1.5;
}

.wcrypto-badge {
    display: inline-block;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 0.1rem 0.5rem;
    border: 1.5px solid;
}

.wcrypto-badge.is-valid { color: #2b8a3e; border-color: #2b8a3e; background: var(--tint-green); }
.wcrypto-badge.is-invalid { color: #e03131; border-color: #e03131; background: var(--tint-red); }

.wcrypto-panel {
    border: 1px solid var(--line);
    background: var(--card);
    padding: 0.4rem 0.6rem;
    margin: 0.3rem 0;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.wcrypto-recover {
    margin-top: 0.5rem;
    padding: 0.4rem 0.6rem;
    border: 1.5px solid var(--line);
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.wcrypto-recover.is-leaked {
    border-color: #e03131;
    background: var(--tint-red);
    color: #c92a2a;
    font-weight: 700;
}

.wcrypto-stack {
    display: flex;
    height: 26px;
    border: 1.5px solid var(--ink);
    margin: 0.5rem 0;
    overflow: hidden;
}

.wcrypto-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
}

.wcrypto-seg.is-msg { background: #2b8a3e; }
.wcrypto-seg.is-over { background: #e8590c; }
.wcrypto-seg.is-free { background: #adb5bd; color: var(--ink); }
.wcrypto-seg.is-bad { background: #e03131; }

.wcrypto-timeline {
    display: flex;
    align-items: stretch;
    height: 30px;
    margin: 0.5rem 0;
    background: var(--paper);
    border: 1px solid var(--line);
}

.wcrypto-on { background: var(--ink); }
.wcrypto-off { background: transparent; }

/* --------------------------------------------------- home category grid */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.3rem;
    margin: 1.6rem 0 3.4rem;
}

.cat-card {
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 2px solid var(--ink);
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    overflow: hidden;
}

.cat-card:hover {
    transform: translate(-3px, -3px);
    box-shadow: var(--shadow);
}

.cat-card:hover h2 { color: var(--blue); }

.cat-card-art {
    display: block;
    border-bottom: 2px solid var(--ink);
    background: #f6f4ee;
    line-height: 0;
}

.cat-card-art img {
    width: 100%;
    height: auto;
    display: block;
}

.cat-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.95rem 1.05rem 1rem;
}

.cat-card-body h2 {
    margin: 0 0 0.3rem;
    font-size: 1.08rem;
    letter-spacing: -0.01em;
}

.cat-card-body p {
    margin: 0 0 0.75rem;
    color: var(--muted);
    font-size: 0.86rem;
    flex: 1;
}

.cat-card-count {
    align-self: flex-start;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--card);
    background: var(--blue);
    border: 1.5px solid var(--ink);
    padding: 0.12rem 0.5rem;
}

@media (max-width: 560px) {
    .cat-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.9rem; }
    .cat-card-body { padding: 0.75rem 0.8rem 0.8rem; }
    .cat-card-body p { display: none; }
}

/* ------------------------------------------------------ smart paste
   Home-page strip: one wide paste box, detection chips and tool cards
   underneath. Kept short so the category grid stays above the fold. */
.smart-paste {
    margin: 0.4rem 0 2.4rem;
    padding: 1.1rem 1.25rem 0.9rem;
    background: var(--card);
    border: 2px solid var(--ink);
    box-shadow: var(--shadow);
}

.sp-head {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.7rem;
}
.sp-head h2 {
    margin: 0;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    padding-right: 0.9rem;
    border-right: 3px solid var(--orange);
}
.sp-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    flex: 1 1 320px;
}

.sp-box {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    border: 2px dashed var(--line);
    background: var(--paper);
    padding: 0.55rem 0.6rem;
    transition: border-color 0.12s ease, background 0.12s ease;
}
.sp-box:focus-within { border-color: var(--blue); }
.sp-box.is-drag { border-color: var(--orange); background: var(--tint-orange); }

.sp-box textarea {
    flex: 1;
    min-height: 48px;
    max-height: 168px;
    resize: none;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 24px;
    padding: 0.3rem 0.4rem;
    outline: none;
}
.sp-box textarea::placeholder { color: var(--muted); opacity: 0.8; }

.sp-side { display: flex; flex-direction: column; gap: 0.45rem; flex: 0 0 auto; }
.sp-side .btn-secondary {
    margin: 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.72rem;
    white-space: nowrap;
}

.sp-files { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.6rem; }
.sp-file {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    border: 1.5px solid var(--ink);
    background: var(--tint-blue);
    padding: 0.2rem 0.3rem 0.2rem 0.6rem;
}
.sp-file-name { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-file-size { color: var(--muted); }
.sp-file-x {
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}
.sp-file-x:hover { color: var(--orange); }

.sp-results { margin-top: 0.8rem; }

.sp-detected {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.7rem;
}
.sp-detected-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    margin-right: 0.2rem;
}
.sp-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.45rem;
    border: 1.5px solid var(--ink);
    padding: 0.18rem 0.6rem;
    font-size: 0.82rem;
    background: var(--paper);
}
.sp-chip.is-top { background: var(--tint-yellow); }
.sp-chip b { font-weight: 600; }
.sp-chip-detail { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }

.sp-tools {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.6rem;
    align-items: stretch;
}
.sp-tool {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    text-decoration: none;
    color: var(--ink);
    border: 1.5px solid var(--ink);
    background: var(--surface);
    padding: 0.55rem 0.7rem 0.6rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    min-height: 62px;
}
.sp-tool:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); }
.sp-tool:hover .sp-tool-name { color: var(--blue); }
.sp-tool.is-primary { background: var(--tint-orange); }
.sp-tool-name { font-weight: 600; font-size: 0.9rem; line-height: 1.25; }
.sp-tool-short {
    font-size: 0.76rem;
    color: var(--muted);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sp-tool-badge {
    position: absolute;
    top: -0.6rem;
    right: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--card);
    background: var(--orange);
    border: 1.5px solid var(--ink);
    padding: 0.05rem 0.4rem;
}
.sp-more {
    align-self: center;
    justify-self: start;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1.5px dashed var(--ink);
    background: transparent;
    color: var(--ink);
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    min-height: 62px;
}
.sp-more:hover { color: var(--orange); border-color: var(--orange); }

.sp-privacy {
    margin: 0.7rem 0 0;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.02em;
}
.sp-hint { display: none; }
.smart-paste.has-input .sp-hint { display: inline; }

@media (max-width: 640px) {
    .smart-paste { padding: 0.9rem 0.85rem 0.75rem; }
    .sp-box { flex-direction: column; }
    .sp-side { flex-direction: row; width: 100%; }
    .sp-side .btn-secondary { flex: 1; }
    .sp-tools { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* toast shown on the tool page when a handoff was applied */
.handoff-toast {
    position: fixed;
    left: 50%;
    bottom: 1.4rem;
    transform: translateX(-50%);
    z-index: 60;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--card);
    background: var(--ink);
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    padding: 0.5rem 0.9rem;
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.handoff-toast.is-out { opacity: 0; transform: translate(-50%, 8px); }
html[data-theme='dark'] .handoff-toast { color: var(--paper); background: var(--surface); }

/* --------------------------------------------------- crossword maker */

.cw-grid-wrap {
    overflow: auto;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    margin: 0.8rem 0;
    line-height: 0;
    padding: 0.6rem;
}

.cw-grid-wrap svg {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
}

/* interactive play grid (same states/colors as the hosted embed,
   which follow Linguno's crossword player) */

.cw-play-bar {
    display: flex;
    justify-content: flex-end;
    margin: 0.8rem 0 -0.4rem;
}

/* maze drawing overlay */

.mz-draw-bar {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 0.8rem 0 -0.4rem;
}

.mz-tool {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.8rem;
    border: 1.5px solid var(--ink);
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
}

.mz-tool.is-active { background: var(--ink); color: var(--paper); }

.mz-holder {
    position: relative;
    width: fit-content;
    margin: 0 auto;
    max-width: 100%;
}

.mz-holder svg { display: block; max-width: 100%; height: auto; }

.mz-draw-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: crosshair;
}

table.cw-play {
    border-collapse: collapse;
    margin: 0 auto;
    line-height: normal;
}

table.cw-play td { padding: 0; width: 32px; height: 32px; }

table.cw-play td.cell {
    border: 1.6px solid var(--ink);
    position: relative;
    background: var(--card);
}

table.cw-play td.cell .num {
    position: absolute;
    top: 0; left: 2px;
    font-size: 9px;
    pointer-events: none;
}

table.cw-play td.cell input {
    width: 100%; height: 100%;
    border: 0; padding: 0; margin: 0;
    text-align: center;
    font: 600 16px/1 inherit;
    font-family: inherit;
    text-transform: uppercase;
    background: transparent;
    color: inherit;
    caret-color: var(--blue);
    outline: none;
    box-sizing: border-box;
}

table.cw-play td.cell.selword:not(.correct):not(.hinted) {
    background: rgba(8, 116, 133, 0.2);
}

table.cw-play td.cell.sel:not(.correct):not(.hinted) {
    background: rgba(8, 116, 133, 0.6);
}

table.cw-play td.cell.correct { background: rgba(0, 255, 0, 0.2); }
table.cw-play td.cell.correct input { font-weight: 700; cursor: default; }

table.cw-play td.cell.hinted {
    background: var(--mark-soft) !important;
}

.cw-clues li { cursor: pointer; padding: 0 0.2rem; }
.cw-clues li:hover { background: var(--card); }
.cw-clues li.active { background: var(--tint-yellow); font-weight: 600; }

.cw-clues li.done {
    color: var(--muted);
    text-decoration: line-through;
}

.cw-clue-cols {
    display: flex;
    gap: 2.5rem;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.cw-clue-col {
    flex: 1 1 16rem;
    min-width: 14rem;
}

.cw-clue-col h3 { margin: 0 0 0.4rem; }

.cw-clues {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.75;
}

.cw-answer { font-weight: 700; color: var(--blue); }

.cw-word-count {
    font-size: 0.68rem;
    font-weight: 700;
    display: inline-block;
    padding: 0.02rem 0.28rem;
    background: var(--card);
    border: 1.5px solid var(--ink);
    position: relative;
    bottom: 0.1rem;
    white-space: nowrap;
}

.cw-skipped {
    font-size: 0.82rem;
    color: var(--muted);
    margin: 0.4rem 0 0;
}

/* ------------------------------------------------ games & puzzles */

/* word search play grid */

table.ws-play {
    border-collapse: collapse;
    margin: 0 auto;
    line-height: normal;
    border: 2px solid var(--ink);
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

table.ws-play td.cell {
    width: 30px; height: 30px;
    text-align: center;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    padding: 0;
}

table.ws-play td.cell.sel {
    background: rgba(8, 116, 133, 0.35);
    border-radius: 50%;
}

table.ws-play td.cell.found {
    background: rgba(116, 184, 22, 0.35);
    border-radius: 50%;
}

.ws-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.9rem;
    margin: 0.6rem 0 1rem;
}

.ws-word {
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.ws-word.done {
    color: var(--muted);
    text-decoration: line-through;
}

/* sudoku play grid */

table.sd-play {
    border-collapse: collapse;
    margin: 0 auto;
    line-height: normal;
    border: 3px solid var(--ink);
}

table.sd-play td.cell {
    width: 40px; height: 40px;
    border: 1px solid var(--ink);
    text-align: center;
    font-size: 19px;
    padding: 0;
    background: var(--card);
}

table.sd-play td.cell.given { font-weight: 700; }
table.sd-play td.cell.bt { border-top-width: 3px; }
table.sd-play td.cell.bl { border-left-width: 3px; }
table.sd-play td.cell.bb { border-bottom-width: 3px; }
table.sd-play td.cell.br { border-right-width: 3px; }

table.sd-play td.cell input {
    width: 100%; height: 100%;
    border: 0; padding: 0; margin: 0;
    text-align: center;
    font: 400 19px/1 inherit;
    font-family: inherit;
    background: transparent;
    color: var(--blue);
    caret-color: var(--blue);
    outline: none;
    box-sizing: border-box;
}

table.sd-play td.cell.wrong { background: rgba(224, 49, 49, 0.25); }
table.sd-play td.cell.correct { background: rgba(0, 255, 0, 0.18); }
table.sd-play td.cell.hinted { background: var(--mark-soft); }

/* nonogram grid */

table.ng-grid {
    border-collapse: collapse;
    margin: 0 auto;
    line-height: normal;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

table.ng-grid td.cell {
    width: 26px; height: 26px;
    border: 1px solid var(--ink);
    padding: 0;
    background: var(--card);
    cursor: pointer;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

table.ng-grid td.cell.on { background: var(--ink); color: transparent; }
table.ng-grid td.cell.g5b { border-bottom-width: 2.5px; }
table.ng-grid td.cell.g5r { border-right-width: 2.5px; }

table.ng-grid td.ng-rowclue {
    padding: 0 0.5rem 0 0.2rem;
    text-align: right;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

table.ng-grid td.ng-colclue {
    vertical-align: bottom;
    text-align: center;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.2rem 0 0.3rem;
    line-height: 1.15;
}

table.ng-grid.ng-solved td.cell.on { background: var(--blue); }

/* bingo cards */

.bg-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 0.8rem 0;
}

.bg-card {
    border: 2px solid var(--ink);
    background: #fff;
    box-shadow: var(--shadow-sm);
    line-height: 0;
    flex: 0 1 300px;
}

.bg-card svg { width: 100%; height: auto; }

/* cryptogram */

.cg-wrap {
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    margin: 0.8rem 0;
    padding: 1.2rem 1.4rem;
}

.cg-frame {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem 1.1rem;
    justify-content: center;
}

.cg-word {
    display: inline-flex;
    gap: 2px;
    white-space: nowrap;
}

.cg-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: 1.6rem;
}

.cg-cell input {
    width: 100%;
    border: 0;
    border-bottom: 2px solid var(--ink);
    padding: 0 0 1px;
    margin: 0;
    text-align: center;
    font: 600 16px/1.4 inherit;
    font-family: inherit;
    text-transform: uppercase;
    background: transparent;
    color: var(--blue);
    caret-color: var(--blue);
    outline: none;
    border-radius: 0;
}

.cg-cell.sel input { background: rgba(8, 116, 133, 0.18); }
.cg-cell.correct input { color: var(--ink); font-weight: 700; }
.cg-cell.hinted input { background: var(--mark-soft); }

.cg-letter {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--muted);
    padding-top: 2px;
}

.cg-punct {
    /* align with the answer line, not the cipher-letter row below */
    align-self: flex-start;
    font-weight: 600;
    line-height: 25px;
}

.cg-author {
    text-align: right;
    font-style: italic;
    margin: 1rem 0 0;
}

/* shared embed page (/embed/<id>/share/) */

.embed-share-frame {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* no border/padding/shadow: the shared puzzle should look exactly
   like it does on the generator page, not like a framed widget */
.embed-share-frame iframe {
    display: block;
    border: 0;
    background: transparent;
    /* flex centering often lands on *.5; snap in the share-page
       script so the iframe's 1px grid lines stay hairline-sharp */
}

.embed-share-cta { margin: 1.2rem 0; }

.embed-share-cta .btn-primary { text-decoration: none; }

.embed-share-snippet textarea {
    width: 100%;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8rem;
}

.embed-share-theme { margin: 1.2rem 0; }

.embed-theme-presets {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.6rem 0;
}

.embed-theme-presets button {
    font: 600 0.8rem/1 inherit;
    padding: 0.4rem 0.8rem;
    border: 1.5px solid #1a1a1a;
    background: #fff;
    cursor: pointer;
}

.embed-theme-presets button:hover { background: #f1f0ec; }

.embed-theme-controls {
    display: flex;
    gap: 0.6rem 1.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.embed-theme-controls label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.embed-theme-controls input[type="color"] {
    width: 2.2rem;
    height: 1.6rem;
    padding: 0.1rem;
    border: 1.5px solid #1a1a1a;
    background: #fff;
    cursor: pointer;
}

.embed-theme-controls select {
    font: inherit;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border: 1.5px solid #1a1a1a;
    background: #fff;
}

/* ------------------------------------------------- code box
   Shared syntax-highlighted code display (code-box.js). Header
   carries a language badge tinted per language. */
.code-box {
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    overflow: hidden;
    margin: 0.6rem 0;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.code-box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.35rem 0.7rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
}

.code-box-lang {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.12rem 0.5rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
}

.code-box[data-lang='javascript'] .code-box-lang {
    background: #fdf3c7; border-color: #e3c94b; color: #6b5a00;
}

.code-box[data-lang='python'] .code-box-lang {
    background: #dbeafe; border-color: #7ba8e8; color: #1e4f9c;
}

.code-box[data-lang='go'] .code-box-lang {
    background: #d5f4fa; border-color: #5cc6dd; color: #086f8a;
}

.code-box[data-lang='php'] .code-box-lang {
    background: #e5e3f5; border-color: #9a94d8; color: #45408f;
}

.code-box[data-lang='powershell'] .code-box-lang {
    background: #d8e6f6; border-color: #6f9fd8; color: #1a4e8a;
}

.code-box[data-lang='bash'] .code-box-lang {
    background: #e2e8f0; border-color: #94a3b8; color: #334155;
}

.code-box[data-lang='css'] .code-box-lang {
    background: #fce7f3; border-color: #e18ab8; color: #9d2463;
}

.code-box[data-lang='json'] .code-box-lang {
    background: #dcfce7; border-color: #6fc48b; color: #14652f;
}

.code-box[data-lang='yaml'] .code-box-lang {
    background: #fee2e2; border-color: #e78f8f; color: #8f2020;
}

.code-box[data-lang='toml'] .code-box-lang {
    background: #ffedd5; border-color: #e8a35c; color: #8a4a0b;
}

.code-box[data-lang='xml'] .code-box-lang {
    background: #ecfccb; border-color: #a3c65c; color: #4d6b10;
}

.code-box[data-lang='sql'] .code-box-lang {
    background: #cffafe; border-color: #55b8c9; color: #0e5e6e;
}

html[data-theme='dark'] .code-box .code-box-lang {
    background: var(--surface);
    border-color: var(--line);
    color: var(--muted);
}

html[data-theme='dark'] .code-box[data-lang='javascript'] .code-box-lang {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(250, 204, 21, 0.4);
    color: #fde68a;
}

html[data-theme='dark'] .code-box[data-lang='python'] .code-box-lang {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(96, 165, 250, 0.4);
    color: #93c5fd;
}

html[data-theme='dark'] .code-box[data-lang='go'] .code-box-lang {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    color: #67e8f9;
}

html[data-theme='dark'] .code-box[data-lang='php'] .code-box-lang {
    background: rgba(129, 140, 248, 0.15);
    border-color: rgba(165, 180, 252, 0.4);
    color: #a5b4fc;
}

html[data-theme='dark'] .code-box[data-lang='powershell'] .code-box-lang {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(96, 165, 250, 0.35);
    color: #7dd3fc;
}

html[data-theme='dark'] .code-box[data-lang='bash'] .code-box-lang {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.35);
    color: #cbd5e1;
}

html[data-theme='dark'] .code-box[data-lang='css'] .code-box-lang {
    background: rgba(236, 72, 153, 0.15);
    border-color: rgba(244, 114, 182, 0.4);
    color: #f9a8d4;
}

html[data-theme='dark'] .code-box[data-lang='json'] .code-box-lang {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(74, 222, 128, 0.4);
    color: #86efac;
}

html[data-theme='dark'] .code-box[data-lang='yaml'] .code-box-lang {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fca5a5;
}

html[data-theme='dark'] .code-box[data-lang='toml'] .code-box-lang {
    background: rgba(249, 115, 22, 0.15);
    border-color: rgba(251, 146, 60, 0.4);
    color: #fdba74;
}

html[data-theme='dark'] .code-box[data-lang='xml'] .code-box-lang {
    background: rgba(132, 204, 22, 0.15);
    border-color: rgba(163, 230, 53, 0.4);
    color: #bef264;
}

html[data-theme='dark'] .code-box[data-lang='sql'] .code-box-lang {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    color: #5eead4;
}

.code-box-pre {
    margin: 0;
    padding: 0.75rem 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    max-height: 32rem;
    overflow-y: auto;
}

.code-box-head .img-actions,
.code-box-head .btn-small { margin: 0; }

/* token colors */
.cb-kw { color: #7c3aed; font-weight: 600; }
.cb-str { color: #0a7d2c; }
.cb-com { color: var(--muted); font-style: italic; }
.cb-num { color: #c2410c; }
.cb-fn { color: var(--blue-deep); }
.cb-var { color: #b45309; }
.cb-prop { color: var(--blue-deep); }
.cb-tag { color: #b91c1c; font-weight: 600; }
.cb-attr { color: #b45309; }
.cb-key { color: var(--blue-deep); font-weight: 600; }
.cb-lit { color: #8a2be2; font-weight: 600; }

html[data-theme='dark'] .cb-kw { color: #c4a5ff; }
html[data-theme='dark'] .cb-str { color: #7ed99a; }
html[data-theme='dark'] .cb-num { color: #ffab70; }
html[data-theme='dark'] .cb-var { color: #e8b35c; }
html[data-theme='dark'] .cb-tag { color: #ff8f8f; }
html[data-theme='dark'] .cb-attr { color: #e8b35c; }
html[data-theme='dark'] .cb-lit { color: #d3a5ff; }
html[data-theme='dark'] .cb-fn,
html[data-theme='dark'] .cb-prop,
html[data-theme='dark'] .cb-key { color: #93c5fd; }

.dev-dns-mail {
    margin: 0.6rem 0;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper-2);
}

.dev-dns-diff td { background: var(--tint-orange); }

.dev-epoch-scan {
    margin-top: 0.8rem;
    padding: 0.75rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.dev-epoch-scan mark {
    background: var(--mark-soft);
    padding: 0 0.15rem;
    border-radius: 3px;
    cursor: help;
}

.dev-epoch-formats { margin: 0.8rem 0; }

.dev-id-block {
    margin-bottom: 1.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle, #e9ecef);
}
.dev-id-block:last-child { border-bottom: none; margin-bottom: 0; }
.dev-id-block h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    word-break: break-all;
}

.dev-esc-hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.dev-esc-warn {
    margin: 0.6rem 0;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    background: var(--tint-orange);
    color: var(--ink);
}

.dev-esc-diff {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
    flex-wrap: wrap;
    margin: 0.75rem 0;
}

.dev-esc-pane {
    flex: 1 1 220px;
    min-width: 0;
}

.dev-esc-pane h4 {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
}

.dev-esc-pre {
    margin: 0;
    padding: 0.65rem 0.75rem;
    min-height: 4.5rem;
    max-height: 14rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.45;
    border-radius: 8px;
    background: var(--paper-2);
    border: 1px solid var(--line);
}

.dev-esc-arrow {
    flex: 0 0 auto;
    align-self: center;
    font-size: 1.35rem;
    opacity: 0.45;
    user-select: none;
}

.dev-esc-pre mark.esc-hl {
    padding: 0 1px;
    border-radius: 2px;
    background: var(--mark-soft);
    color: inherit;
}

/* compact option rows above the flowchart canvas */
.dev-fc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
    margin: 0 0 6px;
}

.dev-fc-row > .img-ctl-label { margin: 0 2px 0 6px; }
.dev-fc-row > .img-ctl-label:first-child { margin-left: 0; }

.dev-fc-row .btn-secondary {
    margin: 0;
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
}

.dev-fc-row select { font-size: 0.82rem; }

.dev-fc-row label { font-size: 0.82rem; }

.dev-fc-swatch {
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 5px;
    cursor: pointer;
}

/* big export buttons under the canvas */
.dev-fc-export { margin-top: 0.75rem; }

.dev-fc-export .btn-secondary {
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
}

/* custom right-click menu */
.dev-fc-menu {
    position: absolute;
    z-index: 20;
    min-width: 170px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.25);
}

.dev-fc-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    padding: 0.35rem 0.6rem;
    border-radius: 5px;
    color: inherit;
}

.dev-fc-menu-item:hover {
    background: var(--paper-2);
    color: var(--orange);
}

.dev-fc-menu-sep {
    height: 1px;
    margin: 4px 6px;
    background: var(--line);
}

.dev-fc-mermaid {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper-2);
}

.dev-fc-mermaid summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dev-fc-mermaid-hint {
    margin: 0 0 0.5rem;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

.dev-fc-mermaid textarea {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* terminal-style command bar */
.dev-gt-cmdbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.4rem 0.3rem 0.8rem;
    margin: 0 0 0.6rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper-2);
    font-family: var(--font-mono);
}

.dev-gt-prompt {
    font-weight: 700;
    color: var(--ink-muted);
    user-select: none;
}

.dev-gt-cmdbar input {
    flex: 1;
    min-width: 8em;
    border: none;
    background: transparent;
    outline: none;
    box-shadow: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: inherit;
}

.dev-gt-cmdbar .btn-primary {
    margin: 0;
    padding: 0.3rem 0.95rem;
    font-size: 0.78rem;
}

/* quick-command chips */
.dev-gt-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 0.6rem;
}

.dev-gt-chip {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: inherit;
    cursor: pointer;
    transition: border-color 0.1s ease, color 0.1s ease;
}

.dev-gt-chip:hover {
    border-color: var(--orange);
    color: var(--orange);
}

/* level / scenario / session actions */
.dev-gt-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0 0 0.4rem;
}

.dev-gt-meta .btn-secondary {
    margin: 0;
    padding: 0.2rem 0.55rem;
    font-size: 0.72rem;
}

.dev-gt-meta select { font-size: 0.82rem; }

.dev-gt-spacer { flex: 1; }

.dev-gt-syntax {
    margin: 0.4rem 0 0.5rem;
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.dev-gt-goal {
    margin: 0 0 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--tint-blue);
    color: var(--ink);
}

.dev-gt-canvas-label {
    margin: 0.6rem 0 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
}

.dev-gt-remote-hint {
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.75rem;
    border: 1px dashed var(--line);
    border-radius: 8px;
    font-size: 0.8rem;
    color: var(--ink-muted);
}

.dev-gt-log {
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    margin-top: 10px;
    min-height: 2.2em;
}

.dev-gt-last {
    margin: 0.6rem 0 0;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    font-size: 0.88rem;
    background: var(--paper-2);
    border-left: 3px solid var(--accent);
    color: var(--ink);
}

.dev-gt-sheet {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper-2);
}

.dev-gt-sheet summary {
    cursor: pointer;
    font-weight: 600;
}

.dev-gt-sheet ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
    font-size: 0.88rem;
    color: var(--ink-muted);
}

.dev-gt-compare {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper-2);
}

.dev-gt-compare h3 {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.dev-gt-compare-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.dev-gt-compare-col {
    flex: 1 1 280px;
    min-width: 0;
}

.gi-cat-head {
    margin: 1rem 0 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
}

.gi-section:first-child .gi-cat-head {
    margin-top: 0;
}

.gi-section.is-hidden {
    display: none;
}

.gi-meta {
    margin: 0.4rem 0 0.6rem;
    font-size: 0.82rem;
    color: var(--ink-muted);
}

/* ------------------------------------------ HTML & JS Playground */

#dev-tool[data-tool='html-playground'] .img-controls {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.7rem;
}

#dev-tool[data-tool='html-playground'] .img-controls > .btn-primary,
#dev-tool[data-tool='html-playground'] .img-controls > .btn-secondary {
    margin: 0;
    padding: 0.5rem 0.95rem;
    align-self: center;
}

#dev-tool[data-tool='html-playground'] .img-controls > label {
    margin: 0;
}

#dev-tool[data-tool='html-playground'] .img-outputs:empty {
    display: none;
    margin: 0;
}

#dev-tool[data-tool='html-playground'] .hp-toolbar-spacer {
    flex: 1;
    min-width: 0.5rem;
}

#dev-tool[data-tool='html-playground'] .hp-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: stretch;
}

@media (max-width: 860px) {
    #dev-tool[data-tool='html-playground'] .hp-workspace {
        grid-template-columns: 1fr;
    }
}

#dev-tool[data-tool='html-playground'] .hp-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

#dev-tool[data-tool='html-playground'] .hp-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.38rem 0.75rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

#dev-tool[data-tool='html-playground'] .hp-panel-title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

#dev-tool[data-tool='html-playground'] .hp-tabs {
    margin: 0;
}

#dev-tool[data-tool='html-playground'] .hp-tabs .img-tab {
    font-size: 0.72rem;
    padding: 0.35rem 0.85rem;
}

#dev-tool[data-tool='html-playground'] .hp-tab[data-lang='html'].is-active {
    background: #ecfccb;
    color: #4d6b10;
    border-color: #a3c65c;
}

#dev-tool[data-tool='html-playground'] .hp-tab[data-lang='css'].is-active {
    background: #fce7f3;
    color: #9d2463;
    border-color: #e18ab8;
}

#dev-tool[data-tool='html-playground'] .hp-tab[data-lang='js'].is-active {
    background: #fdf3c7;
    color: #6b5a00;
    border-color: #e3c94b;
}

html[data-theme='dark'] #dev-tool[data-tool='html-playground'] .hp-tab[data-lang='html'].is-active {
    background: rgba(132, 204, 22, 0.15);
    border-color: rgba(163, 230, 53, 0.4);
    color: #bef264;
}

html[data-theme='dark'] #dev-tool[data-tool='html-playground'] .hp-tab[data-lang='css'].is-active {
    background: rgba(236, 72, 153, 0.15);
    border-color: rgba(244, 114, 182, 0.4);
    color: #f9a8d4;
}

html[data-theme='dark'] #dev-tool[data-tool='html-playground'] .hp-tab[data-lang='js'].is-active {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(250, 204, 21, 0.4);
    color: #fde68a;
}

#dev-tool[data-tool='html-playground'] .hp-editor-body {
    flex: 1 1 auto;
    min-height: 0;
}

#dev-tool[data-tool='html-playground'] .hp-editor-pane {
    display: none;
    height: 100%;
}

#dev-tool[data-tool='html-playground'] .hp-editor-pane.is-active {
    display: block;
}

#dev-tool[data-tool='html-playground'] .hp-editor-pane textarea {
    display: block;
    width: 100%;
    min-height: 22rem;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--card);
    padding: 0.75rem 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.55;
    tab-size: 4;
    resize: vertical;
    box-sizing: border-box;
    color: var(--ink);
}

#dev-tool[data-tool='html-playground'] .hp-editor-pane textarea:focus {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

#dev-tool[data-tool='html-playground'] .hp-view-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

#dev-tool[data-tool='html-playground'] .hp-preview-panel {
    flex: 1 1 auto;
    min-height: 16rem;
}

#dev-tool[data-tool='html-playground'] .hp-preview-body {
    flex: 1 1 auto;
    min-height: 14rem;
    background: #fff;
}

#dev-tool[data-tool='html-playground'] .hp-preview-body iframe {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 14rem;
    border: none;
    background: #fff;
}

#dev-tool[data-tool='html-playground'] .hp-console-panel {
    flex: 0 0 auto;
}

#dev-tool[data-tool='html-playground'] .hp-console {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.55;
    padding: 0.65rem 0.85rem;
    max-height: 11rem;
    min-height: 6rem;
    overflow: auto;
    background: #17181d;
    color: #d8dce8;
}

html[data-theme='dark'] #dev-tool[data-tool='html-playground'] .hp-console {
    background: #0f1014;
}

#dev-tool[data-tool='html-playground'] .hp-console-line {
    white-space: pre-wrap;
    word-break: break-word;
}

#dev-tool[data-tool='html-playground'] .hp-console-line.is-dim {
    color: #8189a3;
}

#dev-tool[data-tool='html-playground'] .hp-console-line.is-warn {
    color: #e8c268;
}

#dev-tool[data-tool='html-playground'] .hp-console-line.is-error {
    color: #ff7373;
}

/* --------------------------------------------- Python Playground */

#dev-tool[data-tool='python-playground'] .img-outputs:empty {
    display: none;
    margin: 0;
}

/* toolbar rows: run / environment / share. Controls bottom-align so a
   labelled select keeps the same baseline as the plain buttons beside
   it. */
#dev-tool[data-tool='python-playground'] .img-controls {
    gap: 0.5rem;
}

#dev-tool[data-tool='python-playground'] .pp-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.55rem;
}

#dev-tool[data-tool='python-playground'] .pp-bar .btn-primary,
#dev-tool[data-tool='python-playground'] .pp-bar .btn-secondary {
    margin: 0;
    padding: 0.5rem 0.95rem;
    align-self: flex-end;
}

#dev-tool[data-tool='python-playground'] .pp-bar-sep {
    flex: 0 0 auto;
    width: 1px;
    height: 2.05rem;
    background: var(--ink);
    opacity: 0.35;
    margin: 0 0.3rem;
}

/* narrow screens wrap between the groups anyway, and a divider left at
   the end of a wrapped line reads as a stray mark */
@media (max-width: 560px) {
    #dev-tool[data-tool='python-playground'] .pp-bar-sep {
        display: none;
    }
}

/* package name + Install read as one control */
#dev-tool[data-tool='python-playground'] .pp-field {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
}

#dev-tool[data-tool='python-playground'] .pp-bar select,
#dev-tool[data-tool='python-playground'] .pp-bar input[type='text'] {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    color: var(--ink);
    box-sizing: border-box;
}

#dev-tool[data-tool='python-playground'] .pp-bar input[type='text'] {
    width: 11em;
    padding: 0.5rem 0.7rem;
}

/* long option labels would otherwise stretch the closed select */
#dev-tool[data-tool='python-playground'] .pp-bar select {
    max-width: 12rem;
    padding: 0.5rem 2rem 0.5rem 0.95rem;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23191919' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
}

html[data-theme='dark'] #dev-tool[data-tool='python-playground']
.pp-bar select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23e6e4dd' stroke-width='1.5'/%3E%3C/svg%3E");
}

#dev-tool[data-tool='python-playground'] .pp-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.85rem;
    align-items: stretch;
}

@media (max-width: 860px) {
    #dev-tool[data-tool='python-playground'] .pp-workspace {
        grid-template-columns: 1fr;
    }
}

#dev-tool[data-tool='python-playground'] .pp-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

#dev-tool[data-tool='python-playground'] .pp-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem 0.5rem;
    padding: 0.38rem 0.75rem;
    background: var(--paper-2);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
}

#dev-tool[data-tool='python-playground'] .pp-panel-title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

#dev-tool[data-tool='python-playground'] .pp-wasm-badge {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    padding: 0.14rem 0.55rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    color: var(--muted);
}

#dev-tool[data-tool='python-playground'] .pp-editor-pane {
    flex: 1 1 auto;
    min-height: 0;
}

#dev-tool[data-tool='python-playground'] .pp-editor-pane textarea {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 24rem;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: var(--card);
    padding: 0.75rem 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.55;
    tab-size: 4;
    resize: vertical;
    box-sizing: border-box;
    color: var(--ink);
}

#dev-tool[data-tool='python-playground'] .pp-editor-pane
textarea:focus {
    outline: 2px solid var(--blue);
    outline-offset: -2px;
}

#dev-tool[data-tool='python-playground'] .pp-note {
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0.45rem 0 0;
}

#dev-tool[data-tool='python-playground'] .pp-view-col {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

#dev-tool[data-tool='python-playground'] .pp-console-panel {
    flex: 1 1 auto;
}

#dev-tool[data-tool='python-playground'] .pp-console {
    flex: 1 1 auto;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.55;
    padding: 0.65rem 0.85rem;
    min-height: 10rem;
    max-height: 24rem;
    overflow: auto;
    background: #17181d;
    color: #d8dce8;
}

html[data-theme='dark'] #dev-tool[data-tool='python-playground'] .pp-console {
    background: #0f1014;
}

#dev-tool[data-tool='python-playground'] .pp-console-line {
    white-space: pre-wrap;
    word-break: break-word;
}

#dev-tool[data-tool='python-playground'] .pp-console-line.is-dim {
    color: #8189a3;
}

#dev-tool[data-tool='python-playground'] .pp-console-line.is-warn {
    color: #e8c268;
}

#dev-tool[data-tool='python-playground'] .pp-console-line.is-error {
    color: #ff7373;
}

#dev-tool[data-tool='python-playground'] .pp-console-line.is-ok {
    color: #7ad48a;
}

#dev-tool[data-tool='python-playground'] .pp-plots-panel {
    flex: 0 1 auto;
}

#dev-tool[data-tool='python-playground'] .pp-plots {
    padding: 0.65rem 0.85rem;
    background: var(--card);
    min-height: 3.4rem;
    max-height: 26rem;
    overflow: auto;
}

#dev-tool[data-tool='python-playground'] .pp-plots img {
    display: block;
    max-width: 100%;
    height: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    margin: 0 0 0.6rem;
}

#dev-tool[data-tool='python-playground'] .pp-plots img:last-child {
    margin-bottom: 0;
}

#dev-tool[data-tool='python-playground'] .pp-plots-empty {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
}

/* --------------------------------------------- geography quiz map */

.geo-maphost {
    position: relative;
    max-width: 720px;
    margin: 8px auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    /* the map keeps its own light-blue cartographic palette in both
       themes, so the ocean is a literal colour rather than a token */
    background: #e7f5ff;
}

.geo-map-svg {
    display: block;
    width: 100%;
    height: auto;
}

body.geo-fs-lock { overflow: hidden; }

/* The whole stage goes fullscreen, not just the map: the question
   prompt and score header sit outside the map element and would
   otherwise be stranded behind the overlay. */
.img-stage.geo-stage-fs {
    position: fixed;
    inset: 1.2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0.9rem;
    background: var(--card);
    border: 1.5px solid var(--ink);
    /* The dim ring is a spread shadow rather than a negative-z-index
       pseudo-element: such a child paints above its own stacking
       context's background and would grey out the panel itself. */
    box-shadow: var(--shadow), 0 0 0 100vmax rgba(25, 25, 25, 0.45);
    overflow: auto;
}

/* Only the map may absorb or give up space. Without this the prompt
   shrinks to its min-height on short viewports, its text overflows,
   and the positioned map paints over the question. */
.img-stage.geo-stage-fs > * { flex: 0 0 auto; }

.img-stage.geo-stage-fs .geo-maphost {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    max-width: none;
    margin: 8px 0 0;
}

/* viewBox plus the default preserveAspectRatio letterboxes the map
   into whatever shape the overlay ends up, so height can just fill */
.img-stage.geo-stage-fs .geo-map-svg {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

.img-stage.geo-stage-fs .img-status {
    margin: 0.5rem 0 0;
    text-align: center;
}

/* --------------------------------------------- tail latency */

/* One bordered panel of labelled groups instead of six loose rows.
   Each group is a two-column grid — caption, then a nested grid of
   equal control tracks — so a control that wraps lands under its
   neighbours and never under the caption. */
.tl-panel {
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 0 0.85rem;
}

.tl-group {
    display: grid;
    grid-template-columns: 6rem minmax(0, 1fr);
    align-items: center;
    gap: 0 0.9rem;
    padding: 0.5rem 0;
    border-top: 1px solid var(--line);
}

.tl-group:first-child { border-top: 0; }

/* the group caption is the only uppercase system in the panel, and the
   positioned anchor for its info tip */
.tl-bar-label {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
}

/* floats over the controls below, and is clamped to the viewport since
   the caption sits close to the left edge on narrow screens */
.tl-info-tip {
    z-index: 20;
    top: 1.4rem;
    width: min(26rem, calc(100vw - 5rem));
}

/* fixed track count rather than auto-fit: three even columns keep the
   five load controls at 3 + 2 instead of stranding one on its own */
.tl-ctls.is-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 0.5rem 0.9rem;
}

.tl-ctls.is-run {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.8rem;
}

.tl-ctls.is-stories {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.tl-btnrow {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.5rem;
}

/* the four named runs sit in even tracks, so the block breaks 2 + 2
   instead of leaving a single button stranded on a line of its own */
.tl-storyrow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.45rem 0.5rem;
}

.tl-panel .btn-primary,
.tl-panel .btn-secondary {
    margin: 0;
    padding: 0.4rem 0.85rem;
}

/* a switch and the knob it governs, stacked in one grid cell */
.tl-cell {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

/* control labels are quiet sentence case, so they read as captions of
   their control rather than competing with the group captions */
#dev-tool[data-tool='tail-latency'] .img-ctl-label {
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
}

/* inactive knobs stay in place, disabled and dimmed */
.tl-dep.is-off { opacity: 0.5; }

/* controls fill their track, so sliders, selects and value readouts
   line up in columns down the panel */
#dev-tool[data-tool='tail-latency'] .is-grid .img-ctl,
#dev-tool[data-tool='tail-latency'] .is-grid .img-slider {
    min-width: 0;
}

#dev-tool[data-tool='tail-latency'] .is-grid .img-slider {
    display: flex;
    width: 100%;
}

#dev-tool[data-tool='tail-latency'] .is-grid
.img-slider input[type="range"] {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

#dev-tool[data-tool='tail-latency'] .is-grid .img-slider-value {
    flex: 0 0 3.6rem;
    min-width: 0;
    text-align: right;
}

#dev-tool[data-tool='tail-latency'] .is-grid select {
    align-self: stretch;
    width: 100%;
}

.tl-charts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.tl-pctwrap {
    margin: 0 0 0.9rem;
    padding: 0.7rem 0.85rem;
    background: var(--card);
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.tl-pct-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.3rem 0;
}

.tl-pct-name {
    flex: 0 0 2.4rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink);
}

.tl-pct-track {
    flex: 1 1 auto;
    height: 0.7rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
}

.tl-pct-track i {
    display: block;
    width: 0;
    height: 100%;
    transition: width 0.2s linear;
}

/* the three percentile colours match the chart lines in both themes */
.tl-pct-row.is-p50 i { background: #16a34a; }
.tl-pct-row.is-p95 i { background: #d97706; }
.tl-pct-row.is-p99 i { background: #dc2626; }

.tl-pct-val {
    flex: 0 0 5rem;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink);
}

.tl-caption {
    margin: 0.6rem 0 0;
    max-width: 68ch;
    font-size: 0.83rem;
    line-height: 1.5;
    color: var(--muted);
}

.tl-legend {
    margin: 0.5rem 0 0;
    font-size: 0.78rem;
    color: var(--muted);
}

@media (max-width: 900px) {
    .tl-ctls.is-grid,
    .tl-storyrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 780px) {
    .tl-charts { grid-template-columns: 1fr; }
}

/* narrow: the caption becomes a heading above its own controls */
@media (max-width: 620px) {
    .tl-group {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.35rem;
    }

    .tl-ctls.is-grid,
    .tl-storyrow { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------ unix timestamp converter */

#dev-tool[data-tool='timestamp-converter'] .img-controls {
    display: block;
}

/* live clock strip: label, four copyable readings, "use this instant" */
#dev-tool[data-tool='timestamp-converter'] .dev-tsc-now {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.9rem;
    padding: 0.6rem 0.75rem;
    margin: 0 0 0.75rem;
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 8px;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-now-label {
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--muted);
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-now-item {
    display: inline-flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-now-key {
    font-size: 0.78rem;
    color: var(--muted);
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-now
.dev-ent-copycell {
    font-size: 0.85rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-now button.btn-secondary {
    margin: 0 0 0 auto;
    padding: 0.4rem 0.8rem;
}

/* control bar, same multi-row rhythm as the playground toolbar */
#dev-tool[data-tool='timestamp-converter'] .dev-tsc-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.6rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-bar .btn-primary,
#dev-tool[data-tool='timestamp-converter'] .dev-tsc-bar .btn-secondary {
    margin: 0;
    padding: 0.5rem 0.95rem;
    align-self: flex-end;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-bar .img-check {
    margin: 0 0 0.3rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-value {
    font-family: var(--font-mono);
    min-width: 15rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-bar select {
    max-width: 14rem;
}

/* one labelled block per job: convert, formats, batch, reverse */
#dev-tool[data-tool='timestamp-converter'] .dev-tsc-sec {
    margin: 1.25rem 0 0;
    padding: 0.9rem 1rem 1rem;
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 10px;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-sec:first-child {
    margin-top: 0.4rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-h {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    letter-spacing: 0.01em;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-sub {
    margin: 0.9rem 0 0.4rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-detect {
    margin: 0;
    font-size: 0.88rem;
    color: var(--ink);
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-rel {
    margin: 0.7rem 0 0;
    font-size: 0.95rem;
    font-weight: 600;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-zones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.6rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-card {
    padding: 0.6rem 0.7rem;
    background: var(--surface);
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-card-zone {
    font-weight: 700;
    font-size: 0.88rem;
    word-break: break-word;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-card-sub {
    margin-left: 0.4rem;
    font-size: 0.75rem;
    color: var(--muted);
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-card-time {
    margin: 0.3rem 0 0.25rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-card-time
.dev-ent-copycell {
    font-size: 1.02rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-card-meta {
    font-size: 0.78rem;
    color: var(--muted);
}

/* the format and batch tables scroll inside their section instead of
   widening the whole page on a phone */
#dev-tool[data-tool='timestamp-converter'] .dev-tsc-fmts {
    overflow-x: auto;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-batch {
    max-height: 26rem;
    overflow: auto;
    margin-top: 0.6rem;
}

#dev-tool[data-tool='timestamp-converter'] .dev-tsc-badrow td {
    color: var(--orange);
}

#dev-tool[data-tool='timestamp-converter'] textarea.dev-code-in {
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 560px) {
    #dev-tool[data-tool='timestamp-converter'] .dev-tsc-now button.btn-secondary {
        margin-left: 0;
    }

    /* one reading per line, key left and value right, so the longer
       labels stop wrapping around their own value */
    #dev-tool[data-tool='timestamp-converter'] .dev-tsc-now-item {
        flex: 1 1 100%;
        justify-content: space-between;
        gap: 0.6rem;
    }

    #dev-tool[data-tool='timestamp-converter'] .dev-tsc-value {
        min-width: 0;
        width: 100%;
    }
}

/* ------------------------------------------ airplane boarding sim */

#sim-tool[data-tool='airplane-boarding'] .ab-panel {
    background: var(--surface);
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 0 0.85rem;
    margin-bottom: 0.6rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-group {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    align-items: center;
    gap: 0 0.9rem;
    padding: 0.55rem 0;
    border-top: 1px solid var(--line);
}

#sim-tool[data-tool='airplane-boarding'] .ab-group:first-child {
    border-top: 0;
}

#sim-tool[data-tool='airplane-boarding'] .ab-bar-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink);
}

#sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
    gap: 0.5rem 0.9rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-run {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.8rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-cell {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 0;
}

#sim-tool[data-tool='airplane-boarding'] .ab-dep.is-off {
    opacity: 0.5;
}

#sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid .img-ctl,
#sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid .img-slider {
    min-width: 0;
}

#sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid .img-slider {
    display: flex;
    width: 100%;
}

#sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid
.img-slider input[type='range'] {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

#sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid select {
    align-self: stretch;
    width: 100%;
}

#sim-tool[data-tool='airplane-boarding'] .ab-seed-note {
    margin-top: 0.15rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-result {
    margin: 0.7rem 0 0.4rem;
    padding: 0.75rem 0.9rem;
    background: var(--card);
    border: 1.5px solid var(--ink);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    max-width: 36rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-result-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 0.35rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-result-note {
    margin: 0 0 0.45rem;
    font-size: 0.85rem;
    color: var(--muted);
}

#sim-tool[data-tool='airplane-boarding'] .ab-result-meta {
    list-style: none;
    margin: 0 0 0.6rem;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 1rem;
    font-size: 0.82rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-result-meta .ab-k {
    color: var(--muted);
    margin-right: 0.35rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-result-meta .ab-v {
    color: var(--ink);
    font-family: var(--font-mono);
}

#sim-tool[data-tool='airplane-boarding'] .ab-result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

#sim-tool[data-tool='airplane-boarding'] .ab-result-actions .btn-secondary {
    margin: 0;
    padding: 0.35rem 0.75rem;
}

@media (max-width: 780px) {
    #sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    #sim-tool[data-tool='airplane-boarding'] .ab-group {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.35rem;
    }

    #sim-tool[data-tool='airplane-boarding'] .ab-ctls.is-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    #sim-tool[data-tool='airplane-boarding'] .ab-result-meta {
        grid-template-columns: 1fr;
    }
}

/* ------------------------------------------------------- will it fit */
.wf-root .img-subhead:first-child { margin-top: 0; }

.wf-verdict {
    display: none;
    margin: 0 0 0.6rem;
    padding: 0.65rem 0.9rem;
    border: 1.5px solid var(--ink);
    box-shadow: var(--shadow-sm);
    line-height: 1.45;
}

.wf-verdict.is-fit,
.wf-verdict.is-nofit { display: block; }
.wf-verdict.is-fit { background: var(--tint-green); }
.wf-verdict.is-nofit { background: var(--tint-red); }

.wf-verdict strong {
    font-family: var(--font-display);
    font-size: 1.15rem;
    margin-right: 0.25rem;
}

.wf-caption {
    min-height: 1.4em;
    margin: 0 0 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--muted);
}

.wf-scrub { width: min(22rem, 60vw); }

.wf-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
    gap: 0.7rem;
    margin: 0.4rem 0 1rem;
}

.wf-step {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.4rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    color: var(--ink);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.wf-step:hover { box-shadow: var(--shadow-sm); }

.wf-step canvas {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid var(--line);
    background: #fffdf8;
}

.wf-step-n {
    position: absolute;
    top: 0.65rem;
    left: 0.65rem;
    min-width: 1.5rem;
    padding: 0.05rem 0.35rem;
    border: 1.5px solid var(--ink);
    background: var(--mark);
    color: var(--ink);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    text-align: center;
}

.wf-step-text { font-size: 0.88rem; line-height: 1.35; }

.wf-fixes { max-width: 34rem; margin-bottom: 0.8rem; }
.wf-fixes .btn-secondary { margin: 0 0 0 0.4rem; padding: 0.15rem 0.6rem; }
.wf-yes { color: #2b8a3e; }
.wf-no { color: var(--muted); }

/* star photo identifier */
.sp-samples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
    margin-top: 0.7rem;
}
.sp-samples .btn-small { margin-left: 0; }
.sp-samples .img-ctl { margin-left: auto; }
.sp-samples-label { font-size: 0.85rem; color: var(--muted); }

.sp-viewer {
    position: relative;
    margin: 0.7rem 0 0.35rem;
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: #04060b;
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
.sp-canvas { display: block; width: 100%; cursor: grab; }
.sp-canvas:active { cursor: grabbing; }

.sp-tip {
    position: absolute;
    z-index: 2;
    max-width: 17rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    background: rgba(8, 12, 22, 0.94);
    color: #f1f3f8;
    font-size: 0.78rem;
    line-height: 1.4;
    pointer-events: none;
}
.sp-tip strong { display: block; font-size: 0.86rem; }

.sp-credit { margin: 0 0 0.3rem; font-size: 0.75rem; color: var(--muted); }

.sp-layers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1.1rem;
    margin: 0.5rem 0;
}

.sp-downloads { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
.sp-downloads > button { margin: 0; }
.sp-layers[hidden], .sp-downloads[hidden] { display: none; }

.sp-lead { font-size: 1.08rem; font-weight: 600; }
.sp-loose {
    padding: 0.5rem 0.7rem;
    border-left: 3px solid var(--orange);
    background: var(--tint-orange);
    font-size: 0.88rem;
}

.sp-facts { border-collapse: collapse; margin: 0.4rem 0 1rem; font-size: 0.88rem; }
.sp-facts th {
    padding: 0.32rem 1.2rem 0.32rem 0;
    font-weight: 600;
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
}
.sp-facts td { padding: 0.32rem 0; }
.sp-facts tr + tr th,
.sp-facts tr + tr td { border-top: 1px solid var(--line); }

.sp-when {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem 1rem;
    padding: 0.75rem;
    border: 2px solid var(--ink);
    box-shadow: var(--shadow-sm);
    background: var(--card);
}
.sp-when input[type="datetime-local"] {
    font: inherit;
    font-size: 0.85rem;
    padding: 0.3rem 0.45rem;
    border: 1.5px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
}
.sp-when-btns { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sp-when-btns .btn-small { margin-left: 0; }
.sp-when-note { margin: 0.4rem 0 1rem; }

.sp-tips li { margin: 0.25rem 0; }

/* song practice studio */
.sng-demo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.7rem;
    margin-top: 0.6rem;
}
.sng-demo-row .btn-small { margin-left: 0; }

.sng-app { margin-top: 0.8rem; }

.sng-info { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.sng-fact {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.45rem 0.75rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.sng-fact-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.sng-fact-value { font-size: 1.05rem; font-weight: 700; }
.sng-fact-value small { font-size: 0.78rem; font-weight: 500; color: var(--muted); }

.sng-tip {
    margin: 0.6rem 0 0;
    padding: 0.45rem 0.7rem;
    border-left: 3px solid var(--blue);
    background: var(--tint-blue);
    font-size: 0.88rem;
}
.sng-tip .btn-small { margin-left: 0.4rem; }

.sng-now {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 0.9rem 0 0.7rem;
}
.sng-chordbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 0.8rem 0.7rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.sng-chordbox.is-next { opacity: 0.8; }
.sng-chordbox.is-next.is-soon { opacity: 1; border-color: var(--orange); }
.sng-chordbox-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    align-self: stretch;
}
.sng-chordbox-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.sng-chordbox-when { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); }
.sng-chordbox-name {
    font-family: var(--font-display);
    font-size: 2.3rem;
    font-weight: 700;
    line-height: 1.05;
    min-height: 1.05em;
}
.sng-diagram { color: var(--ink); min-height: 2rem; }
.sng-diagram svg { display: block; margin: 0 auto; }
.sng-diagram .k-white { fill: var(--surface); stroke: var(--ink); stroke-width: 1; }
.sng-diagram .k-black { fill: var(--ink); stroke: var(--ink); stroke-width: 1; }
.sng-diagram .k-on { fill: var(--blue); stroke: var(--ink); stroke-width: 1; }
.sng-diagram .k-root { fill: var(--orange); stroke: var(--ink); stroke-width: 1; }

.sng-dots { display: inline-flex; gap: 4px; }
.sng-dot {
    width: 9px;
    height: 9px;
    border: 1.5px solid var(--ink);
    border-radius: 50%;
}
.sng-dot.is-past { background: var(--line); }
.sng-dot.is-on { background: var(--orange); border-color: var(--orange); }

.sng-overview {
    display: block;
    width: 100%;
    height: 70px;
    border: 2px solid var(--ink);
    background: var(--card);
    cursor: pointer;
    touch-action: none;
}

.sng-transport { margin: 0.7rem 0; }
.sng-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.sng-btns > .btn-primary,
.sng-btns > .btn-secondary { margin: 0; }
.sng-iconbtn { min-width: 2.4rem; padding-left: 0.55rem; padding-right: 0.55rem; }
.sng-play { min-width: 6.5rem; }
.sng-time { font-family: var(--font-mono); font-size: 0.85rem; min-width: 9.5em; }
.sng-toggle.is-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.sng-loopinfo { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.sng-checks { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-top: 0.6rem; }
.sng-loophint { margin: 0.4rem 0 0; }

.sng-sheet {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    max-height: 24rem;
    overflow-y: auto;
    padding: 6px;
    border: 2px solid var(--ink);
    background: var(--card);
    margin: 0.8rem 0;
}
.sng-bar {
    position: relative;
    min-height: 3.3rem;
    padding-top: 0.95rem;
    border: 1.5px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    user-select: none;
}
.sng-bar.is-cur { border-color: var(--ink); }
.sng-bar.is-loop { background: var(--tint-blue); border-color: var(--blue); }
.sng-bar.is-pick { outline: 2px dashed var(--blue); outline-offset: 1px; }
.sng-bar.is-pickup { opacity: 0.85; }
.sng-barno {
    position: absolute;
    top: 2px;
    left: 5px;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    color: var(--muted);
}
.sng-beats { display: flex; height: 100%; }
.sng-beat {
    flex: 1 1 0;
    min-width: 0;
    padding: 0.15rem 0.3rem 0.3rem;
    white-space: nowrap;
}
.sng-beat + .sng-beat { border-left: 1px dotted var(--line); }
.sng-beat b { position: relative; z-index: 1; font-size: 1.02rem; }
.sng-beat b.is-held,
.sng-beat.is-nc b { color: var(--muted); font-weight: 500; }
.sng-beat.is-now { background: var(--mark); }

.sng-setup { border-top: 1px solid var(--line); padding-top: 0.8rem; }
.sng-fix { margin-top: 0.7rem; }
.sng-fix .btn-small { margin-left: 0; }
.sng-stems {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.9rem;
    padding-top: 0.8rem;
    border-top: 1px dashed var(--line);
}
.sng-split { flex-wrap: wrap; gap: 0.4rem 0.8rem; }
.sng-split .btn-secondary, .sng-mixer .btn-small { margin-left: 0; }
.sng-split .img-note { flex: 1 1 18rem; margin: 0; }
.sng-stems .img-status { margin: 0; }
.sng-mixer { display: flex; flex-direction: column; gap: 0.35rem; }
.sng-mixrow {
    display: grid;
    grid-template-columns: 5.5rem minmax(8rem, 18rem) auto auto;
    justify-content: start;
    align-items: center;
    gap: 0.4rem 0.6rem;
}
.sng-mixname { font-weight: 700; font-size: 0.92rem; }
.sng-mixer .img-slider { display: flex; align-items: center; gap: 0.5rem; }
.sng-mixer .img-slider input { flex: 1 1 auto; min-width: 0; }
.sng-mixer .img-note { margin: 0; }
@media (max-width: 600px) {
    .sng-mixrow { grid-template-columns: 4.6rem minmax(0, 1fr) auto auto; }
}
.sng-semis {
    font-family: var(--font-mono);
    font-weight: 700;
    min-width: 2.2em;
    text-align: center;
}
.sng-app h2 {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1.2rem 0 0.5rem;
}
.sng-shapes { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.sng-shape {
    padding: 0.35rem 0.55rem 0.45rem;
    border: 1.5px solid var(--ink);
    background: var(--card);
    text-align: center;
}
.sng-shape-name { font-weight: 700; font-size: 0.92rem; margin-bottom: 0.2rem; }
.sng-downloads { margin-top: 1rem; }
.sng-keys { margin-top: 0.8rem; }

@media (max-width: 640px) {
    .sng-sheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sng-now { grid-template-columns: 1fr; }
    .sng-chordbox-name { font-size: 1.9rem; }
}

/* auto analyst */
.aa-samples {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.5rem;
}
.aa-samples .btn-small { margin-left: 0; }
.aa-samples-label { font-size: 0.85rem; color: var(--muted); }
.aa-paste > summary,
.aa-options > summary {
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--muted);
}
.aa-paste textarea { width: 100%; margin: 0.5rem 0; font-family: var(--font-mono); font-size: 0.8rem; }
.aa-options .img-row { margin-top: 0.5rem; }

.aa-report { margin-top: 0.4rem; }
.aa-head h2 { margin: 0 0 0.15rem; font-size: 1.35rem; word-break: break-word; }
.aa-meta { margin: 0 0 0.8rem; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.aa-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    border-bottom: 2px solid var(--ink);
    margin-bottom: 1rem;
}
.aa-tab {
    padding: 0.45rem 0.8rem;
    border: 2px solid var(--ink);
    border-bottom: none;
    background: var(--card);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    margin-bottom: -2px;
}
.aa-tab.is-on { background: var(--ink); color: var(--paper); }
.aa-section { margin: 0 0 1.4rem; }
.aa-section > h3 {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.6rem;
}
.aa-warnbox {
    padding: 0.7rem 0.9rem;
    border-left: 4px solid var(--orange);
    background: var(--tint-orange);
}
.aa-warnbox .btn-small { margin-left: 0; }
.aa-cards { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.5rem; }
.aa-card {
    display: flex;
    flex-direction: column;
    min-width: 7.5rem;
    padding: 0.5rem 0.75rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.aa-card strong { font-size: 1.35rem; font-family: var(--font-display); }
.aa-card span { font-size: 0.75rem; color: var(--muted); }
.aa-card.is-warn { border-color: var(--orange); }
.aa-types { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); margin: 0 0 1.2rem; }

.aa-finding {
    border: 1.5px solid var(--line);
    background: var(--card);
    margin: 0 0 0.5rem;
}
.aa-finding[open] { border-color: var(--ink); }
.aa-finding > summary {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    list-style: none;
}
.aa-finding > summary::-webkit-details-marker { display: none; }
.aa-finding-text { line-height: 1.45; }
.aa-explained { color: var(--orange); font-size: 0.86em; }
.aa-finding-body { padding: 0 0.75rem 0.7rem; }
.aa-badge {
    flex: 0 0 auto;
    padding: 0.08rem 0.45rem;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--line);
    color: var(--ink);
}
.aa-badge-1 { background: var(--tint-blue); }
.aa-badge-2 { background: var(--blue); color: #fff; }
.aa-badge-3 { background: var(--orange); color: #fff; }
.aa-detail { font-family: var(--font-mono); font-size: 0.74rem; color: var(--muted); margin: 0.4rem 0 0; }
.aa-calc { font-family: var(--font-mono); font-size: 0.74rem; white-space: nowrap; }

.aa-chart { margin: 0.3rem 0; color: var(--ink); }
.aa-svg { display: block; width: 100%; max-width: 480px; height: auto; overflow: visible; }
.aa-chart-small .aa-svg { max-width: 340px; }
.aa-svg .aa-grid { stroke: var(--line); stroke-width: 1; }
.aa-svg .aa-axis { stroke: var(--ink); stroke-width: 1; }
.aa-svg .aa-tick { font-family: var(--font-mono); font-size: 9.5px; fill: var(--muted); }
.aa-svg .aa-strong { font-weight: 700; fill: var(--ink); }
.aa-svg .aa-axt { font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; fill: var(--ink); }
.aa-svg .aa-mark { stroke: var(--orange); stroke-width: 1.5; stroke-dasharray: 3 3; }
.aa-svg .aa-trend { fill: none; stroke: var(--orange); stroke-width: 2; }
.aa-svg .aa-line { fill: none; stroke: var(--blue); stroke-width: 2; }
.aa-svg .aa-line-orange { stroke: var(--orange); }
.aa-svg .aa-fit { stroke-width: 2.2; }
.aa-svg .aa-fit-all { stroke: var(--ink); stroke-dasharray: 6 4; }
.aa-svg .aa-whisk { stroke: var(--muted); stroke-width: 1.2; }
.aa-svg .aa-box { stroke: var(--blue); stroke-width: 1.2; }
.aa-svg .aa-med { stroke: var(--orange); stroke-width: 2.5; }
.aa-svg .aa-seg { font-family: var(--font-mono); font-size: 9px; fill: #fff; }
.aa-heatwrap { overflow-x: auto; }
.aa-heat { max-width: none; }
.aa-heat .aa-cell.is-pair { cursor: pointer; }
.aa-heat .aa-cell.is-pair:hover { stroke: var(--orange); stroke-width: 2; }
.aa-pick { margin-top: 0.5rem; }

.aa-issues { list-style: none; padding: 0; margin: 0; }
.aa-issue {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    padding: 0.45rem 0;
    border-bottom: 1px solid var(--line);
    font-size: 0.92rem;
    line-height: 1.45;
}
.aa-sev {
    flex: 0 0 4.2rem;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.aa-sev-high .aa-sev { color: #c92a2a; font-weight: 700; }
.aa-sev-medium .aa-sev { color: var(--orange); font-weight: 700; }
.aa-issues-small .aa-issue { font-size: 0.8rem; padding: 0.3rem 0; }
.aa-issues-small .aa-sev { flex-basis: 3.4rem; }

.aa-colgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
    gap: 0.8rem;
}
.aa-col {
    padding: 0.65rem 0.8rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
    min-width: 0;
}
.aa-col h4 { margin: 0 0 0.3rem; font-size: 0.95rem; word-break: break-word; }
.aa-col-head { display: flex; justify-content: space-between; gap: 0.5rem; align-items: baseline; margin-bottom: 0.4rem; }
.aa-col-head strong { word-break: break-word; }
.aa-type {
    flex: 0 0 auto;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.08rem 0.4rem;
    background: var(--tint-blue);
    border-radius: 3px;
}
.aa-type-id, .aa-type-text, .aa-type-const, .aa-type-empty, .aa-type-hicat { background: var(--line); }
.aa-stats {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.1rem 0.7rem;
    margin: 0 0 0.3rem;
    font-size: 0.8rem;
}
.aa-stats dt { color: var(--muted); }
.aa-stats dd { margin: 0; font-family: var(--font-mono); word-break: break-word; }
.aa-shape { margin: 0.3rem 0 0; font-size: 0.82rem; }

.aa-testtable { max-height: 32rem; margin-top: 0.5rem; }
.aa-testtable th.aa-sortable { cursor: pointer; white-space: nowrap; }
.aa-testtable tr.is-sig td { font-weight: 600; }

.aa-lead { font-size: 1rem; line-height: 1.5; }
.aa-warnline {
    padding: 0.4rem 0.7rem;
    border-left: 3px solid var(--orange);
    background: var(--tint-orange);
    font-size: 0.88rem;
}
.aa-caveat { font-size: 0.85rem; color: var(--muted); font-style: italic; }
.aa-drivers h4 { margin: 1rem 0 0.3rem; font-size: 0.9rem; }
.aa-paradox {
    padding: 0.7rem 0.9rem;
    margin-bottom: 1rem;
    border: 2px solid var(--ink);
    background: var(--card);
}
.aa-paradox.is-rev { border-color: var(--orange); }
.aa-legend { font-size: 0.8rem; }
.aa-swatch {
    display: inline-block;
    width: 0.7rem;
    height: 0.7rem;
    margin-right: 0.3rem;
    border-radius: 2px;
    vertical-align: -1px;
}
.aa-series { margin-bottom: 1rem; }
.aa-series h4 { margin: 0 0 0.2rem; }
.aa-exports { border-top: 1px solid var(--line); padding-top: 0.8rem; }

/* handwriting font maker */
.hf-app { display: flex; flex-direction: column; gap: 1.3rem; }
.hf-step {
    padding: 0.9rem 1rem 1rem;
    border: 2px solid var(--ink);
    background: var(--card);
    box-shadow: var(--shadow-sm);
}
.hf-step-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 0.8rem;
    font-size: 1.12rem;
}
.hf-step-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid var(--ink);
    background: var(--mark);
    font-family: var(--font-mono);
    font-size: 0.9rem;
}
.hf-thumbs { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 0.4rem 0 0.6rem; }
.hf-thumbs canvas {
    width: 150px;
    height: auto;
    border: 1.5px solid var(--ink);
    background: #fff;
}
.hf-tips { margin: 0.4rem 0 0; padding-left: 1.2rem; font-size: 0.88rem; }
.hf-tips li { margin: 0.2rem 0; }
.hf-pages { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; }
.hf-pages:empty { display: none; }
.hf-page {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.5rem;
    border: 1.5px solid var(--line);
    background: var(--surface);
}
.hf-page canvas { flex: 0 0 auto; width: 90px; height: auto; border: 1px solid var(--line); }
.hf-page-text { flex: 1 1 auto; min-width: 0; font-size: 0.9rem; }
.hf-page-title { font-weight: 700; }
.hf-page-file { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.hf-page-warn { color: var(--orange); }
.hf-page.is-bad { border-color: var(--orange); background: var(--tint-orange); }
.hf-page > .btn-small { flex: 0 0 auto; margin-left: 0; }
.hf-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(3.3rem, 1fr));
    gap: 0.35rem;
    margin: 0.6rem 0;
}
.hf-tile {
    position: relative;
    aspect-ratio: 22 / 24;
    padding: 0;
    border: 1.5px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}
.hf-tile:hover { border-color: var(--ink); }
.hf-tile svg { display: block; width: 100%; height: 100%; }
.hf-tile path { fill: currentColor; }
.hf-tile .hf-base { stroke: var(--blue); stroke-width: 16; opacity: 0.35; }
.hf-tile-label {
    position: absolute;
    top: 2px;
    left: 4px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    line-height: 1;
    color: var(--muted);
}
.hf-tile.is-missing { border-style: dashed; background: transparent; cursor: default; }
.hf-tile.is-off svg { opacity: 0.22; }
.hf-tile.is-sel { outline: 3px solid var(--blue); outline-offset: 1px; }
.hf-tile.is-adj::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--orange);
}
.hf-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; }
.hf-editor:empty { display: none; }
.hf-editor > .btn-small { margin-left: 0; }
.hf-editor-label { font-weight: 700; margin-right: 0.3rem; }
.hf-checks { margin: 0.6rem 0 0.4rem; }
.hf-preview {
    display: block;
    width: 100%;
    min-height: 10rem;
    box-sizing: border-box;
    margin-top: 0.6rem;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--ink);
    background: var(--surface);
    color: var(--ink);
    line-height: 1.35;
    resize: vertical;
    font-kerning: normal;
    font-feature-settings: "kern" 1, "calt" 1;
}
.hf-install { margin: 0.35rem 0 0; font-size: 0.86rem; color: var(--muted); }
@media (max-width: 600px) {
    .hf-step { padding: 0.7rem; }
    .hf-grid { grid-template-columns: repeat(auto-fill, minmax(2.8rem, 1fr)); }
    .hf-page canvas { width: 64px; }
}
