@import url('https://fonts.googleapis.com/css2?family=Geologica:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&family=Noto+Sans+SC:wght@400;500;600;700;800&display=swap');

* { box-sizing: border-box; }
:root {
  color-scheme: light;
  --bg: #eef7f4;
  --bg-deep: #dfeee9;
  --surface: rgba(255, 255, 255, .9);
  --surface-2: #e8f5f0;
  --text: #102522;
  --muted: #58716c;
  --primary: #0b6b60;
  --primary-strong: #07544c;
  --accent: #58cdb5;
  --line: rgba(21, 93, 82, .18);
  --line-strong: rgba(11, 107, 96, .36);
  --danger: #a33c35;
  --shadow: 0 24px 70px rgba(20, 75, 65, .13);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Geologica', 'Noto Sans SC', system-ui, sans-serif;
  --header-ui: Inter, "Avenir Next", Avenir, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", 'Noto Sans SC', sans-serif;
}
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(rgba(11, 107, 96, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 107, 96, .045) 1px, transparent 1px),
    radial-gradient(circle at 12% 7%, rgba(88, 205, 181, .22), transparent 27rem),
    linear-gradient(180deg, #f7fbfa 0%, var(--bg) 45%, var(--bg-deep) 100%);
  background-size: 48px 48px, 48px 48px, auto, auto;
  font: 16px/1.65 var(--sans);
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 63%, rgba(255,255,255,.54) 63% 68%, transparent 68%);
}
.ambient { position: fixed; z-index: -2; border-radius: 50%; filter: blur(1px); pointer-events: none; }
.ambient-one { width: 420px; height: 420px; top: 9rem; right: -190px; background: radial-gradient(circle, rgba(11,107,96,.2), rgba(11,107,96,0) 70%); }
.ambient-two { width: 340px; height: 340px; left: -170px; top: 55%; background: radial-gradient(circle, rgba(88,205,181,.22), rgba(88,205,181,0) 70%); }
a { color: inherit; }
button, input { font: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(11,107,96,.24); outline-offset: 3px; }
.topbar {
  min-height: 76px;
  padding: 12px clamp(18px, 4vw, 58px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 250, 248, .88);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand img { display: block; width: 116px; height: auto; filter: drop-shadow(0 6px 16px rgba(11,107,96,.13)); }
.brand-context { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.brand small { color: var(--muted); font: 700 9px var(--mono); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.brand b { padding: 4px 7px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--primary); background: #dff7ef; font: 800 8px var(--mono); letter-spacing: .1em; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions a,
.top-actions button {
  min-height: 44px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--primary);
  background: var(--surface);
  font: 800 11px/1 var(--header-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, transform .2s;
}
.top-actions a:hover,
.top-actions button:hover { border-color: var(--line-strong); color: var(--primary); background: var(--surface-2); transform: translateY(-1px); }
.top-actions a:active,
.top-actions button:active { transform: scale(.97); }
.top-actions .language-switch { min-width: 44px; color: var(--text); font: 800 11px/1 var(--header-ui); }
main { width: min(1160px, calc(100% - 36px)); margin: 0 auto; }
.hero { min-height: 520px; padding: 86px 0 62px; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, .7fr); gap: 70px; align-items: end; position: relative; }
.hero::before { content: 'MCP'; position: absolute; top: 42px; right: 4%; z-index: -1; color: rgba(11,107,96,.045); font: 800 clamp(130px, 22vw, 280px)/.8 var(--mono); letter-spacing: -.12em; }
.eyebrow, .step { margin: 0 0 14px; color: var(--primary); font: 800 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { margin: 0; max-width: 820px; font-size: clamp(44px, 7vw, 82px); line-height: .98; letter-spacing: -.06em; text-wrap: balance; }
.lead { max-width: 760px; margin: 25px 0 0; color: var(--muted); font-size: 18px; }
.endpoint-card, .card { border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.endpoint-card { padding: 26px; display: grid; gap: 14px; border-top: 4px solid var(--accent); }
.endpoint-card > span { font-weight: 800; }
.endpoint-card code, .token-box code { padding: 14px; border-radius: 12px; color: #d9fff6; background: #102f2a; font: 12px var(--mono); overflow-wrap: anywhere; }
.endpoint-card small { color: var(--muted); }
button { border: 0; border-radius: 11px; padding: 12px 16px; color: white; background: var(--primary); font-weight: 750; cursor: pointer; }
button:hover { background: var(--primary-strong); }
.secondary { color: var(--primary); background: var(--surface-2); border: 1px solid var(--line); }
.secondary:hover { color: #fff; background: var(--primary); }
.grid { padding-bottom: 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.card { min-width: 0; padding: 24px; overflow-wrap: anywhere; }
.span-2 { grid-column: 1 / -1; }
.card h2, .card h3 { margin: 0 0 12px; line-height: 1.15; letter-spacing: -.03em; text-wrap: balance; }
.card h2 { font-size: clamp(22px, 2.4vw, 28px); }
.card h3 { font-size: clamp(19px, 2vw, 23px); }
.card p { margin: 0 0 12px; color: var(--muted); }
.card p:last-child { margin-bottom: 0; }
.card ol, .card ul { margin: 0; padding-left: 22px; color: var(--muted); }
.card li + li { margin-top: 8px; }
.note { margin-top: 14px; padding: 15px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; color: var(--muted); background: var(--surface-2); }
pre { margin: 14px 0; max-height: 320px; overflow: auto; padding: 18px; border-radius: 14px; color: #d9fff6; background: #102f2a; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
pre code { font: 12px/1.7 var(--mono); }
.account-section { padding: 72px 0; }
.section-heading { max-width: 760px; margin-bottom: 28px; }
.section-heading h2 { margin: 0; font-size: clamp(34px, 5vw, 58px); line-height: 1; letter-spacing: -.05em; }
.section-heading > p:last-child { color: var(--muted); font-size: 17px; }
.account-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tabs button { flex: 1; color: var(--primary); background: var(--surface-2); }
.tabs button.is-active { color: white; background: var(--primary); }
form { display: grid; gap: 15px; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
input { width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: white; outline: none; }
input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(11,107,96,.1); }
.status { min-height: 24px; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.status.error { color: var(--danger); }
.quota { margin: 20px 0; padding: 16px; display: flex; justify-content: space-between; gap: 20px; border-radius: 13px; background: var(--surface-2); }
.token-box { display: grid; gap: 12px; margin: 18px 0; padding: 16px; border: 1px solid var(--accent); border-radius: 14px; background: #effbf7; }
.token-box > span { color: var(--primary); font-size: 12px; font-weight: 800; }
.token-actions, .member-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.safety-card { color: #eaf8f5; background: linear-gradient(145deg, #113c37, #0b2c28); }
.safety-card .step { color: #76d8c5; }
.safety-card h3 { color: #fff; }
.safety-card ul { color: #b8d1cc; }
.safety-card li::marker { color: #76d8c5; }
footer { width: min(1160px, calc(100% - 36px)); margin: 0 auto; padding: 28px 0 48px; display: flex; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); }
footer a { color: var(--primary); font-weight: 700; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; padding: 12px 16px; border-radius: 11px; color: white; background: #102f2a; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: none; }
@media (max-width: 820px) {
  .brand-context small { display: none; }
  .hero, .account-grid { grid-template-columns: 1fr; }
  .hero { min-height: 0; padding-top: 62px; gap: 35px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .hero h1 { font-size: clamp(42px, 13vw, 68px); }
}
@media (max-width: 520px) {
  main { width: min(100% - 24px, 1160px); }
  .topbar { padding-inline: 12px; }
  .brand img { width: 102px; }
  .brand-context { gap: 5px; }
  .top-actions a[href*="#account"] { display: none; }
  .language-switch { min-width: 44px; }
  .card, .endpoint-card { padding: 20px; }
  .hero { padding-top: 48px; }
  .hero h1 { font-size: 42px; }
  .token-actions button, .member-actions button { width: 100%; }
  footer { width: calc(100% - 24px); display: grid; gap: 8px; }
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101715;
  --bg-deep: #0c1211;
  --surface: rgba(23, 32, 30, .94);
  --surface-2: #1d2926;
  --text: #edf7f4;
  --muted: #adc1bc;
  --primary: #4fd1bb;
  --primary-strong: #7fe2d1;
  --accent: #58cdb5;
  --line: rgba(173, 193, 188, .2);
  --line-strong: rgba(79, 209, 187, .42);
  --danger: #ff8888;
  --shadow: 0 24px 70px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] body {
  background:
    linear-gradient(rgba(79, 209, 187, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 209, 187, .045) 1px, transparent 1px),
    radial-gradient(circle at 12% 7%, rgba(79, 209, 187, .14), transparent 27rem),
    linear-gradient(180deg, #121c19 0%, var(--bg) 45%, var(--bg-deep) 100%);
  background-size: 48px 48px, 48px 48px, auto, auto;
}
html[data-theme="dark"] body::before { background: linear-gradient(115deg, transparent 0 63%, rgba(79,209,187,.035) 63% 68%, transparent 68%); }
html[data-theme="dark"] .topbar { background: rgba(16, 23, 21, .9); }
html[data-theme="dark"] input { background: var(--surface-2); }
html[data-theme="dark"] .brand b,
html[data-theme="dark"] .token-box { color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
html[data-theme="dark"] .hero::before { color: rgba(79, 209, 187, .055); }
html[data-theme="dark"] .secondary { color: var(--text); background: var(--surface-2); }

.theme-switch { width: 44px; min-width: 44px; padding: 0; display: inline-grid; place-items: center; color: var(--primary); background: var(--surface); }
.theme-switch svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-moon { display: none; }
html[data-theme="dark"] .theme-sun { display: none; }
html[data-theme="dark"] .theme-moon { display: block; }

.brand small { font-size: 11px; }
.brand b { font-size: 10px; }
.endpoint-card small,
.card p,
.card li,
.note,
.status,
footer { font-size: 13px; }
.card label span { font-size: 13px; }
.card input { min-height: 46px; font-size: 14px; }

@media (max-width: 680px) {
  .top-actions { gap: 6px; }
  .top-actions a, .top-actions button { min-height: 44px; padding-inline: 10px; }
  .top-actions a[href*="#account"] { display: none; }
  .theme-switch { min-width: 44px; width: 44px; }
}
footer nav { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap; }

/* Phase 4 client productization */
.client-card pre { min-height: 0; }
.widget-list { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.widget-list span { padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--primary); background: var(--surface-2); font-size: 12px; font-weight: 800; }
