:root {
  --bg: #0b0d10;
  --panel: #12151a;
  --panel-2: #181c22;
  --line: #232830;
  --text: #e8ecf1;
  --muted: #8a93a0;
  --accent: #7ef0c4;
  --long: #2ecc8f;
  --short: #f0606a;
  --warn: #f5b041;
  --alert-bg: #2a1518;
  --alert-line: #5a2228;
  --alert-text: #ff9aa2;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: 64px minmax(0, 1fr) 40px;
  grid-template-areas: "top top" "side main" "bottom bottom";
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

a { color: inherit; }
button, input { font: inherit; }

.muted { color: var(--muted); }

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.icon-btn, .user-btn, .balance-chip, .quick button, .btn, .pill {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
}

.icon-btn {
  display: none;
  width: 38px;
  height: 38px;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  text-decoration: none;
}

.wordmark { font-weight: 700; font-size: 17px; letter-spacing: 0.02em; }

.search {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
}

.search:focus-within { border-color: var(--accent); }

.search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.balance-chip, .user-btn {
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 14px;
  text-decoration: none;
  white-space: nowrap;
  font-weight: 600;
}

.balance-chip { color: var(--accent); }

.sidebar {
  grid-area: side;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 8px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.nav-item:hover, .nav-item.active { background: var(--panel-2); color: var(--text); }

.nav-sub {
  margin: 4px 0 10px 14px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.coin-link {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
}

.coin-link:hover, .coin-link.active { background: var(--panel-2); color: var(--text); }

.scrim { display: none; }

.main {
  grid-area: main;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 24px;
}

.bottombar {
  grid-area: bottom;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 0 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.status { display: flex; align-items: center; gap: 8px; min-width: 0; }

.dot {
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: var(--long);
}

.bottom-links { display: flex; gap: 16px; flex: none; }

.card {
  min-width: 0;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.pill {
  padding: 4px 10px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 999px;
}

.coin-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.coin-title { font-size: 18px; font-weight: 700; }
.coin-title .muted { font-weight: 400; font-size: 14px; margin-left: 6px; }
.coin-price { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

.chart { margin-top: 16px; min-width: 0; }

.chart-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.chart-live {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}

.chart-live[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }

.voice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.switch[aria-checked="true"] { color: var(--text); }

.switch-track {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--line);
  transition: background 0.15s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.switch[aria-checked="true"] .switch-track { background: var(--accent); }
.switch[aria-checked="true"] .switch-track::after { transform: translateX(14px); }

.voice-line {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  min-height: 1.4em;
}

.voice-signal {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.voice-signal[data-tone="long"] { color: var(--long); border-color: var(--long); }
.voice-signal[data-tone="short"] { color: var(--short); border-color: var(--short); }

.voice-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-status { flex: none; font-size: 12px; }

.chart-canvas {
  --chart-tag-bg: #3a414b;
  --chart-tag-text: var(--text);
  display: block;
  width: 100%;
  height: min(56vh, 460px);
  min-height: 260px;
  border-radius: 10px;
  background: var(--panel-2);
  touch-action: none;
  user-select: none;
  cursor: crosshair;
}

.futures {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  min-width: 0;
}

.trade-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.trade-head strong { color: var(--text); font-variant-numeric: tabular-nums; }

.amount-box {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 10px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 26px;
  font-weight: 600;
}

.amount-box:focus-within { border-color: var(--accent); }

.amount-box input {
  width: 100%;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: inherit;
}

.quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.quick button { padding: 8px 0; cursor: pointer; }

.alert {
  padding: 10px 12px;
  margin: 10px 0;
  background: var(--alert-bg);
  border: 1px solid var(--alert-line);
  border-radius: 10px;
  color: var(--alert-text);
}

.lev-head {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
}

.lev-head strong { color: var(--text); font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  margin: 14px 0 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--long), var(--warn), var(--short));
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}

input[type="range"]:disabled { opacity: 0.45; cursor: not-allowed; }

.lev-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.stats { display: grid; gap: 10px; margin: 14px 0; }
.stats div { display: flex; justify-content: space-between; gap: 12px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn {
  padding: 14px;
  text-align: center;
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  color: #0b0d10;
  border: 0;
}

.btn.long { background: var(--long); }
.btn.short { background: var(--short); }
.btn.primary { grid-column: 1 / -1; background: var(--accent); }

button:disabled { opacity: 0.45; cursor: not-allowed; }

input:disabled { cursor: not-allowed; opacity: 0.6; }

.note { min-height: 1.4em; margin: 12px 0 0; color: var(--muted); font-size: 12px; }

.btn.close {
  grid-column: 1 / -1;
  background: var(--panel-2);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
  font-variant-numeric: tabular-nums;
}

.btn.close.up { background: var(--long); color: #0b0d10; box-shadow: none; }
.btn.close.down { background: var(--short); color: #0b0d10; box-shadow: none; }

.trades { max-width: 960px; margin-top: 16px; }

.tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.tabs h2 { margin: 0 auto 0 0; font-size: 16px; }

.tabs [role="tab"] {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}

.tabs [role="tab"][aria-selected="true"] { color: var(--accent); border-color: var(--accent); }

.table-wrap { overflow-x: auto; }

.trade-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.trade-table th, .trade-table td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
.trade-table th:first-child, .trade-table td:first-child { text-align: left; }
.trade-table th { color: var(--muted); font-weight: 600; font-size: 12px; }
.trade-table tr:last-child td { border-bottom: 0; }
.trade-table a { color: var(--accent); text-decoration: none; }
.trade-table .long { color: var(--long); }
.trade-table .short { color: var(--short); }
.trade-table .text { text-align: left; }

.trades-panel { grid-column: 1 / -1; min-width: 0; }

.trade-tabs { display: flex; gap: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }

.trade-tabs [role="tab"] {
  padding: 8px 2px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.trade-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

.trades-empty {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 44px 16px;
  text-align: center;
}

.trades-empty strong { font-size: 15px; }

.btn-mini {
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.btn-mini:hover { border-color: var(--accent); }

.hero { margin-bottom: 20px; }
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 4vw, 40px); line-height: 1.15; }
.hero p { margin: 0; color: var(--muted); max-width: 60ch; }

.coin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.tile { display: block; text-decoration: none; }
.tile strong { display: block; font-size: 16px; }
.tile:hover { border-color: var(--accent); }

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.account-row:last-child { border-bottom: 0; }
.account-row strong { font-variant-numeric: tabular-nums; }

.launch-btn {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  background: var(--accent);
}

.nav-heading {
  display: block;
  padding: 6px 8px 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.token-icon {
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel-2);
  vertical-align: middle;
}

.coin-icon { margin-right: 8px; }
.coin-link .token-icon { width: 18px; height: 18px; margin-right: 6px; }
.coin-link .coin-label { display: inline-flex; align-items: center; min-width: 0; }
.trade-table .token-icon { width: 18px; height: 18px; margin-right: 6px; }

.coin-ends {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--warn);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.coin-ends.ended, .token-ends.ended { color: var(--muted); }

.launch {
  width: min(520px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
}

.launch::backdrop { background: rgba(0, 0, 0, 0.6); }

.launch-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.launch-head h2 { margin: 0; font-size: 18px; }
.launch-close { display: inline-grid; font-size: 20px; line-height: 1; }

.launch-guest { display: grid; gap: 12px; justify-items: start; }
.launch-guest p { margin: 0; }

.launch-form { display: grid; gap: 14px; }

.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field legend { color: var(--muted); font-size: 13px; padding: 0; }
.field > span .muted, .field legend .muted { font-size: 12px; margin-left: 4px; }

.field input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  outline: none;
}

.field input[type="text"]:focus { border-color: var(--accent); }
.field input[name="ticker"] { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }

.icon-drop {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.icon-drop input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.icon-drop.over, .icon-drop:has(input:focus-visible) { border-color: var(--accent); }
.icon-drop.ready { border-style: solid; }
.icon-preview { width: 64px; height: 64px; }
.icon-drop-text { display: grid; gap: 2px; font-size: 13px; }
.icon-drop-text strong { font-size: 14px; }

.chip-picker { display: flex; flex-wrap: wrap; gap: 6px; }

.chip-choice { position: relative; display: block; cursor: pointer; }
.chip-choice input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }

.chip-choice span {
  display: block;
  padding: 6px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.chip-choice input:checked + span { border-color: var(--accent); color: var(--text); }
.chip-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.launch-fee { margin: 0; display: flex; justify-content: space-between; gap: 12px; }
.launch-form .alert { margin: 0; }
.launch-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.launch-actions .btn.primary { grid-column: auto; }
.btn.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }

.discover { max-width: 1100px; }
.discover h1 { margin: 0 auto 0 0; font-size: 20px; }

.sorts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }

.sorts [role="radio"] {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
}

.sorts [role="radio"][aria-checked="true"] { color: var(--accent); border-color: var(--accent); }

.token-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.token { display: grid; gap: 10px; text-decoration: none; }
.token:hover { border-color: var(--accent); }
.token.ended { opacity: 0.8; }

.token-head { display: flex; align-items: center; gap: 10px; }
.token-head .token-icon { width: 40px; height: 40px; }
.token-id { display: grid; min-width: 0; flex: 1; }
.token-id strong { font-size: 16px; }
.token-id .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

.token-ends {
  flex: none;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--warn);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.token-price { display: flex; align-items: baseline; gap: 10px; font-variant-numeric: tabular-nums; }
.token-price strong { font-size: 22px; }
.token-price .up { color: var(--long); }
.token-price .down { color: var(--short); }

.token-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }
.token-stats div { display: grid; min-width: 0; }
.token-stats dt { color: var(--muted); font-size: 11px; }
.token-stats dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.launched td[data-ends-at] { color: var(--warn); }
.launched .trade-table .muted { font-size: 12px; }

@media (max-width: 1099px) {
  .futures { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 859px) {
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "main" "bottom";
  }

  .icon-btn { display: inline-grid; }

  .sidebar {
    position: fixed;
    top: 64px;
    bottom: 40px;
    left: 0;
    z-index: 20;
    width: min(280px, 85vw);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.nav-open .sidebar { transform: none; }

  body.nav-open .scrim {
    display: block;
    position: fixed;
    top: 64px;
    right: 0;
    bottom: 40px;
    left: 0;
    z-index: 15;
    background: rgba(0, 0, 0, 0.55);
  }
}

@media (max-width: 559px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .search { display: none; }
  .wordmark { display: none; }
  .main { padding: 16px; }
  .bottom-links { display: none; }
  .balance-chip, .user-btn { padding: 0 10px; }
  .amount-box { font-size: 22px; }
}

.deposit { max-width: 960px; margin-top: 16px; }
.deposit h2 { margin: 0 0 12px; font-size: 16px; }
.deposit-body { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.deposit-qr svg { display: block; width: 184px; height: 184px; border-radius: 8px; }
.deposit-info { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.deposit-info p { margin: 0; }
.deposit-warning {
  padding: 8px 10px;
  color: var(--alert-text);
  background: var(--alert-bg);
  border: 1px solid var(--alert-line);
  border-radius: 8px;
  font-weight: 600;
}
.deposit-address { display: flex; gap: 8px; align-items: center; }
.deposit-address code {
  min-width: 0;
  padding: 6px 8px;
  overflow-wrap: anywhere;
  font: 600 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
