/* Hyperliquid-style tokens (same set as perpfun, sampled from app.hyperliquid.xyz) */
:root {
  --bg: #0f1a1f;
  --panel: #0f1a1f;
  --raise: #1b2429;
  --line: #273035;
  --line-soft: #1b2429;
  --text: #f6fefd;
  --muted: #949e9c;
  --accent: #50d2c1;
  --accent-ink: #04201b;
  --green: #1fa67d;
  --green-text: #50d2c1;
  --red: #ed7088;
  --red-bg: #3a2329;
  --r: 8px;
  --gut: 16px;
  font-family: Inter, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--green-text); }
.down { color: var(--red); }
.muted { color: var(--muted); }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 20; min-height: 56px; display: flex; align-items: center; gap: 28px;
  padding: env(safe-area-inset-top) var(--gut) 0; background: var(--bg); border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
.brand em { color: var(--accent); font-style: italic; font-weight: 600; }
.nav { display: flex; gap: 22px; }
.nav a { color: var(--text); font-weight: 500; padding: 18px 0; }
.nav a.on { color: var(--accent); }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.chip { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.chip.live { color: var(--accent); border-color: #1f4a45; }
.chip-bank { color: var(--text); background: var(--raise); }
.btn { border: 1px solid var(--line); background: var(--raise); border-radius: var(--r); padding: 9px 16px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-red { background: var(--red-bg); border-color: #5b2f39; color: var(--red); }

main { padding: 12px var(--gut) var(--gut); max-width: 1560px; margin: 0 auto; min-height: 70vh; }
.foot { display: flex; justify-content: space-between; gap: 12px; padding: 18px var(--gut) calc(18px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; border-top: 1px solid var(--line-soft); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 22px; padding: 0 14px; border-bottom: 1px solid var(--line-soft); overflow-x: auto; scrollbar-width: none; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 0; color: var(--muted); cursor: pointer; white-space: nowrap; font-weight: 500; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- market bar ---------- */
.mbar { display: flex; align-items: center; gap: 26px; padding: 10px 14px; margin-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.coins { display: flex; gap: 4px; }
.coins button { background: none; border: 1px solid transparent; border-radius: 6px; padding: 7px 10px; font-weight: 700; font-size: 15px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.coins button.on { color: var(--text); background: var(--raise); border-color: var(--line); }
.coins button:disabled { cursor: not-allowed; }
.mstat small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; white-space: nowrap; border-bottom: 1px dashed #3a474d; width: fit-content; }
.mstat span { font-size: 13px; white-space: nowrap; }

/* ---------- desk grid ---------- */
.desk { display: grid; grid-template-columns: minmax(0, 1fr) 290px 340px; gap: 8px; }
.chart-panel { display: flex; flex-direction: column; min-height: 520px; }
.chart-top { display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.chart-top b { font-size: 18px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; margin-left: auto; }
.legend i { display: inline-block; width: 14px; border-top: 2px dashed; vertical-align: 3px; margin-right: 6px; }
.legend .lb i { border-color: var(--green-text); }
.legend .la i { border-color: var(--red); }
.chart { position: relative; flex: 1; min-height: 360px; margin: 6px 4px 0; }
.chart canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.round-strip { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-soft); }
.round-strip div { padding: 10px 14px; }
.round-strip div + div { border-left: 1px solid var(--line-soft); }
.round-strip small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.round-strip span { font-size: 16px; font-weight: 600; }

/* order book */
.book { font-size: 12px; }
.book-row { position: relative; display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 3px 14px; }
.book-row span:not(:first-child) { text-align: right; }
.book-row .bar { position: absolute; top: 1px; bottom: 1px; right: 0; opacity: .16; pointer-events: none; }
.book-row.ask .bar { background: var(--red); }
.book-row.bid .bar { background: var(--green-text); }
.book-row.ask span:first-child { color: var(--red); }
.book-row.bid span:first-child { color: var(--green-text); }
.book-row.mine { outline: 1px solid var(--accent); outline-offset: -1px; border-radius: 3px; }
.book-row.mine span:first-child::after { content: ' ◂ you'; color: var(--accent); font-size: 10px; }
.book-head { color: var(--muted); padding: 8px 14px 4px; }
.book-spread { display: flex; justify-content: space-between; padding: 6px 14px; background: var(--raise); color: var(--muted); margin: 3px 0; }
.trades .book-row span:last-child { color: var(--muted); }
.yours { padding: 10px 14px; border-top: 1px solid var(--line-soft); display: grid; gap: 6px; font-size: 12px; }
.yours div { display: flex; justify-content: space-between; gap: 8px; }
.yours small { color: var(--muted); }

/* strategy panel */
.strat { display: flex; flex-direction: column; }
.critter { position: relative; height: 150px; border-bottom: 1px solid var(--line-soft); overflow: hidden; border-radius: var(--r) var(--r) 0 0;
  background: #0d2124 url(../assets/topo.jpg) center / cover; }
.critter img { position: absolute; left: 50%; bottom: -6px; height: 150px; transform: translateX(-50%); transition: filter 1.2s ease; }
.critter .mood { position: absolute; left: 12px; top: 10px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.critter .adapt { position: absolute; right: 12px; top: 10px; font-size: 11px; color: var(--muted); }
.strat-body { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.field label { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.field label b { color: var(--text); font-weight: 600; }
.field input[type=range] { width: 100%; accent-color: var(--accent); margin: 0; }
.field p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { background: none; border: 0; padding: 8px 6px; color: var(--muted); cursor: pointer; font-size: 13px; }
.seg button.on { background: #13332f; color: var(--accent); }
.seg button:disabled { cursor: not-allowed; }
.go { padding: 14px; font-size: 15px; width: 100%; }
.rows { border-top: 1px solid var(--line-soft); padding-top: 12px; display: grid; gap: 7px; font-size: 13px; }
.rows div { display: flex; justify-content: space-between; gap: 12px; }
.rows div span:first-child { color: var(--muted); }

/* bottom */
.bottom { margin-top: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table td { padding: 8px 14px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.table .r { text-align: right; }
.scroll-x { overflow-x: auto; max-height: 300px; overflow-y: auto; }
.empty { padding: 22px 14px; color: var(--muted); }
.log { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 12px; padding: 8px 14px; max-height: 300px; overflow-y: auto; }
.log div { padding: 3px 0; color: var(--muted); }
.log div b { color: var(--text); font-weight: 500; }

/* round summary */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(5, 12, 14, .72); }
.modal[hidden] { display: none; }
.card { width: min(440px, 100%); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.card .critter { height: 170px; border-radius: 0; }
.card .critter img { height: 170px; }
.card-body { padding: 18px; display: grid; gap: 14px; }
.card-body h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.big { font-size: 34px; font-weight: 700; letter-spacing: -.02em; }
.vs { background: var(--raise); border-radius: var(--r); padding: 12px; font-size: 13px; color: var(--muted); line-height: 1.45; }
.vs b { color: var(--text); }
.card-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-btns .btn { padding: 12px; text-align: center; }

/* lore */
.lore { max-width: 980px; margin: 0 auto; }
.lore-hero { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 3 / 2; max-height: 520px; width: 100%; background: #0d2124; }
.lore-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lore h1 { font-size: clamp(30px, 5vw, 48px); letter-spacing: -.03em; line-height: 1.05; margin: 28px 0 10px; }
.lore h1 em { color: var(--accent); }
.lore .lead { color: var(--muted); font-size: 16px; line-height: 1.55; max-width: 640px; margin: 0 0 24px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 32px 0 12px; }
.cards4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.lcard { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.lcard small { color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.lcard b { font-size: 15px; }
.lcard p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; flex: 1; }
.lcard a { color: var(--muted); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.post { padding: 18px; display: grid; gap: 10px; }
.post .who { display: flex; gap: 8px; align-items: baseline; }
.post q { font-size: 18px; line-height: 1.45; }
.post a { color: var(--accent); font-size: 13px; }
.hlp { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hlp div { padding: 16px; }
.hlp div + div { border-left: 1px solid var(--line-soft); }
.hlp small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.hlp span { font-size: 22px; font-weight: 700; }
.rules { padding: 6px 18px; }
.rules li { color: var(--muted); line-height: 1.55; margin: 8px 0; }
.rules li b { color: var(--text); font-weight: 600; }
.cta-row { display: flex; gap: 8px; margin: 28px 0 8px; }

.sticky-go { display: none; }

/* ---------- agent ---------- */
.agent-strip { display: flex; align-items: center; gap: 18px; padding: 10px 14px; margin-top: 8px; cursor: pointer; }
.agent-strip:hover { border-color: #3a474d; }
.agent-strip img { width: 44px; height: 44px; object-fit: contain; transition: filter 1.2s ease; }
.as-text { display: grid; gap: 2px; min-width: 0; }
.as-text b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-text small { color: var(--accent); font-size: 12px; }
.as-stat { border-left: 1px solid var(--line-soft); padding-left: 18px; }
.as-stat small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.as-stat span { font-size: 16px; font-weight: 600; }
.as-go { margin-left: auto; color: var(--accent); font-weight: 600; white-space: nowrap; }
.agent { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 8px; }
.agent-side { display: flex; flex-direction: column; }
.critter-lg { height: 220px; }
.critter-lg img { height: 220px; }
.ag-head { padding: 14px 14px 6px; display: grid; gap: 2px; }
.ag-head b { font-size: 18px; }
.ag-rows { padding: 10px 14px 12px; border-top: 0; }
.brain { border-top: 1px solid var(--line-soft); padding: 12px 14px; }
.brain .kicker { margin: 0 0 10px; }
.reads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.reads small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.reads span { font-size: 14px; font-weight: 600; }
.mode { margin-top: 12px; background: #13332f; color: var(--accent); border-radius: 6px; padding: 8px 10px; font-size: 13px; font-weight: 600; }
.ag-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px 14px 14px; margin-top: auto; }
.ag-btns .btn { text-align: center; padding: 12px 8px; }
.agent-main { display: flex; flex-direction: column; min-height: 520px; }
.agent-main .chart { min-height: 260px; height: 260px; flex: none; }
.talk { padding: 6px 14px 10px; max-height: 360px; overflow-y: auto; }
.say { display: grid; grid-template-columns: 62px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.say p { margin: 0; line-height: 1.45; }
.say span { font-size: 12px; padding-top: 1px; }
.say.warn p { color: var(--red); }
.say.open p { color: var(--accent); }
.agent-note { font-size: 12px; line-height: 1.5; margin: 12px 2px 0; max-width: 900px; }

.ag-badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 6px; }
.ag-badges .chip { font-size: 11px; padding: 4px 8px; }
.ag-range { margin-left: auto; }
.ag-range button { padding: 5px 10px; font-size: 12px; }
.days-table td.r small { color: var(--muted); }

/* ---------- landing ---------- */
.land { max-width: 1180px; margin: 0 auto; display: grid; gap: 28px; padding-top: 10px; }
.hero-l { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 28px; align-items: center; }
.hero-copy { display: grid; gap: 18px; min-width: 0; }
.hero-copy > * { min-width: 0; }
.eyebrow { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-l h1 { font-size: clamp(34px, 4.6vw, 56px); letter-spacing: -.035em; line-height: 1.02; margin: 0; }
.hero-l h1 em { color: var(--accent); font-style: italic; }
.hero-l .lead { color: var(--muted); font-size: 16px; line-height: 1.55; margin: 0; max-width: 520px; }
.hero-ctas { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-ctas .btn { padding: 13px 20px; font-size: 15px; }
.hero-note { font-size: 12px; }
.hero-art { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 3 / 2; background: #0d2124; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.strip-l { display: grid; grid-template-columns: repeat(4, 1fr); }
.strip-l > div { padding: 14px 16px; }
.strip-l > div + div { border-left: 1px solid var(--line-soft); }
.strip-l small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.strip-l span.num { font-size: 20px; font-weight: 600; }
.strip-l span.num small { font-size: 12px; font-weight: 400; display: inline; margin-left: 4px; }
.two-l { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-l { padding: 22px; display: flex; flex-direction: column; gap: 12px; cursor: pointer; }
.card-l:hover { border-color: #3a474d; }
.card-l h2 { margin: 0; font-size: 24px; letter-spacing: -.02em; }
.card-l p { margin: 0; color: var(--muted); line-height: 1.5; }
.card-l .kicker { margin: 0; }
.card-l .link { color: var(--accent); font-weight: 600; margin-top: auto; }
.ticks { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.ticks li::before { content: '✓  '; color: var(--accent); }
.mini-mkts { margin-top: 6px; }
.mini-mkts th, .mini-mkts td { padding: 9px 4px; }
.mini-mkts td:first-child { padding-left: 0; }
.mini-mkts th:first-child { padding-left: 0; }
.card-agent { padding: 0; }
.critter-land { height: 200px; border-radius: var(--r) var(--r) 0 0; }
.critter-land img { height: 200px; }
.card-l-body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.talk-l .say { grid-template-columns: 56px 1fr; padding: 7px 0; font-size: 12px; }
.talk-l .say:last-child { border-bottom: 0; }
.lore-l .kicker, .how-l .kicker { margin-top: 0; }
.how-l { padding: 22px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.steps b { display: block; font-size: 15px; margin-bottom: 6px; }
.steps p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.how-l .cta-row { margin: 20px 0 0; }
.lore-l .cta-row { margin: 12px 0 0; }

@media (max-width: 860px) {
  .hero-l { grid-template-columns: minmax(0, 1fr); }
  .hero-art { order: -1; }
  .two-l { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .strip-l { grid-template-columns: 1fr 1fr; }
  .strip-l > div:nth-child(3) { border-left: 0; }
  .strip-l > div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}

/* ---------- contract address ---------- */
.ca-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--r); padding: 6px 6px 6px 12px; max-width: 520px; background: var(--raise); }
.ca-label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; }
.ca-addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 13px ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: var(--text); }
.ca-copy { padding: 7px 14px; font-size: 13px; }
.ca-copy.done, .ca-mini.done { color: var(--accent); border-color: #1f4a45; }
.ca-links { display: flex; gap: 16px; font-size: 13px; }
.ca-links a { color: var(--accent); }
.foot-right { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
#foot-ca code { font: 12px ui-monospace, Menlo, Consolas, monospace; color: var(--text); }
.ca-mini { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 8px; font-size: 11px; color: var(--muted); cursor: pointer; }

/* ---------- tablet / phone ---------- */
@media (max-width: 1180px) {
  .desk { grid-template-columns: minmax(0, 1fr) 300px; }
  .chart-panel { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .desk { grid-template-columns: 1fr; }
  .agent { grid-template-columns: 1fr; }
  .agent-main { min-height: 0; }
  .agent-strip { flex-wrap: wrap; gap: 12px 16px; }
  .as-go { width: 100%; margin-left: 0; }
  .chart-panel { min-height: 0; }
  .chart { min-height: 260px; height: 260px; flex: none; }
  .cards4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .top { gap: 12px; }
  .nav { gap: 14px; }
  .brand { font-size: 16px; gap: 6px; }
  .brand em { display: none; }
  .chip-bank { display: none; }
  .round-strip { grid-template-columns: 1fr 1fr; }
  .round-strip div:nth-child(3) { border-left: 0; }
  .round-strip div:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
  .legend { margin-left: 0; width: 100%; }
  .cards4 { grid-template-columns: 1fr; }
  .hlp { grid-template-columns: 1fr; }
  .hlp div + div { border-left: 0; border-top: 1px solid var(--line-soft); }
  .foot { flex-direction: column; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .strat .go { display: none; }
  .sticky-go {
    display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 12px var(--gut) calc(12px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
  }
  .sticky-go small { display: block; color: var(--muted); font-size: 11px; }
  .sticky-go b { font-size: 17px; }
  .sticky-go .btn { padding: 15px 8px; font-size: 16px; }
}
