:root {
  color-scheme: dark;
  --bg: #070b12;
  --panel: rgba(15, 23, 36, .84);
  --panel-2: rgba(18, 29, 45, .92);
  --line: rgba(148, 170, 204, .13);
  --text: #f5f8fc;
  --muted: #8290a7;
  --cyan: #25d9c8;
  --blue: #4d8cff;
  --green: #19d992;
  --red: #ff5d78;
  --amber: #f7bf5c;
  --shadow: 0 20px 60px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 4%, rgba(41, 106, 255, .13), transparent 30rem),
    radial-gradient(circle at 90% 10%, rgba(37, 217, 200, .08), transparent 26rem),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .3;
  background-image: linear-gradient(rgba(255,255,255,.015) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.015) 1px, transparent 1px);
  background-size: 48px 48px;
}

.shell { width: min(1440px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 54px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid rgba(77,140,255,.38); border-radius: 14px; color: #fff; font-size: 20px; font-weight: 800; background: linear-gradient(145deg, #2563eb, #13b8a7); box-shadow: 0 10px 30px rgba(38,110,240,.22); }
.eyebrow, .section-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.eyebrow span { color: var(--cyan); }
h1, h2 { margin: 0; font-weight: 720; letter-spacing: -.025em; }
h1 { margin-top: 3px; font-size: 24px; }
h2 { margin-top: 5px; font-size: 19px; }

.connection, .engine-state { display: flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; background: rgba(255,255,255,.025); }
.connection i, .engine-state i { width: 8px; height: 8px; border-radius: 50%; background: #657086; box-shadow: 0 0 0 4px rgba(101,112,134,.1); }
.connection.connected, .engine-state.running { color: var(--green); border-color: rgba(25,217,146,.2); background: rgba(25,217,146,.06); }
.connection.connected i, .engine-state.running i { background: var(--green); box-shadow: 0 0 0 4px rgba(25,217,146,.1), 0 0 18px rgba(25,217,146,.65); }

.panel { border: 1px solid var(--line); border-radius: 18px; background: linear-gradient(145deg, rgba(18,28,43,.92), rgba(11,17,27,.84)); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.instrument-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-bottom: 18px; padding: 7px; border-radius: 15px; }
.instrument-selector button { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-width: 0; padding: 13px 16px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); font: inherit; text-align: left; cursor: pointer; background: transparent; transition: .18s ease; }
.instrument-selector button:hover { color: var(--text); background: rgba(255,255,255,.035); }
.instrument-selector button span { overflow: hidden; font-size: 14px; font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.instrument-selector button small { color: #56647a; font-size: 9px; font-weight: 800; letter-spacing: .09em; white-space: nowrap; }
.instrument-selector button.active { color: #fff; border-color: rgba(37,217,200,.24); background: linear-gradient(135deg, rgba(77,140,255,.18), rgba(37,217,200,.11)); box-shadow: inset 0 0 24px rgba(37,217,200,.035); }
.instrument-selector button.active small { color: var(--cyan); }
.market-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; }
.price-card { padding: 22px; }
.price-heading { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 760; letter-spacing: .08em; }
.demo-tag { padding: 5px 7px; border-radius: 6px; color: var(--amber); font-size: 9px; background: rgba(247,191,92,.09); border: 1px solid rgba(247,191,92,.16); }
.quote-block { padding: 43px 0 38px; }
.quote-block > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.quote-block strong { font-variant-numeric: tabular-nums; font-size: clamp(31px, 3vw, 43px); letter-spacing: -.04em; }
.quote-label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.ask-quote { margin-top: 8px; }
.ask-quote strong { color: var(--cyan); font-size: 20px; letter-spacing: -.02em; }
.mini-stats { display: grid; gap: 0; border-top: 1px solid var(--line); }
.mini-stats div { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.mini-stats span { color: var(--muted); }
.mini-stats b { font-variant-numeric: tabular-nums; font-weight: 650; }

.chart-card { min-width: 0; padding: 20px 20px 14px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.timeframes { display: flex; gap: 5px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(0,0,0,.18); }
.timeframes button { display: grid; min-width: 57px; padding: 6px 9px; border: 0; border-radius: 7px; color: var(--muted); font: inherit; cursor: pointer; background: transparent; }
.timeframes button b { font-size: 11px; font-weight: 780; }
.timeframes button small { margin-top: 2px; color: #596a83; font: 9px ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; }
.timeframes button:hover { color: var(--text); }
.timeframes button.active { color: #fff; background: linear-gradient(135deg, rgba(77,140,255,.75), rgba(37,217,200,.45)); box-shadow: 0 5px 18px rgba(46,119,220,.2); }
.timeframes button.active small { color: rgba(255,255,255,.86); }
.chart-wrap { position: relative; height: 350px; margin-top: 12px; overflow: hidden; border-radius: 12px; background: linear-gradient(180deg, rgba(6,11,18,.4), rgba(5,9,15,.72)); }
#chart { display: block; width: 100%; height: 100%; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.chart-empty.hidden { display: none; }
.chart-footer { display: flex; align-items: center; gap: 18px; padding-top: 12px; color: var(--muted); font-size: 10px; }
.legend { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 2px; }
.legend.up { background: var(--green); } .legend.down { background: var(--red); }
.persistence-note { display: inline-flex; align-items: center; gap: 5px; color: #64cbaa; }
.persistence-note i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(25,217,146,.6); }
.source-note { margin-left: auto; }

.status-section { margin-top: 28px; }
.section-title { display: flex; align-items: end; justify-content: space-between; margin: 0 2px 12px; }
.status-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric { min-width: 0; padding: 17px; box-shadow: 0 12px 35px rgba(0,0,0,.18); }
.metric > span { display: block; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.metric strong { display: block; overflow: hidden; margin: 9px 0 5px; font-size: 22px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; }
.metric strong b { font: inherit; } .metric strong em { margin-left: 3px; color: var(--muted); font-size: 11px; font-style: normal; }
.metric small { color: #56647a; font-size: 10px; }

@media (max-width: 1050px) {
  .market-grid { grid-template-columns: 280px minmax(0, 1fr); }
  .status-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 24px, 700px); padding-top: 18px; }
  .market-grid { grid-template-columns: 1fr; }
  .quote-block { padding: 28px 0; }
  .chart-head { align-items: flex-start; flex-direction: column; }
  .timeframes { width: 100%; }
  .timeframes button { flex: 1; min-width: 0; padding-inline: 4px; }
  .chart-wrap { height: 310px; }
	.instrument-selector button { align-items: flex-start; flex-direction: column; gap: 3px; padding: 11px; }
}
@media (max-width: 520px) {
  .eyebrow { font-size: 8px; }
  .brand-mark { width: 40px; height: 40px; }
  .connection { padding: 8px 10px; }
  .connection span { display: none; }
  .status-grid { grid-template-columns: repeat(2, 1fr); }
  .source-note { display: none; }
  .chart-footer { gap: 10px; }
}
