/* =========================================================================
   KivoxData — design system
   Navy-first. Corporate rather than neon: squared controls, a full-width
   nav bar, banded sections, and one neutral grotesk doing all the work.
   ========================================================================= */

:root {
  --font-display: 'Inter Tight', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --violet: #7c6df2;
  --mint: #10b981;
  --up: #10b981;
  --down: #f43f5e;

  --r-sm: 6px;
  --r-btn: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-full: 999px;

  --shell: min(1200px, 100% - 3rem);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Light palette (also the no-preference fallback) ---- */
  --bg: #ffffff;
  --bg-1: #ffffff;
  --bg-2: #f4f6fa;
  --bg-3: #e8ecf3;
  --band: #f7f9fc;
  --ink: #0f1828;
  --ink-2: #4d5a75;
  --ink-3: #7b89a3;
  --line: rgba(15, 24, 40, 0.1);
  --line-2: rgba(15, 24, 40, 0.18);
  --glass: rgba(255, 255, 255, 0.85);
  --shadow: 0 1px 2px rgba(15, 24, 40, 0.06), 0 8px 24px rgba(15, 24, 40, 0.05);
  --shadow-lg: 0 24px 60px rgba(15, 24, 40, 0.1);
  --accent: #1d4ed8;
  --accent-hi: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: rgba(29, 78, 216, 0.09);
  --icon: #1d4ed8;
  --glow: rgba(29, 78, 216, 0.14);
  --grid-line: rgba(15, 24, 40, 0.055);
  --fade-a: rgba(255, 255, 255, 0.4);
  --fade-b: rgba(255, 255, 255, 0.88);
}

/* Ships deep navy unless the visitor explicitly asks for light. Surfaces sit
   close together in value and are separated by borders rather than brightness,
   so no panel reads as a pale blue block. */
:root[data-theme='dark'],
:root:not([data-theme='light']) {
  --bg: #070d1a;
  --bg-1: #0d1628;
  --bg-2: #131f36;
  --bg-3: #1b2b49;
  --band: #0a1120;
  --ink: #eef4ff;
  --ink-2: #9db0d0;
  --ink-3: #6a7e9f;
  --line: rgba(140, 170, 220, 0.13);
  --line-2: rgba(140, 170, 220, 0.26);
  --glass: rgba(7, 13, 26, 0.85);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 28px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 30px 70px rgba(0, 0, 0, 0.5);
  --accent: #3d82ff;
  --accent-hi: #66a0ff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(61, 130, 255, 0.16);
  --icon: #6aa2ff;
  --glow: rgba(61, 130, 255, 0.22);
  --grid-line: rgba(140, 170, 220, 0.06);
  --fade-a: rgba(7, 13, 26, 0.35);
  --fade-b: rgba(7, 13, 26, 0.85);
}

:root[data-theme='light'] {
  --bg: #ffffff;
  --bg-1: #ffffff;
  --bg-2: #f4f6fa;
  --bg-3: #e8ecf3;
  --band: #f7f9fc;
  --ink: #0f1828;
  --ink-2: #4d5a75;
  --ink-3: #7b89a3;
  --line: rgba(15, 24, 40, 0.1);
  --line-2: rgba(15, 24, 40, 0.18);
  --glass: rgba(255, 255, 255, 0.85);
  --shadow: 0 1px 2px rgba(15, 24, 40, 0.06), 0 8px 24px rgba(15, 24, 40, 0.05);
  --shadow-lg: 0 24px 60px rgba(15, 24, 40, 0.1);
  --accent: #1d4ed8;
  --accent-hi: #2563eb;
  --accent-soft: rgba(29, 78, 216, 0.09);
  --icon: #1d4ed8;
  --glow: rgba(29, 78, 216, 0.14);
  --grid-line: rgba(15, 24, 40, 0.055);
  --fade-a: rgba(255, 255, 255, 0.4);
  --fade-b: rgba(255, 255, 255, 0.88);
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.006em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: none;
  cursor: pointer;
}
::selection {
  background: var(--accent);
  color: #fff;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

code.mono,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
code.mono {
  font-size: 0.9em;
  background: var(--bg-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------------------------------------ typography */

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.section-head {
  max-width: 660px;
  margin-bottom: 2.5rem;
}
.section-head h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  margin-bottom: 0.6rem;
}
.section-head p {
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.65;
}

section {
  padding: 5.5rem 0;
  position: relative;
}
.band {
  background: var(--band);
  border-block: 1px solid var(--line);
}

@media (max-width: 720px) {
  section {
    padding: 3.5rem 0;
  }
  :root {
    --shell: min(1200px, 100% - 2rem);
  }
}

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1.25rem;
  border-radius: var(--r-btn);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  white-space: nowrap;
  border: 1px solid transparent;
}
.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-hi);
}

.btn-ghost {
  background: var(--bg-1);
  color: var(--ink);
  border-color: var(--line-2);
}
.btn-ghost:hover {
  background: var(--bg-2);
  border-color: var(--ink-3);
}

.btn-sm {
  padding: 0.48rem 0.9rem;
  font-size: 0.84rem;
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ------------------------------------------------------------------- nav */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.6);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  width: var(--shell);
  margin-inline: auto;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}
.brand-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}
.brand-name span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  gap: 1.7rem;
  list-style: none;
  margin-right: auto;
}
.nav-links a {
  font-size: 0.885rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.18s;
}
.nav-links a:hover {
  color: var(--ink);
}
.nav-links a .ext {
  width: 11px;
  height: 11px;
  margin-left: 0.15rem;
  vertical-align: -1px;
  opacity: 0.65;
}
.nav-links a.current,
.has-menu.current > .nav-trigger {
  color: var(--ink);
  font-weight: 600;
}

/* ------------------------------------------------------------- dropdowns */

.has-menu {
  position: relative;
}
.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0;
  font-size: 0.885rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.18s;
}
.nav-trigger:hover,
.has-menu.open .nav-trigger {
  color: var(--ink);
}
.chev {
  width: 13px;
  height: 13px;
  opacity: 0.7;
  transition: transform 0.2s var(--ease);
}
.has-menu.open .chev {
  transform: rotate(180deg);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 16px);
  left: 50%;
  translate: -50% 0;
  min-width: 290px;
  padding: 0.45rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease), visibility 0.18s;
  z-index: 60;
}
/* Bridges the gap under the trigger so the panel survives the pointer crossing it. */
.nav-menu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 18px;
}
.has-menu.open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.menu-row {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.6rem 0.6rem;
  border-radius: var(--r-sm);
  transition: background 0.15s;
}
.menu-row:hover {
  background: var(--bg-2);
}
.menu-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--icon);
  flex-shrink: 0;
}
.menu-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
.menu-text b {
  display: block;
  font-size: 0.87rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.menu-text small {
  display: block;
  font-size: 0.77rem;
  color: var(--ink-3);
  margin-top: 0.08rem;
  line-height: 1.4;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* The connected address, beside the Dashboard button. */
.nav-wallet {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.36rem 0.7rem;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.79rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-wallet i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 6px var(--up);
  flex-shrink: 0;
}
@media (max-width: 620px) {
  .nav-wallet {
    display: none;
  }
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  transition: all 0.18s;
  flex-shrink: 0;
}
.icon-btn:hover {
  color: var(--ink);
  background: var(--bg-2);
}
.icon-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  color: var(--icon);
}
:root[data-theme='light'] .icon-sun,
:root:not([data-theme='light']) .icon-moon {
  display: none;
}

.nav-toggle {
  display: none;
}
@media (max-width: 940px) {
  .nav-links {
    display: none;
  }
  .nav-toggle {
    display: grid;
  }
  .nav-links.open {
    display: flex;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem;
    margin: 0;
    background: var(--bg-1);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
  }
  .nav-links.open a {
    display: block;
    padding: 0.65rem 0.8rem;
    border-radius: var(--r-sm);
  }
  .nav-links.open a:hover {
    background: var(--bg-2);
  }

  /* The drawer can outgrow a phone screen, so it scrolls. */
  .nav-links.open {
    max-height: calc(100vh - 90px);
    overflow-y: auto;
  }

  /* Groups collapse in the drawer so Docs and Pricing stay reachable without
     scrolling past ten menu rows. The chevron is the affordance. */
  .nav-links.open .nav-trigger {
    width: 100%;
    justify-content: flex-start;
    padding: 0.65rem 0.8rem;
    border-radius: var(--r-sm);
    font-size: 0.885rem;
    font-weight: 500;
    color: var(--ink-2);
  }
  .nav-links.open .nav-trigger:hover {
    background: var(--bg-2);
  }
  .nav-links.open .chev {
    margin-left: auto;
  }
  .nav-links.open .nav-menu {
    position: static;
    translate: none;
    transform: none;
    opacity: 1;
    visibility: visible;
    display: none;
    min-width: 0;
    padding: 0.15rem 0 0.5rem 0.55rem;
    background: none;
    border: 0;
    box-shadow: none;
  }
  .nav-links.open .has-menu.open > .nav-menu {
    display: block;
  }
  /* Re-assert flex: the generic `.nav-links.open a { display: block }` above
     would otherwise stack the icon on top of the label. */
  .nav-links.open .menu-row {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.8rem;
  }
  .nav-links.open .menu-text small {
    display: none;
  }
}
@media (max-width: 520px) {
  .nav-inner {
    gap: 0.75rem;
  }
}

/* ------------------------------------------------------------------ hero */

/* Fills the first screen so nothing below it is visible without scrolling.
   min-height, not height, so a short window or a tall phone still fits. */
.hero {
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  padding: 3.5rem 0 4rem;
  position: relative;
  overflow: hidden;
}
.hero > .shell {
  width: var(--shell);
}
@media (max-width: 980px) {
  .hero {
    min-height: 0;
    padding: 3rem 0 3.5rem;
  }
}
/* Animated canvas sits behind everything in the hero; the fade blends its
   bottom edge into the page background so there is no seam. */
.hero > #bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
.hero-fade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, var(--fade-a), var(--fade-b) 82%, var(--bg));
}
/* The canvas draws light-on-dark; on the light theme it would only add noise. */
:root[data-theme='light'] .hero > #bg {
  display: none;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 70% 70% at 70% 20%, #000, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 70% 20%, #000, transparent 70%);
}

.hero-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 3.5rem;
  align-items: center;
}
@media (max-width: 980px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
  }
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem 0.35rem 0.4rem;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  font-size: 0.81rem;
  color: var(--ink-2);
  margin-bottom: 1.7rem;
  box-shadow: var(--shadow);
}
.pill b {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.16rem 0.5rem;
  border-radius: var(--r-full);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.5rem);
  letter-spacing: -0.04em;
  margin-bottom: 1.4rem;
}
.hero h1 em {
  font-style: normal;
  color: var(--accent);
}
.hero-sub {
  max-width: 560px;
  color: var(--ink-2);
  font-size: clamp(1.05rem, 1.25vw, 1.2rem);
  line-height: 1.65;
  margin-bottom: 2.2rem;
}
.hero-ctas {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.hero-ctas .btn {
  padding: 0.86rem 1.5rem;
  font-size: 0.95rem;
}
.hero-note {
  font-size: 0.8rem;
  color: var(--ink-3);
}

/* Live market snapshot beside the headline. */
.hero-panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero-panel-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-2);
}
.hero-panel-bar .conn {
  margin-left: auto;
}

.snap-row {
  display: grid;
  grid-template-columns: 6.75rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  transition: background 0.15s;
}
.snap-row:last-child {
  border-bottom: none;
}
.snap-row:hover {
  background: var(--bg-2);
}
.snap-name {
  font-size: 0.83rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.snap-name small {
  display: block;
  font-size: 0.67rem;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.snap-spark {
  width: 100%;
  height: 30px;
  display: block;
}
.snap-fig {
  text-align: right;
}
.snap-px {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  display: block;
  transition: color 0.5s;
}
.snap-chg {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  display: block;
}

.up {
  color: var(--up);
}
.down {
  color: var(--down);
}

/* ----------------------------------------------------------------- stats */

.stats {
  padding: 2.75rem 0;
}
/* min(…, 100%) keeps auto-fit from forcing a track wider than the viewport,
   which is what pushes a narrow phone into horizontal overflow. */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr));
  gap: 1rem;
  text-align: center;
}
.stat-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.6rem 1.1rem;
  transition: border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
}
.stat-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}
.stat-val {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  margin-bottom: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.stat-val small {
  font-size: 0.46em;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}
.stat-lbl {
  font-size: 0.83rem;
  color: var(--ink-3);
}

/* --------------------------------------------------------------- markets */

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr));
  gap: 1rem;
}
@media (max-width: 560px) {
  .market-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.market-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  transition: border-color 0.22s var(--ease), box-shadow 0.22s var(--ease);
  cursor: pointer;
  text-align: left;
  display: block;
  width: 100%;
}
.market-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}
.market-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-md);
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  color: var(--icon);
  margin-bottom: 1rem;
}
.market-icon svg {
  width: 19px;
  height: 19px;
  display: block;
}
.market-card h3 {
  font-size: 1.02rem;
  margin-bottom: 0.25rem;
}
.market-count {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.market-card p {
  font-size: 0.87rem;
  color: var(--ink-3);
  line-height: 1.6;
}

/* -------------------------------------------------------------- terminal */

.terminal {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  flex-wrap: wrap;
}
.term-dots {
  display: flex;
  gap: 0.32rem;
}
.term-dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-2);
}
.term-title {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-3);
}
.conn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.71rem;
  color: var(--ink-2);
}
.conn i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex-shrink: 0;
}
.conn[data-state='connected'] i {
  background: var(--up);
  box-shadow: 0 0 6px var(--up);
  animation: pulse 2.4s infinite;
}
.conn[data-state='reconnecting'] i,
.conn[data-state='connecting'] i {
  background: #f59e0b;
}
.conn[data-state='closed'] i {
  background: var(--down);
}

.term-body {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 272px;
  min-height: 410px;
}
@media (max-width: 1100px) {
  .term-body {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .term-side-right {
    grid-column: 1 / -1;
    border-left: none !important;
    border-top: 1px solid var(--line);
  }
}
@media (max-width: 760px) {
  .term-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .term-side-left {
    border-right: none !important;
    border-bottom: 1px solid var(--line);
    max-height: 250px;
  }
}

.term-side-left {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.term-side-right {
  border-left: 1px solid var(--line);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sym-search {
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.sym-search input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.83rem;
  outline: none;
  transition: border-color 0.18s;
}
.sym-search input:focus {
  border-color: var(--accent);
}
.sym-cats {
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.sym-cats::-webkit-scrollbar {
  display: none;
}
.chip {
  padding: 0.25rem 0.6rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
  transition: all 0.18s;
}
.chip:hover {
  border-color: var(--line-2);
  color: var(--ink);
}
.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.sym-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  max-height: 320px;
}
.sym-list::-webkit-scrollbar {
  width: 8px;
}
.sym-list::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 4px;
}
.sym-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.52rem 0.8rem;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  transition: background 0.14s;
}
.sym-row:hover {
  background: var(--bg-2);
}
.sym-row.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.sym-row-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sym-row-px {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--ink-3);
  flex-shrink: 0;
}
.sym-empty {
  padding: 1.4rem 1rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-3);
}

.term-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chart-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.chart-sym {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.chart-price {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  transition: color 0.45s;
}
.tf-group {
  margin-left: auto;
  display: flex;
  gap: 0.15rem;
  background: var(--bg-2);
  padding: 0.18rem;
  border-radius: var(--r-sm);
}
.tf-btn {
  padding: 0.28rem 0.55rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-2);
  transition: all 0.16s;
}
.tf-btn:hover {
  color: var(--ink);
}
.tf-btn.active {
  background: var(--bg-1);
  color: var(--accent);
  box-shadow: var(--shadow);
}

.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 290px;
}
.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* pan-y leaves vertical page scrolling to the browser, so a finger dragged
     down the page still scrolls; horizontal drags and pinches are ours. */
  touch-action: pan-y;
}

.chart-zoom {
  position: absolute;
  /* Clear of the 66px price axis so the labels stay readable. */
  right: 4.9rem;
  bottom: 2.4rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.chart-zoom button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--bg-2);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1;
  transition: all 0.16s;
}
.chart-zoom button:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.chart-zoom button svg {
  width: 14px;
  height: 14px;
}
.chart-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-1);
  font-family: var(--font-mono);
  font-size: 0.79rem;
  color: var(--ink-3);
  text-align: center;
  padding: 1rem;
  z-index: 3;
}
.chart-overlay[hidden] {
  display: none;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.quote-block h4 {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.55rem;
  font-weight: 600;
}
.quote-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}
.quote-cell {
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.65rem;
}
.quote-cell span {
  display: block;
  font-size: 0.67rem;
  color: var(--ink-3);
  margin-bottom: 0.12rem;
}
.quote-cell b {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.tape {
  flex: 1;
  min-height: 140px;
  max-height: 250px;
  overflow-y: auto;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  padding: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.71rem;
}
.tape::-webkit-scrollbar {
  width: 6px;
}
.tape::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 3px;
}
.tape-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.18rem 0.3rem;
  border-radius: 3px;
  animation: tapeIn 0.3s var(--ease);
}
@keyframes tapeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
.tape-time {
  color: var(--ink-3);
}

/* ------------------------------------------------------------ playground */

.pg {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .pg {
    grid-template-columns: minmax(0, 1fr);
  }
}

.pg-panel {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.15rem;
}
.field {
  margin-bottom: 0.85rem;
}
.field label {
  display: block;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 0.32rem;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.18s;
  font-family: var(--font-mono);
}
.field textarea {
  font-family: var(--font-body);
  resize: vertical;
  min-height: 88px;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.pg-curl {
  margin-top: 1.1rem;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
}
.pg-curl-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.pg-curl-head span {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.pg-curl code {
  display: block;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.7rem;
  font-size: 0.715rem;
  line-height: 1.65;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.pg-out {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}
.pg-out-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
  font-family: var(--font-mono);
  font-size: 0.73rem;
  flex-wrap: wrap;
}
.badge {
  padding: 0.13rem 0.45rem;
  border-radius: 4px;
  font-size: 0.67rem;
  font-weight: 700;
  background: var(--bg-3);
  color: var(--ink-2);
}
.badge.ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--up);
}
.badge.err {
  background: rgba(244, 63, 94, 0.15);
  color: var(--down);
}
.pg-url {
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ------------------------------------------------------------------ code */

pre.code {
  margin: 0;
  padding: 1rem 1.05rem;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.775rem;
  line-height: 1.65;
  background: var(--bg-1);
  flex: 1;
  max-height: 450px;
  tab-size: 2;
}
pre.code::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
pre.code::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 4px;
}
.tok-key {
  color: var(--accent);
}
.tok-str {
  color: var(--mint);
}
.tok-num {
  color: #d97706;
}
:root:not([data-theme='light']) .tok-num {
  color: #fbbf24;
}
.tok-bool {
  color: var(--violet);
}
.tok-punc {
  color: var(--ink-3);
}
.tok-com {
  color: var(--ink-3);
  font-style: italic;
}

.codebox {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--bg-1);
}
.codebox-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-2);
}
.tab {
  padding: 0.32rem 0.7rem;
  border-radius: var(--r-sm);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: all 0.16s;
}
.tab:hover {
  color: var(--ink);
}
.tab.active {
  background: var(--bg-1);
  color: var(--accent);
  box-shadow: var(--shadow);
}
.copy-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.28rem 0.6rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  font-size: 0.71rem;
  color: var(--ink-2);
  transition: all 0.18s;
}
.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.copy-btn svg {
  width: 12px;
  height: 12px;
}

/* ------------------------------------------------------------------ docs */

.docs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .docs-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.docs-sub {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.9rem;
}

.endpoint {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-1);
  margin-bottom: 0.55rem;
  overflow: hidden;
}
.endpoint summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.79rem;
}
.endpoint summary::-webkit-details-marker {
  display: none;
}
.endpoint summary:hover {
  background: var(--bg-2);
}
.method {
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent);
  flex-shrink: 0;
}
.method.post {
  background: rgba(16, 185, 129, 0.14);
  color: var(--mint);
}
.method.ws {
  background: rgba(124, 109, 242, 0.16);
  color: var(--violet);
}
.endpoint-desc {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--ink-3);
}
@media (max-width: 560px) {
  .endpoint-desc {
    display: none;
  }
}
.endpoint-body {
  padding: 0.85rem 0.9rem 0.95rem;
  border-top: 1px solid var(--line);
}
.endpoint-body p {
  font-size: 0.855rem;
  color: var(--ink-2);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

table.params {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.79rem;
  margin-bottom: 0.85rem;
}
table.params th,
table.params td {
  text-align: left;
  padding: 0.42rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.params th {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  font-weight: 700;
}
table.params td:first-child {
  font-family: var(--font-mono);
  color: var(--accent);
  white-space: nowrap;
}
.req {
  color: var(--down);
}
.table-scroll {
  overflow-x: auto;
}

.docs-note {
  margin-top: 1rem;
  font-size: 0.83rem;
  color: var(--ink-3);
  line-height: 1.6;
}

/* --------------------------------------------------------------- pricing */

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 1rem;
  align-items: stretch;
}
.plan {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg-1);
  padding: 1.65rem 1.4rem;
  display: flex;
  flex-direction: column;
  position: relative;
}
.plan.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.plan-tag {
  position: absolute;
  top: -10px;
  left: 1.4rem;
  background: var(--accent);
  color: #fff;
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.plan h3 {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}
.plan-price {
  margin-top: 0.9rem;
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}
.plan-price small {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: -0.01em;
}
.plan ul {
  list-style: none;
  margin: 1.3rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}
.plan li {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-2);
  align-items: flex-start;
}
.plan li svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

/* ---------------------------------------------------------------- access */

.access {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 3rem;
  align-items: center;
}
@media (max-width: 900px) {
  .access {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
}
.access-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}
.form-status {
  margin-top: 0.75rem;
  font-size: 0.84rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--r-sm);
}
.form-status.ok {
  background: rgba(16, 185, 129, 0.12);
  color: var(--up);
}
.form-status.err {
  background: rgba(244, 63, 94, 0.12);
  color: var(--down);
}
.form-status[hidden] {
  display: none;
}
.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  margin-top: 1.5rem;
}
.checklist li {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.9rem;
  color: var(--ink-2);
}
.checklist svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 4px;
}

/* ---------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 1.6rem;
  background: var(--band);
}
.foot-top {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 2rem;
  padding-bottom: 2.25rem;
}
@media (max-width: 860px) {
  .foot-top {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 520px) {
  .foot-top {
    grid-template-columns: minmax(0, 1fr);
  }
}
.foot-brand p {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-top: 0.85rem;
  max-width: 280px;
  line-height: 1.6;
}
.foot-col h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 0.8rem;
  font-weight: 700;
}
.foot-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.foot-col a {
  font-size: 0.86rem;
  color: var(--ink-2);
  transition: color 0.18s;
}
.foot-col a:hover {
  color: var(--accent);
}
.foot-bottom {
  border-top: 1px solid var(--line);
  padding-top: 1.3rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.79rem;
  color: var(--ink-3);
}

/* ----------------------------------------------------------- reveal anim */

.js-reveal .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.js-reveal .reveal.in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------------------------------------------- toast */

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  translate: -50% 0;
  background: var(--ink);
  color: var(--bg);
  padding: 0.6rem 1.05rem;
  border-radius: var(--r-btn);
  font-size: 0.83rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s, translate 0.22s;
}
.toast.show {
  opacity: 1;
  translate: -50% -8px;
}

/* ============================================================== checkout */
/* Lives here rather than in account.css because the pricing page, the
   dashboard and the product pages can all open a checkout.

   The panel carries its own palette rather than the page's theme tokens: it is
   glass over a dimmed backdrop, so it should look the same whichever theme the
   page behind it is using. */

.kx-scrim {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  overflow-y: auto;
  background: rgba(4, 8, 17, 0.7);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.16s var(--ease);
}
.kx-scrim.in {
  opacity: 1;
}

.kx-modal {
  --kx-accent: #3b82f6;
  --kx-text: #f2f5fa;
  --kx-text-2: #e2e8f4;
  --kx-muted: #7c8aa5;
  --kx-muted-2: #66748c;
  --kx-line: rgba(255, 255, 255, 0.09);

  width: 100%;
  max-width: 520px;
  padding: 28px;
  border: 1px solid var(--kx-line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(19, 28, 48, 0.96), rgba(12, 18, 32, 0.98));
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--kx-text);
  transform: translateY(10px) scale(0.985);
  transition: transform 0.18s var(--ease);
}
.kx-scrim.in .kx-modal {
  transform: none;
}
.kx-modal * {
  box-sizing: border-box;
}

/* ---- header ---- */

.kx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}
.kx-head h2 {
  font-family: var(--font-body);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 5px;
  color: var(--kx-text);
}
.kx-head p {
  font-size: 13.5px;
  color: var(--kx-muted);
  margin: 0;
}
.kx-close {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--kx-line);
  background: rgba(255, 255, 255, 0.03);
  color: #9aa6bc;
  cursor: pointer;
  transition: 0.15s;
}
.kx-close:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
}
.kx-close svg {
  width: 13px;
  height: 13px;
}

/* ---- plan summary ---- */

.kx-plan {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  margin-bottom: 28px;
  border: 1px solid var(--kx-line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(255, 255, 255, 0.02));
}
.kx-plan-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #3b82f6, #1d4ed8);
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.32);
}
.kx-plan-icon svg {
  width: 22px;
  height: 22px;
}
.kx-plan-body {
  flex: 1;
  min-width: 0;
}
.kx-plan-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.kx-plan-title span {
  font-size: 17px;
  font-weight: 600;
}
.kx-plan-title em {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.1em;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.28);
  padding: 2px 7px;
  border-radius: 5px;
  white-space: nowrap;
}
.kx-plan-sub {
  font-size: 13.5px;
  color: var(--kx-muted);
}
.kx-plan-price {
  text-align: right;
  flex-shrink: 0;
}
.kx-plan-price strong {
  display: block;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1;
}
.kx-plan-price span {
  display: block;
  font-size: 12px;
  color: var(--kx-muted-2);
  margin-top: 4px;
}

/* ---- section labels ---- */

.kx-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.kx-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--kx-muted-2);
}
.kx-hint {
  font-size: 12px;
  color: var(--kx-muted-2);
}

/* ---- network and token pickers ---- */

.kx-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 26px;
}
.kx-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 26px;
}

.kx-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 14px 12px;
  border: 1px solid var(--kx-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s;
}
.kx-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}
.kx-chain {
  width: 26px;
  height: 26px;
  display: block;
  margin-bottom: 11px;
}
.kx-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--kx-text-2);
  margin-bottom: 3px;
}
.kx-card-sub {
  font-size: 11.5px;
  color: var(--kx-muted-2);
}
.kx-good {
  color: #93c5fd;
}
.kx-warn {
  color: #8c7a55;
}

.kx-card.is-selected,
.kx-token.is-selected {
  border: 1.5px solid var(--kx-accent);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.16), rgba(59, 130, 246, 0.06));
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 10px 26px rgba(59, 130, 246, 0.18);
}
.kx-card.is-selected .kx-card-name,
.kx-token.is-selected .kx-card-name {
  color: var(--kx-text);
}

.kx-check {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--kx-accent);
  display: grid;
  place-items: center;
}
.kx-check svg {
  width: 9px;
  height: 9px;
}
.kx-check-inline {
  position: static;
  flex-shrink: 0;
}

.kx-card-ghost {
  border-style: dashed;
  background: none;
  justify-content: center;
  cursor: default;
}
.kx-card-ghost span {
  font-size: 12.5px;
  color: #4e5a72;
  line-height: 1.5;
}

.kx-token {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  text-align: left;
  border: 1px solid var(--kx-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  font-family: inherit;
  cursor: pointer;
  transition: 0.15s;
}
.kx-token:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
}
.kx-coin {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}
.kx-token-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.kx-token .kx-card-name {
  font-size: 14.5px;
  margin-bottom: 2px;
}

/* ---- total and call to action ---- */

.kx-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  margin-bottom: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.kx-total span {
  font-size: 14px;
  color: var(--kx-muted);
}
.kx-total strong {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 500;
}

.kx-pay {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 0;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(180deg, #4f8bff, #2563eb);
  box-shadow: 0 12px 34px rgba(59, 130, 246, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: 0.15s;
}
.kx-pay:hover:not(:disabled) {
  background: linear-gradient(180deg, #6699ff, #3b82f6);
}
.kx-pay:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}
.kx-pay svg {
  width: 14px;
  height: 14px;
}

.kx-foot {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  color: var(--kx-muted-2);
}
.kx-foot svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}
.kx-foot p {
  font-size: 12.5px;
  line-height: 1.6;
  margin: 0;
}

/* ---- secondary buttons, used by the wallet and result screens ---- */

.kx-ghost {
  padding: 11px 18px;
  border-radius: 11px;
  border: 1px solid var(--kx-line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--kx-text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: 0.15s;
}
.kx-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--kx-text);
}
.kx-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  margin-top: 20px;
}
.kx-actions .kx-pay {
  width: auto;
  padding: 11px 22px;
  font-size: 13.5px;
  border-radius: 11px;
}

/* ---- error, wallet list and progress screens ---- */

.kx-error {
  padding: 12px 14px;
  margin-bottom: 18px;
  border-radius: 11px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  font-size: 13px;
  line-height: 1.55;
  color: #fda4af;
}
.kx-lede {
  font-size: 13.5px;
  color: var(--kx-muted);
  line-height: 1.65;
  margin: 0 0 18px;
}
.kx-lede b {
  color: var(--kx-text-2);
}

.kx-wallets {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.kx-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--kx-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--kx-text-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: 0.15s;
}
.kx-wallet:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: var(--kx-text);
}
.kx-wicon {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--kx-line);
  color: #93c5fd;
  font-size: 13px;
  font-weight: 700;
}
.kx-wicon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.kx-wicon svg {
  width: 15px;
  height: 15px;
}

.kx-state {
  text-align: center;
  padding: 8px 0 6px;
}
.kx-state p {
  font-size: 13.5px;
  color: var(--kx-muted);
  line-height: 1.65;
  margin: 0 auto;
  max-width: 36ch;
}
.kx-state p + p {
  margin-top: 10px;
}
.kx-state b {
  color: var(--kx-text-2);
}

.kx-spin {
  width: 38px;
  height: 38px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--kx-accent);
  animation: kx-spin 0.75s linear infinite;
}
.kx-spin.sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  margin: 0;
  display: inline-block;
  vertical-align: -3px;
}
@keyframes kx-spin {
  to {
    transform: rotate(1turn);
  }
}

.kx-badge {
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}
.kx-badge.bad {
  background: rgba(244, 63, 94, 0.14);
  border-color: rgba(244, 63, 94, 0.3);
  color: #fb7185;
}
.kx-badge svg {
  width: 24px;
  height: 24px;
}

.kx-progress {
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin: 18px auto 0;
  max-width: 240px;
}
.kx-progress i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--kx-accent);
  transition: width 0.4s var(--ease);
}

.kx-tx {
  display: inline-block;
  margin-top: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #93c5fd;
  word-break: break-all;
}
.kx-tx:hover {
  color: #bfdbfe;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 520px) {
  .kx-modal {
    padding: 20px;
    border-radius: 18px;
  }
  .kx-grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .kx-card-ghost {
    display: none;
  }
  .kx-plan {
    padding: 16px;
    gap: 12px;
  }
  .kx-plan-price strong {
    font-size: 26px;
  }
  .kx-head h2 {
    font-size: 19px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kx-spin {
    animation-duration: 2.4s;
  }
}
