@font-face { font-family: Archivo; src: url('assets/archivo-regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: Archivo; src: url('assets/archivo-bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('assets/plex-mono.ttf') format('truetype'); font-weight: 400; font-display: swap; }

:root {
  --cols: 12;
  --bl: 8px;
  --lh: 24px;
  --gutter: 24px;
  --margin: 48px;
  --maxw: 1280px;
  --header: 64px;
  --ink: #0b0b0d;
  --ink-2: #17181b;
  --graphite: #2a2c31;
  --slate: #646870;
  --silver: #b4b8bf;
  --mist: #dfe2e6;
  --paper: #f3f4f6;
  --pearl: #fafbfc;
  --white: #fff;
  --bg: var(--paper);
  --bg-raised: #fff;
  --control-bg: #fff;
  --fg: var(--ink);
  --fg-2: var(--graphite);
  --fg-muted: var(--slate);
  --line-rgb: 11,11,13;
  --line: rgba(11,11,13,.1);
  --line-soft: rgba(11,11,13,.06);
  --line-strong: rgba(11,11,13,.28);
  --shadow-rgb: 11,11,13;
  --header-bg: rgba(243,244,246,.82);
  --footer-bg: var(--ink);
  --footer-fg: var(--pearl);
  --footer-muted: var(--silver);
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --body: Archivo, Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/var(--lh) var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2 { font-weight: 700; letter-spacing: -.03em; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a, button, summary { -webkit-tap-highlight-color: transparent; }
a, button:not(.symbol-toy), summary { touch-action: manipulation; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 6px; }
code { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--fg-muted); }

.shell { width: min(calc(100% - var(--margin) * 2), var(--maxw)); margin-inline: auto; }
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 0 var(--gutter); }
.band { grid-column: 1 / -1; display: grid; grid-template-columns: subgrid; gap: 0 var(--gutter); align-items: start; }
.band > * { min-width: 0; }
@supports not (grid-template-columns: subgrid) { .band { grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); } }

.skip-link { position: fixed; left: 16px; top: -80px; padding: 12px 16px; background: var(--fg); color: var(--bg); z-index: 100; border-radius: 8px; }
.skip-link:focus { top: 16px; }

/* Quiet text actions */
.quiet { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; font-size: 15px; line-height: 24px; color: var(--fg); border-bottom: 1px solid rgba(var(--line-rgb),.28); padding-bottom: 2px; transition: border-color .3s, opacity .3s; }
.quiet:hover { border-color: var(--fg); }

/* Header */
.site-header { position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--header); background: var(--header-bg); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.header-band { align-items: center; height: var(--header); }
.brand { grid-column: 1 / 5; display: flex; align-items: center; min-height: 44px; gap: 12px; font-weight: 700; letter-spacing: .14em; font-size: 14px; line-height: 24px; }
.site-nav { grid-column: 5 / 13; display: flex; justify-content: flex-end; align-items: center; gap: 28px; font-size: 15px; line-height: 24px; }
.site-nav a, .site-nav button { position: relative; flex-shrink: 0; padding: 4px 0; opacity: .78; transition: opacity .3s; }
.site-nav a::after, .site-nav button::after { content: ''; position: absolute; left: 0; right: 100%; bottom: 0; height: 1px; background: currentColor; transition: right .4s var(--ease); }
.site-nav a:hover, .site-nav button:hover { opacity: 1; }
.site-nav a:hover::after, .site-nav button:hover::after { right: 0; }
.site-nav .theme-toggle { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; margin-left: 4px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; opacity: 1; color: var(--fg); background: var(--control-bg); border: 1px solid var(--line); box-shadow: 0 6px 16px rgba(var(--shadow-rgb),.08); transition: background .3s, transform .3s var(--ease); }
.site-nav .theme-toggle::after { display: none; }
.site-nav .theme-toggle:hover { transform: translateY(-1px); }
.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* Hero */
.hero { position: relative; isolation: isolate; min-height: 100dvh; display: flex; flex-direction: column; overflow: visible; touch-action: pan-y pinch-zoom; }
.hero-art { overflow: hidden; }
.hero-art { position: absolute; inset: 0; z-index: 0; pointer-events: none; transform: translateY(var(--parallax, 0px)); will-change: transform; }
.currents { position: absolute; inset: 0; width: 100%; height: 100%; }
.ripples { transform-box: fill-box; transform-origin: center; }
.hero-stage { position: relative; z-index: 1; flex: 1; display: grid; grid-template-rows: 1fr auto; align-content: center; padding: calc(var(--header) + 20px) 0 32px; }
.stage-band { align-items: center; align-self: center; }
.stage { grid-column: 4 / 10; display: flex; justify-content: center; align-items: center; overflow: visible; }

/* The toy: the parent engine transforms .symbol-motion; this stylesheet never animates it */
.symbol-toy { position: relative; width: min(100%, 52dvh, 540px); aspect-ratio: 1; display: grid; place-items: center; margin: 0 auto; background: none; border: 0; padding: 0; border-radius: 50%; touch-action: pinch-zoom; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: grab; pointer-events: auto; }
.symbol-toy:active { cursor: grabbing; }
.symbol-toy:focus-visible { outline: 2px solid var(--fg); outline-offset: 14px; border-radius: 50%; }
.symbol-toy[data-pointer-focus] { outline: none; }
.symbol-toy::before { content: ''; position: absolute; left: 50%; bottom: -1%; width: 72%; height: 9%; border-radius: 50%; background: radial-gradient(ellipse at center, rgba(var(--line-rgb),.34), rgba(var(--line-rgb),.12) 45%, rgba(var(--line-rgb),0) 72%); filter: blur(8px); transform: translate(calc(-50% + var(--toy-x, 0px) * .35), calc(var(--toy-y, 0px) * -.12)); opacity: calc(.95 - var(--toy-speed, 0) * .35); pointer-events: none; }
.symbol-motion { position: relative; z-index: 1; display: block; width: 100%; will-change: transform; isolation: isolate; }
.symbol-motion::before { content: ''; position: absolute; inset: 3%; border-radius: 50%; box-shadow: 0 26px 40px rgba(var(--shadow-rgb),.26), 0 4px 10px rgba(var(--shadow-rgb),.16); z-index: -1; pointer-events: none; }
.liquid { isolation: isolate; }
.balance-symbol { width: 100%; height: auto; display: block; position: relative; pointer-events: none; }

.fee { display: flex; flex-direction: column; gap: 0; min-height: 44px; padding: 12px 18px; margin: -12px -18px; border-radius: 22px; color: var(--fg); }
.fee-sell { grid-column: 1 / 4; justify-self: end; align-items: flex-end; text-align: right; }
.fee-buy { grid-column: 10 / 13; justify-self: start; align-items: flex-start; text-align: left; }
.fee-value { font: 400 64px/68px var(--mono); letter-spacing: -.05em; font-variant-numeric: tabular-nums; color: var(--fg); }
.fee-value span { font-size: 30px; letter-spacing: 0; margin-left: 2px; color: var(--fg-muted); }
.fee-name { font-size: 18px; line-height: 28px; color: var(--fg-2); }
.fee-sell .fee-name::before, .fee-buy .fee-name::after { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid var(--fg); vertical-align: -1px; }
.fee-sell .fee-name::before { background: var(--ink); margin-right: 10px; }
.fee-buy .fee-name::after { background: #fff; margin-left: 10px; }

.hero-foot { padding-top: 24px; row-gap: 20px; }
.hero-copy { grid-column: 3 / 11; text-align: center; }
.hero-copy h1 { font-size: 46px; line-height: 52px; }
.status { margin-top: 10px; display: flex; justify-content: center; align-items: center; gap: 8px; font: 13px/24px var(--mono); color: var(--fg-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--fg); background: var(--control-bg); }
.status[data-status="live"] .status-dot { background: var(--fg); box-shadow: 0 0 0 3px rgba(var(--shadow-rgb),.08); }
.status[data-status="unavailable"] .status-dot { border-style: dashed; }
.hero-actions { grid-column: 1 / -1; display: flex; justify-content: center; align-items: center; gap: 16px; flex-wrap: wrap; }
.scroll-down { width: 52px; height: 52px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--fg); background: var(--control-bg); border: 1px solid rgba(var(--line-rgb),.12); box-shadow: 0 12px 28px rgba(var(--shadow-rgb),.12); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.scroll-down:hover { transform: translateY(3px); box-shadow: 0 16px 32px rgba(var(--shadow-rgb),.18); }
.trade-cta { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 22px; border-radius: 999px; font-size: 16px; line-height: 24px; font-weight: 700; color: var(--bg); background: var(--fg); box-shadow: 0 14px 30px rgba(var(--shadow-rgb),.18); transition: transform .35s var(--ease), box-shadow .35s var(--ease), opacity .3s; cursor: pointer; }
.trade-cta:hover { transform: translateY(-2px); box-shadow: 0 18px 36px rgba(var(--shadow-rgb),.24); }
.trade-cta[role="button"] { opacity: .85; }
.trade-cta svg { transition: transform .3s var(--ease); }
.trade-cta:hover svg { transform: translateX(3px); }

/* Trade */
.trade { padding: 96px 0 104px; scroll-margin-top: var(--header); }
.trade-band > * { grid-column: 2 / 12; }
.trade h2 { font-size: 54px; line-height: 60px; text-align: center; }
.sides { position: relative; margin-top: 44px; display: grid; grid-template-columns: 1fr 1fr; border-radius: 36px; overflow: hidden; box-shadow: 0 40px 80px rgba(var(--shadow-rgb),.14), 0 4px 12px rgba(var(--shadow-rgb),.06); }
.seam { position: absolute; top: 0; bottom: 0; left: calc(50% - 60px); width: 120px; height: 100%; pointer-events: none; z-index: 3; }
.seam-pearl { fill: var(--pearl); }
.seam-ink { fill: var(--ink); }
.side { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 8px; min-height: 360px; transition: background-color .4s; }
.side-yin { color: var(--pearl); background: var(--ink); padding: 52px 96px 52px 56px; }
.side-yang { color: var(--ink); background: var(--pearl); padding: 52px 56px 52px 104px; }
.side-yin:hover { background: var(--ink-2); }
.side-yang:hover { background: #fff; }
.route { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.coin { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; background: #fff; border: 1px solid rgba(var(--line-rgb),.12); box-shadow: 0 6px 14px rgba(0,0,0,.18); }
.coin img[src$="mark.svg"] { width: 40px; height: 40px; }
.side-title { font-size: 32px; line-height: 38px; font-weight: 700; letter-spacing: -.02em; }
.side-fee { font: 18px/28px var(--mono); opacity: .85; }
.side-fee span { font-variant-numeric: tabular-nums; }
.side-cta { margin-top: auto; padding-top: 28px; display: inline-flex; align-items: center; gap: 10px; font-size: 16px; line-height: 24px; }
.side-cta svg { transition: transform .3s var(--ease); }
.side:hover .side-cta svg { transform: translate(2px, -2px); }
.side[role="button"] .side-cta { opacity: .55; }
.pool-row { margin-top: 36px; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 36px; }
.address code { white-space: nowrap; }
.copy-state { font-size: 13px; color: var(--fg-muted); }
.copy-state:empty { display: none; }

/* Story */
.story { position: relative; padding: 96px 0 104px; overflow: hidden; scroll-margin-top: var(--header); }
.story-current { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.story .shell { position: relative; }
.story-copy { grid-column: 1 / 7; display: flex; flex-direction: column; gap: 18px; font-size: 18px; line-height: 28px; }
.story-copy h2 { font-size: 54px; line-height: 60px; margin-bottom: 6px; }
.story-copy p { color: var(--fg-2); max-width: 520px; }
.story-copy .quiet { align-self: flex-start; margin-top: 8px; }
.fee-details { grid-column: 8 / 13; margin-top: 84px; border-radius: 28px; padding: 8px 28px 20px; background: var(--bg-raised); border: 1px solid rgba(var(--line-rgb),.08); box-shadow: 0 30px 60px rgba(var(--shadow-rgb),.1); }
.fee-details summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 16px 0; font-size: 18px; line-height: 24px; }
.fee-details summary::-webkit-details-marker { display: none; }
.fee-details summary svg { transition: transform .4s var(--ease); }
.fee-details[open] summary svg { transform: rotate(45deg); }
.fee-details dl > div { display: grid; grid-template-columns: 104px 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid rgba(var(--line-rgb),.08); font-size: 15px; line-height: 24px; }
.fee-details dd { color: var(--fg-muted); }

/* History */
.history { padding: 96px 0 120px; scroll-margin-top: var(--header); }
.history-head { align-items: end; }
.history-head h2 { grid-column: 1 / 7; font-size: 54px; line-height: 60px; }
.ranges { grid-column: 7 / 13; justify-self: end; display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-raised); border: 1px solid rgba(var(--line-rgb),.08); }
.ranges button { font: 13px/24px var(--mono); padding: 6px 14px; border-radius: 999px; color: var(--fg-muted); transition: background .3s, color .3s; }
.ranges button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }
.history-body { margin-top: 32px; }
.history-body > * { grid-column: 1 / -1; }
.surface { border-radius: 36px; padding: 28px 32px 24px; background: var(--bg-raised); border: 1px solid rgba(var(--line-rgb),.06); box-shadow: 0 34px 70px rgba(var(--shadow-rgb),.1); }
.legend { display: flex; gap: 24px; font-size: 14px; line-height: 24px; color: var(--fg-muted); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { width: 22px; border-top: 2px solid var(--fg); }
.legend .line-buy { border-top-style: dashed; }
.chart { margin-top: 12px; }
#history-chart { width: 100%; height: 300px; }
#history-chart text { font: 12px var(--mono); fill: var(--fg-muted); }
#history-chart .axis { stroke: rgba(var(--line-rgb),.12); }
#history-chart .series-sell { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; }
#history-chart .series-buy { fill: none; stroke: var(--fg); stroke-width: 1.6; stroke-dasharray: 6 6; stroke-linejoin: round; }
#history-chart .hairline { stroke: var(--fg); stroke-width: 1; opacity: .5; }
#history-chart .empty { font-size: 30px; fill: var(--fg-muted); }
#chart-caption { margin-top: 12px; font: 13px/24px var(--mono); color: var(--fg-muted); min-height: 24px; }

/* Footer */
.site-footer { padding: 56px 0 48px; background: var(--footer-bg); color: var(--footer-fg); border-radius: 48px 48px 0 0; }
.footer-band { align-items: center; }
.footer-band .brand { grid-column: 1 / 5; font-size: 13px; }
.footer-band p { grid-column: 5 / 13; text-align: right; font-size: 15px; color: var(--footer-muted); }

/* Dialog */
dialog { padding: 40px; width: min(560px, calc(100% - 32px)); max-height: calc(100dvh - 48px); border: 1px solid rgba(var(--line-rgb),.08); border-radius: 32px; background: var(--bg-raised); color: var(--fg); box-shadow: 0 40px 90px rgba(0,0,0,.35); }
dialog::backdrop { background: rgba(var(--line-rgb),.5); backdrop-filter: blur(8px); }
.dialog-close { position: absolute; right: 16px; top: 16px; width: 44px; height: 44px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(var(--line-rgb),.06); }
dialog h2 { font-size: 36px; line-height: 44px; }
.contract-list { margin-top: 24px; }
.contract-list > div { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 12px 0; border-top: 1px solid rgba(var(--line-rgb),.1); font-size: 15px; line-height: 24px; }
.contract-list dd { display: flex; align-items: center; gap: 8px; min-width: 0; }
.contract-list code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.explorer { display: inline-flex; flex-shrink: 0; }
dialog > .muted { margin-top: 24px; font-size: 15px; }

/* Dark theme: surfaces and text change, Yin black and Yang pearl identities do not */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101114;
  --bg-raised: #17181b;
  --control-bg: #1d1f23;
  --fg: #eef0f3;
  --fg-2: #c9cdd3;
  --fg-muted: #8b9098;
  --line-rgb: 255,255,255;
  --line: rgba(255,255,255,.1);
  --line-soft: rgba(255,255,255,.07);
  --line-strong: rgba(255,255,255,.34);
  --shadow-rgb: 0,0,0;
  --header-bg: rgba(16,17,20,.78);
  --footer-bg: #17181b;
  --footer-fg: #eef0f3;
  --footer-muted: #8b9098;
}
html[data-theme="dark"] .currents .current { opacity: .55; }
html[data-theme="dark"] .currents #current-ink stop, html[data-theme="dark"] .currents #current-ink-2 stop { stop-color: #ffffff; }
html[data-theme="dark"] .currents ellipse { opacity: .14; }
html[data-theme="dark"] .ripples { stroke: #ffffff; }
html[data-theme="dark"] .symbol-motion::before { box-shadow: 0 30px 52px rgba(0,0,0,.65), 0 4px 12px rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.05); }
html[data-theme="dark"] .symbol-toy::before { background: radial-gradient(ellipse at center, rgba(0,0,0,.6), rgba(0,0,0,.25) 45%, rgba(0,0,0,0) 72%); }
html[data-theme="dark"] #rim stop:nth-child(2) { stop-color: #cfd4db; stop-opacity: .75; }
html[data-theme="dark"] .sides { border: 1px solid var(--line); box-shadow: 0 40px 80px rgba(0,0,0,.55), 0 4px 12px rgba(0,0,0,.3); }
html[data-theme="dark"] .side-yin { background: #0b0b0d; }
html[data-theme="dark"] .side-yin:hover { background: #131417; }
html[data-theme="dark"] .side-yin .coin { border-color: rgba(255,255,255,.2); }
html[data-theme="dark"] .dialog-close { background: rgba(255,255,255,.08); }
html[data-theme="dark"] dialog::backdrop { background: rgba(0,0,0,.6); }
html[data-theme="dark"] #history-chart .marker { stroke: var(--fg); }
html[data-theme="dark"] .site-footer { border-top: 1px solid var(--line); }

/* Trade page */
.trade-page { min-height: 100dvh; display: flex; flex-direction: column; }
.trade-page .site-nav a { display: inline-flex; align-items: center; gap: 6px; }
.trade-page main { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: calc(var(--header) + 40px) 0 56px; }
.trade-root { width: min(100%, 480px); margin: 0 auto; }
.trade-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 0 8px 16px; }
.trade-head h1 { font-size: 34px; line-height: 40px; }
.trade-network { font: 13px/24px var(--mono); color: var(--fg-muted); display: inline-flex; align-items: center; gap: 8px; }
.trade-network::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--fg-muted); }
.trade-surface { border-radius: 32px; padding: 20px; background: var(--bg-raised); border: 1px solid var(--line-soft); box-shadow: 0 34px 70px rgba(var(--shadow-rgb),.12), 0 4px 12px rgba(var(--shadow-rgb),.05); }
.trade-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.connect { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; font-size: 15px; line-height: 24px; color: var(--fg); background: var(--control-bg); border: 1px solid var(--line); transition: border-color .3s, transform .3s var(--ease); }
.connect:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.connect.is-connected { font-family: var(--mono); font-size: 13px; }
.sides-toggle { flex: 1 1 auto; max-width: 240px; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; background: var(--control-bg); border: 1px solid var(--line); }
.sides-toggle button { min-height: 44px; padding: 0 18px; border-radius: 999px; font-size: 15px; line-height: 24px; font-weight: 700; color: var(--fg-muted); transition: background .3s, color .3s; }
.sides-toggle button[data-trade-side="buy"][aria-pressed="true"] { background: var(--pearl); color: var(--ink); box-shadow: 0 6px 16px rgba(var(--shadow-rgb),.14); }
.sides-toggle button[data-trade-side="sell"][aria-pressed="true"] { background: var(--ink); color: var(--pearl); box-shadow: 0 6px 16px rgba(var(--shadow-rgb),.2); }
.amount-box { margin-top: 12px; padding: 16px 18px; border-radius: 24px; background: var(--bg); border: 1px solid var(--line-soft); }
.amount-box + .amount-box { margin-top: 8px; }
.amount-box label, .amount-box .box-label { display: flex; justify-content: space-between; align-items: center; font-size: 13px; line-height: 20px; color: var(--fg-muted); }
.amount-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.amount-row input { width: 100%; min-width: 0; min-height: 44px; padding: 0; background: transparent; border: 0; color: var(--fg); font: 400 34px/44px var(--mono); letter-spacing: -.03em; outline: none; }
.amount-row input::placeholder { color: var(--fg-muted); opacity: .6; }
.amount-row input:focus-visible { box-shadow: 0 2px 0 var(--fg); }
.amount-out { font: 400 34px/44px var(--mono); letter-spacing: -.03em; color: var(--fg); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.amount-out.is-pending { opacity: .5; }
.token { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--control-bg); border: 1px solid var(--line); font-size: 14px; line-height: 24px; font-weight: 700; }
.token .coin { width: 28px; height: 28px; }
.token .coin img[src$="mark.svg"] { width: 28px; height: 28px; }
.token .coin img[src$="eth.svg"] { width: 10px; height: 16px; }
.box-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; line-height: 20px; color: var(--fg-muted); }
.balance-line { display: inline-flex; align-items: center; gap: 8px; font: 13px/20px var(--mono); color: var(--fg-muted); }
.max { min-height: 44px; min-width: 44px; margin: -12px 0 -12px 2px; padding: 0 12px; border-radius: 999px; font: 700 13px/20px var(--body); color: var(--fg); background: var(--control-bg); border: 1px solid var(--line); transition: border-color .3s, transform .3s var(--ease); }
.max:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.trade-summary { margin: 16px 6px 0; display: grid; gap: 4px; font-size: 14px; line-height: 24px; color: var(--fg-muted); }
.trade-summary > div { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.trade-summary span:last-child, .trade-summary output { font-family: var(--mono); color: var(--fg); }
.select-wrap { position: relative; display: inline-flex; color: var(--fg); }
.select-wrap::after { content: ''; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.trade-summary select { appearance: none; -webkit-appearance: none; font: 14px/24px var(--mono); color: var(--fg); background: var(--control-bg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 32px 6px 14px; min-height: 44px; cursor: pointer; }
.trade-summary select:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.custom-field { display: inline-flex; align-items: center; gap: 6px; }
.custom-field input { width: 92px; min-height: 44px; padding: 4px 12px; border-radius: 999px; font: 14px/24px var(--mono); color: var(--fg); background: var(--control-bg); border: 1px solid var(--line); text-align: right; -moz-appearance: textfield; }
.custom-field input::-webkit-outer-spin-button, .custom-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.custom-field input:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.custom-field .unit { font: 14px/24px var(--mono); color: var(--fg-muted); }
.submit { margin-top: 16px; width: 100%; min-height: 52px; border-radius: 999px; font-size: 16px; line-height: 24px; font-weight: 700; color: var(--bg); background: var(--fg); transition: opacity .3s, transform .3s var(--ease); }
.submit:hover:not([disabled]) { transform: translateY(-1px); }
.submit[disabled] { opacity: .45; cursor: not-allowed; }
.submit.is-busy { opacity: .7; cursor: progress; }
.trade-status { margin-top: 12px; min-height: 24px; font-size: 14px; line-height: 24px; color: var(--fg-muted); text-align: center; }
.trade-status.is-error { color: var(--fg); }
.trade-status:empty { display: none; }
.trade-links { margin-top: 12px; display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; font-size: 14px; }
.trade-foot { margin-top: 20px; text-align: center; font-size: 14px; line-height: 24px; color: var(--fg-muted); }
.trade-foot .quiet { margin-left: 12px; min-height: 44px; font-size: 14px; }
@media (max-width: 520px) {
  .trade-page main { padding-top: calc(var(--header) + 20px); }
  .trade-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .trade-top { flex-wrap: wrap; }
  .sides-toggle { max-width: none; }
  .trade-head h1 { font-size: 28px; line-height: 34px; }
  .trade-surface { padding: 14px; border-radius: 26px; }
  .amount-row input, .amount-out { font-size: 28px; line-height: 36px; }
}

/* Trade workspace: live symbol beside the form */
.trade-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 480px; gap: 48px; align-items: center; width: min(100%, 1040px); margin: 0 auto; }
.trade-workspace .trade-root { margin: 0; width: 100%; }
.trade-scene { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.scene-stage { width: 100%; display: flex; justify-content: center; }
.trade-scene .symbol-toy { width: min(100%, 42dvh, 400px); }
.scene-fees { display: flex; justify-content: center; align-items: flex-start; gap: 28px; }
.trade-scene .fee { margin: 0; padding: 8px 16px; min-width: 120px; align-items: center; text-align: center; }
.trade-scene .fee-value { font-size: 40px; line-height: 44px; }
.trade-scene .fee-value span { font-size: 20px; }
.trade-scene .fee-name { font-size: 15px; line-height: 24px; }
.scene-status { margin-top: 0; }
.fee-change { font: 14px/24px var(--mono); color: var(--fg-2); }
.fee-change:empty { display: none; }
@media (max-width: 1100px) {
  .trade-workspace { grid-template-columns: minmax(0, 1fr) 440px; gap: 32px; }
}
@media (max-width: 900px) {
  .trade-page main { padding-top: var(--header); justify-content: flex-start; }
  .trade-workspace { display: block; width: min(100%, 480px); }
  .trade-scene { position: sticky; top: var(--header); z-index: 5; display: grid; grid-template-columns: 96px 1fr; grid-template-rows: auto auto; column-gap: 16px; row-gap: 0; align-items: center; text-align: left; padding: 12px 0 10px; margin: 0 calc(-1 * var(--margin)); padding-inline: var(--margin); background: var(--bg); border-bottom: 1px solid var(--line-soft); }
  .scene-stage { grid-row: 1 / 3; }
  .trade-scene .symbol-toy { width: 96px; }
  .trade-scene .symbol-toy::before { display: none; }
  .trade-scene .symbol-motion::before { box-shadow: 0 10px 18px rgba(var(--shadow-rgb),.24); }
  .scene-fees { justify-content: flex-start; gap: 8px; }
  .trade-scene .fee { min-width: 0; min-height: 44px; padding: 4px 10px; align-items: flex-start; text-align: left; border-radius: 14px; }
  .trade-scene .fee-value { font-size: 22px; line-height: 26px; }
  .trade-scene .fee-value span { font-size: 13px; }
  .trade-scene .fee-name { font-size: 12px; line-height: 16px; }
  .trade-scene .fee-sell .fee-name::before, .trade-scene .fee-buy .fee-name::after { width: 8px; height: 8px; }
  .scene-status { justify-content: flex-start; margin-top: 2px; font-size: 12px; line-height: 20px; }
  .fee-change { grid-column: 2; font-size: 12px; line-height: 20px; }
  .trade-workspace .trade-head { padding-top: 20px; }
}
@media (max-width: 520px) {
  .trade-scene { grid-template-columns: 84px 1fr; column-gap: 12px; }
  .trade-scene .symbol-toy { width: 84px; }
  .trade-scene .confirmation-ripple { width: 84px; }
  .trade-scene .fee { padding: 4px 8px; }
  .trade-scene .fee-value { font-size: 20px; line-height: 24px; }
}

/* Trade workspace: pool composition, fee breakdown, recent trades, confirmation */
.trade-workspace { grid-template-rows: auto auto; }
.trade-workspace .trade-scene { grid-column: 1; grid-row: 1; }
.trade-workspace .trade-root { grid-column: 2; grid-row: 1 / 3; }
.pool-panel { grid-column: 1; grid-row: 2; align-self: start; width: min(100%, 420px); margin: 8px auto 0; padding: 20px 22px 18px; border-radius: 24px; background: var(--bg-raised); border: 1px solid var(--line-soft); box-shadow: 0 20px 44px rgba(var(--shadow-rgb),.08); }
.pool-panel h2 { font-size: 18px; line-height: 24px; letter-spacing: -.01em; }
.pool-composition { margin-top: 14px; height: 10px; border-radius: 999px; background: var(--pearl); border: 1px solid var(--line); overflow: hidden; }
.pool-eth-bar { display: block; height: 100%; width: calc(var(--eth-share, 50) * 1%); background: var(--ink); border-radius: 999px 0 0 999px; transition: width .6s var(--ease); }
.pool-amounts { margin-top: 12px; display: grid; gap: 6px; }
.pool-amount { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; line-height: 20px; }
.pool-amount .coin { width: 28px; height: 28px; flex-shrink: 0; }
.pool-amount .coin img[src$="mark.svg"] { width: 28px; height: 28px; }
.pool-amount .coin img[src$="eth.svg"] { width: 10px; height: 16px; }
.pool-figure { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; overflow: hidden; }
.pool-figure strong { font: 400 16px/24px var(--mono); color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-unit { font-size: 12px; color: var(--fg-muted); }
.pool-share { font: 13px/20px var(--mono); color: var(--fg-muted); flex-shrink: 0; }
.pool-amount-eth .pool-share::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); border: 1px solid var(--fg); margin-right: 8px; vertical-align: 0; }
.pool-amount-token .pool-share::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--pearl); border: 1px solid var(--fg); margin-right: 8px; vertical-align: 0; }
.pool-note { margin-top: 8px; font-size: 13px; line-height: 20px; color: var(--fg-muted); }
.pool-note:empty { display: none; }

.fee-breakdown { margin: 10px 6px 0; border-top: 1px solid var(--line-soft); }
.fee-breakdown summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 44px; font-size: 14px; line-height: 24px; color: var(--fg-muted); }
.fee-breakdown summary::-webkit-details-marker { display: none; }
.fee-breakdown summary svg { transition: transform .4s var(--ease); }
.fee-breakdown[open] summary { color: var(--fg); }
.fee-breakdown[open] summary svg { transform: rotate(45deg); }
.breakdown-rows { margin: 0 0 8px; }

.pool-trades { width: min(100%, 1040px); margin: 56px auto 0; }
.pool-trades-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; padding: 0 8px 12px; }
.pool-trades h2 { font-size: 28px; line-height: 36px; }
.trades-status { font: 13px/24px var(--mono); color: var(--fg-muted); }
.trades-status:empty { display: none; }
.trades-empty { padding: 20px 8px; font-size: 15px; line-height: 24px; color: var(--fg-muted); }
.trades-empty[hidden] { display: none; }
.trade-history { display: grid; gap: 8px; }
.trade-history:empty { display: none; }
.pool-trade { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 14px; min-height: 60px; padding: 10px 10px 10px 16px; border-radius: 20px; background: var(--bg-raised); border: 1px solid var(--line-soft); }
.pool-trade-side { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; min-height: 32px; padding: 4px 12px; border-radius: 999px; font-size: 13px; line-height: 24px; font-weight: 700; }
.pool-trade-side.is-buy, .pool-trade[data-side="buy"] .pool-trade-side { background: var(--pearl); color: var(--ink); border: 1px solid var(--line); }
.pool-trade-side.is-sell, .pool-trade[data-side="sell"] .pool-trade-side { background: var(--ink); color: var(--pearl); border: 1px solid var(--ink); }
.pool-trade-amounts { font: 14px/22px var(--mono); color: var(--fg); min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.pool-trade-time { font: 13px/20px var(--mono); color: var(--fg-muted); white-space: nowrap; }
.pool-trade-link { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; color: var(--fg); background: var(--control-bg); border: 1px solid var(--line); transition: transform .3s var(--ease), border-color .3s; }
.pool-trade-link:hover { transform: translateY(-1px); border-color: var(--line-strong); }

/* Confirmed swap: pressed button, silver edge, ripples outside the fixed disc */
.scene-stage { position: relative; }
.trade-scene .symbol-toy { position: relative; z-index: 1; }
.confirmation-ripple { position: absolute; left: 50%; top: 50%; width: min(100%, 42dvh, 400px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; opacity: 0; z-index: 0; }
.confirmation-ripple::before, .confirmation-ripple::after { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid var(--silver); opacity: 0; }
.trade-scene.trade-success .confirmation-ripple { opacity: 1; }
.trade-scene.trade-success .confirmation-ripple::before { animation: ripple-out 1.4s var(--ease) both; }
.trade-scene.trade-success .confirmation-ripple::after { animation: ripple-out 1.4s .25s var(--ease) both; }
@keyframes ripple-out { 0% { transform: scale(1); opacity: 0; } 12% { opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.trade-root.trade-success .submit { animation: press-release .55s var(--ease) both; }
@keyframes press-release { 0% { transform: scale(1); } 35% { transform: scale(.965); } 100% { transform: scale(1); } }
.trade-root.trade-success .trade-surface { animation: edge-pulse 1.3s var(--ease) both; }
@keyframes edge-pulse { 0% { box-shadow: 0 34px 70px rgba(var(--shadow-rgb),.12), 0 0 0 0 rgba(180,184,191,0); } 25% { box-shadow: 0 34px 70px rgba(var(--shadow-rgb),.12), 0 0 0 3px rgba(180,184,191,.9); } 100% { box-shadow: 0 34px 70px rgba(var(--shadow-rgb),.12), 0 0 0 10px rgba(180,184,191,0); } }
@media (prefers-reduced-motion: reduce) {
  .trade-scene.trade-success .confirmation-ripple::before, .trade-scene.trade-success .confirmation-ripple::after { animation: none !important; opacity: .9; transform: scale(1.08); }
  .trade-root.trade-success .submit { animation: none !important; }
  .trade-root.trade-success .trade-surface { animation: none !important; box-shadow: 0 34px 70px rgba(var(--shadow-rgb),.12), 0 0 0 3px rgba(180,184,191,.9); }
}
@media (max-width: 900px) {
  .trade-workspace .trade-scene, .trade-workspace .trade-root, .pool-panel { grid-column: auto; grid-row: auto; }
  .pool-panel { width: 100%; margin-top: 20px; }
  .confirmation-ripple { width: 96px; }
  .pool-trades { margin-top: 40px; }
  .pool-trade { grid-template-columns: auto 1fr auto; gap: 10px 12px; padding: 10px 10px 10px 12px; }
  .pool-trade-time { grid-column: 2; grid-row: 2; }
  .pool-trade-link { grid-column: 3; grid-row: 1 / 3; }
}

/* Responsive */
@media (max-width: 1100px) {
  :root { --margin: 32px; --gutter: 16px; }
  .fee-value { font-size: 50px; line-height: 56px; }
  .fee-value span { font-size: 24px; }
  .symbol-toy { width: min(100%, 48dvh, 480px); }
  .trade-band > * { grid-column: 1 / -1; }
  .side-yin { padding: 44px 80px 44px 40px; }
  .side-yang { padding: 44px 40px 44px 88px; }
  .story-copy { grid-column: 1 / 8; }
  .fee-details { grid-column: 8 / 13; margin-top: 72px; padding-inline: 20px; }
}

@media (max-width: 800px) {
  :root { --cols: 6; --margin: 24px; }
  .brand { grid-column: 1 / 3; font-size: 12px; letter-spacing: .12em; }
  .site-nav { grid-column: 3 / 7; gap: 18px; font-size: 14px; }
  .hero-stage { padding: calc(var(--header) + 12px) 0 20px; }
  .stage { grid-column: 1 / -1; order: -1; }
  .symbol-toy { width: min(100%, 40dvh, 360px); }
  .fee { margin-top: 8px; padding: 10px 14px; margin-inline: -14px; margin-bottom: -10px; }
  .fee-sell { grid-column: 1 / 4; justify-self: start; align-items: flex-start; text-align: left; }
  .fee-buy { grid-column: 4 / 7; justify-self: end; align-items: flex-end; text-align: right; }
  .fee-value { font-size: 40px; line-height: 44px; }
  .fee-value span { font-size: 20px; }
  .fee-name { font-size: 15px; line-height: 24px; }
  .hero-foot { padding-top: 20px; row-gap: 14px; }
  .hero-copy { grid-column: 1 / -1; }
  .hero-copy h1 { font-size: 32px; line-height: 38px; }
  .status { margin-top: 6px; }
  .hero-actions { gap: 10px; }
  .scroll-down { width: 48px; height: 48px; }
  .trade { padding: 72px 0; }
  .trade h2, .story-copy h2, .history-head h2 { font-size: 38px; line-height: 44px; }
  .sides { margin-top: 32px; grid-template-columns: 1fr; border-radius: 28px; }
  .seam { display: none; }
  .side { min-height: 0; }
  .side-yin, .side-yang { padding: 32px 28px; }
  .story { padding: 72px 0; }
  .story-copy { grid-column: 1 / -1; font-size: 17px; line-height: 26px; }
  .fee-details { grid-column: 1 / -1; margin-top: 32px; }
  .history { padding: 72px 0 96px; }
  .history-head h2 { grid-column: 1 / -1; }
  .ranges { grid-column: 1 / -1; justify-self: start; margin-top: 16px; }
  .surface { padding: 20px 18px 16px; border-radius: 28px; }
  #history-chart { height: 240px; }
  .site-footer { border-radius: 32px 32px 0 0; }
  .footer-band .brand { grid-column: 1 / 4; }
  .footer-band p { grid-column: 1 / -1; text-align: left; margin-top: 16px; }
  dialog { padding: 32px 24px; border-radius: 24px; }
  dialog h2 { font-size: 30px; line-height: 36px; }
  .contract-list > div { grid-template-columns: 80px 1fr; }
}

@media (max-width: 520px) {
  :root { --margin: 18px; --gutter: 12px; }
  .brand span { display: none; }
  .site-nav { gap: 8px; font-size: 12px; }
  .site-nav .theme-toggle { margin-left: 2px; }
  .symbol-toy { width: min(100%, 38dvh, 320px); }
  .fee-value { font-size: 34px; line-height: 38px; }
  .fee-value span { font-size: 17px; }
  .hero-copy h1 { font-size: 28px; line-height: 34px; }
  .pool-row { gap: 10px 24px; }
  .fee-details dl > div { grid-template-columns: 1fr; gap: 2px; }
}

/* Ambient motion: surround only, never the toy transform or the symbol geometry */
@media (prefers-reduced-motion: no-preference) {
  .ripples { animation: ripple 12s ease-in-out infinite; }
  @keyframes ripple { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
  .current-a { animation: drift-a 26s ease-in-out infinite alternate; }
  .current-b { animation: drift-b 30s ease-in-out infinite alternate; }
  @keyframes drift-a { from { transform: translate(0, 0); } to { transform: translate(24px, 14px); } }
  @keyframes drift-b { from { transform: translate(0, 0); } to { transform: translate(-22px, -16px); } }
  .scroll-down { animation: bob 2.8s ease-in-out infinite; }
  @keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(5px); } }
  .scroll-down:hover { animation: none; }
  .hero-stage { animation: appear 1s var(--ease) both; }
  @keyframes appear { from { opacity: 0; } to { opacity: 1; } }
  [data-reveal] { transform: translateY(24px); transition: transform 1s var(--ease); }
  [data-reveal].is-visible { transform: none; }
}
[data-scene-visible="false"] .ripples, [data-scene-visible="false"] .current-a, [data-scene-visible="false"] .current-b, [data-scene-visible="false"] .scroll-down { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *:not(.symbol-motion), *::before, *::after { animation: none !important; transition: none !important; }
  .hero-art { transform: none !important; }
}
