:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f5f0;
  color: #151712;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow-x: hidden;
}

a {
  color: #155b45;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 36px;
  border-bottom: 1px solid #d8dbcf;
  background: rgba(255, 255, 250, .92);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.brand {
  font-weight: 800;
  color: #151712;
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14px;
  font-weight: 650;
}

.hero {
  background:
    linear-gradient(90deg, rgba(21, 91, 69, .08) 1px, transparent 1px),
    linear-gradient(rgba(21, 91, 69, .08) 1px, transparent 1px),
    #fafaf5;
  background-size: 44px 44px;
  border-bottom: 1px solid #d8dbcf;
}

.hero-inner,
.content {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.hero-inner {
  padding: 76px 0 34px;
}

h1 {
  margin: 0;
  font-size: clamp(44px, 6vw, 84px);
  line-height: 1.02;
  letter-spacing: 0;
  max-width: 980px;
}

.lede {
  max-width: 820px;
  color: #4d5549;
  font-size: 18px;
  line-height: 1.55;
}

.eyebrow {
  margin: 0 0 10px;
  color: #155b45;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 32px;
}

.metric,
.panel,
.row,
.frontier-strip {
  background: #fffffb;
  border: 1px solid #d8dbcf;
  border-radius: 8px;
}

.metric {
  min-height: 118px;
  padding: 18px;
}

.metric-label {
  color: #687161;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 800;
}

.metric-value {
  margin-top: 10px;
  color: #151712;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 800;
  line-height: 1;
}

.metric-detail {
  margin-top: 8px;
  color: #687161;
  font-size: 13px;
}

.content {
  padding: 28px 0 56px;
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
}

.landing-stack {
  display: grid;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.wide {
  grid-column: 1 / -1;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 20px;
}

.section-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin-bottom: 0;
}

.frontier-strip {
  display: grid;
  grid-template-columns: minmax(170px, .35fr) 1fr;
  gap: 22px;
  align-items: center;
  padding: 20px 22px;
}

.frontier-strip h2 {
  margin: 0;
  font-size: 22px;
}

.frontier-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.frontier-list li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px;
  border: 1px solid #e0e3d8;
  border-radius: 6px;
  background: #f8f9f2;
}

.frontier-rank,
.frontier-score {
  color: #151712;
  font-weight: 800;
}

.frontier-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cmd {
  display: block;
  overflow-x: auto;
  padding: 12px;
  border-radius: 6px;
  background: #151712;
  color: #f7f8ed;
  font-size: 13px;
}

.copy-box {
  width: 100%;
  min-height: 280px;
  resize: vertical;
  border: 1px solid #d8dbcf;
  border-radius: 8px;
  padding: 14px;
  background: #f8f9f2;
  color: #151712;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.note {
  max-height: 260px;
  overflow: auto;
  padding: 12px;
  border-radius: 6px;
  background: #f8f9f2;
  border: 1px solid #d8dbcf;
  white-space: pre-wrap;
}

.plain-list {
  display: grid;
  gap: 10px;
  padding-left: 18px;
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.key-value {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0;
  font-size: 14px;
}

.key-value dt {
  color: #526173;
  font-weight: 650;
}

.key-value dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-actions {
  margin-top: 16px;
}

.button,
button {
  display: inline-block;
  border: 1px solid #155b45;
  border-radius: 6px;
  background: #155b45;
  color: #ffffff;
  padding: 8px 12px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

.button:hover {
  color: #ffffff;
  text-decoration: none;
}

.button.secondary {
  border-color: #d8dbcf;
  background: #fffffb;
  color: #151712;
}

.button.secondary:hover {
  color: #17202a;
}

.danger-button {
  border-color: #b42318;
  background: #b42318;
}

.inline-form {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.stack-form {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.stack-form input {
  width: 100%;
  min-width: 180px;
}

label {
  display: grid;
  gap: 6px;
  color: #526173;
  font-size: 13px;
}

input {
  min-width: 220px;
  border: 1px solid #d8dbcf;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

.notice,
.error {
  padding: 12px;
  border-radius: 6px;
  margin: 12px 0;
}

.notice {
  border: 1px solid #9fc7ad;
  background: #eef8f1;
}

.notice code {
  display: block;
  margin-top: 8px;
  word-break: break-all;
}

.error {
  border: 1px solid #e5a3a3;
  background: #fff1f1;
  color: #9a1f1f;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fffffb;
  border: 1px solid #d8dbcf;
  border-radius: 8px;
  overflow: hidden;
}

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

.score-table {
  border-collapse: separate;
  border-spacing: 0;
  border-color: #d3d5c8;
  background: #fbfbf4;
}

.score-table th {
  padding: 18px 22px;
  background: #dedfd2;
  color: #666861;
  font-size: 13px;
  letter-spacing: .18em;
}

.score-table td {
  padding: 24px 22px;
  border-bottom-color: #dedfd2;
  vertical-align: middle;
  font-size: 16px;
}

.score-table th:nth-child(2),
.score-table th:nth-child(3),
.score-table .score-cell,
.score-table .diff-cell {
  text-align: center;
}

.score-table th:last-child,
.score-table .created-cell {
  text-align: right;
}

.solver-cell {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 260px;
}

.solver-avatar-wrap {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
}

.solver-avatar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 1px solid #d8dbcf;
  background: #eef0e6;
  object-fit: cover;
}

.solver-avatar-fallback {
  display: inline-grid;
  place-items: center;
  color: #155b45;
  font-weight: 800;
}

.solver-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.solver-name {
  color: #22241f;
  font-size: 17px;
  font-weight: 800;
}

.solver-name-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.leader-crown {
  display: inline-grid;
  place-items: center;
  position: absolute;
  top: -25px;
  left: 50%;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #f47b38;
  line-height: 1;
  pointer-events: none;
  transform: translateX(-50%);
}

.leader-crown svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.solver-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #696d68;
  font-weight: 700;
}

.model-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}

.model-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #e0ddd2;
  border-radius: 7px;
  background: #fffffb;
  color: #6d7269;
  flex: 0 0 auto;
}

.model-icon img {
  width: 14px;
  height: 14px;
  display: block;
}

.model-pill-gpt .model-icon {
  color: #22241f;
}

.model-icon-generic {
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.model-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-main,
.diff-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

.score-main {
  color: #22241f;
  font-size: 20px;
  font-weight: 800;
}

.score-sub {
  margin-top: 8px;
  color: #747871;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 700;
}

.diff-cell {
  color: #397d55;
  font-size: 19px;
  font-weight: 800;
}

.diff-bad {
  color: #9a3d30;
}

.diff-neutral,
.created-cell {
  color: #696d68;
}

.created-cell {
  font-size: 16px;
  font-weight: 650;
}

th,
td {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid #e0e3d8;
  font-size: 14px;
}

th {
  color: #687161;
  background: #f5f6ed;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 800;
}

.muted {
  color: #687161;
}

.numeric,
.rank-cell {
  font-variant-numeric: tabular-nums;
}

.numeric {
  text-align: right;
}

.rank-cell {
  color: #687161;
  font-weight: 800;
}

.github-author {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 28px;
  font-weight: 650;
  white-space: nowrap;
}

.github-author span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.github-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid #d8dbcf;
  background: #f5f6ed;
  flex: 0 0 auto;
}

.local-time {
  white-space: nowrap;
}

.status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f5ee;
  color: #177245;
  font-size: 12px;
  font-weight: 650;
}

.status.pending {
  background: #fff4df;
  color: #9a5b00;
}

.status.danger {
  background: #fff1f1;
  color: #9a1f1f;
}

.actions {
  min-width: 220px;
}

.actions p {
  margin: 0 0 10px;
}

@media (max-width: 760px) {
  .hero-inner,
  .content {
    width: min(100% - 28px, 1120px);
  }

  .topbar {
    align-items: flex-start;
    height: auto;
    padding: 14px;
    flex-direction: column;
    gap: 10px;
  }

  .nav {
    flex-wrap: wrap;
    gap: 12px 16px;
  }

  .hero-inner {
    padding: 42px 0 24px;
  }

  h1 {
    font-size: 36px;
    line-height: 1.06;
  }

  .lede {
    font-size: 16px;
  }

  .metric {
    min-height: 0;
  }

  .metrics,
  .grid,
  .detail-grid,
  .frontier-strip,
  .frontier-list {
    grid-template-columns: 1fr;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .section-head .button {
    text-align: center;
  }

  .frontier-list li {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .frontier-score {
    grid-column: 2;
  }

  .table-scroll {
    overflow: visible;
  }

  .leaderboard-table {
    display: block;
    border: 0;
    background: transparent;
  }

  .leaderboard-table thead {
    display: none;
  }

  .leaderboard-table tbody {
    display: grid;
    gap: 10px;
  }

  .leaderboard-table tr {
    display: grid;
    overflow: hidden;
    border: 1px solid #d8dbcf;
    border-radius: 8px;
    background: #fffffb;
  }

  .leaderboard-table td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-width: 0;
    padding: 10px 12px;
    border-bottom: 1px solid #e0e3d8;
  }

  .leaderboard-table td::before {
    content: attr(data-label);
    color: #687161;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  .leaderboard-table td:last-child {
    border-bottom: 0;
  }

  .leaderboard-table .numeric {
    text-align: left;
  }

  .leaderboard-table .empty-row {
    display: block;
    padding: 14px;
    border-bottom: 0;
  }

  .leaderboard-table .empty-row::before {
    content: "";
    display: none;
  }

  .leaderboard-table code,
  .leaderboard-table a {
    overflow-wrap: anywhere;
  }

  .score-table .solver-cell {
    min-width: 0;
  }

  .score-table .solver-meta {
    flex-wrap: wrap;
  }

  .score-table .score-cell,
  .score-table .diff-cell,
  .score-table .created-cell {
    text-align: left;
  }

  .key-value {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .nav {
    width: 100%;
    justify-content: space-between;
  }

  .metric-value {
    font-size: 28px;
  }

  .panel,
  .frontier-strip {
    padding: 16px;
  }

  .leaderboard-table td {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}
