:root {
  color-scheme: dark;
  --bg: #06080b;
  --panel: #10161d;
  --panel-2: #151d26;
  --line: #232f3b;
  --text: #eef4fb;
  --muted: #8194a8;
  --green: #35d68a;
  --red: #ff6b6b;
  --yellow: #ffcf5c;
  --blue: #5aa9ff;
  --accent-btc: #f7931a;
  --accent-eth: #a78bfa;
  --accent-sol: #14f1c6;
  --accent-xrp: #6b8cff;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 10% -10%, #101a26 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.4 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 5;
}

h1, h2, h3, p { margin: 0; }
h1 {
  font-size: 19px;
  font-weight: 750;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #fff, #9db3c9);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

#clock, .muted { color: var(--muted); font-size: 12.5px; }

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
  min-width: min(640px, 52vw);
}

.stat {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 9px 12px;
}

.stat label {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat strong { display: block; margin-top: 4px; font-size: 16px; font-weight: 700; }

main { padding: 20px; max-width: 1600px; margin: 0 auto; }

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

.market {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), #0d1319);
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px -16px rgba(0,0,0,0.6);
  border-top: 2px solid var(--line);
}

.market-grid > article:nth-child(1) { border-top-color: var(--accent-btc); }
.market-grid > article:nth-child(2) { border-top-color: var(--accent-eth); }
.market-grid > article:nth-child(3) { border-top-color: var(--accent-sol); }
.market-grid > article:nth-child(4) { border-top-color: var(--accent-xrp); }

.market-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.coin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  border: 1px solid var(--line);
  color: var(--yellow);
  font-weight: 800;
  font-size: 14px;
  background: #0d131a;
  letter-spacing: -0.02em;
}

.title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.head-left {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.timer {
  text-align: right;
  white-space: nowrap;
  color: var(--muted);
}

.timer strong { color: var(--text); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

.position-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}

.position-bar.pos-up { background: rgba(53, 214, 138, 0.1); color: var(--green); }
.position-bar.pos-down { background: rgba(255, 107, 107, 0.1); color: var(--red); }

.position-label {
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.position-side { font-weight: 800; letter-spacing: 0.02em; }
.position-detail { color: var(--text); opacity: 0.8; font-weight: 500; }

.market-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(300px, 1.1fr);
  gap: 14px;
  padding: 14px;
}

.readout {
  display: grid;
  gap: 8px;
  align-content: start;
}

.kv {
  display: grid;
  grid-template-columns: 104px 1fr;
  align-items: center;
  min-height: 30px;
  border-bottom: 1px solid #1b2630;
  gap: 8px;
}

.kv span:first-child { color: var(--muted); font-size: 12.5px; }
.kv strong { font-size: 14px; overflow-wrap: anywhere; transition: color 0.3s ease; }

.timer strong, .stat strong { transition: color 0.3s ease; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0d131a;
  color: var(--muted);
  font-weight: 650;
  font-size: 12.5px;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}

.badge.ok { color: var(--green); }
.badge.bad { color: var(--red); }
.badge.wait { color: var(--yellow); }

.spark {
  width: 100%;
  height: 76px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b1117;
}

.shot-wrap {
  min-height: 310px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #080b0f;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.shot {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.shot.loaded { opacity: 1; }

.shot-footer {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.015);
}

.event-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid rgba(90, 169, 255, 0.35);
  background: rgba(90, 169, 255, 0.1);
  color: var(--blue);
  text-decoration: none;
  font-weight: 650;
  font-size: 12.5px;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.event-link-arrow {
  transition: transform 0.15s ease;
}

.event-link:hover {
  background: rgba(90, 169, 255, 0.2);
  border-color: rgba(90, 169, 255, 0.6);
}

.event-link:hover .event-link-arrow { transform: translateX(2px); }

.trades {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}

.trade-table {
  display: grid;
  overflow-x: auto;
}

.trade-row {
  display: grid;
  grid-template-columns: 56px 170px 58px 84px 84px 72px 92px 160px;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #1b2630;
  min-width: 830px;
  transition: background 0.15s ease;
}

.trade-row:not(.header):hover { background: rgba(255,255,255,0.02); }

.trade-row.header {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--panel-2);
}

.green { color: var(--green); }
.red { color: var(--red); }
.yellow { color: var(--yellow); }

@media (max-width: 980px) {
  .topbar { display: grid; }
  .stats { min-width: 0; width: 100%; grid-template-columns: repeat(2, 1fr); }
  .market-grid { grid-template-columns: 1fr; }
  .market-body { grid-template-columns: 1fr; }
}
