:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --bg4: #222222;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --text: #f0ede8;
  --text2: #888880;
  --text3: #555550;
  --green: #1DB954;
  --green2: #17a349;
  --green-dim: rgba(29,185,84,0.12);
  --green-glow: rgba(29,185,84,0.06);
  --amber: #f5a623;
  --amber-dim: rgba(245,166,35,0.1);
  --blue: #4a9eff;
  --blue-dim: rgba(74,158,255,0.1);
  --red: #e24b4a;
  --red-dim: rgba(226,75,74,0.1);
  --font: 'Syne', sans-serif;
  --mono: 'DM Mono', monospace;
  --radius: 12px;
  --radius-sm: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── UPLOAD SCREEN ── */
#upload-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

#upload-screen::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(29,185,84,0.04) 0%, transparent 70%);
  pointer-events: none;
}

.upload-inner {
  text-align: center;
  max-width: 520px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.logo-mark {
  width: 56px;
  height: 56px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
}

.logo-mark svg {
  width: 28px;
  height: 28px;
  fill: #000;
}

.upload-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.upload-title span {
  color: var(--green);
}

.upload-sub {
  color: var(--text2);
  font-size: 14px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.drop-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  position: relative;
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--green);
  background: var(--green-glow);
}

.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.drop-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: var(--text3);
}

.drop-label {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.drop-hint {
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
}

.file-list {
  margin-top: 1.5rem;
  text-align: left;
  display: none;
}

.file-list.visible { display: block; }

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg3);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text2);
}

.file-item .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
}

.analyze-btn {
  margin-top: 1.5rem;
  width: 100%;
  padding: 14px;
  background: var(--green);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: none;
}

.analyze-btn.visible { display: block; }
.analyze-btn:hover { background: var(--green2); }
.analyze-btn:active { transform: scale(0.99); }

/* ── PROGRESS ── */
#progress-screen {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  flex-direction: column;
  gap: 2rem;
  text-align: center;
}

.progress-title {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.progress-bar-wrap {
  width: 320px;
  height: 3px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-status {
  font-size: 12px;
  color: var(--text2);
  font-family: var(--mono);
}

/* ── DASHBOARD ── */
#dashboard {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

#tops-page {
  display: none;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 1rem;
}

.dash-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.dash-title span { color: var(--green); }

.reset-btn {
  background: none;
  border: 1px solid var(--border2);
  color: var(--text2);
  padding: 8px 16px;
  border-radius: 99px;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.reset-btn:hover { border-color: var(--text2); color: var(--text); }

.secondary-btn {
  background: var(--bg2);
  border: 1px solid var(--border2);
  color: var(--text);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.secondary-btn:hover {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--green);
}

/* ── SECTION ── */
.section {
  margin-bottom: 3rem;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.section-heading .section-label {
  margin-bottom: 0;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text3);
  margin-bottom: 1.2rem;
  font-family: var(--mono);
}

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.25rem;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 100%; height: 2px;
  background: var(--green);
  opacity: 0;
  transition: opacity 0.2s;
}

.stat-card:hover::before { opacity: 1; }

.stat-label {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat-sub {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
}

.stat-green { color: var(--green); }
.stat-amber { color: var(--amber); }
.stat-blue { color: var(--blue); }
.stat-red { color: var(--red); }

/* ── CHART CARDS ── */
.chart-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.2rem;
}

.chart-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}

.chart-subtitle {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
  margin-bottom: 1.5rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
}

@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
}

.chart-wrap {
  position: relative;
  width: 100%;
}

/* ── TOP LISTS ── */
.rank-list {
  list-style: none;
}

.rank-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.rank-item:last-child { border-bottom: none; }

.rank-num {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text3);
  text-align: right;
}

.rank-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-name .sub {
  display: block;
  font-size: 11px;
  color: var(--text2);
  font-weight: 400;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rank-val {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
  min-width: 60px;
  text-align: right;
  white-space: nowrap;
}

/* ── FULL TOPS PAGE ── */
.tops-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(280px, 2fr) minmax(180px, 0.8fr);
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.2rem;
}

.tops-control-group {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.tops-control-label {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.7rem;
}

.segmented-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment-tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  transition: all 0.15s;
}

.segment-tab:hover {
  border-color: var(--border2);
  color: var(--text);
}

.segment-tab.active {
  background: var(--green);
  border-color: var(--green);
  color: #000;
  font-weight: 600;
}

.tops-year-tabs {
  margin-bottom: 0;
}

.tops-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tops-card-head .chart-subtitle {
  margin-bottom: 0;
}

.tops-count {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
  white-space: nowrap;
  padding-top: 2px;
}

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

.tops-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.tops-table th {
  color: var(--text3);
  font-size: 10px;
  font-family: var(--mono);
  font-weight: 500;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 12px 10px;
  border-bottom: 1px solid var(--border);
}

.tops-table th:first-child,
.tops-table td:first-child {
  width: 46px;
  padding-left: 0;
}

.tops-table th:last-child,
.tops-table td:last-child {
  width: 110px;
  padding-right: 0;
}

.tops-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tops-table tbody tr:last-child td {
  border-bottom: none;
}

.tops-rank {
  color: var(--text3);
  font-family: var(--mono);
  font-size: 12px;
  text-align: right;
}

.tops-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tops-sub {
  color: var(--text2);
  font-size: 11px;
  font-family: var(--mono);
  line-height: 1.4;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tops-metric {
  color: var(--green);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.tops-detail {
  color: var(--text2);
  font-family: var(--mono);
  font-size: 11px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 260px;
}

.tops-detail-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg3);
  color: var(--text2);
  cursor: help;
  white-space: nowrap;
  text-decoration: underline dotted rgba(255,255,255,0.25);
  text-underline-offset: 3px;
}

.tops-detail-chip:hover {
  border-color: var(--border2);
  color: var(--text);
}

.tops-mini-bar {
  width: 96px;
  height: 5px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}

.tops-mini-bar div {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  opacity: 0.75;
}

.tops-empty {
  color: var(--text2);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  padding: 2rem !important;
}

@media (max-width: 900px) {
  .tops-controls {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .section-heading,
  .tops-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-btn {
    width: 100%;
  }
}

/* ── HEATMAP ── */
.heatmap-grid {
  display: grid;
  grid-template-columns: 36px repeat(24, 1fr);
  gap: 3px;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--text3);
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--bg3);
  transition: transform 0.1s;
  position: relative;
}

.heatmap-cell:hover { transform: scale(1.3); z-index: 10; }

.heatmap-label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 9px;
  color: var(--text3);
  padding-right: 4px;
}

.heatmap-hour-label {
  text-align: center;
  padding-bottom: 4px;
  font-size: 9px;
}

.heatmap-header {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 36px repeat(24, 1fr);
  gap: 3px;
  margin-bottom: 2px;
}

/* ── BADGES / PILLS ── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 500;
}

.badge-green { background: var(--green-dim); color: var(--green); }
.badge-amber { background: var(--amber-dim); color: var(--amber); }
.badge-blue { background: var(--blue-dim); color: var(--blue); }
.badge-red { background: var(--red-dim); color: var(--red); }

/* ── PLATFORM BARS ── */
.platform-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.platform-name {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text2);
  width: 140px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.platform-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg3);
  border-radius: 99px;
  overflow: hidden;
}

.platform-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 99px;
  opacity: 0.7;
}

.platform-pct {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text2);
  min-width: 36px;
  text-align: right;
}

/* ── CURIOSITIES ── */
.curiosities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.curiosity-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.curiosity-icon {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}

.curiosity-label {
  font-size: 11px;
  color: var(--text2);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.curiosity-value {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.curiosity-sub {
  font-size: 11px;
  color: var(--text3);
  font-family: var(--mono);
  margin-top: 3px;
}

/* ── YEAR SELECTOR ── */
.year-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.year-tab {
  padding: 5px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-family: var(--mono);
  cursor: pointer;
  border: 1px solid var(--border);
  background: none;
  color: var(--text2);
  transition: all 0.15s;
}

.year-tab:hover { border-color: var(--border2); color: var(--text); }
.year-tab.active { background: var(--green); border-color: var(--green); color: #000; font-weight: 600; }

/* ── TOOLTIP ── */
.tooltip {
  position: fixed;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text);
  pointer-events: none;
  z-index: 1000;
  display: none;
  white-space: nowrap;
}
