:root {
  color-scheme: dark;
  --bg: #090a0d;
  --surface: #101217;
  --surface-2: #151821;
  --surface-3: #1b202b;
  --ink: #f3f5f8;
  --muted: #8f98a8;
  --line: rgba(172, 183, 199, 0.18);
  --blue: #4d8dff;
  --teal: #21d4b0;
  --green: #18d17d;
  --red: #ff5565;
  --amber: #ffbf4d;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(26, 31, 43, 0.72), rgba(9, 10, 13, 0.96) 220px),
    linear-gradient(90deg, rgba(33, 212, 176, 0.05), rgba(77, 141, 255, 0.04)),
    #090a0d;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.58;
}

.shell {
  width: min(100%, 1020px);
  margin: 0 auto;
  padding: max(10px, env(safe-area-inset-top)) 12px calc(82px + env(safe-area-inset-bottom));
}

.topbar,
.hero,
.search-row,
.coin-rail,
.section-head,
.signal-top,
.chart-tools,
.asset-row,
.rail-coin,
.metric-row,
.deal-head,
.chart-head,
.market-filters,
.tabs,
.tab {
  display: flex;
  align-items: center;
}

.topbar {
  position: sticky;
  z-index: 4;
  top: 0;
  justify-content: space-between;
  gap: 10px;
  margin: -4px -4px 10px;
  padding: 8px 4px;
  background: linear-gradient(180deg, rgba(9, 10, 13, 0.96), rgba(9, 10, 13, 0.72));
  backdrop-filter: blur(14px);
}

.eyebrow,
.muted,
dt,
.asset-sub,
.news-source,
.hero small,
.deal-head p,
.chart-head p,
.section-head span,
.top-status {
  color: var(--muted);
}

.eyebrow {
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 2px;
  font-size: 24px;
  line-height: 1;
}

h2 {
  font-size: 16px;
}

.top-status {
  margin-left: auto;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 800;
}

.icon-button {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  font-size: 22px;
}

.command-panel {
  justify-content: space-between;
  gap: 14px;
  min-height: 76px;
  padding: 11px 12px;
  border: 1px solid rgba(77, 141, 255, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(77, 141, 255, 0.16), rgba(33, 212, 176, 0.06)),
    var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  min-width: 0;
}

.hero strong {
  display: block;
  margin-top: 5px;
  font-size: clamp(24px, 6vw, 38px);
  line-height: 0.98;
}

.hero p {
  max-width: 620px;
  margin-top: 5px;
  color: #d4d9e3;
  line-height: 1.32;
  font-size: 13px;
}

.hero-price {
  min-width: 126px;
  text-align: right;
}

.hero-price span {
  display: block;
  font-size: clamp(20px, 4.8vw, 30px);
  font-weight: 920;
  line-height: 1;
}

.hero-price b {
  display: inline-block;
  max-width: 140px;
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(255, 191, 77, 0.35);
  border-radius: 8px;
  background: rgba(255, 191, 77, 0.1);
  color: #ffd98a;
  font-size: 12px;
}

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

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

.search-row {
  gap: 8px;
  margin: 8px 0 10px;
}

.coin-rail {
  gap: 7px;
  margin: 8px 0 7px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.coin-rail::-webkit-scrollbar,
.market-filters::-webkit-scrollbar {
  display: none;
}

.rail-coin {
  flex: 0 0 auto;
  gap: 8px;
  justify-content: space-between;
  min-width: 84px;
  min-height: 40px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(16, 18, 23, 0.86);
  text-align: left;
}

.rail-coin.active {
  border-color: rgba(33, 212, 176, 0.82);
  background: rgba(33, 212, 176, 0.13);
}

.rail-symbol {
  font-size: 14px;
  font-weight: 920;
}

.rail-meta {
  display: grid;
  gap: 2px;
  justify-items: end;
  font-size: 11px;
  font-weight: 850;
}

input,
select {
  min-width: 0;
  height: 40px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

input {
  flex: 1;
  padding: 0 13px;
}

select {
  width: 116px;
  padding: 0 10px;
}

.view {
  display: none;
}

.view-active {
  display: block;
}

.market-filters {
  gap: 7px;
  overflow-x: auto;
  padding: 0 0 8px;
  scrollbar-width: none;
}

.filter {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  font-weight: 850;
}

.filter.active {
  color: #07100d;
  border-color: var(--teal);
  background: var(--teal);
}

.section-head {
  justify-content: space-between;
  margin: 10px 0 7px;
}

.asset-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #08090c;
}

.asset-row {
  width: 100%;
  gap: 10px;
  min-height: 58px;
  padding: 9px 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(172, 183, 199, 0.12);
  text-align: left;
}

.asset-row:last-child {
  border-bottom: 0;
}

.asset-row:hover,
.asset-row.selected {
  background: rgba(77, 141, 255, 0.1);
}

.asset-main {
  flex: 1;
  min-width: 0;
}

.asset-symbol {
  font-size: 18px;
  font-weight: 920;
  line-height: 1;
}

.asset-sub {
  margin-top: 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spark {
  width: 42px;
  height: 4px;
  border-radius: 8px;
  background: var(--line);
}

.spark.positive {
  background: var(--green);
}

.spark.negative {
  background: var(--red);
}

.asset-price {
  min-width: 78px;
  text-align: right;
}

.asset-price strong {
  display: block;
  font-size: 15px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.pill {
  padding: 2px 6px;
  border: 1px solid rgba(172, 183, 199, 0.15);
  border-radius: 8px;
  color: #cbd3df;
  background: rgba(255, 255, 255, 0.045);
  font-size: 10px;
  font-weight: 800;
}

.signal-card,
.chart-card,
.panel,
.deal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.focus-chart {
  padding: 12px;
  background: #08090c;
}

.chart-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chart-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chart-badges span,
.chart-head > span {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(33, 212, 176, 0.1);
  color: #9ff4df;
  font-size: 12px;
  font-weight: 850;
}

#chartLiveStatus {
  color: #cfe0ff;
  background: rgba(77, 141, 255, 0.14);
}

.chart-tools {
  gap: 7px;
  margin-bottom: 10px;
}

.chart-tools button {
  flex: 1;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  font-weight: 850;
}

.chart-tools .active {
  border-color: rgba(77, 141, 255, 0.8);
  background: rgba(77, 141, 255, 0.22);
}

canvas {
  display: block;
  width: 100%;
  height: min(54vh, 500px);
  min-height: 320px;
  border: 1px solid rgba(172, 183, 199, 0.18);
  border-radius: 8px;
  background: #06070a;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

canvas:active {
  cursor: grabbing;
}

.signal-card,
.deal-card,
.panel {
  padding: 14px;
}

.signal-card {
  margin-top: 12px;
}

.signal-top {
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 0 12px;
  border: 1px solid rgba(24, 209, 125, 0.28);
  border-radius: 8px;
  color: var(--green);
  background: rgba(24, 209, 125, 0.08);
  font-weight: 920;
}

dl {
  margin: 0;
}

dl div,
.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(172, 183, 199, 0.12);
}

dl div:last-child,
.metric-row:last-child {
  border-bottom: 0;
}

dd {
  margin: 0;
  text-align: right;
  font-weight: 880;
}

dt,
.metric-row span {
  flex: 0 0 auto;
}

dd,
.metric-row strong {
  max-width: min(62%, 520px);
  overflow-wrap: anywhere;
}

.signal-card p,
.plain {
  margin-top: 11px;
  color: #dce2eb;
  line-height: 1.4;
}

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

.wide {
  grid-column: 1 / -1;
}

.metric-grid {
  margin-top: 9px;
}

.metric-row strong {
  text-align: right;
  font-size: 18px;
  line-height: 1.18;
}

.tag-list,
.news-list {
  margin: 9px 0 0;
  padding: 0;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  list-style: none;
}

.tag-list li {
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(24, 209, 125, 0.1);
  color: #b8f3d5;
  border: 1px solid rgba(24, 209, 125, 0.22);
}

.tag-list.danger li {
  background: rgba(255, 85, 101, 0.11);
  color: #ffc2c8;
  border-color: rgba(255, 85, 101, 0.22);
}

.news-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(172, 183, 199, 0.12);
}

.news-item:last-child {
  border-bottom: 0;
}

.news-item a {
  color: var(--ink);
  text-decoration: none;
  line-height: 1.32;
}

.news-source {
  display: block;
  margin-top: 5px;
  font-size: 12px;
}

.deal-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.deal-head strong {
  font-size: 26px;
}

#dealBadge {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(77, 141, 255, 0.34);
  background: rgba(77, 141, 255, 0.13);
  color: #cfe0ff;
  font-weight: 920;
}

.copy-button {
  width: 100%;
  min-height: 48px;
  margin-top: 13px;
  border: 1px solid rgba(33, 212, 176, 0.45);
  border-radius: 8px;
  color: #07100d;
  background: var(--teal);
  font-weight: 920;
}

.settings-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.command-status {
  min-height: 20px;
  margin-top: 12px;
  color: #9ff4df;
  font-size: 13px;
  font-weight: 750;
}

.settings-actions button {
  min-height: 46px;
  border: 1px solid rgba(77, 141, 255, 0.36);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  font-weight: 850;
}

.settings-actions button:first-child {
  color: #07100d;
  border-color: var(--teal);
  background: var(--teal);
}

.mini-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(77, 141, 255, 0.34);
  border-radius: 8px;
  color: #cfe0ff;
  background: rgba(77, 141, 255, 0.12);
  font-size: 12px;
  font-weight: 850;
}

.trade-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.trade-summary div {
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.trade-summary span,
.trade-row span {
  color: var(--muted);
}

.trade-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.trade-list {
  margin-top: 10px;
  border: 1px solid rgba(172, 183, 199, 0.12);
  border-radius: 8px;
  overflow: hidden;
}

.trade-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 11px 12px;
  border: 0;
  border-bottom: 1px solid rgba(172, 183, 199, 0.12);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.02);
  text-align: left;
}

.trade-row:last-child {
  border-bottom: 0;
}

.trade-row:hover {
  background: rgba(77, 141, 255, 0.08);
}

.trade-row strong,
.trade-row span {
  display: block;
}

.trade-row span {
  margin-top: 4px;
  font-size: 12px;
}

.trade-pnl {
  min-width: 86px;
  text-align: right;
}

.trade-pnl strong {
  font-size: 16px;
}

.tabs {
  position: fixed;
  z-index: 6;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  justify-content: space-between;
  gap: 5px;
  width: min(calc(100% - 18px), 900px);
  padding: 7px;
  border: 1px solid rgba(172, 183, 199, 0.18);
  border-radius: 8px;
  background: rgba(12, 14, 19, 0.95);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.tab {
  flex: 1;
  justify-content: center;
  gap: 5px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 850;
}

.tab-icon {
  font-size: 16px;
  line-height: 1;
}

.tab.active {
  color: var(--ink);
  border-color: rgba(77, 141, 255, 0.54);
  background: rgba(77, 141, 255, 0.14);
}

.empty {
  padding: 16px;
  color: var(--muted);
}

@media (min-width: 760px) {
  #assetList {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #assetList .asset-row {
    border-bottom: 1px solid rgba(172, 183, 199, 0.12);
  }

  #assetList .asset-row:nth-child(odd) {
    border-right: 1px solid rgba(172, 183, 199, 0.12);
  }
}

@media (max-width: 620px) {
  .shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .command-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero strong {
    font-size: clamp(26px, 12vw, 38px);
  }

  .hero-price {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
  }

  .search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 96px;
    align-items: stretch;
  }

  select {
    width: 100%;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .trade-summary {
    grid-template-columns: 1fr;
  }

  .asset-row {
    gap: 8px;
    min-height: 62px;
  }

  .spark {
    width: 28px;
  }

  .asset-price {
    min-width: 72px;
  }

  .asset-price strong {
    font-size: 16px;
  }

  .tabs {
    gap: 4px;
    padding: 6px;
  }

  .tab {
    flex-direction: column;
    gap: 2px;
    min-height: 50px;
    font-size: 10px;
  }

  dd,
  .metric-row strong {
    max-width: 58%;
    font-size: 16px;
  }
}
