:root {
  --bg: #0b0e14;
  --card: #12161e;
  --sheet: #171c26;
  --ink: #f5f6f8;
  --dim: #8b92a0;
  --line: #1d2330;
  --up: #0ecb81;
  --down: #f6465d;
  --gold: #f0b90b;
  --flat: #2b3240;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #000;
  color: var(--ink);
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}

.page.hide, .sheet.hide, .toast.hide { display: none; }

.top, .trade-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
}

.brand em {
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f0b90b;
  color: #111;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.brand svg {
  width: 22px;
  height: 22px;
  display: block;
}

.banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 16px 10px;
  padding: 18px 16px;
  border-radius: 14px;
  background: #10131c;
}

.banner h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
}

.banner p {
  margin: 0;
  color: var(--dim);
  font-size: 12px;
}

.banner .gold {
  margin: 4px 0 12px;
  color: #d6b36a;
  font-size: 13px;
}

.banner button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(90deg, #f0c36a, #e7b34a);
  color: #3a2a0a;
  font-size: 12px;
  font-weight: 600;
}

.banner.done button {
  background: #2b3240;
  color: #888;
}

.gift {
  width: 108px;
  height: 88px;
  position: relative;
}

.gift .lid {
  position: absolute;
  left: 10px;
  top: 0;
  width: 88px;
  height: 18px;
  border-radius: 4px 4px 0 0;
  background: #3d7cff;
}

.gift .box {
  position: absolute;
  left: 8px;
  top: 16px;
  width: 92px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 0 0 8px 8px;
  background: linear-gradient(180deg, #4d8dff, #2f6dff);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 10px 8px 0 #1a4fc7;
}

.notice-wrap {
  margin: 0 16px 12px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: #10131c;
  text-align: left;
}

.notice svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: var(--gold);
}

.notice-track {
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.notice-track span {
  display: inline-block;
  padding-left: 100%;
  white-space: nowrap;
  color: #c8cdd6;
  font-size: 12px;
  animation: notice-roll 22s linear infinite;
}

@keyframes notice-roll {
  to { transform: translateX(-100%); }
}

.notice-list {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #10131c;
}

.notice-list p {
  margin: 0;
  padding: 7px 0;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.45;
}

.notice-list p + p {
  border-top: 1px solid var(--line);
}

.notice-list b {
  color: var(--ink);
  font-weight: 600;
}

.hot {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 0 16px 12px;
}

.hot .card {
  padding: 4px 2px;
  background: none;
}

.hot .name { color: var(--dim); font-size: 11px; }
.hot .px { margin: 4px 0 2px; font-size: 13px; font-weight: 600; }
.hot .chg { font-size: 11px; }
.hot canvas { display: block; width: 100%; height: 22px; }

.quick {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  padding: 6px 8px 10px;
}

.quick button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  color: var(--dim);
  font-size: 12px;
}

.quick svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #9aa3b2;
  stroke-width: 1.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.cols {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.9fr;
  padding: 8px 16px;
  color: var(--dim);
  font-size: 12px;
}

.cols span:nth-child(2), .cols span:nth-child(3) { text-align: right; }

.row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 0.9fr;
  align-items: center;
  min-height: 62px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
}

.coin {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.sym { font-weight: 600; }
.sub { margin-top: 3px; color: var(--dim); font-size: 11px; }
.px { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.chg {
  justify-self: end;
  min-width: 72px;
  text-align: right;
  color: var(--dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.chg.up, .px.up, .hot .chg.up { color: var(--up); }
.chg.down, .px.down, .hot .chg.down { color: var(--down); }
.chg.up { background: none; }
.chg.down { background: none; }
.row > div:nth-child(2) {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.row canvas { display: block; width: 56px; height: 22px; margin-left: auto; }

.trade-head {
  align-items: flex-start;
  flex-wrap: wrap;
}
.trade-head .pair { width: 100%; }
.meta {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.5;
}
.meta > div:last-child { text-align: right; }
.pair {
  border: 0;
  background: none;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
}

.price-xl {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tfs {
  display: flex;
  gap: 14px;
  padding: 0 16px 6px;
  color: var(--dim);
  font-size: 12px;
}

.tfs button {
  border: 0;
  background: none;
  padding: 0;
  color: var(--dim);
}

.tfs button.on { color: var(--gold); }

.chart-box { height: 240px; padding: 4px 8px 0; }
#chart { display: block; width: 100%; height: 100%; }

.live-pos { padding: 8px 16px; font-size: 12px; color: var(--gold); }
.live-pos:empty { display: none; }

.trade-acts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px 16px 16px;
}

.buy, .side, .confirm {
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
}

.buy.up, .side.up, .confirm.up { background: var(--up); }
.buy.down, .side.down, .confirm.down { background: var(--down); }
.side { opacity: 1; }
.side:not(.on) { filter: brightness(0.62); }

.ostats {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.ostats button {
  border: 0;
  background: none;
  padding: 10px 8px 12px;
  color: var(--dim);
}

.ostats button.on { color: var(--ink); }
.ostats em { display: block; font-style: normal; font-size: 12px; margin-bottom: 4px; }
.ostats b { font-size: 16px; }

.orow {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.orow .hd, .orow .ft {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.orow .time { color: var(--dim); font-size: 12px; margin: 4px 0 8px; }
.orow .ft { color: var(--dim); font-size: 12px; }
.tag {
  min-width: 36px;
  height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.tag.win { background: rgba(14, 203, 129, 0.15); color: var(--up); }
.tag.lose { background: rgba(246, 70, 93, 0.15); color: var(--down); }
.tag.draw { background: #2b3240; color: #bbb; }
.pnl { font-weight: 600; }
.pnl.win { color: var(--up); }
.pnl.lose { color: var(--down); }

.profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 16px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #1f2430;
  font-weight: 700;
}

.nick { font-size: 16px; font-weight: 600; }
.uid { margin-top: 4px; color: var(--dim); font-size: 12px; }

.wallet {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 16px 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--card);
  color: var(--dim);
}

.wallet b {
  color: var(--ink);
  font-size: 22px;
}

.menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 32px);
  margin: 6px 16px 16px;
  padding: 14px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
}

.menu em {
  color: var(--dim);
  font-style: normal;
  font-size: 12px;
}

.invite {
  margin: 8px 16px 10px;
  padding: 14px 16px;
  border-radius: 10px;
  background: var(--card);
}

.invite span {
  color: var(--dim);
  font-size: 12px;
}

.invite b {
  display: block;
  margin: 8px 0 12px;
  word-break: break-all;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.invite button {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--gold);
  color: #111;
  font-weight: 700;
}

.link, .back {
  border: 0;
  background: none;
  color: var(--dim);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
}

.form input, .amt-box input, .composer input {
  height: 42px;
  border: 1px solid #2a3140;
  background: #10141c;
  padding: 0 12px;
}

.form button, .composer button {
  height: 42px;
  border: 0;
  background: var(--up);
  color: #04140c;
  font-weight: 600;
}

.tip { color: var(--dim); font-size: 12px; line-height: 1.5; }

.feed { padding: 8px 16px 70px; }
.item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.item .svc { color: var(--gold); }
.item .meta { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; margin-bottom: 6px; }

.composer {
  position: fixed;
  left: 50%;
  bottom: calc(64px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  display: none;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-top: 1px solid var(--line);
}

body.show-svc .composer { display: flex; }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.45);
}

.sheet-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--sheet);
}

.x {
  position: absolute;
  right: 12px;
  top: 10px;
  border: 0;
  background: none;
  font-size: 22px;
  color: var(--dim);
}

.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 16px; }

.row-lab {
  display: flex;
  justify-content: space-between;
  color: var(--dim);
  font-size: 12px;
  margin-bottom: 8px;
}

.row-lab.thin { margin: 10px 0 14px; }
.row-lab b { color: var(--ink); font-weight: 600; }

.periods {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.periods button {
  height: 52px;
  border: 1px solid #2a3140;
  background: #10141c;
  color: var(--dim);
}

.periods button small { display: block; margin-top: 2px; font-size: 11px; }
.periods button.on {
  border-color: var(--gold);
  color: var(--gold);
}

.lab { color: var(--dim); font-size: 12px; }

.amt-box {
  display: flex;
  align-items: center;
  margin: 6px 0 10px;
  border: 1px solid #2a3140;
  background: #10141c;
}

.amt-box input { flex: 1; border: 0; background: none; }
.amt-box span { padding-right: 10px; color: var(--dim); }

.amts { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; }
.amts button {
  height: 34px;
  border: 1px solid #2a3140;
  background: #10141c;
  color: var(--dim);
}
.amts button.on { border-color: var(--gold); color: var(--gold); }

.confirm { width: 100%; height: 46px; border-radius: 8px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  z-index: 9;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 6px;
  background: #fff;
  color: #111;
}

.empty, .err {
  padding: 24px 16px;
  color: var(--dim);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 5;
  width: 100%;
  max-width: 480px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
  background: #0f1218;
  border-top: 1px solid #1a2030;
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 56px;
  border: 0;
  background: none;
  color: #6f7684;
  font-size: 11px;
}

.tabbar svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.tabbar button.on { color: var(--up); }

.tabbar .mid {
  width: 52px;
  height: 52px;
  margin: -14px auto 0;
  border-radius: 50%;
  background: #151a24;
  color: #8b92a0;
  box-shadow: 0 0 0 6px #0f1218;
}

.tabbar .mid.on { color: var(--up); }

.sub .top { gap: 12px; justify-content: flex-start; }
