:root {
  --bg: #07060b;
  --panel: #100d18;
  --panel2: #181325;
  --line: #221b33;
  --line2: #2f2645;
  --text: #f1edf9;
  --mute: #9a91b0;
  --dim: #645b7a;
  --accent: #8a1dfb;
  --accent-text: #a970ff;
  --accent-ink: #ffffff;
  --accent-bg: rgba(138, 29, 251, 0.16);
  --long: #3ee08f;
  --long-bg: rgba(62, 224, 143, 0.12);
  --short: #ff5c7a;
  --short-bg: rgba(255, 92, 122, 0.12);
  --warn: #f5b83d;
  --mono: "Fragment Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Satoshi", system-ui, -apple-system, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--sans); letter-spacing: -0.006em; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--long); }
.down { color: var(--short); }
.mute { color: var(--mute); }
.dim { color: var(--dim); }

/* ---------------------------------------------------------------- rail + top bar */
.rail { position: fixed; inset: 0 auto 0 0; width: 64px; z-index: 30; background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 14px 0; }
.rail .brand { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--panel2); border: 1px solid var(--line2); }
.rail .brand img { width: 30px; height: 30px; display: block; }
.mk-bg { fill: var(--accent); }
.mk-line { stroke: var(--accent-ink); stroke-width: 2.4; stroke-linecap: round; }
.mk-dot { fill: var(--accent-ink); }
.rail nav { display: flex; flex-direction: column; gap: 6px; }
.rail nav a { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--mute); }
.rail nav a span { position: absolute; left: 52px; white-space: nowrap; background: var(--panel2); border: 1px solid var(--line2); padding: 5px 9px; border-radius: 8px; font-size: 12px; color: var(--text); opacity: 0; pointer-events: none; transition: opacity .12s; }
.rail nav a:hover span { opacity: 1; }
.rail svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rail nav a:hover { color: var(--text); background: var(--panel2); }
.rail nav a.on { color: var(--accent-text); background: var(--accent-bg); }
.rail-cta { margin-top: 4px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.shell { margin-left: 64px; min-width: 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 20px; background: rgba(7, 6, 11, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.word { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 20px; letter-spacing: -0.03em; color: var(--text); }
.word img { width: 24px; height: 24px; display: none; }
.search { flex: 1; max-width: 460px; display: flex; align-items: center; gap: 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; height: 40px; color: var(--dim); }
.search:focus-within { border-color: var(--accent); }
.search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); min-width: 0; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.net { white-space: nowrap; font: 500 11px var(--mono); color: var(--accent-text); padding: 4px 9px; border: 1px solid rgba(138, 29, 251, 0.5); border-radius: 999px; }
.net:empty { display: none; }
@media (max-width: 980px) { .net { display: none; } }

.btn { border: 1px solid var(--line2); background: var(--panel2); padding: 9px 16px; border-radius: 12px; font-weight: 600; }
.btn:hover { border-color: #3a414a; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.wallet { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); white-space: nowrap; font-family: var(--mono); font-weight: 500; font-size: 13px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.long { background: var(--long); border-color: var(--long); color: #05210f; }
.btn.short { background: var(--short); border-color: var(--short); color: #2a0610; }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* ---------------------------------------------------------------- tape */
.tape { height: 32px; overflow: hidden; border-bottom: 1px solid var(--line); background: var(--panel); display: flex; align-items: center; }
.tape-in { display: flex; gap: 26px; white-space: nowrap; padding-left: 20px; font: 12px var(--mono); animation: tape 60s linear infinite; }
.tape-in:empty::before { content: "No trades yet."; color: var(--dim); }
.tape-in span b { font-weight: 600; color: var(--text); margin-right: 6px; }
@keyframes tape { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .tape-in { animation: none; } }

/* ---------------------------------------------------------------- layout */
main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 80px; }
.boot { color: var(--mute); padding: 80px 0; text-align: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.panel-h small { font: 500 11px var(--mono); color: var(--dim); text-transform: lowercase; }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 6px 0 20px; flex-wrap: wrap; }
.hero h1 { font-size: 40px; letter-spacing: -0.035em; line-height: 1.05; margin: 0 0 10px; font-weight: 700; }
.hero p { margin: 0; color: var(--mute); max-width: 560px; }

.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 18px; }
.stats.three { grid-template-columns: repeat(3, 1fr); }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat label { display: block; font-size: 11px; color: var(--dim); margin-bottom: 4px; }
.stat .v { font: 600 19px var(--mono); letter-spacing: -0.02em; }
.stat .s { font: 11px var(--mono); color: var(--mute); margin-top: 2px; }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }

/* ---------------------------------------------------------------- market map */
.map { display: flex; flex-wrap: wrap; gap: 3px; padding: 10px; }
.tile { min-width: 84px; height: 64px; border-radius: 6px; padding: 8px 9px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border: 1px solid transparent; }
.tile:hover { border-color: rgba(255, 255, 255, 0.25); }
.tile b { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { font: 11px var(--mono); }

/* ---------------------------------------------------------------- tables */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: 11px; color: var(--dim); padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.row { cursor: pointer; }
tbody tr.row:hover td { background: var(--panel2); }
td.r, th.r { text-align: right; }
.coin { display: flex; align-items: center; gap: 10px; min-width: 0; }
.coin img, .coin .ph { width: 26px; height: 26px; border-radius: 50%; background: var(--panel2); flex: none; object-fit: cover; }
.coin b { font-weight: 600; }
.coin small { display: block; color: var(--dim); font-size: 11px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.tag { font: 500 10px var(--mono); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line2); color: var(--mute); }
.tag.curve { color: var(--warn); border-color: rgba(245, 184, 61, 0.3); }
.oi { display: flex; height: 6px; width: 90px; border-radius: 3px; overflow: hidden; background: var(--panel2); margin-left: auto; }
.oi i { display: block; height: 100%; }
.oi .l { background: var(--long); }
.oi .s { background: var(--short); }
.ls { display: inline-flex; gap: 4px; }
.ls button { width: 28px; height: 26px; border-radius: 6px; border: 1px solid var(--line2); background: var(--panel2); font: 600 12px var(--mono); }
.ls button.l:hover { background: var(--long-bg); border-color: var(--long); color: var(--long); }
.ls button.s:hover { background: var(--short-bg); border-color: var(--short); color: var(--short); }

/* ---------------------------------------------------------------- feed */
.feed { max-height: 640px; overflow-y: auto; }
.ev { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.ev:last-child { border-bottom: 0; }
.ev b { font-weight: 600; }
.ev .k { font: 12px var(--mono); }
.ev .t { font: 11px var(--mono); color: var(--dim); text-align: right; }
.empty { padding: 26px 14px; color: var(--dim); text-align: center; font-size: 13px; }

/* ---------------------------------------------------------------- coin page */
.coinhead { display: flex; align-items: center; gap: 16px; margin: 4px 0 16px; flex-wrap: wrap; }
.coinhead img, .coinhead .ph { width: 44px; height: 44px; border-radius: 50%; background: var(--panel2); }
.coinhead h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.coinhead .px { font: 600 24px var(--mono); }
.coinhead .kv { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; }
.kv div label { display: block; font-size: 11px; color: var(--dim); }
.kv div span { font: 500 13px var(--mono); }
.chart { position: relative; height: 360px; padding: 6px 4px 0; }
.chart canvas { width: 100%; height: 100%; display: block; }
.legend { display: flex; gap: 14px; font: 11px var(--mono); color: var(--mute); }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 5px; }

.ticket { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--bg); padding: 4px; border-radius: 9px; border: 1px solid var(--line); }
.sides button { border: 0; background: transparent; padding: 9px; border-radius: 6px; font-weight: 600; color: var(--mute); }
.sides button.on.l { background: var(--long); color: #05210f; }
.sides button.on.s { background: var(--short); color: #2a0610; }
.field label { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); margin-bottom: 6px; }
.amt { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 0 12px; }
.amt:focus-within { border-color: #4a525c; }
.amt input { flex: 1; background: none; border: 0; outline: 0; padding: 11px 0; font: 500 16px var(--mono); min-width: 0; }
.amt span { font: 12px var(--mono); color: var(--mute); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { flex: 1; border: 1px solid var(--line2); background: var(--panel2); border-radius: 7px; padding: 7px 0; font: 500 12px var(--mono); color: var(--mute); }
.chips button.on { border-color: var(--accent); color: var(--accent-text); background: var(--accent-bg); }
.quote { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 7px; font-size: 12px; }
.quote div { display: flex; justify-content: space-between; }
.quote span:first-child { color: var(--mute); }
.quote span:last-child { font-family: var(--mono); }
.note { font-size: 12px; color: var(--mute); line-height: 1.5; }
.err { color: var(--short); font-size: 12px; min-height: 16px; }

.pos-pnl { font: 600 13px var(--mono); }
.side { font: 600 11px var(--mono); padding: 2px 6px; border-radius: 4px; }
.side.l { color: var(--long); background: var(--long-bg); }
.side.s { color: var(--short); background: var(--short-bg); }

/* ---------------------------------------------------------------- pool + how */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.prose { padding: 4px 18px 18px; color: #c7cbd1; max-width: 760px; }
.prose h2 { font-size: 17px; margin: 22px 0 6px; color: var(--text); letter-spacing: -0.01em; }
.prose p, .prose li { margin: 0 0 10px; }
.prose ul { padding-left: 18px; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: var(--panel2); padding: 1px 5px; border-radius: 4px; }
.rules { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.rule { padding: 16px; }
.rule .n { font: 600 11px var(--mono); color: var(--dim); }
.rule h3 { margin: 6px 0 6px; font-size: 15px; }
.rule p { margin: 0; color: var(--mute); font-size: 13px; }

.toast { position: fixed; right: 18px; bottom: 18px; max-width: 360px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 12px 14px; font-size: 13px; opacity: 0; transform: translateY(8px); transition: 0.2s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: none; }
.toast.bad { border-color: rgba(255, 79, 97, 0.5); }
.toast a { text-decoration: underline; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
  .cols { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .rail { display: none; }
  .shell { margin-left: 0; }
  .word { font-size: 0; gap: 0; }
  .word img { display: block; width: 28px; height: 28px; }
  .search { max-width: none; min-width: 0; }
  .search input { width: 100%; }
  .btn.wallet { padding: 9px 12px; font-size: 12px; }
  .toast { left: 16px; right: 16px; bottom: 64px; max-width: none; }
  .board { grid-template-columns: 1fr; }
  .top { gap: 10px; padding: 0 16px; }
  main { padding: 16px 16px 60px; }
  .hero h1 { font-size: 25px; }
  .stats, .stats.three, .stats.four { grid-template-columns: repeat(2, 1fr); }
  .two { grid-template-columns: 1fr; }
  .hide-s { display: none; }
  .tablewrap { overflow-x: auto; }
  .coinhead .kv { margin-left: 0; }
  .chart { height: 260px; }
}
.mnav { display: none; }
@media (max-width: 720px) {
  .mnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); z-index: 30; }
  .mnav a { flex: 1; text-align: center; padding: 12px 0; font-size: 12px; color: var(--mute); }
  .mnav a.on { color: var(--text); }
}

/* ---------------------------------------------------------------- coin cards (pump.fun board) */
.sect { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 10px; }
.sect h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.sect small { font: 11px var(--mono); color: var(--dim); }
.trend { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.trend::-webkit-scrollbar { display: none; }
.tcard { position: relative; border-radius: 18px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); height: 150px; display: flex; flex-direction: column; justify-content: flex-end; padding: 14px; }
.tcard .bgimg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.45; filter: saturate(1.1); }
.tcard::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,6,11,0) 20%, rgba(7,6,11,0.92)); }
.tcard > * { position: relative; z-index: 1; }
.tcard b { font-size: 16px; }
.tcard .row2 { display: flex; justify-content: space-between; font: 12px var(--mono); color: var(--mute); margin-top: 4px; }
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.ccard { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; border-radius: 16px; border: 1px solid transparent; cursor: pointer; }
.ccard:hover { background: var(--panel); border-color: var(--line2); }
.ccard .img { width: 84px; height: 84px; border-radius: 12px; background: var(--panel2) center/cover; }
.ccard .nm { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.ccard .nm b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccard .nm small { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccard .mc { font: 600 13px var(--mono); margin: 4px 0 6px; display: flex; gap: 8px; align-items: baseline; }
.ccard .mc span { font-weight: 400; font-size: 12px; }
.bar { height: 6px; border-radius: 3px; background: var(--panel2); display: flex; overflow: hidden; }
.bar i { display: block; height: 100%; }
.bar .l { background: var(--long); }
.bar .s { background: var(--short); margin-left: auto; }
.ccard .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 7px; font: 11px var(--mono); color: var(--dim); }
.pill { border: 0; border-radius: 999px; padding: 4px 11px; font: 600 11px var(--sans); }
.pill.l { background: var(--long-bg); color: var(--long); }
.pill.s { background: var(--short-bg); color: var(--short); }
.pill.l:hover { background: var(--long); color: #05210f; }
.pill.s:hover { background: var(--short); color: #2a0610; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line2); background: transparent; color: var(--mute); padding: 6px 13px; border-radius: 999px; font-weight: 500; font-size: 13px; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.hero h1 .hl { color: var(--accent-text); }
.acts { display: inline-flex; gap: 4px; flex: none; }
.ccard .foot { gap: 8px; }
.ccard .foot > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 1000px) { .hide-m { display: none; } }

/* ---------------------------------------------------------------- wallet picker */
#wsheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; }
.wback { position: absolute; inset: 0; background: rgba(4, 3, 8, 0.72); backdrop-filter: blur(4px); }
.wcard { position: relative; width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 20px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.whead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 17px; }
.wx { border: 0; background: var(--panel2); width: 32px; height: 32px; border-radius: 10px; font-size: 18px; color: var(--mute); }
.wlist { display: grid; gap: 8px; }
.wrow { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 1px solid var(--line2); background: var(--panel2); text-align: left; width: 100%; }
.wrow:hover { border-color: var(--accent); }
.wrow img { width: 30px; height: 30px; border-radius: 8px; background: var(--bg); }
.wrow span { font-weight: 600; flex: 1; }
.wrow small { font: 11px var(--mono); color: var(--accent-text); }
a.wrow small { color: var(--dim); }

/* ---------------------------------------------------------------- $LAPO contract address */
.ca { display: inline-flex; align-items: center; gap: 10px; margin-top: 16px; max-width: 100%; padding: 6px 6px 6px 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line2); }
.ca img { width: 24px; height: 24px; flex: none; }
.ca b { font-weight: 700; color: var(--accent-text); flex: none; }
.ca code { font: 13px var(--mono); color: var(--mute); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; }
.ca-copy { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--accent); color: var(--accent-ink); padding: 7px 11px; border-radius: 10px; font-weight: 600; font-size: 13px; }
.ca-copy svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.ca-link { flex: none; font-size: 13px; color: var(--mute); padding: 7px 6px; }
.ca-link:hover { color: var(--text); }
@media (max-width: 720px) { .ca-link { display: none; } }
.hero > div { min-width: 0; max-width: 100%; }
.ca { display: flex; width: fit-content; }
.toast { max-width: min(360px, calc(100vw - 32px)); }
