/* ---------- Tooltip / empty ---------- */

.tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 30;
  min-width: 172px;
  max-width: 230px;
  padding: 10px 12px 11px;
  border-radius: 11px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(7, 12, 20, 0.96);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: none;
  font-size: 11.5px;
  color: var(--muted);
  transform: translate3d(0, 0, 0);
  transition: opacity 0.1s;
}

.tooltip[hidden] {
  display: none;
}

.tt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--dim);
  margin-bottom: 5px;
}

.tt-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.tt-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}

.tt-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.tt-row strong {
  color: var(--text-soft);
  font-weight: 600;
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: radial-gradient(420px 260px at 50% 45%, rgba(14, 22, 35, 0.7), rgba(6, 9, 15, 0.22));
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.empty-state[hidden] {
  display: none;
}

.empty-icon {
  font-size: 30px;
  color: var(--dim);
  line-height: 1;
  margin-bottom: 2px;
}

.empty-state p {
  margin: 0;
}

.empty-state #empty-title {
  color: var(--text-soft);
  font-size: 13px;
}

.empty-sub {
  font-size: 11px;
  color: var(--dim);
  max-width: 360px;
  line-height: 1.6;
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 2px 4px 6px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.2px;
}

.footer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-row.muted {
  color: var(--dim);
}

.footer-row.small {
  font-size: 10px;
}

/* ---------- Animations ---------- */

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(255, 77, 79, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 77, 79, 0);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1120px) {
  .dashboard {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .brand-text h1 {
    font-size: 18px;
  }
}

@media (max-width: 900px) {
  body {
    background-attachment: scroll;
  }

  .app {
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 10px;
    gap: 10px;
  }

  .topbar {
    gap: 10px;
    align-items: flex-start;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .brand-text h1 {
    font-size: 16px;
    white-space: normal;
  }

  .brand-text .sub {
    font-size: 10.5px;
    white-space: normal;
  }

  .topbar-meta {
    order: 3;
    width: 100%;
    margin-left: 0;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .topbar-actions {
    order: 2;
    margin-left: auto;
  }

  .date-line {
    font-size: 12px;
    gap: 7px;
  }

  .asof-line {
    font-size: 10.5px;
  }

  .dashboard {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 0;
    flex: initial;
  }

  .leader-overlay {
    display: none;
  }

  .chart-panel {
    min-height: 58vh;
  }

  .chart-wrap {
    min-height: 300px;
  }

  .rank-panel {
    max-height: none;
    min-height: 0;
  }

  .rank-list {
    max-height: none;
    overflow: visible;
  }

  .panel-head {
    padding: 12px 12px 8px;
  }

  .legend {
    margin-left: 0;
    order: 3;
  }

  .chart-tools {
    margin-left: auto;
  }

  .replay-bar {
    flex-wrap: wrap;
    padding: 8px 10px 10px;
  }

  #replay-slider {
    order: 5;
    flex-basis: 100%;
  }

  .footer-row {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .brand-text h1 {
    font-size: 15px;
  }

  .view-weekday {
    display: none;
  }

  .topbar-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .select-wrap {
    flex: 1;
  }

  .topbar-actions select {
    width: 100%;
  }

  .chart-panel {
    min-height: 52vh;
  }

  .chart-title h2 {
    font-size: 13px;
  }

  .unit {
    display: none;
  }

  .chart-tools .btn {
    padding: 6px 9px;
    font-size: 11px;
  }

  .rank-panel {
    max-height: none;
  }

  .footer {
    font-size: 9.5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.chart-wrap canvas {
  touch-action: pan-y;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
