:root {
  --bg-1: #12081d;
  --bg-2: #1f1634;
  --bg-3: #2c1b3d;
  --panel: rgba(18, 22, 42, 0.82);
  --panel-alt: rgba(31, 23, 50, 0.9);
  --accent: #f7d870;
  --accent-2: #ff7e5f;
  --success: #7ef0b6;
  --warning: #ffd166;
  --danger: #ff6b7d;
  --text: #fcefd8;
  --muted: #d8c5aa;
  --line: rgba(255, 219, 143, 0.22);
  --glow: rgba(247, 216, 112, 0.5);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background:
    radial-gradient(circle at top, rgba(255, 177, 74, 0.18), transparent 30%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 40%, var(--bg-3) 100%);
  color: var(--text);
  min-height: 100vh;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 16px 72px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 8px 0;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 3vw, 3rem);
  text-shadow: 0 0 18px rgba(247, 216, 112, 0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(126, 240, 182, 0.12);
  border: 1px solid rgba(126, 240, 182, 0.32);
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(126, 240, 182, 0.14);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(126, 240, 182, 0.12);
  border: 1px solid rgba(126, 240, 182, 0.32);
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(126, 240, 182, 0.14);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12);
  display: inline-block;
  animation: pulse 1.8s infinite ease-in-out;
}

.badge-text {
  white-space: nowrap;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  background: linear-gradient(135deg, rgba(31, 23, 50, 0.9), rgba(18, 22, 42, 0.8));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
  text-align: center;
}

.summary-card .label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-card strong {
  display: block;
  font-size: 1.8rem;
  font-weight: 700;
}

.panel {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.82), rgba(24, 18, 36, 0.82));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.18);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h2 {
  margin: 0;
}

.panel-header span {
  color: var(--muted);
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

thead th {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

tbody td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.leader-row {
  background: rgba(15, 23, 42, 0.7);
}

.top-rank {
  background: linear-gradient(90deg, rgba(126, 240, 182, 0.18), rgba(15, 23, 42, 0.7));
}

.second-rank {
  background: linear-gradient(90deg, rgba(255, 209, 102, 0.14), rgba(15, 23, 42, 0.7));
}

.third-rank {
  background: linear-gradient(90deg, rgba(255, 126, 95, 0.14), rgba(15, 23, 42, 0.7));
}

.negative-row {
  background: linear-gradient(90deg, rgba(255, 107, 125, 0.1), rgba(15, 23, 42, 0.7));
}

tbody tr:hover {
  background: rgba(148, 163, 184, 0.06);
}

.rank-badge {
  display: inline-flex;
  min-width: 32px;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  color: var(--accent);
  font-weight: 700;
}

.timestamp-cell {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.return-positive {
  color: var(--success);
  font-weight: 700;
}

.return-negative {
  color: var(--danger);
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.status-active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border-color: rgba(56, 189, 248, 0.36);
}

.status-target {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border-color: rgba(34, 197, 94, 0.36);
}

.status-stop {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.36);
}

@media (max-width: 700px) {
  .page-shell {
    padding: 20px 10px 48px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .pill,
  .refresh-btn {
    width: 100%;
    justify-content: center;
  }

  .panel {
    padding: 12px;
  }

  table {
    min-width: 760px;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 1.7rem;
  }

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

  .summary-card strong {
    font-size: 1.4rem;
  }

  .status-pill {
    padding: 5px 8px;
    font-size: 11px;
  }
}
