/* AEN: a trading floor at night. Ink and warm paper for the working surfaces; a deep night panel where the network itself is drawn.
   One signal orange for AEN moving, green for dollars, violet for tokens; each market kind has its own colour. */
:root {
  --paper: #f3efe6; --ink: #14161c; --muted: #5d6170; --line: #d6d0c2; --panel: #fbf8f1; --panel-2: #f0ebe0;
  --signal: #e0551b; --usd: #1f7a4d; --token: #6d4bd8; --ok: #1f7a4d; --warn: #9a5b00; --bad: #b3261e;
  --k-service: #e0551b; --k-inference: #6d4bd8; --k-compute: #0f7f86; --k-software: #2f5fd0; --k-hardware: #a86a00;
  --night: #0c0e14; --night-2: #151925; --night-ink: #ece7dc; --night-muted: #8d93a6; --night-line: #262b3a;
  --display: 'Instrument Serif', Georgia, serif; --body: 'IBM Plex Sans', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 14px; --shadow: 0 1px 0 rgb(20 22 28 / .04), 0 10px 30px -18px rgb(20 22 28 / .35);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0f1117; --ink: #ece7dc; --muted: #979bab; --line: #272b37; --panel: #161922; --panel-2: #1c202b;
  --signal: #ff7a3d; --usd: #4fbf87; --token: #a58bff; --ok: #4fbf87; --warn: #e2a64a; --bad: #ff6b60;
  --k-service: #ff7a3d; --k-inference: #a58bff; --k-compute: #3cc6cf; --k-software: #6f9bff; --k-hardware: #e6a93f;
  --shadow: 0 1px 0 rgb(0 0 0 / .2), 0 14px 34px -20px rgb(0 0 0 / .8); color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #0f1117; --ink: #ece7dc; --muted: #979bab; --line: #272b37; --panel: #161922; --panel-2: #1c202b;
  --signal: #ff7a3d; --usd: #4fbf87; --token: #a58bff; --ok: #4fbf87; --warn: #e2a64a; --bad: #ff6b60;
  --k-service: #ff7a3d; --k-inference: #a58bff; --k-compute: #3cc6cf; --k-software: #6f9bff; --k-hardware: #e6a93f;
  --shadow: 0 1px 0 rgb(0 0 0 / .2), 0 14px 34px -20px rgb(0 0 0 / .8); color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.55 var(--body); padding-inline: 16px; overflow-x: hidden; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.top, main, .foot { max-width: 1180px; margin-inline: auto; }

/* --- Header ------------------------------------------------------------------------------------------------------------------------ */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 16px; position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  margin-inline: -16px; padding-inline: 16px; max-width: none; }
.top > * { max-width: 1180px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.mark { display: block; width: 34px; height: 34px; border-radius: 9px; }
.brand-name { font-weight: 600; letter-spacing: -.01em; }
.brand-name small { display: block; font: 500 10.5px/1 var(--mono); letter-spacing: .1em; color: var(--muted); text-transform: uppercase; margin-top: 3px; }
nav { display: flex; gap: 2px; flex-wrap: wrap; }
nav button, nav a { font: 500 13px var(--body); background: none; border: 1px solid transparent; border-radius: 999px; color: var(--muted); padding: 7px 12px; cursor: pointer; text-decoration: none; }
nav button:hover, nav a:hover { color: var(--ink); }
nav button[aria-current="page"] { color: var(--ink); border-color: var(--line); background: var(--panel); }
nav .cta { background: var(--ink); color: var(--paper); }

/* --- Type ---------------------------------------------------------------------------------------------------------------------------- */
.kicker, .fine, label > span, th, .label { font: 11.5px/1.4 var(--mono); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
h1 { font: 400 clamp(40px, 6.6vw, 78px)/1 var(--display); margin: 14px 0 18px; max-width: 15ch; text-wrap: balance; letter-spacing: -.01em; }
h1 em { color: var(--signal); }
h2 { font: 400 clamp(28px, 3.4vw, 38px)/1.08 var(--display); margin: 36px 0 14px; letter-spacing: -.005em; }
h3 { font-size: 15px; margin: 0; line-height: 1.3; }
.lede { font-size: 18px; max-width: 58ch; color: var(--muted); margin: 0; }
.muted { color: var(--muted); }
.fine { text-transform: none; letter-spacing: 0; font-size: 12.5px; }
code, pre { font: 12.5px/1.5 var(--mono); }
.num, .price { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* --- Hero: the network at night ------------------------------------------------------------------------------------------------------ */
.hero { position: relative; margin: 20px 0 0; border-radius: 22px; overflow: hidden; background: radial-gradient(120% 90% at 80% 20%, #1b2034 0%, var(--night) 60%); color: var(--night-ink);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 560px; isolation: isolate; }
.hero .copy { padding: 56px 20px 40px 44px; display: flex; flex-direction: column; justify-content: center; gap: 4px; z-index: 1; }
.hero .kicker { color: var(--night-muted); }
.hero .lede { color: #b9bccb; }
.hero canvas { width: 100%; height: 100%; display: block; }
.hero .stage { position: relative; min-height: 360px; }
.hero .legend { position: absolute; left: 16px; bottom: 14px; display: flex; gap: 12px; flex-wrap: wrap; font: 11px var(--mono); color: var(--night-muted); letter-spacing: .06em; text-transform: uppercase; }
.hero .legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.hero .btn { border-color: #3a4152; color: var(--night-ink); }
.hero .btn.primary { background: var(--night-ink); color: var(--night); border-color: var(--night-ink); }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .hero .copy { padding: 36px 20px 8px; }
  .hero .stage { min-height: 300px; }
}

.ticker { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); margin: 14px 0 0; }
.ticker::-webkit-scrollbar { display: none; }
.tick { display: grid; gap: 2px; padding: 10px 16px; border-right: 1px solid var(--line); flex: 1 0 auto; min-width: 128px; }
.tick:last-child { border-right: 0; }
.tick b { font: 500 15px var(--mono); font-variant-numeric: tabular-nums; }
.tick .up { color: var(--ok); } .tick .stale { color: var(--warn); }

/* --- Stats, charts, feed ------------------------------------------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 6px; box-shadow: var(--shadow); min-width: 0; }
.stat b { font: 400 34px/1 var(--display); letter-spacing: -.01em; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .axis { fill: var(--muted); font: 10.5px var(--mono); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 320px; overflow: auto; }
.feed li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed time { font: 11px var(--mono); color: var(--muted); }

.kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kind-card { border-radius: var(--radius); padding: 18px; border: 1px solid var(--line); background: var(--panel); display: grid; gap: 8px; position: relative; overflow: hidden; }
.kind-card::after { content: ''; position: absolute; inset: auto -30% -60% auto; width: 160px; height: 160px; border-radius: 50%; background: var(--kc); opacity: .10; }
button.kind-card { text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.kind-card:hover { border-color: var(--kc); }
.kind-card p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* --- Glyphs and kind colours --------------------------------------------------------------------------------------------------------- */
.glyph { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: color-mix(in srgb, var(--kc) 14%, transparent); color: var(--kc); flex: none; }
.glyph svg { width: 21px; height: 21px; }
.glyph.sm { width: 24px; height: 24px; border-radius: 7px; } .glyph.sm svg { width: 14px; height: 14px; }
.k-service { --kc: var(--k-service); } .k-inference { --kc: var(--k-inference); } .k-compute { --kc: var(--k-compute); }
.k-software { --kc: var(--k-software); } .k-hardware { --kc: var(--k-hardware); } .k-token { --kc: var(--token); } .k-usd { --kc: var(--usd); } .k-aen { --kc: var(--signal); }

/* --- Controls -------------------------------------------------------------------------------------------------------------------------- */
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 26px 0 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 600 14px var(--body); padding: 10px 16px; border-radius: 10px; border: 1px solid var(--ink); background: transparent; color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.signal { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn.ghost { border-color: var(--line); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, nav button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .chip:focus-visible, .token-card:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: 500 13px var(--body); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--kc, var(--muted)); }
form { display: grid; gap: 12px; }
label { display: grid; gap: 5px; min-width: 0; }
input, select, textarea { font: 14px var(--body); padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); color: var(--ink); width: 100%; min-width: 0; }
textarea { font-family: var(--mono); font-size: 13px; min-height: 90px; resize: vertical; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar form { display: flex; gap: 8px; flex: 1 1 320px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { font: 500 13px var(--body); border: 0; background: var(--panel); color: var(--muted); padding: 8px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* --- Panels and cards ----------------------------------------------------------------------------------------------------------------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; min-width: 0; box-shadow: var(--shadow); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.listing { display: grid; gap: 10px; align-content: start; }
.listing .head { display: flex; gap: 12px; align-items: flex-start; }
.listing p { margin: 0; color: var(--muted); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.price { font-size: 20px; font-weight: 500; }
.price small { font-size: 12px; color: var(--muted); font-weight: 400; }
.pill { display: inline-flex; align-items: center; gap: 5px; font: 500 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 5px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.pill.solid { border-color: transparent; background: color-mix(in srgb, var(--kc, var(--muted)) 16%, transparent); color: var(--kc, var(--muted)); }
.pill.funded, .pill.delivered { color: var(--warn); }
.pill.settled, .pill.active { color: var(--ok); }
.pill.refunded, .pill.cancelled, .pill.payment_failed, .pill.disputed, .pill.burned, .pill.retired { color: var(--bad); }
.pill.awaiting_approval, .pill.awaiting_payment, .pill.paused { color: var(--signal); }
.empty { text-align: center; padding: 42px 16px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); display: grid; gap: 8px; justify-items: center; }
.empty svg { width: 42px; height: 42px; opacity: .6; }

.meter { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; border: 1px solid var(--line); }
.meter > i { display: block; height: 100%; background: linear-gradient(90deg, var(--k-inference), var(--signal)); border-radius: inherit; transition: width .6s ease; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.detail { background: var(--panel-2); }
.detail td { padding: 16px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--muted); font: 11.5px/1.7 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; white-space: pre; margin: 0; }
.chat { display: grid; gap: 8px; }
.chat .bubble { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; white-space: pre-wrap; font-size: 14px; }

/* --- Gallery ------------------------------------------------------------------------------------------------------------------------------ */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.token-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; display: grid; cursor: pointer; text-align: left; padding: 0; color: inherit; font: inherit; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; }
.token-card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -22px rgb(0 0 0 / .55); }
.token-card img { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--night); }
.token-card .meta { padding: 12px 14px; display: grid; gap: 6px; }
.token-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.token-detail img { border-radius: 18px; aspect-ratio: 1; width: 100%; background: var(--night); box-shadow: 0 30px 60px -30px rgb(0 0 0 / .7); }
@media (max-width: 760px) { .token-detail { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--line); display: grid; gap: 14px; }
.timeline li { position: relative; font-size: 13.5px; }
.timeline li::before { content: ''; position: absolute; left: -25px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--kc, var(--token)); }
.mint-preview { display: grid; grid-template-columns: 160px 1fr; gap: 16px; align-items: start; }
.mint-preview img { border-radius: 14px; aspect-ratio: 1; background: var(--night); }
@media (max-width: 560px) { .mint-preview { grid-template-columns: 1fr; } .mint-preview img { max-width: 220px; } }

/* --- Wallet ------------------------------------------------------------------------------------------------------------------------------ */
.balance { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; background: linear-gradient(135deg, var(--night) 0%, #1d2233 100%); color: var(--night-ink); border-radius: 20px; padding: 26px; overflow: hidden; position: relative; }
.balance .label { color: var(--night-muted); }
.balance b { font: 400 clamp(40px, 7vw, 64px)/1 var(--display); display: block; margin-top: 8px; }
.balance b small { font: 500 16px var(--mono); color: var(--signal); margin-left: 8px; }
.balance .coin { width: 110px; height: 110px; }
.coin { display: block; flex: none; border-radius: 50%; filter: drop-shadow(0 6px 14px rgb(94 28 6 / .28)); transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.coin:hover { transform: perspective(400px) rotateY(360deg); }
.panel.currency > .row { gap: 14px; margin-bottom: 6px; }
.panel.currency h3 { margin: 0; }
@media (prefers-reduced-motion: reduce) { .coin, .coin:hover { transition: none; transform: none; } }
@media (max-width: 560px) { .balance { grid-template-columns: 1fr; } .balance .coin { display: none; } }
.gauge svg { width: 140px; height: 140px; }

.key { font: 13px var(--mono); overflow-wrap: anywhere; background: var(--panel-2); padding: 10px; border-radius: 8px; border: 1px solid var(--line); }
.foot { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: 13px; padding-block: 28px 40px; border-top: 1px solid var(--line); margin-top: 56px; }
#toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 11px 16px; border-radius: 10px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100vw - 32px); z-index: 10; }
#toast.show { opacity: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .token-card, .meter > i { transition: none; } }
.legal { max-width: 70ch; padding-block: 32px; }
.legal h2 { font-size: 26px; margin-top: 28px; }
.token-card img, .mint-preview img, .token-detail img { height: auto; }
.stat > .row { flex-wrap: nowrap; }
.stat .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
a.panel.listing { text-decoration: none; color: inherit; }
a.panel.listing:hover { border-color: var(--kc); }
.aen-amt { white-space: nowrap; }
.aen-sign { display: inline-block; width: .92em; height: .92em; vertical-align: -.1em; margin-left: .12em; }
.view { display: contents; }
.listing form p { display: block; -webkit-line-clamp: none; overflow: visible; } /* the buy form says everything it will do, unclipped */

.share-link { align-self: flex-start; color: var(--muted); }
.single-listing { max-width: 560px; margin: 8px 0 18px; }
.panel.listing .share input { font: 12px var(--mono); }
.single-listing .share-link { display: none; } /* already on it */
.run-out { white-space: pre-wrap; max-height: 320px; overflow: auto; font: 12.5px var(--mono); background: var(--night, #0c0e14); color: #e8e3d6; padding: 12px; border-radius: 10px; }
