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

.acp {
    --acp-accent: #e64e4e;
    --acp-accent-strong: #c23b3b;
    --acp-accent-soft: rgba(230, 78, 78, 0.09);
    --acp-accent-line: rgba(230, 78, 78, 0.42);
    --acp-go: #c23b3b;
    --acp-go-hover: #a83030;
    --acp-card: var(--bg-elevated, #fff);
    --acp-sunk: var(--card-tertiary, #f1f5f9);
    --acp-open: var(--card-secondary, #f8fafc);
    --acp-line: var(--border-color, #e2e8f0);
    --acp-text-1: var(--text-primary, #1e293b);
    --acp-text-2: var(--text-secondary, #555);
    --acp-muted: var(--text-muted, #64748b);
    --acp-checker: #e5e7eb;
    --acp-checker-bg: #fff;
    --acp-ok: #2f855a;
    --acp-mid: #b45309;
    --acp-bad: #c23b3b;
    --acp-input: var(--input-bg, #fff);
}
[data-theme="dark"] .acp {
    --acp-accent: #f07878;
    --acp-accent-strong: #f58b8b;
    --acp-accent-soft: rgba(240, 120, 120, 0.12);
    --acp-accent-line: rgba(240, 120, 120, 0.5);
    --acp-go: #e64e4e;
    --acp-go-hover: #f07878;
    --acp-sunk: #172033;
    --acp-open: #1a2438;
    --acp-checker: #334155;
    --acp-checker-bg: #1e293b;
    --acp-ok: #4ade80;
    --acp-mid: #fbbf24;
    --acp-bad: #f87171;
}

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

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

/* ---------- error ---------- */
.acp .acp-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(--acp-text-1);
}
.acp .acp-error > svg { width: 20px; height: 20px; color: #e64e4e; flex-shrink: 0; margin-top: 2px; }
.acp .acp-error > div { flex: 1; min-width: 0; }
.acp .acp-error p { margin: 0; font-size: 0.9rem; line-height: 1.55; color: var(--acp-text-1); }
.acp .acp-error p + p { margin-top: 0.3rem; color: var(--acp-muted); }
.acp .acp-error a { color: var(--acp-bad); font-weight: 600; }

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

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

/* segmented */
.acp .acp-seg {
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px;
    padding: 4px; border-radius: 12px; background: var(--acp-sunk); border: 1px solid var(--acp-line);
}
.acp .acp-seg-wrap { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.acp .acp-seg-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.acp .acp-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(--acp-text-2); font-size: 0.85rem; font-weight: 600; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.acp .acp-seg button svg { width: 16px; height: 16px; flex-shrink: 0; }
.acp .acp-seg button:hover:not(.active) { color: var(--acp-text-1); }
.acp .acp-seg button.active {
    background: var(--acp-card); color: var(--acp-accent-strong); border-color: var(--acp-line);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.acp .acp-mode { padding: 5px; }
.acp .acp-mode button { min-height: 42px; font-size: 0.92rem; }

/* buttons */
.acp .acp-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;
}
.acp .acp-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.acp .acp-btn-sm { min-height: 34px; padding: 0.35rem 0.75rem; font-size: 0.84rem; border-radius: 9px; }
.acp .acp-btn-sm svg { width: 15px; height: 15px; }
.acp .acp-btn-primary,
.acp .acp-go { background: var(--acp-go); color: #fff; }
.acp .acp-btn-primary:hover,
.acp .acp-go:hover:not(:disabled) { background: var(--acp-go-hover); color: #fff; }
[data-theme="dark"] .acp .acp-btn-primary,
[data-theme="dark"] .acp .acp-go,
[data-theme="dark"] .acp .acp-go:hover:not(:disabled),
[data-theme="dark"] .acp .acp-btn-primary:hover { color: #0b1220; }
.acp .acp-go:disabled { opacity: 0.6; cursor: progress; background: var(--acp-go); }
.acp .acp-btn-secondary { background: var(--acp-card); color: var(--acp-text-1); border-color: var(--acp-line); }
.acp .acp-btn-secondary:hover { border-color: var(--acp-accent-line); color: var(--acp-accent-strong); }
.acp .acp-btn-ghost { background: none; color: var(--acp-text-2); border-color: var(--acp-line); }
.acp .acp-btn-ghost:hover:not(:disabled) { color: var(--acp-accent-strong); border-color: var(--acp-accent-line); background: var(--acp-accent-soft); }

/* ---------- main layout ---------- */
.acp .acp-main {
    background: var(--acp-card); border: 1px solid var(--acp-line); border-radius: 22px;
    box-shadow: var(--shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08)); padding: 1.25rem;
}
.acp .acp-layout {
    display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    gap: 1.25rem; align-items: start;
}
.acp .acp-col-main,
.acp .acp-col-side { min-width: 0; }

/* ---------- source image ---------- */
.acp .acp-source-card { padding: 0.75rem; transition: border-color .15s, box-shadow .15s; }
.acp .acp-source-card.is-drag { border-color: var(--acp-accent); box-shadow: 0 0 0 3px var(--acp-accent-soft); }
.acp .acp-drop {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
    min-height: 230px; padding: 1.5rem 1rem; border-radius: 12px; text-align: center; cursor: pointer;
    border: 2px dashed var(--acp-line); background: var(--acp-open); outline: none;
    transition: border-color .15s, background .15s;
}
.acp .acp-drop:hover,
.acp .acp-drop:focus-visible,
.acp .acp-source-card.is-drag .acp-drop { border-color: var(--acp-accent); background: var(--acp-accent-soft); }
.acp .acp-drop-icon {
    display: flex; align-items: center; justify-content: center; width: 54px; height: 54px; border-radius: 16px;
    background: var(--acp-accent-soft); color: var(--acp-accent); margin-bottom: 0.3rem;
}
.acp .acp-drop-icon svg { width: 28px; height: 28px; }
.acp .acp-drop-title { font-size: 1.1rem; font-weight: 700; color: var(--acp-text-1); }
.acp .acp-drop-sub { font-size: 0.85rem; color: var(--acp-muted); }
.acp .acp-drop-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; margin-top: 0.5rem; }
.acp .acp-drop-chips span {
    padding: 0.1rem 0.45rem; border-radius: 6px; border: 1px solid var(--acp-line); background: var(--acp-card);
    font-size: 0.68rem; font-weight: 700; color: var(--acp-muted); letter-spacing: 0.03em;
}
.acp .acp-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin-top: 0.65rem; }
.acp .acp-samples-label { font-size: 0.8rem; font-weight: 600; color: var(--acp-muted); margin-right: 0.15rem; }
.acp .acp-sample {
    display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.3rem 0.6rem; border-radius: 999px;
    border: 1px solid var(--acp-line); background: var(--acp-card); color: var(--acp-text-2);
    font-size: 0.8rem; font-weight: 600; cursor: pointer;
}
.acp .acp-sample svg { width: 14px; height: 14px; color: var(--acp-accent); }
.acp .acp-sample:hover { border-color: var(--acp-accent-line); color: var(--acp-accent-strong); }
.acp .acp-sample.is-busy { opacity: 0.6; cursor: progress; }
.acp .acp-sample-link {
    display: inline-flex; align-items: center; padding: 0.3rem 0.2rem; margin-left: 0.1rem;
    font-size: 0.8rem !important; font-weight: 600; line-height: 1.2; white-space: nowrap;
    color: var(--acp-accent-strong) !important; text-decoration: none !important;
}
.acp .acp-sample-link:hover { text-decoration: underline !important; }

.acp .acp-photo-frame {
    position: relative; display: flex; align-items: center; justify-content: center;
    border-radius: 10px; background: var(--acp-open); isolation: isolate;
}
.acp .acp-photo-inner { position: relative; max-width: 100%; line-height: 0; border-radius: 8px; }
.acp .acp-photo-inner canvas { display: block; max-width: 100%; max-height: 460px; width: auto; height: auto; cursor: crosshair; border-radius: 8px; }
.acp .acp-markers { position: absolute; inset: 0; pointer-events: none; }
.acp .acp-marker {
    position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0; border-radius: 50%;
    border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45), 0 2px 6px rgba(0, 0, 0, 0.35);
    cursor: pointer; pointer-events: auto; transition: transform .15s;
}
.acp .acp-marker:hover { transform: scale(1.15); }
.acp .acp-marker.is-sel { transform: scale(1.3); box-shadow: 0 0 0 2px var(--acp-accent), 0 2px 8px rgba(0, 0, 0, 0.4); z-index: 2; }
.acp .acp-photo-tag {
    position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.2rem 0.5rem 0.2rem 0.25rem; border-radius: 8px; background: rgba(15, 23, 42, 0.75); color: #fff;
    font: 700 0.75rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; pointer-events: none; z-index: 3;
}
.acp .acp-photo-tag-sw { width: 16px; height: 16px; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5); }
.acp .acp-photo-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-top: 0.55rem; }
.acp .acp-photo-info,
.acp .acp-photo-hint { display: flex; align-items: center; gap: 0.35rem; margin: 0; min-width: 0; }
.acp .acp-photo-info span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-photo-info svg,
.acp .acp-photo-hint svg { width: 14px; height: 14px; flex-shrink: 0; }
.acp .acp-photo-hint { margin-top: 0.2rem; }
.acp .acp-photo-btns { display: flex; gap: 0.1rem; flex-shrink: 0; }

/* ---------- palette strip ---------- */
.acp .acp-mini-actions { display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; justify-content: flex-end; }
.acp .acp-mini-actions .acp-icon-btn { width: 32px; height: 32px; }
.acp .acp-pal-note { margin: -0.35rem 0 0.6rem; }
.acp .acp-strip {
    --cols: 5; --cols-m: 5;
    display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 6px;
}
.acp .acp-sw {
    min-width: 0; border-radius: 12px; border: 2px solid transparent; padding: 2px; cursor: pointer; outline: none;
    transition: border-color .15s;
}
.acp .acp-sw:hover { border-color: var(--acp-line); }
.acp .acp-sw.is-sel { border-color: var(--acp-accent); }
.acp .acp-sw:focus-visible { box-shadow: 0 0 0 3px var(--acp-accent-soft); border-color: var(--acp-accent); }
.acp .acp-sw-color {
    position: relative; height: 132px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.1);
    display: flex; flex-direction: column; justify-content: space-between; padding: 6px; box-sizing: border-box;
}
.acp .acp-sw-aa { font-size: 0.85rem; font-weight: 800; line-height: 1; white-space: nowrap; }
.acp .acp-sw-aa small { font-size: 0.68rem; font-weight: 700; opacity: 0.85; }
.acp .acp-sw-tools { display: flex; gap: 3px; opacity: 0; transition: opacity .15s; }
.acp .acp-strip.is-narrow .acp-sw-btn:not([data-act="lock"]) { display: none; }
.acp .acp-sw:hover .acp-sw-tools,
.acp .acp-sw:focus-within .acp-sw-tools,
.acp .acp-sw.is-sel .acp-sw-tools { opacity: 1; }
.acp .acp-sw-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0;
    border: none; border-radius: 7px; background: rgba(255, 255, 255, 0.85); color: #1e293b; cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.acp .acp-sw-btn svg { width: 14px; height: 14px; }
.acp .acp-sw-btn:hover:not(:disabled) { background: #fff; color: #c23b3b; }
.acp .acp-sw-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.acp .acp-sw.is-locked .acp-sw-tools { opacity: 1; }
.acp .acp-sw.is-locked .acp-sw-btn[data-act="lock"] { background: #1e293b; color: #fff; }
.acp .acp-sw-meta { display: flex; flex-direction: column; padding: 0.35rem 0.2rem 0.1rem; min-width: 0; line-height: 1.3; }
.acp .acp-sw-meta strong { font: 700 0.8rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--acp-text-1); }
.acp .acp-sw-meta span,
.acp .acp-sw-meta em { font-size: 0.72rem; color: var(--acp-muted); font-style: normal; }
.acp .acp-sw-meta > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-sw-meta em { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- selected color ---------- */
.acp .acp-detail { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--acp-line); }
.acp .acp-detail-top { display: grid; grid-template-columns: 52px minmax(0, 1fr) 196px; gap: 0.75rem; align-items: center; }
.acp .acp-detail-edit { display: grid; grid-template-columns: minmax(0, 1fr) 34px 34px; gap: 4px; align-items: center; }
.acp #detailLock.is-on { background: var(--acp-text-1); color: var(--acp-card); border-color: var(--acp-text-1); }
.acp .acp-detail-sw {
    position: relative; display: flex; align-items: center; justify-content: center; width: 52px; height: 52px;
    border-radius: 13px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15);
}
.acp .acp-detail-sw svg { width: 18px; height: 18px; opacity: 0; transition: opacity .15s; }
.acp .acp-detail-sw:hover svg { opacity: 0.9; }
.acp .acp-detail-sw input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: none; padding: 0; }
.acp .acp-detail-id { display: flex; flex-direction: column; min-width: 0; }
.acp .acp-detail-id strong { font-size: 1.05rem; color: var(--acp-text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-detail-id span { font-size: 0.8rem; color: var(--acp-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 0.8rem; }
.acp .acp-val {
    display: grid; grid-template-columns: 48px minmax(0, 1fr) 14px; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.6rem; border-radius: 9px; border: 1px solid var(--acp-line); background: var(--acp-open);
    cursor: pointer; text-align: left; color: var(--acp-text-1); min-width: 0;
}
.acp .acp-val span { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.05em; color: var(--acp-muted); }
.acp .acp-val code { font: 600 0.78rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: none; padding: 0; color: inherit; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-val svg { width: 14px; height: 14px; color: var(--acp-muted); }
.acp .acp-val:hover { border-color: var(--acp-accent-line); }
.acp .acp-val:hover svg { color: var(--acp-accent-strong); }
.acp .acp-contrast { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 0.6rem; }
.acp .acp-contrast .acp-hint { grid-column: 1 / -1; margin-top: 0.15rem; }
.acp .acp-ct {
    display: flex; align-items: center; gap: 0.5rem; padding: 0.35rem 0.5rem 0.35rem 0.35rem; border-radius: 9px;
    border: 1px solid var(--acp-line); font-size: 0.8rem; color: var(--acp-text-2); min-width: 0;
}
.acp .acp-ct > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-ct strong { color: var(--acp-text-1); font-variant-numeric: tabular-nums; }
.acp .acp-ct-sw { display: flex; align-items: center; justify-content: center; width: 30px; height: 26px; border-radius: 7px; font-weight: 800; font-size: 0.8rem; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12); }
.acp .acp-ct b { font-size: 0.66rem; font-weight: 800; padding: 0.1rem 0.4rem; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.acp .acp-ct b.ok { color: var(--acp-ok); background: rgba(51, 153, 102, 0.12); }
.acp .acp-ct b.mid { color: var(--acp-mid); background: rgba(245, 158, 11, 0.12); }
.acp .acp-ct b.bad { color: var(--acp-bad); background: rgba(230, 78, 78, 0.1); }
.acp .acp-send-links { display: flex; flex-wrap: wrap; gap: 6px; }
.acp .acp-send-link {
    display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem; border-radius: 999px;
    border: 1px solid var(--acp-line); background: var(--acp-card); color: var(--acp-text-2);
    font-size: 0.8rem; font-weight: 600; text-decoration: none;
}
.acp .acp-send-link svg { width: 14px; height: 14px; color: var(--acp-accent); }
.acp .acp-send-link:hover { border-color: var(--acp-accent-line); color: var(--acp-accent-strong); background: var(--acp-accent-soft); }
.acp .acp-harm-list { display: grid; gap: 4px; }
.acp .acp-harm { display: grid; grid-template-columns: 112px minmax(0, 1fr) 28px; align-items: center; gap: 0.5rem; }
.acp .acp-harm-name { font-size: 0.8rem; font-weight: 600; color: var(--acp-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acp .acp-harm-sws { display: flex; gap: 4px; min-width: 0; }
.acp .acp-harm-base,
.acp .acp-harm-sw { flex: 1; min-width: 0; height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.12); }
.acp .acp-harm-base { flex: 0 0 18px; border-radius: 7px 3px 3px 7px; }
.acp .acp-harm-sw { display: flex; align-items: center; justify-content: center; padding: 0; border: none; cursor: pointer; }
.acp .acp-harm-sw svg { width: 14px; height: 14px; opacity: 0; transition: opacity .15s; }
.acp .acp-harm-sw:hover svg,
.acp .acp-harm-sw:focus-visible svg { opacity: 1; }
.acp .acp-harm-out {
    display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 7px;
    color: var(--acp-muted);
}
.acp .acp-harm-out svg { width: 15px; height: 15px; }
.acp .acp-harm-out:hover { color: var(--acp-accent-strong); background: var(--acp-accent-soft); }

/* ---------- settings ---------- */
.acp .acp-base { margin-bottom: 0.9rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--acp-line); }
.acp .acp-base-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; align-items: center; }
.acp .acp-swatch {
    position: relative; display: block; width: 42px; height: 36px; border-radius: 9px; overflow: hidden; cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.15);
}
.acp .acp-swatch input[type="color"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: none; padding: 0; }
.acp .acp-quick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 0.6rem; }
.acp .acp-quick button {
    min-height: 32px; padding: 0.2rem; border-radius: 8px; min-width: 0;
    border: 1px solid var(--acp-line); background: var(--acp-card); color: var(--acp-text-2);
    font-size: 0.82rem; font-weight: 700; cursor: pointer; font-variant-numeric: tabular-nums;
}
.acp .acp-quick button:hover { border-color: var(--acp-accent-line); color: var(--acp-accent-strong); }
.acp .acp-quick button.active { border-color: var(--acp-accent); background: var(--acp-accent-soft); color: var(--acp-accent-strong); }

/* collapsed option rows */
.acp .acp-adv-options { padding: 0; overflow: hidden; }
.acp .acp-adv-row + .acp-adv-row { border-top: 1px solid var(--acp-line); }
.acp .acp-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(--acp-text-1); box-sizing: border-box;
}
.acp .acp-adv-head-static { cursor: default; }
.acp .acp-adv-head:hover:not(.acp-adv-head-static) { background: var(--acp-open); }
.acp .acp-adv-left { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.acp .acp-adv-left > svg { width: 18px; height: 18px; color: var(--acp-accent); flex-shrink: 0; }
.acp .acp-adv-text { display: flex; flex-direction: column; min-width: 0; }
.acp .acp-adv-title { font-size: 0.9rem; font-weight: 700; color: var(--acp-text-1); }
.acp .acp-adv-hint { font-size: 0.76rem; color: var(--acp-muted); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
.acp .acp-adv-right { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.acp .acp-chevron { width: 17px; height: 17px; color: var(--acp-muted); transition: transform .2s; }
.acp .acp-adv-row.open .acp-chevron { transform: rotate(180deg); }
.acp .acp-adv-row.open .acp-adv-head,
.acp .acp-adv-row.open .acp-adv-body { background: var(--acp-open); }
.acp .acp-adv-body { padding: 0.2rem 1rem 1rem; }
.acp .acp-adv-body > .acp-seg:first-child { margin-top: 0.2rem; }

/* saved palettes */
.acp .acp-saved-list { display: grid; gap: 6px; }
.acp .acp-saved { display: grid; grid-template-columns: minmax(0, 1fr) 28px; align-items: center; gap: 4px; border: 1px solid var(--acp-line); border-radius: 10px; background: var(--acp-card); }
.acp .acp-saved-apply { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 0.55rem; padding: 0.35rem; border: none; background: none; cursor: pointer; text-align: left; min-width: 0; color: var(--acp-text-1); }
.acp .acp-saved-sw { display: flex; height: 22px; border-radius: 6px; overflow: hidden; }
.acp .acp-saved-sw i { flex: 1; }
.acp .acp-saved-name { font-size: 0.82rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-saved-del { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; padding: 0; border: none; border-radius: 50%; background: none; color: var(--acp-muted); cursor: pointer; }
.acp .acp-saved-del svg { width: 14px; height: 14px; }
.acp .acp-saved-del:hover { background: rgba(230, 78, 78, 0.12); color: var(--acp-bad); }
.acp .acp-save-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; margin-top: 0.6rem; }
.acp .acp-save-row .acp-input { font-family: inherit; font-weight: 500; }
.acp .acp-empty { margin: 0.2rem 0 0; }

/* switch - must beat .tool-container input[type="checkbox"] in custom_styles.css */
.acp .acp-switch-wrap { display: inline-flex; align-items: center; gap: 0.45rem; flex-shrink: 0; cursor: pointer; }
.acp .acp-switch-wrap em { font-style: normal; font-size: 0.72rem; font-weight: 800; color: var(--acp-muted); min-width: 26px; letter-spacing: 0.04em; }
.acp .acp-switch-wrap input:checked + em { color: var(--acp-accent-strong); }
input[type="checkbox"].acp-switch,
.tool-container input[type="checkbox"].acp-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"].acp-switch,
[data-theme="dark"] .tool-container input[type="checkbox"].acp-switch { background: #475569 !important; background-color: #475569 !important; }
input[type="checkbox"].acp-switch::after,
.tool-container input[type="checkbox"].acp-switch::after,
.tool-container input[type="checkbox"].acp-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"].acp-switch:checked,
.tool-container input[type="checkbox"].acp-switch:checked { background: var(--acp-go, #c23b3b) !important; background-color: var(--acp-go, #c23b3b) !important; }
input[type="checkbox"].acp-switch:checked::after,
.tool-container input[type="checkbox"].acp-switch:checked::after { transform: translateX(18px) !important; }
input[type="checkbox"].acp-switch:focus-visible,
.tool-container input[type="checkbox"].acp-switch:focus-visible { outline: 2px solid var(--acp-accent) !important; outline-offset: 2px !important; }

/* ---------- code ---------- */
.acp .acp-code-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.acp .acp-tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--acp-sunk); border: 1px solid var(--acp-line); min-width: 0; }
.acp .acp-tabs button {
    padding: 0.3rem 0.6rem; border: 1px solid transparent; border-radius: 7px; background: none; cursor: pointer;
    color: var(--acp-text-2); font-size: 0.8rem; font-weight: 700;
}
.acp .acp-tabs button.active { background: var(--acp-card); color: var(--acp-accent-strong); border-color: var(--acp-line); }
.acp .acp-code {
    margin: 0; padding: 0.85rem 1rem; border-radius: 11px; max-height: 240px; overflow: auto;
    background: #0f172a; color: #e2e8f0; border: 1px solid #1e293b;
    font: 0.8rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    white-space: pre-wrap; word-break: break-word;
}
.acp .acp-code code { font: inherit; color: inherit; background: none; padding: 0; }

/* ---------- action bar ---------- */
.acp .acp-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(--acp-line);
}
.acp .acp-summary { display: flex; flex-direction: column; min-width: 0; }
.acp .acp-summary strong { font-size: 0.95rem; color: var(--acp-text-1); font-variant-numeric: tabular-nums; }
.acp .acp-summary span { font-size: 0.8rem; color: var(--acp-muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acp .acp-actionbar-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.acp .acp-go { min-width: 170px; }

/* ---------- toast ---------- */
.acp .acp-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);
}
.acp .acp-toast.show { opacity: 1; transform: translate(-50%, 0); }
[data-theme="dark"] .acp .acp-toast { background: #f8fafc; color: #0f172a; }

/* ---------- content ---------- */
.acp .related-tools { margin-top: 2rem; }
.acp .acp-info { display: grid; gap: 1.5rem; margin-top: 2rem; }
.acp .acp-info .info-card {
    background: var(--acp-card); border: 1px solid var(--acp-line); border-radius: 16px;
    padding: 1.6rem 1.75rem; box-shadow: none;
}
.acp .acp-info .info-card h2 { font-size: 1.3rem; margin: 0 0 1rem; }
.acp .acp-info .info-card h2 svg { color: var(--acp-accent); width: 22px; height: 22px; }
.acp .acp-info p { margin: 0.75rem 0 0; line-height: 1.7; color: var(--acp-text-2); }
.acp .acp-info a { color: var(--acp-accent-strong); font-weight: 600; }
.acp .acp-steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.acp .acp-steps li { counter-increment: s; position: relative; padding-left: 2.4rem; line-height: 1.6; color: var(--acp-text-2); }
.acp .acp-steps li::before {
    content: counter(s); position: absolute; left: 0; top: 0; width: 1.65rem; height: 1.65rem; border-radius: 50%;
    background: var(--acp-accent); color: #fff; font-size: 0.82rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .acp .acp-steps li::before { color: #0f172a; }
.acp .acp-steps strong,
.acp .acp-list strong { color: var(--acp-text-1); }
.acp .acp-list { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.6rem; line-height: 1.65; color: var(--acp-text-2); }
.acp .acp-styles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; }
.acp .acp-style-card { border: 1px solid var(--acp-line); border-radius: 14px; padding: 0.8rem; background: var(--acp-open); min-width: 0; }
.acp .acp-style-sw { display: flex; height: 56px; border-radius: 10px; overflow: hidden; }
.acp .acp-style-sw i { flex: 1; }
.acp .acp-style-card h3 { margin: 0.7rem 0 0; font-size: 1rem; color: var(--acp-text-1); }
.acp .acp-style-card p { margin: 0.3rem 0 0; font-size: 0.86rem; line-height: 1.55; }
.acp .acp-table-wrap { overflow-x: auto; border: 1px solid var(--acp-line); border-radius: 12px; }
.acp .acp-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.acp .acp-table th,
.acp .acp-table td { padding: 0.6rem 0.85rem; text-align: left; border-bottom: 1px solid var(--acp-line); color: var(--acp-text-2); }
.acp .acp-table th { background: var(--acp-open); color: var(--acp-text-1); font-weight: 700; }
.acp .acp-table tr:last-child td { border-bottom: none; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .acp .acp-layout { display: flex; flex-direction: column; gap: 0.875rem; }
    .acp .acp-col-main,
    .acp .acp-col-side { display: contents; }
    .acp .acp-col-main > * + *,
    .acp .acp-col-side > * + * { margin-top: 0; }
    .acp .acp-col-main > *,
    .acp .acp-col-side > * { min-width: 0; width: 100%; box-sizing: border-box; }
    .acp .acp-source-card { order: 1; }
    .acp .acp-mode { order: 2; }
    .acp .acp-main-opt { order: 3; }
    .acp .acp-palette-card { order: 4; }
    .acp .acp-adv-options { order: 5; }
    .acp .acp-code-card { order: 6; }
    .acp .acp-styles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .acp.tool-container { padding: 1rem 0.75rem; }
    .acp .tool-title { font-size: 1.6rem; }
    .acp .acp-title-icon { width: 46px; height: 46px; border-radius: 13px; }
    .acp .acp-title-icon svg { width: 24px; height: 24px; }
    .acp .acp-main { padding: 0.75rem; border-radius: 16px; }
    .acp .acp-card { padding: 0.85rem; }
    .acp .acp-source-card { padding: 0.6rem; }
    .acp .acp-drop { min-height: 180px; }
    .acp .acp-strip { grid-template-columns: repeat(var(--cols-m), minmax(0, 1fr)); }
    .acp .acp-sw-color { height: 104px; }
    .acp .acp-sw-tools { opacity: 1; }
    .acp .acp-detail-top { grid-template-columns: 48px minmax(0, 1fr); }
    .acp .acp-detail-edit { grid-column: 1 / -1; }
    .acp .acp-values,
    .acp .acp-contrast { grid-template-columns: minmax(0, 1fr); }
    .acp .acp-harm { grid-template-columns: 88px minmax(0, 1fr) 28px; }
    .acp .acp-styles { grid-template-columns: minmax(0, 1fr); }
    .acp .acp-actionbar { flex-direction: column; align-items: stretch; }
    .acp .acp-actionbar-btns { display: grid; grid-template-columns: 1fr 1fr; }
    .acp .acp-go { min-width: 0; }
    .acp .acp-info .info-card { padding: 1.2rem; }
    .acp .acp-photo-hint { font-size: 0.74rem; }
}
@media (hover: none) {
    .acp .acp-sw-tools { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .acp * { transition: none !important; }
}
