/* ------------------------------------------------------------ header rail */
.site-header { position: sticky; top: 0; z-index: 50; padding: 12px var(--inset) 0; }
.rail {
  max-width: 1280px;
  margin-inline: auto;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 10px 8px 20px;
  border-radius: 999px;
  background: var(--rail);
  border: 1px solid var(--rail-border);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  box-shadow: 0 4px 16px rgba(40, 70, 110, 0.06);
}
.brand { display: inline-flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); transition: transform 0.5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-14deg); }
.brand-word { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: -0.04em; }
.brand-word b { font-weight: 700; color: var(--accent); }
.nav { display: flex; gap: 2px; }
.nav a { position: relative; padding: 7px 12px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: background 0.15s, color 0.15s; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current='page'] { color: var(--ink); }
.nav a[aria-current='page']::after { content: ''; position: absolute; left: 50%; bottom: 2px; width: 16px; height: 2px; border-radius: 2px; background: var(--accent); transform: translateX(-50%); }
.rail-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.icon-btn.menu-toggle { display: none; }
.mobile-nav { max-width: 1280px; margin: 8px auto 0; padding: 8px; border-radius: 22px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow-pop); }
.mobile-nav a { display: block; padding: 12px 14px; border-radius: 12px; font-size: 16px; font-weight: 500; }
.mobile-nav a[aria-current='page'], .mobile-nav a:hover { background: var(--surface-2); color: var(--accent); }
@media (max-width: 980px) {
  .nav { display: none; }
  .icon-btn.menu-toggle { display: inline-flex; }
}
@media (max-width: 640px) {
  .rail { gap: 8px; padding: 6px 6px 6px 14px; }
  .rail-actions { gap: 2px; }
  .rail-actions #ccyWrap, .rail-actions #themeBtn { display: none; }
  .brand-word { font-size: 17px; }
}
.mobile-extra { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px 6px; border-top: 1px solid var(--rule); margin-top: 6px; }
.menu-toggle { flex-direction: column; justify-content: center; gap: 5px; }
.menu-toggle span { display: block; width: 16px; height: 1.6px; background: currentColor; border-radius: 2px; transition: transform 0.25s var(--ease); }
.menu-toggle[aria-expanded='true'] span:first-child { transform: translateY(3.3px) rotate(45deg); }
.menu-toggle[aria-expanded='true'] span:last-child { transform: translateY(-3.3px) rotate(-45deg); }

/* ------------------------------------------------------------ buttons */
.pill-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 18px; border-radius: 999px;
  border: 1px solid var(--rule-2); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: transform 0.12s var(--ease), background 0.15s, border-color 0.15s, box-shadow 0.15s, filter 0.15s;
}
.pill-btn:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.pill-btn:active { transform: scale(0.97); }
.pill-btn.primary { background: linear-gradient(120deg, var(--accent), var(--accent-deep)); color: #fff; border-color: transparent; box-shadow: 0 10px 26px -14px var(--accent); }
:root[data-theme='dark'] .pill-btn.primary { color: var(--accent-ink); }
.pill-btn.primary:hover { filter: brightness(1.08); }
.pill-btn.ink { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill-btn.ghost { background: transparent; border-color: transparent; }
.pill-btn.ghost:hover { background: var(--surface-2); }
.pill-btn.buy { background: var(--up); border-color: var(--up); color: #fff; }
.pill-btn.sell { background: var(--down); border-color: var(--down); color: #fff; }
:root[data-theme='dark'] .pill-btn.buy, :root[data-theme='dark'] .pill-btn.sell { color: #0a0c11; }
.pill-btn.lg { min-height: 50px; padding: 12px 26px; font-size: 15.5px; }
.pill-btn.sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.pill-btn.block { width: 100%; }
.pill-btn.connected { background: var(--accent-wash); color: var(--accent); border-color: transparent; box-shadow: none; }
.pill-btn:disabled { transform: none; filter: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: var(--ink-2); transition: background 0.15s, color 0.15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme='dark'] .i-moon, :root:not([data-theme='dark']) .i-sun { display: none; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; }
.chip-btn:hover { color: var(--ink); border-color: var(--rule-2); }
kbd { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border: 1px solid var(--rule-2); border-bottom-width: 2px; border-radius: 5px; font: 11px var(--font-mono); color: var(--ink-3); background: var(--surface); }
.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ tape */
.tape { position: relative; max-width: 1280px; margin: 10px auto 0; overflow: hidden; border-radius: 999px; border: 1px solid var(--rail-border); background: var(--rail); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.tape-track { display: flex; width: max-content; animation: tape var(--dur, 60s) linear infinite; }
.tape:hover .tape-track, .tape:focus-within .tape-track { animation-play-state: paused; }
.tape a { display: inline-flex; align-items: center; gap: 8px; padding: 7px 16px; font: 12px var(--font-mono); white-space: nowrap; border-right: 1px solid var(--rule); }
.tape a:hover { background: var(--accent-wash); }
.tape b { font-weight: 600; }
.tape .tape-img { width: 18px; height: 18px; border-radius: 6px; object-fit: cover; }
@keyframes tape { to { transform: translate3d(-50%, 0, 0); } }

/* ------------------------------------------------------------ cards */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-panel); padding: clamp(18px, 2.4vw, 26px); box-shadow: var(--shadow-card); }
.panel.tight { padding: 16px 18px; }
.coin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 18px; }
.coin-card {
  position: relative; display: flex; flex-direction: column;
  border-radius: var(--r-card); background: var(--surface); border: 1px solid var(--rule);
  box-shadow: var(--shadow-card); overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
  animation: rise 0.5s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 35ms);
}
.coin-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: var(--rule-2); }
.coin-card .well {
  position: relative; height: 150px; display: grid; place-items: center;
  background:
    radial-gradient(60% 70% at 50% 45%, color-mix(in srgb, var(--hue) 34%, transparent), transparent 72%),
    linear-gradient(180deg, color-mix(in srgb, var(--hue) 12%, var(--surface)), var(--surface));
}
.coin-card .well img, .coin-card .well .mono-art { width: 84px; height: 84px; border-radius: 24px; object-fit: cover; box-shadow: 0 14px 30px -12px color-mix(in srgb, var(--hue) 70%, transparent); animation: bob 5.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -0.7s); }
.coin-card .corner { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: center; }
.coin-card .body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.coin-card h3 { font-size: 17px; }
.coin-card .pair { font: 500 12px var(--font-mono); color: var(--ink-3); }
.coin-card .pair b { color: var(--ink); font-weight: 600; }
.coin-card .figs { display: flex; justify-content: space-between; align-items: baseline; font: 13px var(--font-mono); }
.coin-card .cover::after { content: ''; position: absolute; inset: 0; }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-1.5deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.mono-art { display: grid; place-items: center; color: #fff; font: 700 26px var(--font-display); background: linear-gradient(135deg, var(--hue), color-mix(in srgb, var(--hue) 55%, #000)); }

.progress { position: relative; height: 5px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--accent); transition: width 0.5s var(--ease); }
.progress.hot i { background: linear-gradient(90deg, var(--accent), var(--gold)); }
.progress.done i { background: var(--gold); }

.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface); border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.tag.live { color: var(--up); background: var(--up-wash); border-color: transparent; }
.tag.pool { color: var(--gold); background: var(--gold-wash); border-color: transparent; }
.tag.chain { color: var(--accent); background: var(--accent-wash); border-color: transparent; }
.tag.new { color: var(--down); background: var(--down-wash); border-color: transparent; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px transparent; opacity: 0.55; } }

.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border-radius: 20px; border: 1px solid var(--rule); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-card); }
.stat-strip > div { padding: 16px 20px; box-shadow: 1px 0 0 var(--rule), 0 1px 0 var(--rule); }
.stat-l { font-size: 12px; color: var(--ink-3); }
.stat-v { font: 500 clamp(17px, 1.9vw, 24px) var(--font-mono); letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.art { width: 44px; height: 44px; border-radius: 13px; object-fit: cover; flex-shrink: 0; }
.art.sm { width: 28px; height: 28px; border-radius: 9px; font-size: 12px; }
.art.lg { width: 72px; height: 72px; border-radius: 20px; font-size: 26px; }
.mono-tile { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font: 600 9.5px var(--font-mono); color: #fff; background: linear-gradient(135deg, var(--hue), color-mix(in srgb, var(--hue) 60%, #000)); flex-shrink: 0; letter-spacing: -0.03em; }

/* ------------------------------------------------------------ segmented / inputs */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex-shrink: 0; padding: 6px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed='true'] { background: var(--ink); color: var(--bg); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-3); }
.error { font-size: 12.5px; font-weight: 500; color: var(--down); }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: var(--r);
  border: 1px solid var(--rule-2); background: var(--surface-2); color: var(--ink); font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-wash); }
.input[aria-invalid='true'] { border-color: var(--down); }
.input.num { font-family: var(--font-mono); }
.affix { position: relative; }
.affix .input { padding-right: 78px; }
.affix > span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font: 600 12.5px var(--font-mono); color: var(--ink-3); pointer-events: none; }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23889' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search .input { padding-left: 38px; border-radius: 999px; min-height: 40px; background: var(--surface); }
input[type='range'] { accent-color: var(--accent); width: 100%; }
.notice { display: flex; gap: 10px; padding: 12px 16px; border-radius: var(--r); border-left: 3px solid var(--accent); background: var(--accent-wash); font-size: 13.5px; color: var(--ink-2); }
.notice.warn { border-left-color: var(--gold); background: var(--gold-wash); }
.notice.bad { border-left-color: var(--down); background: var(--down-wash); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 18px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; padding: 10px 14px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-3); background: var(--surface-2); border-bottom: 1px solid var(--rule); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
td.r, td.m { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }
.rowlink { position: relative; }
.rowlink a.cover::after { content: ''; position: absolute; inset: 0; }
.rowlink:focus-within { outline: 2px solid var(--focus); outline-offset: -2px; }

/* ------------------------------------------------------------ modal / palette / menus */
dialog.modal { width: min(440px, calc(100vw - 24px)); padding: 0; border: 1px solid var(--rule-2); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
dialog.modal.wide { width: min(620px, calc(100vw - 24px)); }
dialog.modal[open] { animation: pop 0.24s var(--ease); }
dialog.modal::backdrop { background: var(--scrim); backdrop-filter: blur(6px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.modal-head h2 { font-size: 20px; }
.modal-body { padding: 4px 20px 20px; max-height: min(70vh, 640px); overflow-y: auto; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.wallet-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--rule); background: var(--surface-2); font-weight: 600; text-align: left; transition: transform 0.15s var(--ease), border-color 0.15s; animation: rise 0.35s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); }
.wallet-opt:hover { transform: translateX(3px); border-color: var(--accent); }
.wallet-opt img { width: 30px; height: 30px; border-radius: 8px; }
.palette-input { width: 100%; border: 0; border-bottom: 1px solid var(--rule); background: transparent; padding: 18px 20px; font-size: 17px; }
.palette-input:focus { outline: none; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: min(420px, 55vh); overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; cursor: pointer; }
.palette-list li[aria-selected='true'] { background: var(--accent-wash); }
.palette-list .meta { margin-left: auto; font: 12px var(--font-mono); color: var(--ink-3); }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 220px; max-height: 340px; overflow-y: auto; padding: 6px; border-radius: 16px; border: 1px solid var(--rule-2); background: var(--surface); box-shadow: var(--shadow-pop); animation: pop 0.16s var(--ease); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; text-align: left; }
.menu button:hover, .menu button[aria-selected='true'] { background: var(--surface-2); }

/* ------------------------------------------------------------ toasts & feed */
.toasts { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(460px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 14px; font-weight: 500; box-shadow: var(--shadow-pop); pointer-events: auto; animation: toast 0.24s var(--ease); max-width: 100%; }
.toast a { text-decoration: underline; }
.toast.bad { background: var(--down); color: #fff; }
@keyframes toast { from { opacity: 0; transform: translateY(18px); } }
.live-feed { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; width: 300px; pointer-events: none; }
.live-feed .item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow-lift); pointer-events: auto; animation: rise 0.35s var(--ease); font-size: 13px; }
@media (max-width: 760px) { .live-feed { display: none; } }

/* ------------------------------------------------------------ states */
.skel { display: block; border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sweep 1.4s ease-in-out infinite; }
@keyframes sweep { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; text-align: center; border: 1.5px dashed var(--rule-2); border-radius: 22px; }
.empty p { max-width: 440px; }

/* ------------------------------------------------------------ footer */
.site-footer { margin-top: 60px; border-top: 1px solid var(--rule); background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(10px); }
.foot-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; padding-block: 44px 28px; }
.foot-tag { margin-top: 12px; max-width: 360px; font-size: 13.5px; }
.foot-col { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.foot-col a:hover { color: var(--accent); }
.foot-head { font: 500 11px var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.foot-bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-block: 18px 28px; border-top: 1px solid var(--rule); }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-grid > :first-child { grid-column: 1 / -1; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }

/* ------------------------------------------------------------ baskets */
.basket-chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 3px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--rule)); background: var(--accent-wash); color: var(--accent); font: 600 12px var(--font-mono); letter-spacing: 0.02em; white-space: nowrap; }
.basket-chip:hover { border-color: var(--accent); }
.basket-chip.lg { font-size: 14px; padding: 4px 12px 4px 4px; }
.basket-chip.lg .comp-dot { width: 20px; height: 20px; }
.comp-dot { width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--surface) 70%, transparent); }
.comp-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.comp-bar i { display: block; height: 100%; min-width: 3px; }
.comp-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; }
.comp-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.comp-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.stock-tile { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font: 700 10px var(--font-mono); color: #fff; background: linear-gradient(135deg, var(--hue), color-mix(in srgb, var(--hue) 55%, #000)); flex-shrink: 0; }
