:root {
  --accent: #7c3aed;
  --accent-rgb: 124, 58, 237;
  --bg: #f7f7fb;
  --card: rgba(255, 255, 255, 0.86);
  --card-solid: #ffffff;
  --text: #17151f;
  --muted: #716d7d;
  --line: rgba(35, 28, 53, 0.1);
  --soft: #f3f1f7;
  --shadow: 0 18px 55px rgba(41, 30, 73, 0.08), 0 2px 8px rgba(41, 30, 73, 0.05);
  --radius: 20px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #111016;
  --card: rgba(27, 25, 34, 0.88);
  --card-solid: #1b1922;
  --text: #f6f4fb;
  --muted: #aaa5b5;
  --line: rgba(255, 255, 255, 0.1);
  --soft: #24212c;
  --shadow: 0 20px 65px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .4s ease, color .4s ease;
  overflow-x: hidden;
}
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; stroke-width: 1.9; }

.ambient { position: fixed; z-index: -1; border-radius: 50%; filter: blur(100px); opacity: .17; pointer-events: none; transition: background 1s ease; animation: drift 14s ease-in-out infinite alternate; }
.ambient-one { width: 42vw; height: 42vw; top: 7%; left: -12%; background: var(--accent); }
.ambient-two { width: 34vw; height: 34vw; right: -8%; top: 38%; background: hsl(calc(var(--hue, 265) + 105), 80%, 62%); animation-delay: -5s; }
@keyframes drift { to { transform: translate(8vw, 7vh) scale(1.13); } }

.container { width: min(1160px, calc(100% - 32px)); margin-inline: auto; }
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 76%, transparent); backdrop-filter: blur(20px); }
.navbar { height: 74px; display: flex; justify-content: space-between; align-items: center; }
.brand { display: inline-flex; align-items: center; gap: 11px; font: 700 20px "Space Grotesk", sans-serif; letter-spacing: -.04em; }
.brand.small { font-size: 17px; }
.brand-mark { width: 29px; height: 29px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; transform: rotate(8deg); }
.brand-mark span { border-radius: 4px; background: var(--accent); }
.brand-mark span:nth-child(2) { opacity: .72; }.brand-mark span:nth-child(3) { opacity: .52; }.brand-mark span:nth-child(4) { opacity: .28; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-button, .github-link { height: 42px; border: 1px solid var(--line); background: color-mix(in srgb, var(--card-solid) 62%, transparent); backdrop-filter: blur(10px); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: .2s ease; }
.icon-button { width: 42px; }
.github-link { padding: 0 14px; gap: 8px; font-size: 14px; font-weight: 600; }
.github-link .external-icon { width: 14px; opacity: .55; }
.icon-button:hover, .github-link:hover { transform: translateY(-2px); border-color: rgba(var(--accent-rgb), .45); box-shadow: 0 8px 25px rgba(var(--accent-rgb), .13); }

.page-shell { padding-top: 76px; padding-bottom: 40px; }
.hero { max-width: 780px; margin: 0 auto 56px; text-align: center; }
.eyebrow { width: max-content; max-width: 100%; margin: 0 auto 16px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; }
.eyebrow span { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .13); }
.hero h1 { margin: 0; font: 700 clamp(44px, 7vw, 74px)/.99 "Space Grotesk", sans-serif; letter-spacing: -.065em; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero > p:not(.eyebrow) { max-width: 610px; margin: 22px auto 0; color: var(--muted); font-size: 17px; line-height: 1.7; }
.hero-actions { margin-top: 28px; display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.button { border: 0; border-radius: 12px; min-height: 45px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .18s ease, box-shadow .2s ease, background .2s ease; }
.button:hover { transform: translateY(-2px); }.button:active { transform: scale(.96); }
.button.primary { color: white; background: var(--accent); box-shadow: 0 10px 30px rgba(var(--accent-rgb), .27); }
.button.primary:hover { box-shadow: 0 13px 36px rgba(var(--accent-rgb), .35); }
.button.secondary { background: var(--card-solid); border: 1px solid var(--line); box-shadow: 0 5px 20px rgba(28, 21, 48, .05); }
.button.compact { min-height: 39px; padding: 0 13px; }
.button.ghost { background: transparent; border: 1px solid var(--line); }
.button.dark { color: var(--card-solid); background: var(--text); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(18px); transition: background .4s, border-color .4s; }
.workspace-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 18px; }
.picker-card, .preview-card, .palette-card, .tool-card, .library-card { padding: 24px; }
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.card-heading > div:first-child { display: flex; align-items: center; gap: 10px; }
.card-heading h2 { margin: 0; font: 700 18px "Space Grotesk", sans-serif; letter-spacing: -.035em; }
.step { font: 600 10px "Space Grotesk", sans-serif; color: var(--accent); border: 1px solid rgba(var(--accent-rgb), .2); background: rgba(var(--accent-rgb), .08); border-radius: 6px; padding: 4px 5px; }
.native-color-wrap { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; }
.native-color-wrap input, .gradient-controls input, .contrast-colors input { width: 27px; height: 27px; padding: 0; border: 0; background: none; border-radius: 8px; overflow: hidden; cursor: pointer; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; } input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }

.visual-picker { position: relative; width: 100%; height: 310px; border-radius: 15px; cursor: crosshair; overflow: hidden; background: linear-gradient(to top, #000, transparent), linear-gradient(to right, #fff, transparent), hsl(265, 100%, 50%); touch-action: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.picker-thumb { position: absolute; left: 83%; top: 7%; width: 22px; height: 22px; border: 3px solid white; border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,.45); transform: translate(-50%, -50%); pointer-events: none; }
.hue-control { display: block; margin-top: 15px; }
.hue-control input { width: 100%; height: 12px; appearance: none; border: 0; border-radius: 999px; background: linear-gradient(to right,#f00,#ff0,#0f0,#0ff,#00f,#f0f,#f00); cursor: pointer; }
.hue-control input::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; border: 3px solid white; border-radius: 50%; background: hsl(var(--hue, 265),100%,50%); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.picker-meta { margin-top: 10px; display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }
.picker-meta span:last-child { display: flex; gap: 5px; align-items: center; }.picker-meta svg { width: 13px; }

.preview-card { display: flex; flex-direction: column; }
.preview-swatch { min-height: 250px; padding: 18px; position: relative; display: flex; align-items: flex-end; border-radius: 15px; color: white; background: var(--accent); overflow: hidden; transition: background .25s ease; }
.preview-swatch::after { content: ""; position: absolute; width: 180px; height: 180px; right: -55px; top: -70px; border-radius: 50%; background: rgba(255,255,255,.11); }
.preview-badge { position: absolute; left: 16px; top: 16px; display: flex; gap: 7px; align-items: center; padding: 7px 10px; border-radius: 99px; background: rgba(0,0,0,.18); backdrop-filter: blur(8px); font-size: 11px; font-weight: 600; }
.pulse-dot { width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.8s infinite; } @keyframes pulse { 50% { opacity: .45; transform: scale(.7); } }
.swatch-copy { position: absolute; right: 16px; top: 16px; z-index: 1; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.24); border-radius: 10px; color: white; background: rgba(0,0,0,.14); cursor: pointer; }
.preview-label { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 3px; }.preview-label strong { font: 700 24px "Space Grotesk", sans-serif; }.preview-label span { opacity: .88; font: 500 13px "DM Mono", monospace; letter-spacing: .02em; }
.format-list { margin-top: 13px; display: grid; gap: 2px; }
.format-row { min-height: 44px; display: grid; grid-template-columns: 45px 1fr auto; align-items: center; border-bottom: 1px solid var(--line); }
.format-row:last-child { border: 0; }.format-row > span { color: var(--muted); font-size: 10px; font-weight: 700; }.format-row code { font: 500 12.5px "DM Mono", monospace; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.copy-button { border: 0; background: transparent; color: var(--muted); font-size: 11px; display: flex; gap: 5px; align-items: center; cursor: pointer; }.copy-button svg { width: 13px; }

.palette-card { margin-top: 18px; }.palette-heading { margin-bottom: 14px; }.palette-actions { display: flex; gap: 8px; }
.palette-tabs { display: flex; width: fit-content; max-width: 100%; gap: 4px; padding: 4px; margin-bottom: 18px; overflow-x: auto; background: var(--soft); border-radius: 11px; }
.palette-tab { border: 0; border-radius: 8px; padding: 9px 13px; white-space: nowrap; color: var(--muted); background: transparent; font-size: 12px; font-weight: 600; cursor: pointer; }
.palette-tab.active { color: var(--text); background: var(--card-solid); box-shadow: 0 2px 8px rgba(28,21,48,.08); }
.palette-swatches { min-height: 190px; display: grid; grid-template-columns: repeat(5, 1fr); overflow: hidden; border-radius: 15px; }
.palette-swatch { position: relative; min-height: 190px; border: 0; display: flex; align-items: flex-end; justify-content: center; padding: 15px 7px; color: white; cursor: pointer; transition: flex .25s, transform .2s; }
.palette-swatch:hover { transform: scale(1.025); z-index: 2; box-shadow: 0 0 30px rgba(0,0,0,.2); }.palette-swatch span { padding: 6px 9px; border-radius: 8px; background: rgba(0,0,0,.24); backdrop-filter: blur(5px); font: 600 11px monospace; }
.export-bar { margin-top: 17px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }.export-bar p { margin: 0; color: var(--muted); display: flex; gap: 7px; align-items: center; font-size: 11px; }.export-bar p svg { width: 15px; color: #16a34a; }.export-bar > div { display: flex; gap: 7px; }

.tools-grid, .library-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }.heading-icon { color: var(--accent); }
.gradient-preview { height: 150px; border-radius: 14px; display: grid; place-items: center; color: white; background: linear-gradient(135deg,#7c3aed,#22d3ee); box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }.gradient-preview span { padding: 7px 11px; border-radius: 9px; background: rgba(0,0,0,.16); font-size: 11px; font-weight: 600; }
.gradient-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 9px; align-items: end; margin-top: 17px; }.gradient-controls label, .contrast-colors label, .select-label { color: var(--muted); font-size: 11px; font-weight: 600; }.gradient-controls label > span, .contrast-colors label > span { min-height: 43px; margin-top: 7px; padding: 6px 9px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }.gradient-controls code, .contrast-colors code { color: var(--text); font-size: 12px; }
.swap-button { width: 35px; height: 35px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 50%; background: var(--card-solid); cursor: pointer; }.swap-button svg { width: 14px; }
.select-label { display: block; margin-top: 13px; }.select-label select { width: 100%; height: 41px; margin-top: 7px; padding: 0 11px; color: var(--text); border: 1px solid var(--line); border-radius: 10px; background: var(--soft); outline: none; }
.code-output { min-height: 47px; margin-top: 13px; padding: 9px 10px 9px 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 10px; background: #17151f; color: #e9e5f1; }.code-output code { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.code-output button { color: white; border: 0; background: transparent; cursor: pointer; }

.contrast-demo { height: 150px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--accent); color: white; text-align: center; }.contrast-demo strong { font: 700 25px "Space Grotesk", sans-serif; }.contrast-demo span { margin-top: 5px; font-size: 12px; opacity: .85; }
.contrast-colors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 17px; }.contrast-result { margin-top: 15px; display: flex; justify-content: space-between; align-items: center; }.contrast-result > div:first-child { display: flex; flex-direction: column; gap: 3px; }.contrast-result span { color: var(--muted); font-size: 10px; }.contrast-result strong { font: 700 24px "Space Grotesk", sans-serif; }.wcag-badges { display: flex; gap: 6px; }.wcag-badges span { padding: 7px 9px; border-radius: 8px; display: flex; align-items: center; gap: 4px; font-weight: 700; }.wcag-badges svg { width: 12px; }.wcag-badges .pass { color: #15803d; background: #dcfce7; }.wcag-badges .fail { color: #b91c1c; background: #fee2e2; }.contrast-note { margin: 11px 0 0; color: var(--muted); font-size: 11px; }

.library-card { min-height: 160px; }.text-button { border: 0; color: var(--muted); background: none; font-size: 11px; cursor: pointer; }.count-badge { color: var(--muted); font-size: 11px; }.mini-swatches { display: flex; gap: 9px; flex-wrap: wrap; }.mini-swatch { width: 42px; height: 42px; border-radius: 11px; border: 3px solid var(--card-solid); box-shadow: 0 0 0 1px var(--line); cursor: pointer; transition: transform .2s; }.mini-swatch:hover { transform: translateY(-3px) scale(1.05); }
.saved-palettes { display: grid; gap: 8px; }.saved-palette { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; }.saved-strip { height: 30px; display: flex; overflow: hidden; border-radius: 7px; cursor: pointer; }.saved-strip span { flex: 1; }.delete-saved { width: 30px; height: 30px; border: 0; color: var(--muted); background: transparent; cursor: pointer; }.delete-saved svg { width: 15px; }.empty-state { margin: 4px 0; color: var(--muted); font-size: 12px; }
.site-footer { min-height: 110px; padding-block: 35px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; }.site-footer > p { margin: 0; text-align: center; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 11px 16px; display: flex; align-items: center; gap: 8px; border-radius: 12px; background: #17151f; color: white; box-shadow: 0 10px 40px rgba(0,0,0,.25); font-size: 13px; font-weight: 600; opacity: 0; visibility: hidden; transition: .25s ease; }.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }.toast svg { width: 16px; color: #86efac; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .35); outline-offset: 2px; }

@media (max-width: 820px) {
  .workspace-grid, .tools-grid, .library-grid { grid-template-columns: 1fr; }
  .visual-picker { height: 270px; }
  .preview-card { min-height: auto; }.preview-swatch { min-height: 230px; }
}
@media (max-width: 620px) {
  .container { width: min(100% - 22px, 1160px); }.navbar { height: 66px; }.github-link span, .github-link .external-icon { display: none; }.github-link { width: 42px; padding: 0; }
  .page-shell { padding-top: 52px; }.hero { margin-bottom: 38px; }.hero h1 { font-size: clamp(41px, 13vw, 58px); }.hero > p:not(.eyebrow) { font-size: 15px; }
  .picker-card, .preview-card, .palette-card, .tool-card, .library-card { padding: 17px; }.card-heading { align-items: flex-start; }.native-color-wrap span { display: none; }
  .visual-picker { height: 230px; }.palette-heading { flex-direction: column; }.palette-actions { align-self: stretch; }.palette-actions .button { flex: 1; }
  .palette-tabs { width: 100%; }.palette-swatches { min-height: 260px; grid-template-columns: repeat(6,1fr); grid-template-rows: 1fr 1fr; }.palette-swatch { min-height: 130px; grid-column: span 2; }.palette-swatch:nth-child(4), .palette-swatch:nth-child(5) { grid-column: span 3; }.palette-swatch span { font-size: 9px; }
  .export-bar { align-items: flex-start; flex-direction: column; }.export-bar > div { width: 100%; }.export-bar .button { flex: 1; }
  .tool-card { min-width: 0; overflow: hidden; }
  .tool-card .card-heading { align-items: center; }
  .gradient-controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "from to" "swap swap"; align-items: start; }
  .gradient-controls label:first-child { grid-area: from; }
  .gradient-controls label:last-child { grid-area: to; }
  .gradient-controls label > span, .contrast-colors label > span { min-width: 0; }
  .gradient-controls code, .contrast-colors code { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
  .swap-button { grid-area: swap; justify-self: center; margin: -2px 0 0; transform: rotate(90deg); }
  .code-output { min-width: 0; }
  .code-output code { min-width: 0; }
  .contrast-demo, .gradient-preview { height: 135px; }
  .site-footer { flex-direction: column; text-align: center; }.format-row { grid-template-columns: 42px 1fr auto; }.copy-button span { display: none; }
}
@media (max-width: 430px) {
  .contrast-colors { grid-template-columns: 1fr; }
  .contrast-result { align-items: flex-end; }
  .contrast-result strong { font-size: 22px; }
  .contrast-demo strong { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
