:root {
  --bg-top: #23070b;
  --bg-bottom: #080203;
  --panel: rgba(26, 9, 13, 0.84);
  --panel-strong: rgba(42, 12, 17, 0.96);
  --border: rgba(255, 154, 110, 0.18);
  --text-main: #f8e5db;
  --text-muted: #d7b2a6;
  --accent: #ffb24d;
  --accent-strong: #d43c3c;
  --accent-soft: #ff7a59;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
}

body.index-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(212, 60, 60, 0.34), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 178, 77, 0.18), transparent 24%),
    radial-gradient(circle at center, rgba(92, 16, 20, 0.28), transparent 48%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 2px,
      transparent 2px,
      transparent 14px
    ),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text-main);
  font-family: "IBM Plex Sans", sans-serif;
}

body.table-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(212, 60, 60, 0.34), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 178, 77, 0.18), transparent 24%),
    radial-gradient(circle at center, rgba(92, 16, 20, 0.28), transparent 48%),
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.015) 0,
      rgba(255, 255, 255, 0.015) 2px,
      transparent 2px,
      transparent 14px
    ),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text-main);
  font-family: "IBM Plex Sans", sans-serif;
}

.index-page * {
  box-sizing: border-box;
}

.table-page * {
  box-sizing: border-box;
}

.page-shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(260px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.hero-copy,
.summary-card,
.metric-nav,
.chart-panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(67, 17, 21, 0.88), rgba(18, 5, 8, 0.92)),
    var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.hero-copy::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(140deg, rgba(255, 178, 77, 0.06), transparent 40%),
    linear-gradient(320deg, rgba(212, 60, 60, 0.18), transparent 45%);
  pointer-events: none;
}

.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -70px -90px auto;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(212, 60, 60, 0.32), transparent 70%);
}

.eyebrow {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.hero-copy h1,
.chart-panel h2,
.nav-group h2,
.table-panel-header h2 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.hero-copy h1 {
  max-width: 12ch;
  font-size: clamp(2.6rem, 5vw, 4.75rem);
  line-height: 0.95;
}

.hero-text,
.summary-card p,
.chart-panel-note {
  color: var(--text-muted);
}

.hero-text {
  max-width: 62ch;
  margin: 18px 0 0;
  font-size: 1rem;
  line-height: 1.7;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.meta-pill,
.meta-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 178, 77, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  text-decoration: none;
}

.meta-link {
  background: linear-gradient(135deg, rgba(212, 60, 60, 0.24), rgba(255, 178, 77, 0.14));
  border-color: rgba(255, 122, 89, 0.34);
}

.meta-link:hover,
.nav-chip:hover {
  color: var(--text-main);
  text-decoration: none;
}

.hero-aside {
  display: flex;
}

.summary-card {
  width: 100%;
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(76, 18, 24, 0.96), rgba(22, 6, 9, 0.96)),
    var(--panel-strong);
}

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

.summary-card strong {
  display: block;
  margin-bottom: 14px;
  font-family: "Cinzel", serif;
  font-size: 2rem;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 24px;
}

.metric-nav {
  padding: 22px;
}

.nav-group + .nav-group {
  margin-top: 22px;
}

.nav-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.nav-heading-row h2 {
  font-size: 1.2rem;
}

.nav-heading-row span {
  min-width: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 178, 77, 0.08);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

.nav-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 130, 97, 0.12);
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.2;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.nav-chip:hover,
.nav-chip.is-active {
  transform: translateY(-1px);
  border-color: rgba(255, 178, 77, 0.3);
}

.nav-chip.is-active {
  background: linear-gradient(135deg, rgba(212, 60, 60, 0.32), rgba(255, 178, 77, 0.2));
  color: var(--text-main);
}

.chart-panel {
  padding: 28px;
}

.page-shell-table,
.page-shell-chart {
  max-width: 1640px;
}

.hero-panel-chart,
.hero-panel-table {
  margin-bottom: 28px;
  grid-template-columns: 1fr;
}

.hero-copy-chart,
.hero-copy-table {
  min-height: 0;
  padding: 24px 28px;
}

.hero-copy-chart h1,
.hero-copy-table h1 {
  max-width: 24ch;
  font-size: clamp(2rem, 3.6vw, 3rem);
  line-height: 1.02;
}

.hero-copy-chart .hero-text,
.hero-copy-table .hero-text {
  max-width: 58ch;
  margin-top: 12px;
  line-height: 1.55;
}

.hero-copy-chart .eyebrow,
.hero-copy-table .eyebrow {
  margin-bottom: 10px;
}

.hero-copy-chart .hero-actions,
.hero-copy-table .hero-actions {
  margin-top: 16px;
}

.table-panel {
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(67, 17, 21, 0.88), rgba(18, 5, 8, 0.92)),
    var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  padding: 28px;
}

.table-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.table-scroll {
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(255, 178, 77, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 180, 116, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(16, 4, 6, 0.58);
}

.hiscore-grid {
  width: 100%;
  min-width: 860px;
  border-collapse: separate;
  border-spacing: 0;
}

.hiscore-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px 18px;
  background: rgba(38, 10, 14, 0.97);
  border-bottom: 1px solid rgba(255, 178, 77, 0.12);
  color: var(--text-main);
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: left;
}

.hiscore-grid thead th.metric-header {
  left: 0;
  z-index: 3;
}

.hiscore-grid tbody th,
.hiscore-grid tbody td {
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 178, 77, 0.06);
  background: rgba(255, 255, 255, 0.015);
}

.hiscore-grid tbody tr:nth-child(2n) th,
.hiscore-grid tbody tr:nth-child(2n) td {
  background: rgba(255, 122, 89, 0.03);
}

.hiscore-grid tbody tr:hover th,
.hiscore-grid tbody tr:hover td {
  background: rgba(212, 60, 60, 0.12);
}

.hiscore-grid tbody th.metric-name {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 220px;
  background: rgba(38, 10, 14, 0.98);
  font-weight: 500;
  text-align: left;
}

.hiscore-grid tbody tr:nth-child(2n) th.metric-name {
  background: rgba(49, 13, 18, 0.98);
}

.hiscore-grid tbody tr:hover th.metric-name {
  background: rgba(79, 18, 25, 0.99);
}

.hiscore-grid tbody td {
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.metric-name a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  text-decoration: none;
}

.metric-icon {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  image-rendering: -webkit-optimize-contrast;
}

.metric-name a:hover {
  color: var(--accent);
  text-decoration: none;
}

.chart-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.chart-panel h2 {
  font-size: clamp(1.8rem, 3vw, 2.6rem);
}

.chart-panel-note {
  max-width: 32ch;
  margin: 0;
  text-align: right;
  line-height: 1.6;
}

.chart-stage {
  position: relative;
  min-height: 540px;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 180, 116, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(16, 4, 6, 0.58);
  border: 1px solid rgba(255, 178, 77, 0.08);
}

.chart-status {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 500px;
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.02em;
}

#myChart {
  width: 100% !important;
  height: 500px !important;
}

@media (max-width: 1100px) {
  .hero-panel,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .chart-panel-note {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 18px 14px 28px;
  }

  .hero-copy,
  .summary-card,
  .metric-nav,
  .chart-panel {
    border-radius: 22px;
  }

  .hero-copy,
  .summary-card,
  .metric-nav,
  .chart-panel {
    padding: 20px;
  }

  .chart-stage {
    min-height: 420px;
    padding: 12px;
  }

  .chart-status,
  #myChart {
    min-height: 380px;
    height: 380px !important;
  }

  .table-panel {
    padding: 20px;
    border-radius: 22px;
  }

  .table-scroll {
    border-radius: 18px;
  }

  .hiscore-grid {
    min-width: 720px;
  }
}
