/* ==========================================================================
   AuCore — Design System v2
   Calm, high-contrast, restrained. Developed by AuR AI 2026.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #0a0c10;
  --bg-2: #0e1116;
  --surface: #12151b;
  --surface-2: #171b22;
  --line: #23282f;
  --line-2: #2f353e;

  /* text */
  --text: #e7eaef;
  --text-2: #a8b0bd;
  --text-3: #6f7887;

  /* accent — one hue, used sparingly */
  --accent: #6470f3;
  --accent-2: #8b95f7;
  --accent-bg: rgba(100, 112, 243, 0.12);
  --accent-line: rgba(100, 112, 243, 0.35);

  /* semantic */
  --ok: #3fbf7f;
  --ok-bg: rgba(63, 191, 127, 0.12);
  --warn: #d9a13a;
  --warn-bg: rgba(217, 161, 58, 0.12);
  --err: #e0596b;
  --err-bg: rgba(224, 89, 107, 0.12);
  --info: #3aa8c4;

  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 7px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, .28);
  --shadow-3: 0 16px 48px -16px rgba(0, 0, 0, .6);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;

  --nav-h: 64px;
  --gut: 80px;
  /* page gutter — never let text touch the edge */
  --maxw: 1140px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #fcfcfd;
  --bg-2: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --line: #e3e6ea;
  --line-2: #d3d8de;
  --text: #14171d;
  --text-2: #4e5666;
  --text-3: #838b99;
  --accent: #4f5ae0;
  --accent-2: #3b45c9;
  --accent-bg: rgba(79, 90, 224, 0.08);
  --accent-line: rgba(79, 90, 224, 0.28);
  --ok: #16855a;
  --ok-bg: rgba(22, 133, 90, .09);
  --warn: #9a6f13;
  --warn-bg: rgba(154, 111, 19, .1);
  --err: #c33d51;
  --err-bg: rgba(195, 61, 81, .09);
  --shadow-1: 0 1px 2px rgba(16, 20, 30, .05);
  --shadow-2: 0 4px 14px rgba(16, 20, 30, .07);
  --shadow-3: 0 14px 40px -14px rgba(16, 20, 30, .16);
}

/* ------------------------------------------------------------------ base -- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}

/* soft ambient wash */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(680px 420px at 8% -8%, var(--accent-bg), transparent 70%),
    radial-gradient(560px 380px at 100% 0%, rgba(58, 168, 196, .06), transparent 70%);
}

/* animated starfield canvas — sits above the wash, below all content */
#sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  display: block;
}

[data-theme="light"] #sky {
  opacity: .5;
}

::selection {
  background: var(--accent-bg);
  color: var(--text);
}

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

h1,
h2,
h3,
h4,
h5 {
  margin: 0 0 .55em;
  font-weight: 650;
  letter-spacing: -.021em;
  line-height: 1.22;
  color: var(--text);
}

h1 {
  font-size: clamp(1.95rem, 3.6vw, 2.9rem);
  letter-spacing: -.03em;
  line-height: 1.12;
}

h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
}

h3 {
  font-size: 1.06rem;
}

h4 {
  font-size: .93rem;
}

p {
  margin: 0 0 1rem;
  color: var(--text-2);
}

p:last-child {
  margin-bottom: 0;
}

strong {
  color: var(--text);
  font-weight: 600;
}

code,
pre,
.mono,
kbd {
  font-family: var(--mono);
  font-variant-ligatures: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}

img,
svg {
  max-width: 100%;
}

/* ---------------------------------------------------------------- layout -- */

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + var(--gut) * 2);
  margin: 0 auto;
  padding: 0 var(--gut);
}

.wrap-sm {
  max-width: calc(820px + var(--gut) * 2);
}

@media (max-width: 1320px) {
  :root {
    --gut: 64px;
  }
}

@media (max-width: 1100px) {
  :root {
    --gut: 48px;
  }
}

@media (max-width: 860px) {
  :root {
    --gut: 36px;
  }
}

@media (max-width: 600px) {
  :root {
    --gut: 24px;
  }
}

@media (max-width: 420px) {
  :root {
    --gut: 18px;
  }
}

.section {
  padding: 84px 0;
}

.section-sm {
  padding: 48px 0;
}

.section-head {
  max-width: 640px;
  margin-bottom: 40px;
}

.grid {
  display: grid;
  gap: 20px;
}

.g2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.g3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.g4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {

  .g3,
  .g4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {

  .g2,
  .g3,
  .g4 {
    grid-template-columns: 1fr;
  }
}

.flex {
  display: flex;
  gap: 12px;
  align-items: center;
}

.between {
  justify-content: space-between;
}

.wrapf {
  flex-wrap: wrap;
}

.col {
  display: flex;
  flex-direction: column;
}

.stack>*+* {
  margin-top: 12px;
}

.stack-lg>*+* {
  margin-top: 20px;
}

.center {
  text-align: center;
}

.right {
  text-align: right;
}

.hidden {
  display: none !important;
}

.grow {
  flex: 1;
}

/* ------------------------------------------------------------- typography -- */

.eyebrow {
  font-size: .7rem;
  font-weight: 650;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.lead {
  font-size: 1.06rem;
  color: var(--text-2);
  line-height: 1.6;
}

.small {
  font-size: .845rem;
}

.tiny {
  font-size: .775rem;
}

.muted {
  color: var(--text-3);
}

.dim {
  color: var(--text-2);
}

.accent-txt {
  color: var(--accent);
}

.nowrap {
  white-space: nowrap;
}

.mb0 {
  margin-bottom: 0 !important;
}

.num {
  font-size: 1.65rem;
  font-weight: 650;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  color: var(--text);
}

.num-sm {
  font-size: 1.2rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- surfaces -- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-1);
}

.card-p0 {
  padding: 0;
  overflow: hidden;
}

.card-tight {
  padding: 18px;
}

.hoverable {
  transition: border-color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}

.hoverable:hover {
  border-color: var(--line-2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}

.card-accent {
  border-color: var(--accent-line);
}

.card-quiet {
  background: var(--surface-2);
  box-shadow: none;
}

/* ---------------------------------------------------------------- badges --- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  white-space: nowrap;
}

.badge-accent {
  background: var(--accent-bg);
  border-color: var(--accent-line);
  color: var(--accent);
}

.badge-ok {
  background: var(--ok-bg);
  border-color: transparent;
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-bg);
  border-color: transparent;
  color: var(--warn);
}

.badge-err {
  background: var(--err-bg);
  border-color: transparent;
  color: var(--err);
}

.badge-mono {
  font-family: var(--mono);
  font-size: .7rem;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: 0 0 auto;
}

.dot-warn {
  background: var(--warn);
}

.dot-err {
  background: var(--err);
}

.dot-live {
  position: relative;
}

.dot-live::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--ok);
  opacity: .5;
  animation: ping 2.4s var(--ease) infinite;
}

@keyframes ping {
  0% {
    transform: scale(.7);
    opacity: .6
  }

  70%,
  100% {
    transform: scale(1.5);
    opacity: 0
  }
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  font-size: .72rem;
  line-height: 1.5;
  text-align: center;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  color: var(--text-2);
}

/* --------------------------------------------------------------- buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  font: inherit;
  font-size: .875rem;
  font-weight: 550;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), opacity .16s;
}

.btn:hover {
  background: var(--accent-2);
}

.btn:active {
  transform: translateY(.5px);
}

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

.btn-2 {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--line-2);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--err);
  border-color: var(--err-bg);
}

.btn-danger:hover {
  background: var(--err-bg);
  border-color: var(--err);
}

.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: .8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  height: 44px;
  padding: 0 22px;
  font-size: .93rem;
}

.btn-block {
  width: 100%;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: .45;
  pointer-events: none;
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
}

/* ----------------------------------------------------------------- forms --- */

label,
.label {
  display: block;
  margin-bottom: 6px;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
}

input,
select,
textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  font: inherit;
  font-size: .875rem;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}

textarea {
  height: auto;
  min-height: 84px;
  padding: 9px 11px;
  resize: vertical;
  line-height: 1.55;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 16px, calc(100% - 10px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--line-2);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-3);
}

input[type="checkbox"],
input[type="radio"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

input[type="range"] {
  height: 20px;
  padding: 0;
  background: none;
  border: none;
  accent-color: var(--accent);
}

.field {
  margin-bottom: 14px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row>* {
  flex: 1 1 160px;
  min-width: 0;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: .85rem;
  color: var(--text-2);
  font-weight: 400;
  margin-bottom: 0;
}

.check input {
  flex: 0 0 auto;
}

.hint {
  font-size: .78rem;
  color: var(--text-3);
  margin-top: 5px;
}

/* ------------------------------------------------------------------ nav ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-in {
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--nav-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  letter-spacing: -.02em;
  font-size: .97rem;
  flex: 0 0 auto;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: block;
  border-radius: 8px;
}

.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-lg {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: 10px;
}

.nav-links a {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: .855rem;
  font-weight: 500;
  color: var(--text-2);
  transition: color .15s, background .15s;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-links a[aria-current] {
  color: var(--text);
  font-weight: 550;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex: 0 0 auto;
}

/* ---- language pill (injected by core.js, right of the Dashboard button) --- */
.core-lang {
  position: relative;
  display: inline-flex;
}

.core-lang__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 650;
  letter-spacing: .03em;
}

.core-lang__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 164px;
  padding: 6px;
  z-index: 210;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* the author display:flex above would otherwise beat the UA [hidden] rule,
   leaving the dropdown open forever */
.core-lang__menu[hidden] {
  display: none;
}

.core-lang__opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 11px;
  font-size: .84rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.core-lang__opt:hover {
  background: var(--surface-2);
  color: var(--text);
}

.core-lang__opt.active {
  color: var(--accent);
  font-weight: 650;
}

.nav-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px 0 10px;
  min-width: 172px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  font-size: .8rem;
  cursor: pointer;
  transition: border-color .15s;
}

.nav-search:hover {
  border-color: var(--line-2);
  color: var(--text-2);
}

.nav-search kbd {
  margin-left: auto;
}

.nav-burger {
  display: none;
}

@media (max-width: 1080px) {
  .nav-links {
    display: none;
  }

  .nav-burger {
    display: grid;
    place-items: center;
  }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    padding: 14px var(--gut) 18px;
    margin: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-3);
    max-height: 70vh;
    overflow-y: auto;
  }

  .nav-links.open a {
    padding: 10px 12px;
  }

  .nav-search {
    min-width: 0;
    width: 30px;
    padding: 0;
    justify-content: center;
  }

  .nav-search span:not([aria-hidden]),
  .nav-search kbd {
    display: none;
  }
}

@media (max-width: 640px) {

  /* flag-only language pill so the header row stays compact on phones */
  .core-lang__btn span:nth-child(2),
  .core-lang__btn span:nth-child(3) {
    display: none;
  }

  .core-lang__btn {
    padding: 0 8px;
  }
}

/* grid children default to min-width:auto, letting long code lines stretch
   the whole page sideways on phones */
.grid>* {
  min-width: 0;
}

/* ---------------------------------------------------------------- tables --- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
}

th,
td {
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: .73rem;
  font-weight: 600;
  color: var(--text-3);
  background: var(--surface-2);
  white-space: nowrap;
  position: sticky;
  top: 0;
}

td {
  color: var(--text-2);
}

td strong,
td .num-sm {
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr {
  transition: background .12s;
}

tbody tr:hover {
  background: var(--surface-2);
}

.td-num {
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ code --- */

pre.code {
  margin: 0 0 14px;
  padding: 18px 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: .815rem;
  line-height: 1.6;
  color: var(--text);
  tab-size: 2;
}

pre.code .k {
  color: var(--accent-2);
}

pre.code .s {
  color: var(--ok);
}

pre.code .c {
  color: var(--text-3);
  font-style: italic;
}

pre.code .n {
  color: var(--warn);
}

.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px 9px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}

.code-head+pre.code {
  border-radius: 0 0 var(--radius) var(--radius);
}

.copyfield {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 8px 7px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--text);
}

.copyfield>span:first-child {
  overflow-x: auto;
  white-space: nowrap;
  flex: 1;
  scrollbar-width: none;
}

.copyfield>span:first-child::-webkit-scrollbar {
  display: none;
}

/* ------------------------------------------------------------------ tabs --- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
}

.tabs button {
  position: relative;
  padding: 9px 13px;
  border: 0;
  background: none;
  font: inherit;
  font-size: .865rem;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s;
}

.tabs button:hover {
  color: var(--text-2);
}

.tabs button[aria-selected="true"] {
  color: var(--text);
  font-weight: 550;
}

.tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.seg {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.seg button {
  padding: 5px 11px;
  border: 0;
  background: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.seg button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-1);
}

/* ------------------------------------------------------------------ meter -- */

.meter {
  height: 5px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter>i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--accent);
  transition: width .5s var(--ease);
}

.meter.ok>i {
  background: var(--ok);
}

.meter.warn>i {
  background: var(--warn);
}

.meter.err>i {
  background: var(--err);
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 78px;
}

.bars>i {
  flex: 1;
  min-width: 2px;
  height: 2px;
  background: var(--accent);
  opacity: .55;
  border-radius: 2px;
  transition: opacity .15s;
}

.bars>i:hover {
  opacity: 1;
}

.bars>i.hi {
  opacity: .9;
}

.heat {
  display: flex;
  gap: 2px;
}

.heat>i {
  flex: 1;
  min-width: 3px;
  height: 26px;
  border-radius: 2px;
  background: var(--ok);
  opacity: .75;
}

.heat>i.w {
  background: var(--warn);
}

.heat>i.e {
  background: var(--err);
}

/* ------------------------------------------------------------------ misc --- */

.kv {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: .855rem;
  padding: 6px 0;
}

.kv>span:first-child {
  color: var(--text-3);
}

.kv>span:last-child,
.kv>strong {
  color: var(--text);
  font-weight: 550;
  text-align: right;
}

.kv-list>.kv+.kv {
  border-top: 1px solid var(--line);
}

/* Long URLs / keys must wrap inside their container instead of overflowing
   the card (e.g. the playground endpoint row). */
.kv>span,
.kv>strong,
.copyfield>span,
.mono {
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

.divide>*+* {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.empty {
  padding: 34px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: .875rem;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background: var(--accent-bg);
  color: var(--accent);
  font-size: .74rem;
  font-weight: 650;
}

/* --------------------------------------------------------------- toast ----- */

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 330px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-3);
  font-size: .855rem;
}

.toast .dot {
  width: 6px;
  height: 6px;
}

/* --------------------------------------------------------------- dialog ---- */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(6, 8, 12, .6);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}

[data-theme="light"] .scrim {
  background: rgba(20, 24, 32, .34);
}

.dialog {
  width: 100%;
  max-width: 460px;
  max-height: 86vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: 26px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-head h3 {
  margin: 0;
}

/* ------------------------------------------------------- command palette --- */

.cmdk {
  position: fixed;
  inset: 0;
  z-index: 180;
  background: rgba(6, 8, 12, .55);
  backdrop-filter: blur(3px);
  padding: 10vh 20px 20px;
}

[data-theme="light"] .cmdk {
  background: rgba(20, 24, 32, .3);
}

.cmdk-box {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}

.cmdk-input {
  height: 46px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: .95rem;
  padding: 0 16px;
}

.cmdk-input:focus {
  box-shadow: none;
  border-color: var(--line);
}

.cmdk-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}

.cmdk-group {
  font-size: .69rem;
  font-weight: 650;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 10px 4px;
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text-2);
  cursor: pointer;
}

.cmdk-item[aria-selected="true"] {
  background: var(--accent-bg);
  color: var(--text);
}

.cmdk-item .ci-ic {
  width: 18px;
  text-align: center;
  color: var(--text-3);
  flex: 0 0 auto;
}

.cmdk-item .ci-sub {
  margin-left: auto;
  font-size: .76rem;
  color: var(--text-3);
  font-family: var(--mono);
}

.cmdk-foot {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: .74rem;
  color: var(--text-3);
  background: var(--surface-2);
}

/* --------------------------------------------------------------- banner ---- */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--gut);
  font-size: .82rem;
  color: var(--text-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.banner a {
  color: var(--accent);
  font-weight: 550;
}

.banner button {
  margin-left: auto;
}

/* ----------------------------------------------------------------- prose --- */

.prose {
  max-width: 700px;
}

.prose h2 {
  margin-top: 42px;
  padding-top: 4px;
  font-size: 1.28rem;
}

.prose h3 {
  margin-top: 26px;
  font-size: 1rem;
}

.prose>p,
.prose li {
  color: var(--text-2);
}

.prose ul,
.prose ol {
  padding-left: 20px;
  margin: 0 0 1rem;
}

.prose li {
  margin-bottom: 6px;
}

.prose li::marker {
  color: var(--text-3);
}

.prose code {
  padding: 1px 5px;
  font-size: .86em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
}

.prose a:not(.btn) {
  color: var(--accent);
  border-bottom: 1px solid var(--accent-line);
}

.prose table {
  margin-bottom: 1rem;
}

.toc {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  align-self: start;
}

.toc a {
  display: block;
  padding: 4px 10px;
  font-size: .82rem;
  color: var(--text-3);
  border-left: 2px solid var(--line);
}

.toc a:hover {
  color: var(--text-2);
}

.toc a[aria-current] {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 550;
}

/* ------------------------------------------------------------------ chat --- */

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 400px;
  overflow-y: auto;
  padding-right: 4px;
}

.bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 12px;
  font-size: .885rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble.me {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble.ai {
  align-self: flex-start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}

.bubble.note {
  align-self: center;
  max-width: 100%;
  background: none;
  color: var(--text-3);
  font-size: .8rem;
  padding: 4px;
}

/* ---------------------------------------------------------------- footer --- */

.footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 32px;
  margin-top: 72px;
  background: var(--bg-2);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr repeat(4, 1fr);
  gap: 34px;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer h5 {
  font-size: .74rem;
  font-weight: 650;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

.footer nav a {
  display: block;
  padding: 3px 0;
  font-size: .855rem;
  color: var(--text-2);
}

.footer nav a:hover {
  color: var(--text);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-size: .8rem;
  color: var(--text-3);
}

/* -------------------------------------------------------------- gate page -- */

.gate {
  min-height: calc(100vh - var(--nav-h) - 120px);
  display: grid;
  place-items: center;
  padding: 48px 0;
}

.gate-card {
  width: 100%;
  max-width: 400px;
}

/* ------------------------------------------------------------ hero orbit -- */

.orbit-ring {
  fill: none;
  stroke: var(--line-2);
  stroke-width: 1;
}

.orbit-ring-dash {
  fill: none;
  stroke: var(--accent-line);
  stroke-width: 1;
  stroke-dasharray: 3 7;
}

.orbit-planet {
  stroke: var(--bg);
  stroke-width: 2.5;
}

.orbit-label {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--text-3);
}

/* --------------------------------------------------------------- utility --- */

[data-reveal] {
  will-change: opacity, transform;
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 99px;
  border: 3px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}

@media print {

  .nav,
  .footer,
  .toasts,
  .banner {
    display: none !important;
  }
}

/* ==========================================================================
   Rendered Markdown (model replies)
   ========================================================================== */

.bubble.ai>*:first-child {
  margin-top: 0;
}

.bubble.ai>*:last-child {
  margin-bottom: 0;
}

.bubble.ai p {
  margin: 0 0 .7em;
  color: inherit;
}

.bubble.ai strong {
  font-weight: 650;
  color: var(--text);
}

.bubble.ai em {
  font-style: italic;
}

.bubble.ai del {
  opacity: .6;
}

.bubble.ai .md-h {
  margin: 1.1em 0 .45em;
  font-weight: 650;
  letter-spacing: -.015em;
  line-height: 1.3;
}

.bubble.ai h1.md-h {
  font-size: 1.18rem;
}

.bubble.ai h2.md-h {
  font-size: 1.08rem;
}

.bubble.ai h3.md-h {
  font-size: 1rem;
}

.bubble.ai h4.md-h,
.bubble.ai h5.md-h,
.bubble.ai h6.md-h {
  font-size: .94rem;
}

.bubble.ai ul,
.bubble.ai ol {
  margin: 0 0 .7em;
  padding-left: 1.35em;
}

.bubble.ai li {
  margin-bottom: .3em;
}

.bubble.ai li::marker {
  color: var(--text-3);
}

.bubble.ai ul ul,
.bubble.ai ol ol,
.bubble.ai ul ol,
.bubble.ai ol ul {
  margin: .3em 0 0;
}

.bubble.ai blockquote {
  margin: 0 0 .7em;
  padding: .1em 0 .1em .85em;
  border-left: 2px solid var(--accent-line);
  color: var(--text-2);
}

.bubble.ai hr {
  margin: 1em 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.bubble.ai a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.bubble.ai a:hover {
  text-decoration-thickness: 2px;
}

/* inline code */
.bubble.ai code {
  padding: .12em .38em;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .87em;
  word-break: break-word;
}

/* fenced code block */
.md-code {
  margin: 0 0 .8em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
}

.md-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 6px 5px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}

.md-code-head span {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--text-3);
  text-transform: lowercase;
  letter-spacing: .02em;
}

.md-copy {
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-2);
  font: inherit;
  font-size: .72rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.md-copy:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-2);
}

.md-code pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
  background: none;
  border: 0;
}

.md-code pre code {
  padding: 0;
  background: none;
  border: 0;
  font-size: .82rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre;
}

/* tables inside replies */
.md-table {
  margin: 0 0 .8em;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.md-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

.md-table th,
.md-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.md-table th {
  background: var(--surface-2);
  font-size: .74rem;
  font-weight: 600;
  color: var(--text-3);
  white-space: nowrap;
}

.md-table tbody tr:last-child td {
  border-bottom: 0;
}

/* the user's own bubble keeps plain text on the accent fill */
.bubble.me {
  white-space: pre-wrap;
}

/* ==========================================================================
   MOBILE SUPPORT — phones & small tablets
   The desktop layout above stays untouched; everything here only applies
   below 760px and tightens further below 420px.
   ========================================================================== */

@media (max-width: 760px) {

  /* ---- base rhythm ---- */
  :root {
    --gut: 18px;
    --nav-h: 56px;
  }

  body {
    font-size: 14.5px;
  }

  h1 {
    font-size: clamp(1.5rem, 8vw, 2rem);
  }

  .section {
    padding: 52px 0;
  }

  /* ---- nav: burger menu already exists; tighten spacing ---- */
  .nav-in {
    gap: 8px;
  }

  .brand span:last-child {
    display: none;
  }

  /* mark only, saves width */
  .nav-search {
    min-width: 0;
    width: 30px;
    padding: 0;
    justify-content: center;
  }

  .nav-search span:not([aria-hidden]),
  .nav-search kbd {
    display: none;
  }

  #nav-cta {
    padding: 0 10px;
    font-size: .78rem;
  }

  /* ---- cards & grids stack ---- */
  .card {
    padding: 20px 16px;
    border-radius: var(--radius);
  }

  .g2,
  .g3,
  .g4 {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  .grid[style*="290px"] {
    grid-template-columns: 1fr !important;
  }

  /* playground */

  /* ---- tables become horizontally scrollable with sticky first col ---- */
  .table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 10px 12px;
    font-size: .82rem;
    white-space: normal;
  }

  th {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  /* ---- forms full-width, larger touch targets ---- */
  input,
  select,
  textarea {
    height: 44px;
    font-size: 16px;
  }

  /* 16px kills iOS zoom */
  textarea {
    min-height: 96px;
  }

  .btn {
    height: 42px;
  }

  .btn-sm {
    height: 36px;
  }

  .row>* {
    flex: 1 1 100%;
  }

  /* ---- hero / headers ---- */
  header.wrap {
    padding-top: 28px !important;
  }

  .lead {
    font-size: .95rem;
  }

  /* ---- footer stacks to one column ---- */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 22px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* ---- status page rows wrap cleanly ---- */
  #services>div {
    padding: 13px 16px !important;
  }

  #services .flex.between {
    gap: 10px;
  }

  #services .right {
    text-align: left;
  }

  .heat {
    flex-wrap: wrap;
  }

  .heat>i {
    min-width: calc(10% - 3px);
    height: 20px;
  }

  /* ---- chat / playground ---- */
  .chat {
    height: 320px;
  }

  .bubble {
    max-width: 92%;
    font-size: .85rem;
  }

  #pg {
    grid-template-columns: 1fr !important;
  }

  /* ---- command palette ---- */
  .cmdk {
    padding-top: 6vh;
  }

  .cmdk-box {
    max-width: 94vw;
  }

  /* ---- dialogs ---- */
  .dialog {
    max-width: 94vw;
    padding: 20px 16px;
  }

  /* ---- admin tabs scroll horizontally (already) + KPI grid 2-col ---- */
  #kpi {
    grid-template-columns: 1fr 1fr !important;
  }

  #kpi>div {
    border-right: none !important;
    border-bottom: 1px solid var(--line);
    padding: 16px !important;
  }

  #kpi>div:nth-child(3),
  #kpi>div:nth-child(4) {
    border-bottom: none;
  }

  .num {
    font-size: 1.35rem;
  }

  /* ---- copy fields don't overflow ---- */
  .copyfield {
    flex-wrap: nowrap;
  }

  .copyfield>span:first-child {
    overflow-x: auto;
  }

  /* ---- toasts stay on screen ---- */
  .toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast {
    max-width: none;
  }
}

@media (max-width: 420px) {
  :root {
    --gut: 14px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .heat>i {
    min-width: calc(9% - 2px);
  }

  .kv {
    flex-direction: column;
    gap: 2px;
  }

  .kv>strong,
  .kv>span:last-child {
    text-align: left;
  }
}

/* ---- gate overlay is self-contained (own <style> in gate.js) but make
       sure the Friendly Captcha widget never overflows a phone card ---- */
.g-frc-host iframe,
.g-frc-host div {
  max-width: 100%;
}