:root {
  --bg: #0a0c0b;
  --panel: #111513;
  --panel2: #161b18;
  --line: #222a26;
  --text: #e9efe9;
  --dim: #8a978f;
  --paper: #f4ecd6;
  --green: #5cff8a;
  --green-d: #1f5f35;
  --red: #ff5d6c;
  --red-d: #5f1f27;
  --gold: #ffd166;
  --radius: 12px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 Inter, system-ui, sans-serif; }
body { min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
input { font: inherit; color: inherit; }
a { color: var(--green); text-decoration: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.up { color: var(--green); } .down { color: var(--red); }
[hidden] { display: none !important; }

/* header */
.top { display: flex; align-items: center; gap: 20px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: #0c0f0d; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; flex-direction: column; color: var(--text); }
.logo { font: 700 22px/1 'Space Grotesk', sans-serif; letter-spacing: .5px; background: var(--paper); color: #141414; padding: 4px 8px 3px; border-radius: 4px; transform: rotate(-2deg); box-shadow: 2px 2px 0 var(--green); }
.logo b { color: #0d8f3a; }
.tag { font-size: 11px; color: var(--dim); margin-top: 5px; letter-spacing: .3px; }
.round { display: flex; gap: 22px; margin: 0 auto; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat .k { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .6px; }
.stat .v { font: 600 18px/1.2 var(--mono); }
.timer .v { color: var(--gold); }
.timer.hot .v { color: var(--red); animation: pulse 1s infinite; }
.prize .v { color: var(--green); }
@keyframes pulse { 50% { opacity: .55; } }
.user { display: flex; align-items: center; gap: 10px; }
.btn { background: var(--green); color: #06210f; font-weight: 600; padding: 9px 14px; border-radius: 10px; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel2); object-fit: cover; }
.who { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); }

/* layout */
.grid { flex: 1; display: grid; grid-template-columns: 320px minmax(0, 1fr) 340px; gap: 12px; padding: 12px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.discover { display: flex; flex-direction: column; overflow: hidden; height: calc(100vh - 90px); position: sticky; top: 78px; }
.search { padding: 12px 12px 6px; }
.search input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; outline: none; }
.search input:focus { border-color: var(--green-d); }
.tabs { display: flex; gap: 4px; padding: 6px 12px; }
.tab { flex: 1; padding: 7px 0; border-radius: 8px; color: var(--dim); font-weight: 500; font-size: 13px; }
.tab.on { background: var(--panel2); color: var(--text); }
.sub { display: flex; gap: 4px; padding: 0 12px 6px; }
.sub button { font-size: 12px; color: var(--dim); padding: 3px 8px; border-radius: 6px; }
.sub button.on { color: var(--green); background: #0f2216; }
.list { list-style: none; margin: 0; padding: 4px 6px 10px; overflow-y: auto; flex: 1; }
.row { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; }
.row:hover, .row.sel { background: var(--panel2); }
.row img, .ph { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: var(--panel2); }
.ph { display: grid; place-items: center; font-weight: 700; color: var(--dim); font-size: 13px; }
.row .s { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r { text-align: right; font-family: var(--mono); font-size: 12px; }
.row .r .mc { color: var(--text); font-size: 13px; }
.list .msg { color: var(--dim); text-align: center; padding: 30px 10px; font-size: 13px; }

/* trade */
.trade { padding: 16px; display: flex; flex-direction: column; }
.empty { margin: auto; text-align: center; max-width: 380px; color: var(--dim); }
.empty .big { font: 700 26px 'Space Grotesk', sans-serif; color: var(--text); margin-bottom: 8px; }
.thead { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; }
.timg { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--panel2); }
.tname { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tname span { color: var(--dim); font-size: 14px; }
.badge { font-size: 11px !important; padding: 2px 7px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--dim) !important; vertical-align: 2px; }
.badge.curve { color: var(--gold) !important; border-color: #4d3f17; }
.badge.amm { color: var(--green) !important; border-color: var(--green-d); }
.ca { color: var(--dim); font-size: 12px; padding: 2px 0; }
.ca:hover { color: var(--text); }
.tnums { display: flex; gap: 22px; text-align: right; }
.tnums .k { display: block; font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .5px; }
.tnums .v { font-size: 17px; font-weight: 600; }
.tlinks { grid-column: 1 / -1; display: flex; gap: 14px; font-size: 12px; }
.tlinks a { color: var(--dim); } .tlinks a:hover { color: var(--green); }
.ctools { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.res { display: flex; gap: 4px; }
.res button { font: 12px var(--mono); color: var(--dim); padding: 4px 9px; border-radius: 6px; }
.res button.on { color: var(--green); background: #0f2216; }
.csrc { color: var(--dim); font-size: 11px; }
.chart { margin: 8px 0 14px; height: 380px; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); position: relative; }
.chart iframe { width: 100%; height: 100%; border: 0; }
.chart .msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dim); }
.ticket { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.side-h { font-weight: 700; font-family: 'Space Grotesk', sans-serif; font-size: 15px; }
.side-h.buy { color: var(--green); } .side-h.sell { color: var(--red); }
.amt { display: flex; align-items: center; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.amt input { flex: 1; min-width: 0; background: none; border: 0; outline: none; padding: 11px 0; font: 600 17px var(--mono); }
.amt .unit { color: var(--dim); font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { flex: 1; min-width: 44px; padding: 7px 0; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font: 12px var(--mono); }
.chips button:hover { border-color: var(--dim); }
.holding { color: var(--dim); font-size: 13px; padding: 11px 0 12px; }
.go { padding: 12px; border-radius: 10px; font-weight: 700; font-size: 15px; }
.go.buy { background: var(--green); color: #06210f; }
.go.sell { background: var(--red); color: #2a050a; }
.go:disabled { opacity: .45; cursor: default; }
.note { color: var(--dim); font-size: 12px; margin-top: 10px; min-height: 16px; }

/* right column */
.side-col { background: none; border: 0; display: flex; flex-direction: column; gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card-h { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 8px; }
.live { color: var(--green); font-size: 12px; font-weight: 500; animation: pulse 2s infinite; }
.me .big { font: 700 28px var(--mono); }
.me .row2 { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; margin-top: 4px; }
.me .pnl { font: 600 15px var(--mono); }
.pos { list-style: none; margin: 10px 0 0; padding: 0; }
.pos li { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.pos img, .pos .ph { width: 28px; height: 28px; border-radius: 6px; font-size: 11px; }
.pos .r { text-align: right; font-family: var(--mono); font-size: 12px; }
.me .cta { margin-top: 10px; display: flex; gap: 8px; }
.me .cta .btn { flex: 1; text-align: center; }
.lb { list-style: none; margin: 0; padding: 0; max-height: 52vh; overflow-y: auto; }
.lb li { display: grid; grid-template-columns: 28px 26px 1fr auto; gap: 8px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.lb li.mine { background: #0f2216; border-radius: 8px; }
.lb .rk { font: 600 13px var(--mono); color: var(--dim); text-align: center; }
.lb li:nth-child(1) .rk { color: var(--gold); } .lb li:nth-child(2) .rk { color: #d6dde3; } .lb li:nth-child(3) .rk { color: #e4a36b; }
.lb img, .lb .ph { width: 26px; height: 26px; border-radius: 50%; font-size: 10px; }
.lb .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .pz { color: var(--gold); font: 11px var(--mono); }
.lb .r { text-align: right; font: 600 13px var(--mono); }
.lb .empty-lb { display: block; color: var(--dim); text-align: center; padding: 18px 0; border: 0; }
.lb-foot { text-align: center; margin-top: 10px; color: var(--dim); font-size: 12px; }
.link { color: var(--dim); text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }

/* toast + modal */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; transition: .2s; z-index: 20; pointer-events: none; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { border-color: var(--green-d); } .toast.err { border-color: var(--red-d); color: #ffc7cd; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: 86vh; }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
.modal-body { padding: 22px; overflow-y: auto; max-height: 86vh; }
.modal-body h2 { font: 700 22px 'Space Grotesk', sans-serif; margin: 0 0 6px; }
.modal-body p { color: var(--dim); margin: 6px 0 14px; }
.modal-body .amt { margin-bottom: 12px; }
.modal-body .amt input { font-size: 14px; }
.modal-body .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.modal-body .err { color: var(--red); font-size: 13px; min-height: 18px; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; align-items: end; }
.podium .p { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; }
.podium .p.first { border-color: #6b5520; padding-top: 20px; }
.podium img, .podium .ph { width: 44px; height: 44px; border-radius: 50%; margin: 0 auto 6px; }
.podium .m { font-size: 22px; } .podium .u { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .g { color: var(--green); font: 600 13px var(--mono); } .podium .pz { color: var(--gold); font: 12px var(--mono); }
.rules li { margin: 6px 0; color: var(--dim); } .rules b { color: var(--text); }
.past { border-top: 1px solid var(--line); padding: 10px 0; }
.past .h { display: flex; justify-content: space-between; font-size: 13px; color: var(--dim); }
.past .w { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }

.mnav { display: none; }

@media (max-width: 1100px) {
  .grid { grid-template-columns: 280px minmax(0, 1fr); }
  .side-col { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .top { gap: 10px; padding: 8px 16px; flex-wrap: wrap; }
  .tag, .hide-sm { display: none; }
  .logo { font-size: 18px; }
  .round { order: 3; width: 100%; justify-content: space-between; gap: 8px; }
  .stat .v { font-size: 15px; }
  .user { margin-left: auto; }
  .grid { display: block; padding: 10px 16px 76px; }
  .grid > .panel { display: none; }
  .grid > .panel.show { display: flex; }
  .side-col.show { display: flex !important; }
  .discover { height: calc(100vh - 190px); position: static; }
  .thead { grid-template-columns: 40px 1fr; }
  .timg { width: 40px; height: 40px; }
  .tnums { grid-column: 1 / -1; justify-content: flex-start; text-align: left; }
  .chart { height: 280px; }
  .ticket { grid-template-columns: 1fr; }
  .mnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #0c0f0d; border-top: 1px solid var(--line); z-index: 6; }
  .mnav button { flex: 1; padding: 14px 0; color: var(--dim); font-weight: 600; }
  .mnav button.on { color: var(--green); }
  .lb { max-height: none; }
}
