:root {
  --bg: #ebf0ff;
  --fg: #333952;
  --muted: #7a8ca8;
  --line: #c5d1e3;
  --max: 640px;
}

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

body {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  opacity: 0.6;
}

.wrap {
  flex: 1;
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
  padding-bottom: 4rem;
}

/* header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.logo-img {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.btn {
  display: inline-block;
  padding: 0.4rem 0.875rem;
  border: 1px solid var(--fg);
  font-family: inherit;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  background: var(--fg);
  color: var(--bg);
  cursor: pointer;
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border-color: var(--muted);
}

.btn-outline:hover {
  background: color-mix(in srgb, var(--line) 40%, transparent);
  opacity: 1;
}

/* hero */
.hero {
  padding: 4rem 0 3rem;
}

.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 400;
  line-height: 1;
  margin-top: 0.75rem;
  letter-spacing: -0.02em;
}

h1 em {
  font-style: italic;
  color: var(--muted);
}

.lead {
  margin-top: 1.25rem;
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.7;
}

.lead strong {
  color: var(--fg);
  font-weight: 500;
}

.actions {
  margin-top: 1.75rem;
  display: flex;
  gap: 0.625rem;
}

/* ── landing page ── */
.page-landing {
  font-size: 15px;
}

.wrap-landing {
  --max: min(920px, 100% - 3rem);
  width: 100%;
  max-width: var(--max);
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page-landing header {
  padding: 1.5rem 0;
}

.page-landing .logo {
  font-size: 13px;
  gap: 0.65rem;
}

.page-landing .logo-img {
  width: 40px;
  height: 40px;
}

.page-landing nav a {
  font-size: 12px;
}

.page-landing .btn {
  padding: 0.65rem 1.25rem;
  font-size: 12px;
}

.landing-main {
  flex: 1;
  display: flex;
  align-items: center;
}

.hero-landing {
  width: 100%;
  padding: 2rem 0 3rem;
  min-height: calc(100vh - 11rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.page-landing .eyebrow {
  font-size: 12px;
  letter-spacing: 0.2em;
}

.page-landing h1 {
  font-size: clamp(3rem, 9vw, 5.5rem);
  margin-top: 1rem;
  line-height: 0.95;
  max-width: 14ch;
}

.page-landing .lead {
  margin-top: 1.75rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  max-width: 38rem;
  line-height: 1.65;
}

.page-landing .actions {
  margin-top: 2.25rem;
  gap: 0.875rem;
  flex-wrap: wrap;
}

.page-landing .btn {
  padding: 0.85rem 1.75rem;
  font-size: 13px;
}

.page-landing footer {
  width: min(100% - 3rem, 960px);
  max-width: 960px;
  padding: 1.25rem 0 1.75rem;
  font-size: 11px;
}

@media (min-width: 768px) {
  .wrap-landing {
    --max: min(960px, 100% - 4rem);
  }

  .hero-landing {
    min-height: calc(100vh - 10rem);
  }
}

nav a.active {
  color: var(--fg);
}

/* ── docs ── */
.wrap-docs {
  --max: 960px;
}

.docs-layout {
  display: grid;
  gap: 3rem;
  padding: 2.5rem 0 4rem;
}

@media (min-width: 768px) {
  .docs-layout {
    grid-template-columns: 160px 1fr;
    gap: 4rem;
    align-items: start;
  }
}

.docs-sidebar {
  position: sticky;
  top: 1.5rem;
}

.docs-sidebar-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.docs-toc {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.docs-toc a {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  line-height: 1.4;
  transition: color 0.15s;
}

.docs-toc a:hover {
  color: var(--fg);
  opacity: 1;
}

.docs-header {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2.5rem;
}

.docs-header h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 400;
  margin-top: 0.5rem;
}

.docs-intro {
  margin-top: 1rem;
  max-width: 36rem;
  color: var(--muted);
  line-height: 1.75;
}

.doc-section {
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
}

.doc-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.doc-section h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 400;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.doc-section h3 {
  font-size: 11px;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.doc-section p {
  color: var(--muted);
  line-height: 1.75;
  margin-bottom: 0.875rem;
}

.doc-section p:last-child {
  margin-bottom: 0;
}

.doc-section strong {
  color: var(--fg);
  font-weight: 600;
}

.doc-section a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.doc-section a:hover {
  opacity: 0.7;
}

.doc-section ul,
.doc-section ol {
  margin: 0.75rem 0 1rem;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.75;
}

.doc-section li {
  margin-bottom: 0.4rem;
}

.doc-section li::marker {
  color: var(--muted);
}

.callout {
  margin-top: 1.25rem;
  padding: 1rem 1.125rem;
  background: color-mix(in srgb, var(--line) 35%, var(--bg));
  border-left: 2px solid var(--fg);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
}

.callout strong {
  color: var(--fg);
}

.doc-steps {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-steps li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 1rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}

.doc-steps li:last-child {
  border-bottom: none;
}

.doc-step-num {
  font-size: 10px;
  color: var(--muted);
  padding-top: 0.15rem;
}

.doc-steps h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 0.35rem;
  color: var(--fg);
}

.doc-steps p {
  margin: 0;
  font-size: 11px;
}

.doc-diagram {
  margin: 1rem 0 1.25rem;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--line) 25%, var(--bg));
  border: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.5;
  overflow-x: auto;
  color: var(--fg);
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.25rem;
  font-size: 11px;
}

.doc-table th,
.doc-table td {
  text-align: left;
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--line);
}

.doc-table th {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 600;
}

.doc-table td {
  color: var(--muted);
}

.faq-block {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.faq-block:first-of-type {
  border-top: 1px solid var(--line);
  margin-top: 0.5rem;
}

.faq-block h3 {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--fg);
}

.faq-block p {
  margin: 0;
  font-size: 11px;
}

/* ── launch / deploy ── */
.wrap-launch {
  --max: 980px;
  padding-bottom: 3rem;
}

.launch-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--line);
}

.launch-header .logo {
  justify-self: center;
}

.launch-header .btn {
  justify-self: end;
}

.back-link {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  justify-self: start;
}

.back-link:hover {
  color: var(--fg);
  opacity: 1;
}

.launch-layout {
  display: grid;
  gap: 2.5rem;
  padding: 2rem 0;
}

@media (min-width: 768px) {
  .launch-layout {
    grid-template-columns: 1fr 300px;
    gap: 3rem;
    align-items: start;
  }
}

.launch-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 1.75rem;
}

.form-block {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 0.875rem;
  letter-spacing: 0.02em;
}

.field-row {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

@media (min-width: 480px) {
  .field-row {
    grid-template-columns: 1fr 140px;
  }
}

.field label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}

.optional {
  font-weight: 400;
  opacity: 0.7;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 60%, #fff);
  color: var(--fg);
  font-family: inherit;
  font-size: 12px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--fg);
}

.field textarea {
  resize: vertical;
  min-height: 72px;
}

.field-ticker input {
  text-transform: uppercase;
}

.routing-notice {
  display: flex;
  gap: 1rem;
  padding: 1.125rem 1.25rem;
  background: color-mix(in srgb, var(--line) 30%, var(--bg));
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.routing-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.routing-notice h3 {
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.routing-notice p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
}

.routing-notice strong {
  color: var(--fg);
  font-weight: 600;
}

.upload-zone {
  border: 1px dashed var(--muted);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 60%, #fff);
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, background 0.15s;
}

.upload-zone.dragover {
  border-color: var(--fg);
  background: color-mix(in srgb, var(--line) 40%, var(--bg));
}

.upload-empty {
  text-align: center;
  padding: 2rem 1.5rem;
}

.upload-icon {
  display: inline-flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 1rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.upload-empty p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.upload-btn {
  font-size: 10px;
}

.upload-preview {
  position: relative;
  width: 100%;
  padding: 1rem;
  text-align: center;
}

.upload-preview img {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
}

.upload-remove {
  display: block;
  margin: 0.75rem auto 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 10px;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}

.upload-remove:hover {
  color: var(--fg);
}

.hidden {
  display: none !important;
}

.btn-deploy {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 11px;
  margin-top: 0.5rem;
}

.btn-deploy:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.launch-preview {
  position: sticky;
  top: 1.5rem;
}

.preview-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 0.875rem;
}

.preview-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: color-mix(in srgb, var(--bg) 50%, #fff);
}

.preview-image {
  aspect-ratio: 1;
  background: color-mix(in srgb, var(--line) 25%, var(--bg));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-image img.preview-img-default {
  width: 64px;
  height: 64px;
  object-fit: contain;
  image-rendering: pixelated;
}

.preview-body {
  padding: 1rem;
}

.preview-ticker {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.preview-name {
  font-size: 11px;
  color: var(--muted);
  margin-top: 0.2rem;
}

.preview-desc {
  font-size: 10px;
  color: var(--muted);
  margin-top: 0.75rem;
  line-height: 1.55;
  min-height: 2.5em;
}

.preview-meta {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.875rem;
  flex-wrap: wrap;
}

.preview-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 4px;
}

.preview-note {
  margin-top: 0.875rem;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── explorer ── */
.wrap-explorer {
  --max: 820px;
}

.explorer-main {
  padding: 2rem 0 3rem;
}

.explorer-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.explorer-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.75rem;
  font-weight: 400;
  margin-top: 0.35rem;
}

.explorer-count {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.explorer-loading {
  font-size: 11px;
  color: var(--muted);
  padding: 2rem 0;
  animation: pulse 1.5s ease infinite;
}

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

.explorer-empty {
  text-align: center;
  padding: 3rem 0;
}

.explorer-empty p {
  color: var(--muted);
  margin-bottom: 1.25rem;
  font-size: 11px;
}

.explorer-list ul {
  list-style: none;
}

.explorer-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr 1fr;
  gap: 0.75rem;
  align-items: center;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.explorer-header {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}

.explorer-item {
  min-height: 52px;
}

.explorer-coin {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.explorer-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--line) 40%, var(--bg));
}

.explorer-img-default {
  object-fit: contain;
  image-rendering: pixelated;
  padding: 4px;
}

.explorer-ticker {
  font-weight: 700;
  font-size: 12px;
}

.explorer-name {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.explorer-position {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--fg);
  font-size: 10px;
}

.explorer-position img {
  border-radius: 50%;
}

.explorer-collateral {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.explorer-pnl {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.explorer-pnl-pct {
  font-weight: 500;
  font-size: 10px;
  opacity: 0.85;
}

.pnl-up {
  color: var(--fg);
}

.pnl-down {
  color: var(--muted);
}

.text-right {
  text-align: right;
}

@media (max-width: 600px) {
  .explorer-row {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
  }

  .explorer-header {
    display: none;
  }

  .explorer-position,
  .explorer-collateral {
    display: none;
  }

  .explorer-pnl {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }
}

/* footer */
footer {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
  padding: 1rem 0 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

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

.footer-links {
  display: flex;
  gap: 1.25rem;
}

@media (max-width: 520px) {
  nav {
    display: none;
  }

  .docs-sidebar {
    position: static;
    padding-bottom: 0;
    border-bottom: 1px solid var(--line);
    margin-bottom: -1rem;
  }

  .docs-toc {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding-bottom: 1.5rem;
  }
}
