/* Elpida design system v2: floating panels, hairline borders, pill controls, one accent family.
   Loaded after styles.css. Tokens first; legacy token names are remapped so every existing view
   adopts the new palette, then shared recipes, then the app shell (dock, top bar, footer, tab bar).
   Fonts: Geist and Geist Mono (SIL OFL, assets/fonts/GEIST-OFL.txt). */
@font-face { font-family: 'Geist'; src: url('/assets/fonts/geist-variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url('/assets/fonts/geist-mono-variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }

:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #08090b;
  --panel: #151517;
  --panel-2: #1e1e21;
  --panel-3: #2a2a2e;
  --panel-hi: #1d1d1f;          /* card gradient start */
  --panel-lo: #0e0f11;          /* card gradient end */
  --dock-bg: linear-gradient(155deg, #252525, #111113 78%);
  --topbar-bg: linear-gradient(rgba(38, 38, 39, .91), rgba(23, 23, 25, .91));
  --ink: #f2f1ed;
  --ink-2: #c9c8c2;
  --muted: #929298;
  --line: rgba(255, 255, 255, .13);
  --line-soft: rgba(255, 255, 255, .086);
  --line-faint: rgba(255, 255, 255, .06);
  --line-strong: rgba(255, 255, 255, .22);
  --hover: rgba(255, 255, 255, .04);
  --highlight: rgba(255, 255, 255, .035);
  --up: #76ed9a;   --up-soft: rgba(118, 237, 154, .1);
  --down: #ffa1a1; --down-bg: rgba(51, 23, 25, .93); --down-line: rgba(228, 130, 130, .2);
  --age: #c9d9b0;
  /* Accent: Elpida's green-lime. Change this one family to retint the whole app. */
  --accent: #adff45;
  --accent-hi: #d4ff8a;
  --accent-lo: #7fcc1f;
  --accent-line: rgba(196, 255, 120, .55);
  --accent-ink: #0b1406;
  --accent-text: #b8ff5c;
  --accent-tint: rgba(173, 255, 69, .1);
  --accent-glow: rgba(173, 255, 69, .09);
  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, .016);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, .55);
  --font-sans: 'Geist', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --r-pill: 999px; --r-card: 20px; --r-card-lg: 24px; --r-section: 26px; --r-tile: 18px; --r-input: 12px; --r-chip: 10px;
  --dock-w: 80px;

  /* Legacy names used by styles.css and the views. */
  --paper: var(--bg);
  --surface: var(--panel);
  --surface-1: var(--panel);
  --surface-2: var(--panel-2);
  --surface-3: var(--panel-3);
  --ink-3: var(--muted);
  --primary: var(--accent);
  --primary-hover: var(--accent-hi);
  --primary-ink: var(--accent-ink);
  --primary-soft: var(--accent-tint);
  --positive: var(--up);
  --positive-soft: var(--up-soft);
  --negative: var(--down);
  --negative-soft: var(--down-bg);
  --dawn: var(--accent);
  --dawn-ink: var(--accent-text);
  --dawn-soft: var(--accent-tint);
  --focus: var(--accent);
  --scrim: rgba(4, 5, 6, .66);
  --font-display: var(--font-sans);
  --font-body: var(--font-sans);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 24px;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fa;
  --panel: #ffffff;
  --panel-2: #eef0f5;
  --panel-3: #e2e5ed;
  --panel-hi: #ffffff;
  --panel-lo: #f6f7fb;
  --dock-bg: linear-gradient(155deg, #ffffff, #eff1f6 78%);
  --topbar-bg: linear-gradient(rgba(255, 255, 255, .92), rgba(248, 249, 252, .92));
  --ink: #161a24;
  --ink-2: #373d4d;
  --muted: #5d6475;
  --line: rgba(22, 26, 40, .12);
  --line-soft: rgba(22, 26, 40, .09);
  --line-faint: rgba(22, 26, 40, .06);
  --line-strong: rgba(22, 26, 40, .22);
  --hover: rgba(22, 26, 40, .045);
  --highlight: rgba(255, 255, 255, .8);
  --up: #18884a;   --up-soft: rgba(24, 136, 74, .1);
  --down: #c2413b; --down-bg: rgba(194, 65, 59, .09); --down-line: rgba(194, 65, 59, .22);
  --age: #6b7186;
  --accent: #5b5bd6; --accent-hi: #7b7bea; --accent-lo: #4545bd; --accent-ink: #ffffff;
  --accent-text: #4338ca;
  --accent-tint: rgba(91, 91, 214, .1);
  --accent-glow: rgba(91, 91, 214, .15);
  --accent-line: rgba(91, 91, 214, .5);
  --shadow-card: 0 1px 2px rgba(16, 20, 40, .04), 0 10px 28px rgba(16, 20, 40, .05);
  --shadow-pop: 0 18px 50px rgba(16, 20, 40, .16);
  --primary: var(--accent-text);
  --scrim: rgba(16, 20, 32, .34);
}

/* ---------- Base ---------- */
html { background: var(--bg); }
body { background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 14px; letter-spacing: -.005em; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--font-sans); letter-spacing: -.02em; }
h1 { font-weight: 650; letter-spacing: -.035em; }
a { color: var(--accent-text); }
::selection { background: var(--accent-tint); }
.icon-xs { width: 12px; height: 12px; }
.mono, code, kbd { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[data-theme="light"] :focus-visible { outline-color: var(--accent-text); }

/* ---------- Recipes ---------- */
.btn-accent, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(var(--accent-hi), var(--accent) 60%, var(--accent-lo));
  border: .67px solid var(--accent-line); color: var(--accent-ink); border-radius: var(--r-pill);
  font-weight: 650; text-decoration: none; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 7px 20px var(--accent-glow);
  transition: filter var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.btn-accent { min-height: 44px; padding: 0 18px; font-size: 13px; }
.btn-accent-sm { min-height: 38px; padding: 0 15px; font-size: 12.5px; }
.btn-accent:not(:disabled):hover, .btn-primary:not(:disabled):hover { filter: brightness(1.05); background: linear-gradient(var(--accent-hi), var(--accent) 60%, var(--accent-lo)); }
.btn-accent:active, .btn-primary:active { transform: translateY(1px); }
.btn-accent:disabled { opacity: .5; cursor: not-allowed; }
.btn { border-radius: var(--r-pill); font-size: 13px; font-weight: 600; }
.btn-secondary { background: rgba(255, 255, 255, .025); border: .67px solid var(--line); color: var(--ink); }
.btn-secondary:not(:disabled):hover { background: var(--hover); border-color: var(--line-strong); }
.btn-ghost { color: var(--muted); }
.btn-ghost:not(:disabled):hover { background: var(--hover); color: var(--ink); }
.btn-lg { min-height: 48px; font-size: 14px; }
.btn-buy { background: linear-gradient(#9cf5b6, var(--up) 60%, #52c776); color: #06140b; border: .67px solid rgba(160, 245, 184, .55); }
.btn-sell { background: linear-gradient(#ff8f8f, #e05a5a 60%, #b83a3a); color: #fff; border: .67px solid rgba(255, 160, 160, .4); }
[data-theme="light"] .btn-secondary { background: #fff; }
.is-active, .seg-active {
  background: linear-gradient(rgba(255, 255, 255, .043) 50%, var(--accent-tint));
  border: .67px solid rgba(255, 255, 255, .157); color: var(--ink);
  box-shadow: inset 0 -3px 7px var(--accent-glow);
}
[data-theme="light"] .is-active, [data-theme="light"] .seg-active { background: linear-gradient(#fff 50%, var(--accent-tint)); border-color: var(--line); }
.label-xs { font-size: 9px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); }
.card {
  background: linear-gradient(145deg, var(--panel-hi), var(--panel-lo) 82%);
  border: .67px solid var(--line); border-radius: 23px; box-shadow: var(--shadow-card);
}
.icon-tile { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; flex: none; background: var(--accent-tint); border: .67px solid color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-text); }
.round-button { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; flex: none; border: .67px solid var(--line); background: rgba(255, 255, 255, .02); color: var(--muted); cursor: pointer; }
.round-button:hover { color: var(--ink); background: var(--hover); }
.link-plain { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-align: left; }

/* ---------- Existing components in the new language ---------- */
.panel, .preview-card, .summary-card, .review-block, .connection, .treasury, .activity, .stats, .token-terminal-bar {
  background: linear-gradient(145deg, var(--panel-hi), var(--panel-lo) 82%);
  border: .67px solid var(--line); box-shadow: var(--shadow-card);
}
.panel { border-radius: var(--r-card-lg); }
.preview-card, .summary-card, .treasury, .activity, .stats { border-radius: 22px; }
.review-block, .connection { border-radius: 18px; }
.token-page .token-layout .panel, .token-terminal-bar { border-radius: 20px; }
.token-card { background: linear-gradient(145deg, var(--panel-hi), var(--panel-lo) 82%); border: .67px solid var(--line); border-radius: 23px; box-shadow: var(--shadow-card); }
.token-card:hover { border-color: var(--line-strong); }
.chip { border-radius: var(--r-pill); background: rgba(255, 255, 255, .04); border: .67px solid var(--line-soft); font-size: 11px; font-weight: 500; color: var(--ink-2); }
[data-theme="light"] .chip { background: var(--panel-2); }
.chip-positive { background: var(--up-soft); color: var(--up); border-color: transparent; }
.chip-negative { background: var(--down-bg); color: var(--down); border-color: var(--down-line); }
.chip-sim { background: rgba(233, 196, 109, .1); color: #e9c46d; border-color: transparent; }
[data-theme="light"] .chip-sim { color: #8a6a12; }
.chip-testnet, .chip-dawn { background: var(--accent-tint); color: var(--accent-text); border-color: transparent; }
.input, .select, .textarea { background: var(--bg); border: .67px solid var(--line-soft); border-radius: var(--r-input); min-height: 46px; padding: 11px 13px; font-weight: 500; }
[data-theme="light"] .input, [data-theme="light"] .select, [data-theme="light"] .textarea { background: #fff; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.segmented { background: rgba(255, 255, 255, .02); border: .67px solid var(--line); border-radius: var(--r-pill); padding: 3px; }
.segmented button { border-radius: var(--r-pill); border: .67px solid transparent; color: var(--muted); }
.segmented button[aria-pressed="true"], .segmented button[aria-selected="true"] { background: linear-gradient(rgba(255, 255, 255, .043) 50%, var(--accent-tint)); border-color: rgba(255, 255, 255, .157); color: var(--ink); box-shadow: inset 0 -3px 7px var(--accent-glow); }
[data-theme="light"] .segmented button[aria-pressed="true"], [data-theme="light"] .segmented button[aria-selected="true"] { background: linear-gradient(#fff 50%, var(--accent-tint)); border-color: var(--line); }
.callout { border-radius: 14px; background: rgba(255, 255, 255, .03); border: .67px solid var(--line-soft); }
.callout-warn { background: var(--accent-tint); border-color: transparent; }
.callout-error { background: var(--down-bg); border-color: var(--down-line); }
.callout-ok { background: var(--up-soft); border-color: transparent; }
.empty { border: .67px solid var(--line); border-radius: 28px; background: radial-gradient(ellipse 60% 70% at 50% 0%, var(--accent-glow), transparent 70%), linear-gradient(145deg, var(--panel-hi), var(--panel-lo) 82%); }
.skeleton { background: linear-gradient(90deg, var(--panel), var(--panel-2), var(--panel)); background-size: 200% 100%; border-radius: 23px; }
.bar { background: rgba(255, 255, 255, .07); }
[data-theme="light"] .bar { background: var(--panel-3); }
.bar > span { background: linear-gradient(90deg, var(--accent-lo), var(--accent)); }
.bar[data-state="done"] > span { background: var(--up); }
.copy { border-radius: 8px; background: rgba(255, 255, 255, .03); border: .67px solid var(--line-soft); font-family: var(--font-mono); font-size: 11.5px; }
.links a { border: .67px solid var(--line); border-radius: var(--r-pill); color: var(--ink-2); }
.links a:hover { background: var(--hover); color: var(--ink); }
.choice { border: .67px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .015); }
.choice:has(input:checked), .choice[aria-pressed="true"] { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-tint); }
.avatar { border-radius: 12px; border: .67px solid var(--line-soft); background: var(--panel-2); }
.price-ticker > span { border-radius: var(--r-pill); border: .67px solid var(--line); background: rgba(255, 255, 255, .02); }
.price-ticker strong { color: var(--accent-text); }
.intro { border-radius: 28px; border: .67px solid var(--line); background: radial-gradient(ellipse 50% 80% at 100% 0%, var(--accent-glow), transparent 70%), linear-gradient(145deg, var(--panel-hi), var(--panel-lo) 82%); }
.intro::after { border-color: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: 0 0 0 48px color-mix(in srgb, var(--accent) 2%, transparent), 0 0 0 96px color-mix(in srgb, var(--accent) 1.5%, transparent); }
.env-banner { border-radius: 16px; background: rgba(255, 255, 255, .025); border: .67px solid var(--line-soft); }
.env-banner[data-env="local"] { background: rgba(233, 196, 109, .07); border-color: rgba(233, 196, 109, .16); color: var(--ink-2); }
.market-table td, .analytics-table td, .analytics-table th { border-color: var(--line-faint); }
.market-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.tabs-underline button[aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); }
.stage-filters button[aria-pressed="true"], .chart-options button[aria-pressed=true], .analytics-filters button[aria-pressed="true"] {
  background: linear-gradient(rgba(255, 255, 255, .043) 50%, var(--accent-tint)); color: var(--ink); border-color: rgba(255, 255, 255, .157); box-shadow: inset 0 -3px 7px var(--accent-glow);
}
[data-theme="light"] .stage-filters button[aria-pressed="true"], [data-theme="light"] .chart-options button[aria-pressed=true], [data-theme="light"] .analytics-filters button[aria-pressed="true"] { background: linear-gradient(#fff 50%, var(--accent-tint)); border-color: var(--line); }

/* Dialogs and notifications */
dialog { border-radius: 28px; background: linear-gradient(160deg, var(--panel-hi), var(--panel-lo) 85%); border: .67px solid var(--line); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(6px); }
.toast { background: var(--panel-2); color: var(--ink); border: .67px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); }
.toast[data-kind="error"] .icon { color: var(--down); }
.toast[data-kind="success"] .icon { color: var(--up); }
.toast a { color: var(--accent-text); }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: calc(var(--dock-w) + 8px) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; transition: grid-template-columns 220ms var(--ease); }
.app-shell[data-dock="open"] { --dock-w: 232px; }
.app-main { min-width: 0; display: flex; flex-direction: column; }

/* Dock: collapsed to icons, widens on hover or focus, or stays open when pinned. */
.dock { position: sticky; top: 8px; z-index: 30; margin: 8px 0 8px 8px; width: var(--dock-w); height: calc(100vh - 16px); height: calc(100dvh - 16px);
  display: flex; flex-direction: column; padding: 18px 12px 12px; border-radius: 25px; background: var(--dock-bg); border: .67px solid var(--line);
  box-shadow: inset 0 1px 0 var(--highlight); transition: width 220ms var(--ease); }
.dock-brand { display: flex; align-items: center; height: 40px; padding-left: 11px; overflow: hidden; flex: none; }
.dock-mark { width: 34px; height: 34px; flex: none; }
.dock-wordmark { height: 30px; width: auto; display: none; }
.dock-nav { display: grid; gap: 4px; margin-top: 22px; }
.dock-link, .dock-launch { display: flex; align-items: center; gap: 12px; height: 45px; padding: 0 19px; border-radius: var(--r-pill); border: .67px solid transparent;
  color: var(--muted); font: 550 13px/1 var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap; overflow: hidden; width: 100%; }
.dock-link { background: none; }
.dock-link .icon, .dock-launch .icon { width: 18px; height: 18px; flex: none; }
.dock-link:hover { background: var(--hover); color: var(--ink); }
.dock-link[aria-current="page"] { background: linear-gradient(rgba(255, 255, 255, .043) 50%, var(--accent-tint)); border-color: rgba(255, 255, 255, .157); color: var(--ink); box-shadow: inset 0 -3px 7px var(--accent-glow); }
[data-theme="light"] .dock-link[aria-current="page"] { background: linear-gradient(#fff 50%, var(--accent-tint)); border-color: var(--line); }
.dock-link[aria-current="page"] .icon { color: var(--accent-text); }
.dock-launch { margin-top: 16px; height: 44px; color: var(--accent-ink); font-weight: 650; border-color: var(--accent-line); justify-content: flex-start; }
.dock-label { opacity: 0; visibility: hidden; transition: opacity 120ms var(--ease), visibility 0s linear 120ms; }
.dock-spacer { flex: 1; min-height: 12px; }
.dock-network { position: relative; }
.dock-env, .mobile-chain .env-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 13px; border-radius: var(--r-pill);
  border: .67px solid var(--line-soft); background: rgba(255, 255, 255, .02); color: var(--ink-2); font: 500 12px/1.2 var(--font-sans); cursor: pointer; text-align: left; overflow: hidden; white-space: nowrap; }
.dock-env:hover, .mobile-chain .env-button:hover { background: var(--hover); color: var(--ink); }
.dock-env .asset-icon, .mobile-chain .env-button .asset-icon, .dock-env .icon { width: 20px; height: 20px; flex: none; }
.dock-env > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dock-env > small, .mobile-chain .env-button > small { font-size: 10px; color: var(--muted); }
.dock-env > span, .dock-env > small, .dock-env > .icon:last-child { opacity: 0; visibility: hidden; transition: opacity 120ms var(--ease), visibility 0s linear 120ms; }
.dock-env:disabled { opacity: .6; cursor: wait; }
/* A compact chain selector is the chain's circular badge, with no inset square. */
.app-shell:not([data-dock="open"]) .dock-env { width: 44px; height: 44px; min-height: 44px; padding: 0; gap: 0; margin-inline: auto; justify-content: center; border-radius: 50%; }
.app-shell:not([data-dock="open"]) .dock-env > :not(:first-child) { display: none; }
.app-shell:not([data-dock="open"]) .dock-env > .asset-icon { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.dock-tools { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-top: 10px; }
.dock-tool { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; color: var(--muted); cursor: pointer; }
.dock-tool:hover { background: var(--hover); color: var(--ink); }
.dock-tool[aria-pressed="true"] { color: var(--accent-text); }
.pin-close, [data-dock-pinned] .pin-open { display: none; }
[data-dock-pinned] .pin-close { display: block; }
.theme-moon, [data-theme="light"] .theme-sun { display: none; }
[data-theme="light"] .theme-moon { display: block; }

.app-shell[data-dock="open"] .dock-label, .app-shell[data-dock="open"] .dock-env > span, .app-shell[data-dock="open"] .dock-env > small, .app-shell[data-dock="open"] .dock-env > .icon:last-child { opacity: 1; visibility: visible; transition-delay: 60ms, 0s; }
.app-shell[data-dock="open"] .dock-mark { display: none !important; }
[data-theme="light"] .dock-mark.brand-light { display: block; }
.app-shell[data-dock="open"] .dock-wordmark.brand-dark { display: block; }
[data-theme="light"] .app-shell[data-dock="open"] .dock-wordmark.brand-dark { display: none; }
[data-theme="light"] .app-shell[data-dock="open"] .dock-wordmark.brand-light { display: block; }
.app-shell[data-dock="open"] .dock-launch { justify-content: center; }
/* The tools keep one column when open, so nothing under the pointer moves while the dock widens. */
.app-shell[data-dock="open"] .dock-tools { align-items: flex-start; padding-left: 8px; }
.brand-light { display: none; }
[data-theme="light"] .brand-dark { display: none !important; }
[data-theme="light"] .brand-light { display: block; }
.dock-wordmark.brand-light, .topbar-wordmark.brand-light, .footer-wordmark.brand-light { display: none; }
[data-theme="light"] .topbar-wordmark.brand-light, [data-theme="light"] .footer-wordmark.brand-light { display: block; }

/* Chain menu (shared by the dock and the mobile header) */
.chain-selector { position: relative; }
.chain-options { position: absolute; z-index: 70; min-width: 290px; max-width: calc(100vw - 32px); padding: 8px; border: .67px solid var(--line); border-radius: 20px;
  background: linear-gradient(160deg, var(--panel-hi), var(--panel-lo) 85%); box-shadow: var(--shadow-pop); max-height: calc(100dvh - 80px); overflow-y: auto; }
.dock .chain-options { left: calc(100% + 14px); right: auto; top: auto; bottom: 0; width: 300px; }
.mobile-chain .chain-options { left: auto; right: 0; bottom: auto; top: calc(100% + 10px); width: min(300px, calc(100vw - 24px)); }
.chain-option { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; min-height: 46px; background: transparent; color: var(--ink); border: 0; border-radius: 14px; text-align: left; cursor: pointer; font: 500 13px/1.2 var(--font-sans); }
.chain-option small { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.chain-option[aria-selected="true"], .chain-option:hover, .chain-option:focus-visible { background: var(--hover); color: var(--ink); }
.chain-option[aria-selected="true"] { box-shadow: inset 0 0 0 .67px var(--line); }

/* Top bar */
.topbar { position: sticky; top: 8px; z-index: 25; margin: 8px 8px 0 16px; min-height: 56px; display: flex; align-items: center; gap: 14px; padding: 8px;
  border-radius: 25px; background: var(--topbar-bg); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
  border: .67px solid var(--line); box-shadow: inset 0 1px 0 var(--highlight); }
.topbar-brand { display: none; align-items: center; padding-left: 8px; flex: none; }
.topbar-wordmark { height: 28px; width: auto; }
.top-search { display: flex; align-items: center; gap: 9px; flex: 0 1 330px; min-width: 200px; height: 40px; padding: 0 6px 0 14px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, .016); border: .67px solid var(--line-soft); color: var(--muted); transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease); }
[data-theme="light"] .top-search { background: #fff; }
.top-search:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 3px var(--accent-glow); }
.top-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font: 450 13px var(--font-sans); outline: none; }
.top-search input::placeholder { color: var(--muted); }
.top-search input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }
.top-search kbd { font: 500 10px/1 var(--font-sans); color: var(--muted); padding: 5px 7px; border-radius: 7px; background: rgba(255, 255, 255, .04); border: .67px solid var(--line-faint); white-space: nowrap; }
.top-search:focus-within kbd { display: none; }
.last-sale { display: flex; align-items: center; gap: 14px; flex: 1 1 auto; min-width: 0; }
.last-sale-label { font-size: 11px; color: var(--muted); white-space: nowrap; flex: none; }
.last-sale-track { flex: 1; min-width: 0; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.last-sale-items { display: inline-flex; align-items: center; gap: 26px; white-space: nowrap; will-change: transform; }
.last-sale-items[data-scroll] { animation: last-sale var(--marquee-duration, 40s) linear infinite; }
.last-sale-track:hover .last-sale-items, .last-sale-track:focus-within .last-sale-items { animation-play-state: paused; }
@keyframes last-sale { from { transform: translateX(0); } to { transform: translateX(var(--marquee-shift, -50%)); } }
.sale-item { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); text-decoration: none; font-size: 11.5px; border-radius: var(--r-pill); padding: 2px 4px 2px 2px; }
.sale-item:hover { background: var(--hover); }
.sale-item .avatar { width: 22px; height: 22px; border-radius: 50%; border: 0; }
.sale-item .avatar .initials { font-size: 8px; }
.sale-item strong { font-weight: 650; }
.sale-item span { color: var(--up); font-weight: 500; }
.sale-item span[data-side="sell"] { color: var(--down); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: none; }
.top-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: .67px solid var(--line-soft); background: rgba(255, 255, 255, .02); color: var(--ink-2); cursor: pointer; }
.top-icon:hover { background: var(--hover); color: var(--ink); }
.btn-wallet { min-height: 40px; padding: 0 16px; font-size: 12.5px; max-width: 220px; }
.btn-wallet .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-wallet[data-connected] { background: rgba(255, 255, 255, .03); color: var(--ink); border-color: var(--line); box-shadow: none; font-weight: 550; }
[data-theme="light"] .btn-wallet[data-connected] { background: #fff; }
.btn-wallet[data-address] { font-family: var(--font-mono); font-weight: 500; }
.btn-wallet[data-connected] .icon { color: var(--accent-text); }
.mobile-only, .mobile-chain { display: none; }

/* Main content and footer */
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 24px 48px; flex: 1; }
.site-footer { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 24px 24px; color: var(--muted); font-size: 13px; }
.footer-card { position: relative; overflow: hidden; border-radius: 28px; border: .67px solid var(--line); padding: 32px 28px 0;
  background: radial-gradient(ellipse 45% 60% at 100% 0%, var(--accent-glow), transparent 70%), linear-gradient(145deg, var(--panel-hi), var(--panel-lo) 82%); box-shadow: var(--shadow-card); }
.footer-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); gap: 28px; position: relative; z-index: 1; }
.footer-intro { display: grid; gap: 16px; align-content: start; justify-items: start; }
.footer-wordmark { height: 34px; width: auto; }
.footer-intro p { color: var(--muted); max-width: 34ch; line-height: 1.6; }
.footer-col { display: grid; gap: 11px; align-content: start; }
.footer-col h2 { font-size: 13px; font-weight: 600; color: var(--ink); letter-spacing: 0; margin-bottom: 4px; }
.footer-col a, .footer-col .link-plain { color: var(--muted); text-decoration: none; font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.footer-col a:hover, .footer-col .link-plain:hover { color: var(--ink); }
.footer-watermark { position: relative; margin: 28px -10px -0.12em; text-align: center; font: 800 clamp(88px, 15vw, 190px)/.85 var(--font-sans); letter-spacing: -.065em; user-select: none;
  color: transparent; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent) 2%, transparent) 80%); -webkit-background-clip: text; background-clip: text; }
.footer-strip { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; margin: 0 -28px; padding: 13px 20px; border-top: .67px solid var(--line-faint); background: rgba(0, 0, 0, .18); font-size: 11px; }
[data-theme="light"] .footer-strip { background: rgba(29, 39, 26, .03); }
.footer-strip img { width: 16px; height: 16px; }
.footer-strip > span { flex: 1; min-width: 0; }
.footer-theme { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 6px 10px; border-radius: var(--r-pill); border: .67px solid var(--line-soft); background: none; color: var(--muted); font: 500 11px var(--font-sans); cursor: pointer; flex: none; }
.footer-theme:hover { color: var(--ink); background: var(--hover); }
.footer-theme .icon { width: 13px; height: 13px; }
.footer-theme .theme-label-light, [data-theme="light"] .footer-theme .theme-label-dark { display: none; }
[data-theme="light"] .footer-theme .theme-label-light { display: inline; }

/* Mobile tab bar */
.tabbar { display: none; }

/* Wallet dialog */
.wallet-dialog { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 26px; }
.wallet-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.wallet-head h2 { font-size: 24px; font-weight: 650; letter-spacing: -.03em; }
.wallet-head p { color: var(--muted); margin-top: 6px; line-height: 1.5; }
.wallet-body { display: grid; gap: 10px; margin: 22px 0 18px; }
.wallet-list-head { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; }
.wallet-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; width: 100%; min-height: 70px; padding: 12px 16px; border-radius: 18px;
  border: .67px solid var(--line-soft); background: rgba(255, 255, 255, .025); color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.wallet-row:hover { background: var(--hover); border-color: var(--line); }
.wallet-row:disabled { opacity: .6; cursor: wait; }
.wallet-row .wallet-logo { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--panel-2); border: .67px solid var(--line-faint); overflow: hidden; }
.wallet-row .wallet-logo img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.wallet-row strong { display: block; font-size: 14px; font-weight: 650; }
.wallet-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.wallet-row > .icon { color: var(--muted); }
.wallet-foot { display: flex; gap: 10px; align-items: flex-start; padding-top: 16px; border-top: .67px solid var(--line-faint); color: var(--muted); font-size: 12px; line-height: 1.55; }
.wallet-foot .icon { color: var(--accent-text); margin-top: 1px; }
.wallet-empty { padding: 18px; border-radius: 18px; border: .67px dashed var(--line); color: var(--muted); font-size: 13px; line-height: 1.55; }
.wallet-more { border-top: .67px solid var(--line-faint); padding-top: 14px; }
.wallet-more summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.wallet-catalog { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.wallet-install { display: flex; align-items: center; gap: 9px; padding: 10px; color: var(--ink); text-decoration: none; border: .67px solid var(--line-soft); border-radius: 12px; font-size: 12px; }
.wallet-install:hover { background: var(--hover); }
.wallet-install img { object-fit: contain; border-radius: 6px; flex: none; }
.wallet-install span { min-width: 0; flex: 1; }
.wallet-install .icon { color: var(--muted); flex: none; }

/* Search sheet (phones) */
.search-dialog { width: min(560px, calc(100vw - 16px)); margin: 8px auto auto; padding: 8px; border-radius: 26px; }
.sheet-search { flex: 1 1 auto; height: 50px; max-width: none; }

/* Not found */
.not-found { display: grid; place-items: center; text-align: center; gap: 22px; padding: clamp(60px, 14vh, 140px) 16px; }
.not-found h1 { font-size: clamp(32px, 5vw, 44px); font-weight: 600; letter-spacing: -.04em; }
.not-found p { color: var(--muted); max-width: 40ch; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .last-sale { display: none; }
  .top-search { flex: 1 1 auto; max-width: 420px; }
}
@media (max-width: 780px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .dock { display: none; }
  .topbar { margin: 8px 8px 0; min-height: 60px; padding: 8px 8px 8px 10px; gap: 8px; }
  .topbar-brand { display: flex; padding-left: 4px; }
  .topbar > .top-search { display: none; }
  .mobile-only { display: grid; }
  .mobile-chain { display: block; }
  .mobile-chain .env-button { width: auto; min-height: 42px; padding: 0 10px; gap: 6px; }
  .mobile-chain .env-button > span { max-width: 92px; overflow: hidden; text-overflow: ellipsis; }
  .btn-wallet { min-height: 42px; padding: 0 13px; max-width: 150px; }
  main { padding: 20px 16px 120px; }
  .site-footer { padding: 0 12px 112px; }
  .footer-card { padding: 26px 20px 0; border-radius: 24px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .footer-intro { grid-column: 1 / -1; }
  .footer-strip { margin: 0 -20px; }
  .toasts { bottom: calc(100px + env(safe-area-inset-bottom)); right: 12px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 40; left: 50%; transform: translateX(-50%);
    bottom: calc(12px + env(safe-area-inset-bottom)); width: min(480px, calc(100% - 24px)); padding: 6px; border-radius: 24px;
    background: var(--topbar-bg); -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2); border: .67px solid var(--line); box-shadow: var(--shadow-pop); }
  .tabbar::before { content: ""; position: absolute; left: 18%; right: 18%; top: -.5px; height: 1px; pointer-events: none;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 45%, transparent), transparent); }
  .tabbar a { position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-width: 0; min-height: 62px; padding: 4px 2px 8px; border-radius: 18px;
    color: var(--muted); text-decoration: none; font: 500 11.5px/1.2 var(--font-sans); -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
  .tabbar .tab-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 13px; transition: transform .18s, background-color .18s; }
  .tabbar .tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar a[aria-current="page"] { color: var(--accent-text); }
  .tabbar a[aria-current="page"] .tab-icon { background: var(--accent-tint); }
  .tabbar a[aria-current="page"]::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 7px var(--accent); }
  .tabbar a:active .tab-icon { transform: scale(.93); }
  .tabbar .tab-create .tab-icon { width: 44px; height: 44px; border-radius: 50%; transform: translateY(-4px); color: var(--accent-ink);
    background: linear-gradient(145deg, var(--accent-hi), var(--accent) 60%, var(--accent-lo)); border: .67px solid var(--accent-line); box-shadow: 0 6px 18px var(--accent-glow); }
  .tabbar .tab-create[aria-current="page"] .tab-icon { background: linear-gradient(145deg, var(--accent-hi), var(--accent) 60%, var(--accent-lo)); }
  .tabbar .tab-create:active .tab-icon { transform: translateY(-4px) scale(.93); }
}
@media (max-width: 600px) {
  .top-actions .mobile-only[data-theme-toggle] { display: none; }
  .mobile-chain .env-button > span, .mobile-chain .env-button > small, .mobile-chain .env-button > .icon:last-child { display: none; }
  .mobile-chain .env-button { width: 42px; padding: 0; justify-content: center; }
}
@media (max-width: 420px) {
  .topbar-wordmark { height: 24px; }
  .mobile-chain .env-button > span, .mobile-chain .env-button > small { display: none; }
  .btn-wallet { max-width: 132px; font-size: 12px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 360px) {
  .topbar-brand { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .app-shell, .dock { transition: none; }
  .last-sale-items[data-scroll] { animation: none; }
}

/* Chain menu: every logo sits in the same 28px round slot, whatever the artwork's shape. */
.chain-option > .asset-icon, .chain-option > .icon { width: 28px; height: 28px; flex: none; box-sizing: border-box; border-radius: 50%; padding: 5px; object-fit: contain; background: var(--panel-2); border: .67px solid var(--line-soft); }
.chain-option > .asset-icon[src*="base"], .chain-option > .asset-icon[src*="robinhood"] { padding: 0; object-fit: cover; border: 0; }
.chain-option > .icon { padding: 6px; color: var(--ink-2); }
/* Footer watermark: a deeper green in the light theme so the whole word reads, and room for the descender. */
.footer-watermark { line-height: .95; margin-bottom: -.18em; }
[data-theme="light"] .footer-watermark { background-image: linear-gradient(180deg, color-mix(in srgb, var(--accent-text) 26%, transparent), color-mix(in srgb, var(--accent-text) 8%, transparent) 85%); }
[data-theme="light"] .footer-strip { background: rgba(244, 246, 239, .96); }

/* ---------- Phase 6: chain badges (square/wide glyphs sit centred in the round slot) ---------- */
.chain-option > .asset-icon[src*="ethereum"], .chain-option > .asset-icon[src*="solana"] { padding: 6px; object-fit: contain; border: 0; }
.chain-option > .asset-icon[src*="ethereum"] { background: #eceefb; }
.chain-option > .asset-icon[src*="solana"] { background: #0c0d12; }
.app-shell:not([data-dock="open"]) .dock-env > .asset-icon[src*="ethereum"], .app-shell:not([data-dock="open"]) .dock-env > .asset-icon[src*="solana"],
.mobile-chain .env-button .asset-icon[src*="ethereum"], .mobile-chain .env-button .asset-icon[src*="solana"] { box-sizing: border-box; padding: 22%; object-fit: contain; border-radius: 50%; }
.app-shell:not([data-dock="open"]) .dock-env > .asset-icon[src*="ethereum"] { background: #eceefb; }
.app-shell:not([data-dock="open"]) .dock-env > .asset-icon[src*="solana"] { background: #0c0d12; }

/* ---------- Phase 6b: route enter, light-theme polish ---------- */
.view-enter { animation: view-in 240ms var(--ease, ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .view-enter { animation: none; } }
[data-theme="light"] .skeleton { background-image: linear-gradient(90deg, var(--panel-2), var(--panel-3), var(--panel-2)); animation: shimmer 1.4s linear infinite; }
@media (prefers-reduced-motion: reduce) { [data-theme="light"] .skeleton { animation: none; } }
[data-theme="light"] .label-xs, [data-theme="light"] .muted { color: var(--muted); }

/* ---------- Mobile chain button and menu ---------- */
.asset-icon[src*="/base."], .asset-icon[src*="/robinhood."] { border-radius: 50%; object-fit: cover; }
.mobile-chain .env-button .asset-icon { width: 28px; height: 28px; border-radius: 50%; box-sizing: border-box; background: var(--panel-2); flex: none; }
.mobile-chain .env-button .asset-icon[src*="bnb"] { padding: 5px; object-fit: contain; }
.mobile-chain .env-button .asset-icon[src*="ethereum"] { background: #eceefb; }
.mobile-chain .env-button .asset-icon[src*="solana"] { background: #0c0d12; }
@media (max-width: 900px) {
  .mobile-chain .chain-options { position: fixed; left: 12px; right: 12px; top: calc(env(safe-area-inset-top, 0px) + 76px); width: auto; max-width: none; max-height: calc(100dvh - 190px); overflow-y: auto; }
}
