:root {
  color-scheme: dark;
  --bg: #090c0e; --panel: #0d1114; --line: #283039; --line-soft: #1b2228;
  --gold: #f7b928; --gold-2: #ffca45; --text: #f3f5f8; --muted: #8f9aab;
  --green: #31d68b; --red: #ff6178; --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 75% -10%, rgba(247,185,40,.07), transparent 34%), var(--bg); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }

.topbar { height: 72px; padding: 0 clamp(20px, 4vw, 64px); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; border-bottom: 1px solid var(--line-soft); background: rgba(9,12,14,.92); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 20; }
.brand { display: inline-flex; align-items: center; gap: 12px; width: fit-content; font-weight: 900; letter-spacing: .14em; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--gold); color: var(--gold); letter-spacing: -.1em; font: 800 13px var(--mono); transform: rotate(45deg); }
.brand-mark + span { font-size: 15px; }
.topbar nav { height: 100%; display: flex; align-items: center; gap: 32px; color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.topbar nav a { height: 100%; display: grid; place-items: center; border-bottom: 2px solid transparent; }
.topbar nav a:hover, .topbar nav a.active { color: var(--text); border-bottom-color: var(--gold); }
.wallet-button { justify-self: end; min-height: 42px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--gold); background: transparent; color: var(--gold); padding: 0 18px; font-size: 12px; font-weight: 900; letter-spacing: .05em; }
.wallet-button:hover { background: var(--gold); color: #090c0e; }

main { width: min(1500px, calc(100% - 40px)); margin: 0 auto 80px; }
.token-head { min-height: 150px; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); }
.coin-orbit { width: 76px; height: 76px; border: 1px solid var(--gold); display: grid; place-items: center; position: relative; transform: rotate(45deg); background: rgba(247,185,40,.035); }
.coin-orbit::before, .coin-orbit::after { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(247,185,40,.35); }
.coin-orbit::after { inset: 19px; background: var(--gold); }
.coin-orbit span { z-index: 1; color: #0a0d0f; font: 900 22px var(--mono); transform: rotate(-45deg); }
.token-flags { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font: 800 10px var(--mono); letter-spacing: .08em; }
.token-flags span { padding: 5px 7px; border: 1px solid var(--line); }
.token-flags .rank { color: var(--gold); border-color: rgba(247,185,40,.5); }
.privacy-dot::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 9px var(--green); }
.token-head h1 { margin: 8px 0 2px; font-size: clamp(30px, 4vw, 52px); line-height: .95; text-transform: uppercase; letter-spacing: -.04em; }
.token-head h1 small { color: #5f6975; font-size: .36em; letter-spacing: 0; }
.token-head p { margin: 10px 0 0; color: var(--muted); font: 12px var(--mono); }
.head-stat { min-width: 145px; padding-left: 25px; border-left: 1px solid var(--line); }
.head-stat label, .side-stats label, .curve-summary label { display: block; color: var(--muted); font: 800 10px var(--mono); letter-spacing: .11em; text-transform: uppercase; }
.head-stat label span { color: var(--gold); }
.head-stat strong { display: block; margin-top: 8px; font: 800 24px var(--mono); }
.head-stat small { color: var(--muted); font: 11px var(--mono); }

.market-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 20px; align-items: start; padding-top: 20px; }
.market-main { display: grid; gap: 20px; min-width: 0; }
.chart-panel, .activity-panel, .curve-panel, .trade-card { background: rgba(13,17,20,.9); border: 1px solid var(--line); }
.chart-panel { min-height: 470px; padding: 18px 20px 12px; }
.ohlc { display: flex; flex-wrap: wrap; gap: 18px; min-height: 26px; color: #65717d; font: 10px var(--mono); }
.ohlc b { color: #b8c0ca; font-weight: 500; }
.chart-tabs { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 14px; }
.chart-tabs > div { display: flex; }
.chip { min-height: 30px; padding: 0 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 800 10px var(--mono); }
.chip + .chip { border-left: 0; }
.chip.active { color: #090c0e; background: var(--gold); border-color: var(--gold); }
.chart-wrap { height: 365px; position: relative; overflow: hidden; }
#marketChart { display: block; width: 100%; height: 100%; overflow: visible; }
.grid-lines { stroke: #1a2025; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--gold); stroke-width: 2; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 5px rgba(247,185,40,.35)); }
.chart-area { fill: url(#chartFill); }
.last-point { fill: var(--gold); stroke: #fff4d4; stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: #545f6a; font: 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; }

.section-title { min-height: 62px; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.section-title h2 { margin: 0; font-size: 15px; text-transform: uppercase; letter-spacing: .08em; }
.section-title span { color: var(--muted); font-size: 11px; }
.trade-table { font: 12px var(--mono); }
.trade-row { min-height: 48px; padding: 0 20px; display: grid; grid-template-columns: .6fr 1.2fr 1fr .8fr; align-items: center; gap: 12px; border-bottom: 1px solid var(--line-soft); }
.trade-row:last-child { border-bottom: 0; }
.trade-row span:nth-child(n+2) { text-align: right; }
.trade-row .buy { color: var(--green); }
.trade-row .sell { color: var(--red); }
.table-head { color: #606b77; min-height: 38px; font-size: 9px; font-weight: 800; }
.empty-row { padding: 45px 20px; text-align: center; color: var(--muted); font-size: 12px; }

.curve-summary { display: grid; grid-template-columns: 1fr 1.5fr; border-bottom: 1px solid var(--line); }
.curve-summary > div { min-height: 105px; padding: 22px 20px; }
.curve-summary > div + div { border-left: 1px solid var(--line); }
.curve-summary strong { display: block; margin: 12px 0 6px; color: var(--gold); font: 800 20px var(--mono); }
.curve-summary small { color: var(--muted); }
.curve-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font: 12px var(--mono); }
th, td { padding: 14px 20px; border-bottom: 1px solid var(--line-soft); text-align: right; }
th:first-child, td:first-child { text-align: left; }
th { color: #68737e; font-size: 9px; letter-spacing: .08em; }
td:first-child { color: var(--gold); font-weight: 900; }
.curve-note { margin: 0; padding: 18px 20px 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }

.trade-card { position: sticky; top: 92px; overflow: hidden; }
.asset-line { height: 72px; padding: 0 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.mini-coin { width: 34px; height: 34px; display: grid; place-items: center; background: var(--gold); color: #090c0e; font: 900 15px var(--mono); transform: rotate(45deg); }
.asset-line > div:nth-child(2) { display: grid; gap: 3px; }
.asset-line strong { font-size: 13px; letter-spacing: .08em; }
.asset-line span { color: var(--muted); font: 9px var(--mono); text-transform: uppercase; }
.sync-status { color: var(--green) !important; }
.side-stats { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.side-stats > div { min-height: 73px; padding: 16px 18px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.side-stats > div:nth-child(even) { border-right: 0; }
.side-stats > div:nth-last-child(-n+2) { border-bottom: 0; }
.side-stats strong { display: block; margin-top: 9px; font: 700 12px var(--mono); }
.trade-tabs { display: grid; grid-template-columns: 1fr 1fr; }
.trade-tabs button { height: 52px; border: 0; border-bottom: 1px solid var(--line); background: #0b0f12; color: #64707c; font: 900 12px var(--mono); }
.trade-tabs button.active { background: var(--gold); color: #090c0e; }
.trade-pane { padding: 22px 18px; }
.trade-pane > label, .input-label { color: var(--muted); font: 800 10px var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.input-label { display: flex; justify-content: space-between; }
.amount-box { height: 70px; display: flex; align-items: center; margin-top: 9px; padding: 0 16px; border: 1px solid #3a444e; background: #090c0e; }
.amount-box:focus-within { border-color: var(--gold); }
.amount-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 800 28px var(--mono); }
.amount-box b { color: var(--gold); font: 900 12px var(--mono); }
.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 8px; }
.quick-row button { min-height: 34px; border: 1px solid var(--line); border-right: 0; background: transparent; color: var(--muted); font: 700 9px var(--mono); }
.quick-row button:last-child { border-right: 1px solid var(--line); }
.quick-row button:hover { color: var(--gold); border-color: var(--gold); }
.receive-box { margin: 18px 0; padding: 15px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.receive-box label { color: var(--muted); font: 800 9px var(--mono); text-transform: uppercase; }
.receive-box strong { display: block; margin: 7px 0; font: 800 18px var(--mono); }
.receive-box small { color: #65717d; font-size: 10px; }
.address-input, select, textarea.secret { width: 100%; border: 1px solid #303942; outline: 0; background: #090c0e; color: var(--text); }
.address-input { height: 46px; margin: 8px 0 14px; padding: 0 12px; font: 11px var(--mono); }
.address-input:focus, select:focus, textarea.secret:focus { border-color: var(--gold); }
select { height: 46px; margin: 9px 0 4px; padding: 0 12px; font: 11px var(--mono); }
.action-button, .gold-button { width: 100%; min-height: 54px; border: 1px solid var(--gold); background: var(--gold); color: #080b0d; font-weight: 950; letter-spacing: .06em; }
.action-button:hover, .gold-button:hover { background: var(--gold-2); }
.wallet-balance { min-height: 62px; padding: 13px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.wallet-balance span { color: var(--muted); font: 8px var(--mono); }
.wallet-balance strong { font: 700 11px var(--mono); }
.trust-line { padding: 0 18px 17px; display: flex; align-items: center; gap: 7px; color: #64707c; font-size: 10px; }
.trust-line span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }

.payment-sheet { margin-top: 15px; padding: 18px; border: 1px solid var(--gold); background: #080b0d; text-align: center; }
.payment-sheet h3 { margin: 0 0 14px; font-size: 14px; }
.payment-sheet img { display: block; margin: 0 auto 15px; background: #fff; }
.payment-line { display: flex; justify-content: space-between; margin: 8px 0; color: var(--muted); font-size: 11px; }
.payment-line b { color: var(--text); }
.payment-sheet code { display: block; padding: 10px; overflow-wrap: anywhere; border: 1px solid var(--line); color: var(--muted); font-size: 9px; text-align: left; }
.payment-actions { display: grid; grid-template-columns: 1fr 1fr; margin-top: 10px; }
.payment-actions a, .payment-actions button, .simulate-button { min-height: 39px; display: grid; place-items: center; border: 1px solid var(--line); background: transparent; color: var(--text); font: 800 9px var(--mono); }
.payment-actions button { border-left: 0; }
.simulate-button { width: 100%; margin-top: 10px; border-color: #614c19; color: var(--gold); }

.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.82); backdrop-filter: blur(7px); }
.wallet-modal { position: relative; width: min(1020px, 100%); max-height: calc(100vh - 48px); overflow-y: auto; padding: clamp(28px, 5vw, 54px); border: 1px solid #222a31; background: #090d10; box-shadow: 0 30px 100px rgba(0,0,0,.7); }
.modal-close { position: absolute; top: 17px; right: 20px; border: 0; background: transparent; color: var(--muted); font-size: 44px; font-weight: 300; line-height: 1; }
.modal-kicker { margin: 0 0 26px; color: var(--gold); font-size: 14px; font-weight: 950; letter-spacing: .2em; }
.wallet-modal h2 { margin: 0 0 64px; font-size: clamp(38px, 6vw, 64px); line-height: .98; letter-spacing: -.04em; }
.wallet-types { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.wallet-types article { min-height: 275px; padding: 35px 30px; border: 1px solid #303a43; }
.wallet-types article.token-wallet { border-color: var(--gold); }
.wallet-types article > span { display: inline-block; padding: 8px 14px; background: #121820; color: #dbe0e8; font-size: 12px; font-weight: 950; letter-spacing: .12em; }
.wallet-types article.token-wallet > span { background: var(--gold); color: #090c0e; }
.wallet-types h3 { margin: 24px 0 18px; font-size: 23px; }
.wallet-types p { margin: 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.modal-assurance { margin: 38px 0; color: var(--muted); font-size: 21px; font-weight: 900; }
.modal-copy { color: var(--muted); font-size: 18px; line-height: 1.55; }
.modal-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 32px; }
.outline-button, .danger-button { min-height: 56px; border: 1px solid #35404b; background: transparent; color: var(--text); font-weight: 900; }
.danger-button { color: var(--red); border-color: #5b2630; }
.wallet-modal > div > label, #restoreBox > label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 12px; font-weight: 800; }
textarea.secret { min-height: 110px; padding: 15px; resize: vertical; font: 14px/1.8 var(--mono); }
.connected-wallet { min-height: 82px; padding: 18px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; border: 1px solid var(--line); }
.connected-wallet span { color: var(--green); font: 900 10px var(--mono); }
.connected-wallet strong, .connected-wallet b { font: 12px var(--mono); }
#backupBox { margin-top: 22px; padding: 22px; border: 1px solid var(--gold); }
#backupBox p { margin-top: 0; color: var(--muted); line-height: 1.6; }
.check-line { margin: 14px 0 !important; color: var(--text) !important; }
.check-line input { accent-color: var(--gold); }

#toast { position: fixed; left: 50%; bottom: 25px; z-index: 200; max-width: calc(100% - 40px); padding: 14px 18px; opacity: 0; transform: translate(-50%, 25px); pointer-events: none; border: 1px solid var(--gold); background: #11161b; color: var(--text); font-size: 12px; transition: .22s ease; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { display: none; }
  .token-head { grid-template-columns: auto 1fr; padding: 24px 0; }
  .head-stat { min-width: 0; border-left: 0; border-top: 1px solid var(--line); padding: 18px 0 0; }
  .market-layout { grid-template-columns: 1fr; }
  .trade-card { position: static; grid-row: 1; }
}
@media (max-width: 620px) {
  main { width: min(100% - 24px, 1500px); }
  .topbar { height: 62px; padding: 0 12px; gap: 10px; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-mark + span { display: none; }
  .wallet-button { max-width: 245px; min-height: 38px; padding: 0 12px; font-size: 10px; }
  .token-head { grid-template-columns: 56px 1fr; gap: 15px; }
  .coin-orbit { width: 52px; height: 52px; }
  .coin-orbit::after { inset: 14px; }
  .token-head h1 { font-size: 34px; }
  .head-stat strong { font-size: 19px; }
  .chart-panel { min-height: 365px; padding: 14px 10px; }
  .chart-wrap { height: 285px; }
  .ohlc { gap: 8px; }
  .trade-row { grid-template-columns: .6fr 1.3fr .9fr; padding: 0 12px; font-size: 10px; }
  .trade-row span:last-child { display: none; }
  .curve-summary { grid-template-columns: 1fr; }
  .curve-summary > div + div { border-left: 0; border-top: 1px solid var(--line); }
  th, td { padding: 12px 14px; }
  .modal { padding: 0; }
  .wallet-modal { width: 100%; max-height: 100vh; min-height: 100vh; padding: 32px 20px; border: 0; }
  .modal-kicker { margin-bottom: 18px; font-size: 11px; }
  .wallet-modal h2 { margin-bottom: 35px; font-size: 38px; }
  .wallet-types { grid-template-columns: 1fr; gap: 12px; }
  .wallet-types article { min-height: 0; padding: 25px 22px; }
  .wallet-types p { font-size: 15px; }
  .modal-assurance { margin: 25px 0; font-size: 17px; }
  .modal-copy { font-size: 15px; }
  .modal-actions { grid-template-columns: 1fr; gap: 10px; }
  .connected-wallet { grid-template-columns: 1fr; gap: 8px; }
}
