:root {
  color-scheme: light;
  --green: rgb(95, 206, 117);
  --green-dark: #006d35;
  --green-soft: rgba(95, 206, 117, 0.12);
  --black: #1b1c1c;
  --text: #252625;
  --muted: #666b67;
  --line: #c8d2c8;
  --line-light: #e2e7e2;
  --surface: #ffffff;
  --surface-low: #f5f7f5;
  --surface-high: #e9ece9;
  --error: #b42318;
  --max-width: 1440px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: "Hanken Grotesk", Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  width: 100%;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.header-inner,
.page-container,
.footer-inner {
  width: min(var(--max-width), calc(100% - 80px));
  margin-inline: auto;
}

.header-inner {
  display: flex;
  height: 64px;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--black);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--green-dark);
}

.brand__mark svg {
  width: 27px;
  fill: var(--surface);
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.desktop-nav {
  display: flex;
  height: 100%;
  gap: 28px;
  align-items: center;
  margin-right: auto;
  margin-left: 40px;
}

.desktop-nav a {
  position: relative;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.desktop-nav a:hover,
.desktop-nav a.is-active {
  color: var(--green-dark);
}

.desktop-nav a.is-active::after {
  position: absolute;
  right: 0;
  bottom: -22px;
  left: 0;
  height: 2px;
  background: var(--green-dark);
  content: "";
}

.header-action {
  border: 1px solid var(--black);
  border-radius: 4px;
  padding: 8px 16px;
  background: var(--black);
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 160ms ease;
}

.header-action:hover {
  opacity: 0.82;
}

.page-container {
  padding: 72px 0 112px;
}

.hero {
  max-width: 1040px;
  margin: 0 auto 64px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 24px;
  border-radius: 999px;
  padding: 5px 12px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
}

.eyebrow span,
.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.eyebrow span {
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

.hero h1 {
  margin: 0;
  color: var(--black);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.18;
}

.hero__title-line {
  white-space: nowrap;
}

.hero h2 {
  margin: 12px 0 0;
  color: var(--green-dark);
  font-size: clamp(23px, 2.5vw, 32px);
  font-weight: 680;
  letter-spacing: -0.025em;
}

.hero p {
  max-width: 700px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 96px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.summary__item {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  text-align: center;
}

.summary__item strong {
  color: var(--black);
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 720;
  letter-spacing: -0.04em;
}

.summary__item--accent strong {
  color: var(--green-dark);
}

.summary__item span {
  margin-top: 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.ranking-section {
  scroll-margin-top: 90px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-heading h2 {
  margin: 0;
  color: var(--black);
  font-size: 26px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.updated-at {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.live-dot {
  background: rgba(95, 206, 117, 0.65);
}

.toolbar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.search-box,
.sort-box {
  display: flex;
  height: 48px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.search-box {
  min-width: 0;
  flex: 1;
}

.search-box:focus-within,
.sort-box:focus-within {
  border-color: var(--black);
}

.search-box svg {
  width: 20px;
  margin: 0 12px 0 15px;
  fill: none;
  stroke: var(--muted);
  stroke-linecap: round;
  stroke-width: 1.8;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--black);
  font-size: 14px;
}

.search-box input::placeholder {
  color: #8b908c;
}

.sort-box {
  min-width: 210px;
  padding: 0 12px 0 15px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.sort-box select {
  min-width: 0;
  flex: 1;
  cursor: pointer;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--black);
  font-family: inherit;
  font-size: 12px;
}

.table-shell {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
}

.table-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  table-layout: auto;
}

th {
  height: 54px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-low);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: nowrap;
}

td {
  height: 94px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-light);
  color: var(--text);
  font-size: 13px;
  vertical-align: middle;
}

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

tbody tr {
  transition: background 150ms ease;
}

tbody tr:hover {
  background: #fbfcfb;
}

.rank-column,
.rank-cell {
  width: 78px;
  text-align: center;
}

.rank-badge {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--black);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.rank-badge--1 {
  border-color: var(--green-dark);
  background: var(--green-dark);
  color: #ffffff;
}

.rank-badge--2,
.rank-badge--3 {
  background: var(--surface-low);
}

.site-cell {
  min-width: 180px;
}

.site-link {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  text-decoration: none;
}

.site-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--black);
  font-size: 15px;
  font-weight: 750;
  text-transform: uppercase;
}

.site-info,
.site-name {
  min-width: 0;
}

.site-name {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--black);
  font-size: 16px;
  font-weight: 680;
  white-space: nowrap;
}

.site-name svg {
  width: 13px;
  fill: none;
  stroke: var(--green-dark);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.site-link:hover .site-name {
  color: var(--green-dark);
}

.models-cell {
  min-width: 190px;
}

.model-summary {
  display: flex;
  gap: 5px;
  align-items: center;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.model-count {
  color: var(--black);
  font-weight: 750;
}

.model-tags {
  display: flex;
  max-width: 220px;
  gap: 5px;
  margin-top: 8px;
  overflow: hidden;
}

.model-tag,
.payment-tag {
  border-radius: 3px;
  padding: 3px 7px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
}

.model-tag {
  overflow: hidden;
  background: var(--surface-high);
  text-overflow: ellipsis;
}

.metric {
  display: flex;
  min-width: 120px;
  flex-direction: column;
  gap: 7px;
}

.metric strong {
  color: var(--black);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.metric strong.good {
  color: var(--green-dark);
}

.metric-bar {
  width: 112px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-high);
}

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

.latency {
  display: inline-flex;
  min-width: 100px;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--black);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.latency::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  content: "";
}

.latency.poor::before {
  background: var(--error);
}

.latency.medium::before {
  background: #858b86;
}

.rating-cell {
  min-width: 100px;
}

.rating {
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.rating strong {
  color: var(--black);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 680;
}

.rating span,
.rating-cell small {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 9px;
}

.rating-cell small {
  display: block;
  margin-top: 4px;
}

.payments {
  display: flex;
  min-width: 130px;
  flex-wrap: wrap;
  gap: 5px;
}

.payment-tag {
  border: 1px solid var(--line);
  background: var(--surface);
}

.center-column,
.support-cell {
  text-align: center;
}

.support-badge {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 750;
}

.support-badge--yes {
  background: var(--green-soft);
  color: var(--green-dark);
}

.support-badge--no,
.support-badge--unknown {
  background: var(--surface-high);
  color: var(--muted);
}

.loading-state,
.error-state,
.empty-state {
  display: flex;
  min-height: 260px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.loading-spinner {
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  animation: spin 850ms linear infinite;
  border: 3px solid var(--surface-high);
  border-top-color: var(--green-dark);
  border-radius: 50%;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.error-state__icon {
  display: grid;
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
  place-items: center;
  border: 1px solid var(--error);
  border-radius: 50%;
  color: var(--error);
  font-weight: 800;
}

.error-state strong,
.empty-state strong {
  color: var(--black);
  font-size: 14px;
}

.error-state p,
.empty-state p {
  margin: 6px 0 14px;
}

.error-state button {
  cursor: pointer;
  border: 1px solid var(--black);
  border-radius: 4px;
  padding: 8px 14px;
  background: var(--black);
  color: #ffffff;
  font-size: 12px;
}

.data-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  text-align: right;
}

.guide-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 112px;
  scroll-margin-top: 90px;
}

.guide-card {
  min-height: 300px;
  border: 1px solid var(--line);
  padding: 34px;
  background: var(--surface-low);
}

.guide-card__index {
  color: var(--green-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

.guide-card h2 {
  margin: 48px 0 14px;
  color: var(--black);
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -0.025em;
}

.guide-card p {
  max-width: 570px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.guide-card a {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 28px;
  color: var(--green-dark);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.guide-card--dark {
  border-color: var(--black);
  background: var(--black);
}

.guide-card--dark .guide-card__index,
.guide-card--dark a {
  color: var(--green);
}

.guide-card--dark h2 {
  color: #ffffff;
}

.guide-card--dark p {
  color: #c9cdca;
}

footer {
  border-top: 1px solid var(--line);
  background: var(--surface-low);
}

.footer-inner {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

.footer-inner strong {
  color: var(--black);
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--green-dark);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 1050px) {
  .header-inner,
  .page-container,
  .footer-inner {
    width: min(100% - 48px, var(--max-width));
  }

  .hero__title-line {
    white-space: normal;
  }

  .table-shell {
    border: 0;
    background: transparent;
  }

  .table-scroll {
    overflow: visible;
  }

  table,
  tbody {
    display: block;
    min-width: 0;
  }

  thead {
    display: none;
  }

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

  tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--surface);
  }

  td {
    display: flex;
    min-width: 0;
    min-height: 72px;
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 14px 16px;
    border-right: 1px solid var(--line-light);
    border-bottom: 1px solid var(--line-light);
  }

  td::before {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 10px;
    font-weight: 600;
    content: attr(data-label);
  }

  .rank-cell {
    position: absolute;
    z-index: 1;
    top: 15px;
    left: 16px;
    display: block;
    width: auto;
    min-height: 0;
    padding: 0;
    border: 0;
  }

  .rank-cell::before,
  .site-cell::before {
    display: none;
  }

  .site-cell {
    grid-column: 1 / -1;
    min-height: 70px;
    padding-left: 68px;
    border-right: 0;
    background: var(--surface-low);
  }

  .site-name {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .models-cell,
  .payment-cell {
    grid-column: 1 / -1;
    border-right: 0;
  }

  .model-tags {
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
  }

  .payments {
    min-width: 0;
  }

  .metric,
  .metric-bar {
    width: 100%;
    min-width: 0;
  }

  .latency {
    justify-content: flex-start;
  }

  .refund-cell,
  .invoice-cell {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0;
  }

  .refund-cell::before,
  .invoice-cell::before {
    margin-bottom: 0;
  }
}

@media (max-width: 720px) {
  .header-inner,
  .page-container,
  .footer-inner {
    width: calc(100% - 32px);
  }

  .site-header {
    padding-top: env(safe-area-inset-top);
  }

  .desktop-nav,
  .header-action {
    display: none;
  }

  .header-inner {
    height: 60px;
  }

  .page-container {
    padding: 48px 0 72px;
  }

  .hero {
    margin-bottom: 42px;
  }

  .eyebrow {
    margin-bottom: 20px;
  }

  .hero h1 {
    font-size: clamp(29px, 9vw, 38px);
    line-height: 1.2;
  }

  .hero h2 {
    margin-top: 10px;
    font-size: 23px;
  }

  .hero p {
    margin-top: 18px;
    font-size: 14px;
  }

  .summary {
    grid-template-columns: 1fr;
    margin-bottom: 68px;
  }

  .summary__item {
    min-height: 108px;
  }

  .summary__item strong {
    font-size: 28px;
  }

  .section-heading {
    display: block;
  }

  .updated-at {
    margin-top: 10px;
  }

  .toolbar {
    flex-direction: column;
    gap: 10px;
  }

  .search-box,
  .sort-box {
    width: 100%;
    height: 48px;
  }

  .search-box input,
  .sort-box select {
    font-size: 16px;
  }

  .sort-box {
    min-width: 0;
  }

  tbody {
    grid-template-columns: 1fr;
    gap: 14px;
  }

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

  .data-note {
    line-height: 1.6;
    text-align: left;
  }

  .guide-section {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 72px;
  }

  .guide-card {
    min-height: 280px;
    padding: 26px;
  }

  .guide-card h2 {
    margin-top: 42px;
  }

  .footer-inner {
    min-height: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 28px 0 calc(30px + env(safe-area-inset-bottom));
  }

  .footer-links {
    flex-wrap: wrap;
    gap: 16px;
  }
}

@media (max-width: 380px) {
  .header-inner,
  .page-container,
  .footer-inner {
    width: calc(100% - 24px);
  }

  .hero h1 {
    font-size: 28px;
  }

  td {
    padding-inline: 12px;
  }

  .rank-cell {
    left: 12px;
  }

  .site-cell {
    padding-left: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
