:root {
  color-scheme: light;
  --ink: #14213d;
  --muted: #667085;
  --line: #d8dee9;
  --soft: #f7f9fc;
  --blue: #0969da;
  --blue-dark: #0550ae;
  --red: #f04438;
  --white: #fff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: #f4f6fa;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

a { color: var(--blue); }

.page-shell {
  width: min(1480px, calc(100% - 48px));
  margin: 40px auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

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

h1 { margin: 0; font-size: clamp(28px, 3vw, 42px); letter-spacing: -.03em; }
.updated { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.refresh-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--blue);
  border-radius: 10px;
  padding: 10px 16px;
  background: var(--blue);
  color: var(--white);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.refresh-button:hover { background: var(--blue-dark); }
.refresh-button:disabled { cursor: wait; opacity: .65; }
.refresh-icon { font-size: 20px; line-height: 1; }

.notice { margin-top: 18px; border-radius: 8px; padding: 12px 16px; }
.notice-error { border: 1px solid #fecdca; background: #fffbfa; color: #b42318; }

.category-tabs {
  display: flex;
  gap: 10px;
  margin: 28px 0 18px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.category-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  background: var(--white);
  color: #475467;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: .15s ease;
}
.category-chip:hover { border-color: #84adff; color: var(--blue); transform: translateY(-1px); }
.category-chip.active { border-color: var(--blue); background: var(--blue); color: var(--white); box-shadow: 0 5px 14px rgba(9,105,218,.2); }

.company-tabs {
  display: flex;
  gap: 8px;
  margin: -2px 0 16px;
  padding: 12px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
}
.company-chip {
  flex: 0 0 auto;
  border-radius: 8px;
  padding: 8px 13px;
  color: #475467;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.company-chip:hover { background: #f0f6ff; color: var(--blue); }
.company-chip.active { background: #e8f1ff; color: var(--blue-dark); box-shadow: inset 0 0 0 1px #b9d2ff; }

.category-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
  border: 1px solid #cfe0ff;
  border-radius: 12px;
  padding: 15px 18px;
  background: #f5f9ff;
}
.category-summary strong { display: block; margin-bottom: 3px; font-size: 18px; }
.category-summary span, .category-summary small { color: var(--muted); }
.category-summary small { flex: 0 0 auto; }
.category-ranking-tabs { margin-top: 0; }

.tabs { display: flex; gap: 8px; margin-top: 28px; }
.tab {
  border-radius: 9px 9px 0 0;
  padding: 11px 18px;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}
.tab.active { background: var(--white); color: var(--blue); box-shadow: 0 -1px 0 var(--line), 1px 0 0 var(--line), -1px 0 0 var(--line); }

.ranking-card { border: 1px solid var(--line); border-radius: 0 12px 12px 12px; background: var(--white); overflow: hidden; box-shadow: 0 10px 28px rgba(20,33,61,.05); }
.ranking-card.category-card { border-radius: 12px; }
.table-scroll { overflow-x: auto; }
.ranking-table { width: 100%; min-width: 1050px; border-collapse: collapse; table-layout: fixed; }
.ranking-table th, .ranking-table td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 17px 18px; text-align: left; vertical-align: middle; }
.ranking-table th:last-child, .ranking-table td:last-child { border-right: 0; }
.ranking-table tbody tr:last-child td { border-bottom: 0; }
.ranking-table th { background: #fbfcfe; color: #344054; font-size: 15px; font-weight: 750; }
.ranking-table tbody tr:nth-child(even) { background: var(--soft); }
.ranking-table tbody tr:hover { background: #eef5ff; }
.rank-column { width: 78px; }
.project-column { width: 300px; }
.number-column { width: 120px; }
.growth-column { width: 165px; }
.intro-column { width: auto; min-width: 360px; }
.rank-value { font-size: 18px; font-weight: 700; }
.number-value, .growth-value { font-variant-numeric: tabular-nums; white-space: nowrap; }
.project-link { font-size: 17px; font-weight: 650; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.intro-link { display: -webkit-box; overflow: hidden; color: #475467; line-height: 1.6; text-decoration: none; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.intro-link:hover { color: var(--blue); }
.triangle { display: inline-block; width: 0; height: 0; margin-right: 8px; border-right: 9px solid transparent; border-left: 9px solid transparent; border-bottom: 17px solid var(--red); filter: drop-shadow(0 0 0 #111); }
.triangle.small { border-right-width: 7px; border-left-width: 7px; border-bottom-width: 13px; }
.updated-dot { display: inline-block; width: 9px; height: 9px; margin-right: 9px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 4px #e7f8ef; }
.warning-count { color: var(--muted); font-size: 13px; }
.category-empty { padding: 42px 20px; color: var(--muted); text-align: center; }

.empty-state { margin-top: 28px; border: 1px solid var(--line); border-radius: 12px; padding: 80px 24px; background: var(--white); text-align: center; }
.empty-state h2 { margin: 18px 0 8px; }
.empty-state p { color: var(--muted); }
.spinner { width: 38px; height: 38px; margin: auto; border: 3px solid #dbeafe; border-top-color: var(--blue); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.detail-shell { width: min(1040px, calc(100% - 48px)); }
.back-link { display: inline-block; margin-bottom: 24px; color: #475467; font-weight: 650; text-decoration: none; }
.back-link:hover { color: var(--blue); }
.detail-header { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.link-symbol { font-size: .8em; }
.project-detail { position: relative; margin-top: 26px; border: 1px solid var(--line); border-radius: 14px; padding: 34px 38px 38px; background: var(--white); box-shadow: 0 12px 35px rgba(20,33,61,.06); }
.project-detail h2 { margin: 8px 0 30px; font-size: clamp(20px, 3vw, 30px); overflow-wrap: anywhere; }
.project-detail h2 a { overflow-wrap: anywhere; word-break: break-all; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.rank-badge { display: inline-block; border-radius: 999px; padding: 5px 11px; background: #eaf2ff; color: var(--blue); font-size: 13px; font-weight: 750; }
.project-tags { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 4px; }
.project-tags span { border: 1px solid #cfe0ff; border-radius: 999px; padding: 5px 10px; background: #f5f9ff; color: var(--blue-dark); font-size: 13px; font-weight: 650; }
.metric-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 0; }
.metric-list div { border: 1px solid var(--line); border-radius: 10px; padding: 17px; background: var(--soft); }
.metric-list dt { color: var(--muted); font-size: 14px; }
.metric-list dd { margin: 8px 0 0; font-size: 22px; font-weight: 750; }
.description-card { margin-top: 24px; border-left: 4px solid var(--blue); border-radius: 8px; padding: 20px 22px; background: #f7faff; }
.description-card h3 { margin: 0 0 10px; font-size: 18px; }
.description-card p { margin: 0; color: #344054; font-size: 17px; line-height: 1.85; }

@media (max-width: 720px) {
  .page-shell, .detail-shell { width: min(100% - 24px, 100%); margin: 20px auto; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .refresh-button { width: 100%; justify-content: center; }
  .tabs { overflow-x: auto; }
  .category-summary { align-items: flex-start; flex-direction: column; }
  .project-detail { padding: 24px 20px; }
  .metric-list { grid-template-columns: 1fr; }
}
