/* Public trading UI: the page scrolls as a whole, only the token list is pinned. */
body { overflow-x: hidden; }

/* ---------- top bar ---------- */
.topbar {
  height: 64px; display: flex; align-items: center; gap: 20px; padding: 0 16px;
}
.logo { display: flex; align-items: center; min-width: 120px; }
.search {
  position: relative; flex: 1; max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--border-2); }
.search-ico { color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; }
.search input::placeholder { color: var(--muted); }
.kbd {
  display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border-radius: 6px;
  background: var(--panel-3); color: var(--muted); font-size: 11px; font-weight: 600;
}
button.kbd:hover { color: var(--text); }
.search-results {
  position: absolute; z-index: 50; top: 50px; left: 0; right: 0; max-height: 420px; overflow: auto;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 12px; padding: 6px;
  box-shadow: 0 20px 50px rgba(0,0,0,.6);
}
.sr-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; }
.sr-item:hover, .sr-item.sel { background: var(--panel-3); }
.sr-item .sr-main { flex: 1; min-width: 0; }
.sr-item .sr-addr { font-size: 12px; color: var(--dim); }
.sr-empty { padding: 14px; color: var(--muted); text-align: center; }

.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 120px; justify-content: flex-end; }
.cash-box {
  display: flex; flex-direction: column; justify-content: center; height: 48px; padding: 0 12px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--border); font-size: 13px; line-height: 1.25;
}
.cash-box b { font-size: 14px; }
.link-btn { color: var(--accent); font-size: 12px; font-weight: 600; text-align: left; }
.avatar-btn { width: 44px; height: 44px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); display: grid; place-items: center; }
.avatar-dot { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #2ed47a); }

/* ---------- layout ---------- */
.layout {
  display: grid; grid-template-columns: 340px minmax(0, 1fr) 360px; gap: 12px; align-items: start;
  min-height: calc(100vh - 64px - 32px); padding: 0 12px 44px;
}

/* ---------- sidebar ---------- */
.sidebar {
  position: sticky; top: 10px; height: calc(100vh - 64px - 32px - 10px);
  display: flex; flex-direction: column; min-height: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.side-tabs { display: flex; gap: 4px; padding: 10px 10px 0; }
.side-tab { padding: 6px 8px; font-weight: 600; color: var(--muted); }
.side-tab.active { color: var(--text); }
.chips { display: flex; gap: 6px; padding: 10px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--muted); background: var(--panel-2); border: 1px solid var(--border);
}
.chip:hover { color: var(--text); }
.chip.active { color: var(--text); background: var(--panel-3); border-color: var(--border-2); }

.token-list { flex: 1; overflow-y: auto; padding: 6px; }
.tl-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 11px; cursor: pointer;
  transition: background .12s;
}
.tl-item:hover { background: var(--panel-2); }
.tl-item.active { background: var(--panel-3); }
.tl-mid { flex: 1; min-width: 0; }
.tl-sym { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.tl-sym .fire { font-size: 11px; }
.tl-price { color: var(--muted); font-size: 13px; }
.tl-right { text-align: right; white-space: nowrap; }
.tl-mc { font-weight: 700; }
.tl-mc small { font-weight: 600; font-size: 12px; margin-left: 2px; }
.tl-chg { font-size: 12px; font-weight: 600; }
.tl-empty { padding: 30px 16px; text-align: center; color: var(--muted); }
.skeleton-list { height: 100%; background: repeating-linear-gradient(180deg, var(--panel-2) 0 52px, transparent 52px 60px); opacity: .5; border-radius: 10px; }

/* ---------- center ---------- */
.center { min-width: 0; }
.token-head-wrap { container-type: inline-size; }
.token-view { display: flex; flex-direction: column; gap: 12px; }
.empty-state { min-height: calc(100vh - 140px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--muted); }
.empty-state a { color: var(--accent); }

.token-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.th-id { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.th-icon, .th-chain, .th-links, .th-row1 .chain-badge, .th-row1 .star { flex: none; }
.th-names { min-width: 0; flex: 1; }
.th-icon .ticon { width: 46px; height: 46px; }
.th-row1 { display: flex; align-items: center; gap: 8px; }
.th-symbol { font-size: 18px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-links { display: flex; gap: 2px; }
.th-links a { display: inline-flex; width: 26px; height: 26px; align-items: center; justify-content: center; border-radius: 7px; color: var(--muted); }
.th-links a:hover { background: var(--panel-3); color: var(--text); }
.th-links svg { width: 15px; height: 15px; }
.star svg { width: 17px; height: 17px; }
.star.on { color: #ffcc33; }
.star.on svg { fill: #ffcc33; }
.th-row2 { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.th-row2 #th-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-row3 { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.dot-sep::before { content: '·'; }
.addr-btn { color: var(--dim); font-size: 12px; display: inline-flex; gap: 4px; align-items: center; }
.addr-btn:hover { color: var(--text); }
.addr-btn svg { width: 12px; height: 12px; }

.th-stats { display: flex; gap: 6px; margin-left: auto; flex: none; }
.stat {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 76px; height: 50px; padding: 0 7px;
  border-radius: 11px; background: var(--panel-2); border: 1px solid var(--border);
}
.stat span { font-size: 12px; color: var(--muted); }
.stat b { font-size: 15px; font-weight: 700; white-space: nowrap; border-radius: 4px; padding: 0 3px; }
.stat-main { background: none; border-color: transparent; }
.stat-main b { font-size: 17px; }

@container (max-width: 850px) {
  .th-row3 .th-links, .th-row3 .dot-sep { display: none; }
}
@container (max-width: 700px) {
  .stat-change { display: none; }
  .stat { min-width: 70px; padding: 0 5px; }
  .stat b { font-size: 13px; }
}

/* chart */
.chart-card { display: flex; flex-direction: column; min-height: 480px; }
.chart-card.fullscreen { position: fixed; inset: 8px; z-index: 100; min-height: 0; }
.chart-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.chart-toolbar::-webkit-scrollbar { display: none; }
.chart-toolbar .seg, .chart-toolbar .tb-right { flex: none; }
.chart-demo { flex: none; padding: 2px 6px; border: 1px solid var(--border-2); border-radius: 5px; color: var(--muted); font-size: 10px; }
.seg { display: inline-flex; gap: 2px; }
.seg button { height: 28px; padding: 0 9px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button:hover { color: var(--text); }
.seg button.active { color: var(--text); background: var(--panel-3); }
.seg-text { align-items: center; gap: 4px; color: var(--dim); }
.seg-text button { padding: 0 2px; }
.seg-text button.active { background: none; color: var(--accent); }
.tb-sep { width: 1px; height: 20px; background: var(--border-2); }
.tb-right { margin-left: auto; display: flex; gap: 4px; }
.tb-btn { height: 28px; min-width: 28px; padding: 0 8px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.tb-btn:hover { color: var(--text); background: var(--panel-3); }
.tb-btn.active { color: var(--accent); background: var(--accent-soft); }
.tb-btn svg { width: 15px; height: 15px; }
.chart-wrap { position: relative; flex: 1; min-height: 0; }
.chart { position: absolute; inset: 0; }
.chart.loading { opacity: .45; transition: opacity .2s; }
.chart-legend { position: absolute; z-index: 3; left: 12px; right: 80px; top: 8px; font-size: 13px; pointer-events: none; line-height: 1.6; }
.chart-legend b { display: inline-block; max-width: min(240px, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.chart-status {
  position: absolute; z-index: 4; left: 50%; top: 46%; transform: translate(-50%, -50%);
  padding: 8px 14px; border-radius: 10px; background: rgba(20, 20, 27, .92); border: 1px solid var(--border-2);
  color: var(--muted); font-size: 13px; font-weight: 500; pointer-events: none; white-space: nowrap;
}
.chart-legend .ohlc { margin-left: 8px; }

/* activity */
.activity { display: flex; flex-direction: column; min-height: 360px; }
.tabs-row { display: flex; align-items: center; justify-content: space-between; padding: 0 12px; height: 46px; border-bottom: 1px solid var(--border); background: var(--panel-2); border-radius: var(--radius) var(--radius) 0 0; }
.tabs { display: flex; gap: 4px; }
.tabs button { height: 46px; padding: 0 10px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

.swaps { width: 100%; border-collapse: collapse; }
.swaps th { position: sticky; top: 0; text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 10px 12px; background: var(--panel); }
.swaps td { padding: 9px 12px; border-top: 1px solid rgba(255,255,255,.03); white-space: nowrap; }
.swaps .r { text-align: right; }
.swaps tr.new td { animation: flash-up 1.2s ease-out; }
.swaps tr.new.sell td { animation-name: flash-down; }
.trader { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.trader i { width: 26px; height: 26px; border-radius: 50%; flex: none; }
.trader:hover span { color: var(--accent); }
.badge { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 12px; font-weight: 700; }
.badge.buy { background: var(--green-bg); color: var(--green); }
.badge.sell { background: var(--red-bg); color: var(--red); }
.swaps-empty { padding: 28px; text-align: center; }

/* holders */
.holders .w-num { width: 40px; }
.holder-cell { display: flex; align-items: center; gap: 8px; }
.tag { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--panel-3); color: var(--muted); white-space: nowrap; }
.tag.pool { background: rgba(110, 140, 255, .14); color: #9fb2ff; }
.tag.insider { background: var(--red-bg); color: var(--red); }
.tag.contract, .tag.known { background: var(--accent-soft); color: var(--accent); }
.own { display: flex; flex-direction: column; gap: 5px; min-width: 110px; max-width: 180px; }
.own-bar { height: 4px; background: var(--panel-3); border-radius: 4px; overflow: hidden; }
.own-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.holders-foot { padding: 12px; font-size: 12px; border-top: 1px solid rgba(255,255,255,.03); }
.tab-pane { overflow-x: auto; }

.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 14px; }
.info-cell { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.info-cell span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.info-cell b { font-weight: 600; word-break: break-all; }
.info-cell a:hover { color: var(--accent); }

/* ---------- right bar ---------- */
.rightbar { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.trade-card { padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.trade-tabs { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.tt { height: 40px; border-radius: 10px; font-weight: 700; font-size: 15px; background: var(--panel-2); color: var(--muted); }
.tt.buy.active { background: var(--green-bg); color: var(--green); }
.tt.sell.active { background: var(--red-bg); color: var(--red); }
.amount {
  display: flex; align-items: center; gap: 2px; height: 68px; padding: 0 16px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--border); cursor: text;
}
.amount:focus-within { border-color: var(--border-2); }
.amount-prefix { font-size: 30px; font-weight: 700; color: var(--dim); }
.amount input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 30px; font-weight: 700; }
.amount input::placeholder { color: var(--dim); }
.amount-hint { font-size: 14px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button { height: 36px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--border); font-weight: 700; color: var(--muted); }
.quick button:hover { color: var(--text); border-color: var(--border-2); }
.trade-est { font-size: 13px; padding: 0 2px; }
.trade-btn { height: 46px; border-radius: 11px; font-size: 16px; font-weight: 700; transition: filter .15s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trade-btn.buy { background: var(--green); color: #04160c; }
.trade-btn.sell { background: var(--red); color: #1d0503; }
.trade-btn:hover { filter: brightness(1.08); }
.trade-note { text-align: center; font-size: 12px; }

.about { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.about h3, .positions h3 { margin: 0; font-size: 17px; }
.about h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.about-desc { margin: 0; color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.about-desc.open { -webkit-line-clamp: unset; }
.about-desc:empty { display: none; }
.read-more { color: var(--muted); font-weight: 600; font-size: 13px; text-decoration: underline; }
.windows { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.win { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 0; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12px; }
.win span { color: var(--muted); font-weight: 600; }
.win b { font-size: 12.5px; }
.win.active { background: var(--panel-3); border-color: var(--border-2); }
.flow { display: flex; flex-direction: column; gap: 12px; }
.flow-row .flow-labels { display: flex; justify-content: space-between; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.flow-bar { display: flex; gap: 4px; height: 5px; }
.flow-bar i { border-radius: 4px; transition: flex-grow .4s; }
.flow-bar .g { background: var(--green); }
.flow-bar .r { background: var(--red); }
.about-links { display: flex; flex-wrap: wrap; gap: 6px; }
.about-links a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.about-links a:hover { border-color: var(--border-2); }
.about-links svg { width: 14px; height: 14px; }

.positions { padding: 14px; min-height: 150px; }
.pos-head { display: flex; align-items: center; justify-content: space-between; }
.seg-small { background: var(--panel-2); border-radius: 8px; padding: 2px; }
.seg-small button { height: 24px; font-size: 12px; padding: 0 8px; }
.seg-small button.active { color: var(--accent); background: var(--panel-3); }
.pos-empty { text-align: center; padding: 34px 0 20px; }

/* ---------- footer ---------- */
.footer {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 16px;
  border-top: 1px solid var(--border); font-size: 12.5px; background: var(--bg);
}
.majors { display: flex; gap: 18px; overflow: hidden; white-space: nowrap; }
.major { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.major i { width: 15px; height: 15px; border-radius: 50%; display: inline-grid; place-items: center; font-style: normal; font-size: 9px; font-weight: 800; color: #000; }
.major small { font-size: 12px; }
.footer-right { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.footer-right a:hover { color: var(--text); }
.live-status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.live-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.live-status.live { color: var(--green); }
.live-status.live i { background: var(--green); box-shadow: 0 0 0 3px rgba(46,212,122,.18); }
.live-status.reconnecting { color: #f5b942; }
.live-status.reconnecting i { background: #f5b942; }

.only-mobile { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .layout { grid-template-columns: 300px minmax(0, 1fr) 330px; }
}
@media (max-width: 1140px) {
  .layout { grid-template-columns: 290px minmax(0, 1fr); }
  .rightbar { grid-column: 2; }
  .cash-box.hide-sm { display: none; }
}
@media (max-width: 820px) {
  body { overflow-x: hidden; }
  .topbar { gap: 8px; padding: 0 10px; }
  .logo { min-width: 0; flex: none; }
  .logo-mark { font-size: 22px; }
  .only-mobile { display: inline-flex; }
  .search { min-width: 0; padding: 0 10px; }
  .topbar-right { min-width: 0; flex: none; }
  .topbar-right .cash-box { display: none; }
  .avatar-btn { width: 40px; height: 40px; }
  .kbd { display: none; }
  .th-id, .th-names { min-width: 0; }
  .token-head { flex-direction: column; align-items: stretch; }
  .th-row1 { gap: 8px; }
  .chart-toolbar { overflow-x: auto; scrollbar-width: none; }
  .chart-toolbar::-webkit-scrollbar { display: none; }
  .tb-sep { display: none; }
  .tb-right { margin-left: 4px; }
  .chart-legend { right: 70px; }
  .chart-legend .ohlc { display: block; margin-left: 0; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 0 8px 10px; }
  .sidebar { position: fixed; z-index: 60; left: 0; top: 0; bottom: 32px; width: min(340px, 88vw); height: auto; border-radius: 0 var(--radius) var(--radius) 0; transform: translateX(-105%); transition: transform .2s; box-shadow: 20px 0 50px rgba(0,0,0,.6); }
  .sidebar.open { transform: none; }
  .rightbar { grid-column: 1; }
  .th-stats { margin-left: 0; }
  .stat { min-width: 0; flex: 1; }
  .chart-card { min-height: 380px; }
  .hide-sm { display: none; }
  .majors { gap: 12px; }
}
