:root {
  --bg: #07060b;
  --bg-2: #0d0b14;
  --panel: #110e1b;
  --line: #241c38;
  --line-2: #322750;
  --text: #ece8f6;
  --muted: #8b819f;
  --faint: #5b5270;
  --violet: #8b5cf6;
  --violet-bright: #b69bff;
  --violet-deep: #6d28d9;
  --glow: rgba(139, 92, 246, 0.35);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* soft purple light leaking from top-left + bottom-right */
  background-image:
    radial-gradient(900px 500px at 8% -10%, rgba(109, 40, 217, 0.22), transparent 60%),
    radial-gradient(700px 600px at 105% 110%, rgba(139, 92, 246, 0.12), transparent 55%);
  background-attachment: fixed;
}

.grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- typography helpers ---- */
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--violet-bright);
  margin-bottom: 1.1rem;
}

h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; }
em { font-style: italic; color: var(--violet-bright); }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem clamp(1.2rem, 5vw, 4rem);
  backdrop-filter: blur(14px);
  background: linear-gradient(to bottom, rgba(7,6,11,0.85), rgba(7,6,11,0.4));
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--mono); font-weight: 500;
  letter-spacing: 0.34em; font-size: 0.95rem;
  color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.7rem;
}
.wordmark.sm { font-size: 0.8rem; letter-spacing: 0.28em; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 12px 1px var(--glow);
}
.topnav { display: flex; align-items: center; gap: 1.6rem; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; }
.topnav a:hover { color: var(--text); }
@media (max-width: 720px) { .topnav a[href^="#"] { display: none; } }

/* ---- buttons ---- */
.btn {
  font-family: var(--sans); font-size: 0.92rem; font-weight: 500;
  color: #0a0710; background: var(--violet-bright);
  border: none; border-radius: 9px; padding: 0.7rem 1.3rem;
  cursor: pointer; transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 0 0 1px rgba(182,155,255,0.3), 0 10px 30px -12px var(--glow);
}
.btn:hover { transform: translateY(-1px); background: #c9b4ff; box-shadow: 0 0 0 1px rgba(182,155,255,0.5), 0 14px 34px -12px var(--glow); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 0.5rem 0.95rem; font-size: 0.85rem; }
.btn-block { width: 100%; padding: 0.85rem; margin-top: 0.4rem; }
.btn-ghost {
  background: transparent; color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line-2);
}
.btn-ghost:hover { background: rgba(139,92,246,0.08); box-shadow: inset 0 0 0 1px var(--violet); }
.link-btn {
  background: none; border: none; color: var(--muted);
  font: inherit; font-size: 0.9rem; cursor: pointer; transition: color 0.2s;
}
.link-btn:hover { color: var(--text); }

/* ---- views ---- */
.view { display: none; position: relative; z-index: 1; }
.view.is-active { display: block; }
.view-auth.is-active, .view-account.is-active {
  display: flex; min-height: calc(100vh - 64px);
  align-items: center; justify-content: center; padding: 2rem 1.2rem;
}

/* ---- hero ---- */
.hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr; gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding: clamp(3rem, 9vw, 7rem) clamp(1.2rem, 5vw, 4rem) clamp(2rem, 5vw, 4rem);
  max-width: 1240px; margin: 0 auto;
}
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: 1.02;
  margin-bottom: 1.5rem;
}
.lede { color: var(--muted); font-size: 1.08rem; max-width: 30rem; margin-bottom: 2rem; }
.hero-actions { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.hero-meta { font-family: var(--mono); font-size: 0.78rem; color: var(--faint); letter-spacing: 0.02em; }
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; } .hero-panel { order: -1; } }

/* ---- hero panel (faux terminal) ---- */
.hero-panel {
  background: linear-gradient(160deg, var(--panel), #0a0812);
  border: 1px solid var(--line); border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px -40px rgba(0,0,0,0.9), 0 0 0 1px rgba(139,92,246,0.05) inset;
}
.panel-head {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.8rem 1.1rem; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 0.74rem; color: var(--faint);
}
.dots { display: inline-flex; gap: 6px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); display: block; }
.dots i:first-child { background: var(--violet-deep); }
.panel-body {
  font-family: var(--mono); font-size: 0.82rem; line-height: 1.9;
  padding: 1.3rem 1.4rem; color: var(--text); white-space: pre-wrap;
}
.c-mut { color: var(--faint); }
.c-key { color: var(--violet-bright); font-weight: 500; }
.c-acc { color: #7ee0c0; }
.spectrum { display: flex; align-items: flex-end; gap: 4px; height: 46px; padding: 0 1.4rem 1.3rem; }
.spectrum i {
  flex: 1; border-radius: 3px 3px 0 0;
  background: linear-gradient(to top, var(--violet-deep), var(--violet-bright));
  animation: bar 1.8s ease-in-out infinite;
}
.spectrum i:nth-child(odd) { animation-delay: 0.2s; }
.spectrum i:nth-child(3n) { animation-delay: 0.45s; }
.spectrum i:nth-child(4n) { animation-delay: 0.7s; }
@keyframes bar { 0%,100% { height: 20%; opacity: 0.5; } 50% { height: 100%; opacity: 1; } }

/* ---- strip (steps) ---- */
.strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line); border-block: 1px solid var(--line);
  max-width: 1240px; margin: 2rem auto 0;
}
.strip-item { background: var(--bg); padding: clamp(1.6rem, 3vw, 2.4rem); }
.strip-item .num { font-family: var(--mono); color: var(--violet); font-size: 0.8rem; letter-spacing: 0.1em; }
.strip-item h3 { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; margin: 0.7rem 0 0.5rem; }
.strip-item p { color: var(--muted); font-size: 0.94rem; }
@media (max-width: 760px) { .strip { grid-template-columns: 1fr; } }

/* ---- keys section ---- */
.keys { max-width: 1240px; margin: 0 auto; padding: clamp(3.5rem, 8vw, 6rem) clamp(1.2rem, 5vw, 4rem); }
.keys h2 { font-size: clamp(1.8rem, 4vw, 2.7rem); margin-bottom: 2rem; max-width: 18ch; }
.keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.keys-grid article {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.8rem; transition: border-color 0.25s, transform 0.25s;
}
.keys-grid article:hover { border-color: var(--line-2); transform: translateY(-3px); }
.keys-grid h4 { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--violet-bright); margin-bottom: 0.8rem; }
.keys-grid p { color: var(--muted); }
@media (max-width: 680px) { .keys-grid { grid-template-columns: 1fr; } }

/* ---- auth card ---- */
.auth-card {
  width: 100%; max-width: 430px;
  background: linear-gradient(165deg, var(--panel), #0a0812);
  border: 1px solid var(--line); border-radius: 18px;
  padding: 2.2rem; position: relative;
  box-shadow: 0 40px 90px -50px rgba(0,0,0,0.95);
}
.auth-back { position: absolute; top: 1.3rem; left: 1.6rem; color: var(--faint); font-size: 0.82rem; text-decoration: none; cursor: pointer; font-family: var(--mono); }
.auth-back:hover { color: var(--muted); }
.auth-tabs {
  display: flex; gap: 0.3rem; margin: 1.4rem 0 1.8rem;
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 4px;
}
.auth-tabs button {
  flex: 1; padding: 0.55rem; border: none; background: transparent;
  color: var(--muted); font: inherit; font-size: 0.88rem; border-radius: 8px;
  cursor: pointer; transition: all 0.2s;
}
.auth-tabs button.is-active { background: var(--violet-deep); color: #fff; box-shadow: 0 6px 18px -8px var(--glow); }
.auth-form { display: none; flex-direction: column; gap: 1rem; }
.auth-form.is-active { display: flex; }
.auth-form h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.auth-form label { display: flex; flex-direction: column; gap: 0.45rem; font-size: 0.82rem; color: var(--muted); }
.auth-form input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  padding: 0.72rem 0.85rem; color: var(--text); font: inherit; font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-form input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }
.form-note { font-size: 0.84rem; min-height: 1.2rem; font-family: var(--mono); }
.form-note.err { color: #ff8b8b; }
.form-note.ok { color: #7ee0c0; }
.form-note a { color: var(--violet-bright); }

/* ---- account ---- */
.account-wrap {
  width: 100%; max-width: 620px;
  background: linear-gradient(165deg, var(--panel), #0a0812);
  border: 1px solid var(--line); border-radius: 18px; padding: 2.2rem;
}
.account-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.8rem; }
.account-head h2 { font-size: 1.9rem; }
.account-grid { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.field { background: var(--bg-2); padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: 0.5rem; }
.field-label { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); display: flex; justify-content: space-between; align-items: center; }
.field code { font-family: var(--mono); font-size: 0.9rem; color: var(--violet-bright); word-break: break-all; }
.mask { filter: blur(5px); transition: filter 0.2s; cursor: pointer; }
.reveal:hover .mask, .mask.shown { filter: none; }
.copy { background: none; border: none; color: var(--faint); font-family: var(--mono); font-size: 0.68rem; cursor: pointer; letter-spacing: 0.08em; }
.copy:hover { color: var(--violet-bright); }
.badge { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--mono); font-size: 0.85rem; color: var(--text); width: fit-content; }
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.badge.verified { color: #7ee0c0; }
.badge.verified::before { background: #7ee0c0; box-shadow: 0 0 8px #7ee0c0; }
.badge.unverified { color: #e8c07e; }
.badge.unverified::before { background: #e8c07e; }
.account-foot { color: var(--faint); font-size: 0.85rem; margin-top: 1.3rem; }
.head-actions { display: flex; align-items: center; gap: 1rem; }
#acct-status { padding: 0.35rem 0.8rem; border: 1px solid var(--line-2); border-radius: 999px; color: var(--violet-bright); }
#acct-status::before { background: var(--violet); box-shadow: 0 0 8px var(--glow); }

/* ---- minimal centered hero ---- */
.hero-center { grid-template-columns: 1fr; text-align: center; place-items: center; max-width: 720px; min-height: calc(100vh - 200px); }
.hero-center h1 { font-size: clamp(3.5rem, 12vw, 6.5rem); margin-bottom: 1.2rem; }
.hero-center .lede { margin-inline: auto; }
.hero-center .hero-actions { justify-content: center; }
.orb { margin-top: 3rem; width: min(360px, 80vw); }
.spectrum-lg { height: 90px; gap: 6px; }

/* ---- token portal (small logged-in GUI) ---- */
.view-account.is-active { align-items: flex-start; padding-top: clamp(2rem, 8vh, 5rem); }
.portal {
  width: 100%; max-width: 440px;
  background: linear-gradient(165deg, var(--panel), #0a0812);
  border: 1px solid var(--line); border-radius: 18px; padding: 1.8rem;
  box-shadow: 0 40px 90px -50px rgba(0,0,0,0.95);
}
.portal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.portal-id { display: flex; align-items: center; gap: 0.6rem; font-family: var(--mono); font-size: 0.95rem; }
.dl-btn { display: block; width: 100%; text-align: center; font-size: 1rem; padding: 0.85rem; }
.dl-btn.disabled { pointer-events: none; opacity: 0.5; background: var(--line-2); color: var(--muted); box-shadow: none; }
.dl-sub { text-align: center; color: var(--faint); font-size: 0.8rem; margin: 0.7rem 0 1.5rem; }

.stock { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1.5rem; }
.stock-item {
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
  padding: 0.9rem 0.5rem; text-align: center;
}
.stk-n { display: block; font-family: var(--serif); font-size: 1.7rem; color: var(--violet-bright); line-height: 1; }
.stk-t { display: block; font-family: var(--mono); font-size: 0.7rem; color: var(--faint); margin-top: 0.35rem; letter-spacing: 0.06em; }

.key-row {
  background: var(--bg); border: 1px solid var(--line); border-radius: 11px;
  padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.5rem;
}
.key-label { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); display: flex; justify-content: space-between; align-items: center; }
.key-row code { font-family: var(--mono); font-size: 0.85rem; color: var(--violet-bright); word-break: break-all; }
.creds { margin-top: 1rem; padding-top: 0; border-top: none; }
.creds .key-row { margin-top: 0.8rem; }
.gen-bar { display: flex; gap: 0.6rem; margin-bottom: 1.4rem; }
.gen-bar input[name="label"] { flex: 1; }
.gen-bar input[name="count"] { width: 76px; text-align: center; }
.gen-bar input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 9px;
  padding: 0.7rem 0.85rem; color: var(--text); font: inherit; font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.gen-bar input:focus { outline: none; border-color: var(--violet); box-shadow: 0 0 0 3px rgba(139,92,246,0.15); }

.token-list { display: flex; flex-direction: column; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 64px; }
.token-list .empty { background: var(--bg-2); padding: 1.6rem; text-align: center; color: var(--faint); font-size: 0.9rem; }
.token-row {
  display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 0.9rem;
  background: var(--bg-2); padding: 0.85rem 1.1rem;
  animation: rowIn 0.35s ease both;
}
@keyframes rowIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.token-val { font-family: var(--mono); font-size: 0.88rem; color: var(--violet-bright); word-break: break-all; }
.token-label { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); white-space: nowrap; }
.token-label:not(:empty)::before { content: "#"; opacity: 0.6; }
.token-copy { color: var(--faint); }
.token-copy:hover { color: var(--violet-bright); }
.token-del {
  background: none; border: none; color: var(--faint); cursor: pointer;
  font-size: 0.9rem; line-height: 1; padding: 0.2rem 0.3rem; border-radius: 5px; transition: all 0.18s;
}
.token-del:hover { color: #ff8b8b; background: rgba(255,139,139,0.1); }

/* ---- collapsible credentials ---- */
.creds { margin-top: 1.6rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }
.creds summary {
  cursor: pointer; font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--faint); list-style: none; user-select: none;
}
.creds summary::-webkit-details-marker { display: none; }
.creds summary::before { content: "▸ "; color: var(--violet); }
.creds[open] summary::before { content: "▾ "; }
.creds .account-grid { margin-top: 1rem; }

/* ---- footer ---- */
.footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;
  padding: 2rem clamp(1.2rem, 5vw, 4rem); border-top: 1px solid var(--line);
  position: relative; z-index: 1;
}
.footer-mut { font-family: var(--mono); font-size: 0.74rem; color: var(--faint); }

/* ---- docs (single column) ---- */
.docs { max-width: 760px; margin: 0 auto; padding: clamp(2rem, 5vw, 4rem) clamp(1.2rem, 5vw, 2rem); position: relative; z-index: 1; }
.docs-eyebrow { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--violet-bright); margin-bottom: 0.6rem; }
.docs-body { min-width: 0; }
.docs-body section { margin-bottom: 2.6rem; scroll-margin-top: 88px; }
.docs-body h1 { font-size: clamp(2.2rem, 5vw, 3rem); margin-bottom: 1rem; }
.docs-body h2 { font-family: var(--sans); font-weight: 600; font-size: 1.15rem; margin-bottom: 0.8rem; display: flex; align-items: center; gap: 0.6rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.docs-body h3 { font-family: var(--sans); font-weight: 600; font-size: 0.95rem; margin: 1.4rem 0 0.6rem; color: var(--text); }
.docs-body p { color: var(--muted); margin-bottom: 1rem; }
.docs-body strong { color: var(--text); font-weight: 600; }
.docs-body code { font-family: var(--mono); font-size: 0.85em; background: var(--bg-2); border: 1px solid var(--line); border-radius: 5px; padding: 0.1em 0.4em; color: var(--violet-bright); }
.docs-body a { color: var(--violet-bright); }
.endpoint { font-family: var(--mono); font-size: 0.95rem; color: var(--text); }
.muted-inline { font-family: var(--mono); font-size: 0.72rem; color: var(--faint); font-weight: 400; }
.verb { font-family: var(--mono); font-size: 0.72rem; font-weight: 500; padding: 0.2rem 0.5rem; border-radius: 6px; letter-spacing: 0.05em; }
.verb.get { background: rgba(126,224,192,0.14); color: #7ee0c0; }
.verb.post { background: rgba(139,92,246,0.18); color: var(--violet-bright); }
.callout { display: flex; align-items: center; gap: 0.9rem; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 0.8rem 1rem; }
.callout .mono { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.callout code { background: none; border: none; color: var(--violet-bright); padding: 0; }
.code { font-family: var(--mono); font-size: 0.82rem; line-height: 1.85; background: linear-gradient(160deg, var(--panel), #0a0812); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.3rem; overflow-x: auto; color: var(--text); white-space: pre; }
.code .c-str { color: #7ee0c0; }
.docs-table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.docs-table th { text-align: left; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 500; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); }
.docs-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.92rem; }
.docs-table td:first-child { white-space: nowrap; }
@media (max-width: 760px) { .docs { grid-template-columns: 1fr; } .docs-nav { position: static; flex-flow: row wrap; gap: 1rem; } }

/* ---- toast ---- */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(120%);
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 0.7rem 1.1rem; font-size: 0.86rem; color: var(--text);
  font-family: var(--mono); z-index: 50; transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 20px 50px -20px rgba(0,0,0,0.9);
}
.toast.show { transform: translateX(-50%) translateY(0); }
