@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;700&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg: #07111d;
  --bg-soft: #0d2033;
  --panel: #102942;
  --panel-soft: #0b2135;
  --line: #315777;
  --text: #e8f1fa;
  --muted: #9ab6cf;
  --good: #2ed39e;
  --warn: #f6b73c;
  --bad: #f06c5e;
  --accent: #4ec5ff;
  --accent-2: #69d8b8;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at 8% -10%, rgba(78, 197, 255, 0.26) 0%, transparent 34%),
    radial-gradient(circle at 92% 8%, rgba(105, 216, 184, 0.16) 0%, transparent 28%),
    linear-gradient(160deg, #06101b 0%, #0a1b2b 52%, #07111d 100%);
  color: var(--text);
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), transparent 78%);
  z-index: 0;
}

code {
  font-family: "IBM Plex Mono", monospace;
  color: #9ce7ff;
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  filter: blur(12px);
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  right: -60px;
  top: 100px;
  background: linear-gradient(45deg, #2fcbad, #2d89f0);
  opacity: 0.2;
  border-radius: 28% 72% 62% 38% / 42% 37% 63% 58%;
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  left: -60px;
  bottom: 60px;
  background: linear-gradient(45deg, #f6b73c, #ef6d52);
  opacity: 0.18;
  border-radius: 64% 36% 54% 46% / 43% 55% 45% 57%;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1360px;
  margin: 0 auto;
  padding: 30px 20px 46px;
}

.hero {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid rgba(78, 197, 255, 0.22);
  border-radius: 22px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(18, 55, 86, 0.88), rgba(8, 25, 41, 0.88)),
    radial-gradient(circle at 100% 0%, rgba(105, 216, 184, 0.24), transparent 32%);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.3);
}

.hero::after {
  content: "";
  position: absolute;
  right: 28px;
  bottom: 24px;
  width: min(360px, 44vw);
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2));
  opacity: 0.75;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  margin-bottom: 8px;
}

h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.subsection-title {
  margin-top: 12px;
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  max-width: 760px;
  font-size: 17px;
}

.section {
  margin-top: 18px;
  border: 1px solid rgba(78, 197, 255, 0.22);
  border-radius: 18px;
  padding: 16px;
  background:
    linear-gradient(175deg, rgba(14, 33, 52, 0.94) 0%, rgba(8, 25, 40, 0.94) 100%);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.2);
}

.section-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  min-width: 0;
}

.card {
  min-width: 0;
  border: 1px solid rgba(78, 197, 255, 0.2);
  border-radius: 14px;
  padding: 12px 14px;
  background:
    linear-gradient(170deg, rgba(23, 54, 84, 0.95), rgba(12, 35, 55, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.card .label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.card .value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}

#overviewCards.cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#overviewCards .overview-card {
  min-height: 128px;
  position: relative;
  overflow: hidden;
}

#overviewCards .overview-card::after {
  content: "";
  position: absolute;
  inset: auto 14px 12px 14px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), transparent);
  opacity: 0.75;
}

#overviewCards .overview-card .value {
  font-size: 19px;
}

#overviewCards .overview-card .metric {
  display: block;
  margin-top: 8px;
  color: #b8d2e8;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
}

.overview-footnote {
  margin: 12px 0 0;
  color: #b4cada;
  font-size: 13px;
}

.traffic-inline {
  margin: -4px 0 10px;
  padding: 8px 10px;
  border: 1px solid #284665;
  border-radius: 10px;
  background: rgba(14, 34, 54, 0.6);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  color: var(--muted);
}

.traffic-inline .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ec1de;
  font-family: "IBM Plex Mono", monospace;
  padding-right: 4px;
}

.traffic-inline .item {
  font-size: 12px;
  color: #bfd5e8;
}

.traffic-inline .item strong {
  font-family: "IBM Plex Mono", monospace;
  color: #e6f4ff;
  font-weight: 600;
}

#trafficStatus {
  font-size: 12px;
  margin-left: auto;
  color: #9ab6cf;
}

#trafficStatus.traffic-status-error {
  color: var(--bad);
}

.dual-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start;
}

.dual-grid > div {
  min-width: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(78, 197, 255, 0.18);
  border-radius: 12px;
  background: rgba(6, 18, 30, 0.32);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid #284665;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ec1de;
  background: #12304d;
  position: sticky;
  top: 0;
  z-index: 2;
  font-family: "IBM Plex Mono", monospace;
}

.data-table tbody tr:hover {
  background: rgba(78, 197, 255, 0.1);
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

.good {
  color: var(--good);
}

.warn {
  color: var(--warn);
}

.bad {
  color: var(--bad);
}

.legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.legend .swatch {
  width: 180px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2ed39e 0%, #f6b73c 55%, #f06c5e 100%);
  border: 1px solid #3b5f79;
}

.legend .swatch.swatch-gain {
  background: linear-gradient(90deg, #f06c5e 0%, #f6b73c 46%, #2ed39e 100%);
}

.matrix-wrap {
  max-height: 420px;
}

.matrix-table td {
  text-align: center;
  min-width: 88px;
  font-family: "IBM Plex Mono", monospace;
}

.matrix-table .matrix-divider-left {
  border-left: 3px solid rgba(226, 238, 248, 0.92);
}

.matrix-table .matrix-divider-top td,
.matrix-table .matrix-divider-top th {
  border-top: 3px solid rgba(226, 238, 248, 0.92);
}

.matrix-table td.first-col,
.matrix-table td.model-cell {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #0f2539;
}

.filters {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-bottom: 10px;
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
}

.filters select,
.filters input {
  width: 100%;
  min-width: 0;
  border: 1px solid #345571;
  background: #0f2438;
  color: var(--text);
  border-radius: 8px;
  padding: 8px 9px;
  font-family: "Space Grotesk", sans-serif;
}

#runsSection .filters {
  grid-template-columns: repeat(24, minmax(0, 1fr));
  align-items: end;
}

#runsSection .filters label:nth-child(1),
#runsSection .filters label:nth-child(2),
#runsSection .filters label:nth-child(3) {
  grid-column: span 4;
}

#runsSection .filters label:nth-child(4) {
  grid-column: span 3;
}

#runsSection .filters label:nth-child(5) {
  grid-column: span 5;
}

#runsSection .filters label:nth-child(6) {
  grid-column: span 4;
}

#runsSection .filters select,
#runsSection .filters input {
  height: 48px;
  font-size: 15px;
}

#runScopeCards.cards {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}

#runScopeCards .scope-card {
  min-height: 78px;
  padding: 12px 16px;
}

#runScopeCards .scope-card .label {
  font-size: 10px;
}

#runScopeCards .scope-card .value {
  font-size: clamp(20px, 1.55vw, 28px);
  line-height: 1.08;
}

#runScopeCards .scope-card-text .value {
  font-size: clamp(18px, 1.2vw, 22px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: normal;
  overflow-wrap: normal;
}

#runScopeBreakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 10px;
}

#runScopeBreakdown .scope-segment {
  min-width: min(100%, 320px);
  color: var(--muted);
}

#runScopeBreakdown strong {
  color: #c8dceb;
  font-weight: 600;
}

#runScopeBreakdown code {
  white-space: normal;
  overflow-wrap: anywhere;
}

#runsTable {
  table-layout: fixed;
  min-width: 1320px;
}

#runsTable th,
#runsTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}

#runsTable th:nth-child(1),
#runsTable td:nth-child(1) {
  width: 260px;
}

#runsTable th:nth-child(2),
#runsTable td:nth-child(2),
#runsTable th:nth-child(3),
#runsTable td:nth-child(3) {
  width: 190px;
}

#runsTable th:nth-child(4),
#runsTable td:nth-child(4),
#runsTable th:nth-child(5),
#runsTable td:nth-child(5),
#runsTable th:nth-child(7),
#runsTable td:nth-child(7),
#runsTable th:nth-child(9),
#runsTable td:nth-child(9) {
  width: 110px;
}

#runsTable th:nth-child(6),
#runsTable td:nth-child(6) {
  width: 150px;
}

#runsTable th:nth-child(8),
#runsTable td:nth-child(8) {
  width: 185px;
}

.detail {
  margin-top: 10px;
  border: 1px solid #31506b;
  border-radius: 10px;
  background: #0d2236;
  padding: 10px;
}

.detail pre {
  margin: 0;
  overflow-x: auto;
  max-height: 240px;
  font-size: 12px;
  line-height: 1.45;
  color: #b9d4ea;
  font-family: "IBM Plex Mono", monospace;
}

.metric-hint {
  border-bottom: 1px dashed rgba(156, 231, 255, 0.5);
  cursor: help;
}

.sample-list {
  display: grid;
  gap: 10px;
}

.sample-card {
  border: 1px solid #2f4c67;
  border-radius: 9px;
  background: #10283d;
  overflow: hidden;
}

.sample-card summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
}

.sample-card summary::-webkit-details-marker {
  display: none;
}

.sample-title {
  font-family: "IBM Plex Mono", monospace;
}

.sample-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.sample-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #3a617d;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: "IBM Plex Mono", monospace;
  color: #c6ddf0;
  background: #0c2032;
}

.sample-body {
  border-top: 1px solid #2f4c67;
  padding: 10px;
  display: grid;
  gap: 10px;
}

.sample-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.sample-item {
  border: 1px solid #2d4b65;
  border-radius: 8px;
  background: #0c1f31;
  padding: 8px;
}

.sample-item .label {
  display: block;
  margin-bottom: 6px;
  color: #9ec1de;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sample-item pre {
  margin: 0;
  max-height: 190px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #d4e7f7;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
}

.wrap-table th,
.wrap-table td {
  white-space: normal !important;
  vertical-align: top;
}

.sample-merged-header {
  border: 1px solid #2f4c67;
  border-radius: 9px;
  background: #10283d;
  margin-bottom: 8px;
  padding: 8px 10px;
}

.sample-merged-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 0.55fr 2.15fr 2.15fr 2.15fr 0.95fr 1.35fr;
  align-items: start;
}

.sample-merged-grid > span {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
  min-width: 0;
}

.sample-merged-grid--header {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9ec1de;
  font-family: "IBM Plex Mono", monospace;
}

.sample-card-merged .sample-merged-summary {
  padding: 10px 12px;
}

.sample-card-merged .sample-merged-summary .sample-merged-grid > span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sample-card-merged .sample-merged-summary .sample-merged-grid > span:nth-child(1),
.sample-card-merged .sample-merged-summary .sample-merged-grid > span:nth-child(5) {
  -webkit-line-clamp: 1;
  font-family: "IBM Plex Mono", monospace;
}

.sample-card-merged .sample-merged-summary .sample-merged-grid > span:nth-child(6) {
  -webkit-line-clamp: 2;
  font-size: 12px;
}

.muted-inline {
  color: var(--muted);
}

.phase-table .phase-name {
  min-width: 130px;
  font-weight: 600;
}

.phase-table td pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.judger-table td,
.judger-table th {
  white-space: normal !important;
}

.kv-table th {
  width: 180px;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, 0.78);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  margin: 24px auto;
  width: min(1180px, calc(100vw - 24px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid #355472;
  border-radius: 12px;
  background: linear-gradient(175deg, #0f2437 0%, #0a1c2c 100%);
  padding: 14px;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.45);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close,
.modal-link {
  border: 1px solid #3a617d;
  background: #10273b;
  color: #dcebf8;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
  font-family: "IBM Plex Mono", monospace;
}

.modal-close:hover,
.modal-link:hover {
  background: #163452;
}

body.modal-open {
  overflow: hidden;
}

.empty {
  padding: 12px;
  color: var(--muted);
}

@media (max-width: 980px) {
  .dual-grid {
    grid-template-columns: 1fr;
  }

  .modal-panel {
    margin: 10px auto;
    width: calc(100vw - 12px);
    max-height: calc(100vh - 20px);
    padding: 10px;
  }

  .modal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .sample-merged-header {
    display: none;
  }

  .sample-merged-grid {
    grid-template-columns: 1fr;
  }

  .traffic-inline {
    gap: 6px 10px;
  }

  #runsSection .filters {
    grid-template-columns: 1fr;
  }

  #runsSection .filters label:nth-child(n) {
    grid-column: auto;
  }

  #runScopeCards.cards {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  #trafficStatus {
    margin-left: 0;
    width: 100%;
  }

  #overviewCards.cards {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 981px) and (max-width: 1240px) {
  #overviewCards.cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #runScopeCards.cards {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  #runScopeCards .scope-card {
    padding: 10px 12px;
  }

  #runScopeCards .scope-card .value {
    font-size: 20px;
  }

  #runScopeCards .scope-card-text .value {
    font-size: 17px;
  }
}
