/* ============================================================
   Carbide AI — design system
   Dark carbon surfaces, carbide-teal accent, sharp radii.
   ============================================================ */

:root {
  /* color tokens */
  --bg: #08090c;
  --bg-soft: #0c0e12;
  --surface: #111419;
  --surface-2: #161a21;
  --surface-3: #1d222b;
  --border: #242a35;
  --border-strong: #39404e;
  --text: #edf0f4;
  --text-muted: #a8b1c0;
  --text-faint: #8a93a4;
  --accent: #34e3c6;
  --accent-strong: #8df2e0;
  --accent-ink: #052620;
  --accent-dim: rgba(52, 227, 198, 0.12);
  --accent-border: rgba(52, 227, 198, 0.45);
  --danger: #ff7a76;
  --danger-dim: rgba(255, 122, 118, 0.12);
  --warn: #ffce6b;

  /* type */
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  /* shape + depth */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.3);

  /* motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 85% -10%, rgba(52, 227, 198, 0.07), transparent 60%),
    radial-gradient(900px 520px at -10% 25%, rgba(52, 227, 198, 0.05), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.92em; }
img, svg { display: block; }

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

::selection { background: rgba(52, 227, 198, 0.28); }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

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

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(8, 9, 12, 0.78);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--text);
}
.logo:hover { text-decoration: none; }
.logo .tld { color: var(--text-faint); font-weight: 400; }
.logo svg { width: 26px; height: 26px; }

.nav-links { display: flex; gap: 20px; margin-left: 8px; }
.nav-links a {
  color: var(--text-muted);
  font-size: 14px;
  padding: 6px 2px;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); }

.nav-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  flex: none;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 44px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 180ms var(--ease), border-color 180ms var(--ease), transform 120ms var(--ease);
  text-decoration: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-discord {
  width: 100%;
  background: #5865f2;
  border-color: #5865f2;
  color: #fff;
}
.btn-discord:hover { background: #6b75f8; border-color: #6b75f8; }
.btn-discord[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

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

.btn-danger { color: var(--danger); border-color: var(--border-strong); background: transparent; }
.btn-danger:hover { background: var(--danger-dim); border-color: var(--danger); }

.btn-lg { padding: 13px 26px; font-size: 15px; }

/* ---------------------------------------------------------- badges, pills */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent-strong);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.badge .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.4s infinite;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

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

.hero { padding: 84px 0 64px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 48px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.3rem, 5.2vw, 3.5rem);
  font-weight: 800;
  margin: 20px 0 16px;
}
.hero h1 .accent { color: var(--accent); }
.hero .lede {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 46ch;
  margin-bottom: 28px;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.cta-row .hint { color: var(--text-faint); font-size: 13px; }

/* code card */
.code-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.code-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.code-card-head .dots { display: flex; gap: 6px; }
.code-card-head .dots i {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border-strong);
}
.code-card-head .file {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}
.code-card pre {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  color: #c9d2de;
}
.code-card pre .c { color: var(--text-faint); }
.code-card pre .k { color: var(--accent); }
.code-card pre .s { color: #ffd28a; }

/* ---------------------------------------------------------- sections */

.section { padding: 72px 0; }
.section-alt { background: var(--bg-soft); border-block: 1px solid var(--border); }
.section-head { max-width: 640px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
.section-head p { color: var(--text-muted); }
.section-head .eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

/* stats strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.stat {
  background: var(--surface);
  padding: 26px 28px;
}
.stat .value {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 700;
  color: var(--accent);
}
.stat .label { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.step {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 26px;
  position: relative;
}
.step .num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 8px;
  margin-bottom: 16px;
}
.step h3 { font-size: 16px; }
.step p { color: var(--text-muted); font-size: 14px; margin: 0; }

/* feature cards */
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.feature {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 26px;
  transition: border-color 180ms var(--ease), transform 180ms var(--ease);
}
.feature:hover { border-color: var(--accent-border); transform: translateY(-2px); }
.feature .icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--accent-border);
  border-radius: 9px;
  background: var(--accent-dim);
  color: var(--accent);
  margin-bottom: 16px;
}
.feature h3 { font-size: 15.5px; }
.feature p { color: var(--text-muted); font-size: 14px; margin: 0; }

/* tables */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: auto; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--border); }
thead th {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
  font-weight: 600;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
td.mono, th.mono { font-family: var(--font-mono); font-size: 13px; }
td .dim { color: var(--text-faint); }

/* CTA band */
.cta-band {
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(600px 200px at 20% 0%, rgba(52, 227, 198, 0.14), transparent 70%),
    var(--surface);
  padding: 48px;
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
}
.cta-band h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 6px; }
.cta-band p { color: var(--text-muted); margin: 0; }

/* footer */
.footer { border-top: 1px solid var(--border); padding: 36px 0; margin-top: 48px; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 13.5px;
}
.footer a { color: var(--text-muted); }

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

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::placeholder { color: var(--text-faint); }

.form-error {
  display: none;
  border: 1px solid rgba(255, 122, 118, 0.4);
  background: var(--danger-dim);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13.5px;
  margin-bottom: 16px;
}
.form-error.show { display: block; }

/* auth card */
.auth-wrap { max-width: 420px; margin: 72px auto 96px; padding: 0 24px; }
.auth-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 32px;
}
.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 5px;
  margin-bottom: 24px;
}
.tabs button {
  min-height: 40px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.tabs button[aria-selected="true"] { background: var(--surface-3); color: var(--text); }
.auth-card h1 { font-size: 20px; margin-bottom: 4px; }
.auth-card .sub { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }
.auth-foot { margin-top: 18px; font-size: 13.5px; color: var(--text-faint); text-align: center; }

/* ---------------------------------------------------------- dashboard */

.page { padding: 44px 0 72px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: baseline; justify-content: space-between; margin-bottom: 28px; }
.page-head h1 { font-size: 26px; margin: 0; }
.page-head .sub { color: var(--text-muted); font-size: 14px; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px;
}
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 24px;
  min-width: 0;
}
.card h2 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.card h2 svg { width: 16px; height: 16px; color: var(--accent); flex: none; }
.card .card-sub { color: var(--text-faint); font-size: 13px; margin-bottom: 16px; }

.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.balance-value {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.1;
  word-break: break-all;
}
.balance-unit { color: var(--text-faint); font-size: 13px; margin-top: 6px; }

.key-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.key-hint {
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: nowrap;
  flex: 1 1 200px;
}

.usage-nums { display: flex; gap: 32px; flex-wrap: wrap; }
.usage-nums .value { font-family: var(--font-mono); font-size: 24px; font-weight: 700; }
.usage-nums .label { color: var(--text-faint); font-size: 12.5px; }

.empty-note { color: var(--text-faint); font-size: 13.5px; padding: 8px 0; }

/* ---------------------------------------------------------- ad player */

.earn-player { display: flex; flex-direction: column; gap: 14px; max-width: 480px; }
.earn-stage {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(45deg, transparent 0 3px, rgba(255, 255, 255, 0.012) 3px 6px),
    var(--bg-soft);
  min-height: 200px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.earn-creative {
  width: 100%;
  min-height: 200px;
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
  transition: opacity 300ms var(--ease);
}
.earn-creative iframe, .earn-creative img { max-width: 100%; border: 0; }
.earn-creative .earn-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 10px;
}
.earn-creative h4 { font-size: 17px; margin-bottom: 6px; }
.earn-creative p { color: var(--text-muted); font-size: 13.5px; margin: 0 auto; max-width: 34ch; }
.earn-creative .earn-cta { margin-top: 12px; font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.earn-fade { opacity: 0; }

.earn-ring {
  position: absolute;
  top: 12px; right: 12px;
  width: 52px; height: 52px;
  display: none;
}
.earn-ring circle { fill: none; }
.earn-ring .track { stroke: var(--border-strong); stroke-width: 3; }
.earn-ring .bar {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 120ms linear;
}
.earn-ring text {
  fill: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  text-anchor: middle;
}
.earn-player.watching .earn-ring { display: block; }

.earn-status { min-height: 20px; font-size: 13.5px; color: var(--text-muted); }
.earn-status.err { color: var(--danger); }
.earn-status.ok { color: var(--accent); }

.earn-credit {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
}
.earn-credit span {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 26px;
  color: var(--accent);
  text-shadow: 0 0 24px rgba(52, 227, 198, 0.5);
}
.earn-credit.pop { animation: credit-pop 1.4s var(--ease) forwards; }
@keyframes credit-pop {
  0% { opacity: 0; transform: translateY(14px) scale(0.85); }
  18% { opacity: 1; transform: translateY(0) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-18px) scale(1.02); }
}

.earn-note { color: var(--text-faint); font-size: 12.5px; margin: 0; }

/* ---------------------------------------------------------- dialog + toast */

dialog {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  padding: 28px;
  width: min(480px, calc(100vw - 40px));
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(4, 5, 7, 0.7); backdrop-filter: blur(3px); }
dialog h3 { font-size: 17px; }
dialog .warn-note {
  border: 1px solid rgba(255, 206, 107, 0.35);
  background: rgba(255, 206, 107, 0.09);
  color: var(--warn);
  font-size: 13px;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 14px 0;
}
dialog .new-key {
  font-family: var(--font-mono);
  font-size: 14px;
  word-break: break-all;
  background: var(--bg-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--accent-strong);
  margin-bottom: 16px;
}
dialog .dialog-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

#toasts {
  position: fixed;
  bottom: 20px; right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(360px, calc(100vw - 40px));
}
.toast {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--accent);
  background: var(--surface-2);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  animation: toast-in 220ms var(--ease);
}
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------- docs */

.docs-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 40px; }
.docs-toc { position: sticky; top: 84px; align-self: start; }
.docs-toc a {
  display: block;
  padding: 5px 0;
  color: var(--text-faint);
  font-size: 13.5px;
}
.docs-toc a:hover { color: var(--text); text-decoration: none; }
.docs-body { max-width: 72ch; }
.docs-body h2 { font-size: 20px; margin-top: 40px; scroll-margin-top: 84px; }
.docs-body h2:first-child { margin-top: 0; }
.docs-body p, .docs-body li { color: var(--text-muted); font-size: 14.5px; }
.docs-body ul { padding-left: 20px; }
.endpoint {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 8px;
}
.endpoint .method {
  color: var(--accent);
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
  border-radius: 4px;
  padding: 1px 7px;
  font-weight: 700;
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .features, .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-toc { position: static; display: none; }
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .features, .steps, .stats-strip { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 44px; }
  .section { padding: 52px 0; }
  .cta-band { padding: 32px 24px; }
  .container { padding: 0 18px; }
}

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