/* ==========================================================================
   ImgColorPicker – site styles
   Plain CSS with custom properties. Sections:
   1. Tokens  2. Base  3. Layout  4. Header & footer  5. Components
   6. Tool pages  7. Individual tools  8. Utilities
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */
:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --surface-2: #f1f3f6;
    --border: #e2e5ea;
    --border-strong: #c9ced6;
    --text: #15181e;
    --text-2: #4a5160;
    --muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef0ff;
    --on-primary: #ffffff;
    --success: #0f7b4a;
    --success-soft: #e5f6ee;
    --danger: #c52b2b;
    --danger-soft: #fdecec;
    --warning: #9a5b00;
    --warning-soft: #fff4e0;
    --focus: #4f46e5;
    --checker: repeating-conic-gradient(#e6e8ec 0 25%, #fff 0 50%) 0 0 / 16px 16px;
    --shadow-sm: 0 1px 2px rgb(16 24 40 / 6%);
    --shadow: 0 1px 3px rgb(16 24 40 / 8%), 0 4px 12px rgb(16 24 40 / 6%);
    --shadow-lg: 0 12px 32px rgb(16 24 40 / 14%);
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --container: 1200px;
    --header-h: 60px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --border-strong: #3a4150;
    --text: #eceef2;
    --text-2: #b7bdc8;
    --muted: #8e95a3;
    --primary: #8b85ff;
    --primary-hover: #a29dff;
    --primary-soft: #23224a;
    --on-primary: #0f1115;
    --success: #4ccf8f;
    --success-soft: #12301f;
    --danger: #ff7b7b;
    --danger-soft: #3a1717;
    --warning: #ffb547;
    --warning-soft: #33250f;
    --focus: #a29dff;
    --checker: repeating-conic-gradient(#2a2f3a 0 25%, #1f232c 0 50%) 0 0 / 16px 16px;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 30%);
    --shadow: 0 1px 3px rgb(0 0 0 / 40%), 0 4px 12px rgb(0 0 0 / 25%);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 50%);
    color-scheme: dark;
}

/* 2. Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 var(--font);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.6rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
img, svg, canvas { display: block; max-width: 100%; }
code, kbd, pre, textarea.code-output { font-family: var(--mono); font-size: .9em; }
kbd {
    display: inline-block;
    padding: 0 .4em;
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    background: var(--surface);
    font-size: .8em;
    line-height: 1.5;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--primary-soft); }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

.icon { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -.25em; }
.icon--sm { width: 1em; height: 1em; }
.icon--xl { width: 3rem; height: 3rem; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 100;
    padding: .5rem 1rem;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--radius-sm);
}
.skip-link:focus { top: .5rem; }
main:focus { outline: none; }

/* 3. Layout ---------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container--narrow { max-width: 800px; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

main { min-height: 60vh; padding-bottom: 3rem; }

.page-head { padding: 1.75rem 0 1.25rem; max-width: 780px; }
.page-head--center { text-align: center; margin: 0 auto; padding-top: 4rem; }
.page-head h1 { margin-bottom: .35rem; }
.lead { font-size: 1.1rem; color: var(--text-2); margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 700; color: var(--primary); margin: 0 0 .5rem; }

.content-grid { display: grid; gap: 2rem; margin-top: 3rem; }
@media (min-width: 960px) { .content-grid { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }

.sidebar { display: grid; gap: 1rem; }
@media (min-width: 960px) { .sidebar { position: sticky; top: calc(var(--header-h) + 16px); } }

/* 4. Header & footer ------------------------------------------------------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; gap: .75rem; height: var(--header-h); }
.site-header__inner > .icon-btn { flex: none; }

.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none; font-weight: 750; font-size: 1.1rem; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.brand__mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: conic-gradient(from 200deg, #ff4d6d, #ffb347, #ffe66d, #4cd97b, #3fb6ff, #7a5cff, #ff4d6d);
    box-shadow: inset 0 0 0 6px var(--surface), inset 0 0 0 7px var(--border);
}

.site-nav { margin-left: auto; }
.site-nav__list { display: flex; align-items: center; gap: .25rem; list-style: none; margin: 0; padding: 0; }
.site-nav__link, .menu > summary {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .45rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 550;
    font-size: .95rem;
    text-decoration: none;
    cursor: pointer;
    list-style: none;
    white-space: nowrap;
}
.menu > summary::-webkit-details-marker { display: none; }
.site-nav__link:hover, .menu > summary:hover, .menu[open] > summary { background: var(--surface-2); color: var(--text); }
.menu { position: relative; }
.menu[open] > summary .icon { transform: rotate(180deg); }
.menu__panel {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 250px;
    margin: 0;
    padding: .4rem;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.menu__panel a { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: .95rem; }
.menu__panel a:hover, .menu__panel a[aria-current] { background: var(--surface-2); }
.menu__panel .icon { color: var(--primary); }
.menu__all { margin-top: .25rem; padding-top: .25rem; border-top: 1px solid var(--border); }
.menu__all a { color: var(--primary); font-weight: 600; font-size: .875rem; }
.menu__all .icon { margin-left: auto; }

/* "All tools": a wide panel with every tool, grouped by category. It overlays the page, so opening it moves nothing. */
.menu--mega { position: static; }
.mega {
    position: absolute;
    top: calc(100% + 1px);
    left: 50%;
    width: min(calc(var(--container) - 32px), calc(100vw - 32px));
    max-height: calc(100dvh - var(--header-h) - 24px);
    overflow-y: auto;
    padding: 1.25rem 1.25rem 1rem;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.mega__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1.25rem 1rem; }
.mega__title { display: flex; align-items: center; gap: .5rem; margin-bottom: .35rem; padding: .25rem .6rem; border-radius: var(--radius-sm); color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.mega__title:hover { color: var(--text); background: var(--surface-2); }
.mega__title .icon { color: var(--primary); }
.mega ul { margin: 0; padding: 0; list-style: none; }
.mega li a { display: flex; align-items: center; gap: .6rem; padding: .4rem .6rem; border-radius: var(--radius-sm); color: var(--text); font-size: .925rem; line-height: 1.3; text-decoration: none; }
.mega li a:hover, .mega li a[aria-current] { background: var(--surface-2); }
.mega li .icon { flex: none; color: var(--primary); }
.mega__all { display: flex; align-items: center; justify-content: center; gap: .4rem; margin-top: 1rem; padding: .6rem; border-top: 1px solid var(--border); color: var(--primary); font-size: .9rem; font-weight: 600; text-decoration: none; }
.mega__all:hover { text-decoration: underline; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.nav-toggle { display: none; margin-left: auto; }
.theme-toggle__sun { display: none; }
:root[data-theme="dark"] .theme-toggle__sun { display: block; }
:root[data-theme="dark"] .theme-toggle__moon { display: none; }

@media (min-width: 1024px) and (max-width: 1180px) {
    /* Six menus and the brand only just fit here: tighten them so the header never overflows. */
    .site-nav__list { gap: 0; }
    .site-nav__link, .menu > summary { padding-inline: .5rem; }
}
@media (max-width: 1023px) {
    .nav-toggle { display: inline-grid; }
    .site-nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        max-height: calc(100dvh - var(--header-h));
        overflow-y: auto;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-lg);
        padding: .5rem 16px 1rem;
        display: none;
    }
    .site-nav.is-open { display: block; }
    .site-nav__list { flex-direction: column; align-items: stretch; }
    .menu > summary, .site-nav__link { width: 100%; justify-content: space-between; padding: .75rem .5rem; }
    .menu__panel { position: static; box-shadow: none; border: 0; padding: 0 0 .5rem .5rem; min-width: 0; }
    .mega { position: static; width: auto; max-height: none; overflow: visible; padding: .25rem 0 .75rem .5rem; transform: none; border: 0; border-radius: 0; box-shadow: none; }
    .mega__grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .75rem 1rem; }
    .mega__all { justify-content: flex-start; margin-top: .5rem; padding: .6rem; }
    .theme-toggle { margin-left: 0; }
}

.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding: 3rem 0 1.5rem; font-size: .95rem; }
.site-footer__grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.site-footer__about { max-width: 300px; }
.site-footer__about p { color: var(--muted); margin-top: .75rem; }
.site-footer__title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .75rem; }
.site-footer__title a { color: inherit; text-decoration: none; }
.site-footer__title a:hover { color: var(--text); }
.directory__group h2 a { color: inherit; text-decoration: none; }
.directory__group h2 a:hover { color: var(--primary); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--primary); text-decoration: underline; }
.site-footer__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); color: var(--muted); }
.site-footer__bottom p { margin: 0; }
.site-footer__links { display: flex !important; flex-wrap: wrap; gap: 1.25rem !important; }
.link-btn { border: 0; background: none; padding: 0; color: var(--text-2); font: inherit; cursor: pointer; }
.link-btn:hover { color: var(--primary); text-decoration: underline; }
.link-btn[data-armed="true"] { color: var(--danger); font-weight: 600; }

/* 5. Components ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    min-height: 40px;
    padding: .5rem 1rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: .95rem;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: var(--on-primary); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { min-height: 34px; padding: .35rem .75rem; font-size: .875rem; }
.btn--block { width: 100%; }
.btn[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .85rem; }
.card__title { display: flex; align-items: center; gap: .5rem; font-size: 1rem; margin: 0; }
.card__title .icon { color: var(--primary); }
.card > .card__title { margin-bottom: .75rem; }

.input, .select {
    width: 100%;
    min-height: 42px;
    padding: .5rem .75rem;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
}
.input:focus, .select:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
.input[aria-invalid="true"] { border-color: var(--danger); background: var(--danger-soft); }
textarea.input { resize: vertical; min-height: 120px; }
.select { appearance: none; padding-right: 2.25rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .6rem center; background-size: 1.1rem; }
.select--sm { width: auto; min-height: 34px; padding-top: .3rem; padding-bottom: .3rem; font-size: .875rem; }

.field { display: grid; gap: .35rem; margin-bottom: 1rem; }
.field > label, .label { font-weight: 600; font-size: .9rem; }
.field__error { color: var(--danger); font-size: .875rem; margin: 0; }
.field__hint { color: var(--muted); font-size: .85rem; margin: 0; }
.form__row--2 { display: grid; gap: 0 1rem; }
@media (min-width: 640px) { .form__row--2 { grid-template-columns: 1fr 1fr; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.contact-email { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1rem; }
.contact-email p { margin: 0; }

.range { display: grid; gap: .25rem; }
.range__top { display: flex; justify-content: space-between; align-items: baseline; font-size: .875rem; }
/* A steady width keeps the value from nudging sideways as the script fills it in or it changes length. */
.range__top output, .range__top .range__value { min-width: 4ch; font-family: var(--mono); color: var(--text-2); text-align: right; }
input[type="range"] { width: 100%; accent-color: var(--primary); margin: .25rem 0; height: 24px; }

.check { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); flex-wrap: wrap; }
.segmented button, .segmented label { border: 0; background: transparent; padding: .35rem .75rem; border-radius: 4px; font-size: .875rem; font-weight: 600; color: var(--text-2); cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented [aria-pressed="true"], .segmented input:checked + span, .segmented button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented label:has(input:focus-visible) { outline: 2px solid var(--focus); }

.color-field {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}
.color-field:focus-within { outline: 2px solid var(--focus); outline-offset: -1px; }
.color-field input[type="color"] {
    width: 46px;
    min-height: 42px;
    padding: 0;
    border: 0;
    border-right: 1px solid var(--border);
    background: var(--checker);
    cursor: pointer;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; }
.color-field input[type="color"]::-moz-color-swatch { border: 0; }
.color-field input[type="text"] { flex: 1; min-width: 0; border: 0; padding: .5rem .75rem; background: transparent; font-family: var(--mono); text-transform: uppercase; outline: none; }
.color-field input[type="text"][aria-invalid="true"] { background: var(--danger-soft); color: var(--danger); }

.notice { display: flex; gap: .75rem; align-items: flex-start; padding: .9rem 1rem; border-radius: var(--radius); border: 1px solid; margin-bottom: 1rem; }
.notice--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success); }
.notice--error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.notice--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning); }
.notice--info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); color: var(--text); }

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 200;
    transform: translate(-50%, 20px);
    max-width: calc(100vw - 32px);
    padding: .65rem 1rem;
    border-radius: 999px;
    background: #15181e;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.toast[data-type="error"] { background: #b42323; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.breadcrumbs { padding-top: 1rem; font-size: .875rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0; padding: 0; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: .35rem; color: var(--border-strong); }
.breadcrumbs a { color: var(--muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--primary); text-decoration: underline; }

/* Color formats list */
.formats { display: grid; gap: .35rem; }
.format {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    align-items: center;
    gap: .5rem;
    width: 100%;
    padding: .45rem .6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    text-align: left;
    transition: border-color .15s, background-color .15s;
}
.format:hover { border-color: var(--primary); background: var(--primary-soft); }
.format--primary { border-color: var(--border-strong); }
.format__label { font-size: .75rem; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.format__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.format__icon { color: var(--muted); }
.format:hover .format__icon { color: var(--primary); }

/* Swatches */
.swatch {
    --c: #000;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 88px;
    padding: .5rem .6rem;
    border: 0;
    border-radius: var(--radius);
    background: linear-gradient(var(--c), var(--c)), var(--checker);
    text-align: left;
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%);
    transition: transform .15s;
}
.swatch:hover { transform: translateY(-2px); }
.swatch__hex { font-family: var(--mono); font-weight: 700; font-size: .85rem; }
.swatch__sub { font-size: .75rem; opacity: .85; }
.swatch-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.swatch-strip { display: flex; border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.swatch-strip .swatch { flex: 1 1 0; border-radius: 0; min-width: 0; min-height: 120px; }
.swatch-strip .swatch:hover { transform: none; filter: brightness(1.05); }

/* History */
.history__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 6px; }
.history__swatch { aspect-ratio: 1; border: 0; border-radius: 6px; background: linear-gradient(var(--c), var(--c)), var(--checker); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); transition: transform .12s; }
.history__swatch:hover { transform: scale(1.12); }
.history__empty { font-size: .875rem; margin: 0; }

.related { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; }
.related a { display: flex; align-items: center; gap: .6rem; padding: .5rem .5rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-weight: 550; }
.related a:hover { background: var(--surface-2); }
.related .icon { color: var(--primary); }

.code-output {
    width: 100%;
    min-height: 140px;
    padding: .75rem;
    margin-bottom: .75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text);
    line-height: 1.5;
    resize: vertical;
    white-space: pre;
    overflow: auto;
}

/* Tool cards & directory */
.tool-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.tool-card {
    display: flex;
    gap: .85rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tool-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--text); }
.tool-card__icon { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.tool-card__icon--image { background: #ffe9ef; color: #d6336c; }
.tool-card__icon--color { background: #e7f5ff; color: #1c7ed6; }
.tool-card__icon--design { background: #f3f0ff; color: #7048e8; }
.tool-card__icon--util { background: #e6fcf5; color: #0c8f6a; }
.tool-card__icon--edit { background: #fff4e6; color: #e8590c; }
:root[data-theme="dark"] .tool-card__icon { background: var(--surface-2); }
.tool-card__name { display: block; font-weight: 700; margin-bottom: .15rem; }
.tool-card__desc { display: -webkit-box; color: var(--muted); font-size: .9rem; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.directory { margin-top: 4rem; }
.directory__group { margin: 2rem 0; }
.directory__group h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.features { list-style: none; margin: 3rem 0 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.features li { display: flex; gap: .85rem; padding: 1.1rem; border-radius: var(--radius-lg); background: var(--surface-2); }
.features .icon { width: 28px; height: 28px; color: var(--primary); }
.features strong { display: block; }
.features span { color: var(--muted); font-size: .92rem; }

/* Prose */
.prose { max-width: 75ch; font-size: 1.125rem; }
.prose h2 { margin-top: 2rem; }
.prose h2:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: .4rem; }
.prose h3 { margin: 1.5rem 0 .5rem; font-size: 1.1em; }
.prose table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.25rem; font-size: .92em; }
.prose th, .prose td { padding: .5rem .65rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose th { font-weight: 700; color: var(--text); background: var(--surface-2); }
.prose td code, .prose li code, .prose p code { font-size: .88em; padding: .1em .35em; border-radius: 4px; background: var(--surface-2); }
.prose pre { margin: 1rem 0 1.25rem; padding: .85rem 1rem; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); line-height: 1.55; }
.table-wrap { overflow-x: auto; }
.feature-list { list-style: none; padding: 0 !important; display: grid; gap: .5rem 1.25rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.feature-list li { display: flex; gap: .55rem; align-items: flex-start; margin: 0; }
.feature-list .icon { flex: none; width: 18px; height: 18px; margin-top: .2rem; color: var(--success); }
.steps { counter-reset: step; list-style: none; padding: 0 !important; }
.steps li { counter-increment: step; position: relative; padding-left: 2.5rem; margin-bottom: .85rem; }
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: -.05rem;
    display: grid;
    place-items: center;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: .875rem;
}
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { padding: .9rem 2rem .9rem 0; font-weight: 650; cursor: pointer; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: .25rem; top: .7rem; font-size: 1.4rem; line-height: 1; color: var(--muted); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--text-2); }

/* Ads */
.ad { margin: 1.5rem 0; text-align: center; min-height: 120px; }
.ad--sidebar { min-height: 600px; }
.ad__label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .25rem; }

/* Dropzone */
.dropzone { position: relative; }
.dropzone__label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    min-height: 260px;
    padding: 2rem 1rem;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    background: var(--surface);
    text-align: center;
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}
.dropzone__label:hover, .dropzone.is-over .dropzone__label { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input:focus-visible + .dropzone__label { outline: 2px solid var(--focus); outline-offset: 2px; }
.dropzone__icon { width: 44px; height: 44px; color: var(--primary); }
.dropzone__text { color: var(--text-2); line-height: 2.2; }
.dropzone__text strong { color: var(--text); }
.dropzone__hint { font-size: .85rem; color: var(--muted); }
.dropzone__error { margin: .75rem 0 0; color: var(--danger); font-weight: 600; }
.dropzone.is-loading .dropzone__label { opacity: .6; cursor: progress; }
.dropzone--compact .dropzone__label { min-height: 0; flex-direction: row; flex-wrap: wrap; padding: .75rem 1rem; gap: .5rem 1rem; }
.dropzone--compact .dropzone__icon { width: 24px; height: 24px; }
.dropzone--compact .dropzone__hint { display: none; }
.dropzone--compact .dropzone__text { line-height: 1.6; font-size: .9rem; }
.dropzone__url { display: flex; gap: .5rem; max-width: 520px; margin: .75rem auto 0; }
.dropzone__url .input { flex: 1; min-width: 0; }
.dropzone--compact .dropzone__url { margin-left: 0; }

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    place-items: center;
    background: color-mix(in srgb, var(--primary) 18%, transparent);
    backdrop-filter: blur(2px);
    pointer-events: none;
}
.drop-overlay > div { display: grid; justify-items: center; gap: .5rem; padding: 2rem 3rem; border: 3px dashed var(--primary); border-radius: var(--radius-lg); background: var(--surface); color: var(--primary); font-weight: 700; font-size: 1.2rem; }
.drop-overlay p { margin: 0; }
body.is-dragging:has([data-dropzone]) .drop-overlay { display: grid; }

/* 6. Tool pages ------------------------------------------------------------ */
.tool { position: relative; }
.tool-layout { display: grid; gap: 1rem; }
.tool-layout > *, .content-grid > *, .stack > *, .panel > * { min-width: 0; }
@media (min-width: 960px) {
    .tool-layout { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
    .tool-layout--wide-panel { grid-template-columns: minmax(0, 1fr) 420px; }
    .tool-layout--even { grid-template-columns: 1fr 1fr; }
    /* Main column, side panel spanning both rows, then extra cards under the main column. */
    .tool-layout--flow { grid-template-areas: "main panel" "extra panel"; grid-template-rows: auto 1fr; }
    .tool-layout--flow > :first-child { grid-area: main; }
    .tool-layout--flow > .panel { grid-area: panel; }
    .tool-layout--flow > :last-child { grid-area: extra; }
}
.panel { display: grid; gap: 1rem; align-content: start; }
.panel .card { padding: 1rem; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; padding: .5rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.toolbar__group { display: flex; align-items: center; gap: .25rem; }
.toolbar__sep { width: 1px; height: 24px; background: var(--border); margin: 0 .25rem; }
.toolbar__spacer { flex: 1; }
.toolbar .icon-btn { width: 36px; height: 36px; }
.toolbar__zoom { min-width: 3.5rem; text-align: center; font-family: var(--mono); font-size: .85rem; color: var(--text-2); }
.toolbar label { font-size: .875rem; color: var(--text-2); }

.viewer { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.stage {
    position: relative;
    height: clamp(320px, 62vh, 640px);
    background: var(--checker);
    overflow: hidden;
    touch-action: none;
    cursor: crosshair;
}
.stage.is-panning { cursor: grabbing; }
.stage.is-precise { cursor: none; } /* the crosshair moves slower than the pointer, so hide the pointer */
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
/* The sample photo printed by the server, placed where the viewer will draw it. */
.stage__sample { position: absolute; inset: 0; width: auto; height: auto; max-width: 96%; max-height: 96%; margin: auto; }
[data-saved-image] [data-sample-img] { visibility: hidden; }
/* Server-printed stand-ins that only hold space until a script fills it. */
.is-placeholder { visibility: hidden; }
/* A status line that keeps its height while empty. */
.reserve-line:empty::before, output:empty::before { content: "\00a0"; }
/* Where the sample is the preview itself, hold the shape of the saved image instead. */
[data-saved-image] [data-sample-img]:not([data-sample-placeholder]) { aspect-ratio: var(--saved-ar); }
/* Images shown at their own size (capped by max-width/max-height) also need the saved width. */
[data-saved-image] .ext-img[data-sample-img] { aspect-ratio: var(--saved-ar); width: min(var(--saved-w), 520px * var(--saved-ar)); }
[data-saved-image] .crop__sample[data-sample-img] { aspect-ratio: var(--saved-ar); width: min(var(--saved-w), min(560px, 65vh) * var(--saved-ar)); }
.stage:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.toolbar__icon-label { display: inline-flex; color: var(--muted); }
.stage__status { position: absolute; left: .5rem; bottom: .5rem; padding: .2rem .5rem; border-radius: 4px; background: rgb(0 0 0 / 65%); color: #fff; font: 12px/1.5 var(--mono); pointer-events: none; }
.stage__status:empty { display: none; }
.viewer__footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; padding: .5rem .75rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); }
.viewer__empty { padding: 1rem; }

.picked { display: grid; grid-template-columns: 88px 1fr auto; gap: .9rem; align-items: center; margin-bottom: .9rem; }
.picked > div { min-width: 0; }
.picked .nudge { margin: 0; grid-template-columns: repeat(3, 28px); grid-template-rows: repeat(2, 28px); }
.picked__swatch { --c: #000; aspect-ratio: 1; border-radius: var(--radius); background: linear-gradient(var(--c), var(--c)), var(--checker); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); }
.picked__hex { font: 700 1.5rem/1.2 var(--mono); margin: 0 0 .2rem; }
.picked__name { color: var(--muted); font-size: .9rem; margin: 0; }
.picked__coords { color: var(--muted); font: .8rem var(--mono); margin: .2rem 0 0; }

.nudge { display: grid; grid-template-columns: repeat(3, 34px); grid-template-rows: repeat(2, 34px); gap: 4px; margin-top: .5rem; }
.nudge button { padding: 0; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); font-size: .9rem; }
.nudge button:hover { background: var(--surface-2); }
.nudge [data-nudge="up"] { grid-column: 2; }
.nudge [data-nudge="left"] { grid-column: 1; grid-row: 2; }
.nudge [data-nudge="down"] { grid-column: 2; grid-row: 2; }
.nudge [data-nudge="right"] { grid-column: 3; grid-row: 2; }

/* 7. Individual tools ------------------------------------------------------ */

/* Extractor */
.preview-img { width: 100%; height: auto; max-height: 520px; object-fit: contain; border-radius: var(--radius); background: var(--checker); }
.palette-strip { display: flex; height: 140px; border-radius: var(--radius-lg); overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); margin-bottom: 1rem; }
.palette-strip button { flex: 1 1 0; min-width: 0; border: 0; padding: .5rem; display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; background: var(--c); text-align: left; transition: flex-grow .2s; overflow: hidden; white-space: nowrap; }
.palette-strip button:hover { flex-grow: 1.6; }
.palette-strip .swatch__hex { font-size: .8rem; }
.palette-list { display: grid; gap: .4rem; }
.palette-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: .6rem; padding: .35rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.palette-item__chip { width: 40px; height: 40px; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%); border: 0; }
.palette-item__codes { display: flex; flex-wrap: wrap; gap: .25rem .75rem; font-size: .85rem; min-width: 0; }
.palette-item__codes button { border: 0; background: none; padding: 0; font-family: var(--mono); color: var(--text); }
.palette-item__codes button:hover { color: var(--primary); text-decoration: underline; }
.palette-item__pct { font: .8rem var(--mono); color: var(--muted); padding-right: .35rem; }
.option-grid { display: grid; gap: .75rem; }

/* 8. Utilities ------------------------------------------------------------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.stack { display: grid; gap: 1rem; }
.stack--sm { gap: .5rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.row--between { justify-content: space-between; }
.mt-1 { margin-top: 1rem; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
}

@media print {
    .site-header, .site-footer, .ad, .sidebar, .drop-overlay { display: none !important; }
}

@media (max-width: 640px) {
    .stage { height: clamp(260px, 48vh, 420px); }
    .toolbar__sep { display: none; }
    .toolbar [data-action="eyedropper"] { display: none; }
    .viewer__footer .muted { display: none; }
}

/* Color picker */
.sv {
    --hue: 210;
    position: relative;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, hsl(var(--hue) 100% 50%));
    cursor: crosshair;
    touch-action: none;
}
.sv__thumb {
    position: absolute;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgb(0 0 0 / 40%), 0 2px 6px rgb(0 0 0 / 30%);
    background: var(--c);
    pointer-events: none;
}
.sv__thumb:not([style]) { visibility: hidden; } /* until the script places it */
.slider { appearance: none; -webkit-appearance: none; height: 16px !important; border-radius: 999px; outline-offset: 4px; }
.slider--hue { background: linear-gradient(to right, red, #ff0, lime, cyan, blue, #f0f, red); }
.slider--alpha { background: linear-gradient(to right, transparent, var(--c-solid, #000)), var(--checker); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 2px 6px rgb(0 0 0 / 30%); cursor: pointer; }
.slider::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 2px 6px rgb(0 0 0 / 30%); cursor: pointer; }
.channel { display: grid; grid-template-columns: 1.5rem 1fr 4.5rem; align-items: center; gap: .6rem; margin-bottom: .4rem; }
.channel label { font-weight: 700; font-size: .85rem; color: var(--muted); }
.channel .input { min-height: 34px; padding: .25rem .5rem; font-family: var(--mono); }
.mini-scale { display: grid; grid-template-columns: repeat(11, 1fr); border-radius: var(--radius-sm); overflow: hidden; margin-top: .75rem; }
.mini-scale button { aspect-ratio: 1; border: 0; background: var(--c); }
.mini-scale button:hover { transform: scale(1.15); position: relative; z-index: 1; box-shadow: var(--shadow); }

/* Converter */
.converter { display: grid; gap: .6rem; }
.converter__row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 40px; align-items: center; gap: .6rem; }
.converter__row label { font-weight: 650; font-size: .9rem; }
@media (max-width: 480px) { .converter__row { grid-template-columns: minmax(0, 1fr) 40px; } .converter__row label { grid-column: 1 / -1; margin-bottom: -.4rem; } }
.big-preview { --c: #000; display: grid; place-items: center; height: 180px; border-radius: var(--radius); background: linear-gradient(var(--c), var(--c)), var(--checker); font: 700 1.4rem var(--mono); margin-bottom: 1rem; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .4rem 1rem; margin: 0; font-size: .9rem; }
.facts dt { color: var(--muted); white-space: nowrap; }
.facts dd { margin: 0; min-width: 0; font-family: var(--mono); text-align: right; overflow-wrap: anywhere; }
.code-inline { padding: .35rem .6rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: .85rem; overflow-wrap: anywhere; }

/* Random colors & palettes */
.random-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; }
.color-tile { --c: #000; position: relative; display: flex; flex-direction: column; justify-content: flex-end; min-height: 220px; padding: .75rem; border-radius: var(--radius-lg); background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.color-tile__hex { border: 0; background: none; padding: 0; color: inherit; font: 700 1.1rem var(--mono); text-align: left; cursor: pointer; }
.color-tile__sub { font-size: .8rem; opacity: .85; font-family: var(--mono); }
.color-tile__actions { position: absolute; top: .5rem; right: .5rem; display: flex; gap: .25rem; }
.color-tile__actions button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: rgb(255 255 255 / 22%); color: inherit; }
.color-tile__actions button:hover { background: rgb(255 255 255 / 40%); }
.color-tile__actions [aria-pressed="true"] { background: rgb(255 255 255 / 55%); }

/* Complementary & palette */
.pair { display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--radius-lg); overflow: hidden; }
.pair .swatch { min-height: 160px; border-radius: 0; }
.demo { --bg: #000; --fg: #fff; --accent: #f00; padding: 1.5rem; border-radius: var(--radius-lg); background: var(--bg); color: var(--fg); }
.demo h3 { margin-bottom: .35rem; }
.demo__btn { display: inline-block; padding: .55rem 1.1rem; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-fg, #fff); font-weight: 700; }
.wheel { position: relative; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, #fff 0, transparent 62%), conic-gradient(from 90deg, red, #ff0, lime, cyan, blue, #f0f, red); }
.wheel--ryb { background: radial-gradient(circle, #fff 0, transparent 62%), conic-gradient(from 90deg, #fe2712, #fb9902, #fefe33, #66b032, #0247fe, #8601af, #fe2712); }
.wheel__dot { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; border: 3px solid #fff; background: var(--c); box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 2px 6px rgb(0 0 0 / 30%); }
.wheel__dot--base { width: 32px; height: 32px; margin: -16px 0 0 -16px; }
.palette-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .5rem; }
.btn--primary kbd { background: transparent; color: inherit; border-color: currentColor; opacity: .8; }

/* Gradient */
.gradient-preview { height: clamp(220px, 40vh, 380px); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.stop-bar { position: relative; height: 36px; border-radius: var(--radius-sm); cursor: copy; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); margin: 0 12px 14px; touch-action: none; }
.stop-bar::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--checker); }
.stop { position: absolute; top: 50%; width: 24px; height: 44px; margin-left: -12px; transform: translateY(-50%); border: 3px solid #fff; border-radius: 6px; background: var(--c); box-shadow: 0 0 0 1px rgb(0 0 0 / 40%), var(--shadow); cursor: grab; padding: 0; }
.stop[aria-pressed="true"] { outline: 3px solid var(--primary); outline-offset: 1px; z-index: 1; }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .5rem; }
.presets button { aspect-ratio: 1; border: 0; border-radius: var(--radius); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.presets button:hover { transform: scale(1.06); }
.grad-stage { display: grid; min-height: clamp(220px, 40vh, 380px); border-radius: var(--radius-lg); }
.grad-stage > [hidden] { display: none; }
.grad-text, .grad-buttons { place-self: stretch; display: grid; place-items: center; border-radius: var(--radius-lg); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }
.grad-text { margin: 0; padding: 1rem; font: 900 clamp(2.5rem, 8vw, 5.5rem)/1 var(--font); letter-spacing: -.04em; text-align: center; -webkit-background-clip: text; background-clip: text; color: transparent; }
.grad-buttons { display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 1rem; padding: 1.5rem; }
.grad-btn { display: inline-block; padding: .9rem 1.75rem; border-radius: 999px; color: #fff; font-weight: 800; font-size: 1.05rem; box-shadow: 0 8px 24px rgb(0 0 0 / 18%); }
.grad-btn--outline { border: 3px solid; border-radius: 0; background: var(--surface); box-shadow: none; }
.grad-btn--outline span { -webkit-background-clip: text; background-clip: text; color: transparent; }
.grad-stop-edit { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(90px, .5fr) minmax(0, 1fr); gap: .75rem; align-items: end; }
.grad-dirs { display: grid; grid-template-columns: repeat(8, 1fr); gap: .25rem; margin-top: .5rem; }
.grad-dirs button { padding: .3rem 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: 1rem; line-height: 1.2; }
.grad-dirs button:hover { border-color: var(--primary); color: var(--text); }
.grad-dirs [aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); }
.grad-saved { position: relative; display: grid; }
.grad-saved__del { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-2); opacity: 0; transition: opacity .12s; }
.grad-saved__del svg { width: 12px; height: 12px; }
.grad-saved:hover .grad-saved__del, .grad-saved__del:focus-visible { opacity: 1; }
@media (hover: none) { .grad-saved__del { opacity: 1; } }
[data-stop-alpha] { background: linear-gradient(to right, transparent, var(--c-solid, #000)), var(--checker); border-radius: 99px; }
@media (max-width: 600px) { .grad-stop-edit { grid-template-columns: 1fr 1fr; } .grad-stop-edit > :first-child { grid-column: 1 / -1; } }

/* Box shadow */
.shadow-stage { display: grid; place-items: center; min-height: clamp(280px, 46vh, 420px); border-radius: var(--radius-lg); background: var(--stage-bg, #f1f3f6); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 6%); padding: 2rem; }
.shadow-box { display: grid; place-items: center; width: min(240px, 60%); aspect-ratio: 1; background: #fff; border-radius: 16px; transition: width .2s, aspect-ratio .2s; }
.shadow-box[data-box-shape="card"] { width: min(340px, 80%); aspect-ratio: 4 / 3; place-items: end start; padding: 1.25rem; }
.shadow-box[data-box-shape="button"] { width: auto; aspect-ratio: auto; padding: 1rem 2.25rem; }
.shadow-box__text { font-weight: 800; font-size: 1.1rem; color: rgb(0 0 0 / 70%); }
.shadow-box__text:empty { display: none; }
.layer-tabs .is-hidden { opacity: .5; text-decoration: line-through; }
.shadow-saved { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .6rem; }
.shadow-saved__item { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.shadow-saved__box { width: 50%; aspect-ratio: 1; border: 0; padding: 0; cursor: pointer; }
.shadow-saved__del { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-2); opacity: 0; }
.shadow-saved__del svg { width: 12px; height: 12px; }
.shadow-saved__item:hover .shadow-saved__del, .shadow-saved__del:focus-visible { opacity: 1; }
@media (hover: none) { .shadow-saved__del { opacity: 1; } }
.layer-tabs { display: flex; flex-wrap: wrap; gap: .35rem; }
.layer-tabs button { padding: .35rem .75rem; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-size: .85rem; font-weight: 600; }
.layer-tabs [aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Contrast checker */
.ratio { display: flex; align-items: baseline; gap: .75rem; padding: 1rem 1.25rem; border-radius: var(--radius-lg); background: var(--surface-2); }
.ratio__value { font: 800 2.75rem/1 var(--font); letter-spacing: -.03em; }
.ratio__label { font-weight: 700; }
.ratio[data-level="fail"] .ratio__label { color: var(--danger); }
.ratio[data-level="aa"] .ratio__label, .ratio[data-level="aaa"] .ratio__label { color: var(--success); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.checks li { display: grid; grid-template-columns: 1fr auto auto; gap: .75rem; align-items: center; padding: .55rem .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .925rem; }
.checks .muted { font-size: .8rem; }
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.badge--pass { background: var(--success-soft); color: var(--success); }
.badge--fail { background: var(--danger-soft); color: var(--danger); }
.suggest { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.suggest button { display: flex; align-items: center; gap: .5rem; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: left; font-size: .85rem; }
.suggest button:hover { border-color: var(--primary); }
.suggest i { width: 28px; height: 28px; border-radius: 6px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); flex: none; }
.contrast-preview { --fg: #000; --bg: #fff; padding: 1.75rem; border-radius: var(--radius-lg); background: var(--bg); color: var(--fg); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.contrast-preview__large { font-size: 24px; font-weight: 700; }
.contrast-preview__btn { padding: .55rem 1.1rem; border-radius: var(--radius-sm); background: var(--fg); color: var(--bg); font-weight: 700; }
.contrast-preview__input { padding: .5rem .9rem; border: 2px solid var(--fg); border-radius: var(--radius-sm); }

/* Tailwind palette */
.tw-scale { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.tw-scale .swatch { min-height: 110px; }
.tw-scale .swatch__step { font-weight: 800; font-size: .95rem; margin-bottom: auto; }

/* Tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: .6rem .75rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table td.mono, .table .mono { font-family: var(--mono); }
.table__file { display: flex; align-items: center; gap: .6rem; max-width: 280px; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; }
button.table__file:hover span { color: var(--primary); text-decoration: underline; }
.table__file img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; background: var(--checker); flex: none; }
.table__file span { overflow: hidden; text-overflow: ellipsis; }
.meta-groups { display: grid; gap: 1rem; }
.meta-groups .facts dd { text-align: left; overflow-wrap: anywhere; }
.meta-groups .facts { grid-template-columns: minmax(120px, 34%) minmax(0, 1fr); }
.meta-groups .facts dt { white-space: normal; }

/* Pixel inspector */
.pixel-grid { --n: 7; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; padding: 2px; border-radius: var(--radius-sm); background: var(--border); }
.pixel-grid button { aspect-ratio: 1; border: 0; padding: 0; background: linear-gradient(var(--c), var(--c)), var(--checker); font: 600 9px var(--mono); overflow: hidden; }
.pixel-grid button[aria-selected="true"] { outline: 3px solid var(--primary); outline-offset: -1px; z-index: 1; }
.pixel-grid button:disabled { background: var(--surface-2); cursor: default; }
.b64-thumb { width: 96px; height: 96px; object-fit: contain; border-radius: var(--radius-sm); background: var(--checker); }
.segmented [role="tab"][aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* Floating magnifier that follows the pointer */
.floater { --c: #000; position: absolute; left: 0; top: 0; z-index: 2; display: grid; justify-items: center; gap: 6px; pointer-events: none; will-change: transform; }
.floater canvas { position: static; box-sizing: content-box; width: 171px; height: 171px; border-radius: var(--radius); border: 3px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 10px 28px rgb(0 0 0 / 35%); background: var(--checker); image-rendering: pixelated; }
.floater span { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem .2rem .3rem; border-radius: var(--radius-sm); background: rgb(0 0 0 / 78%); color: #fff; font: 600 12px/1.5 var(--mono); white-space: nowrap; }
.floater i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); box-shadow: 0 0 0 1px rgb(255 255 255 / 60%); }
.floater b { font-weight: 600; }
/* Magnifier docked in a corner of the image; it moves to the other corner when the pointer comes near. */
.dock { --c: #000; position: absolute; top: .6rem; right: .6rem; z-index: 2; display: grid; justify-items: center; gap: 6px; pointer-events: none; }
.dock--left { right: auto; left: .6rem; }
.dock canvas { position: static; box-sizing: content-box; width: 143px; height: 143px; border-radius: var(--radius); border: 3px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / 35%), 0 10px 28px rgb(0 0 0 / 35%); background: var(--checker); image-rendering: pixelated; }
.dock span { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .6rem .2rem .3rem; border-radius: var(--radius-sm); background: rgb(0 0 0 / 78%); color: #fff; font: 600 12px/1.5 var(--mono); white-space: nowrap; }
.dock i { width: 14px; height: 14px; border-radius: 4px; background: var(--c); box-shadow: 0 0 0 1px rgb(255 255 255 / 60%); }
.dock b { font-weight: 600; }
@media (max-width: 640px) { .dock canvas { width: 99px; height: 99px; } }
.palette-strip--sm { height: 84px; margin-bottom: .6rem; }
.picker-extras { gap: 1rem; align-items: start; }
.palette-strip--sm { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; height: auto; background: none; box-shadow: none; overflow: visible; }
.palette-strip--sm button { min-height: 52px; border-radius: 6px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%); }
.palette-strip--sm button:hover { flex-grow: 0; transform: translateY(-2px); }
.palette-strip--sm .swatch__hex { font-size: .72rem; }

/* ---------- Image editing and analysis tools ---------- */
.toolbar--plain { padding: 0; border: 0; background: none; }
.toolbar .segmented label span, .segmented label > span { display: inline-flex; align-items: center; gap: .35rem; }

.compare { position: relative; width: 100%; max-height: 640px; margin-inline: auto; border-radius: var(--radius); overflow: hidden; background: var(--checker); user-select: none; touch-action: pan-y; cursor: ew-resize; }
.compare canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.compare canvas:nth-of-type(2) { clip-path: inset(0 0 0 var(--pos)); }
.compare__sample { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.compare__sample--sim { filter: url(#cvd-sample-filter); clip-path: inset(0 0 0 var(--pos)); }
.compare__line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .35); pointer-events: none; }
.compare__knob { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 34px; height: 34px; transform: translate(-50%, -50%); border-radius: 50%; background: #fff; color: #111; box-shadow: var(--shadow-sm); }
.compare__tag { position: absolute; top: .5rem; padding: .15rem .5rem; border-radius: 99px; background: rgb(0 0 0 / .6); color: #fff; font-size: .75rem; font-weight: 600; pointer-events: none; }
.compare__tag--left { left: .5rem; }
.compare__tag--right { right: .5rem; }
.compare__range { position: absolute; left: 0; bottom: 0; width: 100%; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.compare.is-dragging .compare__knob { transform: translate(-50%, -50%) scale(1.12); }
.compare:has(.compare__range:focus-visible) .compare__knob { outline: 3px solid var(--focus); }

.cvd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.cvd-grid__item { margin: 0; }
.cvd-grid__item canvas { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); background: var(--checker); }
.cvd-grid__item figcaption { margin-top: .35rem; font-size: .85rem; font-weight: 600; color: var(--text-2); }

.avg-frame { --c: transparent; position: relative; border-radius: var(--radius); background: var(--c); }
.avg-frame .preview-img { transition: opacity .4s; }
.avg-frame.is-placeholder .preview-img { opacity: 0; }
.avg-results { display: grid; gap: .25rem; }
.avg-result { margin-bottom: .5rem; grid-template-columns: 72px 1fr; }
.avg-result .picked__swatch { border: 0; cursor: pointer; }
.avg-result__label { margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.avg-result__hex { display: block; border: 0; background: none; padding: 0; color: var(--text); cursor: pointer; font-size: 1.25rem; }
.avg-result__codes { display: flex; flex-wrap: wrap; gap: .1rem .75rem; }
.avg-result__codes button { border: 0; background: none; padding: 0; color: var(--text-2); font: .8rem var(--mono); cursor: pointer; }
.avg-result__codes button:hover, .avg-result__hex:hover { color: var(--primary); }
.avg-result--placeholder .avg-result__hex, .avg-result--placeholder .avg-result__codes, .avg-result--placeholder .picked__name { visibility: hidden; }
.avg-result--placeholder .avg-result__codes span { font: .8rem var(--mono); }

.input--sm { width: auto; min-height: 34px; padding-top: .3rem; padding-bottom: .3rem; font-size: .875rem; }
.names-find { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; }
.names-preview { margin: 0; height: 150px; font-family: var(--font); }
.names-sub { margin: 0 0 .5rem; font-size: .9rem; color: var(--text-2); }
.names-matches { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.names-match { display: flex; align-items: center; gap: .75rem; padding: .4rem; border-radius: var(--radius-sm); }
.names-match:first-child { background: var(--surface-2); }
.names-match__pair { display: flex; flex: none; width: 52px; height: 36px; border-radius: 6px; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%); }
.names-match__pair span { flex: 1; }
.names-match__text { flex: 1; min-width: 0; display: grid; }
.names-match__name { justify-self: start; border: 0; background: none; padding: 0; color: var(--text); font-weight: 700; cursor: pointer; }
.names-match__meta { font-size: .8rem; color: var(--muted); }
.names-match__meta button { border: 0; background: none; padding: 0; color: inherit; font-family: var(--mono); cursor: pointer; }
.names-match__name:hover, .names-match__meta button:hover { color: var(--primary); }
.names-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.names-tile { display: flex; flex-direction: column; justify-content: flex-end; min-height: 96px; padding: .6rem; border-radius: var(--radius-sm); background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.names-tile button { border: 0; background: none; padding: 0; color: inherit; text-align: left; cursor: pointer; }
.names-tile__name { font-weight: 700; font-size: .9rem; overflow-wrap: anywhere; }
.names-tile__hex, .names-tile__rgb { font: .75rem var(--mono); opacity: .85; }
.names-tile button:hover { text-decoration: underline; }
@media (max-width: 720px) { .names-find { grid-template-columns: 1fr; } }

.hist { position: relative; height: 280px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; touch-action: pan-y; }
.hist canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hist__tip { position: absolute; top: .4rem; transform: translateX(-50%); padding: .15rem .5rem; border-radius: 4px; background: var(--text); color: var(--surface); font: .75rem var(--mono); white-space: nowrap; pointer-events: none; }
.hist__axis { display: flex; justify-content: space-between; margin-top: -.5rem; font-size: .75rem; color: var(--muted); }
.hist__axis { background: linear-gradient(90deg, #000, #fff) bottom / 100% 6px no-repeat; padding-bottom: 10px; }
.hist__thumb, .meta-thumb { max-height: 240px; }
.hist__notes { display: grid; gap: .5rem; margin-top: 1rem; }
.hist__notes .notice { margin: 0; }

.small { font-size: .8rem; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.compare img:nth-of-type(2) { clip-path: inset(0 0 0 var(--pos)); }
.segmented .is-disabled { opacity: .45; cursor: not-allowed; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.file-list__item { display: flex; align-items: center; gap: .75rem; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.file-list__item:hover { background: var(--surface-2); }
.file-list__item.is-selected { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.file-list__thumb { flex: none; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--checker); }
.file-list__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.file-list__info { flex: 1; min-width: 0; display: grid; }
.file-list__name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list__status { font-size: .8rem; color: var(--text-2); }
.file-list__delta { font-weight: 700; }
.file-list__delta--good { color: var(--success); }
.file-list__delta--bad { color: var(--danger); }
.icon-btn--sm { width: 30px; height: 30px; font-size: 1.1rem; }
@media (max-width: 520px) { .file-list__item { flex-wrap: wrap; } .file-list__info { flex-basis: calc(100% - 60px); } }

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button { padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text-2); font-size: .85rem; font-weight: 600; cursor: pointer; }
.chips button:hover { border-color: var(--primary); color: var(--text); }
.chips [aria-checked="true"], .chips [aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.crop { position: relative; display: flex; justify-content: center; min-height: 120px; user-select: none; }
.crop canvas { display: block; background: var(--checker); }
/* Until the script draws the canvas, the sample photo stands in at the same size. */
.crop__sample { display: block; width: min(var(--sample-w), min(560px, 65vh) * var(--sample-ar)); max-width: 100%; height: auto; }
.crop:has(> .crop__sample) :is(canvas, .crop__box) { display: none; }
.crop__box { position: absolute; box-shadow: 0 0 0 9999px rgb(0 0 0 / .5); outline: 1px solid #fff; cursor: move; touch-action: none; }
.crop { overflow: hidden; }
.crop__box:focus-visible { outline: 3px solid var(--focus); }
.crop__box--circle { border-radius: 50%; }
.crop__grid { position: absolute; inset: 0; pointer-events: none; background:
    linear-gradient(90deg, transparent calc(33.33% - .5px), rgb(255 255 255 / .5) 0 calc(33.33% + .5px), transparent 0 calc(66.66% - .5px), rgb(255 255 255 / .5) 0 calc(66.66% + .5px), transparent 0),
    linear-gradient(transparent calc(33.33% - .5px), rgb(255 255 255 / .5) 0 calc(33.33% + .5px), transparent 0 calc(66.66% - .5px), rgb(255 255 255 / .5) 0 calc(66.66% + .5px), transparent 0); }
.crop__handle { position: absolute; width: 22px; height: 22px; border: 3px solid #fff; touch-action: none; }
.crop__handle::after { content: ""; position: absolute; inset: -10px; }
.crop__handle[data-handle="nw"] { left: -3px; top: -3px; border-right: 0; border-bottom: 0; cursor: nwse-resize; }
.crop__handle[data-handle="ne"] { right: -3px; top: -3px; border-left: 0; border-bottom: 0; cursor: nesw-resize; }
.crop__handle[data-handle="sw"] { left: -3px; bottom: -3px; border-right: 0; border-top: 0; cursor: nesw-resize; }
.crop__handle[data-handle="se"] { right: -3px; bottom: -3px; border-left: 0; border-top: 0; cursor: nwse-resize; }
.icon-btn--mirror .icon { transform: scaleX(-1); }
.icon-btn--turn .icon { transform: rotate(90deg); }
.resize-dims { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; align-items: end; }
.resize-dims .field { margin-bottom: 0; }
.resize-lock { margin-bottom: 4px; }

.filter-stage { position: relative; cursor: pointer; user-select: none; -webkit-touch-callout: none; }
.filter-stage img { pointer-events: none; }
.filter-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.filter-preset { display: grid; gap: .25rem; padding: .3rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: .8rem; font-weight: 600; cursor: pointer; }
.filter-preset img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.filter-preset:hover { border-color: var(--primary); }
.filter-preset[aria-checked="true"] { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); color: var(--text); }
.filter-preset-wrap { position: relative; display: grid; }
.filter-preset__del { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-2); opacity: 0; }
.filter-preset__del svg { width: 12px; height: 12px; }
.filter-preset-wrap:hover .filter-preset__del, .filter-preset__del:focus-visible { opacity: 1; }
@media (hover: none) { .filter-preset__del { opacity: 1; } }
.code-output--wrap { white-space: pre-wrap; min-height: 0; }

.tab-mock { display: grid; gap: .5rem; }
.tab-mock__bar { display: flex; padding: .5rem .75rem 0; border-radius: var(--radius-sm); }
.tab-mock__bar--light { background: #dee1e6; }
.tab-mock__bar--dark { background: #202124; }
.tab-mock__tab { display: flex; align-items: center; gap: .5rem; width: min(240px, 100%); padding: .55rem .75rem; border-radius: 8px 8px 0 0; font-size: .8rem; }
.tab-mock__bar--light .tab-mock__tab { background: #fff; color: #202124; }
.tab-mock__bar--dark .tab-mock__tab { background: #35363a; color: #e8eaed; }
.tab-mock__tab canvas { width: 16px; height: 16px; flex: none; }
.tab-mock__tab span:nth-of-type(1) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab-mock__x { opacity: .6; }
.fav-sizes { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem; }
.fav-size { display: grid; justify-items: center; gap: .25rem; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--checker); color: var(--text); font-size: .75rem; font-weight: 600; cursor: pointer; }
.fav-size span { padding: 0 .3rem; border-radius: 4px; background: var(--surface); }
.fav-size__name { font-weight: 400; color: var(--muted); font-size: .7rem; }
.fav-size:hover { border-color: var(--primary); }
.names-controls { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 1rem; }
.names-controls .input { flex: 1 1 200px; min-width: 0; }

/* ---------- Palette generator ---------- */
.slider--track { background: var(--track, var(--surface-2)); }
.pg { display: grid; gap: 1rem; }
.pg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }
.pg-bar__group { display: flex; gap: .25rem; }
.pg-bar__main { display: flex; gap: .5rem; flex: 1 1 320px; justify-content: center; }
.pg-bar__main .select { width: auto; min-width: 200px; }
.pg-stage { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.pg-strip { display: flex; height: 120px; border-radius: var(--radius); overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.pg-strip__item { flex: 1; border: 0; padding: 0; cursor: pointer; transition: flex-grow .2s; }
.pg-strip__item.is-selected { flex-grow: 1.35; }
.pg-colors { --circle: min(104px, calc((100% / var(--n)) - 1.5rem)); list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: .25rem; }
.pg-color { position: relative; display: grid; justify-items: center; align-content: start; gap: .35rem; padding-bottom: 3rem; }
.pg-color__swatch { position: relative; width: min(104px, 88%); aspect-ratio: 1; border-radius: 50%; border: 0; padding: 0; background: var(--c); box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--border); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.pg-color__swatch:hover { transform: scale(1.04); }
.pg-color.is-selected .pg-color__swatch { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--text); }
.pg-color__lock { position: absolute; inset: 0; display: grid; place-items: center; opacity: .9; }
.pg-color__hex { width: 100%; max-width: 110px; border: 1px solid transparent; border-radius: 6px; background: none; color: var(--text); font: 700 .85rem var(--mono); text-align: center; padding: .2rem; text-transform: uppercase; }
.pg-color__hex:hover { border-color: var(--border); }
.pg-color__hex:focus { border-color: var(--primary); outline: none; background: var(--surface-2); }
.pg-color__name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; color: var(--muted); }
.pg-color__picker { position: absolute; top: 40px; left: 50%; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pg-color__actions { position: absolute; bottom: 0; left: 50%; display: none; gap: .1rem; padding: .2rem; transform: translateX(-50%); border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-sm); white-space: nowrap; z-index: 2; }
.pg-color.is-first .pg-color__actions { left: 0; transform: none; }
.pg-color.is-last .pg-color__actions { left: auto; right: 0; transform: none; }
.pg-color.is-selected .pg-color__actions { display: flex; }
.pg-color__actions [aria-pressed="true"] { color: var(--primary); background: var(--primary-soft); }
@media (hover: hover) and (pointer: fine) and (min-width: 721px) {
    /* With a mouse, pointing at a color shows its tools; the selected color keeps them the rest of the time. */
    .pg-color:is(:hover, :has(:focus-visible), .is-dragging) .pg-color__actions { display: flex; animation: pg-tools-in .12s ease-out; }
    .pg-colors:has(.pg-color:hover, :focus-visible) .pg-color.is-selected:not(:hover, :has(:focus-visible)) .pg-color__actions { display: none; }
}
@keyframes pg-tools-in { from { opacity: 0; translate: 0 4px; } }
.pg-color__drag { cursor: grab; touch-action: none; }
.pg-color.is-dragging { z-index: 5; opacity: .85; pointer-events: none; }
.pg-color.is-dragging .pg-color__drag { pointer-events: auto; cursor: grabbing; }
.pg-color.is-drop-target .pg-color__swatch { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--primary); }
.pg-insert { position: absolute; top: calc(min(104px, 88%) / 2); right: 0; display: grid; place-items: center; width: 30px; height: 30px; transform: translate(50%, -50%); border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--muted); opacity: 0; cursor: pointer; transition: opacity .15s; z-index: 1; }
.pg-colors:hover .pg-insert, .pg-insert:focus-visible { opacity: 1; }
.pg-insert:hover { color: var(--primary); border-color: var(--primary); }
.pg-insert .icon { width: 16px; height: 16px; }
.pg-color:last-child .pg-insert { transform: translate(0, -50%); }
@media (hover: none) { .pg-insert { opacity: 1; } }
.pg-sub { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pg-count { display: inline-flex; align-items: center; gap: .25rem; padding: 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.pg-count output { min-width: 4.5rem; text-align: center; font-size: .875rem; font-weight: 600; }
.pg-hint { margin-left: auto; font-size: .75rem; color: var(--muted); }
.pg-hint kbd { font-size: .7rem; }
.pg-panel { margin: 0; }
.pg-adjust { display: grid; gap: .5rem 1.5rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pg-lower { display: grid; gap: 1rem; margin-top: 1rem; }
@media (min-width: 960px) { .pg-lower { grid-template-columns: minmax(0, 1fr) 420px; align-items: start; } }
.pg-details { display: grid; gap: 1rem; grid-template-columns: minmax(0, 200px) minmax(0, 1fr); }
.pg-details__preview { --c: #000; display: grid; align-content: end; gap: .1rem; min-height: 160px; padding: .9rem; border-radius: var(--radius); background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.pg-details__preview span:first-child { font: 700 1.25rem var(--mono); }
.pg-details__preview span:last-child { font-size: .85rem; opacity: .85; }
.pg-hsl { display: grid; gap: .35rem; }
.pg-contrast-badges { display: grid; gap: .4rem; grid-template-columns: 1fr 1fr; }
.pg-cbadge { display: grid; gap: .1rem; padding: .5rem .6rem; border-radius: var(--radius-sm); font-size: .75rem; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); }
.pg-cbadge strong { font-size: 1.25rem; line-height: 1; }
.pg-cbadge .badge { justify-self: start; }
.pg-variations { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); height: 44px; border-radius: var(--radius-sm); overflow: hidden; }
/* A saved palette is being restored: hide the starter palette's details until the script draws the real ones. */
.is-restoring :is([data-details-preview] span, [data-details-title], [data-hsl-out], .pg-cbadge > *, .format__value, .pg-color__name) { visibility: hidden; }
.is-restoring :is([data-details-preview], .pg-cbadge, .pg-var) { background: var(--surface-2) !important; }
.pg-spare { display: none; }
/* Same height as the icon buttons, so the row wraps to the same height whether or not the eyedropper shows. */
.cp-actions > .btn { min-height: 40px; }
/* Favicon generator with a saved image: shown in image mode from the first paint (see the inline script). */
.is-image-source [data-source-image] { display: block !important; }
.is-image-source [data-source-text] { display: none !important; }
.is-pending :is(.pg-strip__item, .pg-color__swatch) { background: var(--surface-2) !important; --c: var(--surface-2); }
.is-pending .pg-color__hex { visibility: hidden; }
.pg-var { border: 0; padding: 0; cursor: pointer; }
.pg-var:hover { transform: scaleY(1.12); }
.pg-var.is-current { box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #000; }
.pg-save-form { display: flex; gap: .5rem; }
.pg-save-form .input { flex: 1; min-width: 0; }
.pg-saved { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .4rem; max-height: 360px; overflow: auto; }
.pg-saved__item { display: flex; align-items: center; gap: .6rem; padding: .35rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pg-saved__strip { display: flex; flex: none; width: 120px; height: 36px; padding: 0; border: 0; border-radius: 6px; overflow: hidden; cursor: pointer; }
.pg-saved__strip span { flex: 1; }
.pg-saved__meta { flex: 1; min-width: 0; display: grid; }
.pg-saved__name { font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pg-preview__toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .75rem; }
.pg-preview__toolbar .segmented button { border: 0; background: none; }
.mock { border-radius: var(--radius); overflow: hidden; background: var(--bg); color: var(--fg); box-shadow: inset 0 0 0 1px var(--line); font-size: .9rem; }
.mock__nav { display: flex; align-items: center; gap: 1rem; padding: .8rem 1.25rem; border-bottom: 1px solid var(--line); }
.mock__logo { display: flex; align-items: center; gap: .4rem; font-weight: 800; }
.mock__logo i { width: 18px; height: 18px; border-radius: 5px; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.mock__links { display: flex; gap: 1rem; margin-left: auto; color: var(--muted); }
.mock__btn { display: inline-flex; padding: .55rem 1rem; border-radius: 8px; background: var(--primary); color: var(--on-primary); font-weight: 700; }
.mock__btn--sm { padding: .35rem .75rem; font-size: .8rem; background: var(--fg); color: var(--bg); }
.mock__btn--ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--line); }
.mock__hero { display: grid; gap: 1.5rem; padding: 2rem 1.25rem; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: center; }
.mock__eyebrow { display: inline-block; padding: .15rem .55rem; border-radius: 99px; background: var(--secondary); color: var(--on-secondary); font-size: .75rem; font-weight: 700; }
.mock__title { margin: .6rem 0 .4rem; font-size: 1.6rem; font-weight: 800; line-height: 1.15; }
.mock__text { margin: 0; color: var(--muted); }
.mock__actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
.mock__chart { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding: 1rem; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.mock__chart span { flex: 1; border-radius: 4px 4px 0 0; }
.mock__cards { display: grid; gap: 1rem; padding: 0 1.25rem 1.5rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mock__card { padding: 1rem; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.mock__icon { display: block; width: 32px; height: 32px; border-radius: 9px; }
.mock__card-title { margin: .6rem 0 .2rem; font-weight: 700; }
.pg-cg { border-collapse: separate; border-spacing: 4px; width: 100%; font-size: .8rem; }
.pg-cg th { font: 600 .75rem var(--mono); color: var(--text-2); white-space: nowrap; text-align: left; }
.pg-cg thead th { text-align: center; }
.pg-cg__chip { display: inline-block; width: 12px; height: 12px; margin-right: .35rem; border-radius: 3px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 15%); }
.pg-cg td { min-width: 64px; padding: .45rem .3rem; border-radius: 6px; text-align: center; line-height: 1.2; }
.pg-cg td strong { display: block; font-size: 1rem; }
.pg-cg td span { display: block; font-family: var(--mono); }
.pg-cg td em { display: block; font-style: normal; font-weight: 700; font-size: .7rem; }
.pg-cg__same { background: var(--surface-2); color: var(--muted); }

@media (max-width: 720px) {
    .pg-bar__label { display: none; }
    .pg-bar__main { order: 3; flex-basis: 100%; }
    .pg-bar__main .select { flex: 1; min-width: 0; }
    .pg-stage { padding: .75rem; }
    .pg-strip { height: 56px; }
    .pg-colors { grid-template-columns: 1fr; gap: 0; margin-top: .75rem; }
    .pg-color { grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-rows: auto auto; justify-items: start; align-items: center; column-gap: .75rem; row-gap: 0; padding: .5rem 0; border-bottom: 1px solid var(--border); }
    .pg-color__swatch { grid-row: span 2; width: 48px; }
    .pg-color__hex { text-align: left; max-width: 120px; padding-left: 0; }
    .pg-color__name { grid-column: 2; }
    .pg-color__actions, .pg-color.is-first .pg-color__actions, .pg-color.is-last .pg-color__actions { position: static; display: flex; grid-column: 3; grid-row: 1 / span 2; transform: none; border: 0; box-shadow: none; background: none; padding: 0; }
    .pg-color:not(.is-selected) .pg-color__actions [data-item-action="copy"], .pg-color:not(.is-selected) .pg-color__actions [data-item-action="edit"], .pg-color:not(.is-selected) .pg-color__actions [data-item-action="remove"] { display: none; }
    .pg-insert, .pg-color:last-child .pg-insert { top: auto; bottom: 0; right: auto; left: 24px; width: 26px; height: 26px; transform: translate(-50%, 50%); opacity: 1; }
    .pg-hint { display: none; }
    .pg-details { grid-template-columns: 1fr; }
    .pg-details-actions span { display: none; }
    .pg-details__preview { min-height: 110px; }
    .mock__hero, .mock__cards { grid-template-columns: 1fr; }
    .mock__links { display: none; }
}
.pg-lower .names-sub { margin-top: 1rem; }

/* Shared: "use in" links, contrast tiles, picked colors */
.use-in { display: flex; flex-wrap: wrap; gap: .25rem .75rem; margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--border); font-size: .85rem; }
.use-in__label { color: var(--muted); }
.use-in a { color: var(--primary); text-decoration: none; font-weight: 600; }
.use-in a:hover { text-decoration: underline; }
.picked-contrast { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; margin-bottom: .75rem; }
.cbadge { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .45rem; padding: .4rem .55rem; border-radius: var(--radius-sm); font-size: .75rem; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%); }
.cbadge strong { font-size: 1.05rem; }
.cbadge .badge { margin-left: auto; font-size: .7rem; padding: .05rem .4rem; }
.picker-settings { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .75rem; }
.picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: .35rem; }
.pick { position: relative; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%); }
.pick__main { display: grid; align-content: end; width: 100%; min-height: 56px; padding: .3rem; border: 0; background: none; color: inherit; font: 600 .68rem var(--mono); text-align: left; cursor: pointer; }
.pick__remove { position: absolute; top: 2px; right: 2px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; background: rgb(0 0 0 / .45); color: #fff; font-size: .9rem; line-height: 1; opacity: 0; cursor: pointer; }
.pick:hover .pick__remove, .pick:focus-within .pick__remove { opacity: 1; }
@media (hover: none) { .pick__remove { opacity: 1; } }

/* Image color extractor */
.ext-frame { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; cursor: crosshair; touch-action: none; user-select: none; }
.ext-img { display: block; max-width: 100%; max-height: 520px; width: auto; height: auto; border-radius: var(--radius); background: var(--checker); }
/* The frame is as wide as its image, so a percentage here would be circular: max-width does the clamping. */
.ext-img[data-sample-img] { width: min(var(--sample-w), 520px * var(--sample-ar)); }
.ext-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; border-radius: var(--radius); }
.ext-marker { position: absolute; display: grid; place-items: center; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgb(0 0 0 / .4), 0 2px 6px rgb(0 0 0 / .3); color: #fff; font: 700 .65rem var(--font); text-shadow: 0 0 2px #000; }
.ext-area { position: absolute; border: 2px dashed #fff; outline: 1px solid rgb(0 0 0 / .5); box-shadow: 0 0 0 9999px rgb(0 0 0 / .35); }
.ext-area--live { box-shadow: none; }
.palette-item--removable { grid-template-columns: 40px minmax(0, 1fr) auto auto; }
.palette-item__name { font-size: .75rem; color: var(--muted); }
.palette-item--placeholder > :not(.palette-item__chip), .palette-item--placeholder button { visibility: hidden; }

/* Color picker extras */
.harmony-row { display: flex; gap: .4rem; }
.harmony-row button { flex: 1; min-width: 0; min-height: 76px; display: grid; align-content: end; padding: .4rem; border: 0; border-radius: var(--radius-sm); background: var(--c); font: 600 .7rem var(--mono); text-align: left; overflow: hidden; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%); cursor: pointer; }
.harmony-row button:hover { transform: translateY(-2px); }
.harmony-row [aria-current="true"] { outline: 3px solid var(--primary); outline-offset: 2px; }
.scale-rows { display: grid; gap: .5rem; }
.scale-row { display: grid; grid-template-columns: 3.75rem minmax(0, 1fr); align-items: center; gap: .5rem; }
.scale-row__label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.scale-row .mini-scale { margin-top: 0; grid-template-columns: repeat(10, 1fr); }
.mini-scale button { cursor: pointer; }
.cvd-swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.cvd-swatch { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.cvd-swatch i { flex: none; width: 38px; height: 38px; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 10%); }
.cvd-swatch span { display: grid; min-width: 0; font-size: .8rem; }
.cvd-swatch code { color: var(--muted); font-size: .75rem; }

/* Contrast checker extras */
.cc-colors { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .75rem; align-items: start; }
.cc-color .field { margin-bottom: .5rem; }
.cc-swap { margin-top: 1.75rem; }
.apca { margin: 0; padding: .55rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9rem; cursor: help; }
.cc-controls__row { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 1rem; align-items: end; }
.cc-controls__row .check { padding-bottom: .55rem; }
.cc-controls__row .field { margin: 0; }
.cc-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; margin-top: .75rem; font-size: .9rem; }
.cc-verdict__item { display: inline-flex; align-items: center; gap: .35rem; font-weight: 600; }
.contrast-preview__sample { margin-top: 0; font-size: 18px; line-height: 1.3; outline: none; border-radius: 4px; }
.contrast-preview__sample:focus-visible { box-shadow: 0 0 0 2px var(--fg); }
.contrast-preview__outline { padding: .5rem 1rem; border: 2px solid var(--fg); border-radius: var(--radius-sm); font-weight: 700; }
.contrast-preview__link { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; }
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.pair { position: relative; display: grid; }
.pair__main { display: grid; gap: .1rem; justify-items: start; padding: .55rem .65rem; border: 0; border-radius: var(--radius-sm); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); font: 600 .75rem var(--mono); text-align: left; cursor: pointer; }
.pair__main strong { font: 800 1.25rem/1 var(--font); }
.pair__remove { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 22px; height: 22px; padding: 0; border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text-2); opacity: 0; }
.pair__remove svg { width: 12px; height: 12px; }
.pair:hover .pair__remove, .pair__remove:focus-visible { opacity: 1; }
@media (hover: none) { .pair__remove { opacity: 1; } }
@media (max-width: 560px) {
    .cc-colors { grid-template-columns: minmax(0, 1fr); }
    .cc-swap { margin: 0 auto; transform: rotate(90deg); }
    .cc-controls__row { grid-template-columns: 1fr auto; }
    .cc-controls__row .field { grid-column: 1 / -1; }
}

/* Color mixer */
.mix-list { display: grid; gap: .5rem; }
.mix-row { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(0, 1.2fr) auto; gap: .75rem; align-items: center; }
.mix-row__amount { display: grid; grid-template-columns: minmax(0, 1fr) 3rem; align-items: center; gap: .5rem; }
.mix-row__amount output { font: 600 .85rem var(--mono); text-align: right; color: var(--text-2); }
.mix-saved { display: grid; gap: .4rem; }
.mix-saved__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem; align-items: center; }
.mix-saved__main { display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); text-align: left; cursor: pointer; min-width: 0; }
.mix-saved__main:hover { border-color: var(--primary); }
.mix-saved__main i { width: 22px; height: 22px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); flex: none; }
.mix-saved__inputs { display: flex; gap: 2px; }
.mix-saved__inputs i { width: 16px; }
.mix-saved__eq { color: var(--muted); font-weight: 700; }
.mix-saved__main code { font-size: .8rem; }
@media (max-width: 560px) { .mix-row { grid-template-columns: minmax(0, 1fr) auto; } .mix-row__amount { grid-column: 1 / -1; grid-row: 2; } }

/* Full-size image dialog */
[data-lightbox], [data-sim] { cursor: zoom-in; }
.lightbox { width: min(96vw, 1400px); max-width: none; max-height: 94vh; padding: 0; border: 0; border-radius: var(--radius); background: var(--surface); color: var(--text); box-shadow: 0 30px 80px rgb(0 0 0 / 45%); overflow: hidden; }
.lightbox::backdrop { background: rgb(10 12 16 / 72%); }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox__bar { display: flex; align-items: center; gap: .5rem; padding: .5rem .5rem .5rem 1rem; border-bottom: 1px solid var(--border); }
.lightbox__caption { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; color: var(--muted); }
.lightbox__stage { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; background: var(--checker); }
.lightbox__stage img { display: block; max-width: 100%; max-height: calc(94vh - 56px); object-fit: contain; cursor: zoom-in; }
.lightbox.is-actual .lightbox__stage { place-items: start; }
.lightbox.is-actual .lightbox__stage img { max-width: none; max-height: none; cursor: zoom-out; }
