@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700&family=Barlow:wght@400;500;600;700&display=swap');

:root {
  --brand: #e02e24;
  --brand-hot: #f04438;
  --brand-dim: #c41f1a;
  --brand-glow: rgb(224 46 36 / 0.18);
  --bg: #070708;
  --bg-elevated: #0e0e11;
  --surface: #111114;
  --surface-2: #18181c;
  --border: rgb(255 255 255 / 0.08);
  --border-strong: rgb(255 255 255 / 0.14);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --muted-2: #71717a;
  --radius: 14px;
  --radius-lg: 18px;
  --font: 'Barlow', system-ui, sans-serif;
  --font-display: 'Barlow Condensed', 'Barlow', sans-serif;
  --shadow: 0 24px 60px rgb(0 0 0 / 0.45);
  --header-h: 72px;
  --page-pad: clamp(12px, 3.5vw, 16px);
  --touch-min: 44px;
}

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

button {
  font-family: inherit;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 8% -8%, var(--brand-glow), transparent 55%),
    radial-gradient(900px 500px at 92% 0%, rgb(255 255 255 / 0.04), transparent 50%),
    radial-gradient(600px 400px at 50% 100%, rgb(224 46 36 / 0.06), transparent 60%),
    var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

img {
  display: block;
}

.wrap {
  width: min(1120px, calc(100% - 2 * var(--page-pad)));
  margin-inline: auto;
  padding-inline: env(safe-area-inset-left) env(safe-area-inset-right);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  min-height: var(--header-h);
  margin-bottom: 0.5rem;
  padding: 0.75rem max(var(--page-pad), env(safe-area-inset-right)) 0.75rem
    max(var(--page-pad), env(safe-area-inset-left));
  backdrop-filter: blur(16px);
  background: linear-gradient(to bottom, rgb(7 7 8 / 0.92), rgb(7 7 8 / 0.65));
  border-bottom: 1px solid transparent;
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-items: center;
  column-gap: 0.75rem;
  width: min(1120px, 100%);
  margin-inline: auto;
}

.brand {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  min-width: 0;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  box-shadow: 0 4px 16px rgb(224 46 36 / 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-text strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.brand-text small {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-actions {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}

.btn--compact {
  min-height: 34px;
  padding: 0 0.85rem;
  font-size: 0.82rem;
}

.btn--icon {
  flex: 0 0 auto;
  flex-shrink: 0;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  padding: 0 !important;
  border-radius: 10px;
}

.btn--icon .btn-icon {
  display: block;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.lang-switch {
  display: inline-flex;
  flex-shrink: 0;
  gap: 0;
  padding: 0;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04);
}

.lang-btn {
  appearance: none;
  -webkit-appearance: none;
  min-height: 38px;
  min-width: 48px;
  padding: 0 14px;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.lang-btn + .lang-btn {
  border-left: 1px solid var(--border-strong);
}

.lang-btn.is-active {
  background: var(--text);
  color: var(--bg);
  box-shadow: inset 0 -2px 0 var(--brand);
}

.lang-btn:not(.is-active):hover {
  color: #fff;
  background: rgb(224 46 36 / 0.12);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--brand-hot);
  outline-offset: 2px;
  z-index: 1;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: var(--touch-min);
  padding: 0.62rem 1.05rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgb(255 255 255 / 0.03);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.btn:hover {
  background: rgb(255 255 255 / 0.07);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--brand);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 24px rgb(224 46 36 / 0.28);
}

.btn--primary:hover {
  background: var(--brand-hot);
  box-shadow: 0 10px 28px rgb(224 46 36 / 0.35);
}

.btn--ghost {
  background: transparent;
}

.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2.5rem;
  align-items: center;
  padding: 2rem 0 3.5rem;
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgb(224 46 36 / 0.25);
  background: rgb(224 46 36 / 0.1);
  color: #ffb4ae;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-hot);
  box-shadow: 0 0 10px var(--brand);
}

.hero h1 {
  margin: 1rem 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.75rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  max-width: 12ch;
}

.hero p.lead {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.06rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.75rem;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgb(255 255 255 / 0.02);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.stat-pill strong {
  color: var(--text);
  font-weight: 700;
}

.hero-visual {
  position: relative;
  min-width: 0;
}

.code-block {
  margin: 0;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgb(255 255 255 / 0.04), rgb(0 0 0 / 0.35));
  box-shadow: var(--shadow);
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 0.8rem;
  color: #d4d4d8;
  overflow-x: auto;
  line-height: 1.65;
}

.code-block .dim {
  color: var(--muted-2);
}

.code-block .key {
  color: #7dd3fc;
}

.code-block .str {
  color: #86efac;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  padding-bottom: 3rem;
}

.card {
  position: relative;
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface), var(--bg-elevated));
  transition: border-color 0.2s, transform 0.2s;
}

.card:hover {
  border-color: rgb(224 46 36 / 0.35);
  transform: translateY(-2px);
}

.card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: 0.85rem;
  border-radius: 10px;
  background: rgb(224 46 36 / 0.12);
  color: #ffb4ae;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
}

.card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.card code {
  padding: 0.12rem 0.35rem;
  border-radius: 6px;
  background: rgb(255 255 255 / 0.06);
  font-size: 0.85em;
}

.cta-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 3rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid rgb(224 46 36 / 0.22);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgb(224 46 36 / 0.12), rgb(255 255 255 / 0.02));
}

.cta-band h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.cta-band p {
  margin: 0;
  max-width: 48ch;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
}

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

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.footer-links a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgb(255 255 255 / 0.2);
}

.panel {
  max-width: 540px;
  margin: 3rem auto 5rem;
  padding: 2.25rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius-lg) + 2px);
  background: linear-gradient(160deg, var(--surface), var(--bg-elevated));
  text-align: center;
  box-shadow: var(--shadow);
}

.panel h1 {
  margin: 0.5rem 0;
  font-family: var(--font-display);
  font-size: 2rem;
  text-transform: uppercase;
}

.panel p {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.legal-page {
  padding-bottom: 4rem;
}

.page-hero {
  padding: 1rem 0 2rem;
}

.page-hero h1 {
  margin: 0.75rem 0 0.35rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  text-transform: uppercase;
}

.page-hero .meta {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.page-sub {
  margin: 0.5rem 0 0;
  color: var(--muted);
  max-width: 52ch;
}

.legal-notice {
  margin: 0 0 1.5rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  border: 1px solid rgb(224 46 36 / 0.25);
  background: rgb(224 46 36 / 0.08);
  color: #ffd0cc;
  font-size: 0.9rem;
}

.legal-content {
  display: grid;
  gap: 1.75rem;
}

.legal-content section h2 {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.legal-content section p,
.legal-content section ul {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.legal-content section p:last-child,
.legal-content section ul:last-child {
  margin-bottom: 0;
}

.legal-content ul {
  padding-left: 1.25rem;
}

.legal-link {
  color: #ffb4ae;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-link:hover {
  color: #fff;
}

.legal-footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.88rem;
}

/* —— Dashboard —— */
.dash {
  padding: 0.5rem 0 2.5rem;
}

.dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-title {
  margin: 0.35rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  text-transform: uppercase;
}

.dash-sub {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 0.95rem;
}

.dash-badge {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgb(224 46 36 / 0.35);
  background: rgb(224 46 36 / 0.12);
  color: #ffb4ae;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(160deg, var(--surface), var(--bg-elevated));
}

.stat-card-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat-card-value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.stat-card-value--plan {
  font-size: 1.15rem;
  text-transform: uppercase;
  color: #ffb4ae;
}

.dash-panel {
  margin-top: 1rem;
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--surface), var(--bg-elevated));
}

.dash-panel--compact {
  padding-bottom: 1rem;
}

.dash-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.dash-panel-head h2,
.dash-panel-title {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.dash-panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.dash-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.usage-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.45rem;
  height: 140px;
  margin-bottom: 1.25rem;
  padding: 0.5rem 0 0;
}

.usage-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  height: 100%;
  min-width: 0;
}

.usage-bar {
  width: 100%;
  max-width: 36px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(to top, var(--brand-dim), var(--brand-hot));
  transition: height 0.3s ease;
}

.usage-day {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.quota-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.quota-row strong {
  color: var(--text);
}

.quota-track {
  height: 8px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.06);
  overflow: hidden;
}

.quota-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand-dim), var(--brand-hot));
  transition: width 0.4s ease;
}

.key-list {
  display: grid;
  gap: 0.75rem;
}

.key-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgb(0 0 0 / 0.2);
}

.key-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.key-label {
  display: block;
  font-size: 0.95rem;
}

.key-meta {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.key-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: rgb(224 46 36 / 0.15);
  color: #ffb4ae;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.key-value {
  flex: 1 1 200px;
  min-width: 0;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgb(0 0 0 / 0.35);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: #d4d4d8;
  word-break: break-all;
}

.key-actions {
  display: flex;
  gap: 0.4rem;
}

.key-foot {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.ep-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.ep-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.ep-list li:last-child {
  border-bottom: 0;
}

.ep-list code {
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: rgb(255 255 255 / 0.06);
  font-size: 0.82em;
  color: #d4d4d8;
}

.dash-toast {
  position: fixed;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  white-space: nowrap;
  max-width: calc(100% - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-user {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.key-card--fresh {
  border-color: rgb(224 46 36 / 0.45);
  box-shadow: 0 0 0 1px rgb(224 46 36 / 0.12);
}

.key-fresh-hint {
  color: #ffb4ae;
  font-weight: 600;
}

.key-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* —— API Tester —— */
.dash-panel--tester {
  padding: 0;
  overflow: hidden;
  background: linear-gradient(165deg, rgb(255 255 255 / 0.02), rgb(0 0 0 / 0.12));
}

.dash-panel--tester .dash-panel-head {
  padding: 1.25rem 1.35rem 0;
}

.tester-console {
  display: grid;
  gap: 0;
}

.tester-compose {
  padding: 1rem 1.35rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(600px 200px at 0% 0%, rgb(224 46 36 / 0.08), transparent 55%),
    rgb(0 0 0 / 0.15);
}

.tester-request-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.65rem;
}

.tester-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 0.85rem;
  border-radius: 11px;
  border: 1px solid rgb(34 197 94 / 0.35);
  background: rgb(34 197 94 / 0.12);
  color: #86efac;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.ui-field {
  display: grid;
  gap: 0.4rem;
  min-width: 0;
}

.ui-field--endpoint {
  flex: 1;
}

.ui-field--token {
  grid-column: 1 / -1;
}

.ui-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.ui-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ui-input-wrap input {
  width: 100%;
  min-height: 46px;
  padding: 0.7rem 0.9rem 0.7rem 2.45rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgb(0 0 0 / 0.35);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.ui-input-wrap--token input {
  padding-right: 2.75rem;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.84rem;
}

.ui-input-wrap input::placeholder {
  color: var(--muted-2);
}

.ui-input-wrap input:focus {
  outline: none;
  border-color: rgb(224 46 36 / 0.55);
  box-shadow: 0 0 0 3px rgb(224 46 36 / 0.12);
}

.ui-input-icon {
  position: absolute;
  left: 0.85rem;
  color: var(--muted-2);
  pointer-events: none;
}

.ui-input-action {
  position: absolute;
  right: 0.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.ui-input-action:hover {
  color: var(--text);
  background: rgb(255 255 255 / 0.06);
}

/* Custom listbox */
.ui-listbox-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ui-listbox {
  position: relative;
}

.ui-listbox-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.04), rgb(0 0 0 / 0.28));
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.ui-listbox-trigger:hover {
  border-color: rgb(255 255 255 / 0.22);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.06), rgb(0 0 0 / 0.32));
}

.ui-listbox.is-open .ui-listbox-trigger,
.ui-listbox-trigger:focus-visible {
  outline: none;
  border-color: rgb(224 46 36 / 0.55);
  box-shadow: 0 0 0 3px rgb(224 46 36 / 0.12);
}

.ui-listbox-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.82rem;
}

.ui-listbox-chevron {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.ui-listbox.is-open .ui-listbox-chevron {
  transform: rotate(180deg);
  color: var(--text);
}

.ui-listbox-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  max-height: 240px;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgb(14 14 17 / 0.98);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.55);
}

.ui-listbox-menu[hidden] {
  display: none;
}

.ui-listbox-option {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.62rem 0.75rem;
  border-radius: 9px;
  color: #e4e4e7;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.ui-listbox-option::before {
  content: '';
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: transparent;
}

.ui-listbox-option:hover {
  background: rgb(255 255 255 / 0.06);
}

.ui-listbox-option.is-selected {
  background: rgb(224 46 36 / 0.14);
  color: #fff;
}

.ui-listbox-option.is-selected::before {
  background: var(--brand-hot);
  box-shadow: 0 0 8px rgb(224 46 36 / 0.6);
}

.ui-listbox-option.is-muted {
  color: var(--muted);
  font-family: var(--font);
  font-size: 0.82rem;
}

.tester-send {
  min-height: 46px;
  padding-inline: 1.15rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(224 46 36 / 0.28);
}

.tester-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.tester-chip {
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: rgb(0 0 0 / 0.22);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tester-chip:hover {
  color: var(--text);
  border-color: rgb(255 255 255 / 0.2);
}

.tester-chip.is-active {
  border-color: rgb(224 46 36 / 0.45);
  background: rgb(224 46 36 / 0.14);
  color: #ffd0cc;
  box-shadow: 0 0 0 1px rgb(224 46 36 / 0.12);
}

.tester-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.tester-hint {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid rgb(255 255 255 / 0.06);
  background: rgb(255 255 255 / 0.02);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.tester-output {
  overflow: hidden;
  background: rgb(0 0 0 / 0.35);
}

.tester-output-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 0.02);
}

.tester-output-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tester-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.tester-dot--r {
  background: #ff5f57;
}

.tester-dot--y {
  background: #febc2e;
}

.tester-dot--g {
  background: #28c840;
}

.tester-output-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.tester-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.6rem;
  padding: 0.22rem 0.6rem;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.08);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tester-status--ok {
  background: rgb(34 197 94 / 0.15);
  color: #86efac;
}

.tester-status--err {
  background: rgb(224 46 36 / 0.15);
  color: #ffb4ae;
}

.tester-meta {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.tester-url {
  display: block;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: #a1a1aa;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.76rem;
  word-break: break-all;
}

.tester-url:empty {
  display: none;
}

.tester-body {
  margin: 0;
  min-height: 140px;
  max-height: min(440px, 52vh);
  padding: 1rem;
  overflow: auto;
  color: #d4d4d8;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.tester-body:empty::before {
  content: attr(data-empty);
  color: var(--muted-2);
  font-style: italic;
}

@media (max-width: 820px) {
  .tester-request-line {
    grid-template-columns: 1fr;
  }

  .tester-method {
    width: fit-content;
    min-height: 36px;
  }

  .tester-fields {
    grid-template-columns: 1fr;
  }

  .ui-field--token {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .tester-compose {
    padding-inline: 1rem;
  }

  .tester-send {
    width: 100%;
  }
}

/* —— Auth / Login —— */
.auth-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.site-header--auth {
  margin-bottom: 0;
  border-bottom-color: var(--border);
}

.auth-shell {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 460px);
  min-height: calc(100vh - var(--header-h));
}

.auth-visual {
  position: relative;
  display: flex;
  align-items: center;
  padding: clamp(2rem, 5vw, 4rem) clamp(1.5rem, 4vw, 3.5rem);
  overflow: hidden;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(900px 500px at 15% 20%, rgb(224 46 36 / 0.22), transparent 55%),
    radial-gradient(700px 420px at 85% 80%, rgb(255 255 255 / 0.04), transparent 50%),
    linear-gradient(165deg, rgb(14 14 17 / 0.95), rgb(7 7 8 / 0.98));
}

.auth-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 30% 40%, black, transparent);
  pointer-events: none;
}

.auth-visual-inner {
  position: relative;
  z-index: 1;
  max-width: 34rem;
}

.auth-visual-kicker {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffb4ae;
}

.auth-visual-title {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.auth-visual-lead {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 32ch;
}

.auth-features {
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.85rem;
}

.auth-features li {
  position: relative;
  padding-left: 1.65rem;
  color: #e4e4e7;
  font-size: 0.95rem;
  font-weight: 500;
}

.auth-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px rgb(224 46 36 / 0.55);
}

.auth-code-preview {
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: rgb(0 0 0 / 0.35);
  backdrop-filter: blur(8px);
}

.auth-code-preview code {
  display: block;
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.82rem;
  line-height: 1.65;
  color: #d4d4d8;
  word-break: break-all;
}

.auth-panel-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 3vw, 2rem);
  background: var(--bg-elevated);
}

.auth-panel {
  width: min(400px, 100%);
  padding: clamp(1.5rem, 3vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.03), rgb(255 255 255 / 0.01));
  box-shadow: var(--shadow);
}

.auth-panel-head {
  margin-bottom: 1.35rem;
}

.auth-title {
  margin: 0.35rem 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.1rem);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.auth-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.auth-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgb(0 0 0 / 0.28);
}

.auth-mode-btn {
  padding: 0.58rem 0.75rem;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.auth-mode-btn:hover:not(.is-active) {
  color: var(--text);
}

.auth-mode-btn.is-active {
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}

.auth-msg {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.88rem;
}

.auth-msg--error {
  border: 1px solid rgb(224 46 36 / 0.35);
  background: rgb(224 46 36 / 0.1);
  color: #ffd0cc;
}

.auth-msg--ok {
  border: 1px solid rgb(34 197 94 / 0.35);
  background: rgb(34 197 94 / 0.08);
  color: #bbf7d0;
}

.auth-form {
  display: grid;
  gap: 0.9rem;
}

.auth-field {
  display: grid;
  gap: 0.38rem;
}

.auth-field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.auth-field input {
  width: 100%;
  padding: 0.72rem 0.9rem;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgb(0 0 0 / 0.32);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-field input::placeholder {
  color: var(--muted-2);
}

.auth-field input:focus {
  outline: none;
  border-color: rgb(224 46 36 / 0.55);
  box-shadow: 0 0 0 3px rgb(224 46 36 / 0.15);
}

.auth-form:not(.is-register) .auth-field--register {
  display: none;
}

.auth-submit {
  width: 100%;
  margin-top: 0.35rem;
  min-height: var(--touch-min);
  font-size: 0.95rem;
}

.auth-hint {
  margin: 1.1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

@media (max-width: 960px) {
  .auth-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-visual {
    display: none;
  }

  .auth-panel-wrap {
    padding-top: 2rem;
    padding-bottom: 2.5rem;
  }
}

@media (max-width: 640px) {
  .auth-panel {
    padding: 1.35rem 1.15rem;
    border-radius: var(--radius);
  }

  .site-header--auth .header-inner {
    column-gap: 0.5rem;
  }
}

@media (max-width: 900px) {
  .dash-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .dash-stats {
    grid-template-columns: 1fr 1fr;
  }

  .dash-panel {
    padding: 1rem;
  }

  .dash-panel-actions {
    width: 100%;
  }

  .dash-panel-actions .btn {
    flex: 1;
  }

  .key-row {
    flex-direction: column;
    align-items: stretch;
  }

  .key-actions {
    width: 100%;
  }

  .key-actions .btn {
    flex: 1;
  }
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding: 1.5rem 0 2.75rem;
  }

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

@media (max-width: 640px) {
  :root {
    --header-h: 48px;
    --page-pad: 14px;
    --touch-min: 36px;
  }

  body {
    font-size: 0.95rem;
  }

  .site-header {
    column-gap: 0.4rem;
    padding-top: 0.4rem;
    padding-bottom: 0.55rem;
    min-height: auto;
  }

  .header-inner {
    column-gap: 0.4rem;
  }

  .brand {
    gap: 0.45rem;
  }

  .brand img {
    width: 32px;
    height: 32px;
    border-radius: 9px;
  }

  .brand-text strong {
    font-size: 0.92rem;
  }

  .brand-text small {
    font-size: 0.58rem;
  }

  .header-actions {
    gap: 0.3rem;
  }

  .lang-switch {
    border-radius: 7px;
    border-width: 1px;
  }

  .lang-btn {
    min-height: 30px;
    min-width: 30px;
    padding: 0 8px;
    font-size: 10px;
    letter-spacing: 0.05em;
  }

  .header-actions .btn--hide-mobile {
    display: none;
  }

  .header-actions .btn:not(.btn--icon),
  .header-actions .btn--compact:not(.btn--icon) {
    min-height: 30px;
    padding: 0 0.62rem;
    font-size: 0.72rem;
    box-shadow: none;
  }

  .header-actions .btn--primary:not(.btn--icon) {
    box-shadow: 0 3px 10px rgb(224 46 36 / 0.2);
  }

  .header-actions .btn.btn--icon {
    width: 32px;
    min-width: 32px;
    max-width: 32px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    padding: 0 !important;
    flex: 0 0 32px;
    border-radius: 9px;
  }

  .header-actions .btn--icon .btn-icon {
    width: 16px;
    height: 16px;
  }

  .hero {
    padding: 0.5rem 0 2rem;
    gap: 1.25rem;
  }

  .hero h1 {
    max-width: none;
    font-size: clamp(1.85rem, 9.5vw, 2.5rem);
    line-height: 1.02;
  }

  .hero p.lead {
    font-size: 0.98rem;
  }

  .hero-actions {
    flex-direction: column;
    margin-top: 1.35rem;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .hero-stats {
    margin-top: 1.25rem;
    gap: 0.45rem;
  }

  .stat-pill {
    font-size: 0.74rem;
    padding: 0.38rem 0.65rem;
  }

  .code-block {
    padding: 0.85rem 0.9rem;
    font-size: 0.68rem;
    line-height: 1.55;
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }

  .section-title {
    font-size: 1.15rem;
  }

  .grid {
    padding-bottom: 2rem;
    gap: 0.75rem;
  }

  .card {
    padding: 1.1rem;
  }

  .cta-band {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 2rem;
    padding: 1.15rem 1.1rem;
  }

  .cta-band .btn {
    width: 100%;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.5rem 0 max(2rem, env(safe-area-inset-bottom));
  }

  .footer-links {
    flex-direction: column;
    gap: 0.65rem;
  }

  .panel {
    margin: 1.5rem auto 2.5rem;
    padding: 1.5rem 1.15rem;
  }

  .panel h1 {
    font-size: 1.65rem;
  }

  .page-hero {
    padding: 0.5rem 0 1.5rem;
  }

  .page-hero h1 {
    font-size: clamp(1.75rem, 8vw, 2.25rem);
  }

  .legal-content section h2 {
    font-size: 1rem;
  }

  .legal-content section p,
  .legal-content section ul {
    font-size: 0.9rem;
  }

  .legal-notice {
    font-size: 0.85rem;
  }
}

@media (max-width: 380px) {
  :root {
    --page-pad: 12px;
  }

  .hero-stats {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-pill {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .btn,
  .card {
    transition: none;
  }
}
