/* ============================================================
   CSS Color Scheme Editor - stylesheet (rebuilt 2026-10-05)
   Everything is scoped under .cce / .cce-*; the shared header, footer,
   FAQ and related-tools pills come from styles/custom_styles.css,
   which loads first. Blue accent, single colours for titles and icons,
   no 4px side borders. Dark mode via [data-theme="dark"], light default.
   ============================================================ */

.cce {
    --cce-accent: #3399cc;
    --cce-accent-strong: #237a9f;
    --cce-accent-soft: rgba(51, 153, 204, 0.10);
    --cce-accent-line: rgba(51, 153, 204, 0.45);
    --cce-go: #237a9f;
    --cce-go-hover: #1b6183;
    --cce-card: var(--bg-elevated, #fff);
    --cce-sunk: var(--card-tertiary, #f1f5f9);
    --cce-open: var(--card-secondary, #f8fafc);
    --cce-line: var(--border-color, #e2e8f0);
    --cce-text-1: var(--text-primary, #1e293b);
    --cce-text-2: var(--text-secondary, #555);
    --cce-muted: var(--text-muted, #64748b);
    --cce-checker: #e5e7eb;
    --cce-checker-bg: #fff;
    --cce-warn: #b45309;
    --cce-red: #c23b3b;
    --cce-input: var(--input-bg, #fff);
    --cce-ed-bg: #fbfdff;
    --cce-ed-gutter: #f1f5f9;
    --cce-ed-text: #1e293b;
    --cce-hl: rgba(255, 213, 79, 0.45);
    --cce-hl-line: rgba(217, 160, 0, 0.55);
    --cce-hl-cur: rgba(255, 179, 0, 0.6);
}
[data-theme="dark"] .cce {
    --cce-accent: #5bb8e0;
    --cce-accent-strong: #7cc8ea;
    --cce-accent-soft: rgba(91, 184, 224, 0.13);
    --cce-accent-line: rgba(91, 184, 224, 0.5);
    --cce-go: #3399cc;
    --cce-go-hover: #5bb8e0;
    --cce-sunk: #172033;
    --cce-open: #1a2438;
    --cce-checker: #334155;
    --cce-checker-bg: #1e293b;
    --cce-warn: #fbbf24;
    --cce-red: #f87171;
    --cce-ed-bg: #0f172a;
    --cce-ed-gutter: #111c31;
    --cce-ed-text: #e2e8f0;
    --cce-hl: rgba(250, 204, 21, 0.28);
    --cce-hl-line: rgba(250, 204, 21, 0.55);
    --cce-hl-cur: rgba(250, 204, 21, 0.45);
}

.cce.tool-container { max-width: 1160px; margin: 0 auto; padding: 2rem; }
.cce [hidden] { display: none !important; }
.cce button { font: inherit; width: auto; }
.cce .faq-question { width: 100%; }

/* ---------- title ---------- */
.cce .tool-header { text-align: center; margin-bottom: 1.75rem; }
.cce .tool-title-row { display: flex; align-items: center; justify-content: center; gap: 0.9rem; margin-bottom: 0.9rem; }
.cce .cce-title-icon {
    width: 56px; height: 56px; border-radius: 16px;
    background: var(--cce-accent); color: #fff;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
[data-theme="dark"] .cce .cce-title-icon { color: #0f172a; }
.cce .cce-title-icon svg { width: 30px; height: 30px; display: block; }
.cce .tool-title { margin: 0; font-size: 2rem; font-weight: 700; color: var(--cce-accent); line-height: 1.2; }
.cce .tool-description { max-width: 800px; margin: 0 auto; font-size: 1.05rem; line-height: 1.65; color: var(--cce-text-2); }
.cce .tool-description a { color: var(--cce-accent-strong); font-weight: 500; }

/* ---------- error ---------- */
.cce .cce-error {
    display: flex; align-items: flex-start; gap: 0.7rem;
    margin: 0 0 1rem; padding: 0.9rem 1rem; border-radius: 12px;
    border: 1px solid rgba(230, 78, 78, 0.35); background: rgba(230, 78, 78, 0.08);
    color: var(--cce-text-1);
}
.cce .cce-error > svg { width: 20px; height: 20px; color: #e64e4e; flex-shrink: 0; margin-top: 2px; }
.cce .cce-error > div { flex: 1; min-width: 0; }
.cce .cce-error p { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--cce-text-1); }
.cce .cce-error p + p { margin-top: 0.3rem; color: var(--cce-muted); }
.cce .cce-error a { color: var(--cce-red); font-weight: 600; }

/* ---------- shared bits ---------- */
.cce .cce-checker {
    background-color: var(--cce-checker-bg);
    background-image:
        linear-gradient(45deg, var(--cce-checker) 25%, transparent 25%),
        linear-gradient(-45deg, var(--cce-checker) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--cce-checker) 75%),
        linear-gradient(-45deg, transparent 75%, var(--cce-checker) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.cce .cce-card {
    background: var(--cce-card); border: 1px solid var(--cce-line);
    border-radius: 16px; padding: 1rem 1.1rem; min-width: 0;
}
.cce .cce-card + .cce-card,
.cce .cce-col-side > * + * { margin-top: 0.875rem; }
.cce .cce-card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.cce .cce-h { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--cce-text-1); }
.cce .cce-h svg { width: 17px; height: 17px; color: var(--cce-accent); }
.cce .cce-chip,
.cce .cce-adv-value {
    display: inline-flex; align-items: center; padding: 0.12rem 0.5rem; border-radius: 999px;
    background: var(--cce-accent-soft); color: var(--cce-accent-strong);
    font-size: 0.75rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.cce .cce-hint { margin: 0.55rem 0 0; font-size: 0.78rem; line-height: 1.5; color: var(--cce-muted); }
.cce .cce-hint-inline { margin: 0; }
.cce .cce-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--cce-text-1); }
.cce .cce-caption {
    display: block; margin: 0.85rem 0 0.4rem;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--cce-muted);
}
.cce .cce-text-btn {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.4rem 0.6rem; border: none; border-radius: 8px; background: none;
    color: var(--cce-accent-strong); font-size: 0.85rem; font-weight: 600; cursor: pointer; flex-shrink: 0;
}
.cce .cce-text-btn:hover { background: var(--cce-accent-soft); }
.cce .cce-text-btn svg { width: 15px; height: 15px; }
.cce .cce-icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; padding: 0; border-radius: 9px;
    border: 1px solid var(--cce-line); background: var(--cce-card); color: var(--cce-text-2);
    cursor: pointer; flex-shrink: 0; transition: border-color .15s, color .15s, background .15s;
}
.cce .cce-icon-btn svg { width: 16px; height: 16px; }
.cce .cce-icon-btn:hover:not(:disabled) { border-color: var(--cce-accent-line); color: var(--cce-accent-strong); }
.cce .cce-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; background: var(--cce-card); }
.cce .cce-error-close { width: 28px; height: 28px; border: none; background: none; }

.cce .cce-input {
    width: 100%; min-width: 0; height: 36px; padding: 0 0.6rem; border-radius: 9px;
    border: 1px solid var(--cce-line); background: var(--cce-input); color: var(--cce-text-1);
    font: 600 0.85rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-sizing: border-box;
}
.cce .cce-input:focus { outline: none; border-color: var(--cce-accent); box-shadow: 0 0 0 3px var(--cce-accent-soft); }
.cce .cce-input.is-bad { border-color: #e64e4e; box-shadow: 0 0 0 3px rgba(230, 78, 78, 0.15); }
.cce .cce-input::placeholder { font-family: inherit; font-weight: 500; color: var(--cce-muted); }

.cce .cce-num {
    display: inline-flex; align-items: center; gap: 0.3rem; height: 36px; padding: 0 0.55rem;
    border: 1px solid var(--cce-line); border-radius: 9px; background: var(--cce-input);
    color: var(--cce-muted); font-size: 0.8rem; box-sizing: border-box; min-width: 0;
}
.cce .cce-num:focus-within { border-color: var(--cce-accent); box-shadow: 0 0 0 3px var(--cce-accent-soft); }
.cce .cce-num b { color: var(--cce-text-1); font-size: 0.75rem; }
.cce .cce-num input {
    width: 100%; min-width: 0; border: none; background: none; padding: 0; margin: 0;
    color: var(--cce-text-1); font: 600 0.88rem/1 inherit; font-variant-numeric: tabular-nums; text-align: right;
    -moz-appearance: textfield; appearance: textfield; box-shadow: none; height: auto;
}
.cce .cce-num input:focus { outline: none; }
.cce .cce-num input::-webkit-outer-spin-button,
.cce .cce-num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.cce .cce-range { width: 100%; accent-color: var(--cce-accent); margin: 0.35rem 0 0; }
.cce .cce-slider-head { display: flex; justify-content: space-between; align-items: baseline; }
.cce .cce-slider-head strong { font-size: 0.82rem; color: var(--cce-accent-strong); font-variant-numeric: tabular-nums; }
.cce .cce-field { margin-top: 0.85rem; }

/* segmented */
.cce .cce-seg {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px;
    padding: 4px; border-radius: 12px; background: var(--cce-sunk); border: 1px solid var(--cce-line);
}
.cce .cce-seg-wrap { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cce .cce-seg button {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
    min-height: 36px; padding: 0.35rem 0.5rem; border: 1px solid transparent; border-radius: 9px;
    background: none; color: var(--cce-text-2); font-size: 0.85rem; font-weight: 600; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cce .cce-seg button svg { width: 16px; height: 16px; flex-shrink: 0; }
.cce .cce-seg button:hover:not(.active) { color: var(--cce-text-1); }
.cce .cce-seg button.active {
    background: var(--cce-card); color: var(--cce-accent-strong); border-color: var(--cce-line);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* buttons */
.cce .cce-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
    min-height: 42px; padding: 0.55rem 1rem; border-radius: 11px; border: 1px solid transparent;
    font-size: 0.92rem; font-weight: 700; cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
}
.cce .cce-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.cce .cce-btn-sm { min-height: 34px; padding: 0.35rem 0.75rem; font-size: 0.84rem; border-radius: 9px; }
.cce .cce-btn-sm svg { width: 15px; height: 15px; }
.cce .cce-btn-primary,
.cce .cce-go { background: var(--cce-go); color: #fff; }
.cce .cce-btn-primary:hover,
.cce .cce-go:hover:not(:disabled) { background: var(--cce-go-hover); color: #fff; }
[data-theme="dark"] .cce .cce-btn-primary,
[data-theme="dark"] .cce .cce-go,
[data-theme="dark"] .cce .cce-go:hover:not(:disabled),
[data-theme="dark"] .cce .cce-btn-primary:hover { color: #0b1220; }
.cce .cce-go:disabled { opacity: 0.5; cursor: not-allowed; background: var(--cce-go); }
.cce .cce-go.is-busy { cursor: progress; }
.cce .cce-btn-secondary { background: var(--cce-card); color: var(--cce-text-1); border-color: var(--cce-line); }
.cce .cce-btn-secondary:hover { border-color: var(--cce-accent-line); color: var(--cce-accent-strong); }
.cce .cce-btn-ghost { background: none; color: var(--cce-text-2); border-color: var(--cce-line); }
.cce .cce-btn-ghost:hover:not(:disabled) { color: var(--cce-accent-strong); border-color: var(--cce-accent-line); background: var(--cce-accent-soft); }
.cce .cce-btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; background: none; }

/* ---------- main layout ---------- */
.cce .cce-main {
    background: var(--cce-card); border: 1px solid var(--cce-line); border-radius: 22px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08)); padding: 1.25rem;
}
.cce .cce-layout {
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1.25rem; align-items: start;
}
.cce .cce-col-main,
.cce .cce-col-side { min-width: 0; }
.cce .cce-main > .cce-layout .cce-card { border-radius: 14px; }
.cce .cce-modes { margin-bottom: 1rem; padding: 5px; max-width: 420px; }
.cce .cce-modes button { min-height: 42px; font-size: 0.92rem; }

/* ---------- code / tabs ---------- */
.cce .cce-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--cce-sunk); border: 1px solid var(--cce-line); }
.cce .cce-tabs button {
    padding: 0.3rem 0.75rem; border: 1px solid transparent; border-radius: 7px; background: none; cursor: pointer;
    color: var(--cce-text-2); font-size: 0.82rem; font-weight: 700;
}
.cce .cce-tabs button.active { background: var(--cce-card); color: var(--cce-accent-strong); border-color: var(--cce-line); }
.cce .cce-code {
    margin: 0; padding: 0.85rem 1rem; border-radius: 11px; max-height: 220px; overflow: auto;
    background: #0f172a; color: #e2e8f0; border: 1px solid #1e293b;
    font: 0.82rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap; word-break: break-word;
}
.cce .cce-code code { font: inherit; color: inherit; background: none; padding: 0; }
.cce .cce-next { margin: 0.5rem 0 0; font-size: 0.82rem; line-height: 1.55; color: var(--cce-text-2); }
.cce .cce-next a,
.cce .cce-info a { color: var(--cce-accent-strong); font-weight: 600; }
/* ---------- swatches ---------- */
.cce .cce-swatch {
    position: relative; display: block; width: 36px; height: 34px; border-radius: 9px; overflow: hidden; cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15); background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}
.cce .cce-swatch-fill { position: absolute; inset: 0; }
.cce .cce-swatch input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: none; padding: 0; }
.cce .cce-swatch-sm { width: 30px; height: 28px; }
/* ---------- collapsed option rows ---------- */
.cce .cce-adv-options { padding: 0; overflow: hidden; }
.cce .cce-adv-row + .cce-adv-row { border-top: 1px solid var(--cce-line); }
.cce .cce-adv-head {
    display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
    width: 100%; min-height: 52px; padding: 0.55rem 1rem; border: none; background: none;
    cursor: pointer; text-align: left; color: var(--cce-text-1); box-sizing: border-box;
}
.cce .cce-adv-head-static { cursor: default; }
.cce .cce-adv-head:hover:not(.cce-adv-head-static) { background: var(--cce-open); }
.cce .cce-adv-left { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.cce .cce-adv-left > svg { width: 18px; height: 18px; color: var(--cce-accent); flex-shrink: 0; }
.cce .cce-adv-text { display: flex; flex-direction: column; min-width: 0; }
.cce .cce-adv-title { font-size: 0.9rem; font-weight: 700; color: var(--cce-text-1); }
.cce .cce-adv-hint { font-size: 0.76rem; color: var(--cce-muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
.cce .cce-adv-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.cce .cce-chevron { width: 17px; height: 17px; color: var(--cce-muted); transition: transform .2s; }
.cce .cce-adv-row.open .cce-chevron { transform: rotate(180deg); }
.cce .cce-adv-row.open .cce-adv-head,
.cce .cce-adv-row.open .cce-adv-body { background: var(--cce-open); }
.cce .cce-adv-body { padding: 0.2rem 1rem 1rem; }
.cce .cce-adv-body > .cce-seg:first-child { margin-top: 0.2rem; }
.cce .cce-grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.cce .cce-grid6 button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
    min-height: 34px; padding: 0.25rem 0.15rem; border-radius: 8px; min-width: 0;
    border: 1px solid var(--cce-line); background: var(--cce-card); color: var(--cce-text-2);
    font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
/* switch */
.cce .cce-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 0.9rem; cursor: pointer; }
.cce .cce-switch-txt { display: flex; flex-direction: column; min-width: 0; }
.cce .cce-switch-txt strong { font-size: 0.85rem; color: var(--cce-text-1); }
.cce .cce-switch-txt small { font-size: 0.76rem; color: var(--cce-muted); line-height: 1.4; }
.cce .cce-switch-wrap { display: inline-flex; align-items: center; gap: 0.45rem; flex-shrink: 0; cursor: pointer; }
.cce .cce-switch-wrap em { font-style: normal; font-size: 0.72rem; font-weight: 800; color: var(--cce-muted); min-width: 26px; letter-spacing: 0.04em; }
.cce .cce-switch-wrap input:checked + em { color: var(--cce-accent-strong); }
input[type="checkbox"].cce-switch,
.tool-container input[type="checkbox"].cce-switch {
    -webkit-appearance: none !important; appearance: none !important;
    position: relative !important; display: inline-block !important;
    width: 40px !important; min-width: 40px !important; max-width: 40px !important; height: 22px !important;
    margin: 0 !important; padding: 0 !important; border: none !important; border-radius: 999px !important;
    background: #cbd5e1 !important; background-color: #cbd5e1 !important; box-shadow: none !important;
    cursor: pointer !important; transition: background-color .2s !important; flex-shrink: 0; vertical-align: middle;
}
[data-theme="dark"] input[type="checkbox"].cce-switch,
[data-theme="dark"] .tool-container input[type="checkbox"].cce-switch { background: #475569 !important; background-color: #475569 !important; }
input[type="checkbox"].cce-switch::after,
.tool-container input[type="checkbox"].cce-switch::after,
.tool-container input[type="checkbox"].cce-switch:checked::after {
    content: '' !important; font-size: 0 !important; position: absolute !important;
    top: 3px !important; left: 3px !important; right: auto !important; bottom: auto !important;
    width: 16px !important; height: 16px !important; border-radius: 50% !important;
    background: #fff !important; box-shadow: 0 1px 2px rgba(0,0,0,.3) !important;
    transform: none !important; transition: transform .2s !important; display: block !important;
}
input[type="checkbox"].cce-switch:checked,
.tool-container input[type="checkbox"].cce-switch:checked { background: var(--cce-go, #237a9f) !important; background-color: var(--cce-go, #237a9f) !important; }
input[type="checkbox"].cce-switch:checked::after,
.tool-container input[type="checkbox"].cce-switch:checked::after { transform: translateX(18px) !important; }
input[type="checkbox"].cce-switch:focus-visible,
.tool-container input[type="checkbox"].cce-switch:focus-visible { outline: 2px solid var(--cce-accent) !important; outline-offset: 2px !important; }
/* guard */
.cce .cce-guard {
    display: flex; align-items: flex-start; gap: 0.55rem; padding: 0.7rem 0.85rem; border-radius: 12px;
    background: var(--cce-accent-soft); border: 1px solid var(--cce-accent-line);
    font-size: 0.82rem; line-height: 1.5; color: var(--cce-text-1);
}
.cce .cce-guard svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 1px; color: var(--cce-accent-strong); }
.cce .cce-guard.is-warn { background: rgba(245, 158, 11, 0.10); border-color: rgba(245, 158, 11, 0.45); }
.cce .cce-guard.is-warn svg { color: var(--cce-warn); }
/* ---------- action bar ---------- */
.cce .cce-actionbar {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid var(--cce-line);
}
.cce .cce-summary { display: flex; flex-direction: column; min-width: 0; }
.cce .cce-summary strong { font-size: 0.95rem; color: var(--cce-text-1); font-variant-numeric: tabular-nums; }
.cce .cce-summary span { font-size: 0.8rem; color: var(--cce-muted); font-variant-numeric: tabular-nums; }
.cce .cce-actionbar-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cce .cce-go { min-width: 170px; }

/* ---------- toast ---------- */
.cce .cce-toast {
    position: fixed; left: 50%; bottom: 24px; z-index: 9500; transform: translate(-50%, 16px);
    padding: 0.7rem 1.1rem; border-radius: 12px; background: #0f172a; color: #f8fafc;
    font-size: 0.88rem; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.cce .cce-toast.show { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .cce .cce-toast { background: #f8fafc; color: #0f172a; }
/* ---------- content ---------- */
.cce .related-tools { margin-top: 2rem; }
.cce .cce-info { display: grid; gap: 1.5rem; margin-top: 2rem; }
.cce .cce-info .info-card {
    background: var(--cce-card); border: 1px solid var(--cce-line); border-radius: 16px;
    padding: 1.6rem 1.75rem; box-shadow: none;
}
.cce .cce-info .info-card h2 { font-size: 1.3rem; margin: 0 0 1rem; }
.cce .cce-info .info-card h2 svg { color: var(--cce-accent); width: 22px; height: 22px; }
.cce .cce-info p { margin: 0.75rem 0 0; line-height: 1.7; color: var(--cce-text-2); }
.cce .cce-steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.cce .cce-steps li { counter-increment: s; position: relative; padding-left: 2.4rem; line-height: 1.6; color: var(--cce-text-2); }
.cce .cce-steps li::before {
    content: counter(s); position: absolute; left: 0; top: 0; width: 1.65rem; height: 1.65rem; border-radius: 50%;
    background: var(--cce-accent); color: #fff; font-size: 0.82rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .cce .cce-steps li::before { color: #0f172a; }
.cce .cce-steps strong,
.cce .cce-list strong { color: var(--cce-text-1); }
.cce .cce-list { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.6rem; line-height: 1.65; color: var(--cce-text-2); }
.cce .cce-table-wrap { overflow-x: auto; border: 1px solid var(--cce-line); border-radius: 12px; }
.cce .cce-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.cce .cce-table th,
.cce .cce-table td { padding: 0.6rem 0.85rem; text-align: left; border-bottom: 1px solid var(--cce-line); color: var(--cce-text-2); }
.cce .cce-table th { background: var(--cce-open); color: var(--cce-text-1); font-weight: 700; }
.cce .cce-table tr:last-child td { border-bottom: none; }

.cce .cce-grid6 button:hover { border-color: var(--cce-accent-line); color: var(--cce-accent-strong); }
.cce .cce-grid6 button.active { border-color: var(--cce-accent); background: var(--cce-accent-soft); color: var(--cce-accent-strong); }
.cce .cce-btn-block { width: 100%; margin-top: 0.75rem; }
.cce .cce-two-btns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; margin-top: 0.6rem; }
.cce .cce-switch-row + .cce-switch-row { margin-top: 0.75rem; }
.cce code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.cce .cce-hint code,
.cce .cce-info code,
.cce .faq-answer code { font-size: 0.85em; padding: 0.05rem 0.3rem; border-radius: 4px; background: var(--cce-sunk); color: var(--cce-text-1); }

/* mode visibility (the JS also sets [hidden], this avoids a flash) */
.cce .cce-main[data-mode="color"] [data-for="css"],
.cce .cce-main[data-mode="css"] [data-for="color"] { display: none !important; }

/* ---------- stylesheet editor ---------- */
.cce .cce-editor-card { padding: 0.75rem; }
.cce .cce-editor-card .cce-card-head { flex-wrap: wrap; margin-bottom: 0.6rem; }
.cce .cce-editor-card .cce-h { min-width: 0; }
.cce .cce-editor-card .cce-h span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.cce .cce-mini-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.cce .cce-editor {
    --cce-lh: 20px;
    position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr);
    height: 560px; border-radius: 11px; overflow: hidden;
    border: 1px solid var(--cce-line); background: var(--cce-ed-bg);
    font: 13px/var(--cce-lh) ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cce .cce-editor.is-drop { border-color: var(--cce-accent); box-shadow: 0 0 0 3px var(--cce-accent-soft); }
.cce .cce-gutter {
    position: relative; overflow: hidden; min-width: 44px; padding: 10px 0;
    background: var(--cce-ed-gutter); border-right: 1px solid var(--cce-line); user-select: none;
}
.cce .cce-gutter-in {
    padding: 0 8px 0 10px; text-align: right; white-space: pre; color: var(--cce-muted);
    font: inherit; line-height: var(--cce-lh); font-variant-numeric: tabular-nums; will-change: transform;
}
.cce .cce-code-wrap { position: relative; min-width: 0; overflow: hidden; }
.cce .cce-backdrop { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.cce .cce-backdrop-in,
.cce .cce-textarea {
    margin: 0; padding: 10px 12px; border: 0; box-sizing: border-box;
    font: inherit; line-height: var(--cce-lh); letter-spacing: 0; tab-size: 4; -moz-tab-size: 4;
    white-space: pre; word-wrap: normal; overflow-wrap: normal;
}
.cce .cce-backdrop-in { color: transparent; will-change: transform; min-width: 100%; width: max-content; }
.cce .cce-backdrop-in mark {
    color: transparent; background: none; border-radius: 3px; padding: 0;
    box-shadow: inset 0 -2px 0 var(--m, transparent);
}
.cce .cce-backdrop-in mark.is-sel { background: var(--cce-hl); box-shadow: inset 0 -2px 0 var(--m, transparent), 0 0 0 1px var(--cce-hl-line); }
.cce .cce-backdrop-in mark.is-cur { background: var(--cce-hl-cur); box-shadow: inset 0 -2px 0 var(--m, transparent), 0 0 0 2px var(--cce-accent); }
.cce .cce-textarea {
    position: relative; display: block; width: 100%; height: 100%; resize: none; outline: none;
    background: transparent; color: var(--cce-ed-text); caret-color: var(--cce-ed-text);
    overflow: auto; border-radius: 0; box-shadow: none;
}
.cce .cce-textarea::placeholder { color: transparent; }
.cce .cce-textarea::selection { background: rgba(51, 153, 204, 0.35); }
.cce .cce-empty {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.6rem; padding: 1.5rem; text-align: center; pointer-events: none; color: var(--cce-muted);
    font-family: inherit;
}
.cce .cce-empty > svg { width: 38px; height: 38px; color: var(--cce-accent); opacity: 0.8; }
.cce .cce-empty p { margin: 0; font: 0.92rem/1.55 system-ui, -apple-system, Segoe UI, sans-serif; color: var(--cce-text-2); }
.cce .cce-empty p strong { color: var(--cce-text-1); }
.cce .cce-empty .cce-btn { pointer-events: auto; font-family: system-ui, -apple-system, Segoe UI, sans-serif; }
.cce .cce-drop {
    position: absolute; inset: 8px; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    border: 2px dashed var(--cce-accent); border-radius: 10px; background: var(--cce-accent-soft);
    color: var(--cce-accent-strong); font: 700 1rem/1 system-ui, -apple-system, Segoe UI, sans-serif; pointer-events: none;
}
.cce .cce-drop svg { width: 20px; height: 20px; }

/* ---------- palette (CSS mode main control) ---------- */
.cce .cce-palette-card .cce-card-head { margin-bottom: 0.6rem; }
.cce .cce-tabs button { width: auto; }
.cce .cce-palette {
    display: grid; gap: 2px; max-height: 300px; overflow-y: auto; margin: 0 -0.35rem; padding: 0 0.35rem;
    scrollbar-width: thin;
}
.cce .cce-pal {
    display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 0.6rem; align-items: center;
    width: 100%; padding: 5px 6px; border: 1px solid transparent; border-radius: 10px;
    background: none; cursor: pointer; text-align: left; color: var(--cce-text-1); min-width: 0;
}
.cce .cce-pal:hover { background: var(--cce-open); }
.cce .cce-pal.is-sel { background: var(--cce-accent-soft); border-color: var(--cce-accent-line); }
.cce .cce-pal:focus-visible { outline: 2px solid var(--cce-accent); outline-offset: -2px; }
.cce .cce-pal-sw {
    position: relative; display: block; width: 30px; height: 30px; border-radius: 8px; overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15); background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}
.cce .cce-pal-sw > span { position: absolute; inset: 0; }
.cce .cce-pal-text { display: flex; flex-direction: column; min-width: 0; }
.cce .cce-pal-val { font: 600 0.84rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cce .cce-pal-sub { font-size: 0.72rem; color: var(--cce-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cce .cce-pal-mini { display: inline-flex; gap: 2px; vertical-align: middle; margin-right: 4px; }
.cce .cce-pal-mini i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.2); }
.cce .cce-palette-empty { margin: 0.25rem 0 0; }
.cce .cce-dupes {
    display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.6rem; padding: 0.45rem 0.4rem 0.45rem 0.7rem;
    border-radius: 10px; background: rgba(245, 158, 11, 0.10); border: 1px solid rgba(245, 158, 11, 0.4);
    font-size: 0.8rem; color: var(--cce-text-1);
}
.cce .cce-dupes > svg { width: 15px; height: 15px; color: var(--cce-warn); flex-shrink: 0; }
.cce .cce-dupes span { flex: 1; min-width: 0; }
.cce .cce-dupes .cce-text-btn { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

/* selected colour */
.cce .cce-sel { margin-top: 0.75rem; padding-top: 0.85rem; border-top: 1px solid var(--cce-line); min-width: 0; }
.cce .cce-sel-head { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; }
.cce .cce-sel-sw {
    position: relative; display: block; width: 44px; height: 44px; border-radius: 11px; overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15); background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}
.cce .cce-sel-sw > span { position: absolute; inset: 0; }
.cce .cce-sel-text { display: flex; flex-direction: column; min-width: 0; }
.cce .cce-sel-text strong { font: 700 0.95rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--cce-text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cce .cce-sel-text span { font-size: 0.78rem; color: var(--cce-muted); }
.cce .cce-sel-nav { display: flex; align-items: center; gap: 0.3rem; }
.cce .cce-sel-nav .cce-icon-btn { width: 30px; height: 30px; }
.cce .cce-sel-nav .cce-chip { min-width: 44px; justify-content: center; }
.cce .cce-variants,
.cce .cce-lines { display: flex; flex-wrap: wrap; gap: 4px; }
.cce .cce-lines { max-height: 74px; overflow-y: auto; }
.cce .cce-pill {
    display: inline-flex; align-items: center; gap: 0.35rem; max-width: 100%; min-width: 0;
    padding: 0.2rem 0.5rem; border-radius: 999px; border: 1px solid var(--cce-line);
    background: var(--cce-card); color: var(--cce-text-1); cursor: pointer;
    font: 600 0.76rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.cce .cce-pill > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cce .cce-pill small { font: 700 0.68rem/1 system-ui, sans-serif; color: var(--cce-muted); flex-shrink: 0; }
.cce .cce-pill:hover { border-color: var(--cce-accent-line); color: var(--cce-accent-strong); }
.cce .cce-pill.active { border-color: var(--cce-accent); background: var(--cce-accent-soft); color: var(--cce-accent-strong); }
.cce .cce-replace { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 6px; align-items: center; }

/* ---------- colour converter ---------- */
.cce .cce-color-top { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1.1rem; align-items: start; }
.cce .cce-big-swatch {
    position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 16px; overflow: hidden; cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12); background-size: 16px 16px;
}
.cce .cce-big-swatch input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: none; padding: 0; }
.cce .cce-big-tag {
    position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 9px; background: rgba(15, 23, 42, 0.55); color: #fff; pointer-events: none;
}
.cce .cce-big-tag svg { width: 16px; height: 16px; }
.cce .cce-color-side { min-width: 0; }
.cce .cce-color-side .cce-label { margin-bottom: 0.4rem; }
.cce .cce-input-lg { height: 44px; font-size: 1rem; padding: 0 0.8rem; }
.cce .cce-contrast { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 0.85rem; }
.cce .cce-ct {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 12px;
    border: 1px solid var(--cce-line); min-width: 0;
}
.cce .cce-ct-white { background: #fff; border-color: #e2e8f0; }
.cce .cce-ct-black { background: #000; border-color: #334155; }
.cce .cce-ct-aa { font: 800 1.55rem/1 system-ui, -apple-system, Segoe UI, sans-serif; flex-shrink: 0; }
.cce .cce-ct-txt { display: flex; flex-direction: column; min-width: 0; }
.cce .cce-ct-txt strong { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.cce .cce-ct-txt small { font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cce .cce-ct-white strong { color: #0f172a; }
.cce .cce-ct-white small { color: #475569; }
.cce .cce-ct-black strong { color: #f8fafc; }
.cce .cce-ct-black small { color: #cbd5e1; }

.cce .cce-formats { display: grid; gap: 4px; margin-top: 1rem; }
.cce .cce-fmt {
    display: grid; grid-template-columns: 92px minmax(0, 1fr) 34px; gap: 0.6rem; align-items: center;
    padding: 4px 4px 4px 10px; border-radius: 10px; background: var(--cce-open); border: 1px solid var(--cce-line);
}
.cce .cce-fmt-label { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cce-muted); }
.cce .cce-fmt-val {
    font: 600 0.88rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--cce-text-1);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: copy; background: none; padding: 0; border-radius: 4px;
}
.cce .cce-fmt-val:focus-visible { outline: 2px solid var(--cce-accent); outline-offset: 2px; }
.cce .cce-fmt .cce-icon-btn { width: 32px; height: 32px; }
.cce .cce-fmt.is-flash { border-color: var(--cce-accent); background: var(--cce-accent-soft); }
.cce .cce-color-card .cce-guard { margin: 0.75rem 0 0; }
.cce .cce-color-card .cce-next { margin-top: 0.85rem; }

/* sliders */
.cce .cce-sliders { display: grid; gap: 0.85rem; }
.cce .cce-sl { min-width: 0; }
.cce .cce-sl .cce-slider-head { align-items: center; margin-bottom: 0.35rem; }
.cce .cce-sl .cce-num { height: 30px; width: 104px; }
.cce .cce-track {
    position: relative; height: 22px; border-radius: 999px; overflow: visible;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12); background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}
.cce .cce-track-fill { position: absolute; inset: 0; border-radius: 999px; }
.cce .cce-track .cce-range {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent;
    -webkit-appearance: none; appearance: none; cursor: pointer;
}
.cce .cce-track .cce-range::-webkit-slider-runnable-track { background: transparent; height: 22px; }
.cce .cce-track .cce-range::-moz-range-track { background: transparent; height: 22px; }
.cce .cce-track .cce-range::-webkit-slider-thumb {
    -webkit-appearance: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%;
    background: transparent; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45), 0 1px 4px rgba(0, 0, 0, 0.35);
}
.cce .cce-track .cce-range::-moz-range-thumb {
    width: 12px; height: 12px; border-radius: 50%; background: transparent;
    border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45), 0 1px 4px rgba(0, 0, 0, 0.35);
}
.cce .cce-track .cce-range:focus-visible { outline: none; }
.cce .cce-track .cce-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--cce-accent), 0 1px 4px rgba(0, 0, 0, 0.35); }

/* shades + recent */
.cce .cce-shades { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 3px; margin-top: 0.2rem; }
.cce .cce-shade {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 2px;
    height: 58px; padding: 0 0 5px; border: 2px solid transparent; border-radius: 8px; cursor: pointer; min-width: 0;
    font: 700 0.6rem/1 system-ui, sans-serif;
}
.cce .cce-shade:hover { transform: translateY(-1px); }
.cce .cce-shade.is-cur { border-color: var(--cce-text-1); }
.cce .cce-shade:focus-visible { outline: 2px solid var(--cce-accent); outline-offset: 1px; }
.cce .cce-recent { display: flex; flex-wrap: wrap; gap: 6px; }
.cce .cce-recent-sw {
    position: relative; width: 34px; height: 34px; padding: 0; border-radius: 9px; overflow: hidden; cursor: pointer;
    border: none; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.18); background-size: 10px 10px;
    background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}
.cce .cce-recent-sw > span { position: absolute; inset: 0; }
.cce .cce-recent-sw:hover { box-shadow: 0 0 0 2px var(--cce-accent); }
.cce #recentClear { margin: 0.6rem 0 0 -0.4rem; }

/* vars */
.cce .cce-vars-opts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 6px; align-items: center; margin-top: 0.2rem; }
.cce .cce-prefix {
    display: inline-flex; align-items: center; height: 40px; padding: 0 0.55rem; border-radius: 9px; min-width: 0;
    border: 1px solid var(--cce-line); background: var(--cce-input); color: var(--cce-muted);
    font: 600 0.85rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; box-sizing: border-box;
}
.cce .cce-prefix:focus-within { border-color: var(--cce-accent); box-shadow: 0 0 0 3px var(--cce-accent-soft); }
.cce .cce-prefix input {
    flex: 1; min-width: 0; width: 100%; border: none; background: none; padding: 0 1px; margin: 0; height: auto; box-shadow: none;
    color: var(--cce-text-1); font: inherit;
}
.cce .cce-prefix input:focus { outline: none; }
.cce .cce-vars-opts .cce-seg button { min-height: 30px; }
.cce #varsOut { margin-top: 0.6rem; max-height: 200px; }
.cce .cce-actionbar-btns[hidden] { display: none !important; }

/* sticky editor on wide screens, rings that show on dark */
@media (min-width: 961px) {
    .cce .cce-col-main { position: sticky; top: 1rem; }
}
[data-theme="dark"] .cce .cce-pal-sw,
[data-theme="dark"] .cce .cce-sel-sw,
[data-theme="dark"] .cce .cce-swatch,
[data-theme="dark"] .cce .cce-recent-sw,
[data-theme="dark"] .cce .cce-big-swatch,
[data-theme="dark"] .cce .cce-track { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); }
[data-theme="dark"] .cce .cce-pal-mini i { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
    .cce .cce-layout { grid-template-columns: minmax(0, 1fr); }
    .cce .cce-editor { height: 440px; }
    .cce .cce-palette { max-height: 260px; }
}
@media (max-width: 600px) {
    .cce.tool-container { padding: 1rem 0.75rem; }
    .cce .tool-title { font-size: 1.6rem; }
    .cce .cce-title-icon { width: 46px; height: 46px; border-radius: 13px; }
    .cce .cce-title-icon svg { width: 24px; height: 24px; }
    .cce .cce-main { padding: 0.75rem; border-radius: 16px; }
    .cce .cce-card { padding: 0.85rem; }
    .cce .cce-modes { max-width: none; }
    .cce .cce-editor { height: 380px; --cce-lh: 19px; font-size: 12px; }
    .cce .cce-mini-actions .cce-btn span { display: none; }
    .cce .cce-mini-actions .cce-btn { padding: 0.35rem 0.55rem; }
    .cce .cce-color-top { grid-template-columns: minmax(0, 1fr); }
    .cce .cce-big-swatch { aspect-ratio: auto; height: 120px; }
    .cce .cce-fmt { grid-template-columns: 74px minmax(0, 1fr) 34px; gap: 0.4rem; }
    .cce .cce-fmt-val { font-size: 0.8rem; white-space: normal; word-break: break-all; }
    .cce .cce-adv-options { padding: 0; }
    .cce .cce-adv-value { max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
    .cce .cce-grid6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .cce .cce-vars-opts { grid-template-columns: minmax(0, 1fr); }
    .cce .cce-shades { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .cce .cce-actionbar { flex-direction: column; align-items: stretch; }
    .cce .cce-actionbar-btns { display: grid; grid-template-columns: 1fr 1fr; }
    .cce .cce-info .info-card { padding: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
    .cce * { transition: none !important; }
}
