:root {
  color-scheme: dark;
  --bg: #0b0e13;
  --panel: rgba(20, 22, 26, 0.94);
  --glass: rgba(24, 26, 30, 0.85);
  --glass-border: rgba(245, 213, 83, 0.18);
  --text: #eaecef;
  --muted: #707a8a;
  --accent: #fcd535;
  --accent-2: #f0b90b;
  --accent-3: #2bd9b5;
  --bear: #f6465d;
  --bull: #fcd535;
  --neon: #fcd535;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.bg-glow {
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(circle at 10% 15%, rgba(252, 213, 53, 0.18), transparent 55%),
    radial-gradient(circle at 80% 20%, rgba(14, 203, 129, 0.12), transparent 55%),
    radial-gradient(circle at 60% 90%, rgba(246, 70, 93, 0.1), transparent 60%);
  filter: blur(50px);
  z-index: -1;
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at top, rgba(0, 0, 0, 0.8), transparent 75%);
  z-index: -1;
  pointer-events: none;
}

.bg-grid::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.02) 0px,
    rgba(255, 255, 255, 0.02) 1px,
    transparent 1px,
    transparent 5px
  );
  opacity: 0.15;
  pointer-events: none;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px 28px;
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(140deg, rgba(252, 213, 53, 0.55), rgba(240, 185, 11, 0.25));
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.4px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(252, 213, 53, 0.45);
}

.titles .name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.titles .pair {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, SFMono-Regular, Menlo, monospace;
}

.titles .pair .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(148, 164, 191, 0.8);
}

.badge {
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(252, 213, 53, 0.18);
  color: var(--accent);
  font-size: 12px;
  border: 1px solid rgba(252, 213, 53, 0.45);
  letter-spacing: 0.4px;
}

.card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.glass {
  background: var(--glass);
}

.hero-panel {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  background: var(--panel);
  border: 1px solid rgba(252, 213, 53, 0.18);
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
}

.panel-sub {
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0 16px;
}

.panel-metrics {
  display: grid;
  gap: 10px;
}

.metric {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 15px;
  font-weight: 600;
}

.panel-right {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
}

.pulse {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(252, 213, 53, 0.8);
  animation: pulse 1.4s infinite ease-in-out;
}

.panel-action {
  display: grid;
  gap: 10px;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-sub {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

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

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.btn {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border 0.18s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  background: rgba(252, 213, 53, 0.12);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
}

.btn::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 0 18px rgba(252, 213, 53, 0.4);
  pointer-events: none;
}

.btn:hover::after {
  opacity: 1;
}

.btn.glow {
  animation: glow 2.4s ease-in-out infinite;
}

.btn.fired {
  background: rgba(252, 213, 53, 0.22);
  border-color: rgba(252, 213, 53, 0.7);
  box-shadow: 0 0 26px rgba(252, 213, 53, 0.45);
}

.btn.active {
  background: rgba(252, 213, 53, 0.2);
  border-color: rgba(252, 213, 53, 0.55);
  box-shadow: 0 10px 24px rgba(252, 213, 53, 0.24);
}

.btn-ghost {
  background: rgba(252, 213, 53, 0.08);
  border-color: rgba(252, 213, 53, 0.3);
}

.btn-chip {
  padding: 10px 12px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(252, 213, 53, 0.1);
  border-color: rgba(252, 213, 53, 0.3);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.btn-primary {
  background: linear-gradient(120deg, rgba(252, 213, 53, 0.78), rgba(240, 185, 11, 0.4));
  border-color: rgba(252, 213, 53, 0.6);
  color: #0b0e13;
}

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

.dash-item {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.dash-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.dash-value {
  font-size: 18px;
  font-weight: 600;
}

.dash-refresh {
  margin-top: 12px;
  width: 100%;
}

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

.market-overview {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.overview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.bias-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.6px;
}

.bias-pill {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
}

.bias-long {
  background: rgba(252, 213, 53, 0.18);
  color: var(--accent);
  border: 1px solid rgba(252, 213, 53, 0.5);
}

.bias-short {
  background: rgba(246, 70, 93, 0.18);
  color: var(--bear);
  border: 1px solid rgba(246, 70, 93, 0.5);
}

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

.chart,
.heatmap {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.chart-head,
.heat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.chip {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(252, 213, 53, 0.18);
  color: var(--accent);
  font-size: 11px;
}

.chart-body {
  position: relative;
  height: 170px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(8, 12, 20, 0.9), rgba(12, 18, 30, 0.7));
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.candles {
  position: absolute;
  inset: 16px 12px 16px;
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 6px;
  align-items: end;
}

.candles .c {
  width: 100%;
  border-radius: 4px;
  height: 34px;
  position: relative;
  background: rgba(252, 213, 53, 0.45);
}

.candles .c::before {
  content: "";
  position: absolute;
  width: 2px;
  height: 24px;
  left: 50%;
  transform: translateX(-50%);
  top: -16px;
  background: rgba(255, 255, 255, 0.4);
}

.candles .c.up {
  background: rgba(63, 226, 154, 0.6);
}

.candles .c.down {
  background: rgba(255, 95, 109, 0.6);
}

.candles .c.tall {
  height: 60px;
}

.price-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 55%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(252, 213, 53, 0.6), transparent);
}

.price-tag {
  position: absolute;
  right: 12px;
  top: 48%;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  background: rgba(252, 213, 53, 0.2);
  color: var(--accent);
  border: 1px solid rgba(252, 213, 53, 0.5);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.heatmap .heat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  height: 170px;
}

.heatmap .heat-grid span {
  border-radius: 8px;
  background: rgba(246, 70, 93, 0.12);
}

.heatmap .heat-grid span:nth-child(3n) {
  background: rgba(240, 185, 11, 0.2);
}

.heatmap .heat-grid span:nth-child(4n) {
  background: rgba(14, 203, 129, 0.2);
}

.heatmap .heat-grid span:nth-child(5n) {
  background: rgba(246, 70, 93, 0.22);
}

.heat-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 10px;
}

.legend-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(240, 185, 11, 0.4), rgba(246, 70, 93, 0.6));
}

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

.mini-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.mini-label {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.mini-value {
  font-size: 16px;
  font-weight: 600;
}

.mini-value.positive {
  color: var(--bull);
}

.mini-value.negative {
  color: var(--bear);
}

.mini-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.footer {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  justify-content: center;
  align-items: center;
}

.dot {
  color: rgba(255, 255, 255, 0.2);
}

.statusbar {
  margin-top: 4px;
  text-align: center;
  font-size: 11px;
  color: rgba(234, 236, 239, 0.6);
  letter-spacing: 0.2px;
}

.response pre,
#response-box {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  background: rgba(12, 16, 24, 0.8);
  border-radius: 14px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-height: 90px;
}

.ticker {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(12, 16, 24, 0.8);
  box-shadow: var(--shadow);
  padding: 10px 0;
}

.ticker::before,
.ticker::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40px;
  z-index: 2;
  pointer-events: none;
}

.ticker::before {
  left: 0;
  background: linear-gradient(90deg, rgba(11, 14, 19, 1), transparent);
}

.ticker::after {
  right: 0;
  background: linear-gradient(270deg, rgba(11, 14, 19, 1), transparent);
}

.ticker-track {
  display: inline-flex;
  gap: 16px;
  white-space: nowrap;
  padding: 0 16px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  animation: ticker 22s linear infinite;
}

.ticker-track .up {
  color: var(--accent);
}

.ticker-track .down {
  color: var(--bear);
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(0.9);
    opacity: 0.6;
  }
}

@keyframes ticker {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@keyframes glow {
  0% {
    box-shadow: 0 0 10px rgba(252, 213, 53, 0.2);
  }
  50% {
    box-shadow: 0 0 24px rgba(252, 213, 53, 0.55);
  }
  100% {
    box-shadow: 0 0 10px rgba(252, 213, 53, 0.2);
  }
}

@media (max-width: 420px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .grid-4,
  .grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-panel,
  .split {
    grid-template-columns: 1fr;
  }

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

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