/* skx.finance — cool paper, ink, cobalt */
:root {
  --paper: #EEF0F4;
  --sheet: #FFFFFF;
  --ink: #161B3D;
  --ink-2: #4A5070;
  --ink-3: #7D8299;
  --line: #D9DCE5;
  --cobalt: #2E46F5;
  --cobalt-ink: #1B2FC9;
  --cobalt-wash: #E3E7FE;
  --up: #0B8A5E;
  --down: #C23A1D;
  --r-panel: 18px;
  --r-field: 12px;
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --step--1: .8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.75rem, 6vw, 4.5rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
h1 { font-size: var(--step-3); font-weight: 800; letter-spacing: -.02em; }
h2 { font-size: var(--step-1); font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
a { color: var(--cobalt-ink); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
[hidden] { display: none !important; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--paper);
  position: sticky; top: 0; z-index: 20;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-size: var(--step-1); font-weight: 800; letter-spacing: -.02em; }
.brand b { font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  text-decoration: none; color: var(--ink-2); font-weight: 600;
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); background: #E2E5EC; }
.tabs a[aria-current="page"] { color: #fff; background: var(--ink); }
.top-right { display: flex; align-items: center; gap: 8px; }
.lang { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-weight: 600; font-size: var(--step--1); cursor: pointer; color: var(--ink-2); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 11px 20px;
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cobalt); color: #fff; }
.btn-primary:hover { background: var(--cobalt-ink); }
.btn-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-ghost:hover { background: var(--ink); color: #fff; }
.btn-small { padding: 6px 14px; font-size: var(--step--1); }
.btn-wide { width: 100%; padding: 16px 20px; font-size: var(--step-1); margin-top: 16px; white-space: normal; }
.btn[disabled] { background: #D5D8E1; color: var(--ink-3); cursor: not-allowed; box-shadow: none; }
.btn.busy { position: relative; color: transparent !important; }
.btn.busy::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid #fff; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 8px; border-radius: 10px; cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: var(--step--1); }
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.link-btn { background: none; border: 0; padding: 0; color: var(--cobalt-ink); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; font-size: var(--step--1); }

/* ---------- banners ---------- */
.netwarn, .cfgwarn {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 16px; font-weight: 600; font-size: var(--step--1);
}
.netwarn { background: #FFE9E2; color: var(--down); }
.cfgwarn { background: var(--cobalt-wash); color: var(--cobalt-ink); }

/* ---------- layout ---------- */
main { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 40px) 64px; }
.page-head { max-width: 62ch; margin-bottom: 28px; }
.page-head p { color: var(--ink-2); margin-top: 10px; font-size: var(--step-1); line-height: 1.45; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.panel { background: var(--sheet); border-radius: var(--r-panel); padding: 22px; border: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }

/* ---------- trade ---------- */
.trade-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 28px; align-items: start; }
.price-head { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 24px; align-items: end; }
.ticker { display: flex; align-items: center; gap: 12px; grid-column: 1 / -1; margin-bottom: 14px; }
.ticker-sym { font-weight: 800; font-size: var(--step-1); }
.ticker-pair { color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.ticker-name { color: var(--ink-2); font-size: var(--step--1); }
.price-big { font-size: var(--step-4); font-weight: 800; letter-spacing: -.045em; line-height: .95; }
.price-sub { color: var(--ink-2); font-weight: 600; padding-bottom: 6px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 28px 0 22px; border-top: 1.5px solid var(--ink); }
.stats > div { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); }
.stats dt { color: var(--ink-2); font-size: var(--step--1); }
.stats dd { margin: 2px 0 0; font-size: var(--step-1); font-weight: 700; letter-spacing: -.01em; }
.stats-3 { max-width: 760px; }

.chart { background: var(--sheet); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; height: 440px; position: relative; }
.chart iframe { width: 100%; height: 100%; border: 0; display: block; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 32px; text-align: center; color: var(--ink-3); max-width: 46ch; margin: auto; }
.token-links { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }

/* swap card */
.swap { position: sticky; top: 84px; box-shadow: 0 1px 0 var(--line), 0 24px 48px -28px rgba(22, 27, 61, .35); }
.field { background: var(--paper); border-radius: var(--r-field); padding: 14px 16px; border: 1.5px solid transparent; }
.field:focus-within { border-color: var(--cobalt); background: #F6F7FA; }
.field-top { display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); font-size: var(--step--1); font-weight: 600; }
.bal { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: var(--step--1); font-weight: 600; cursor: pointer; }
button.bal:hover { color: var(--cobalt-ink); text-decoration: underline; }
.field-row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.amount {
  flex: 1; min-width: 0; width: 100%; background: none; border: 0; outline: none;
  font-size: var(--step-3); font-weight: 700; letter-spacing: -.03em; padding: 0;
}
.amount::placeholder { color: #B9BDCB; }
.asset, .asset-tag {
  background: var(--sheet); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; font-weight: 700; flex: none;
}
.asset { cursor: pointer; appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23161B3D' stroke-width='2'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.flip { display: grid; place-items: center; margin: -10px auto; position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 12px; border: 4px solid var(--sheet); background: var(--ink); color: #fff; cursor: pointer; }
.flip:hover { background: var(--cobalt); }
.plus { text-align: center; font-weight: 700; color: var(--ink-3); margin: 6px 0; }
.quote { margin: 14px 2px 0; display: grid; gap: 6px; font-size: var(--step--1); }
.quote > div, .kv > div { display: flex; justify-content: space-between; gap: 16px; }
.quote dt, .kv dt { color: var(--ink-2); }
.quote dd, .kv dd { margin: 0; font-weight: 600; text-align: right; }
.impact-high { color: var(--down); }
.fine { color: var(--ink-3); font-size: var(--step--1); text-align: center; margin-top: 12px; }
.hint { color: var(--ink-2); font-size: var(--step--1); margin-top: 10px; }

/* segmented */
.seg { display: inline-flex; gap: 4px; background: var(--paper); padding: 4px; border-radius: 999px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 999px; font-weight: 600; cursor: pointer; color: var(--ink-2); font-size: var(--step--1); }
.seg button.on, .seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg-wide { display: flex; margin-bottom: 16px; }
.seg-wide button { flex: 1; padding: 10px; font-size: var(--step-0); }
.slip { background: var(--paper); border-radius: var(--r-field); padding: 12px 14px; margin-bottom: 12px; font-size: var(--step--1); font-weight: 600; }
.slip .seg { background: var(--sheet); margin-top: 8px; }
.slip-custom { display: inline-flex; align-items: center; gap: 2px; padding: 0 8px; }
.slip-custom input { width: 64px; border: 0; background: none; outline: none; font-weight: 600; text-align: right; }

/* liquidity */
.kv { display: grid; gap: 10px; margin: 0; }
.remove { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.remove label { display: flex; justify-content: space-between; font-weight: 600; }
.remove output { font-size: var(--step-2); font-weight: 800; }
.remove input[type=range] { width: 100%; accent-color: var(--cobalt); margin: 10px 0; }

/* stake */
.stake-hero { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; flex-wrap: wrap; }
.stake-hero p { color: var(--ink-2); margin-top: 10px; font-size: var(--step-1); max-width: 52ch; }
.apr-figure { text-align: right; }
.apr-figure span { display: block; font-size: clamp(3.5rem, 9vw, 6.5rem); font-weight: 800; letter-spacing: -.05em; line-height: .9; color: var(--cobalt); }
.apr-figure small { color: var(--ink-2); font-weight: 600; font-size: var(--step-0); }
.earned { font-size: var(--step-3); font-weight: 800; letter-spacing: -.03em; }
.earned .sym { font-size: var(--step-1); color: var(--ink-2); font-weight: 600; letter-spacing: 0; }
.earned-usd { color: var(--ink-2); margin-bottom: 18px; min-height: 1.5em; }

/* buy */
.buy-grid { display: grid; grid-template-columns: 300px 1fr; gap: 28px; align-items: start; }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 22px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; }
.steps li::before { content: counter(s); grid-row: span 2; width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; }
.steps span { color: var(--ink-2); font-size: var(--step--1); }
.buy-frame { padding: 0; overflow: hidden; min-height: 640px; display: grid; }
.buy-frame iframe { width: 100%; height: 680px; border: 0; }
.empty { padding: 32px; color: var(--ink-2); align-self: center; text-align: center; max-width: 48ch; margin: auto; }

/* referral */
.ref-link { max-width: 760px; margin-bottom: 8px; }
.ref-link label { font-weight: 700; }
.ref-link .field-row { margin-top: 10px; }
.ref-link input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: var(--r-field); border: 1px solid var(--line); background: var(--paper); font-weight: 600; }

/* footer */
.foot { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 22px clamp(16px, 4vw, 40px); border-top: 1px solid var(--line); color: var(--ink-2); font-size: var(--step--1); }
.foot-links { display: flex; gap: 16px; }
.foot-risk { flex-basis: 100%; color: var(--ink-3); max-width: 80ch; }

/* toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 60; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: var(--step--1); font-weight: 500; box-shadow: 0 12px 32px -12px rgba(0,0,0,.4); animation: tin .2s ease-out; }
.toast a { color: #AEB9FF; }
.toast.err { background: var(--down); }
.toast.ok { background: var(--up); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .trade-grid { grid-template-columns: minmax(0, 1fr); }
  .swap { position: static; order: -1; }
  .two-col, .buy-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: 10px 12px; }
  .tabs { order: 3; flex-basis: 100%; }
  .top-right { margin-left: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand { flex: 1; font-size: var(--step-0); }
  .top-right .btn { padding: 8px 14px; font-size: var(--step--1); }
  .price-big { font-size: 2.75rem; }
  .chart { height: 360px; }
  .apr-figure { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}
