:root {
  color-scheme: light dark;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #f0f0f2;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(60, 60, 67, .16);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #248a3d;
  --red: #d70015;
  --shadow: 0 18px 55px rgba(0, 0, 0, .08);
  --ease-out: cubic-bezier(.23, 1, .32, 1);
}

* { box-sizing: border-box; }
html { overflow-x: hidden; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; overflow-x: hidden; background: var(--bg); color: var(--text); font: 100%/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
code, pre { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; }
.nav-inner, main, footer { width: min(1080px, calc(100% - 2.5rem)); margin-inline: auto; }

.nav { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid rgba(60, 60, 67, .1); background: rgba(245, 245, 247, .78); backdrop-filter: blur(22px) saturate(180%); -webkit-backdrop-filter: blur(22px) saturate(180%); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; min-height: 3.75rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: inherit; text-decoration: none; font-size: .92rem; font-weight: 650; letter-spacing: -.015em; }
.brand span { display: grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: .58rem; background: linear-gradient(145deg, #1685f8, #0066d6); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 3px 9px rgba(0, 102, 214, .2); font-size: .78rem; font-weight: 750; }
.live { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .72rem; font-weight: 500; }
.live i { width: .45rem; height: .45rem; border-radius: 50%; background: #30d158; box-shadow: 0 0 0 .2rem rgba(48, 209, 88, .12); }

.hero { padding: clamp(6rem, 13vw, 10rem) 0 clamp(4.5rem, 9vw, 7rem); text-align: center; }
.eyebrow, .label { margin: 0 0 .8rem; color: var(--blue); font-size: .76rem; font-weight: 650; letter-spacing: .035em; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 780px; margin: 0 auto 1.35rem; font-size: clamp(3.4rem, 7.5vw, 6rem); line-height: .98; letter-spacing: -.06em; font-weight: 720; text-wrap: balance; }
.lede { max-width: 38rem; margin: 0 auto; color: var(--muted); font-size: clamp(1.08rem, 2vw, 1.35rem); line-height: 1.45; letter-spacing: -.018em; }

.lookup { margin: 0 0 clamp(7rem, 13vw, 10rem); padding: clamp(1.4rem, 4vw, 2.6rem); border: 1px solid rgba(255, 255, 255, .7); border-radius: 1.8rem; background: rgba(255, 255, 255, .78); box-shadow: var(--shadow); backdrop-filter: blur(30px) saturate(160%); -webkit-backdrop-filter: blur(30px) saturate(160%); }
.lookup-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.7rem; }
.lookup-head h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.15rem); line-height: 1.08; letter-spacing: -.04em; }
.privacy { display: flex; align-items: center; gap: .48rem; color: var(--muted); font-size: .74rem; }
.privacy span { width: .42rem; height: .42rem; border-radius: 50%; background: var(--green); }
label { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .5rem; color: var(--muted); font-size: .78rem; }
label small { font-weight: 400; }
label code { color: var(--text); font-size: .74rem; }
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .65rem; }
.input-wrap { position: relative; }
input { width: 100%; height: 3.3rem; padding: 0 4.5rem 0 1rem; border: 1px solid transparent; border-radius: .9rem; outline: 0; background: var(--surface-soft); color: var(--text); font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: .84rem; transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out), background-color 160ms var(--ease-out); }
input::placeholder { color: #8e8e93; }
input:focus { border-color: var(--blue); background: var(--surface); box-shadow: 0 0 0 .22rem rgba(0, 113, 227, .14); }
.input-wrap button { position: absolute; top: .47rem; right: .55rem; height: 2.35rem; padding: 0 .55rem; border: 0; border-radius: .55rem; background: transparent; color: var(--blue); font-size: .78rem; font-weight: 600; }
.primary, .secondary { min-height: 3.3rem; padding: 0 1.2rem; border: 0; border-radius: .9rem; font-weight: 600; transition: transform 140ms var(--ease-out), background-color 160ms ease, opacity 160ms ease; }
.primary { background: var(--blue); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2); }
.secondary { background: var(--surface-soft); color: var(--text); }
.primary:active, .secondary:active, .input-wrap button:active, .brand:active { transform: scale(.97); }
.primary:disabled { cursor: progress; opacity: .6; }
#message { min-height: 0; margin: .8rem 0 0; color: var(--red); font-size: .8rem; }
#message:empty { display: none; }

#dashboard { margin-top: 2.25rem; padding-top: 2.25rem; border-top: 1px solid var(--line); opacity: 1; transform: translateY(0); transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out); }
@starting-style { #dashboard { opacity: 0; transform: translateY(.45rem); } }
.balance { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 1rem .35rem 2rem; }
.balance-copy span { display: block; color: var(--muted); font-size: .82rem; }
.balance-copy strong { display: block; margin: .15rem 0 -.1rem; font-size: clamp(3rem, 7vw, 5rem); line-height: 1; letter-spacing: -.06em; font-weight: 680; font-variant-numeric: tabular-nums; }
.balance-copy small { color: var(--muted); }
.usage-ring { --usage: 0%; display: grid; place-items: center; width: 7.4rem; height: 7.4rem; flex: none; border-radius: 50%; background: conic-gradient(var(--blue) var(--usage), rgba(118, 118, 128, .12) 0); }
.usage-ring::before { content: ""; grid-area: 1/1; width: 6rem; height: 6rem; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 5px rgba(0, 0, 0, .04); }
.usage-ring div { z-index: 1; grid-area: 1/1; text-align: center; }
.usage-ring strong, .usage-ring span { display: block; }
.usage-ring strong { font-size: 1.25rem; letter-spacing: -.03em; }
.usage-ring span { color: var(--muted); font-size: .7rem; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 1.15rem; background: rgba(118, 118, 128, .045); }
.stats article { padding: 1.15rem 1.25rem; }
.stats article + article { border-left: 1px solid var(--line); }
.stats span { display: block; color: var(--muted); font-size: .72rem; }
.stats strong { display: block; margin-top: .3rem; font-size: 1.25rem; font-weight: 600; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.stats strong.date { margin-top: .45rem; font-size: 1.05rem; }
.stats small { display: block; margin-top: .1rem; color: var(--muted); font-size: .7rem; }
.stats .state { width: max-content; margin-top: .3rem; padding: .08rem .42rem; border-radius: 99rem; background: rgba(36, 138, 61, .1); color: var(--green); font-weight: 600; }
.stats .state.disabled, .stats .state.expired, .stats .state.exhausted { background: rgba(215, 0, 21, .1); color: var(--red); }
.usage-head { display: flex; align-items: end; justify-content: space-between; margin: 2.25rem .2rem .7rem; }
.usage-head h3 { margin: 0; font-size: .95rem; font-weight: 600; letter-spacing: -.01em; }
.usage-head span { color: var(--muted); font-size: .72rem; }
.table-wrap { max-width: 100%; overflow: auto; overscroll-behavior-x: contain; border: 1px solid var(--line); border-radius: 1.15rem; background: rgba(118, 118, 128, .035); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .75rem; }
th, td { padding: .8rem .85rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .66rem; font-weight: 550; }
tbody tr:last-child td { border: 0; }
.ok { color: var(--green); }.error { color: var(--red); }

.models { padding-bottom: clamp(7rem, 13vw, 10rem); }
.models-head { display: flex; align-items: end; justify-content: space-between; gap: 2rem; margin-bottom: 1.6rem; }
.models-head h2 { margin: 0; font-size: clamp(2.7rem, 5vw, 4rem); line-height: 1; letter-spacing: -.055em; }
.models-head p:not(.eyebrow) { max-width: 34rem; margin: .9rem 0 0; color: var(--muted); }
.models-head > span { color: var(--muted); font-size: .78rem; }
.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.model { min-width: 0; padding: 1.1rem 1.15rem; border: 1px solid rgba(255, 255, 255, .7); border-radius: 1rem; background: var(--surface); box-shadow: 0 5px 22px rgba(0, 0, 0, .035); }
.model code { display: block; overflow: hidden; color: var(--text); font-size: .78rem; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.model span { display: block; margin-top: .28rem; color: var(--muted); font-size: .68rem; }
.model-message { margin: .75rem 0 0; color: var(--red); font-size: .8rem; }
.model-message:empty { display: none; }

.connect { display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(3rem, 8vw, 6rem); margin-bottom: clamp(6rem, 11vw, 9rem); padding: clamp(2rem, 5vw, 4rem); border-radius: 2rem; background: #1d1d1f; color: #f5f5f7; box-shadow: 0 22px 60px rgba(0, 0, 0, .12); }
.connect .eyebrow { color: #2997ff; }
.connect h2 { margin-bottom: 1rem; font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1; letter-spacing: -.055em; }
.connect > div > p:last-child { max-width: 24rem; color: #a1a1a6; }
.endpoint { min-width: 0; padding-top: .25rem; }
.endpoint > span { display: block; margin-bottom: .5rem; color: #a1a1a6; font-size: .65rem; font-weight: 600; letter-spacing: .04em; }
.endpoint > code { display: block; padding: .9rem 1rem; border: 1px solid #424245; border-radius: .85rem; background: #2c2c2e; color: #64d2ff; font-size: .84rem; overflow-wrap: anywhere; }
pre { max-width: 100%; margin: .75rem 0 0; padding: 1rem; overflow: auto; overscroll-behavior-x: contain; border: 1px solid #424245; border-radius: 1rem; background: #111113; color: #f5f5f7; font-size: .69rem; line-height: 1.65; -webkit-overflow-scrolling: touch; }

footer { display: flex; justify-content: space-between; padding: 1.8rem 0 max(2.5rem, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: .75rem; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible { outline: .18rem solid rgba(0, 113, 227, .55); outline-offset: .2rem; }

@media (hover: hover) and (pointer: fine) {
  .primary:hover { background: var(--blue-hover); }
  .secondary:hover { background: rgba(118, 118, 128, .15); }
  .input-wrap button:hover { background: rgba(0, 113, 227, .08); }
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --surface: #1c1c1e; --surface-soft: #2c2c2e; --text: #f5f5f7; --muted: #98989d; --line: rgba(235, 235, 245, .15); --blue: #0a84ff; --blue-hover: #409cff; --green: #30d158; --red: #ff453a; --shadow: 0 24px 80px rgba(0, 0, 0, .4); }
  .nav { border-color: rgba(235, 235, 245, .12); background: rgba(0, 0, 0, .72); }
  .lookup { border-color: rgba(255, 255, 255, .1); background: rgba(28, 28, 30, .78); }
  .model { border-color: rgba(255, 255, 255, .1); }
}

@media (max-width: 760px) {
  .nav-inner, main, footer { width: min(100% - 1.5rem, 1080px); }
  .nav-inner { min-height: 3.55rem; }
  .live { font-size: 0; }
  .live i { width: .5rem; height: .5rem; }
  .hero { padding: 5rem 0 3.75rem; }
  h1 { font-size: clamp(3rem, 14vw, 4.5rem); }
  .lookup { padding: 1.25rem; border-radius: 1.4rem; }
  .lookup-head { align-items: start; flex-direction: column; gap: .7rem; }
  input { font-size: 1rem; }
  .key-row { grid-template-columns: 1fr 1fr; }
  .input-wrap { grid-column: 1 / -1; }
  .balance { padding-inline: .1rem; }
  .usage-ring { width: 6.4rem; height: 6.4rem; }
  .usage-ring::before { width: 5.15rem; height: 5.15rem; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stats article:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .models-head { align-items: start; flex-direction: column; gap: .55rem; }
  .model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .connect { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.6rem; border-radius: 1.5rem; }
  footer { gap: .5rem; flex-direction: column; }
}

@media (max-width: 440px) {
  .hero { padding-top: 4rem; }
  .balance { align-items: flex-start; flex-direction: column; gap: 1.25rem; }
  .balance-copy strong { max-width: 100%; overflow-wrap: anywhere; font-size: 3rem; }
  .stats { grid-template-columns: 1fr; }
  .stats article + article, .stats article:nth-child(3) { grid-column: auto; border-top: 1px solid var(--line); border-left: 0; }
  .usage-head { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .model-grid { grid-template-columns: 1fr; }
  th, td { padding: .72rem .75rem; }
}

@media (max-width: 350px) {
  .nav-inner, main, footer { width: min(100% - 1rem, 1080px); }
  .lookup { padding: 1rem; }
  .key-row { grid-template-columns: 1fr; }
  .input-wrap { grid-column: auto; }
  .primary, .secondary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #dashboard { transform: none; transition: opacity 160ms ease; }
  .primary, .secondary, .input-wrap button, .brand { transition: none; }
}
@media (prefers-reduced-transparency: reduce) { .nav, .lookup { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; } }
@media (prefers-contrast: more) { .lookup, .stats, .table-wrap, .model, .endpoint > code, pre { border-color: var(--text); } }
