:root {
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #21181e;
  background: #faf9fb;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #21181e;
  --muted: #716870;
  --line: #eadfe7;
  --panel: #ffffff;
  --orange: #ff5a32;
  --orange-2: #ff7a49;
  --orange-soft: #fff0e9;
  --pink: #ff2d8d;
  --pink-soft: #ffe8f3;
  --purple: #7c3aed;
  --purple-soft: #f1ebff;
  --silver: #f1edef;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  min-height: 100vh;
  margin: 0;
  background-color: #faf9fb;
  background-image:
    linear-gradient(rgba(124, 58, 237, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 90, 50, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

.topbar,
main,
footer {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 104px;
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  position: relative;
}

.topbar::before {
  width: 100%;
  height: 3px;
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  background: linear-gradient(90deg, var(--orange) 0 68%, var(--pink) 68% 86%, var(--purple) 86%);
}

.title-group {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 4px 18px;
}

.brand,
.terminal-tag,
.label {
  margin: 0;
  font-family: Bahnschrift, Inter, "Microsoft YaHei", sans-serif;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand {
  color: var(--ink);
  font-size: 1rem;
}

.brand::after {
  color: var(--orange);
  content: " //";
}

.terminal-tag,
.label {
  color: var(--muted);
  font-size: 0.72rem;
}

.terminal-tag {
  grid-column: 1 / -1;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-family: Bahnschrift, Inter, "Microsoft YaHei", sans-serif;
  font-size: clamp(1.55rem, 3vw, 2.1rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.9rem);
  letter-spacing: 0;
}

.download-link {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid rgba(255, 90, 50, 0.42);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 3px 3px 0 var(--orange-soft);
  transition: border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.download-link:hover {
  border-color: var(--pink);
  color: var(--pink);
  transform: translateY(-1px);
}

.summary-band {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  grid-template-columns: 1.2fr repeat(4, 1fr);
  overflow: hidden;
}

.summary-item {
  min-width: 0;
  padding: 15px 18px 14px;
  border-left: 1px solid var(--line);
  position: relative;
}

.summary-item:first-child {
  border-left: 0;
}

.summary-item::before {
  height: 3px;
  content: "";
  position: absolute;
  inset: 0 0 auto;
  background: var(--orange);
}

.summary-item.total::before,
.summary-item.medium::before {
  background: var(--orange-2);
}

.summary-item.high::before {
  background: var(--pink);
}

.summary-item.low::before {
  background: var(--purple);
}

.summary-band strong {
  display: block;
  margin-top: 8px;
  font-family: Bahnschrift, "Arial Narrow", Inter, sans-serif;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  font-variant-numeric: tabular-nums;
}

.summary-item.high strong {
  color: var(--pink);
}

.summary-item.medium strong {
  color: var(--orange);
}

.summary-item.low strong {
  color: var(--purple);
}

.controls {
  margin-bottom: 28px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.tabs {
  min-height: 46px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  gap: 4px;
}

.tab {
  min-width: 112px;
  padding: 0 14px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease;
}

.tab:hover {
  color: var(--purple);
}

.tab.active {
  background: var(--orange);
  color: #ffffff;
  box-shadow: inset -3px 0 0 rgba(255, 45, 141, 0.42);
}

.search {
  min-width: min(320px, 100%);
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.search input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.search input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: view-in 180ms ease-out;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.section-head {
  margin-bottom: 15px;
  display: grid;
  gap: 5px;
}

.section-head .label {
  color: var(--orange);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.focus-panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 40px rgba(45, 24, 35, 0.06);
  position: relative;
  overflow: hidden;
}

.focus-panel::before {
  width: 92px;
  height: 2px;
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  background: linear-gradient(90deg, var(--orange), var(--pink), var(--purple));
}

.panel-title {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.panel-title span {
  color: var(--ink);
}

.rank-list {
  display: grid;
  gap: 12px;
}

.rank-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 86px;
  align-items: center;
  gap: 12px;
}

.rank-index {
  width: 38px;
  height: 38px;
  border-radius: 6px;
  background: var(--orange);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-family: Bahnschrift, Inter, sans-serif;
  font-weight: 900;
}

.rank-item:nth-child(2) .rank-index {
  background: var(--orange-2);
}

.rank-item:nth-child(3) .rank-index {
  background: var(--pink);
}

.rank-name {
  margin-bottom: 5px;
  overflow: hidden;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.score {
  color: var(--orange);
  text-align: right;
  font-family: Bahnschrift, "Arial Narrow", Inter, sans-serif;
  font-size: 1.32rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
}

.bar {
  height: 6px;
  margin-top: 8px;
  border-radius: 2px;
  background: var(--silver);
  overflow: hidden;
}

.bar span {
  height: 100%;
  border-radius: inherit;
  background: var(--orange);
  display: block;
}

.compact .rank-item {
  grid-template-columns: minmax(0, 1fr) 72px;
}

.compact .rank-index {
  display: none;
}

.compact .rank-item:nth-child(-n + 3) .score {
  color: var(--pink);
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.heat-card {
  min-height: 116px;
  padding: 13px;
  border: 1px solid rgba(255, 90, 50, 0.1);
  border-radius: 4px;
  background: var(--heat-bg);
  color: var(--heat-color);
  display: grid;
  align-content: space-between;
  gap: 12px;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.heat-card:hover {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px var(--purple-soft);
  transform: translateY(-2px);
}

.heat-card strong {
  display: block;
  font-size: 0.94rem;
  line-height: 1.28;
}

.heat-card span {
  color: inherit;
  display: block;
  margin-top: 5px;
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0.72;
}

.heat-score {
  font-family: Bahnschrift, "Arial Narrow", Inter, sans-serif;
  font-size: 1.7rem;
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #f7f2f4;
  color: var(--muted);
  font-size: 0.8rem;
}

td {
  color: var(--ink);
  font-size: 0.9rem;
}

tbody tr:hover {
  background: var(--orange-soft);
}

.pill {
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 900;
}

.pill.high {
  background: var(--pink-soft);
  color: #bc0e61;
}

.pill.medium {
  background: var(--orange-soft);
  color: #be3517;
}

.pill.low {
  background: var(--purple-soft);
  color: #5f28c6;
}

footer {
  padding: 34px 0 46px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 18px;
  font-size: 0.8rem;
}

@media (max-width: 1040px) {
  .heatmap-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar,
  .controls,
  footer {
    align-items: stretch;
    flex-direction: column;
  }

  .title-group {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .terminal-tag {
    grid-column: auto;
  }

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

  .summary-item,
  .summary-item:first-child {
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .summary-item:nth-child(-n + 2) {
    border-top: 0;
  }

  .summary-item:nth-child(odd) {
    border-left: 0;
  }

  .summary-item:last-child {
    grid-column: 1 / -1;
    border-left: 0;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    min-width: 104px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

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

  .rank-item {
    grid-template-columns: 34px minmax(0, 1fr) 70px;
  }
}

@media (max-width: 480px) {
  .topbar,
  main,
  footer {
    width: min(100% - 20px, 1240px);
  }

  .summary-item {
    padding: 13px 12px;
  }

  .summary-band strong {
    font-size: 1.55rem;
  }

  .focus-panel {
    padding: 16px;
  }

  .rank-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .heat-card {
    min-height: 108px;
    padding: 11px;
  }
}

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