/* ==========================================================================
   llmapicomparison.com — V5 "Neo-Brutalism" (Gumroad / 新野兽派)
   Cream base, thick black outlines, hard offset shadows, high-saturation
   accent blocks. Light theme only. Covers all classes/elements used by the
   existing templates (base.html / index.html / models.html / leaderboard.html
   / counter.html / _stations_block.html) — markup is unchanged.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;700&family=Archivo+Black&family=DM+Sans:wght@400;500;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* base surfaces */
  --bg: #fef6e4;          /* cream page background */
  --panel: #ffffff;       /* card / table surface */
  --panel-alt: #fffdf7;   /* footer / header surface, very slight cream */
  --ink: #111111;         /* near-black text + borders */
  --muted: #4b4640;       /* warm dark gray, AA on cream & white */

  /* accents — Gumroad-adjacent trio */
  --yellow: #ffd23f;
  --yellow-ink: #111111;
  --pink: #ff90e8;
  --pink-ink: #111111;
  --mint: #23d5ab;
  --mint-ink: #072e26;

  /* semantic */
  --accent: #ff2e93;      /* deep pink used for link accent / focus */
  --link-ink: #111111;
  --good: #0f8a5f;
  --new: #ff2e93;
  --tiers: #111111;

  /* borders / shadows */
  --border: #111111;
  --border-w: 2.5px;
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);
  --shadow-lg: 7px 7px 0 var(--ink);
  --radius: 10px;
  --radius-sm: 6px;

  /* medals */
  --gold: #e8b800;
  --gold-bg: #fff2b8;
  --silver: #8a8f98;
  --silver-bg: #eef0f2;
  --bronze: #b5651d;
  --bronze-bg: #f6ddc2;
}

/* ---------- reset / base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(17,17,17,.07) 1px, transparent 0);
  background-size: 22px 22px;
  color: var(--ink);
  font: 16px/1.6 "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

main { max-width: 1080px; margin: 0 auto; padding: 0 20px 72px; overflow-wrap: break-word; }

/* ---------- links (generic) ---------- */
a {
  color: var(--link-ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2.5px;
  text-underline-offset: 3px;
  font-weight: 700;
}
a:hover { background: var(--yellow); text-decoration-color: var(--ink); }
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
th.sortable:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--yellow);
}

/* ---------- header / nav / brand ---------- */
.site-header {
  background: var(--panel-alt);
  border-bottom: var(--border-w) solid var(--border);
}
.site-header nav {
  max-width: 1080px; margin: 0 auto; padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 10px;
}
.brand {
  font-family: "Archivo Black", "Space Grotesk", sans-serif;
  font-size: 20px;
  letter-spacing: -.01em;
  color: var(--ink);
  text-decoration: none;
  background: var(--yellow);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  box-shadow: var(--shadow-sm);
  display: inline-flex;
  transform: rotate(-1deg);
}
.brand:hover { background: var(--mint); text-decoration: none; }
.brand span { color: var(--accent); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a {
  margin-left: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  border: var(--border-w) solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
}
.links a:hover {
  background: var(--pink);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  transform: translate(-1px, -1px);
}

/* ---------- headings / lede / inline text ---------- */
h1 {
  font-family: "Archivo Black", "Space Grotesk", sans-serif;
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: -.01em;
  margin: 40px 0 12px;
}
h2 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  margin-top: 44px;
  font-size: 25px;
  display: inline-block;
  background: var(--mint);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  box-shadow: var(--shadow-sm);
}
h3 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 17px;
  margin: 0 0 6px;
}
.lede { color: var(--muted); font-size: 18px; max-width: 720px; font-weight: 500; }
.lede strong { color: var(--ink); }
.data-updated { color: var(--muted); font-size: 13px; font-family: "Space Mono", ui-monospace, monospace; margin: 4px 0 20px; }

code {
  font-family: "Space Mono", ui-monospace, monospace;
  background: var(--yellow);
  border: 1.5px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .9em;
}
em {
  font-style: normal;
  background: var(--pink);
  padding: 0 4px;
  border-radius: 3px;
}
strong { font-weight: 700; color: var(--ink); }

/* ---------- card ---------- */
.card {
  background: var(--panel);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 18px 0;
  box-shadow: var(--shadow);
}

/* ---------- forms ---------- */
label { display: block; margin: 14px 0 5px; color: var(--ink); font-size: 13px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

textarea, input[type=text], input[type=number], input[type=file], select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: var(--border-w) solid var(--border);
  background: #fff; color: var(--ink); font-size: 15px; font-family: "DM Sans", sans-serif;
  box-shadow: var(--shadow-sm);
}
textarea:focus, input:focus, select:focus { outline: none; }
textarea { min-height: 180px; resize: vertical; font-family: "Space Mono", monospace; font-size: 14px; }
input[type=file] { box-shadow: none; border-style: dashed; cursor: pointer; padding: 12px; }
input[type=file]:hover { background: var(--yellow); }
select { appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%),
                     linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 18px) center, calc(100% - 13px) center;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat; padding-right: 34px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  background: var(--yellow); color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700; padding: 11px 24px; border-radius: var(--radius-sm);
  border: var(--border-w) solid var(--border);
  font-size: 16px; cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .1s ease, box-shadow .1s ease, background .1s ease;
}
.btn:hover {
  background: var(--mint); text-decoration: none;
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}
.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

/* ---------- stats / stat cards ---------- */
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 18px 0; }
.stat {
  background: var(--panel);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  min-width: 150px;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .1s ease, box-shadow .1s ease;
}
a.stat { cursor: pointer; }
a.stat:hover { transform: translate(-3px, -3px); box-shadow: 7px 7px 0 var(--ink); text-decoration: none; }
a.stat:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
/* three-way accent rotation — works whether .stat is <a> (homepage nav cards)
   or <div> (counter/leaderboard numeric stat tiles) */
.stats .stat:nth-child(3n+1) { background: var(--yellow); }
.stats .stat:nth-child(3n+2) { background: var(--pink); }
.stats .stat:nth-child(3n+3) { background: var(--mint); }
.stat .num {
  font-family: "Space Grotesk", sans-serif;
  font-size: 30px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat .lab { color: var(--ink); opacity: .75; font-size: 12.5px; font-weight: 600; margin-top: 2px; }
.stat .lab strong { color: var(--ink); }

/* ---------- tables ---------- */
.tablewrap {
  overflow-x: auto;
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 16px 0;
  background: var(--panel);
}
table {
  border-collapse: collapse; width: 100%; margin: 0; font-size: 14px;
  background: var(--panel);
}
th, td {
  text-align: left; padding: 9px 12px; border-bottom: 2px solid var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
th {
  color: var(--ink); font-weight: 700; font-family: "Space Grotesk", sans-serif;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em;
  position: sticky; top: 0; z-index: 2;
  background: var(--yellow);
  border-bottom: var(--border-w) solid var(--ink);
}
th.sortable { cursor: pointer; }
th.sortable:hover { background: var(--pink); }
td.name { white-space: normal; min-width: 220px; font-weight: 600; }
tbody tr:hover { background: rgba(255, 144, 232, .18); }

/* ---------- badges ---------- */
.badge-new, .badge-tiers {
  display: inline-block; font-size: 10.5px; font-weight: 800;
  border: 1.5px solid var(--border); border-radius: 5px;
  padding: 1px 6px; margin-left: 6px; vertical-align: 1px;
  text-transform: uppercase; letter-spacing: .02em;
  box-shadow: 2px 2px 0 var(--ink);
}
.badge-new { background: var(--pink); color: var(--pink-ink); }
.badge-tiers { background: var(--mint); color: var(--mint-ink); }

/* ---------- filters ---------- */
.filters { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; margin: 14px 0; }
.filters > div { flex: 1 1 180px; }
.filters.card { padding: 18px 20px 14px; }

/* ---------- muted / faq / notice ---------- */
.muted { color: var(--muted); font-size: 14px; font-weight: 600; }

.faq { display: grid; gap: 12px; margin: 16px 0 8px; }
.faq h3::before { content: "Q. "; color: var(--accent); }

.notice {
  background: var(--mint);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 15px; font-size: 13.5px; color: var(--mint-ink); font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ---------- footer ---------- */
.site-footer {
  border-top: var(--border-w) solid var(--border);
  margin-top: 56px; background: var(--panel-alt);
}
.site-footer p {
  max-width: 1080px; margin: 14px auto; padding: 0 20px;
  color: var(--muted); font-size: 13px; font-weight: 500;
}
.site-footer a { color: var(--ink); }

/* ---------- sponsored stations block ---------- */
.stations {
  margin-top: 44px; padding: 22px;
  border: var(--border-w) dashed var(--border);
  border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, #fff 0 14px, #fffdf0 14px 28px);
  box-shadow: var(--shadow-lg);
}
.stations .product-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.stations .product-head h2 { margin-top: 0; }
.stations .src {
  color: var(--ink); font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--ink); color: #fff;
  border-radius: 999px; padding: 4px 12px;
  display: inline-block;
}
.stations .src a { color: var(--yellow); text-decoration-color: var(--yellow); }
.stations .src a:hover { background: transparent; color: var(--pink); text-decoration-color: var(--pink); }

.station-list {
  list-style: none; margin: 16px 0 0; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px;
}
.station-list li {
  background: var(--panel);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  position: relative;
}
.station-list li::before {
  content: "AD";
  position: absolute; top: -10px; right: 10px;
  background: var(--yellow); color: var(--ink);
  font-family: "Space Grotesk", sans-serif; font-size: 10px; font-weight: 800;
  border: 1.5px solid var(--border); border-radius: 4px;
  padding: 1px 6px; letter-spacing: .04em;
  box-shadow: 2px 2px 0 var(--ink);
}
.station-list li:nth-child(3n+2)::before { background: var(--pink); }
.station-list li:nth-child(3n+3)::before { background: var(--mint); }
.station-name {
  font-weight: 800; font-size: 15.5px; text-decoration-color: var(--accent);
}
.station-list .tag {
  display: inline-block; background: #fff; color: var(--ink);
  font-size: 10.5px; font-weight: 700; border: 1.5px solid var(--border);
  border-radius: 5px; padding: 1px 7px; margin: 7px 6px 0 0;
}
.station-list p { color: var(--muted); font-size: 13px; margin: 9px 0 0; font-weight: 500; }
.stations .disclaimer { color: var(--muted); font-size: 11.5px; margin-top: 16px; font-weight: 600; }

/* ---------- leaderboard rank highlighting ---------- */
.rank-num {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800; color: var(--ink); text-align: right;
  font-variant-numeric: tabular-nums;
}
tr.rank-top { background: var(--pink); background: rgba(255, 144, 232, .18); }
tr.rank-1 { background: var(--gold-bg); box-shadow: inset 6px 0 0 var(--gold); }
tr.rank-1 .rank-num { color: #6e5400; }
tr.rank-1 .rank-num::before { content: "🥇 "; }
tr.rank-2 { background: var(--silver-bg); box-shadow: inset 6px 0 0 var(--silver); }
tr.rank-2 .rank-num { color: #55595f; }
tr.rank-2 .rank-num::before { content: "🥈 "; }
tr.rank-3 { background: var(--bronze-bg); box-shadow: inset 6px 0 0 var(--bronze); }
tr.rank-3 .rank-num { color: #8a4a10; }
tr.rank-3 .rank-num::before { content: "🥉 "; }

/* ---------- breadcrumb (per-model pricing/counter pages) ---------- */
.breadcrumb {
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px; font-weight: 600; color: var(--muted);
  margin: 18px 0 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
}
.breadcrumb a { font-weight: 700; }
.breadcrumb span { color: var(--muted); }

/* ---------- price / bench stat tiles: multi-line label (per-1K sub-value, rank) ---------- */
.price-stats .lab, .bench-stats .lab { line-height: 1.35; }

/* ---------- CTA row + secondary button ---------- */
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.btn-secondary {
  background: var(--panel);
}
.btn-secondary:hover { background: var(--yellow); }

/* ---------- data source line ---------- */
.source-line {
  color: var(--muted); font-size: 12.5px; font-weight: 700;
  font-family: "Space Mono", ui-monospace, monospace;
  margin: 28px 0 0;
}

/* ---------- comparison tables: highlight "you are here" row on Leaderboard neighbours ---------- */
tr.self-row { background: var(--yellow); }
tr.self-row td { font-weight: 700; }

/* ---------- degraded-state notice (price data fetch failed) ---------- */
.notice-warn { background: var(--pink); color: var(--pink-ink); }

/* ---------- token-counter "by model" directory (main /token-counter/ page footer) ---------- */
.counter-directory {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px; margin: 16px 0 8px;
}
.counter-group {
  background: var(--panel);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.counter-group h3 { margin-bottom: 8px; }
.counter-group ul { list-style: none; margin: 0; padding: 0; }
.counter-group li { margin: 3px 0; font-size: 13.5px; }
.counter-group a { font-weight: 600; text-decoration-thickness: 1.5px; }

/* ==========================================================================
   Responsive — no horizontal page scroll at 375px; tables scroll internally
   via .tablewrap only.
   ========================================================================== */
@media (max-width: 600px) {
  main { padding: 0 16px 56px; }
  h1 { font-size: 30px; }
  h2 { font-size: 20px; }
  .lede { font-size: 16px; }
  .site-header nav { padding: 12px 16px; gap: 8px; }
  .brand { font-size: 17px; transform: none; }
  .links { width: 100%; gap: 6px; }
  .links a { padding: 5px 8px; font-size: 13px; }
  .card, .filters.card { padding: 16px; }
  .stats { gap: 12px; }
  .stat { min-width: 130px; padding: 12px 16px; }
  .stat .num { font-size: 24px; }
  .station-list { grid-template-columns: 1fr; }
  .stations { padding: 16px; }
  .btn { width: 100%; text-align: center; }
  .cta-row { flex-direction: column; }
  .counter-directory { grid-template-columns: 1fr; }
  .breadcrumb { font-size: 12px; }
}
