* { box-sizing: border-box; font-family: 'Inter', system-ui, -apple-system, sans-serif; }
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  color: #d1d4dc;
  overflow: hidden;
}
body {
  display: flex; flex-direction: column;
  background: #080b12;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 0%, rgba(16, 185, 129, 0.06) 0%, transparent 50%);
}

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  flex-shrink: 0;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.055) 0%,
    rgba(255,255,255,0.028) 100%
  );
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 8px 32px rgba(0,0,0,0.5);
  position: relative;
  z-index: 50;
}

.brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: #fff;
  text-shadow: 0 0 20px rgba(255,255,255,0.3);
  margin-right: 4px;
}

.symbol {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.4);
  margin-right: 12px;
}

.sep {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.08);
  margin: 0 8px;
  flex-shrink: 0;
}

.spacer { flex: 1; }

.topbar-collapsible { display: contents; }
.topbar-collapse-btn { display: none; }
.tfs { display: flex; gap: 2px; }
.tfs button {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.35);
  background: transparent;
  border: none;
  padding: 5px 9px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
}
.tfs button:hover {
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.05);
}
.tfs button.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.15),
    0 0 12px rgba(255,255,255,0.08),
    0 0 0 1px rgba(255,255,255,0.08);
}

.traders-wrap { position: relative; }
.traders-btn {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 5px 14px;
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.traders-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
.traders-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 0 16px rgba(255,255,255,0.05);
}
.traders-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  box-shadow:
    0 0 20px rgba(255,255,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.15);
}

.traders-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: rgba(12,14,20,0.95);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  z-index: 100;
  min-width: 140px;
}
.traders-dropdown.open { display: block; }
.traders-dropdown label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
}
.traders-dropdown label:hover { background: rgba(255,255,255,0.05); }

#calendar-btn {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 5px 14px;
  border-radius: 100px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
#calendar-btn::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
#calendar-btn:hover {
  color: rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.18);
  box-shadow: 0 0 16px rgba(255,255,255,0.05);
}
#calendar-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
  box-shadow:
    0 0 20px rgba(255,255,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.15);
}

.price-wrap {
  display: flex;
  align-items: center;
}
#price-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  box-shadow: none;
  margin-right: 8px;
  display: inline-block;
  animation: none;
  flex-shrink: 0;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 8px #00C853, 0 0 16px rgba(0,200,83,0.4); }
  50% { box-shadow: 0 0 4px #00C853, 0 0 8px rgba(0,200,83,0.2); }
}
.price {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px rgba(255,255,255,0.2);
}

#chart-wrap { flex: 1; min-height: 0; }

#jump-to-now {
  position: absolute;
  bottom: 40px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  font-size: 18px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  user-select: none;
  transition: all 0.15s ease;
}
#jump-to-now:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.2);
}

.brand-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.85;
  pointer-events: none;
  user-select: none;
  z-index: 10;
}
.brand-x {
  color: #fff;
  font-size: 14px;
  line-height: 1;
  font-weight: 300;
  width: 16px;
  text-align: center;
  display: block;
}
.brand-logo {
  height: 22px;
  width: auto;
  display: block;
  filter: brightness(0) invert(1);
}

/* ── Mobile overrides (phones) ─────────────────────────────────── */
@media (max-width: 768px) and (pointer: coarse) {
  .topbar {
    height: auto;
    padding: 10px 12px;
    gap: 0;
    flex-wrap: wrap;
    row-gap: 8px;
  }

  /* Row 1: COT · sep · XAU/USD · spacer · price */
  .brand {
    font-size: 16px;
    margin-right: 0;
  }
  .symbol {
    font-size: 14px;
    margin-right: 0;
  }
  .sep {
    display: none;
  }
  .brand::after {
    content: '';
    display: inline-block;
    width: 1px;
    height: 14px;
    background: rgba(255,255,255,0.15);
    margin: 0 8px;
    vertical-align: middle;
  }
  .spacer {
    flex: 1;
  }
  .price-wrap {
    display: flex;
    align-items: center;
  }
  .price {
    font-size: 18px;
  }
  #price-dot {
    width: 8px;
    height: 8px;
    margin-right: 8px;
  }

  /* Row 2: collapsible — TF buttons · TRADERS · CALENDAR */
  .topbar-collapsible {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    order: 10;
    row-gap: 8px;
    max-height: 200px;
    opacity: 1;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
  }
  .topbar.collapsed .topbar-collapsible {
    max-height: 0;
    opacity: 0;
    margin-top: -8px; /* eat the row-gap */
  }
  .tfs {
    width: 100%;
    display: flex;
    gap: 2px;
  }
  .tfs button {
    font-size: 13px;
    padding: 7px 10px;
    flex: 1;
    text-align: center;
  }
  .traders-wrap {
    margin-left: auto;
  }
  .traders-btn,
  #calendar-btn {
    font-size: 13px;
    padding: 7px 14px;
    margin-left: 6px;
  }

  /* Row 3: collapse arrow — centered below row 2 */
  .topbar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    order: 20;
    width: 100%;
    height: 16px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.45);
    cursor: pointer;
    padding: 0;
    margin: -2px 0 -4px;
  }
  .topbar-collapse-btn svg {
    transition: transform 0.25s ease;
  }
  .topbar.collapsed .topbar-collapse-btn svg {
    transform: rotate(180deg);
  }
}

.cal-country {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.4);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.cal-country.active {
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
  border-color: rgba(255,255,255,0.25);
}
.cal-country:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}
#calendar-panel {
  display: none;
}
#calendar-panel[style*="flex"] .tradingview-widget-container,
#calendar-panel.open .tradingview-widget-container {
  height: calc(100% - 49px);
}
