/* =========================================================
   PickHue - soft minimal UI
   Light: pale gray canvas, soft white panels, black active pills.
   Dark: graphite canvas, quiet glass panels, white active pills.
   ========================================================= */

:root {
  --canvas: #e9e9ec;
  --canvas-2: #e2e2e6;
  --surface: #f7f7f8;
  --surface-hi: #fdfdfd;
  --surface-2: #efeff2;
  --text: #111113;
  --muted: #6c6c74;
  --faint: #a3a3ab;
  --line: rgba(17, 17, 19, .07);
  --line-strong: rgba(17, 17, 19, .12);
  --ink: #111113;
  --ink-text: #ffffff;
  --accent: #3d7bff;
  --accent-soft: rgba(61, 123, 255, .12);
  --focus: rgba(61, 123, 255, .45);

  --shadow-xs: 0 1px 2px rgba(17, 17, 19, .05);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 1px 2px rgba(17, 17, 19, .05), 0 3px 8px -2px rgba(17, 17, 19, .06);
  --shadow: 0 1px 0 rgba(255, 255, 255, .95) inset, 0 2px 4px rgba(17, 17, 19, .03), 0 18px 40px -18px rgba(17, 17, 19, .16);
  --inset: inset 0 1px 2px rgba(17, 17, 19, .06), inset 0 0 0 1px rgba(17, 17, 19, .04);

  --r-xl: 32px;
  --r-lg: 24px;
  --r: 18px;
  --r-sm: 12px;

  --checker: repeating-conic-gradient(#e4e4e8 0 25%, #f6f6f8 0 50%) 0 0 / 16px 16px;
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas: #0c0d10;
    --canvas-2: #101115;
    --surface: #16171b;
    --surface-hi: #1b1c21;
    --surface-2: #1f2025;
    --text: #f1f1f3;
    --muted: #8d8e97;
    --faint: #5c5d66;
    --line: rgba(255, 255, 255, .06);
    --line-strong: rgba(255, 255, 255, .11);
    --ink: #f1f1f3;
    --ink-text: #0c0d10;
    --accent: #5b8cff;
    --accent-soft: rgba(91, 140, 255, .16);
    --focus: rgba(91, 140, 255, .55);
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-sm: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 6px rgba(0, 0, 0, .35);
    --shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 48px -24px rgba(0, 0, 0, .7);
    --inset: inset 0 1px 2px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .04);
    --checker: repeating-conic-gradient(#1c1d22 0 25%, #15161a 0 50%) 0 0 / 16px 16px;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --canvas: #0c0d10;
  --canvas-2: #101115;
  --surface: #16171b;
  --surface-hi: #1b1c21;
  --surface-2: #1f2025;
  --text: #f1f1f3;
  --muted: #8d8e97;
  --faint: #5c5d66;
  --line: rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .11);
  --ink: #f1f1f3;
  --ink-text: #0c0d10;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, .16);
  --focus: rgba(91, 140, 255, .55);
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 6px rgba(0, 0, 0, .35);
  --shadow: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 48px -24px rgba(0, 0, 0, .7);
  --inset: inset 0 1px 2px rgba(0, 0, 0, .35), inset 0 0 0 1px rgba(255, 255, 255, .04);
  --checker: repeating-conic-gradient(#1c1d22 0 25%, #15161a 0 50%) 0 0 / 16px 16px;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  background: var(--canvas) linear-gradient(180deg, var(--canvas) 0%, var(--canvas-2) 100%) fixed;
  font: 15.5px/1.6 var(--font); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; }
code, .mono, kbd { font-family: var(--mono); }
code { font-size: .88em; background: var(--surface-2); padding: .12em .4em; border-radius: 6px; }
kbd { font-size: .8em; background: var(--surface-hi); border-radius: 6px; padding: .1em .45em; box-shadow: var(--shadow-xs), inset 0 -1px 0 var(--line-strong); }
h1, h2, h3 { line-height: 1.2; font-weight: 600; letter-spacing: -0.025em; }
h1 { font-size: clamp(1.8rem, 4.2vw, 2.7rem); margin: 0 0 .5rem; letter-spacing: -0.035em; }
h2 { font-size: 1.3rem; margin: 2.6rem 0 .9rem; }
h3 { font-size: 1rem; margin: 1.5rem 0 .55rem; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt { margin-top: 18px; }

/* ---------- Icons ---------- */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Header: floating panel with pill nav ---------- */
.site-header { position: sticky; top: 0; z-index: 30; padding: 12px 0 0; }
.header-inner {
  display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 8px 8px 18px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); backdrop-filter: saturate(1.4) blur(18px);
  border-radius: 999px; box-shadow: var(--shadow);
}
.logo { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 1.05rem; letter-spacing: -0.02em; white-space: nowrap; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 22px; height: 22px; }
.nav { display: flex; gap: 2px; margin-left: auto; padding: 4px; border-radius: 999px; background: var(--surface-2); box-shadow: var(--inset); }
.nav a {
  display: flex; align-items: center; gap: 7px; color: var(--muted); padding: 8px 14px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; white-space: nowrap; transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); background: var(--surface-hi); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--ink); color: var(--ink-text); box-shadow: var(--shadow-xs); }
.theme-toggle {
  width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  color: var(--text); background: var(--surface-hi); box-shadow: var(--shadow-sm); flex: none;
}
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}
@media (max-width: 1020px) { .nav a span { display: none; } .nav a { padding: 9px 11px; } .nav a[aria-current="page"] span { display: inline; } }
@media (max-width: 640px) {
  .site-header { position: static; padding-top: 10px; }
  .header-inner { flex-wrap: wrap; border-radius: var(--r-lg); padding: 10px; }
  .logo { padding-left: 6px; }
  .theme-toggle { margin-left: auto; width: 38px; height: 38px; }
  .nav { order: 3; width: 100%; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; }
}

/* ---------- Hero ---------- */
.hero { padding-top: 44px; padding-bottom: 6px; }
.hero p.lead { color: var(--muted); margin: 0; max-width: 640px; font-size: 1.04rem; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); font-size: .8rem; color: var(--muted); margin-bottom: 16px; }
.eyebrow b { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 8px; font-weight: 600; }

/* ---------- Panels ---------- */
.card {
  background: linear-gradient(180deg, var(--surface-hi), var(--surface));
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 22px;
}
.tool { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; margin-top: 22px; align-items: start; }
@media (max-width: 900px) { .tool { grid-template-columns: 1fr; } }
.tool > aside.card { position: sticky; top: 92px; }
@media (max-width: 900px) { .tool > aside.card { position: static; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  border: 0; background: var(--surface-hi); color: var(--text); box-shadow: var(--shadow-sm);
  padding: 10px 18px; border-radius: 999px; font: 500 .92rem var(--font); text-decoration: none;
  transition: transform .12s;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: var(--shadow-xs); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--ink); color: var(--ink-text); box-shadow: 0 6px 16px -8px rgba(0, 0, 0, .45); }
.btn.primary:hover { opacity: .9; }
.btn.small { padding: 6px 13px; font-size: .82rem; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Form controls ---------- */
input[type="text"], input[type="number"], select {
  font: inherit; font-size: .95rem; color: var(--text); background: var(--surface-2); border: 0; box-shadow: var(--inset);
  border-radius: 999px; padding: 10px 16px; width: 100%; outline: none;
}
input[type="text"]:focus, input[type="number"]:focus, select:focus { box-shadow: var(--inset), 0 0 0 3px var(--focus); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d8e97' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 16px;
}
label { font-size: .9rem; }
input[type="range"] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; margin: 6px 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-strong); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -8px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25), 0 0 0 1px rgba(0,0,0,.04); }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
input[type="color"] { -webkit-appearance: none; appearance: none; border: 0; padding: 0; background: none; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }

/* Segmented control */
.tabs { display: flex; gap: 2px; margin-bottom: 10px; padding: 4px; border-radius: 999px; background: var(--surface-2); box-shadow: var(--inset); overflow-x: auto; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 6px 10px; border-radius: 999px; cursor: pointer; font: 500 .83rem var(--font); white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--surface-hi); color: var(--text); box-shadow: var(--shadow-xs); }

/* sliding indicator for segmented tabs (added by ui.js) */
.tabs.has-ind { position: relative; }
.tabs-ind {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 999px;
  background: var(--surface-hi); box-shadow: var(--shadow-xs); pointer-events: none;
  transition: transform .32s cubic-bezier(.3, .8, .2, 1), width .32s cubic-bezier(.3, .8, .2, 1);
}
.tabs.has-ind button { position: relative; z-index: 1; transition: color .2s; }
.tabs.has-ind button[aria-selected="true"] { background: transparent; box-shadow: none; }

/* ---------- Export block ---------- */
.export-box { margin-top: 2px; border-radius: var(--r); background: var(--surface-2); box-shadow: var(--inset); overflow: hidden; }
.export-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px 0; font-size: .76rem; }
.export-file { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); color: var(--text); }
.export-file i { width: 8px; height: 8px; border-radius: 50%; display: block; transition: background .25s; }
.export-box textarea.export { background: transparent; box-shadow: none; border-radius: 0; min-height: 138px; padding: 10px 14px 14px; }
.export-actions { display: flex; gap: 8px; margin-top: 12px; }
.export-actions .btn-copy { flex: 1; }

/* action buttons: icon + label, success state */
.btn .i { width: 17px; height: 17px; }
.icon-btn { width: 44px; height: 44px; padding: 0; flex: none; }
.btn:disabled:active { transform: none; }
.btn-copy { overflow: hidden; }
.btn-copy .ic-check, .icon-btn .ic-check { display: none; }
.btn.done { background: #1f9d55; color: #fff; box-shadow: 0 6px 16px -8px rgba(31, 157, 85, .7); }
.btn.done .ic-copy { display: none; }
.btn.done .ic-check { display: block; animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
.btn.done .lbl { animation: fade-in .25s ease; }
.icon-btn.done .i { animation: pop .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(3px); } }

/* ---------- Drop zone & image stage ---------- */
.dropzone {
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--inset);
  outline: 1.5px dashed var(--line-strong); outline-offset: -12px;
  min-height: 360px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; text-align: center; padding: 32px; cursor: pointer; transition: outline-color .15s, background .15s;
}
.dropzone:hover { outline-color: var(--faint); }
.dropzone.drag { outline-color: var(--accent); background: var(--accent-soft); }
.dropzone .hint { color: var(--muted); font-size: .86rem; max-width: 420px; }
.dropzone-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--surface-hi); box-shadow: var(--shadow-sm); display: grid; place-items: center; color: var(--text); margin-bottom: 4px; }
.dropzone-icon .i { width: 22px; height: 22px; }

.stage { position: relative; background: var(--checker); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow); }
.stage canvas.view { display: block; width: 100%; height: auto; cursor: crosshair; touch-action: none; }
.loupe {
  position: absolute; pointer-events: none; width: 132px; height: 132px; border-radius: 50%;
  border: 4px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 12px 30px rgba(0,0,0,.3);
  display: none; overflow: hidden; background: #000;
}
.loupe canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.loupe-label {
  position: absolute; pointer-events: none; display: none; transform: translate(-50%, 0);
  background: rgba(17,17,19,.85); color: #fff; font: 600 12px/1 var(--mono);
  padding: 6px 9px; border-radius: 999px; white-space: nowrap; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.stage-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.stage-bar .muted { font-size: .85rem; padding-left: 6px; }
.stage-bar .sample { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }

/* ---------- Custom dropdown (enhanced <select>) ---------- */
.dd { position: relative; }
.dd-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.dd-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; cursor: pointer; text-align: left;
  font: 500 .93rem var(--font); color: var(--text); background: var(--surface-2); border: 0; box-shadow: var(--inset);
  border-radius: 999px; padding: 9px 14px 9px 16px; transition: box-shadow .2s;
}
.dd-btn:hover { box-shadow: var(--inset), 0 0 0 1px var(--line-strong); }
.dd-btn:focus-visible, .dd.open .dd-btn { outline: none; box-shadow: var(--inset), 0 0 0 3px var(--focus); }
.dd-val { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dd-val > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-chev { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s cubic-bezier(.3, .8, .2, 1); }
.dd.open .dd-chev { transform: rotate(180deg); }
.dd-pv { width: 22px; height: 22px; flex: none; border-radius: 7px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); display: block; }

.dd-list {
  position: absolute; z-index: 50; top: calc(100% + 8px); left: 0; right: 0; min-width: 210px;
  padding: 6px; border-radius: 18px; max-height: 320px; overflow-y: auto;
  background: var(--surface-hi); box-shadow: 0 0 0 1px var(--line), 0 24px 48px -16px rgba(0, 0, 0, .28), 0 4px 12px rgba(0, 0, 0, .06);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translateY(-6px) scale(.97); transform-origin: top center;
  transition: opacity .16s ease, transform .22s cubic-bezier(.3, .8, .2, 1), visibility 0s linear .22s;
}
.dd.up .dd-list { top: auto; bottom: calc(100% + 8px); transform-origin: bottom center; transform: translateY(6px) scale(.97); }
.dd.open .dd-list { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition-delay: 0s; }

.dd-opt {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px 9px 12px; border-radius: 12px; cursor: pointer;
  font-size: .92rem; color: var(--text); transition: background-color .12s;
}
.dd.open .dd-opt { animation: dd-item .28s cubic-bezier(.3, .8, .2, 1) both; animation-delay: calc(var(--i) * 28ms + 30ms); }
@keyframes dd-item { from { opacity: 0; transform: translateY(-4px); } }
.dd-opt.active { background: var(--surface-2); }
.dd-text { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.dd-text small { color: var(--muted); font-size: .76rem; margin-top: 2px; }
.dd-opt[aria-selected="true"] .dd-text > span { font-weight: 600; }
.dd-check { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(.6); transition: opacity .15s, transform .2s; }
.dd-opt[aria-selected="true"] .dd-check { opacity: 1; transform: none; }

/* compact variant (small inline control) */
.dd-compact .dd-btn { width: auto; padding: 6px 10px 6px 13px; font-size: .82rem; background: var(--surface-hi); box-shadow: var(--shadow-sm); }
.dd-compact .dd-list { left: auto; right: 0; min-width: 250px; }

/* ---------- Color readout ---------- */
.swatch-big {
  height: 132px; border-radius: var(--r); margin-bottom: 14px; display: flex; align-items: flex-end; padding: 14px 16px;
  font: 600 .95rem var(--mono); box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.codes { display: grid; gap: 6px; }
.code-row { display: grid; grid-template-columns: 50px 1fr auto; align-items: center; gap: 8px; background: var(--surface-2); box-shadow: var(--inset); border-radius: 999px; padding: 4px 4px 4px 16px; }
.code-row .k { color: var(--faint); font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.code-row .v { font-family: var(--mono); font-size: .86rem; overflow-wrap: anywhere; }
.code-row .btn.small { padding: 5px 12px; }

.picked { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; border: 0; background: var(--surface-hi); box-shadow: var(--shadow-sm);
  border-radius: 999px; padding: 4px 11px 4px 4px; cursor: pointer; font: 500 .8rem var(--mono); color: var(--text);
}
.chip:hover { background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ink-text); }
.chip[aria-pressed="true"] i { box-shadow: 0 0 0 2px var(--ink-text); }
.chip i { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); display: block; }

/* ---------- Palette ---------- */
.palette { display: flex; border-radius: var(--r-lg); overflow: hidden; min-height: 170px; box-shadow: var(--shadow); }
.palette .p { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; cursor: pointer; transition: flex-grow .25s ease; }
.palette .p:hover { flex-grow: 1.5; }
.palette .p b { font: 600 .85rem var(--mono); }
.palette .p small { opacity: .75; font-size: .75rem; }
.palette .p .pn { opacity: .92; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }
@media (max-width: 600px) {
  .palette { flex-direction: column; }
  .palette .p { min-height: 56px; flex-direction: row; align-items: center; justify-content: space-between; }
}
.preview-img { max-height: 300px; width: auto; display: block; margin: 0 auto; border-radius: var(--r); }
textarea.export {
  width: 100%; min-height: 150px; font: .82rem/1.55 var(--mono); background: var(--surface-2); color: var(--text);
  border: 0; box-shadow: var(--inset); border-radius: var(--r); padding: 14px; resize: vertical; outline: none;
}

/* ---------- Swatch grids ---------- */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.sw { display: block; border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--text); background: var(--surface-hi); box-shadow: var(--shadow-sm); transition: transform .15s; }
.sw:hover { transform: translateY(-2px); text-decoration: none; }
.sw i { display: block; height: 60px; margin: 5px 5px 0; border-radius: 13px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.sw span { display: block; padding: 7px 10px 0; font: 500 .74rem var(--mono); }
.sw small { display: block; padding: 0 10px 8px; font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip { display: flex; border-radius: 14px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.strip > * { flex: 1; height: 54px; position: relative; cursor: pointer; transition: flex-grow .2s; }
.strip > *:hover { flex-grow: 1.4; }
.harmony { display: grid; grid-template-columns: 170px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.harmony > span { font-size: .88rem; }
@media (max-width: 600px) { .harmony { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- Color pages ---------- */
.color-hero { border-radius: var(--r-xl); padding: 30px 28px; min-height: 230px; display: flex; flex-direction: column; justify-content: flex-end; box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,0,0,.05); }
.color-hero h1 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }
.grid-2 > * { min-width: 0; }
table.info td { overflow-wrap: anywhere; }
table.info { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.info td, table.info th { padding: 9px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.info tr:last-child td, table.info tr:last-child th { border-bottom: 0; }
table.info th { color: var(--muted); font-weight: 500; width: 38%; }
.contrast-box { border-radius: 999px; padding: 11px 16px; font-weight: 600; font-size: .88rem; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
pre.snippet { background: var(--surface-2); box-shadow: var(--inset); border-radius: var(--r); padding: 14px 16px; overflow-x: auto; font-size: .83rem; line-height: 1.6; }
pre.snippet code { background: none; padding: 0; font-size: inherit; }

/* ---------- Gradient generator ---------- */
.grad-preview { height: 340px; border-radius: var(--r-xl); box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,0,0,.05); }
@media (max-width: 600px) { .grad-preview { height: 210px; } }
.grad-bar { position: relative; height: 30px; border-radius: 999px; cursor: copy; touch-action: none; margin: 20px 12px 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.grad-handle {
  position: absolute; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%); border-radius: 50%;
  border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 4px 10px rgba(0,0,0,.25); cursor: grab;
}
.grad-handle:active { cursor: grabbing; }
.stops { display: grid; gap: 8px; }
.stop-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 80px 40px; gap: 8px; align-items: center; }
.stop-row input[type="color"] { width: 40px; height: 40px; }
.stop-row .btn.small { width: 36px; height: 36px; padding: 0; }
#angleQuick .btn.small { width: 34px; height: 34px; padding: 0; }
.grad-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.grad-preset { border: 0; background: var(--surface-hi); box-shadow: var(--shadow-sm); border-radius: var(--r); padding: 5px; cursor: pointer; text-align: left; color: var(--text); font: inherit; transition: transform .15s; }
.grad-preset:hover { transform: translateY(-2px); }
.grad-preset i { display: block; height: 76px; border-radius: 13px; }
.grad-preset span { display: block; padding: 7px 7px 3px; font-size: .84rem; font-weight: 500; }

/* ---------- Tailwind grid ---------- */
.scroll-x { overflow-x: auto; position: relative; -webkit-overflow-scrolling: touch; }
.tw-grid { display: grid; grid-template-columns: 76px repeat(11, minmax(46px, 1fr)); gap: 5px; min-width: 680px; align-items: center; }
.tw-grid .h { font-size: .72rem; color: var(--faint); text-align: center; font-weight: 500; }
.tw-grid .fam { font-size: .84rem; font-weight: 500; text-transform: capitalize; color: var(--muted); }
.tw-grid a { display: block; height: 42px; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); transition: transform .12s; }
.tw-grid a.cur { outline: 2px solid var(--ink); outline-offset: 2px; }
.tw-grid a:hover { transform: scale(1.08); }

/* ---------- Brand / flag sets ---------- */
.set-strip { display: flex; border-radius: var(--r-xl); overflow: hidden; min-height: 160px; box-shadow: var(--shadow), inset 0 0 0 1px rgba(0,0,0,.05); }
.set-strip > div { flex: 1; display: flex; align-items: flex-end; padding: 14px; font: 600 .82rem var(--mono); cursor: pointer; }
.set-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.set-card { padding: 6px; }
.set-card > i { display: block; height: 84px; border-radius: var(--r); box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.set-card > div { padding: 12px 12px 8px; }
.set-card table.info td, .set-card table.info th { padding: 5px 2px; font-size: .84rem; }
.set-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.set-list a { display: block; color: var(--text); border-radius: var(--r); overflow: hidden; background: var(--surface-hi); box-shadow: var(--shadow-sm); padding: 5px; transition: transform .15s; }
.set-list a:hover { transform: translateY(-2px); text-decoration: none; }
.set-list a .mini { display: flex; height: 46px; border-radius: 13px; overflow: hidden; }
.set-list a .mini i { flex: 1; }
.set-list a span { display: block; padding: 7px 8px 4px; font-weight: 500; font-size: .87rem; }
.pill-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.pill-links a { border-radius: 999px; padding: 7px 15px; color: var(--text); background: var(--surface-hi); box-shadow: var(--shadow-sm); font-size: .88rem; font-weight: 500; }
.pill-links a:hover { text-decoration: none; background: var(--surface); }

/* ---------- Guides index: cards ---------- */
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 28px; }
@media (max-width: 960px) { .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-card {
  display: flex; flex-direction: column; padding: 6px; border-radius: var(--r-lg); color: var(--text);
  background: linear-gradient(180deg, var(--surface-hi), var(--surface)); box-shadow: var(--shadow);
  transition: transform .2s cubic-bezier(.3, .8, .2, 1), box-shadow .2s;
}
.guide-card:hover { text-decoration: none; transform: translateY(-3px); }
.gc-art { display: block; height: 128px; border-radius: 19px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.05); }
.gc-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 14px; flex: 1; }
.gc-meta { display: flex; align-items: center; gap: 10px; font-size: .78rem; color: var(--muted); }
.gc-meta b { font-weight: 500; color: var(--text); background: var(--surface-2); box-shadow: var(--inset); padding: 3px 10px; border-radius: 999px; }
.gc-title { font-size: 1.08rem; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; }
.gc-desc { font-size: .9rem; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.gc-more { margin-top: auto; padding-top: 6px; display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 500; color: var(--text); }
.gc-more .i { width: 16px; height: 16px; transition: transform .2s; }
.guide-card:hover .gc-more { color: var(--accent); }
.guide-card:hover .gc-more .i { transform: translateX(4px); }
/* first guide: wide, image on the left */
.guide-card.featured { grid-column: 1 / -1; flex-direction: row; }
.guide-card.featured .gc-art { width: 46%; height: auto; min-height: 220px; flex: none; }
.guide-card.featured .gc-body { padding: 28px 30px; justify-content: center; }
.guide-card.featured .gc-title { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
.guide-card.featured .gc-desc { font-size: .98rem; -webkit-line-clamp: 4; }
.guide-card.featured .gc-more { margin-top: 8px; }
@media (max-width: 620px) {
  .guide-card.featured { flex-direction: column; }
  .guide-card.featured .gc-art { width: auto; min-height: 140px; }
  .guide-card.featured .gc-body { padding: 16px 16px 14px; }
}

/* ---------- Article / SEO content ---------- */
.content { max-width: 740px; }
.content p, .content li { color: var(--text); }
.content li { margin: .3rem 0; }
.content table.info { margin: 1rem 0; }
article.content > p:first-of-type, .guide > p:nth-of-type(2) { font-size: 1.04rem; }
/* FAQ: one quiet panel, hairline dividers, a small chevron that turns, smooth open/close */
.faq {
  margin-top: .6rem; padding: 4px 24px; border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--surface-hi), var(--surface)); box-shadow: var(--shadow);
  interpolate-size: allow-keywords;
}
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  position: relative; cursor: pointer; list-style: none; padding: 19px 48px 19px 0;
  font-weight: 500; line-height: 1.45; color: var(--text); transition: color .2s;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }
.faq summary:focus-visible { outline: none; }
.faq summary:focus-visible::before { box-shadow: 0 0 0 3px var(--focus); }
/* round button */
.faq summary::before {
  content: ""; position: absolute; right: 0; top: 50%; width: 30px; height: 30px; margin-top: -15px;
  border-radius: 50%; background: var(--surface-2); box-shadow: var(--inset); transition: background-color .25s;
}
/* chevron */
.faq summary::after {
  content: ""; position: absolute; right: 11.5px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted);
  transform: rotate(45deg); transition: transform .3s cubic-bezier(.3, .8, .2, 1), border-color .25s, margin-top .3s;
}
.faq details[open] summary::before { background: var(--ink); box-shadow: none; }
.faq details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; border-color: var(--ink-text); }
.faq details p { margin: -4px 48px 20px 0; color: var(--muted); }
/* smooth height animation where supported (Chrome 131+); elsewhere it simply opens */
.faq details::details-content { block-size: 0; overflow: hidden; opacity: 0; transition: block-size .32s cubic-bezier(.3, .8, .2, 1), opacity .25s, content-visibility .32s allow-discrete; }
.faq details[open]::details-content { block-size: auto; opacity: 1; }
@media (max-width: 600px) { .faq { padding: 2px 18px; } .faq details p { margin-right: 0; } }
.crumbs { font-size: .84rem; padding-top: 22px; color: var(--muted); }

/* ---------- Ads ---------- */
.ad { margin: 26px auto; text-align: center; min-height: 100px; }
.ad-label { font-size: .66rem; color: var(--faint); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 4px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 72px; padding: 0 0 28px; color: var(--muted); font-size: .88rem; }
.site-footer .cols { display: flex; gap: 32px; flex-wrap: wrap; justify-content: space-between; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow); padding: 30px 32px; }
.site-footer strong { color: var(--text); font-weight: 600; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text); }
.site-footer ul { list-style: none; padding: 0; margin: 8px 0 0; }
.site-footer li { margin: 5px 0; }
@media (max-width: 640px) { .site-footer .cols { padding: 24px; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px); opacity: 0; background: var(--ink); color: var(--ink-text);
  padding: 10px 18px; border-radius: 999px; font-size: .88rem; font-weight: 500; transition: .22s; pointer-events: none; z-index: 100;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Page-to-page transitions (View Transitions API) ----------
   The header stays put, the active pill slides to the new tool,
   and the page content fades and lifts in. Browsers without support
   simply navigate as usual. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
.nav a[aria-current="page"] { view-transition-name: nav-pill; }

::view-transition-group(nav-pill) { animation-duration: .42s; animation-timing-function: cubic-bezier(.3, .8, .2, 1); }
::view-transition-old(nav-pill), ::view-transition-new(nav-pill) { height: 100%; animation-duration: .25s; }
::view-transition-group(site-header) { animation: none; }
::view-transition-old(root) { animation: .16s ease-out both vt-out; }
::view-transition-new(root) { animation: .34s cubic-bezier(.2, .7, .2, 1) .05s both vt-in; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-4px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  @view-transition { navigation: none; }
}


/* ---------- Accessible pairs (palette page) ---------- */
.pairs { padding: 24px; }
.pairs-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.pairs-head h2 { margin: 0 0 4px; }
.pairs-head p { margin: 0; font-size: .9rem; max-width: 560px; }
.pairs-tabs { max-width: 470px; }
.pair-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-top: 6px; }
.pair {
  display: flex; flex-direction: column; gap: 10px; padding: 8px 8px 12px; border: 0; border-radius: var(--r);
  background: var(--surface-hi); box-shadow: var(--shadow-sm); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: transform .2s cubic-bezier(.3, .8, .2, 1), box-shadow .2s; animation: pair-in .35s cubic-bezier(.2, .7, .2, 1) both;
}
.pair:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.pair:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.pair-demo { display: flex; flex-direction: column; gap: 2px; padding: 16px 14px; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--line); min-height: 92px; justify-content: flex-end; }
.pair-demo b { font-size: 1.6rem; line-height: 1; letter-spacing: -.02em; }
.pair-demo span { font-size: .85rem; }
.pair-meta { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.pair-ratio { font: 600 .95rem var(--mono); }
.lvl { font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; }
.lvl-aaa { background: var(--ink); color: var(--ink-text); }
.lvl-aa { background: rgba(31, 157, 85, .14); color: #1a8a4a; }
.lvl-large { background: rgba(240, 180, 41, .18); color: #a06d00; }
.pair-codes { display: flex; align-items: center; gap: 6px; padding: 0 6px; font: .78rem var(--mono); color: var(--muted); }
.pair-codes i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); flex: none; }
.pair-codes em { font: italic .75rem var(--font); color: var(--faint); margin: 0 2px; }
.pairs-empty { grid-column: 1 / -1; margin: 0; padding: 28px 16px; text-align: center; color: var(--muted); border-radius: var(--r); background: var(--surface-2); box-shadow: var(--inset); }
@keyframes pair-in { from { opacity: 0; transform: translateY(6px); } }
.pair:nth-child(2) { animation-delay: .03s; } .pair:nth-child(3) { animation-delay: .06s; } .pair:nth-child(4) { animation-delay: .09s; }
.pair:nth-child(5) { animation-delay: .12s; } .pair:nth-child(n+6) { animation-delay: .15s; }

/* Toggle switch */
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: .88rem; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui { position: relative; width: 38px; height: 22px; border-radius: 999px; background: var(--surface-2); box-shadow: var(--inset); transition: background .25s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-hi); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s cubic-bezier(.3, 1.3, .5, 1); }
.switch input:checked + .switch-ui { background: var(--ink); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); background: var(--ink-text); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 640px) { .pairs { padding: 16px; } .pairs-tabs { max-width: none; } }

:root[data-theme="dark"] .lvl-aa { color: #4ade80; } :root[data-theme="dark"] .lvl-large { color: #fbbf24; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lvl-aa { color: #4ade80; } :root:not([data-theme="light"]) .lvl-large { color: #fbbf24; } }


/* ---------- Contrast checker ---------- */
.cc-preview {
  position: relative; border-radius: var(--r-lg); padding: 56px 40px 36px; min-height: 360px; box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
  transition: background-color .35s ease, color .35s ease; display: flex; flex-direction: column; justify-content: center;
}
.cc-tag { position: absolute; top: 16px; left: 16px; font: 500 .74rem var(--mono); padding: 4px 10px; border-radius: 999px; background: rgba(127, 127, 127, .14); }
.cc-large { font-size: clamp(1.6rem, 3.4vw, 2.2rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; margin: 0 0 14px; }
.cc-normal { font-size: 1rem; line-height: 1.6; margin: 0 0 10px; max-width: 560px; }
.cc-small { font-size: .8rem; margin: 0 0 22px; }
.cc-ui { display: flex; align-items: center; gap: 12px; }
.cc-btn { padding: 10px 20px; border-radius: 999px; font-weight: 600; font-size: .9rem; transition: background-color .35s, color .35s; }
.cc-outline { padding: 8px 18px; border-radius: 999px; border: 2px solid currentColor; font-weight: 600; font-size: .9rem; }
.cc-ui .i { width: 26px; height: 26px; }

.cc-panel { display: flex; flex-direction: column; gap: 4px; }
.cc-field label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin: 0 0 6px 4px; }
.cc-input { display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 5px; border-radius: 999px; background: var(--surface-2); box-shadow: var(--inset); }
.cc-input input[type="color"] { width: 36px; height: 36px; flex: none; }
.cc-input input[type="text"] { background: transparent; box-shadow: none; padding: 6px 4px; font-family: var(--mono); min-width: 0; }
.cc-input:focus-within { box-shadow: var(--inset), 0 0 0 3px var(--focus); }
.cc-swap {
  align-self: center; width: 36px; height: 36px; margin: 4px 0 -2px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  color: var(--text); background: var(--surface-hi); box-shadow: var(--shadow-sm);
}
.cc-swap:hover { background: var(--surface); }
.cc-swap.spin .i { animation: cc-spin .45s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes cc-spin { from { transform: rotate(180deg); } }
.cc-error { min-height: 1.2em; margin: 2px 4px; font-size: .8rem; color: #d14343; }

.cc-score { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-top: 6px; }
.cc-ratio { font: 700 2.4rem/1 var(--font); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.cc-verdict { font-size: .78rem; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.cc-score[data-state="ok"] .cc-verdict { background: rgba(31, 157, 85, .14); color: #1a8a4a; }
.cc-score[data-state="warn"] .cc-verdict { background: rgba(240, 180, 41, .18); color: #a06d00; }
.cc-score[data-state="bad"] .cc-verdict { background: rgba(209, 67, 67, .13); color: #c03535; }
.cc-meter { position: relative; height: 6px; border-radius: 6px; background: var(--surface-2); box-shadow: var(--inset); margin: 12px 0 10px; }
.cc-meter i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: linear-gradient(90deg, #e05555, #f0b429 15%, #3dbb6f 30%, #1f9d55); background-size: 333px 100%; transition: width .45s cubic-bezier(.3, .8, .2, 1); }
.cc-meter b { position: absolute; top: -3px; width: 2px; height: 12px; border-radius: 2px; background: var(--line-strong); }

.cc-checks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 2px; }
.cc-checks li { display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.cc-checks li:last-child { border-bottom: 0; }
.cc-mark { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cc-mark .i { width: 13px; height: 13px; stroke-width: 2.6; }
.cc-checks .pass .cc-mark { background: #1f9d55; color: #fff; }
.cc-checks .fail .cc-mark { background: var(--surface-2); color: var(--faint); box-shadow: var(--inset); }
.cc-checks .fail > span:nth-child(2) { color: var(--muted); }
.cc-lvl { font: .74rem var(--mono); color: var(--faint); }

.cc-fix h2 { margin: 0 0 4px; }
.cc-fix > p { margin: 0 0 14px; font-size: .9rem; }
.cc-fixes { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cc-fixcard {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 8px; border: 0; border-radius: var(--r); cursor: pointer; text-align: left; font: inherit; color: var(--text);
  background: var(--surface-hi); box-shadow: var(--shadow-sm); transition: transform .2s cubic-bezier(.3, .8, .2, 1), box-shadow .2s; animation: pair-in .35s cubic-bezier(.2, .7, .2, 1) both;
}
.cc-fixcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cc-fixdemo { width: 52px; height: 52px; border-radius: var(--r-sm); display: grid; place-items: center; font-weight: 700; font-size: 1.15rem; box-shadow: inset 0 0 0 1px var(--line); flex: none; }
.cc-fixtxt { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.cc-fixtxt b { font: 600 .84rem var(--mono); }
.cc-fixtxt small { color: var(--muted); font-size: .78rem; }
.cc-use { font-size: .78rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; background: var(--ink); color: var(--ink-text); opacity: 0; transition: opacity .2s; }
.cc-fixcard:hover .cc-use, .cc-fixcard:focus-visible .cc-use { opacity: 1; }

.cc-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-presets button {
  border: 0; cursor: pointer; font: 500 .85rem var(--font); color: var(--text); padding: 8px 16px; border-radius: 999px;
  background: var(--surface-hi); box-shadow: var(--shadow-sm); transition: transform .15s;
}
.cc-presets button:hover { transform: translateY(-1px); }
@media (max-width: 640px) {
  .cc-preview { padding: 52px 20px 24px; min-height: 0; }
  .cc-use { opacity: 1; }
}
:root[data-theme="dark"] .cc-score[data-state="ok"] .cc-verdict { color: #4ade80; }
:root[data-theme="dark"] .cc-score[data-state="warn"] .cc-verdict { color: #fbbf24; }
:root[data-theme="dark"] .cc-score[data-state="bad"] .cc-verdict { color: #f87171; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .cc-score[data-state="ok"] .cc-verdict { color: #4ade80; }
  :root:not([data-theme="light"]) .cc-score[data-state="warn"] .cc-verdict { color: #fbbf24; }
  :root:not([data-theme="light"]) .cc-score[data-state="bad"] .cc-verdict { color: #f87171; }
}


/* ---------- Other values of a named color ---------- */
.alt-vals { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.alt-vals a { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px; border-radius: var(--r); background: var(--surface-hi); box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none; transition: transform .2s; }
.alt-vals a:hover { transform: translateY(-2px); }
.alt-vals i { grid-row: 1 / 3; width: 52px; height: 52px; border-radius: var(--r-sm); box-shadow: inset 0 0 0 1px var(--line); }
.alt-vals b { font: 600 .9rem var(--mono); align-self: end; }
.alt-vals span { font-size: .8rem; color: var(--muted); align-self: start; }
.color-name { font-family: var(--font); font-weight: 600; opacity: .9; }

/* ---------- Theme switch ----------
   The new theme spreads from the toggle as a soft, feathered circle
   (View Transitions); the old theme stays still underneath. Other
   browsers get a short color cross-fade instead. */
@property --tr { syntax: '<length>'; inherits: false; initial-value: 0px; }
:root.theme-vt .site-header,
:root.theme-vt .nav a[aria-current="page"] { view-transition-name: none; }
:root.theme-vt::view-transition-old(root) { animation: none; }
:root.theme-vt::view-transition-new(root) {
  --tr: 0px;
  -webkit-mask-image: radial-gradient(circle at var(--tx, 50%) var(--ty, 0px), #000 calc(var(--tr) - 140px), transparent var(--tr));
          mask-image: radial-gradient(circle at var(--tx, 50%) var(--ty, 0px), #000 calc(var(--tr) - 140px), transparent var(--tr));
  animation: theme-reveal .8s cubic-bezier(.45, .05, .2, 1) both;
}
@keyframes theme-reveal { to { --tr: calc(var(--tmax, 2400px) + 140px); } }

:root.theme-fade *, :root.theme-fade *::before, :root.theme-fade *::after {
  transition: background-color .45s ease, color .45s ease, border-color .45s ease, box-shadow .45s ease, fill .45s ease !important;
}

.theme-toggle svg { transition: transform .5s cubic-bezier(.3, 1.4, .5, 1), opacity .3s ease; }
.theme-toggle.spin svg { animation: toggle-spin .5s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes toggle-spin { from { transform: rotate(-90deg) scale(.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  :root.theme-vt::view-transition-new(root) { animation: none; -webkit-mask-image: none; mask-image: none; }
  .theme-toggle.spin svg { animation: none; }
  .pair, .cc-fixcard { animation: none; }
}
