/* ==========================================================================
   DevCraft Studio — design tokens, components and motion.
   Utilities come from css/tailwind.css (compiled); this file owns the system.
   ========================================================================== */

/* ---------- Fonts (self-hosted, latin subset covers EN + ES) ---------- */
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/inter-var-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/jetbrains-mono-var-latin.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* Neutrals: a faintly warm graphite, never pure grey */
  --bg: #f6f6f4;
  --bg-sunken: #efefec;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --surface-hover: #f3f3f0;
  --border: rgba(24, 24, 20, 0.08);
  --border-strong: rgba(24, 24, 20, 0.14);
  --text: #17171a;
  --text-2: #55555c;
  --text-3: #85858c;

  /* Accent: deep cobalt */
  --accent: #2a5fe8;
  --accent-hover: #2253d4;
  --accent-soft: rgba(42, 95, 232, 0.09);
  --accent-ring: rgba(42, 95, 232, 0.32);
  --on-accent: #ffffff;

  --success: #16804a;
  --danger: #c4322c;
  --danger-soft: rgba(196, 50, 44, 0.08);
  --warning: #9a6200;

  --code-bg: #f7f7f5;
  --tk-prop: #2a5fe8;
  --tk-num: #b2541a;
  --tk-str: #16804a;
  --tk-comment: #85858c;
  --tk-key: #7a3ec2;

  --shadow-1: 0 1px 2px rgba(20, 20, 15, 0.04), 0 1px 1px rgba(20, 20, 15, 0.03);
  --shadow-2: 0 1px 2px rgba(20, 20, 15, 0.04), 0 4px 12px rgba(20, 20, 15, 0.05), 0 12px 32px rgba(20, 20, 15, 0.05);
  --shadow-pop: 0 2px 6px rgba(20, 20, 15, 0.06), 0 18px 48px rgba(20, 20, 15, 0.14);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);

  --glass-bg: rgba(246, 246, 244, 0.78);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #111113;
  --bg-sunken: #0c0c0e;
  --surface: #18181b;
  --surface-2: #1c1c20;
  --surface-hover: #222227;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.13);
  --text: #f2f2f3;
  --text-2: #a8a8b0;
  --text-3: #75757d;

  --accent: #7d9bff;
  --accent-hover: #93acff;
  --accent-soft: rgba(125, 155, 255, 0.12);
  --accent-ring: rgba(125, 155, 255, 0.4);
  --on-accent: #0d1430;

  --success: #4cc283;
  --danger: #ff7a70;
  --danger-soft: rgba(255, 122, 112, 0.1);
  --warning: #e6b450;

  --code-bg: #141417;
  --tk-prop: #8fb0ff;
  --tk-num: #f0a36b;
  --tk-str: #7fd6a2;
  --tk-comment: #6c6c74;
  --tk-key: #c9a2ff;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.28);
  --shadow-pop: 0 2px 8px rgba(0, 0, 0, 0.4), 0 24px 64px rgba(0, 0, 0, 0.5);

  --glass-bg: rgba(17, 17, 19, 0.74);
}

/* ---------- Base ---------- */
html {
  font-family: var(--font-sans);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}
html:has(dialog[open]) {
  overflow: hidden;
}
body {
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.55;
  min-height: 100dvh;
}
::selection {
  background: var(--accent-soft);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}
.icon {
  flex: none;
}
code,
pre,
kbd,
.mono {
  font-family: var(--font-mono);
  font-feature-settings: 'calt' 0;
}
.tabular {
  font-variant-numeric: tabular-nums;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--bg);
  font-weight: 550;
  transform: translateY(-160%);
  transition: transform 200ms var(--ease-out);
}
.skip-link:focus {
  transform: none;
}

/* Theme switch cross-fade (only colours; no layout motion) */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, fill 200ms ease !important;
}

/* ---------- Typography ---------- */
.display {
  font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.85rem);
  line-height: 1.06;
  letter-spacing: -0.032em;
  font-weight: 650;
  text-wrap: balance;
}
.h1 {
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.024em;
  font-weight: 650;
  text-wrap: balance;
}
.h2 {
  font-size: 1.0625rem;
  line-height: 1.3;
  letter-spacing: -0.012em;
  font-weight: 600;
}
.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  font-weight: 550;
  color: var(--text-3);
}
.lede {
  color: var(--text-2);
  font-size: 1.0625rem;
  line-height: 1.55;
  max-width: 62ch;
  text-wrap: pretty;
}
.muted {
  color: var(--text-2);
}
.faint {
  color: var(--text-3);
}

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100dvh;
}
html[data-sidebar='collapsed'] .app {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 12px;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
  z-index: 40;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 6px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  color: var(--text);
  white-space: nowrap;
}
.brand__mark {
  width: 28px;
  height: 28px;
  flex: none;
}
.brand__name {
  font-weight: 650;
  letter-spacing: -0.02em;
  font-size: 0.98rem;
}
.brand__name span {
  color: var(--text-3);
  font-weight: 500;
}
.nav-label {
  padding: 14px 10px 6px;
  font-size: 0.72rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  color: var(--text-3);
  white-space: nowrap;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav__link .icon {
  color: var(--text-3);
  transition: color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .nav__link:hover {
    background: var(--surface-hover);
    color: var(--text);
  }
}
.nav__link[aria-current='page'] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1), inset 0 0 0 1px var(--border);
}
.nav__link[aria-current='page'] .icon {
  color: var(--accent);
}
.nav__text {
  transition: opacity 200ms ease;
}
.sidebar__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pro-card {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transition: opacity 200ms ease;
}
.pro-card__title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.875rem;
}
.pro-card__title .icon {
  color: var(--accent);
}
.pro-card p {
  margin: 4px 0 10px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-2);
}
html[data-pro] .pro-card [data-pro-hide] {
  display: none;
}
.pro-card [data-pro-show] {
  display: none;
}
html[data-pro] .pro-card [data-pro-show] {
  display: block;
}

.collapse-btn {
  justify-content: flex-start;
}
html[data-sidebar='collapsed'] .collapse-btn .icon {
  transform: scaleX(-1);
}

/* Collapsed rail */
html[data-sidebar='collapsed'] .sidebar .nav__text,
html[data-sidebar='collapsed'] .sidebar .brand__name,
html[data-sidebar='collapsed'] .sidebar .nav-label,
html[data-sidebar='collapsed'] .sidebar .pro-card {
  opacity: 0;
  pointer-events: none;
}
html[data-sidebar='collapsed'] .sidebar .nav-label {
  height: 14px;
  padding: 0;
}
html[data-sidebar='collapsed'] .sidebar .pro-card {
  display: none;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Topbar: translucent material, content scrolls beneath */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}
.topbar.is-scrolled {
  border-bottom-color: var(--border);
}
.topbar__title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--text-2);
  white-space: nowrap;
}
.topbar__title strong {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.menu-btn {
  display: none;
}

.content {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px 28px 56px;
}
@media (min-width: 1440px) {
  .content {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}
.rail {
  display: none;
}
@media (min-width: 1440px) {
  .rail {
    display: block;
  }
  .rail__sticky {
    position: sticky;
    top: calc(var(--topbar-h) + 28px);
  }
}

@media (max-width: 1023px) {
  .app,
  html[data-sidebar='collapsed'] .app {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(288px, 86vw);
    background: var(--surface);
    box-shadow: var(--shadow-pop);
    transform: translateX(-104%);
    transition: transform 300ms var(--ease-drawer);
    visibility: hidden;
  }
  html.nav-open .sidebar {
    transform: none;
    visibility: visible;
  }
  html[data-sidebar='collapsed'] .sidebar .nav__text,
  html[data-sidebar='collapsed'] .sidebar .brand__name,
  html[data-sidebar='collapsed'] .sidebar .nav-label,
  html[data-sidebar='collapsed'] .sidebar .pro-card {
    opacity: 1;
    pointer-events: auto;
  }
  html[data-sidebar='collapsed'] .sidebar .pro-card {
    display: block;
  }
  .collapse-btn {
    display: none !important;
  }
  .menu-btn {
    display: inline-flex;
  }
  .scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(10, 10, 12, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
  }
  html.nav-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }
  .topbar {
    padding: 0 16px;
  }
  .content {
    padding: 20px 16px 48px;
  }
}
@media (min-width: 1024px) {
  .scrim {
    display: none;
  }
}

/* ---------- Buttons ---------- */
.btn {
  --btn-h: 36px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--btn-h);
  padding: 0 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 550;
  letter-spacing: -0.005em;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, color 150ms ease, box-shadow 150ms ease,
    border-color 150ms ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn--sm {
  --btn-h: 30px;
  padding: 0 10px;
  font-size: 0.8125rem;
  border-radius: 8px;
}
.btn--lg {
  --btn-h: 46px;
  padding: 0 20px;
  font-size: 0.95rem;
  border-radius: 12px;
}
.btn--icon {
  width: var(--btn-h);
  padding: 0;
}
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(20, 30, 80, 0.18);
}
.btn--secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-1);
}
.btn--ghost {
  color: var(--text-2);
}
.btn--dark {
  background: var(--text);
  color: var(--bg);
}
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover {
    background: var(--accent-hover);
  }
  .btn--secondary:hover {
    background: var(--surface-hover);
  }
  .btn--ghost:hover {
    background: var(--surface-hover);
    color: var(--text);
  }
  .btn--dark:hover {
    opacity: 0.88;
  }
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}
/* Inline loading: label fades, spinner takes its place; width stays stable */
.btn[data-loading] {
  pointer-events: none;
}
.btn[data-loading] > * {
  opacity: 0;
}
.btn[data-loading]::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 600ms linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Copy button morph: copy icon → check */
.copy-btn__icons {
  position: relative;
  width: 15px;
  height: 15px;
  display: inline-grid;
}
.copy-btn__icons .icon {
  grid-area: 1 / 1;
  transition: opacity 200ms ease, transform 200ms var(--ease-out), filter 200ms ease;
}
.copy-btn__check {
  opacity: 0;
  transform: scale(0.6);
  filter: blur(2px);
}
.is-copied .copy-btn__copy {
  opacity: 0;
  transform: scale(0.6);
  filter: blur(2px);
}
.is-copied .copy-btn__check {
  opacity: 1;
  transform: none;
  filter: none;
}

/* ---------- Segmented control ---------- */
.segmented {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg-sunken);
  box-shadow: inset 0 0 0 1px var(--border);
  isolation: isolate;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.segmented__thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 0.5px var(--border-strong);
  transition: transform 300ms var(--ease-out), width 300ms var(--ease-out);
  z-index: -1;
}
.segmented__opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 11px;
  border-radius: 7px;
  font-size: 0.8125rem;
  font-weight: 520;
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
  transition: color 150ms ease;
}
.segmented__opt[aria-checked='true'] {
  color: var(--text);
}
.segmented--sm .segmented__opt {
  height: 24px;
  padding: 0 9px;
  font-size: 0.78rem;
}
.segmented__lock {
  display: inline-flex;
  color: var(--text-3);
}
html[data-pro] .segmented__lock {
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  .segmented__opt:hover {
    color: var(--text);
  }
}

/* ---------- Cards / surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  min-height: 54px;
}
.card__body {
  padding: 18px;
}
.card__title {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Tool layout ---------- */
.tool-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.tool-head__text {
  max-width: 68ch;
}
.tool-head .lede {
  margin-top: 6px;
  font-size: 0.95rem;
}
.tool-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.tool-grid > .stack {
  min-width: 0;
}
@media (max-width: 1100px) {
  .tool-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.controls {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.controls__group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.controls__group + .controls__group {
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.controls__heading {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

/* Preview stage */
.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 340px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.stage--plain {
  background: var(--stage-bg, #eef0f3);
}
.stage__toolbar {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

/* ---------- Fields ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.field__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.field__label {
  font-size: 0.8125rem;
  font-weight: 520;
  color: var(--text-2);
}
.field__error {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--danger);
}
.field__hint {
  font-size: 0.78rem;
  color: var(--text-3);
}

.num {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 8px 0 2px;
  border-radius: 7px;
  background: var(--bg-sunken);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: box-shadow 150ms ease;
}
.num:focus-within {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-ring);
}
.num__input {
  width: 44px;
  padding: 0 2px 0 6px;
  background: transparent;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
  appearance: textfield;
}
.num__input:focus {
  outline: none;
}
.num__input::-webkit-outer-spin-button,
.num__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.num__unit {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
}

/* Range: custom track with filled portion */
.range {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}
.range:focus {
  outline: none;
}
.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--accent) var(--fill), var(--border-strong) var(--fill));
}
.range::-moz-range-track {
  height: 4px;
  border-radius: 99px;
  background: var(--border-strong);
}
.range::-moz-range-progress {
  height: 4px;
  border-radius: 99px;
  background: var(--accent);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border-radius: 50%;
  background: #fff;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 150ms var(--ease-out), box-shadow 150ms ease;
}
.range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: transform 150ms var(--ease-out);
}
.range:active::-webkit-slider-thumb {
  transform: scale(1.12);
}
.range:active::-moz-range-thumb {
  transform: scale(1.12);
}
.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--accent-ring), 0 1px 3px rgba(0, 0, 0, 0.18);
}
.range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 4px var(--accent-ring);
}

/* Colour field */
.color-input {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px 0 5px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: box-shadow 150ms ease;
}
.color-input:focus-within {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-ring);
}
.is-invalid .color-input {
  box-shadow: inset 0 0 0 1px var(--danger), 0 0 0 3px var(--danger-soft);
}
.color-input__swatch {
  --swatch: #000;
  position: relative;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 7px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: transform 150ms var(--ease-out);
}
.color-input__swatch:active {
  transform: scale(0.94);
}
.color-input__swatch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}
.color-input__text {
  flex: 1;
  min-width: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: var(--text);
}
.color-input__text:focus {
  outline: none;
}

/* Generic text input / select */
.input,
.select {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-strong);
  font-size: 0.875rem;
  transition: box-shadow 150ms ease;
}
.input:focus,
.select:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-ring);
}

/* Switch */
.field--switch {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}
.switch {
  position: relative;
  width: 36px;
  height: 22px;
  flex: none;
  border-radius: 99px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background-color 200ms ease;
}
.switch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 200ms var(--ease-out);
}
.switch[aria-checked='true'] {
  background: var(--accent);
}
.switch[aria-checked='true'] .switch__knob {
  transform: translateX(14px);
}

/* ---------- Code panel ---------- */
.code-panel {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.code-panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 10px 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.code-panel__formats {
  min-width: 0;
  max-width: 100%;
}
.code-panel__actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.code-panel__pre {
  margin: 0;
  padding: 16px 18px;
  background: var(--code-bg);
  font-size: 0.8rem;
  line-height: 1.7;
  overflow: auto;
  max-height: 340px;
  white-space: pre;
  tab-size: 2;
  color: var(--text);
}
.code-panel__pre:focus-visible {
  outline-offset: -2px;
}
.tk-prop {
  color: var(--tk-prop);
}
.tk-num {
  color: var(--tk-num);
}
.tk-str {
  color: var(--tk-str);
}
.tk-attr,
.tk-key {
  color: var(--tk-key);
}
.tk-comment {
  color: var(--tk-comment);
  font-style: italic;
}
.tk-bool {
  color: var(--tk-prop);
}
.tk-null {
  color: var(--text-3);
}

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--bg-sunken);
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--border);
}
.badge--ok {
  color: var(--success);
}
.badge--bad {
  color: var(--danger);
}
.badge--accent {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
}

/* ---------- Overview ---------- */
.hero {
  padding: 18px 0 30px;
}
.hero .lede {
  margin-top: 14px;
}
.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 20px;
  font-size: 0.82rem;
  color: var(--text-2);
}
.trust-row span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.trust-row .icon {
  color: var(--accent);
}
.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.tool-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px;
  min-height: 176px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out), border-color 200ms ease;
}
.tool-card:active {
  transform: scale(0.985);
}
@media (hover: hover) and (pointer: fine) {
  .tool-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2);
    border-color: var(--border-strong);
  }
  .tool-card:hover .tool-card__go {
    opacity: 1;
    transform: none;
  }
}
.tool-card__icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tool-card__title {
  font-weight: 600;
  letter-spacing: -0.012em;
}
.tool-card__desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-2);
}
.tool-card__go {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--text-3);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 200ms ease, transform 200ms var(--ease-out);
}
.tool-card__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.tool-card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tool-card__link:focus-visible {
  outline: none;
}

.section-title {
  margin: 40px 0 14px;
}
.faq {
  display: grid;
  gap: 10px;
}
.faq details {
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}
.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  font-weight: 550;
  font-size: 0.92rem;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary .icon {
  color: var(--text-3);
  transition: transform 200ms var(--ease-out);
}
.faq details[open] summary .icon {
  transform: rotate(180deg);
}
.faq details p {
  padding: 0 16px 16px;
  color: var(--text-2);
  font-size: 0.88rem;
  max-width: 72ch;
}

/* ---------- Views & route transition ---------- */
.view[hidden] {
  display: none !important;
}
.view.is-entering {
  animation: view-in 300ms var(--ease-out) both;
}
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.view-loading {
  display: grid;
  gap: 16px;
  /* Hidden for the first 100ms so fast (cached) loads never flash a skeleton */
  animation: loader-in 200ms ease-out 100ms both;
}
@keyframes loader-in {
  from {
    opacity: 0;
  }
}
.skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--bg-sunken) 0%, var(--surface-hover) 50%, var(--bg-sunken) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ---------- Ad slots (fixed footprint → no layout shift) ---------- */
.ad-slot {
  position: relative;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px dashed var(--border-strong);
  color: var(--text-3);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  overflow: hidden;
}
.ad-slot--rail {
  width: 300px;
  min-height: 600px;
}
.ad-slot--inline {
  width: 100%;
  min-height: 100px;
  margin-top: 28px;
}
.ad-slot__label {
  position: absolute;
  top: 8px;
  left: 10px;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.ad-slot[data-filled] {
  border-style: solid;
  border-color: var(--border);
  background: transparent;
}
.ad-slot .adsbygoogle {
  display: block;
  width: 100%;
}
html[data-pro] .ad-slot,
html[data-pro] .rail {
  display: none !important;
}
@media (min-width: 1440px) {
  html[data-no-ads] .content,
  html[data-pro] .content {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px;
  color: var(--text-2);
  font-size: 0.82rem;
}
.footer__inner {
  max-width: 1480px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}
.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
.footer a,
.footer .link-btn {
  color: var(--text-2);
  transition: color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .footer a:hover,
  .footer .link-btn:hover {
    color: var(--text);
  }
}
.footer__credit {
  width: 100%;
  margin-top: 6px;
  font-size: 0.66rem;
  letter-spacing: 0.02em;
  color: var(--text-3);
  opacity: 0.55;
}
@media (max-width: 1023px) {
  .footer {
    padding: 24px 16px;
  }
}

/* ---------- Dialogs ---------- */
.dialog {
  margin: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  overflow: visible;
}
.dialog::backdrop {
  background: rgba(12, 12, 14, 0.38);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.dialog[open] {
  animation: dialog-in 300ms var(--ease-out);
}
.dialog[open]::backdrop {
  animation: backdrop-in 300ms ease;
}
.dialog.is-closing {
  animation: dialog-out 200ms ease forwards;
}
.dialog.is-closing::backdrop {
  animation: backdrop-out 200ms ease forwards;
}
@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}
@keyframes dialog-out {
  to {
    opacity: 0;
    transform: scale(0.98);
  }
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
@keyframes backdrop-out {
  to {
    opacity: 0;
  }
}
.dialog__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: calc(100dvh - 32px);
  border-radius: var(--radius-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.dialog__close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}
.dialog--pro .dialog__panel {
  width: 440px;
}
.dialog--legal .dialog__panel {
  width: 760px;
}

.pro-hero {
  padding: 30px 28px 6px;
}
.pro-hero__badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000));
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-ring);
}
.pro-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 18px;
}
.pro-price strong {
  font-size: 2.2rem;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1;
}
.pro-list {
  display: grid;
  gap: 11px;
  padding: 20px 28px 8px;
}
.pro-list li {
  display: flex;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--text-2);
}
.pro-list .icon {
  margin-top: 2px;
  color: var(--accent);
}
.pro-actions {
  display: grid;
  gap: 8px;
  padding: 18px 28px 24px;
}
.pro-fine {
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--text-3);
  text-align: center;
  text-wrap: pretty;
}
.pro-fine a,
.pro-fine button {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.notice {
  display: flex;
  gap: 10px;
  margin: 0 28px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.45;
}
.notice .icon {
  margin-top: 1px;
}
.pro-reason {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 520;
}
#pro-dialog [data-pro-active-view] {
  display: none;
}
#pro-dialog[data-active] [data-pro-active-view] {
  display: block;
}
#pro-dialog[data-active] [data-pro-buy-view] {
  display: none;
}

/* Legal document */
.legal-head {
  padding: 24px 28px 16px;
  border-bottom: 1px solid var(--border);
}
.legal-tabs {
  margin-top: 14px;
}
.legal-body {
  padding: 8px 28px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 0.89rem;
  line-height: 1.68;
  color: var(--text-2);
}
.legal-body h3 {
  margin: 26px 0 8px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.legal-body p,
.legal-body ul {
  margin: 0 0 10px;
  max-width: 72ch;
}
.legal-body ul {
  padding-left: 18px;
  list-style: disc;
}
.legal-body li {
  margin-bottom: 4px;
}
.legal-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-body strong {
  color: var(--text);
  font-weight: 600;
}
.legal-meta {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--text-3);
}

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 92%, transparent);
  color: var(--bg);
  font-size: 0.85rem;
  font-weight: 520;
  box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  transition: opacity 200ms ease, transform 300ms var(--ease-out);
}
.toast.is-visible {
  opacity: 1;
  transform: none;
}
.toast.is-leaving {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition-duration: 200ms;
}
.toast__icon {
  display: inline-flex;
  color: var(--accent);
}
.toast--success .toast__icon {
  color: #4cc283;
}
:root[data-theme='dark'] .toast--success .toast__icon {
  color: #16804a;
}
.toast--error .toast__icon {
  color: #ff7a70;
}
:root[data-theme='dark'] .toast--error .toast__icon {
  color: #c4322c;
}

/* ---------- Empty state ---------- */
.empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-height: 100%;
  padding: 32px 24px;
  text-align: center;
}
.empty__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--bg-sunken);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text-3);
}
.empty__title {
  font-weight: 600;
  letter-spacing: -0.012em;
}
.empty__text {
  max-width: 38ch;
  font-size: 0.86rem;
  color: var(--text-2);
}

/* ---------- Noscript / file protocol notice ---------- */
.boot-notice {
  margin: 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.88rem;
}

/* ---------- Accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .sidebar,
  .tool-card,
  .segmented__thumb,
  .switch__knob,
  .app {
    transition-property: opacity, background-color, color !important;
  }
  .toast {
    transform: none !important;
  }
  .skeleton {
    animation: none;
  }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar {
    background: var(--bg);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
@media (prefers-contrast: more) {
  :root {
    --border: rgba(0, 0, 0, 0.3);
    --border-strong: rgba(0, 0, 0, 0.5);
    --text-2: #303036;
    --text-3: #4a4a52;
  }
  :root[data-theme='dark'] {
    --border: rgba(255, 255, 255, 0.35);
    --border-strong: rgba(255, 255, 255, 0.55);
    --text-2: #d0d0d6;
    --text-3: #b0b0b8;
  }
}

/* ==========================================================================
   Shell details
   ========================================================================== */
.theme-icon-sun {
  display: none;
}
:root[data-theme='dark'] .theme-icon-sun {
  display: block;
}
:root[data-theme='dark'] .theme-icon-moon {
  display: none;
}
@media (max-width: 1023px) {
  .sidebar {
    transition: transform 300ms var(--ease-drawer), visibility 0s linear 300ms;
  }
  html.nav-open .sidebar {
    transition: transform 300ms var(--ease-drawer), visibility 0s linear 0s;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btn[data-loading]::after {
    animation-duration: 900ms !important;
    animation-iteration-count: infinite !important;
  }
}
.link-btn {
  cursor: pointer;
}

/* Chips (presets, quick actions) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 99px;
  font-size: 0.78rem;
  font-weight: 520;
  color: var(--text-2);
  background: var(--bg-sunken);
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background-color 150ms ease, color 150ms ease;
}
.chip:active {
  transform: scale(0.96);
}
.chip[aria-pressed='true'] {
  background: var(--text);
  color: var(--bg);
  box-shadow: none;
}
@media (hover: hover) and (pointer: fine) {
  .chip:hover {
    color: var(--text);
    background: var(--surface-hover);
  }
  .chip[aria-pressed='true']:hover {
    background: var(--text);
    color: var(--bg);
  }
}

.empty--compact {
  padding: 20px 12px;
  gap: 8px;
}

/* ==========================================================================
   Tool: Box shadow
   ========================================================================== */
.layer-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.layer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .layer:hover {
    background: var(--surface-hover);
  }
  .layer:hover .layer__actions {
    opacity: 1;
  }
}
.layer.is-selected {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.layer:focus-visible {
  outline-offset: 0;
}
.layer.is-hidden .layer__text,
.layer.is-hidden .layer__swatch {
  opacity: 0.4;
}
.layer__swatch {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.layer__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}
.layer__name {
  font-size: 0.84rem;
  font-weight: 550;
}
.layer__meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer__actions {
  display: flex;
  gap: 0;
  opacity: 0.55;
  transition: opacity 150ms ease;
}
.layer.is-selected .layer__actions,
.layer:focus-within .layer__actions {
  opacity: 1;
}
@media (hover: none) {
  .layer__actions {
    opacity: 1;
  }
}
.shadow-demo {
  display: grid;
  place-items: center;
  width: min(260px, 70%);
  aspect-ratio: 4 / 3;
  color: #8a8f98;
  font-size: 0.8rem;
  font-weight: 550;
  letter-spacing: 0.02em;
  transition: border-radius 100ms ease;
}

/* ---------- Fixes: global hidden, nav overflow, card heads ---------- */
[hidden] {
  display: none !important;
}
.topbar .menu-btn {
  display: none;
}
@media (max-width: 1023px) {
  .topbar .menu-btn {
    display: inline-flex;
  }
}
.nav__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card__head {
  flex-wrap: wrap;
}
.card__title {
  white-space: nowrap;
}

/* ==========================================================================
   Tool: Glassmorphism
   ========================================================================== */
.glass-stage {
  min-height: 420px;
  isolation: isolate;
  background: #1b1f3a;
}
.glass-stage[data-scene='aurora'] {
  background: radial-gradient(120% 90% at 10% 0%, #2d1b69 0%, #0f1530 60%);
}
.glass-stage[data-scene='sunset'] {
  background: linear-gradient(160deg, #ff8a5b 0%, #e2457a 45%, #5b2a86 100%);
}
.glass-stage[data-scene='ocean'] {
  background: linear-gradient(200deg, #0bb3c8 0%, #1667d9 55%, #0b2a6f 100%);
}
.glass-blob {
  position: absolute;
  border-radius: 50%;
  z-index: -1;
  transition: background-color 300ms ease;
}
.glass-blob--a {
  width: 46%;
  aspect-ratio: 1;
  top: -8%;
  left: 6%;
  background: #ff5fa2;
}
.glass-blob--b {
  width: 34%;
  aspect-ratio: 1;
  bottom: -10%;
  right: 8%;
  background: #4ee1c1;
}
.glass-blob--c {
  width: 22%;
  aspect-ratio: 1;
  top: 18%;
  right: 22%;
  background: #ffd25f;
}
.glass-stage[data-scene='sunset'] .glass-blob--a {
  background: #ffd25f;
}
.glass-stage[data-scene='sunset'] .glass-blob--b {
  background: #3b1c6b;
}
.glass-stage[data-scene='sunset'] .glass-blob--c {
  background: #ff5f6d;
}
.glass-stage[data-scene='ocean'] .glass-blob--a {
  background: #7af0ff;
}
.glass-stage[data-scene='ocean'] .glass-blob--b {
  background: #0a1e5c;
}
.glass-stage[data-scene='ocean'] .glass-blob--c {
  background: #b5ffd9;
}
.glass-card {
  width: min(340px, 82%);
  padding: 28px;
  color: #fff;
}
.glass-card__eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}
.glass-card__title {
  margin-top: 8px;
  font-size: 1.45rem;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.glass-card__text {
  margin-top: 8px;
  font-size: 0.88rem;
  line-height: 1.5;
  opacity: 0.88;
}

/* ==========================================================================
   Tool: JSON formatter
   ========================================================================== */
.json-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 10px 12px;
  margin-bottom: 16px;
}
.json-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.json-toolbar__end {
  margin-left: auto;
}
.json-toolbar [data-act='sort'].is-on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}
.json-toolbar .rotate-180 {
  transform: rotate(180deg);
}
.json-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 900px) {
  .json-split {
    grid-template-columns: minmax(0, 1fr);
  }
}
.json-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.json-editor {
  position: relative;
  display: flex;
  height: clamp(360px, 62vh, 640px);
  background: var(--code-bg);
  transition: box-shadow 150ms ease;
}
.json-editor.is-dragover {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.json-editor:focus-within {
  box-shadow: inset 0 0 0 1px var(--accent);
}
.json-gutter {
  flex: none;
  min-width: 44px;
  margin: 0;
  padding: 14px 10px 14px 12px;
  overflow: hidden;
  text-align: right;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--text-3);
  border-right: 1px solid var(--border);
  user-select: none;
  font-variant-numeric: tabular-nums;
}
.json-gutter b {
  font-weight: 600;
  color: var(--danger);
}
.json-input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.6;
  resize: none;
  white-space: pre;
  overflow: auto;
  tab-size: 2;
}
.json-input:focus {
  outline: none;
}
.json-input::placeholder {
  color: var(--text-3);
}
.json-output-wrap {
  position: relative;
  height: clamp(360px, 62vh, 640px);
  background: var(--code-bg);
}
.json-output {
  height: 100%;
  margin: 0;
  padding: 14px 16px;
  overflow: auto;
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre;
  tab-size: 2;
}
.json-output-wrap > * {
  display: none;
}
.json-output-wrap[data-view='output'] .json-output,
.json-output-wrap[data-view='empty'] .empty {
  display: block;
}
.json-output-wrap[data-view='empty'] .empty {
  display: grid;
  height: 100%;
}
.json-output-wrap[data-view='error'] .json-error {
  display: flex;
}
.json-error {
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  height: 100%;
  padding: 20px;
  overflow: auto;
  animation: view-in 200ms var(--ease-out);
}
.json-error__head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--danger);
}
.json-error__title {
  font-weight: 600;
}
.json-error__where {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}
.json-error__why {
  color: var(--text-2);
  font-size: 0.88rem;
  max-width: 52ch;
}
.json-error__frame {
  width: 100%;
  margin: 4px 0 6px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}
.json-stats {
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.74rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-height: 35px;
}
.badge[data-kind='checking'] {
  color: var(--text-3);
}

/* ==========================================================================
   Tool: SVG patterns
   ========================================================================== */
.pattern-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.pattern-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 8px 6px 9px;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 520;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: pointer;
  transition: transform 150ms var(--ease-out), box-shadow 150ms ease, color 150ms ease, background-color 150ms ease;
}
.pattern-opt:active {
  transform: scale(0.96);
}
.pattern-opt[aria-checked='true'] {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
@media (hover: hover) and (pointer: fine) {
  .pattern-opt:hover {
    background: var(--surface-hover);
    color: var(--text);
  }
}
.pattern-opt__swatch {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--border);
}
.pattern-stage {
  min-height: 380px;
}
.pattern-stage.is-transparent {
  background-color: var(--surface);
}

/* ==========================================================================
   Tool: Color palette
   ========================================================================== */
.harmony-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.harmony-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 11px;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .harmony-opt:hover {
    background: var(--surface-hover);
  }
}
.harmony-opt[aria-checked='true'] {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}
.harmony-opt__dots {
  display: flex;
  flex: none;
}
.harmony-opt__dots i {
  width: 14px;
  height: 22px;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.1);
}
.harmony-opt__dots i:first-child {
  border-radius: 6px 0 0 6px;
}
.harmony-opt__dots i:last-child {
  border-radius: 0 6px 6px 0;
}
.harmony-opt__text {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
}
.harmony-opt__name {
  font-size: 0.86rem;
  font-weight: 560;
}
.harmony-opt__desc {
  font-size: 0.75rem;
  color: var(--text-3);
}
.palette {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.strip {
  display: flex;
  height: 168px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-1);
}
.strip__cell {
  position: relative;
  flex: 1;
  display: flex;
  align-items: flex-end;
  min-width: 0;
  padding: 12px;
  background: var(--sw);
  color: var(--sw-fg);
  cursor: pointer;
  animation: swatch-in 300ms var(--ease-out) both;
  animation-delay: calc(var(--i) * 35ms);
}
.strip__cell:active {
  filter: brightness(0.96);
}
.strip__cell:focus-visible {
  outline-offset: -3px;
  border-radius: 4px;
}
@keyframes swatch-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
.strip__hex {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.strip__base {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 1px 7px;
  border-radius: 6px;
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px currentColor;
  opacity: 0.85;
}
.prows {
  padding: 6px;
}
.prow {
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
}
.prow + .prow {
  border-top: 1px solid var(--border);
  border-radius: 0;
}
.prow__chip {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--sw);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.prow__index {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-3);
}
.prow__values {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}
.vchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 0.74rem;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, transform 150ms var(--ease-out);
}
.vchip:active {
  transform: scale(0.97);
}
.vchip__k {
  font-size: 0.62rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.vchip__v {
  font-family: var(--font-mono);
  white-space: nowrap;
}
.vchip .icon {
  opacity: 0;
  transition: opacity 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .vchip:hover {
    background: var(--surface-hover);
    color: var(--text);
  }
  .vchip:hover .icon {
    opacity: 0.7;
  }
}
.vchip:focus-visible .icon {
  opacity: 0.7;
}
.prow__contrast {
  display: flex;
  gap: 14px;
}
@media (max-width: 760px) {
  .strip {
    height: 120px;
  }
  .strip__hex {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
  }
  .prow {
    grid-template-columns: 34px minmax(0, 1fr);
  }
  .prow__index {
    display: none;
  }
  .prow__contrast {
    grid-column: 2;
  }
}
.contrast {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-2);
}
.contrast__aa {
  display: grid;
  place-items: center;
  width: 26px;
  height: 20px;
  border-radius: 5px;
  background: var(--on);
  color: var(--sw);
  font-weight: 700;
  font-size: 0.72rem;
  box-shadow: inset 0 0 0 1px var(--border);
}
.contrast .badge {
  margin-left: auto;
  height: 18px;
  font-size: 0.64rem;
}

@media (prefers-reduced-motion: reduce) {
  .strip__cell,
  .json-error {
    animation: none;
  }
}

/* Toast region as a manual popover: reset UA popover styles */
.toast-region:popover-open,
.toast-region[popover] {
  inset: auto auto 22px 50%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
#pro-dialog[data-active] [data-pro-reason] {
  display: none !important;
}
.topbar .pro-top-btn {
  display: none;
}
@media (min-width: 640px) {
  .topbar .pro-top-btn {
    display: inline-flex;
  }
}
html[data-pro] .topbar .pro-top-btn {
  display: none;
}

/* Route-change focus target: not interactive, so no ring */
h1[tabindex="-1"]:focus {
  outline: none;
}
