/* ==========================================================================
   Chromatic Laboratory — Design Tokens & Styles
   ========================================================================== */
:root {
  color-scheme: dark;
  --bg: #08080c;
  --surface: #0f1017;
  --surface-2: #171822;
  --surface-3: #202230;
  --border: #262838;
  --border-strong: #373a4f;
  --tx: #f3f4f8;
  --tx-2: #a3a7bc;
  --tx-3: #6c7089;
  --accent: #6366f1;
  --ok: #22c55e;
  --warn: #f59e0b;
  --p3: #06b6d4;
  --err: #ef4444;
  --code-bg: #060609;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 0.375rem;
  --r-md: 0.5rem;
  --r-lg: 0.75rem;
  --r-xl: 1rem;
}

:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f4f5f8;
  --surface: #ffffff;
  --surface-2: #eef0f5;
  --surface-3: #e2e5ee;
  --border: #d7dbe6;
  --border-strong: #bcc3d4;
  --tx: #11131c;
  --tx-2: #4b5066;
  --tx-3: #666c84;
  --code-bg: #f8f9fc;
}

:root[data-theme='light'] .gamut-badge--srgb {
  color: #15803d;
  background: rgba(34, 197, 94, 0.12);
}

:root[data-theme='light'] .gamut-badge--p3 {
  color: #0e7490;
  background: rgba(6, 182, 212, 0.12);
}

:root[data-theme='light'] .gamut-badge--out {
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
}

:root[data-theme='light'] .badge--pass {
  color: #15803d;
  background: rgba(34, 197, 94, 0.14);
}

:root[data-theme='light'] .badge--fail {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.14);
}

:root[data-theme='light'] .alpha-tile__check {
  background-image: linear-gradient(45deg, #d8dce6 25%, transparent 25%),
    linear-gradient(-45deg, #d8dce6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dce6 75%),
    linear-gradient(-45deg, transparent 75%, #d8dce6 75%);
  background-color: #f1f3f8;
}

:root[data-theme='light'] .swatch-btn[aria-selected='true'] {
  border-color: var(--tx);
}

:root[data-theme='light'] .sem-card--base {
  outline: 2px solid var(--tx);
}

:root[data-theme='light'] .preset-btn[aria-pressed='true'] {
  border-color: var(--tx);
}

:root[data-theme='light'] .slider {
  border-color: var(--border);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--sans);
  line-height: 1.55;
  color: var(--tx);
  background: var(--bg);
  min-height: 100dvh;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--r-md);
  font-weight: 600;
}

.skip-link:focus {
  top: 1rem;
}

/* App Shell */
.app {
  max-width: 1380px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

@media (min-width: 768px) {
  .app {
    padding: 2rem 2rem 4rem;
  }
}

/* Header */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.5rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, oklch(0.72 0.2 165), oklch(0.62 0.24 265), oklch(0.68 0.22 340));
  box-shadow: 0 0 24px -6px oklch(0.65 0.22 260 / 0.5);
  flex-shrink: 0;
}

.brand__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand__sub {
  font-size: 0.8125rem;
  color: var(--tx-2);
}

.header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.625rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--r-md);
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: #5254e8;
}

.btn--secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--tx);
}

.btn--secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}

.btn--ghost {
  color: var(--tx-2);
  padding: 0.375rem 0.625rem;
}

.btn--ghost:hover {
  color: var(--tx);
  background: var(--surface-3);
}

.btn--xs {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

/* Gamut Pill */
.gamut-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--mono);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.gamut-badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.gamut-badge--srgb {
  border-color: rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.gamut-badge--srgb .gamut-badge__dot {
  background: var(--ok);
}

.gamut-badge--p3 {
  border-color: rgba(6, 182, 212, 0.45);
  color: #67e8f9;
}

.gamut-badge--p3 .gamut-badge__dot {
  background: var(--p3);
}

.gamut-badge--out {
  border-color: rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}

.gamut-badge--out .gamut-badge__dot {
  background: var(--warn);
}

/* Browser Support Banner */
.alert {
  padding: 0.875rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: var(--r-lg);
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-size: 0.875rem;
}

/* Workspace Grid */
.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .workspace {
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 2rem;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .sidebar {
    position: sticky;
    top: 1.25rem;
  }
}

.content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  min-width: 0;
}

/* Panels & Cards */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.panel__title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tx-2);
}

.panel__body {
  padding: 1.25rem;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-sub {
  font-size: 0.8125rem;
  color: var(--tx-3);
}

/* Color Preview */
.preview-box {
  position: relative;
  height: 112px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  margin-bottom: 1.125rem;
}

.preview-box__swatch {
  width: 100%;
  height: 100%;
  transition: background-color 0.08s linear;
}

.preview-box__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(8, 8, 12, 0.78), rgba(8, 8, 12, 0.05) 60%);
  pointer-events: none;
}

.preview-box__chips {
  position: absolute;
  left: 0.625rem;
  right: 0.625rem;
  bottom: 0.625rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  background: rgba(8, 8, 12, 0.82);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-sm);
  backdrop-filter: blur(8px);
}

.chip-btn:hover {
  background: rgba(20, 20, 30, 0.96);
  border-color: rgba(255, 255, 255, 0.3);
}

.chip-btn svg {
  width: 12px;
  height: 12px;
  opacity: 0.75;
}

/* Sliders */
.control {
  margin-bottom: 1rem;
}

.control__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.control__label {
  font-size: 0.8125rem;
  font-weight: 600;
}

.control__num {
  width: 74px;
  padding: 0.2rem 0.45rem;
  text-align: right;
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.control__num:focus {
  border-color: var(--accent);
  outline: none;
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  border-radius: 9999px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.slider--l {
  background: linear-gradient(to right, #000, #888, #fff);
}

.slider--c {
  background: linear-gradient(to right, var(--c-min, #808080), var(--c-max, #00e5a3));
}

.slider--h {
  background: linear-gradient(
    to right,
    oklch(0.65 0.2 0),
    oklch(0.65 0.2 60),
    oklch(0.65 0.2 120),
    oklch(0.65 0.2 180),
    oklch(0.65 0.2 240),
    oklch(0.65 0.2 300),
    oklch(0.65 0.2 360)
  );
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #08080c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #08080c;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* Gamut Boundary Meter */
.gamut-panel {
  margin-top: 0.65rem;
  padding: 0.75rem;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
}

.gamut-meter {
  position: relative;
  height: 8px;
  border-radius: 9999px;
  background: var(--surface-3);
  overflow: hidden;
  margin: 0.5rem 0;
}

.gamut-meter__srgb {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  background: rgba(34, 197, 94, 0.45);
}

.gamut-meter__p3 {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(6, 182, 212, 0.45);
}

.gamut-meter__cursor {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 3px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.gamut-panel__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  color: var(--tx-2);
  font-family: var(--mono);
  font-size: 0.72rem;
}

.gamut-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

/* Import HEX & Presets */
.hex-import {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.hex-import__row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.color-ring-picker {
  position: relative;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9999px;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.25), 0 3px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  overflow: hidden;
  background: #0d9488;
  transition: transform 0.15s ease;
}

.color-ring-picker:hover {
  transform: scale(1.08);
}

.color-ring-picker:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.color-ring-picker input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.input-field {
  flex: 1;
  min-width: 0;
  padding: 0.45rem 0.7rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.input-field:focus {
  border-color: var(--accent);
  outline: none;
}

.input-msg {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  color: var(--err);
}

.input-msg--warn {
  color: var(--warn);
}

.presets {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.presets__grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.preset-btn {
  height: 30px;
  border-radius: var(--r-md);
  border: 2px solid transparent;
  transition: transform 0.12s, border-color 0.12s;
}

.preset-btn:hover {
  transform: scale(1.06);
}

.preset-btn[aria-pressed='true'] {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--bg);
}

/* 50-900 Scale Strip */
.scale-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

@media (min-width: 640px) {
  .scale-strip {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1200px) {
  .scale-strip {
    grid-template-columns: repeat(10, 1fr);
  }
}

.swatch-btn {
  position: relative;
  height: 82px;
  padding: 0.5rem;
  border-radius: var(--r-md);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  transition: transform 0.12s, border-color 0.12s;
}

.swatch-btn:hover {
  transform: translateY(-2px);
}

.swatch-btn[aria-selected='true'] {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
}

.swatch-btn__step {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 700;
}

.swatch-btn__hex {
  font-family: var(--mono);
  font-size: 0.65rem;
  opacity: 0.85;
}

.swatch-btn__gamut {
  position: absolute;
  top: 6px;
  right: 6px;
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: rgba(8, 8, 12, 0.6);
  color: #67e8f9;
}

.tone--dark {
  color: #0b0c10;
}

.tone--light {
  color: #f8fafc;
}

/* Swatch Inspector */
.inspector {
  margin-top: 0.75rem;
  padding: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.65rem;
}

.inspector__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.55rem 0.75rem;
  background: var(--surface-2);
  border-radius: var(--r-md);
  font-size: 0.75rem;
}

.inspector__label {
  color: var(--tx-3);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inspector__val {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--mono);
  color: var(--tx);
  white-space: nowrap;
}

/* Semantic Scale (Chromatic Laboratory Signature) */
.semantic-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

@media (min-width: 768px) {
  .semantic-strip {
    grid-template-columns: repeat(9, 1fr);
  }
}

.sem-card {
  height: 76px;
  padding: 0.5rem;
  border-radius: var(--r-md);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.12s;
}

.sem-card:hover {
  transform: translateY(-2px);
}

.sem-card--base {
  outline: 2px solid rgba(255, 255, 255, 0.75);
}

.sem-card__name {
  font-size: 0.72rem;
  font-weight: 700;
}

.sem-card__meta {
  font-family: var(--mono);
  font-size: 0.65rem;
  opacity: 0.85;
}

/* Two Column Lab Row */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Alpha Variants */
.alpha-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .alpha-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.alpha-tile {
  position: relative;
  height: 76px;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  text-align: left;
}

.alpha-tile__check {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(45deg, #1b1d28 25%, transparent 25%),
    linear-gradient(-45deg, #1b1d28 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1b1d28 75%),
    linear-gradient(-45deg, transparent 75%, #1b1d28 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-color: #11131b;
}

.alpha-tile__fill {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0.55rem 0.7rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.alpha-tile__pct {
  display: inline-block;
  width: fit-content;
  padding: 0.15rem 0.45rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 4px;
  background: rgba(8, 8, 12, 0.78);
  color: #fff;
}

.alpha-tile__copy {
  display: inline-block;
  width: fit-content;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(8, 8, 12, 0.72);
  font-family: var(--mono);
  font-size: 0.65rem;
  color: #fff;
}

/* WCAG Matrix */
.wcag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.65rem;
}

.wcag-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.wcag-card__name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
}

.wcag-card__ratio {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--tx-3);
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.5rem;
  border-radius: var(--r-sm);
  font-size: 0.7rem;
  font-weight: 700;
}

.badge--pass {
  background: rgba(34, 197, 94, 0.16);
  color: #4ade80;
}

.badge--fail {
  background: rgba(239, 68, 68, 0.16);
  color: #f87171;
}

.seg-toggle {
  display: inline-flex;
  padding: 0.2rem;
  gap: 0.2rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.seg-toggle__btn {
  padding: 0.28rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--tx-2);
  border-radius: var(--r-sm);
  transition: background-color 0.12s, color 0.12s;
}

.seg-toggle__btn:hover {
  color: var(--tx);
}

.seg-toggle__btn[aria-pressed='true'] {
  background: var(--accent);
  color: #fff;
}

/* Live UI Preview */
.preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.875rem;
}

@media (min-width: 768px) {
  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.ui-card {
  padding: 1.125rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
}

.ui-card__eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.75rem;
  opacity: 0.75;
}

.ui-card__btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ui-btn {
  padding: 0.45rem 0.9rem;
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  font-weight: 600;
}

.ui-card h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.ui-card p {
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* Hue Interpolation & Blend Mode */
.interp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.875rem;
}

.interp-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.interp-card__grad {
  height: 48px;
}

.interp-card__steps {
  display: flex;
  height: 20px;
}

.interp-card__step {
  flex: 1;
}

.interp-card__meta {
  padding: 0.75rem;
}

.interp-card__title {
  font-size: 0.8125rem;
  font-weight: 700;
}

.interp-card__desc {
  font-size: 0.72rem;
  color: var(--tx-3);
}

.blend-stage {
  position: relative;
  height: 184px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.blend-stage--light {
  background: #f4f5f7;
}

.blend-circles {
  position: relative;
  width: 210px;
  height: 150px;
}

.blend-circle {
  position: absolute;
  width: 102px;
  height: 102px;
  border-radius: 50%;
  transition: mix-blend-mode 0.15s;
}

.blend-circle--1 {
  left: 54px;
  top: 8px;
}

.blend-circle--2 {
  left: 20px;
  top: 48px;
}

.blend-circle--3 {
  right: 20px;
  top: 48px;
}

.select-pill {
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  font-size: 0.75rem;
  font-family: var(--mono);
}

/* Exporters */
.export-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

.tab-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--tx-2);
  border-radius: var(--r-sm);
}

.tab-btn[aria-pressed='true'] {
  background: var(--accent);
  color: #fff;
}

.token-prefix {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--tx-2);
}

.token-prefix input {
  width: 110px;
  padding: 0.35rem 0.55rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}

.code-panel {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

.code-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.code-panel__file {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--tx-2);
}

.code-panel__body {
  padding: 1rem;
  max-height: 390px;
  overflow: auto;
}

.code-panel__body pre {
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre;
}

/* Info / FAQ */
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 1.25rem 1.5rem;
  color: var(--tx-2);
  font-size: 0.9rem;
}

.info-card ul {
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.info-card strong {
  color: var(--tx);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.faq-item h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--tx);
  margin-bottom: 0.3rem;
}

/* Footer */
.footer {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--tx-3);
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer__links a:hover {
  color: var(--tx);
}

/* Toast */
.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 60;
  padding: 0.65rem 1rem;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--tx);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}

.toast[data-open='true'] {
  opacity: 1;
  transform: translateY(0);
}
