:root {
  --bg: #1c1c1e;
  --side: #2a2a2c;
  --side-border: #3a3a3c;
  --card: #2c2c2e;
  --text: #ffffff;
  --text-2: #8e8e93;
  --text-3: #d1d1d6;
  --muted: #636366;
  --green: #34c759;
  --red: #ff453a;
  --blue: #3b82f6;
  --select: #3a3a3c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "SF Pro Text", ui-sans-serif, system-ui, sans-serif;
}

body {
  min-height: 100%;
  min-height: 100dvh;
}

.native {
  min-height: 100%;
  min-height: 100dvh;
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  grid-template-areas: "side main";
  background: var(--bg);
  overflow: hidden;
}

.side {
  grid-area: side;
}

.main {
  grid-area: main;
}

.mobile-brand,
.watch-tabs,
.dock {
  display: none;
}

.side {
  background: var(--side);
  border-right: 1px solid var(--side-border);
  padding: 18px 10px 14px;
  display: flex;
  flex-direction: column;
}

.side h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pro {
  background: var(--blue);
  font-size: 8px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.4px;
}

.side p {
  margin: 0 8px 6px;
  font-size: 11px;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.side .app-label {
  margin-top: 16px;
}

.side button {
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  color: var(--text-3);
  font: 500 13px Inter, sans-serif;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.side button.on {
  background: var(--select);
  color: var(--text);
  font-weight: 600;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.toolbar {
  padding: 18px 20px 4px;
  flex-shrink: 0;
}

.toolbar h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 10px 14px 8px 12px;
  color: var(--text-2);
  font-size: 13.5px;
  flex-shrink: 0;
}

.filters button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--text);
  font: 500 13.5px Inter, sans-serif;
  cursor: pointer;
  padding: 0;
}

.filters .count {
  justify-self: end;
  color: var(--text-2);
  font-size: 12.5px;
}

.filters .mid {
  justify-self: center;
}

.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  padding: 4px 12px 12px;
  align-content: start;
  overflow: auto;
}

.card {
  background: var(--card);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 86px;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(88px, 6fr);
  gap: 6px;
  cursor: pointer;
}

.card:hover {
  background: #323234;
}

.card > :first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.ex {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pair {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  margin: 5px 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kind {
  color: var(--text-2);
  font-size: 10px;
  white-space: nowrap;
}

.right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  text-align: right;
}

.spark {
  width: 58px;
  height: 18px;
  display: block;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  margin-top: 5px;
}

.tee {
  width: 9px;
  height: 13px;
  flex-shrink: 0;
}

.price {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chg {
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

.up {
  color: var(--green);
}

.dn {
  color: var(--red);
}

.placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  text-align: center;
  padding: 40px 20px;
  gap: 8px;
}

.placeholder h3 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
}

.placeholder p {
  margin: 0;
  font-size: 14px;
}

.detail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 16px 12px;
}

.detail.hidden {
  display: none;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 0 10px;
}

.detail-back {
  width: 32px;
  height: 32px;
  margin-top: 2px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.detail-back svg {
  width: 20px;
  height: 20px;
}

.detail-title {
  flex: 1;
  min-width: 0;
}

.detail-title .pair {
  margin: 0 0 4px;
  font-size: 22px;
}

.detail-px {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.detail-px .price {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.detail-px .chg {
  margin-top: 4px;
  font-size: 13px;
}

.detail-tf {
  display: flex;
  gap: 16px;
  padding: 2px 0 10px 32px;
}

.detail-tf button {
  background: none;
  border: 0;
  color: var(--text-2);
  font: 500 13px Inter, sans-serif;
  cursor: pointer;
  padding: 4px 0;
}

.detail-tf button.on {
  color: var(--text);
}

.chart-wrap {
  flex: 1;
  min-height: 220px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}

.chart-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-empty {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-2);
  font-size: 14px;
}

.hidden {
  display: none;
}

.ico {
  width: 16px;
  height: 16px;
  color: var(--text-2);
}

.mobile-brand {
  align-items: center;
  justify-content: center;
  padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 6px;
  flex-shrink: 0;
}

.mobile-brand h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.watch-tabs {
  align-items: flex-end;
  gap: 18px;
  padding: 0 16px;
  height: 34px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex-shrink: 0;
}

.watch-tabs::-webkit-scrollbar {
  display: none;
}

.watch-tabs button {
  flex: 0 0 auto;
  background: none;
  border: 0;
  color: var(--text-2);
  font: 400 14.5px Inter, sans-serif;
  padding: 0 0 6px;
  cursor: pointer;
  position: relative;
}

.watch-tabs button.on {
  color: var(--text);
  font-weight: 600;
}

.watch-tabs button.on::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 22px;
  height: 1.6px;
  margin-left: -11px;
  background: var(--text);
  border-radius: 2px;
}

.dock {
  grid-area: dock;
  align-items: stretch;
  justify-content: space-around;
  border-top: 0.5px solid #2c2c2e;
  background: var(--bg);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  flex-shrink: 0;
}

.dock button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 58px;
  background: none;
  border: 0;
  color: var(--muted);
  font: 400 11px Inter, sans-serif;
  cursor: pointer;
  padding: 0;
}

.dock button.on {
  color: var(--text);
  font-weight: 600;
}

.dock .ico {
  width: 24px;
  height: 24px;
  color: inherit;
}

@media (max-width: 820px) {
  html,
  body {
    height: auto;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .native {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .side {
    display: none;
  }

  .mobile-brand {
    display: flex;
  }

  .watch-tabs {
    display: flex;
    overflow-x: auto;
    overflow-y: visible;
    touch-action: pan-x pan-y;
  }

  .native.app-page .watch-tabs,
  .native.detail-open .watch-tabs {
    display: none;
  }

  .dock {
    display: flex;
    position: static;
  }

  .main {
    min-height: 0;
    overflow: visible;
    flex: 1 0 auto;
  }

  .toolbar {
    display: none;
  }

  .filters {
    padding: 10px 12px 8px;
    font-size: 12.5px;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 4px 8px 24px;
    overflow: visible;
  }

  .card {
    padding: 7px 8px;
    min-height: 78px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pair {
    font-size: 13px;
    margin: 3px 0 2px;
  }

  .spark {
    width: 52px;
    height: 16px;
  }

  .detail {
    padding: 2px 10px 8px;
    min-height: calc(100dvh - 90px);
  }

  .detail-title .pair,
  .detail-px .price {
    font-size: 18px;
  }

  .detail-tf {
    padding-left: 8px;
    gap: 14px;
  }

  .chart-wrap {
    min-height: min(70dvh, 520px);
  }
}
