:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --ink: #111;
  --muted: #626a76;
  --faint: #66707e;
  --line: #e3e5e8;
  --green: #087a53;
  --amber: #a35b00;
  --red: #c92f43;
  --resize-dur: 180ms;
  --resize-ease: cubic-bezier(.22, 1, .36, 1);
  --panel-open-dur: 400ms;
  --panel-close-dur: 350ms;
  --panel-translate-y: 100px;
  --panel-blur: 2px;
  --panel-ease: cubic-bezier(.22, 1, .36, 1);
  --icon-swap-dur: 250ms;
  --icon-swap-blur: 2px;
  --icon-swap-start-scale: .25;
  --icon-swap-ease: ease-in-out;
  --check-opacity-dur: 500ms;
  --check-rotate-dur: 500ms;
  --check-rotate-from: 80deg;
  --check-bob-dur: 500ms;
  --check-y-amount: 12px;
  --check-blur-dur: 500ms;
  --check-blur-from: 8px;
  --check-path-dur: 500ms;
  --check-path-delay: 80ms;
  --check-ease-out: cubic-bezier(.22, 1, .36, 1);
  --check-ease-opacity: cubic-bezier(.22, 1, .36, 1);
  --check-ease-rotate: cubic-bezier(.22, 1, .36, 1);
  --check-ease-bob: cubic-bezier(.34, 1.35, .64, 1);
  --check-ease-path: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: #fff; color: var(--ink); }
button, input { font: inherit; }
button, input, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, a:focus-visible, .token-row:focus-visible {
  outline: 2px solid #1769e0;
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.board { width: 100%; max-width: 640px; margin: auto; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.masthead { display: flex; align-items: center; justify-content: space-between; padding: calc(19px + env(safe-area-inset-top)) 12px 13px; }
.masthead h1 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -.4px; }
.masthead p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.freshness { white-space: nowrap; }
.freshness i { display: inline-block; width: 6px; height: 6px; margin: 0 4px 1px 0; border-radius: 50%; background: var(--faint); }
.freshness i[data-state="fresh"] { background: var(--green); }
.freshness i[data-state="aging"] { background: var(--amber); }
.freshness i[data-state="stale"] { background: var(--red); }
.gear { width: 44px; height: 44px; border: 0; background: transparent; font-size: 19px; cursor: pointer; border-radius: 4px; }
.research-links { display: flex; gap: 4px; padding: 0 12px 11px; border-bottom: 1px solid var(--line); }
.research-links a, .research-links span { display: grid; min-height: 34px; place-items: center; padding: 0 10px; border-radius: 6px; color: var(--muted); font-size: 11px; font-weight: 650; text-decoration: none; }
.research-links span { color: #fff; background: var(--ink); }

.controls { position: sticky; z-index: 4; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 0 8px; }
.controls.is-stuck { box-shadow: 0 1px 0 #cdd1d6; }
.search { display: flex; align-items: center; height: 44px; border: 1px solid #d9dde2; padding: 0 10px; gap: 7px; color: var(--faint); }
.search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search input::placeholder { color: var(--faint); }
.sorts { display: flex; gap: 3px; padding: 7px 0; }
.sorts button { display: inline-flex; align-items: center; min-height: 29px; border: 0; border-radius: 2px; background: transparent; padding: 4px 9px; color: var(--muted); font-size: 11px; cursor: pointer; }
.sorts button[aria-pressed="true"] { background: #111; color: #fff; }
.sort-arrow { display: none; width: 11px; margin-left: 3px; font-style: normal; }
.sorts button[aria-pressed="true"] .sort-arrow { display: inline-grid; }
.t-icon-swap { position: relative; display: inline-grid; }
.t-icon-swap .t-icon { grid-area: 1 / 1; font-style: normal; transition: opacity var(--icon-swap-dur) var(--icon-swap-ease), filter var(--icon-swap-dur) var(--icon-swap-ease), transform var(--icon-swap-dur) var(--icon-swap-ease); will-change: opacity, filter, transform; }
.t-icon-swap[data-state="down"] .t-icon[data-icon="down"], .t-icon-swap[data-state="up"] .t-icon[data-icon="up"] { opacity: 1; filter: blur(0); transform: scale(1); }
.t-icon-swap[data-state="down"] .t-icon[data-icon="up"], .t-icon-swap[data-state="up"] .t-icon[data-icon="down"] { opacity: 0; filter: blur(var(--icon-swap-blur)); transform: scale(var(--icon-swap-start-scale)); }

.columns, .token-row { display: grid; grid-template-columns: minmax(78px, 1fr) 34px repeat(4, minmax(32px, 42px)) minmax(40px, 48px); column-gap: 3px; align-items: center; }
.columns { height: 24px; color: var(--faint); font-size: 11px; text-align: right; }
.columns span:first-child { text-align: left; padding-left: 4px; }
.chain-group { position: relative; }
.chain-title { position: sticky; z-index: 2; top: var(--controls-height, 121px); height: 27px; padding: 8px 12px 4px; border-bottom: 1px solid #e6e8eb; background: #f6f7f8; color: #4d5560; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.token-row { position: relative; min-height: 46px; width: 100%; padding: 3px 8px; border: 0; border-bottom: 1px solid var(--line); background: #fff; text-align: right; cursor: pointer; }
.token-row:hover { background: #fafbfc; }
.token-cell { text-align: left; min-width: 0; }
.token-cell strong { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; }
.suffix { color: var(--faint); font-size: 9px; font-weight: 500; }
.price { display: block; color: var(--faint); font-size: 10px; font-variant-numeric: tabular-nums; }
.metric { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.muted { color: var(--faint); }
.ath { color: #4d5560; }
.tag { margin-left: 3px; background: #dfe2e6; color: #343a43; padding: 1px 3px; font-size: 8px; }
.spark { display: block; width: 34px; height: 18px; }
.spark polyline { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark.positive polyline { stroke: var(--green); }
.spark.negative polyline { stroke: var(--red); }
.chevron { width: 12px; height: 12px; color: var(--faint); transition: transform var(--resize-dur) var(--resize-ease); }
.token-row[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.detail-wrap { display: grid; grid-template-rows: 0fr; border-bottom: 0 solid var(--line); transition: grid-template-rows var(--resize-dur) var(--resize-ease), border-width var(--resize-dur) var(--resize-ease); overflow: hidden; }
.detail-wrap.open { grid-template-rows: 1fr; border-bottom-width: 1px; }
.detail { min-height: 0; overflow: hidden; }
.detail-strip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 7px 10px 9px; padding: 8px 10px; border: 1px solid #d9dde2; background: #f6f7f8; color: #4d5560; font-size: 11px; line-height: 1.45; }
.detail-strip p { margin: 0; }
.detail-strip a { display: grid; place-items: center; min-width: 112px; min-height: 44px; color: #111; font-weight: 700; text-decoration: underline; }

.empty { padding: 56px 16px; text-align: center; color: var(--faint); font-size: 12px; }
footer { padding: 22px 12px; color: var(--faint); font-size: 9px; text-align: center; }
.scrim { position: fixed; z-index: 8; inset: 0; background: #0006; }
.sheet { position: fixed; z-index: 9; right: 0; bottom: 0; left: 0; max-width: 640px; max-height: 85vh; margin: auto; padding: 7px 16px 0; overflow: auto; background: #fff; }
.t-panel-slide { transform: translateY(var(--panel-translate-y)); opacity: 0; filter: blur(var(--panel-blur)); pointer-events: none; transition: transform var(--panel-close-dur) var(--panel-ease), opacity var(--panel-close-dur) var(--panel-ease), filter var(--panel-close-dur) var(--panel-ease); will-change: transform, opacity, filter; }
.t-panel-slide[data-open="true"] { transform: translateY(0); opacity: 1; filter: blur(0); pointer-events: auto; transition: transform var(--panel-open-dur) var(--panel-ease), opacity var(--panel-open-dur) var(--panel-ease), filter var(--panel-open-dur) var(--panel-ease); }
.grip { width: 34px; height: 3px; margin: 0 auto 10px; background: #b7bdc5; }
.sheet header { display: flex; align-items: center; justify-content: space-between; }
.sheet h2 { font-size: 17px; }
.sheet header button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 25px; }
.setting-title { display: flex; justify-content: space-between; margin: 8px 0; font-size: 11px; font-weight: 700; }
.setting-title button { min-height: 32px; border: 0; padding: 0 2px; background: transparent; text-decoration: underline; font-size: 10px; }
.chain-option { display: flex; align-items: center; justify-content: space-between; min-height: 44px; border-top: 1px solid var(--line); font-size: 12px; }
.chain-option span { margin-left: auto; margin-right: 10px; color: var(--faint); font-size: 10px; }
.chain-option input { width: 20px; height: 20px; accent-color: #111; }
.tag-toggle { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.tag-toggle strong, .tag-toggle small { display: block; font-size: 11px; }
.tag-toggle small { margin-top: 3px; color: var(--faint); font-weight: 400; }
.tag-toggle input { position: absolute; opacity: 0; }
.tag-toggle i { width: 40px; height: 23px; padding: 2px; border-radius: 12px; background: #adb3bc; }
.tag-toggle i::after { content: ""; display: block; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform var(--resize-dur) var(--resize-ease); }
.tag-toggle input:checked + i { background: #111; }
.tag-toggle input:checked + i::after { transform: translateX(17px); }
.tag-toggle input:focus-visible + i { outline: 2px solid #1769e0; outline-offset: 2px; }
.save-dock { position: sticky; bottom: 0; margin: 12px -16px 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #fff; }
.save { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 44px; border: 0; background: #111; color: #fff; font-weight: 700; cursor: pointer; }
.t-success-check { display: none; transform-origin: center; opacity: 0; will-change: transform, opacity, filter; }
.t-success-check svg { display: block; width: 18px; height: 18px; overflow: visible; }
.t-success-check svg path { stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 22; stroke-dashoffset: 22; }
.t-success-check[data-state="in"] { display: inline-block; animation: t-check-fade var(--check-opacity-dur) var(--check-ease-opacity) forwards, t-check-rotate var(--check-rotate-dur) var(--check-ease-rotate) forwards, t-check-blur var(--check-blur-dur) var(--check-ease-out) forwards, t-check-bob var(--check-bob-dur) var(--check-ease-bob) forwards; }
.t-success-check[data-state="in"] svg path { animation: t-check-draw var(--check-path-dur) var(--check-ease-path) var(--check-path-delay) forwards; }
@keyframes t-check-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes t-check-rotate { from { transform: rotate(var(--check-rotate-from)); } to { transform: rotate(0); } }
@keyframes t-check-blur { from { filter: blur(var(--check-blur-from)); } to { filter: blur(0); } }
@keyframes t-check-bob { from { translate: 0 var(--check-y-amount); } to { translate: 0 0; } }
@keyframes t-check-draw { to { stroke-dashoffset: 0; } }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (min-width: 641px) { .board { border-right: 1px solid var(--line); border-left: 1px solid var(--line); } }
@media (min-width: 768px) {
  .board { max-width: 800px; }
  .sheet { max-width: 800px; }
  .columns, .token-row { grid-template-columns: minmax(108px, 1fr) 54px repeat(4, minmax(48px, 58px)) minmax(56px, 64px); column-gap: 8px; }
  .spark { width: 54px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .t-icon-swap .t-icon, .t-panel-slide, .chevron, .detail-wrap { transition: none !important; }
  .t-success-check { animation: none !important; opacity: 1; }
  .t-success-check svg path { animation: none !important; stroke-dashoffset: 0 !important; }
}
