/* Elpida design system. Tokens first; components below use only these variables.
   Type: Bricolage Grotesque (display, wordmark) + IBM Plex Sans (interface, tabular numbers). */
@font-face { font-family: 'Bricolage Grotesque'; src: url('/assets/fonts/bricolage-grotesque-wght.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/assets/fonts/ibm-plex-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/assets/fonts/ibm-plex-sans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('/assets/fonts/ibm-plex-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }

.curve-limit-action[hidden] { display: none; }
:root {
  color-scheme: dark;
  /* Black surfaces and a clear green accent, independent of the system theme. */
  --paper: #080B09;
  --surface: #101512;
  --surface-2: #171E19;
  --surface-3: #222C25;
  --line: #28332C;
  --line-strong: #435348;
  --ink: #F2F7F3;
  --ink-2: #C4D0C7;
  --ink-3: #9AAA9E;
  --primary: #ADFF45;
  --primary-hover: #C6FF7C;
  --primary-ink: #07120B;
  --primary-soft: #173423;
  --dawn: #76ED9A;
  --dawn-ink: #A0F5B8;
  --dawn-soft: #173423;
  --positive: #76ED9A;
  --positive-soft: #173423;
  --negative: #FF9292;
  --negative-action: #B83A3A;
  --negative-soft: #391A1C;
  --sim: #E9C46D;
  --sim-soft: #302A17;
  --testnet: #A5DFC0;
  --testnet-soft: #193329;
  --focus: #A0F5B8;
  --scrim: rgba(0, 0, 0, .72);

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --text-xs: .75rem;   /* 12 */
  --text-sm: .8125rem; /* 13 */
  --text-md: .9375rem; /* 15 */
  --text-lg: 1.125rem; /* 18 */
  --text-xl: 1.375rem; /* 22 */
  --text-2xl: 1.75rem; /* 28 */
  --text-3xl: 2.25rem; /* 36 */
  --leading-tight: 1.15;
  --leading: 1.5;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-14: 56px;

  --radius-sm: 6px;   /* inputs, chips */
  --radius-md: 10px;  /* cards, buttons */
  --radius-lg: 16px;  /* panels, dialogs */
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-2: 0 16px 40px rgba(0, 0, 0, .45);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --fast: 120ms; --base: 180ms; --slow: 260ms;
  --content: 1200px;
}
@media (prefers-reduced-motion: reduce) { :root { --fast: 0ms; --base: 0ms; --slow: 0ms; } *, *::before, *::after { animation-duration: 0ms !important; transition-duration: 0ms !important; scroll-behavior: auto !important; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: radial-gradient(ellipse at 85% 0%, #17301b60, transparent 50%), var(--paper); color: var(--ink); font: 400 var(--text-md)/var(--leading) var(--font-body); font-variant-numeric: tabular-nums; min-height: 100vh; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 650; line-height: var(--leading-tight); margin: 0; letter-spacing: -.01em; }
h1 { font-size: var(--text-3xl); letter-spacing: -.02em; }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); font-family: var(--font-body); font-weight: 600; letter-spacing: 0; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: var(--text-sm); }
.num { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
.skip-link { position: absolute; left: var(--space-4); top: -60px; z-index: 50; background: var(--ink); color: var(--paper); padding: var(--space-2) var(--space-4); border-radius: var(--radius-sm); }
.skip-link:focus { top: var(--space-2); }
.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.spin { animation: spin 900ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-4); border-radius: var(--radius-md); border: 1px solid transparent; font-weight: 600; font-size: var(--text-md); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), color var(--fast) var(--ease); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:not(:disabled):hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:not(:disabled):hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--ink-2); padding: 0 var(--space-3); }
.btn-ghost:not(:disabled):hover { background: var(--surface-2); color: var(--ink); }
.btn-buy { background: var(--positive); color: var(--primary-ink); }
.btn-sell { background: var(--negative-action); color: #fff; }
.btn-sm { min-height: 32px; padding: 0 var(--space-3); font-size: var(--text-sm); border-radius: var(--radius-sm); }
.btn-lg { min-height: 48px; padding: 0 var(--space-6); font-size: var(--text-md); }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; color: var(--primary); font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-button:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Form controls ---------- */
.field { display: grid; gap: 6px; }
.field > label, .field-label { font-weight: 600; font-size: var(--text-sm); color: var(--ink); display: flex; justify-content: space-between; gap: var(--space-2); }
.field-label .opt { font-weight: 400; color: var(--ink-3); }
.hint { font-size: var(--text-sm); color: var(--ink-3); }
.error-text { font-size: var(--text-sm); color: var(--negative); }
.error-text:empty, .hint:empty { display: none; }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.textarea { resize: vertical; min-height: 96px; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--negative); }
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-right: 84px; }
.input-affix .affix { position: absolute; right: 12px; color: var(--ink-3); font-weight: 600; font-size: var(--text-sm); pointer-events: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: var(--radius-md); gap: 2px; border: 1px solid var(--line); }
.segmented button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: var(--text-sm); color: var(--ink-2); cursor: pointer; min-height: 32px; }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- Chips, badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; min-height: 24px; border-radius: var(--radius-pill); font-size: var(--text-xs); font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.chip-sim { background: var(--sim-soft); color: var(--sim); border-color: transparent; }
.chip-testnet { background: var(--testnet-soft); color: var(--testnet); border-color: transparent; }
.chip-positive { background: var(--positive-soft); color: var(--positive); border-color: transparent; }
.chip-negative { background: var(--negative-soft); color: var(--negative); border-color: transparent; }
.chip-dawn { background: var(--dawn-soft); color: var(--dawn-ink); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.env-banner { display: flex; align-items: flex-start; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); font-size: var(--text-sm); color: var(--ink-2); }
.env-banner .icon { margin-top: 2px; color: var(--ink-3); }
.env-banner[data-env="local"] { background: var(--sim-soft); border-color: transparent; color: var(--dawn-ink); }
.env-banner[data-env="local"] .icon { color: var(--dawn-ink); }
.env-banner .btn { margin-left: auto; }

/* ---------- Generic layout pieces ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); flex-wrap: wrap; }
.page-head p { color: var(--ink-2); max-width: 62ch; margin-top: var(--space-2); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); }
.panel + .panel, .stack > * + * { margin-top: var(--space-4); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.panel-head p { color: var(--ink-3); font-size: var(--text-sm); margin-top: 2px; }
.section { margin-top: var(--space-10); }
.section > h2 { margin-bottom: var(--space-4); }
.divider { height: 1px; background: var(--line); margin: var(--space-4) 0; border: 0; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: var(--space-2) var(--space-4); font-size: var(--text-md); }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.kv .total { border-top: 1px solid var(--line); padding-top: var(--space-2); }
details.tech { border: 1px solid var(--line); border-radius: var(--radius-md); padding: 0 var(--space-4); background: var(--surface); }
details.tech summary { cursor: pointer; padding: var(--space-3) 0; font-weight: 600; color: var(--ink-2); list-style: none; display: flex; align-items: center; justify-content: space-between; }
details.tech summary::-webkit-details-marker { display: none; }
details.tech[open] summary .icon { transform: rotate(180deg); }
details.tech summary .icon { transition: transform var(--base) var(--ease); }
details.tech .kv { padding-bottom: var(--space-4); font-size: var(--text-sm); }
details.tech .kv dd { font-weight: 500; word-break: break-all; }
.callout { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); color: var(--ink-2); font-size: var(--text-sm); }
.callout .icon { margin-top: 1px; color: var(--ink-3); }
.callout-warn { background: var(--dawn-soft); color: var(--dawn-ink); }
.callout-warn .icon { color: var(--dawn-ink); }
.callout-error { background: var(--negative-soft); color: var(--negative); }
.callout-error .icon { color: var(--negative); }
.callout-ok { background: var(--positive-soft); color: var(--positive); }
.callout-ok .icon { color: var(--positive); }

/* ---------- Discovery ---------- */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-6); align-items: end; padding-bottom: var(--space-6); border-bottom: 1px solid var(--line); }
.intro h1 { max-width: 18ch; }
.intro p { color: var(--ink-2); max-width: 58ch; margin-top: var(--space-3); font-size: var(--text-lg); }
.intro-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: var(--space-6) 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.stats > div { padding: var(--space-4) var(--space-5); border-left: 1px solid var(--line); min-width: 0; }
.stats > div:first-child { border-left: 0; }
.stats span { display: block; font-size: var(--text-sm); color: var(--ink-3); }
.stats strong { display: block; font-size: var(--text-xl); font-family: var(--font-display); font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.stats small { display: block; color: var(--ink-3); font-size: var(--text-xs); }
.toolbar { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .input { padding-left: 38px; }
.toolbar .select { width: auto; min-width: 180px; }
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: var(--space-4); }
.token-card { position: relative; display: grid; gap: var(--space-3); padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); color: inherit; text-decoration: none; transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
.token-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.token-card-head { display: flex; gap: var(--space-3); align-items: center; min-width: 0; }
.token-card-head > div { min-width: 0; }
.token-card h3 { font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.token-card .sym { color: var(--ink-3); font-size: var(--text-sm); font-weight: 600; }
.token-card .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.token-card .desc { color: var(--ink-2); font-size: var(--text-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.token-card .figures { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); }
.figure span { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.figure strong { font-size: var(--text-md); font-weight: 600; }
.avatar { width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--ink-3); border: 1px solid var(--line); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; border-radius: 14px; }
.avatar .initials { font-family: var(--font-display); font-weight: 650; font-size: var(--text-md); color: var(--ink-2); }
.avatar-lg .initials { font-size: var(--text-2xl); }
.progress { display: grid; gap: 6px; }
.progress-label { display: flex; justify-content: space-between; font-size: var(--text-xs); color: var(--ink-3); }
.progress-label strong { color: var(--ink-2); font-weight: 600; }
.bar { height: 6px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--dawn); border-radius: inherit; width: 0; transition: width var(--slow) var(--ease); }
.bar[data-state="done"] > span { background: var(--positive); }
.empty { text-align: center; padding: var(--space-14) var(--space-6); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--ink-2); }
.empty img { width: 56px; height: 56px; margin: 0 auto var(--space-4); }
.empty h3 { margin-bottom: var(--space-2); }
.empty p { max-width: 46ch; margin: 0 auto var(--space-4); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-md); min-height: 196px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.activity { display: grid; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.activity-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); font-size: var(--text-sm); }
.activity-row:first-child { border-top: 0; }
.activity-row .glyph { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.activity-row .glyph[data-kind="Buy"] { background: var(--positive-soft); color: var(--positive); }
.activity-row .glyph[data-kind="Sell"] { background: var(--negative-soft); color: var(--negative); }
.activity-row strong { display: block; font-weight: 600; }
.activity-row .meta { color: var(--ink-3); }

/* ---------- Token page ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: var(--text-sm); margin-bottom: var(--space-4); }
.back-link:hover { color: var(--ink); }
.token-head { display: flex; gap: var(--space-4); align-items: center; margin-bottom: var(--space-6); flex-wrap: wrap; }
.token-head h1 { font-size: var(--text-2xl); }
.token-head .sym { color: var(--ink-3); font-weight: 600; margin-left: var(--space-2); font-size: var(--text-lg); font-family: var(--font-body); }
.token-head .chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--space-2); }
.token-head .head-actions { margin-left: auto; display: flex; gap: var(--space-2); flex-wrap: wrap; }
.token-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-6); align-items: start; }
.token-layout aside { position: sticky; top: 88px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4) var(--space-6); }
.metric span { display: flex; align-items: center; gap: 4px; font-size: var(--text-sm); color: var(--ink-3); }
.metric strong { display: block; font-size: var(--text-xl); font-family: var(--font-display); font-weight: 600; margin-top: 2px; overflow-wrap: anywhere; }
.metric small { display: block; font-size: var(--text-xs); color: var(--ink-3); margin-top: 2px; }
.dawn-arc { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: var(--space-5); align-items: center; }
.dawn-arc svg { width: 148px; height: 84px; }
.dawn-arc .arc-track { stroke: var(--surface-3); }
.dawn-arc .arc-fill { stroke: var(--dawn); transition: stroke-dashoffset var(--slow) var(--ease); }
.dawn-arc .arc-horizon { stroke: var(--ink); }
.dawn-arc .arc-value { font: 650 20px var(--font-display); fill: var(--ink); }
.dawn-arc[data-state="done"] .arc-fill { stroke: var(--positive); }
.links { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.links a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); text-decoration: none; color: var(--ink-2); font-size: var(--text-sm); font-weight: 600; }
.links a:hover { border-color: var(--line-strong); color: var(--ink); }
.trade-panel .segmented { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
.trade-panel .segmented button[data-side="buy"][aria-selected="true"] { color: var(--positive); }
.trade-panel .segmented button[data-side="sell"][aria-selected="true"] { color: var(--negative); }
.shortcuts { display: flex; flex-wrap: wrap; gap: 6px; }
.quote { display: grid; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--surface-2); border-radius: var(--radius-md); font-size: var(--text-sm); }
.quote div { display: flex; justify-content: space-between; gap: var(--space-3); }
.quote span { color: var(--ink-3); }
.quote strong { text-align: right; }
.address { font-family: var(--font-body); font-size: var(--text-sm); color: var(--ink-2); word-break: break-all; }
.copy { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 8px; cursor: pointer; font-size: var(--text-sm); color: var(--ink-2); font-weight: 500; }
.copy:hover { color: var(--ink); border-color: var(--line-strong); }

/* ---------- Launch flow ---------- */
.launch { display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; gap: var(--space-8); align-items: start; }
.stepper { position: sticky; top: 88px; display: grid; gap: 2px; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.stepper button { width: 100%; display: grid; grid-template-columns: 28px 1fr; align-items: center; gap: var(--space-3); padding: 8px 10px; border-radius: var(--radius-md); background: transparent; border: 0; text-align: left; cursor: pointer; color: var(--ink-3); font-weight: 600; }
.stepper button:disabled { cursor: default; }
.stepper .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-size: var(--text-sm); background: var(--surface); }
.stepper [aria-current="step"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
.stepper [aria-current="step"] .n { border-color: var(--primary); color: var(--primary); }
.stepper [data-done="true"] { color: var(--ink-2); }
.stepper [data-done="true"] .n { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.step-panel { min-width: 0; }
.step-panel > header { margin-bottom: var(--space-6); }
.step-panel > header p { color: var(--ink-2); margin-top: var(--space-2); max-width: 60ch; }
.step-kicker { display: block; color: var(--ink-3); font-size: var(--text-sm); font-weight: 600; margin-bottom: var(--space-2); }
.step-body { display: grid; gap: var(--space-5); animation: step-in var(--slow) var(--ease); }
@keyframes step-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step-nav { display: flex; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-8); padding-top: var(--space-5); border-top: 1px solid var(--line); }
.logo-drop { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-4); align-items: center; padding: var(--space-4); border: 1px dashed var(--line-strong); border-radius: var(--radius-md); background: var(--surface); }
.logo-drop .avatar { width: 88px; height: 88px; border-radius: 18px; }
.logo-drop input[type=file] { font-size: var(--text-sm); max-width: 100%; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-3); }
.choice { position: relative; display: grid; gap: 6px; padding: var(--space-4); border: 1.5px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; text-align: left; transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease); }
.choice:hover { border-color: var(--line-strong); }
.choice > label { display:grid; gap:6px; cursor:inherit; }
.choice:has(input:disabled):has(.btn) { opacity:1; cursor:default; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice:has(input:disabled) { cursor: not-allowed; opacity: .62; }
.choice .choice-title { display: flex; align-items: center; gap: var(--space-2); font-weight: 600; }
.choice .choice-title .icon { color: var(--ink-2); }
.choice p { font-size: var(--text-sm); color: var(--ink-2); }
.choice .chip { justify-self: start; }
.reveal { animation: reveal var(--base) var(--ease); }
@keyframes reveal { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.connection { display: grid; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); }
.connection-row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.connection-row .grow { flex: 1; min-width: 200px; }
/* Trading pairs: the same four kinds on every network, two by two. */
.pair-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice .choice-title .chip { margin-left: auto; font-weight: 500; }
.choice[data-unavailable] p { color: var(--ink-3, var(--ink-2)); }
/* Wallet picker: one button per installed wallet. */
.wallet-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.wallet-icon { width: 18px; height: 18px; border-radius: 4px; flex: none; }
details.small summary { cursor: pointer; color: var(--primary); margin-block: var(--space-2); }
@media (max-width: 560px) { .pair-grid { grid-template-columns: 1fr; } }
.alloc { display: grid; gap: var(--space-2); }
.alloc-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px 36px; gap: var(--space-2); align-items: center; }
.alloc-row .input-affix .input { padding-right: 32px; }
.alloc-total { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--text-sm); font-weight: 600; }
.alloc-total[data-ok="true"] { color: var(--positive); }
.alloc-total[data-ok="false"] { color: var(--negative); }
.preview { position: sticky; top: 88px; display: grid; gap: var(--space-4); }
.preview-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-4); display: grid; gap: var(--space-3); }
.preview-card .token-card-head h3 { font-size: var(--text-lg); }
.preview-card p.desc { color: var(--ink-2); font-size: var(--text-sm); overflow-wrap: anywhere; }
.summary-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-4); }
.summary-card h4 { margin-bottom: var(--space-3); }
.review { display: grid; gap: var(--space-3); }
.review-block { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); padding: var(--space-4); }
.review-block header { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.review-block .kv { font-size: var(--text-sm); }
.review-block .kv dd { overflow-wrap: anywhere; max-width: 40ch; }
.fixed-list { margin: 0; padding-left: var(--space-5); color: var(--ink-2); font-size: var(--text-sm); display: grid; gap: 4px; }
.status-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.status-list li { display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); align-items: start; padding: var(--space-3) 0; color: var(--ink-3); }
.status-list li .mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); }
.status-list li[data-state="active"] { color: var(--ink); }
.status-list li[data-state="active"] .mark { border-color: var(--primary); color: var(--primary); }
.status-list li[data-state="done"] { color: var(--ink-2); }
.status-list li[data-state="done"] .mark { background: var(--positive); border-color: var(--positive); color: var(--primary-ink); }
.status-list li[data-state="error"] .mark { background: var(--negative); border-color: var(--negative); color: var(--primary-ink); }
.status-list li strong { display: block; font-weight: 600; }
.status-list li small { display: block; font-size: var(--text-sm); color: var(--ink-3); }
.success { text-align: center; padding: var(--space-10) var(--space-6); }
.success .avatar { margin: 0 auto var(--space-4); }
.success h2 { margin-bottom: var(--space-2); }
.success p { color: var(--ink-2); max-width: 52ch; margin: 0 auto var(--space-6); }
.success .actions { display: flex; gap: var(--space-2); justify-content: center; flex-wrap: wrap; }

/* ---------- Rewards ---------- */
.reward-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-4); }
.fee-row { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)) auto; gap: var(--space-4); align-items: center; padding: var(--space-4); border-top: 1px solid var(--line); }
.fee-row:first-of-type { border-top: 0; }
.fee-row .token-card-head h3 { font-size: var(--text-md); }
.treasury { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.treasury > header { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.treasury-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.treasury-group { padding: var(--space-4) var(--space-5); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: var(--space-3); align-content: start; }
.treasury-group h4 { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); }
.treasury-group h4 .count { color: var(--ink-3); font-weight: 500; }
.treasury-group .empty-note { color: var(--ink-3); font-size: var(--text-sm); }
.alloc-card { display: grid; gap: 6px; padding: var(--space-3); border-radius: var(--radius-md); background: var(--surface-2); font-size: var(--text-sm); }
.alloc-card strong { font-weight: 600; overflow-wrap: anywhere; }
.alloc-card .row { display: flex; justify-content: space-between; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: var(--scrim); }
dialog[open] { animation: dialog-in var(--base) var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); padding: var(--space-5) var(--space-6) 0; }
.dialog-head p { color: var(--ink-2); margin-top: var(--space-2); font-size: var(--text-sm); }
.dialog-body { padding: var(--space-5) var(--space-6) var(--space-6); display: grid; gap: var(--space-4); }
.verify-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-4); counter-reset: v; }
.verify-steps > li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--space-3); }
.verify-steps > li::before { counter-increment: v; content: counter(v); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-weight: 600; font-size: var(--text-sm); color: var(--ink-2); }
.verify-steps > li[data-done="true"]::before { content: '✓'; background: var(--positive); color: var(--primary-ink); }
.verify-steps > li > div { display: grid; gap: var(--space-2); min-width: 0; }
.record { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: var(--space-2); align-items: center; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); font-size: var(--text-sm); }
.record code, .message-box { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: var(--text-xs); overflow-wrap: anywhere; }
.message-box { white-space: pre-wrap; padding: var(--space-3); border-radius: var(--radius-sm); background: var(--surface-2); max-height: 140px; overflow: auto; }
.tools-section { display: grid; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.tools-section:first-child { border-top: 0; padding-top: 0; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: 60; display: grid; gap: var(--space-2); width: min(400px, calc(100vw - 32px)); }
.toast { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: var(--space-3); align-items: start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--ink); color: var(--paper); box-shadow: var(--shadow-2); font-size: var(--text-sm); animation: toast-in var(--base) var(--ease); }
.toast a { color: inherit; font-weight: 600; }
.toast .icon { margin-top: 1px; }
.toast[data-kind="error"] .icon { color: #FFB4A6; }
.toast[data-kind="success"] .icon { color: #8EE0BD; }
.toast button { background: none; border: 0; color: inherit; opacity: .7; cursor: pointer; padding: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Responsive ---------- */@media (max-width: 1100px) {
  .launch { grid-template-columns: minmax(0, 1fr) 300px; }
  .stepper { position: static; grid-column: 1 / -1; display: flex; overflow-x: auto; gap: var(--space-1); }
  .stepper li { flex: none; }
  .stepper button { grid-template-columns: 28px auto; }
  .token-layout { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 860px) {
  .intro { grid-template-columns: 1fr; }
  h1 { font-size: var(--text-2xl); }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .launch { grid-template-columns: 1fr; gap: var(--space-5); }
  .preview { position: static; order: 3; }
  .token-layout { grid-template-columns: 1fr; }
  .token-layout aside { position: static; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .row-2 { grid-template-columns: 1fr; }
  .alloc-row { grid-template-columns: 1fr 96px 36px; }
  .alloc-row > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .fee-row { grid-template-columns: 1fr 1fr; }
  .fee-row > :first-child { grid-column: 1 / -1; }
  .activity-row { grid-template-columns: 32px minmax(0, 1fr) auto; }
  .activity-row .who { display: none; }
  .toasts { bottom: 84px; right: 16px; }
  .dawn-arc { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .token-grid { grid-template-columns: 1fr; }
  .logo-drop { grid-template-columns: minmax(0, 1fr); }
  .step-nav .btn { flex: 1; }
}

/* ---------- Small additions ---------- */
.stats.compact { grid-template-columns: repeat(2, minmax(0, 200px)); margin: 0; }
.trade-gap { height: var(--space-2); }
.activity.flush { border: 0; border-radius: 0; background: transparent; margin-top: var(--space-3); }
.activity.flush .activity-row { padding-left: 0; padding-right: 0; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: var(--space-2); }
input[type=file] { color: var(--ink-2); font-size: var(--text-sm); }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: var(--space-3); padding: 7px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.token-row { color: inherit; text-decoration: none; }
.token-row:hover { background: var(--surface-2); }
.fee-row .token-card-head { color: inherit; text-decoration: none; }
.stack > .panel + .panel { margin-top: var(--space-4); }
.panel h2 + p, .panel h2 + .links { margin-top: var(--space-2); }
.trade-panel h2 { margin-bottom: var(--space-1); }
.treasury-tech { border: 0; border-radius: 0; border-top: 1px solid var(--line); }
.step-panel h2:focus, .success h2:focus, main:focus { outline: none; }
.choice[aria-pressed="true"] { border-color: var(--primary); background: var(--primary-soft); }
.token-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.dawn-arc h3 + p, .dawn-arc p + p { margin-top: var(--space-2); }
.stats strong { font-size: var(--text-lg); }
.kv { grid-template-columns: max-content minmax(0, 1fr); }
@media (max-width: 860px) {
  .stepper { overflow: visible; flex-wrap: nowrap; }
  .stepper li { flex: 0 0 auto; }
  .stepper button:not([aria-current]) span:last-child { display: none; }
  .stepper button:not([aria-current]) { grid-template-columns: 28px; padding: 6px; }
}
.review-block .kv dd { max-width: none; }
@media (max-width: 860px) { .token-layout aside { order: -1; } }

/* Quiet neon accents; layout and meaning remain clear without animation. */
.intro { position:relative; border:1px solid var(--line); border-radius:24px; padding:clamp(24px,4vw,48px); background:linear-gradient(120deg,#101b13,#080d0a); overflow:hidden; }
.intro::after { content:''; position:absolute; pointer-events:none; right:-80px; top:-130px; width:400px; height:400px; border-radius:50%; border:1px solid #adff4520; box-shadow:0 0 0 48px #adff4504,0 0 0 96px #adff4503; }
.intro > * { z-index:1; position:relative; }
.btn-primary { box-shadow:0 0 20px #adff4512; }
.token-card { transition:border-color var(--base),transform var(--base); }
.token-card:hover { border-color:#adff4570; transform:translateY(-2px); }
.price-status { border-left:2px solid var(--primary); padding:8px 12px; color:var(--ink-2); font-size:var(--text-sm); background:#adff4506; border-radius:0 8px 8px 0; }
.price-ticker { display:flex; gap:12px; flex-wrap:wrap; margin:20px 0; }
.price-ticker > span { padding:8px 12px; border:1px solid var(--line); border-radius:8px; background:var(--surface); color:var(--ink-2); font-size:var(--text-sm); }
.price-ticker strong { color:var(--primary); margin-right:8px; }
.kv dt,.kv dd,.choice p,.connection-row .grow { overflow-wrap:anywhere; min-width:0; }
.kv { grid-template-columns:minmax(0,1fr) minmax(0,1.2fr); gap:10px 16px; }
input,select,textarea { scroll-margin:100px; }
button.link-button,.copy { min-height:44px; }
@media(max-width:600px) { .intro { border-radius:16px; padding:24px; } .intro-actions { display:flex;flex-wrap:wrap; } .intro-actions .btn { width:100%; } .toolbar { gap:12px; } .step-panel,.panel { padding:20px; } .metrics { gap:20px 12px; } .choice { min-height:100px; } .price-ticker { gap:8px; } .price-ticker > span { flex:1; white-space:nowrap; } }
@media(prefers-reduced-motion:reduce) { .token-card:hover { transform:none; } }

.btn-sm,.icon-button,.segmented button { min-height:44px; }
.icon-button { min-width:44px; }
[hidden] { display:none !important; }

.token-card .figures { grid-template-columns:repeat(3,minmax(0,1fr));gap:10px; }
.token-card .figure strong { font-size:1rem;overflow-wrap:anywhere; }
@media(max-width:600px) { .stepper button { min-height:44px; } }
@media(max-width:380px) {
  .stepper { display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px; }
  .stepper li { min-width:0; }
  .stepper button,.stepper button:not([aria-current]) { grid-template-columns:28px;justify-content:center;padding:8px 0; }
  .stepper button span:last-child { display:none; }
}

.price-history svg {width:100%;height:auto;min-height:120px;}
.chart-grid {stroke:var(--line);stroke-width:1;}
.chart-line {stroke:var(--primary);stroke-width:2;stroke-linejoin:round;stroke-linecap:round;}
.chart-dot {fill:var(--primary);}
.chart-caption {display:flex;justify-content:space-between;gap:12px;color:var(--ink-3);font-size:var(--text-xs);}

.stage-filters {display:flex;gap:8px;flex-wrap:wrap;margin:0 0 20px;}
.stage-filters button[aria-pressed=true] {background:var(--primary-soft);color:var(--primary);border-color:var(--line-strong);}
.market-headline {display:grid;gap:4px;text-align:right;}
.token-head .head-actions {align-items:center;}
.market-headline strong {font-size:1.8rem;color:var(--primary);letter-spacing:-.04em;}
.chart-controls {display:flex;flex-wrap:wrap;gap:12px;justify-content:space-between;margin-bottom:20px;}
.chart-options {display:flex;gap:5px;flex-wrap:wrap;}
.chart-options button[aria-pressed=true] {color:var(--primary);border-color:var(--primary);background:var(--primary-soft);}
.chart-axis {fill:var(--ink-3);font-size:11px;font-family:inherit;}
.candle-up {stroke:var(--primary);fill:var(--primary);stroke-width:1.5;}
.candle-down {stroke:#f77787;fill:#f77787;stroke-width:1.5;}
.table-scroll {overflow-x:auto;}
.token-layout>.stack,.token-layout .panel {min-width:0;}
.token-layout .panel-head {flex-wrap:wrap;gap:12px;}
.market-table {width:100%;border-collapse:collapse;font-size:.85rem;}
.market-table th {text-align:left;color:var(--ink-3);font-weight:500;}
.market-table th,.market-table td {padding:13px 10px;border-bottom:1px solid var(--line);white-space:nowrap;}
.market-table td small {display:block;color:var(--ink-3);margin-top:3px;}
.trade-buy {color:var(--primary);}.trade-sell {color:#f77787;}
@media(max-width:600px) {.market-headline{text-align:left;}.chart-caption{flex-wrap:wrap;}.chart-controls{gap:8px;}.chart-options button{min-height:44px;}.price-history{padding:16px;}}

/* ---------- Post-launch token page (Pons-style structure) ---------- */
.token-page .back-link { margin-bottom: var(--space-4); }
.token-hero { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-4) var(--space-5); align-items: center; margin-bottom: var(--space-6); }
.token-hero h1 { font-family: var(--font-display); font-size: clamp(1.75rem, 4vw, 2.6rem); line-height: var(--leading-tight); margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-3); overflow-wrap: anywhere; }
.token-hero h1 .sym { font-size: .55em; color: var(--ink-3); font-weight: 600; letter-spacing: .02em; }
.token-identity { min-width: 0; display: grid; gap: var(--space-2); }
.byline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); color: var(--ink-3); font-size: var(--text-sm); }
.byline a { color: var(--ink-2); }
.byline .creator-link { color: var(--ink); font-weight: 600; }
.byline .addr { display: inline-flex; align-items: center; gap: var(--space-1); font-variant-numeric: tabular-nums; }
.icon-link { display: inline-grid; place-items: center; min-width: 32px; min-height: 32px; border-radius: var(--radius-sm); color: var(--ink-3); }
.icon-link:hover { color: var(--primary); background: var(--surface-2); }
.chip-link { text-decoration: none; }
.market-headline { display: grid; justify-items: end; text-align: right; gap: 2px; }
.market-headline strong { font-family: var(--font-display); font-size: clamp(1.75rem, 4vw, 2.6rem); line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.token-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 360px); gap: var(--space-6); align-items: start; }
.trade-aside { position: sticky; top: 84px; }
.price-history .chart-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-3); margin-bottom: var(--space-3); }
.chart-value { display: block; font-family: var(--font-display); font-size: var(--text-3xl); line-height: 1; font-variant-numeric: tabular-nums; }
.chart-change { display: block; margin-top: var(--space-1); font-size: var(--text-sm); color: var(--ink-3); }
.chart-change[data-dir=up] { color: var(--positive); }
.chart-change[data-dir=down] { color: var(--negative); }
.price-history .chart-controls { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.price-history .chart-options { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius-pill); background: var(--surface-2); border: 1px solid var(--line); }
.price-history .chart-options .btn { border: 0; border-radius: var(--radius-pill); min-height: 32px; padding: 0 var(--space-3); background: transparent; }
.price-history .chart-options .btn[aria-pressed=true] { background: var(--surface-3); color: var(--ink); box-shadow: none; }
.curve-strip { display: grid; gap: var(--space-2); padding: var(--space-2) 0 var(--space-5); border-bottom: 1px solid var(--line); }
.curve-line { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); color: var(--ink-2); }
.curve-strip .bar { height: 6px; }
.stat-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-4); padding: var(--space-5) 0; border-bottom: 1px solid var(--line); }
.stat { display: grid; gap: var(--space-1); min-width: 0; }
.stat > span { font-size: var(--text-sm); color: var(--ink-3); }
.stat > strong { font-family: var(--font-display); font-size: var(--text-xl); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.address-row { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-8); padding: var(--space-5) 0; border-bottom: 1px solid var(--line); }
.address-row > div { display: grid; gap: var(--space-1); }
.address-row span { font-size: var(--text-sm); color: var(--ink-3); }
.address-row a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; font-variant-numeric: tabular-nums; }
.address-row strong { font-weight: 500; color: var(--ink-2); }
.about { padding: var(--space-5) 0 0; }
.about h2, .activity-panel h2 { font-size: var(--text-lg); margin: 0; }
.about .section-text { margin: var(--space-3) 0; color: var(--ink-2); max-width: 68ch; overflow-wrap: anywhere; white-space: pre-line; }
.activity-panel { padding-top: var(--space-4); }
.activity-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: var(--space-2); }
.tabs-underline { display: flex; gap: var(--space-2); }
.tabs-underline button { min-height: 44px; padding: 0 var(--space-3); background: none; border: 0; border-bottom: 2px solid transparent; color: var(--ink-3); font: inherit; font-weight: 600; cursor: pointer; }
.tabs-underline button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs-underline button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.market-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.market-table th { text-align: left; font-weight: 500; color: var(--ink-3); padding: var(--space-2) var(--space-2); }
.market-table td { padding: var(--space-3) var(--space-2); border-top: 1px solid var(--line); white-space: nowrap; }
.market-table .num { text-align: right; }
.market-table tbody tr:hover { background: var(--surface); }
.market-table .trade-buy { color: var(--positive); }
.market-table .trade-sell { color: var(--negative); }
.market-table a { color: var(--ink-2); }
.trader { display: inline-flex; align-items: center; gap: var(--space-2); }
.badge-dev { font-size: var(--text-xs); padding: 1px 8px; border-radius: var(--radius-pill); background: var(--surface-3); color: var(--ink); }
.trade-panel .pay-box { display: grid; gap: var(--space-2); padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); }
.trade-panel .pay-box > label { font-size: var(--text-sm); color: var(--ink-3); }
.pay-input { display: flex; align-items: center; gap: var(--space-2); }
.pay-input input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--ink); font-family: var(--font-display); font-size: var(--text-2xl); padding: 0; outline: none; }
.pay-input .affix { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 700; color: var(--ink); }
.pay-box:focus-within { border-color: var(--primary); }
.shortcuts { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip-btn { min-height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface-3); color: var(--ink-2); font: inherit; font-size: var(--text-sm); cursor: pointer; }
.chip-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.chip-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.trade-panel .receive { display: grid; gap: 2px; padding: var(--space-2) var(--space-1); }
.trade-panel .receive span { font-size: var(--text-sm); color: var(--ink-3); }
.trade-panel .receive strong { font-family: var(--font-display); font-size: var(--text-xl); }
.trade-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); font-size: var(--text-sm); color: var(--ink-3); }
.trade-meta strong { color: var(--ink-2); font-weight: 500; }
.trade-meta .select { width: auto; min-height: 36px; }
@media (max-width: 1080px) { .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .token-layout { grid-template-columns: 1fr; }
  .trade-aside { position: static; order: -1; }
  .token-hero { grid-template-columns: auto 1fr; }
  .market-headline { grid-column: 1 / -1; justify-items: start; text-align: left; }
}
@media (max-width: 560px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-table th:nth-child(4), .market-table td:nth-child(4) { display: none; }
}
.nowrap{white-space:nowrap;}
.market-table .side{display:inline-flex;align-items:center;gap:4px;} .byline .copy{min-height:32px;padding:0 6px;}
.analytics-controls,.analytics-filters,.analytics-section-head,.analytics-axis,.analytics-pair,.analytics-coverage-row { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.analytics-controls { flex-wrap:wrap; }
.analytics-filters { gap:6px; }
.analytics-filters button[aria-pressed="true"] { color:var(--primary); border-color:var(--primary); background:var(--primary-muted,var(--surface)); }
.analytics-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:16px; }
.analytics-metric strong { font-size:clamp(24px,3vw,36px); color:var(--ink); font-variant-numeric:tabular-nums; }
.analytics-body { display:grid; gap:24px; }
.analytics-body .panel { padding:24px; min-width:0; }
.analytics-body h2 { font-size:24px; margin-bottom:12px; }
.analytics-columns { display:grid; grid-template-columns:1fr 1fr; gap:24px; }
.analytics-plot { padding-top:24px; }
.analytics-plot svg { width:100%; height:auto; display:block; overflow:visible; }
.analytics-line { fill:none; stroke:var(--primary); stroke-width:3; stroke-linejoin:round; }
.analytics-gridline { stroke:var(--line); stroke-width:1; }
.analytics-axis { font-size:12px; color:var(--ink-3); padding-top:12px; }
.analytics-pair,.analytics-coverage-row { padding:16px 0; border-bottom:1px solid var(--line); }
.analytics-pair>div:last-child { text-align:right; }
.analytics-table-scroll { overflow-x:auto; }
.analytics-table { width:100%; border-collapse:collapse; text-align:left; font-variant-numeric:tabular-nums; }
.analytics-table th { color:var(--ink-3); font-size:13px; font-weight:500; }
.analytics-table td,.analytics-table th { padding:16px 12px; border-bottom:1px solid var(--line); }
.analytics-table a { color:var(--primary); }
.analytics-notes { padding:0 4px; }
@media(max-width:1000px) { .analytics-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); } .analytics-columns { grid-template-columns:1fr; } .analytics-page .page-head { flex-wrap:wrap; gap:20px; } }
@media(max-width:600px) { .analytics-controls { width:100%; } .analytics-filters { flex-wrap:wrap; } .analytics-section-head { flex-wrap:wrap; } .analytics-body .panel { padding:18px; } .analytics-metrics { gap:10px; } .analytics-controls select { max-width:100%; } .analytics-table { min-width:540px; } }
.analytics-body .panel { margin:0; }
.analytics-controls select { color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:10px; min-height:44px; padding:10px 32px 10px 12px; }

/* Narrow phones: grid tracks must not grow past the panel because of an input's intrinsic width. */
.step-body{grid-template-columns:minmax(0,1fr)}
.row-2>*,.step-body>*{min-width:0}
.step-body .input{min-width:0;width:100%}
.logo-drop,.logo-drop>*,.field-label{min-width:0}
.logo-drop input[type=file]{width:100%}
.asset-icon { width:20px; height:20px; object-fit:contain; flex-shrink:0; display:inline-block; vertical-align:middle; }
.chain-options { position:absolute; right:0; top:calc(100% + 8px); z-index:60; min-width:290px; max-width:calc(100vw - 32px); padding:8px; border:1px solid var(--line); border-radius:14px; background:var(--surface); box-shadow:0 16px 40px #0008; }
.chain-option { width:100%; display:flex; align-items:center; gap:12px; padding:12px; min-height:48px; background:transparent; color:var(--ink); border:0; border-radius:8px; text-align:left; cursor:pointer; }
.chain-option small { margin-left:auto; color:var(--ink-3); font-size:11px; }
.chain-option[aria-selected="true"],.chain-option:hover { background:var(--surface-2); color:var(--primary); }
.chain-context,.card-change { display:flex; align-items:center; gap:8px; }
.card-change { font-size:13px; margin:14px 0; color:var(--ink-3); }
.card-change[data-direction="up"] { color:var(--primary); }
.card-change[data-direction="down"] { color:#ff9f9f; }
.price-ticker>span { display:flex; align-items:center; gap:8px; }
.token-card .figures { grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-bottom:12px; }
.stage-filters button[aria-pressed="true"] { background:var(--surface-2); color:var(--primary); border-color:var(--primary); }
@media(max-width:600px) { .chain-options { min-width:280px; } .token-card .figures strong { white-space:normal; overflow-wrap:anywhere; } }
.price-sources { margin:0 0 24px; font-size:13px; color:var(--ink-3); }
.price-sources summary { min-height:44px; display:flex; align-items:center; cursor:pointer; text-decoration:underline; text-underline-offset:4px; }
/* Token trading terminal: market context first, then execution and holder context. */
.token-page .token-hero{padding:20px;background:var(--surface-1);border:1px solid var(--line);border-radius:18px;margin-bottom:0;}
.token-page .token-hero h1{font-size:clamp(1.4rem,3vw,2rem);}
.token-page>.stat-row{grid-template-columns:repeat(7,minmax(0,1fr));gap:16px;padding:18px 20px;margin:0 0 20px;background:var(--surface-1);border:1px solid var(--line);border-top:0;border-radius:0 0 18px 18px;}
.token-page>.stat-row .stat strong{font-size:clamp(1rem,1.8vw,1.35rem);white-space:nowrap;}
.token-page .token-layout{grid-template-columns:minmax(0,1fr) minmax(300px,350px);gap:20px;}
.token-page .trade-aside{grid-column:2;grid-row:1/span 2;position:static;}
.terminal-detail{grid-column:1;min-width:0;}
.terminal-chart{height:460px;width:100%;min-width:0;}
.chart-readout{min-height:20px;font-size:12px;font-variant-numeric:tabular-nums;color:var(--ink-2);}
.chart-credit{font-size:11px;color:var(--ink-3);margin-bottom:0;}
.position-panel h2{font-size:20px;margin-bottom:16px;}
.position-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px;}
.position-stat{display:grid;gap:5px;min-width:0;}
.position-stat strong{font-size:15px;overflow-wrap:anywhere;}
.position-pnl{display:flex;justify-content:space-between;flex-wrap:wrap;gap:8px;padding:14px;margin-top:18px;background:var(--surface-2);border-radius:10px;}
.position-pnl[data-dir=up] strong{color:var(--positive);}.position-pnl[data-dir=down] strong{color:var(--negative);}
@media(max-width:1100px) {.token-page>.stat-row{grid-template-columns:repeat(4,minmax(0,1fr));}.terminal-chart{height:400px;}}
@media(max-width:780px) {.token-page .token-layout{grid-template-columns:1fr;}.token-page .trade-aside{grid-column:1;grid-row:auto;order:0;}.terminal-detail{grid-column:1;}.terminal-chart{height:340px;}.token-page>.stat-row{grid-template-columns:repeat(3,minmax(0,1fr));padding:16px;}.token-page .token-hero{padding:16px;}}
@media(max-width:420px) {.token-page>.stat-row{grid-template-columns:repeat(2,minmax(0,1fr));}.terminal-chart{height:300px;}.chart-readout{font-size:11px;}}

/* Compact terminal ribbon, matching the dense two-line token headers used by trading terminals. */
main:has(.token-page){max-width:none;padding:12px 16px 64px;}
.token-terminal-bar{display:flex;align-items:center;gap:20px;min-height:80px;padding:10px 14px;margin-bottom:10px;background:var(--surface);border:1px solid var(--line);border-radius:8px;}
.terminal-identity{display:flex;align-items:center;gap:10px;flex:0 1 310px;min-width:190px;}
.terminal-identity .avatar-lg{width:46px;height:46px;border-radius:6px;flex-shrink:0;}
.terminal-identity .avatar-lg .initials{font-size:18px;}
.terminal-identity-copy{min-width:0;flex:1;}
.terminal-identity h1{display:flex;gap:8px;align-items:baseline;margin:0;font-family:var(--font-body);font-size:17px;line-height:22px;white-space:nowrap;}
.token-full-name{min-width:0;font-size:14px;font-weight:400;color:var(--ink-3);overflow:hidden;text-overflow:ellipsis;}
.terminal-byline{display:flex;align-items:center;gap:9px;overflow-x:auto;scrollbar-width:none;height:28px;color:var(--ink-3);font-size:12px;}
.terminal-byline>*{flex-shrink:0;}
.terminal-byline .chain-icon,.terminal-byline .asset-icon{width:16px;height:16px;}
.terminal-byline .icon-link,.terminal-byline .copy{display:inline-flex;align-items:center;justify-content:center;width:22px;height:24px;min-height:24px;padding:2px;border:0;background:none;border-radius:3px;color:var(--ink-3);}
.token-terminal-bar .stat-row{display:flex;align-items:center;flex:1;min-width:0;overflow-x:auto;gap:24px;margin:0;padding:0;border:0;scrollbar-width:thin;}
.token-terminal-bar .stat{display:flex;flex-direction:column;position:relative;gap:3px;flex-shrink:0;min-width:70px;padding:0;border:0;font-size:12px;}
.token-terminal-bar .stat>span{font-size:12px;color:var(--ink-3);white-space:nowrap;}
.token-terminal-bar .stat strong{font-size:16px;line-height:21px;white-space:nowrap;font-variant-numeric:tabular-nums;}
.terminal-claim{position:absolute;right:-18px;bottom:0;color:var(--primary);display:inline-flex;}
.terminal-context{position:relative;flex-shrink:0;font-size:12px;}
.terminal-context>summary{display:flex;align-items:center;gap:7px;cursor:pointer;list-style:none;padding:8px 10px;border:1px solid var(--line);border-radius:5px;background:var(--surface-2);white-space:nowrap;}
.terminal-context>summary::-webkit-details-marker{display:none;}
.terminal-context .status-dot{width:6px;height:6px;border-radius:50%;background:var(--primary);}
.terminal-context-popover{position:absolute;right:0;top:100%;margin-top:8px;width:290px;max-width:80vw;z-index:5;padding:14px;background:var(--surface-2);border:1px solid var(--line);border-radius:8px;box-shadow:0 8px 24px #0008;}
.terminal-context-popover p{font-size:12px;line-height:1.5;margin:0 0 8px;}
.terminal-context-popover strong{font-size:12px;}
.token-page .token-layout{gap:10px;grid-template-columns:minmax(0,1fr) minmax(280px,320px);}
.token-page .token-layout .panel{padding:14px;border-radius:8px;}
.token-page .price-history .chart-top{margin-bottom:6px;align-items:center;gap:6px;}
.token-page .chart-readout{margin:4px 0;font-size:11px;min-height:16px;}
.token-page .chart-top>strong{font-size:13px;}
.token-page .chart-options .btn{font-size:12px;min-height:28px;padding:0 9px;}
.token-page .chart-controls{gap:5px;}
.token-page .position-panel h2{font-size:15px;margin-bottom:12px;}
.token-page .position-grid{gap:12px;}.token-page .position-stat .meta{font-size:11px;}.token-page .position-stat strong{font-size:13px;}
.token-page .position-pnl{margin-top:12px;padding:10px;font-size:12px;}
.token-page .position-panel .small,.token-page .position-panel .hint{font-size:11px;}
@media(max-width:900px) {.token-terminal-bar{gap:12px;flex-wrap:wrap;}.terminal-identity{flex:1;}.terminal-context{margin-left:auto;}.token-terminal-bar .stat-row{order:3;flex-basis:100%;gap:22px;padding-top:8px;border-top:1px solid var(--line);}.token-page .token-layout{grid-template-columns:minmax(0,1fr) minmax(260px,290px);}}
@media(max-width:780px) {main:has(.token-page){padding:10px 10px 96px;}.token-page .token-layout{grid-template-columns:1fr;}.token-terminal-bar{padding:8px 10px;gap:8px;}.terminal-identity{min-width:0;}.terminal-identity h1{font-size:15px;}.token-full-name{max-width:160px;font-size:12px;}.terminal-identity .avatar-lg{width:40px;height:40px;}.terminal-context>summary{font-size:11px;padding:7px;}.token-terminal-bar .stat-row{gap:20px;}.token-terminal-bar .stat strong{font-size:14px;}.token-page .chart-options .btn{min-height:36px;}.terminal-byline .icon-link,.terminal-byline .copy{min-height:28px;}.token-page .terminal-chart{height:340px;}}

/* Mobile fit: constrain the layout tracks, rather than clipping the whole page. */.launch>*,.preview,.toolbar>*,.panel-head>*,.analytics-columns>*,.reward-grid>* {min-width:0;}
.token-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,280px),1fr));}
.reward-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,320px),1fr));}
.choice-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr));}
.treasury-groups{grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr));}
.token-card-head>div,.fee-row>*{min-width:0;}.token-card-head h3,.fee-row strong,.preview h3{overflow-wrap:anywhere;}
.chain-options{max-height:calc(100vh - 160px);max-height:calc(100dvh - 160px);overflow-y:auto;overscroll-behavior:contain;}
dialog{max-height:calc(100dvh - 32px);overflow-y:auto;overscroll-behavior:contain;}
@media(max-width:860px) {
 .toasts{max-width:calc(100vw - 32px);bottom:calc(80px + env(safe-area-inset-bottom));}
 .page-head,.panel-head,.analytics-section-head{flex-wrap:wrap;gap:12px;}
 .fee-row{grid-template-columns:repeat(2,minmax(0,1fr));}.fee-row>:first-child{grid-column:1/-1;}.fee-row>:last-child{grid-column:1/-1;}.fee-row>:last-child>.btn{width:100%;justify-content:center;}
}
@media(max-width:600px) {
 .chain-options{left:0;right:auto;min-width:0;width:min(320px,calc(100vw - 32px));max-width:calc(100vw - 32px);}
 input:not([type=radio]):not([type=checkbox]):not([type=file]),select,textarea{font-size:16px;max-width:100%;}
 .dialog-head,.dialog-body{padding:16px;}.dialog-head h2{font-size:20px;}.dialog-body .btn{white-space:normal;}
 .connection-row .grow{min-width:0;flex-basis:100%;}.connection-row .btn{max-width:100%;white-space:normal;}
 .analytics-controls{min-width:0;flex-wrap:wrap;}.analytics-filters{min-width:0;gap:8px;}.analytics-filters .btn{padding:6px 10px;}
 .price-ticker>span{min-width:0;flex:1 1 130px;white-space:normal;}.price-ticker strong{margin-right:4px;}
 .token-card,.panel,.step-panel{padding:16px;}.intro{padding:20px;}.intro p{font-size:16px;}
 .step-nav{flex-wrap:wrap;}.step-nav .btn{min-width:0;white-space:normal;}
 .alloc-row{grid-template-columns:minmax(0,1fr) 80px 36px;}.alloc-row>*{min-width:0;}.alloc-row .input{width:100%;}
 .terminal-context-popover{width:min(290px,calc(100vw - 40px));}.token-page .chart-readout{overflow-wrap:anywhere;}
 .analytics-metrics{grid-template-columns:repeat(2,minmax(0,1fr));}.analytics-metric{padding:14px;}.analytics-metric strong{font-size:20px;overflow-wrap:anywhere;}
}
@media(max-width:360px) {.chain-options{width:calc(100vw - 32px);}.chart-controls{width:100%;}}

/* Holder chat and trade-side controls */
.activity-head { gap: 12px; flex-wrap: wrap; }
.activity-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-block: 6px; }
.trade-side-filter { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.trade-side-filter .select { width: auto; min-width: 92px; padding-block: 7px; }
.trade-side-filter[hidden] { display: none; }
.holder-chat { display: grid; gap: 14px; padding-top: 12px; }
.chat-toolbar, .chat-compose-actions, .chat-reply { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.chat-messages { max-height: 520px; overflow-y: auto; overflow-wrap: anywhere; }
.chat-message { padding: 16px 0; border-bottom: 1px solid var(--line); }
.chat-byline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.chat-byline strong { font-size: 13px; }
.chat-byline time { color: var(--muted); font-size: 11px; }
.chat-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin-block: 10px; }
.chat-message blockquote { margin: 10px 0; padding: 8px 12px; border-left: 2px solid var(--accent); background: var(--hover); color: var(--muted); font-size: 12px; white-space: pre-wrap; }
.chat-composer { display: grid; gap: 10px; }
.chat-composer textarea { width: 100%; resize: vertical; }
.chat-reply { font-size: 12px; color: var(--muted); }
