:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f4f7fb;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #172033;
  --muted: #5e6a7d;
  --accent: #1f6feb;
  --accent-soft: #e8f0ff;
  --accent-strong: #174ea6;
  --score: #0f766e;
  --critical: #c2415d;
  --high: #c4601d;
  --medium: #9a6a00;
  --low: #16805f;
  --unknown: #64748b;
  --shadow: 0 8px 22px rgba(23, 32, 51, 0.05);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: "Inter", "Segoe UI", sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: inherit;
}

.page-shell {
  width: calc(100% - 2rem);
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.site-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.1rem;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand,
.nav-link {
  text-decoration: none;
}

.brand {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-link {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.48rem 0.72rem;
}

.nav-link:hover,
.nav-link:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.header-copy {
  margin-top: 1.6rem;
  max-width: 720px;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 1.04;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.08rem;
  line-height: 1.25;
}

.hero-copy {
  margin: 0.85rem 0 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}

.header-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.header-meta strong {
  color: var(--text);
  font-weight: 600;
}

.review-notice {
  margin-top: 1rem;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
  padding: 0.5rem 0.68rem;
}

.panel {
  margin-top: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-table {
  box-shadow: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.panel-title-stack {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.panel-caption {
  margin: 0;
  max-width: 78ch;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.table-controls {
  display: inline-flex;
  max-width: 100%;
  flex-wrap: nowrap;
  gap: 0.35rem;
  overflow-x: auto;
}

.filter-tab {
  appearance: none;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: 600 0.86rem "Inter", "Segoe UI", sans-serif;
  line-height: 1;
  padding: 0.52rem 0.68rem;
  white-space: nowrap;
}

.filter-tab:hover,
.filter-tab:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
  outline: none;
}

.filter-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.filter-label-short {
  display: none;
}

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

table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
  table-layout: fixed;
}

thead th {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  padding: 0.7rem 0.72rem;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody td {
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
  padding: 0.78rem 0.72rem;
  vertical-align: top;
}

thead th:nth-child(1) {
  width: 34%;
}

thead th:nth-child(2) {
  width: 17%;
}

thead th:nth-child(3) {
  width: 18%;
}

thead th:nth-child(4) {
  width: 11%;
}

thead th:nth-child(5) {
  width: 8%;
}

thead th:nth-child(6) {
  width: 12%;
}

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

.record-row {
  background: var(--surface);
}

.record-row:hover {
  background: #fafcff;
}

.record-row td:first-child {
  box-shadow: none;
}

.tone-critical td:first-child {
  box-shadow: none;
}

.tone-high td:first-child {
  box-shadow: none;
}

.tone-medium td:first-child {
  box-shadow: none;
}

.tone-low td:first-child {
  box-shadow: none;
}

.tone-unknown td:first-child {
  box-shadow: none;
}

.finding-stack,
.students-stack,
.notes-stack,
.team-stack,
.score-source-stack,
.score-stack {
  display: grid;
  gap: 0.22rem;
}

.finding-title,
.students-main,
.score-main {
  margin: 0;
  color: var(--text);
  font-weight: 650;
}

.finding-meta,
.ranking-students,
.score-sub,
.team-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.score-main {
  color: var(--score);
  font-family: "IBM Plex Mono", monospace;
  white-space: nowrap;
}

.score-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
}

.score-provisional {
  width: fit-content;
  border: 1px solid #ecd479;
  border-radius: 999px;
  background: #fff7d7;
  color: var(--medium);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  margin: 0;
  padding: 0.12rem 0.42rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.notes-stack {
  min-width: 0;
  max-width: none;
}

.students-stack {
  min-width: 0;
  max-width: none;
}

.students-main {
  font-size: 0.9rem;
  line-height: 1.35;
}

.notes-link {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--accent-strong);
  text-decoration: none;
  width: fit-content;
}

.notes-link:hover,
.notes-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  outline: none;
}

.notes-muted {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.notes-evidence {
  color: var(--unknown);
}

.notes-provisional {
  color: var(--medium);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
}

.notes-text:hover,
.notes-text:focus-visible {
  color: var(--accent-strong);
  text-decoration: none;
}

.tag-stack {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.24rem;
}

.team-stack {
  min-width: 0;
  overflow-wrap: normal;
}

.team-main {
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
}

.team-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
}

.score-source-stack {
  min-width: 96px;
  max-width: 140px;
}

.severity-source,
.severity-reason,
.source-note {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  line-height: 1.35;
}

.severity-reason {
  max-width: 190px;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.78rem;
}

.source-note {
  max-width: 130px;
  font-family: "Inter", "Segoe UI", sans-serif;
  font-size: 0.78rem;
}

.source-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.sev-badge,
.zero-badge,
.originality-badge,
.source-pill {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.66rem;
  letter-spacing: 0.03em;
  padding: 0.16rem 0.42rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.source-pill {
  width: fit-content;
}

.sev-critical {
  background: #fde7ed;
  border-color: #f5b4c2;
  color: var(--critical);
}

.sev-high {
  background: #fff0df;
  border-color: #f7c48f;
  color: var(--high);
}

.sev-medium {
  background: #fff7d7;
  border-color: #ecd479;
  color: var(--medium);
}

.sev-low {
  background: #e4f8ef;
  border-color: #a7dfc6;
  color: var(--low);
}

.sev-unknown,
.zero-unknown {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: var(--unknown);
}

.zero-zero-day {
  background: #e4f8ef;
  border-color: #a7dfc6;
  color: var(--low);
}

.zero-non-zero-day {
  background: #edf4ff;
  border-color: #b8cff9;
  color: var(--accent-strong);
}

.originality-first {
  background: #e4f8ef;
  border-color: #a7dfc6;
  color: var(--low);
}

.originality-duplicate {
  background: #edf4ff;
  border-color: #b8cff9;
  color: var(--accent-strong);
}

.originality-candidate {
  background: #fff7d7;
  border-color: #ecd479;
  color: var(--medium);
}

.originality-known,
.originality-unknown {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: var(--unknown);
}

.source-vendor {
  background: #e8f0ff;
  border-color: #b8cff9;
  color: var(--accent-strong);
}

.source-course {
  background: #fff7d7;
  border-color: #ecd479;
  color: var(--medium);
}

.source-unknown {
  background: #eef2f7;
  border-color: #cbd5e1;
  color: var(--unknown);
}

.scoring-panel,
.notes-panel {
  padding: 1rem;
}

.bonus-panel {
  overflow: hidden;
}

.ranking-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  padding: 0.8rem;
}

.ranking-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 0.72rem;
}

.ranking-list {
  display: grid;
  gap: 0.42rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.ranking-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.52rem;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 0.42rem;
}

.ranking-item[hidden] {
  display: none;
}

.ranking-item:first-child {
  border-top: none;
  padding-top: 0;
}

.ranking-toggle {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  font: 600 0.78rem "Inter", "Segoe UI", sans-serif;
  padding: 0.38rem 0.6rem;
}

.ranking-toggle:hover,
.ranking-toggle:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.ranking-toggle-row {
  grid-column: 1 / -1;
}

.ranking-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  border: 1px solid #bad7d1;
  border-radius: 999px;
  background: #e3f5f2;
  color: var(--score);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 0.08rem 0.34rem;
}

.ranking-body {
  display: grid;
  gap: 0.12rem;
  min-width: 0;
}

.ranking-heading {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  column-gap: 0.55rem;
  row-gap: 0.08rem;
}

.ranking-title,
.ranking-detail {
  margin: 0;
  overflow-wrap: anywhere;
}

.ranking-title {
  color: var(--text);
  font-weight: 650;
}

.ranking-detail {
  width: fit-content;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0.08rem 0.34rem;
}

.ranking-detail,
.ranking-students {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}

.student-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.student-link:hover {
  color: var(--score);
}

.scoring-panel .panel-head {
  border-bottom: none;
  padding: 0 0 1rem;
}

.scoring-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.score-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 0.9rem;
}

.score-card-formula {
  grid-column: 1 / -1;
  background: var(--accent-soft);
  border-color: #c4d7ff;
}

.score-card-label {
  margin: 0 0 0.45rem;
  color: var(--accent-strong);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.score-formula {
  margin: 0;
  color: var(--text);
  font-weight: 650;
}

.score-list {
  display: grid;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.score-list li {
  display: grid;
  gap: 0.28rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.score-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border: 1px solid #bad7d1;
  border-radius: 999px;
  background: #e3f5f2;
  color: var(--score);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  padding: 0.16rem 0.44rem;
}

.logic-list {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
}

.logic-list li {
  display: grid;
  gap: 0.35rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.94rem;
  padding-top: 0.75rem;
}

.logic-list li:first-child {
  border-top: none;
  padding-top: 0;
}

.noscript-message {
  margin: 0;
  padding: 1rem;
  text-align: center;
}

@media (max-width: 820px) {
  .page-shell {
    width: calc(100% - 1rem);
    padding-top: 0.9rem;
  }

  .header-copy {
    margin-top: 1.45rem;
  }

  .panel-head {
    display: grid;
  }

  .table-controls {
    width: 100%;
  }

  .filter-tab {
    flex: 1 1 0;
    font-size: 0.8rem;
    padding-inline: 0.48rem;
  }

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

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

@media (max-width: 520px) {
  .filter-label-full {
    display: none;
  }

  .filter-label-short {
    display: inline;
  }

  .page-shell {
    width: 100%;
    padding: 0.9rem 0.5rem 2rem;
  }

  .top-nav {
    min-width: 0;
    max-width: 100%;
  }

  .nav-link {
    flex: 0 1 auto;
    max-width: 9.5rem;
    overflow-wrap: anywhere;
    text-align: center;
  }

  h1 {
    max-width: calc(100vw - 1rem);
    font-size: 1.85rem;
    line-height: 1.08;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .hero-copy,
  .header-meta,
  .review-notice,
  .panel-caption {
    max-width: calc(100vw - 2rem);
    font-size: 0.9rem;
  }

  .header-copy,
  .panel-title-stack {
    width: 100%;
    max-width: 100%;
  }

  .panel,
  .panel-head,
  .ranking-grid,
  .ranking-card,
  .ranking-list,
  .ranking-item {
    min-width: 0;
  }

  .panel-head,
  .ranking-grid {
    padding: 0.85rem;
  }

  .ranking-item {
    grid-template-columns: minmax(1.9rem, auto) minmax(0, 1fr);
    gap: 0.55rem;
  }

  .ranking-title,
  .ranking-students,
  .ranking-detail,
  .students-main,
  .notes-muted,
  .notes-provisional,
  .score-sub {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 700px) {
  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody,
  tbody tr,
  tbody td {
    display: block;
    width: 100%;
  }

  tbody tr {
    border-bottom: 1px solid var(--line);
    padding: 0.72rem 0.8rem;
  }

  tbody tr:last-child {
    border-bottom: none;
  }

  tbody td {
    border-bottom: none;
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 0.7rem;
    padding: 0.38rem 0;
  }

  tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.68rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  tbody td[colspan] {
    display: block;
  }

  tbody td[colspan]::before {
    content: none;
  }

  .record-row td:first-child,
  .tone-critical td:first-child,
  .tone-high td:first-child,
  .tone-medium td:first-child,
  .tone-low td:first-child,
  .tone-unknown td:first-child {
    box-shadow: none;
  }
}

@media (max-width: 420px) {
  tbody td {
    grid-template-columns: 1fr;
    gap: 0.22rem;
  }

  .notes-stack,
  .students-stack,
  .students-main,
  .score-source-stack {
    max-width: none;
    min-width: 0;
  }
}
