*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html.lang-wait body {
  visibility: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  color: #1c1915;
  background:
    radial-gradient(1200px 420px at 10% -10%, rgba(15, 92, 69, 0.08), transparent 60%),
    #f3f0e8;
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

a {
  color: #0f5c45;
}

a:hover {
  color: #0a3d2e;
}

:focus-visible {
  outline: 2px solid #0f5c45;
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 12px;
  top: 8px;
  z-index: 30;
  transform: translateY(-140%);
  background: #1c1915;
  color: #fff;
  padding: 10px 14px;
  text-decoration: none;
}

.skip:focus {
  transform: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.container {
  width: min(100% - 32px, 1120px);
  margin-inline: auto;
}

.num,
code {
  font-variant-numeric: tabular-nums;
  font-family: "Cascadia Mono", "Segoe UI Mono", ui-monospace, Consolas, monospace;
}

h1,
h2,
h3,
.logo strong {
  font-family: "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  text-wrap: balance;
}

h2 {
  margin: 0 0 10px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

p {
  margin: 0 0 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(243, 240, 232, 0.92);
  border-bottom: 1px solid #e2dcd0;
  backdrop-filter: blur(10px);
}

.bar,
.bar-tools,
.nav-row,
.hero-actions,
.card-links,
.rate-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bar {
  justify-content: space-between;
  min-height: 72px;
}

.logo {
  display: grid;
  color: inherit;
  text-decoration: none;
}

.logo strong {
  font-size: 1.35rem;
}

.logo small,
.eyebrow,
.kicker,
.estimate-kicker {
  color: #6a6256;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bar-tools {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lang select,
.filter-grid select,
.filter-grid input,
.stack select,
.stack input {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cfc6b8;
  border-radius: 10px;
  background: #fffdf8;
  padding: 8px 12px;
}

.nav-panel {
  display: none;
  border-top: 1px solid #e2dcd0;
}

.nav-panel.is-open {
  display: block;
}

.nav-row {
  flex-wrap: wrap;
  padding: 12px 0 16px;
}

.nav-row a,
.text-btn {
  color: #1c1915;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 8px 0;
  cursor: pointer;
}

.nav-close {
  margin-left: auto;
}

.btn,
.btn-line,
.account-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
}

.btn {
  background: #0f5c45;
  color: #f7f4ee;
  border: 1px solid #0f5c45;
}

.btn:hover {
  background: #0a3d2e;
  color: #fff;
}

.btn-line,
.account-btn {
  background: transparent;
  color: #1c1915;
  border: 1px solid #1c1915;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid #cfc6b8;
  border-radius: 12px;
  background: #fffdf8;
  color: #1c1915;
  cursor: pointer;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  margin: 0 auto;
}

.hero {
  padding: 36px 0 12px;
}

.hero-grid,
.estimate-grid,
.footer-grid,
.credit-grid,
.use-grid,
.guide-grid,
.dispute-grid {
  display: grid;
  gap: 18px;
}

.hero-copy,
.hero-card,
.credit-card,
.use-grid article,
.guide-grid article,
.dispute-grid article,
.estimate-out {
  background: #fffdf8;
  border: 1px solid #e2dcd0;
  border-radius: 18px;
}

.hero-copy,
.hero-card {
  padding: 28px 24px;
}

.title-line {
  display: block;
  color: #0f5c45;
}

.hero-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.hero-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #eee6da;
}

.panel {
  padding: 28px 0;
}

.section-head {
  max-width: 760px;
  margin-bottom: 18px;
}

.muted,
.fine {
  color: #5e564c;
}

.note,
.callout {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f6f0e2;
  color: #4e4332;
}

.filter-grid,
.token-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.filter-grid label,
.stack label,
.token-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.token-grid label[hidden] {
  display: none;
}

.filter-action {
  display: flex;
  align-items: end;
}

.rate-head {
  display: none;
}

.rate,
.dispute-grid article {
  padding: 16px;
  margin-bottom: 12px;
}

.rate {
  background: #fffdf8;
  border: 1px solid #e2dcd0;
  border-radius: 16px;
}

.model-id {
  margin: 0;
  color: #6a6256;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.tier-line {
  display: none;
  margin: 4px 0 0;
  color: #6a6256;
  font-size: 0.78rem;
}

.rate-facts {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.rate-facts div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rate-facts dt {
  color: #6a6256;
}

.rate-facts dd {
  margin: 0;
  text-align: right;
}

.rate-actions,
.card-links {
  flex-wrap: wrap;
}

.dispute {
  margin-top: 22px;
}

.dispute-sides {
  margin: 0;
  padding-left: 18px;
}

.dispute-sides li {
  margin: 8px 0;
}

.estimate-grid {
  align-items: start;
}

.stack {
  display: grid;
  gap: 12px;
  padding: 18px;
  background: #fffdf8;
  border: 1px solid #e2dcd0;
  border-radius: 18px;
}

.estimate-out {
  padding: 14px;
}

.estimate-total {
  margin: 0;
  font-family: "Palatino Linotype", Palatino, "Songti SC", serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.estimate-formula {
  margin: 6px 0 0;
  color: #5e564c;
}

.credit-card,
.use-grid article,
.guide-grid article {
  padding: 18px;
}

.summary {
  font-weight: 650;
}

.fact-list {
  margin: 12px 0;
}

.fact-list div {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-top: 1px solid #eee6da;
}

.fact-list dt {
  color: #6a6256;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fact-list dd {
  margin: 0;
}

.rules summary,
.method summary {
  cursor: pointer;
  font-weight: 650;
}

.rules p,
.method p {
  margin: 8px 0 0;
}

.method {
  margin-top: 12px;
}

.name-btn {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.name-btn:hover,
.name-btn:focus-visible {
  color: #0f5c45;
}

.group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin: 18px 0 0;
  padding: 8px 0 6px;
  border-bottom: 1px solid #e2dcd0;
}

.group-head p {
  margin: 0;
  color: #5e564c;
  font-size: 0.85rem;
}

.credit-card h4 {
  margin: 16px 0 8px;
  font-size: 0.95rem;
}

.credit-card ul {
  margin: 0 0 12px;
  padding-left: 18px;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  counter-reset: step;
}

.steps li {
  padding: 16px 16px 16px 64px;
  background: #fffdf8;
  border: 1px solid #e2dcd0;
  border-radius: 16px;
  position: relative;
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #0f5c45;
  color: #f7f4ee;
  font-weight: 700;
}

.endpoint {
  display: grid;
  gap: 4px;
}

.endpoint span {
  color: #6a6256;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

code {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f6f1e7;
  word-break: break-all;
  font-size: 0.86rem;
}

.faq-list details {
  border-top: 1px solid #e2dcd0;
  padding: 12px 0;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 650;
}

.site-footer {
  padding: 28px 0 40px;
  background: #1c1915;
  color: #f3f0e8;
}

.site-footer a {
  color: #d7efe4;
}

.footer-links {
  display: grid;
  gap: 8px;
}

.legal {
  margin-top: 18px;
  color: #c9c1b4;
  font-size: 0.92rem;
}

dialog {
  width: min(100% - 32px, 460px);
  border: 1px solid #e2dcd0;
  border-radius: 18px;
  padding: 22px;
  background: #fffdf8;
}

dialog::backdrop {
  background: rgba(28, 25, 21, 0.48);
}

.wait-track {
  height: 8px;
  margin: 16px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e0d4;
}

.wait-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #0f5c45;
}

.wait-count {
  margin: 0 0 16px;
  font-family: "Palatino Linotype", Palatino, "Songti SC", serif;
  font-size: 1.8rem;
  line-height: 1.1;
}

.account-links {
  margin: 0 0 16px;
  padding-left: 18px;
}

.empty {
  padding: 16px;
  background: #fffdf8;
  border-radius: 16px;
}

@media (max-width: 859px) {
  .bar {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 8px;
    padding: 10px 0;
  }

  .bar-tools {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .nav-panel.is-open {
    flex: 1 1 100%;
    order: 3;
  }
}

@media (min-width: 860px) {
  .icon-btn,
  .nav-close {
    display: none;
  }

  .nav-panel {
    display: block;
    border-top: 0;
  }

  .nav-row {
    padding-top: 0;
  }

  .hero-grid {
    grid-template-columns: 1.3fr 0.9fr;
    align-items: stretch;
  }

  .filter-grid {
    grid-template-columns: 1fr 1fr 1.4fr auto;
    align-items: end;
  }

  .rate-head,
  #rateList .rate {
    display: grid;
    grid-template-columns: minmax(180px, 1.4fr) repeat(5, minmax(90px, 0.8fr));
    gap: 10px;
    align-items: start;
  }

  .rate-head {
    padding: 0 16px 8px;
    color: #6a6256;
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  #rateList .rate-facts {
    display: contents;
  }

  .rate-facts div:nth-child(6) {
    display: none;
  }

  .rate-facts div {
    display: block;
  }

  .rate-facts dd {
    text-align: left;
  }

  .rate-facts dt {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .rate-actions {
    grid-column: 1 / -1;
  }

  .estimate-grid,
  .footer-grid {
    grid-template-columns: 0.8fr 1.2fr;
  }

  .footer-grid {
    grid-template-columns: 1.2fr 1fr 0.8fr;
  }

  .credit-grid,
  .guide-grid {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }

  .use-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .steps {
    grid-template-columns: repeat(4, 1fr);
  }

  .token-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .faq-wrap {
    grid-template-columns: minmax(180px, 0.7fr) 1.4fr;
    align-items: start;
    gap: 40px;
  }
}

.logo strong::before {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 0.55em;
  margin-right: 0.45em;
  border-radius: 2px;
  background: #0f5c45;
  box-shadow: 0.28em 0.28em 0 #c9b89a;
  transform: translateY(-0.04em);
}

.panel {
  padding: 72px 0;
  scroll-margin-top: 76px;
}

.sheet {
  background: #fffdf8;
}

.section-head {
  max-width: 34rem;
  margin-bottom: 28px;
}

main {
  counter-reset: band;
}

.section-head > h2::before {
  counter-increment: band;
  content: counter(band, decimal-leading-zero);
  display: block;
  margin-bottom: 8px;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans", sans-serif;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.16em;
  color: #0f5c45;
}

.hero {
  padding: 64px 0 36px;
}

.hero-copy {
  background: transparent;
  border: 0;
  padding: 8px 0 0;
  box-shadow: none;
}

.hero-copy .eyebrow {
  margin-bottom: 14px;
}

.hero .note {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid #d5ccbe;
  border-radius: 999px;
  background: transparent;
  font-size: 0.86rem;
}

.hero-card {
  background: #1c1915;
  color: #f6f3ec;
  border: 0;
  border-radius: 28px;
  padding: 28px 26px 18px;
  box-shadow: 0 28px 60px rgba(28, 25, 21, 0.16);
}

.hero-card .eyebrow,
.hero-card .fine,
.hero-card .muted {
  color: #c9c0b2;
}

.hero-card h2,
.hero-card .name-btn {
  color: #f6f3ec;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.hero-card .name-btn:hover,
.hero-card .name-btn:focus-visible {
  color: #d7efe4;
}

.hero-list li {
  align-items: baseline;
  padding: 14px 0;
  border-top-color: rgba(246, 243, 236, 0.16);
}

.hero-list strong {
  font-size: 1.2rem;
  font-weight: 650;
}

#estimate {
  margin-top: 22px;
  padding: 16px;
  border-radius: 24px;
  background: #e7e0d4;
  scroll-margin-top: 84px;
}

.missing-note {
  margin: 0 0 12px;
  color: #6a6256;
  font-size: 0.92rem;
}

#rateList .rate.is-picked {
  border-color: #0f5c45;
  box-shadow: 0 0 0 2px #0f5c45;
}

.stack {
  gap: 14px;
  padding: 22px;
  border-radius: 24px;
  box-shadow: 0 16px 40px rgba(28, 25, 21, 0.06);
}

.estimate-out {
  background: #1c1915;
  color: #f6f3ec;
  border: 0;
  border-radius: 18px;
  padding: 18px 18px 16px;
}

.estimate-out .estimate-kicker {
  color: #b7d7c8;
}

.estimate-formula {
  color: #d9d1c3;
}

.filter-grid {
  margin-bottom: 18px;
  padding: 12px;
  background: #f6f1e7;
  border: 1px solid #e4ddd0;
  border-radius: 18px;
}

#resultStatus {
  margin: 0 0 12px;
  color: #6a6256;
  font-size: 0.88rem;
}

.group-head {
  margin: 26px 2px 8px;
  padding: 0;
  border: 0;
}

.group-head .name-btn {
  font-family: "Palatino Linotype", Palatino, "Songti SC", serif;
  font-size: 1.15rem;
}

.group-head p:last-child {
  padding: 3px 10px;
  border-radius: 999px;
  background: #e7f3ee;
  color: #0f5c45;
  font-size: 0.75rem;
  letter-spacing: 0.03em;
}

.rate-openrouter { border-left: 3px solid #0f5c45; }
.rate-fireworks { border-left: 3px solid #8a5a2b; }
.rate-together { border-left: 3px solid #3d4c5f; }

.rate.in-group {
  background: #fffcf7;
}

.dispute {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid #e4ddd0;
}

.method,
.note {
  font-size: 0.92rem;
}

.credit-card {
  display: flex;
  flex-direction: column;
  padding: 22px 20px 18px;
  border-radius: 22px;
  box-shadow: 0 10px 30px rgba(28, 25, 21, 0.04);
}

.credit-grid article:nth-child(1) { box-shadow: inset 0 4px 0 #0f5c45, 0 10px 30px rgba(28, 25, 21, 0.04); }
.credit-grid article:nth-child(2) { box-shadow: inset 0 4px 0 #8a5a2b, 0 10px 30px rgba(28, 25, 21, 0.04); }
.credit-grid article:nth-child(3) { box-shadow: inset 0 4px 0 #3d4c5f, 0 10px 30px rgba(28, 25, 21, 0.04); }

.credit-card h3 {
  font-size: 1.55rem;
  margin-bottom: 6px;
}

.summary {
  font-weight: 500;
  color: #3f3a33;
}

.fact-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 16px 0 12px;
}

.fact-list div {
  gap: 4px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  background: #f6f1e7;
}

.fact-list dt {
  letter-spacing: 0.02em;
  text-transform: none;
}

.credit-card .card-links {
  margin-top: auto;
  padding-top: 8px;
}

.credit-card h4 {
  margin-top: 8px;
  color: #6a6256;
  font-family: "Segoe UI", "PingFang SC", "Noto Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ink {
  background: #12382c;
  color: #f4f0e6;
}

.ink h2,
.ink h3 {
  color: #f4f0e6;
  text-wrap: balance;
}

.ink .section-head > h2::before {
  color: #b7d7c8;
}

.ink p {
  color: #d9d1c3;
}

.ink .steps li {
  background: rgba(255, 253, 248, 0.05);
  border-color: rgba(255, 253, 248, 0.14);
}

.ink .steps li::before {
  background: #f4f0e6;
  color: #12382c;
}

.use-grid article,
.guide-grid article {
  border-radius: 20px;
  padding: 20px 18px 16px;
}

.use-grid h3,
.guide-grid h3 {
  font-size: 1.35rem;
}

#images {
  margin-top: 42px;
  padding-top: 8px;
}

.endpoint code {
  background: #1c1915;
  color: #f6f3ec;
}

.faq-list details {
  padding: 16px 0 14px;
}

.faq-list summary {
  font-family: "Palatino Linotype", Palatino, "Songti SC", serif;
  font-size: 1.12rem;
  font-weight: 600;
}

.faq-list p {
  max-width: 62ch;
  color: #4e463c;
}

.site-footer {
  padding: 56px 0 36px;
}

.site-footer h2 {
  font-size: 1.15rem;
}

@media (min-width: 860px) {
  .nav-panel {
    align-self: center;
  }

  .nav-row {
    padding: 0;
    gap: 22px;
  }

  .nav-row a {
    position: relative;
    padding: 6px 0;
  }

  .hero-grid {
    align-items: center;
    gap: 48px;
  }

  .tier-line {
    display: block;
  }

  .rate-head,
  #rateList .rate {
    grid-template-columns: minmax(200px, 1.6fr) repeat(4, minmax(84px, 0.8fr));
  }

  .rate-head span:nth-child(6),
  #rateList .rate-facts div:nth-child(5) {
    display: none;
  }

  #rateList .rate {
    padding: 14px 16px 12px;
    margin-bottom: 8px;
  }

  #rateList .rate-actions {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
  }

  .rate-head {
    position: sticky;
    top: 73px;
    z-index: 2;
    padding: 8px 16px 8px 19px;
    background: #fffdf8;
  }
}

@media (min-width: 860px) and (max-width: 1099px) {
  .steps,
  .use-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .hero {
    padding-top: 28px;
  }

  .panel {
    padding: 48px 0;
  }
}

@media (min-width: 860px) {
  .desk {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
    gap: 18px;
    align-items: start;
  }

  #estimate {
    position: sticky;
    top: 84px;
    max-height: calc(100vh - 100px);
    margin-top: 0;
    overflow: auto;
  }

  #estimate .stack {
    gap: 10px;
    padding: 14px;
  }

  #estimate .estimate-total {
    font-size: 2rem;
  }

  #estimate .estimate-grid,
  #estimate .token-grid {
    grid-template-columns: 1fr;
  }

  #estimate h2 {
    font-size: 1.45rem;
  }

  .desk .rate-head,
  .desk #rateList .rate {
    grid-template-columns: minmax(128px, 1.3fr) repeat(4, minmax(58px, 0.7fr));
  }
}

.estimate-out.is-fresh {
  animation: estimate-flash 0.6s ease;
}

@keyframes estimate-flash {
  from { box-shadow: 0 0 0 3px rgba(15, 92, 69, 0.45); }
  to { box-shadow: 0 0 0 0 rgba(15, 92, 69, 0); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .estimate-out.is-fresh {
    animation: none;
  }
}
