:root {
  --bg: #f4f7ff;
  --surface: #ffffff;
  --ink: #101a37;
  --muted: #69738b;
  --border: #e2e8f5;
  --accent: #4f75ef;
  --accent-dark: #3357cd;
  --accent-pale: #edf2ff;
  --purple: #7757d9;
  --green: #1bbf76;
  --yellow: #e49a19;
  --red: #e14d5a;
  --code: #101a37;
  --radius: 18px;
  --shadow: 0 18px 44px rgba(45, 69, 135, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: Outfit, Arial, sans-serif; }
button { font: inherit; }
code, pre { font-family: "IBM Plex Mono", Consolas, monospace; }

.topbar { height: 64px; background: rgba(255,255,255,.93); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 max(20px, calc((100% - 900px) / 2)); position: sticky; top: 0; z-index: 20; }
.brand { color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 9px; font-size: 19px; font-weight: 800; letter-spacing: -.6px; }
.brand-logo { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; box-shadow: 0 3px 12px rgba(68, 104, 222, .22); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.live-badge { font: 600 11px "IBM Plex Mono", monospace; display: inline-flex; align-items: center; gap: 7px; color: var(--accent-dark); background: var(--accent-pale); padding: 6px 10px; border-radius: 999px; }
.live-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(27,191,118,.15); }
.menu-button { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid #dce4f5; border-radius: 12px; color: var(--accent-dark); background: linear-gradient(145deg, #ffffff, #f0f4ff); box-shadow: 0 5px 14px rgba(48, 77, 155, .10); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.menu-button:hover { border-color: #b9c9f5; box-shadow: 0 8px 18px rgba(48, 77, 155, .16); transform: translateY(-1px); }
.menu-button:active { transform: translateY(0) scale(.96); }
.menu-button:focus-visible { outline: 3px solid rgba(79,117,239,.25); outline-offset: 2px; }
.menu-icon { width: 18px; height: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.menu-icon i { display: block; width: 18px; height: 2px; border-radius: 999px; background: currentColor; transform-origin: center; transition: transform .22s ease, opacity .18s ease; }
.menu-button[aria-expanded="true"] { color: #fff; border-color: var(--accent); background: linear-gradient(135deg, var(--accent), var(--purple)); box-shadow: 0 8px 20px rgba(79,117,239,.3); }
.menu-button[aria-expanded="true"] .menu-icon i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-button[aria-expanded="true"] .menu-icon i:nth-child(2) { opacity: 0; transform: scaleX(.2); }
.menu-button[aria-expanded="true"] .menu-icon i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.tabs-wrap { position: sticky; top: 64px; z-index: 15; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs-wrap::-webkit-scrollbar { display: none; }
.tabs { max-width: 900px; padding: 0 20px; margin: auto; display: flex; gap: 3px; min-width: max-content; }
.tab { position: relative; padding: 15px 15px 13px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: transparent; cursor: pointer; font-size: 13px; font-weight: 700; transition: color .18s, border-color .18s; }
.tab:hover, .tab.active { color: var(--accent-dark); }
.tab.active { border-bottom-color: var(--accent); }

main { max-width: 900px; margin: 0 auto; padding: 28px 20px 52px; }
.page { animation: fade-in .22s ease-out; }
.page[hidden] { display: none; }
@keyframes fade-in { from { opacity: .25; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

.hero-card { min-height: 260px; overflow: hidden; border-radius: 22px; padding: 32px 34px; color: #fff; position: relative; background: linear-gradient(128deg, #4f75ef 0%, #6076ed 52%, #8664d8 100%); box-shadow: 0 22px 42px rgba(87, 102, 218, .25); }
.hero-card::before { content: ""; position: absolute; width: 280px; height: 280px; border: 44px solid rgba(255,255,255,.07); border-radius: 50%; right: -100px; top: -136px; }
.hero-card::after { content: ""; position: absolute; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.06); right: 72px; bottom: -100px; }
.hero-logo { position: absolute; z-index: 1; right: 34px; bottom: 28px; width: 84px; height: 84px; object-fit: cover; border-radius: 23px; box-shadow: 0 18px 26px rgba(18,25,75,.27); transform: rotate(-5deg); }
.hero-tag { position: relative; z-index: 1; display: inline-block; padding: 6px 10px; margin-bottom: 17px; border-radius: 999px; background: rgba(255,255,255,.15); font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .09em; }
.hero-card h1 { position: relative; z-index: 1; margin: 0 0 10px; max-width: 550px; font-size: clamp(30px, 5vw, 40px); line-height: 1; letter-spacing: -1.4px; }
.hero-card p { position: relative; z-index: 1; margin: 0; max-width: 570px; font-size: 15px; line-height: 1.65; color: rgba(255,255,255,.88); }

.base-url { padding: 12px 14px 12px 16px; margin: 16px 0; display: flex; align-items: center; gap: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: 0 5px 20px rgba(31, 54, 121, .025); }
.base-url-label, .eyebrow { flex: 0 0 auto; color: var(--muted); font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .11em; text-transform: uppercase; }
.base-url-value { flex: 1; color: var(--accent-dark); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-copy { border: 0; background: var(--accent-pale); border-radius: 8px; padding: 7px 10px; color: var(--accent-dark); cursor: pointer; font: 600 11px "IBM Plex Mono", monospace; transition: .18s; }
.icon-copy:hover, .copy-btn:hover { filter: brightness(1.1); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.pill { border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; background: var(--surface); color: var(--muted); font: 600 11px "IBM Plex Mono", monospace; }
.section-title { margin: 27px 0 10px; color: var(--muted); font: 700 11px "IBM Plex Mono", monospace; letter-spacing: .1em; text-transform: uppercase; }
.card, .endpoint-card { background: var(--surface); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 7px 24px rgba(31, 54, 121, .03); margin-bottom: 12px; }
.card-header { display: flex; align-items: center; gap: 11px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.step-mark { width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 8px; color: var(--accent-dark); background: var(--accent-pale); font: 700 10px "IBM Plex Mono", monospace; }
.card-title { margin: 0; font-size: 15px; }
.card-body { padding: 15px 17px; }
.card-desc { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.card-desc code, .flow-list code, .endpoint-card > p code, .notice code { color: var(--accent-dark); font-size: .9em; font-weight: 600; }

.flow-list { padding: 5px 0 0; }
.flow-item { position: relative; padding: 0 0 20px 48px; min-height: 52px; }
.flow-item:last-child { padding-bottom: 0; }
.flow-item:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 34px; bottom: 0; width: 2px; background: linear-gradient(var(--accent), rgba(123,95,215,.18)); }
.flow-num { position: absolute; top: 0; left: 0; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--accent), var(--purple)); box-shadow: 0 6px 15px rgba(80,117,239,.22); font: 600 11px "IBM Plex Mono", monospace; }
.flow-item > div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; }
.flow-item strong { font-size: 14px; }
.flow-item p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.page-heading { margin: 2px 0 22px; }
.page-heading h1 { margin: 8px 0 7px; font-size: clamp(28px, 5vw, 36px); letter-spacing: -1px; }
.page-heading p { max-width: 640px; color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0; }
.notice { margin: 0 0 18px; padding: 13px 15px; color: #8b5f10; background: #fff6da; border-left: 3px solid #eeb432; border-radius: 0 10px 10px 0; font-size: 13px; line-height: 1.6; }

.method { display: inline-flex; flex: 0 0 auto; align-items: center; height: 24px; padding: 0 8px; border-radius: 7px; font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .05em; }
.method.post { color: #6f47bd; background: #f0eafe; }
.method.get { color: #188d58; background: #e0f8ed; }
.endpoint-card { padding: 20px; }
.endpoint-title { display: flex; align-items: center; gap: 10px; }
.endpoint-title code { font-size: 18px; font-weight: 600; }
.endpoint-card > p { color: var(--muted); line-height: 1.6; font-size: 14px; }

.code-wrap { overflow: hidden; margin: 0 0 16px; border-radius: 13px; background: var(--code); box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
.code-top { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px 9px 14px; color: rgba(255,255,255,.42); border-bottom: 1px solid rgba(255,255,255,.08); font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .11em; }
.copy-btn { border: 1px solid rgba(255,255,255,.12); border-radius: 6px; background: rgba(255,255,255,.08); padding: 4px 8px; color: rgba(255,255,255,.7); cursor: pointer; font: 600 10px "IBM Plex Mono", monospace; transition: .18s; }
pre { margin: 0; padding: 16px; overflow-x: auto; color: #b9c9e7; font-size: 12px; line-height: 1.7; white-space: pre; }
.large-code pre { max-height: 680px; }
.key { color: #86b3ff; }
.string { color: #b9dfaf; }
.number { color: #f3c373; }

.param-list { overflow: hidden; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; }
.param-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: start; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--border); }
.param-row:last-child { border-bottom: 0; }
.param-row code { color: var(--accent-dark); font-size: 13px; font-weight: 600; }
.param-row p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.type, .required, .optional { margin-top: 1px; padding: 3px 6px; border-radius: 5px; font: 600 10px "IBM Plex Mono", monospace; white-space: nowrap; }
.type { color: #6f47bd; background: #f0eafe; }
.required { color: #188d58; background: #e0f8ed; }
.optional { color: var(--muted); background: #f0f3f8; }

.status-list { display: grid; gap: 9px; }
.status-item { display: flex; align-items: center; gap: 13px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.status-dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; }
.status-dot.success { background: var(--green); }.status-dot.warning { background: var(--yellow); }.status-dot.danger { background: var(--red); }.status-dot.purple { background: var(--purple); }
.status-item code { min-width: 30px; font-size: 13px; font-weight: 600; }.status-item strong { font-size: 14px; }.status-item p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

footer { display: flex; justify-content: space-between; gap: 16px; max-width: 900px; margin: 0 auto; padding: 18px 20px 30px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
footer span:first-child { font-family: "IBM Plex Mono", monospace; }
.toast { position: fixed; z-index: 30; bottom: 22px; left: 50%; padding: 10px 14px; border-radius: 9px; color: #fff; background: var(--ink); box-shadow: 0 12px 30px rgba(13,25,57,.2); transform: translate(-50%, 90px); opacity: 0; transition: .25s ease; font-size: 13px; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@media (max-width: 620px) {
  .topbar { height: 57px; padding: 0 16px; }.tabs-wrap { top: 57px; }.brand { font-size: 18px; }.live-badge { display: none; }.menu-button { display: inline-flex; }
  .tabs-wrap { max-height: 0; overflow: hidden; transition: max-height .25s ease; }.tabs-wrap.open { max-height: 320px; overflow-y: auto; }.tabs { min-width: 0; flex-direction: column; gap: 0; padding: 5px 16px; }.tab { text-align: left; padding: 10px 5px; border-bottom: 0; border-left: 2px solid transparent; }.tab.active { border-left-color: var(--accent); }
  main { padding: 18px 14px 40px; }.hero-card { min-height: 235px; padding: 25px 23px; }.hero-card p { padding-right: 3px; font-size: 14px; }.hero-logo { width: 62px; height: 62px; right: 22px; bottom: 22px; border-radius: 18px; }.hero-card h1 { font-size: 32px; }
  .base-url { gap: 8px; padding-left: 12px; }.base-url-label { display: none; }.base-url-value { font-size: 11px; }.icon-copy { font-size: 10px; }
  .endpoint-card { padding: 15px; }.param-row { grid-template-columns: 1fr auto; }.param-row .optional, .param-row .required { grid-column: 2; }.status-item { gap: 10px; padding: 12px; }
  footer { display: block; padding: 16px 15px 26px; }footer span { display: block; margin-bottom: 5px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Subgram balance endpoint */
.subgram-intro { display: flex; align-items: center; gap: 14px; padding: 16px 18px; margin: 0 0 18px; border: 1px solid #dce6ff; border-radius: 15px; background: linear-gradient(110deg, #edf3ff, #f8faff); }
.provider-icon { flex: 0 0 40px; width: 40px; height: 40px; padding: 3px; overflow: hidden; border: 1px solid rgba(79,117,239,.22); border-radius: 12px; background: linear-gradient(135deg, #dce8ff, #bbd0ff); box-shadow: 0 8px 18px rgba(70,115,244,.22); }
.provider-logo { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.subgram-intro strong { color: var(--accent-dark); font: 700 14px "IBM Plex Mono", monospace; }
.subgram-intro p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.subgram-intro code { color: var(--accent-dark); font-size: .9em; font-weight: 600; }
.endpoint-url { margin-left: auto; padding: 5px 8px; color: var(--accent-dark); border: 1px solid #dbe5ff; border-radius: 7px; background: #f4f7ff; font: 600 10px "IBM Plex Mono", monospace; white-space: nowrap; }
.no-params { display: flex; align-items: flex-start; gap: 11px; padding: 14px 15px; border: 1px solid #cfeedd; border-radius: 12px; background: #f1fcf6; margin-bottom: 16px; }
.no-params > span { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-size: 12px; font-weight: 800; }
.no-params strong { display: block; color: #177c4e; font-size: 13px; }
.no-params p { margin: 3px 0 0; color: #4a7d65; font-size: 12px; line-height: 1.5; }
.no-params code { color: #177c4e; font-size: .95em; font-weight: 600; }
.response-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.response-card { min-height: 122px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.response-card.success { border-color: #cfeedd; background: linear-gradient(135deg, #f1fcf6, #fff); }
.response-card.error { border-color: #f6d7da; background: linear-gradient(135deg, #fff5f5, #fff); }
.response-status { display: block; margin-bottom: 11px; font: 600 10px "IBM Plex Mono", monospace; letter-spacing: .04em; }
.response-card.success .response-status, .response-card.success strong { color: #177c4e; }
.response-card.error .response-status, .response-card.error strong { color: #b4404d; }
.response-card strong { font-size: 14px; }
.response-card p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.response-card code { color: inherit; font-size: .92em; font-weight: 600; }

@media (max-width: 620px) {
  .subgram-intro { padding: 13px; }.endpoint-title { flex-wrap: wrap; }.endpoint-url { width: 100%; margin-left: 0; overflow: hidden; text-overflow: ellipsis; }.response-grid { grid-template-columns: 1fr; }
}


/* Language switcher */
.language-button { height: 36px; display: inline-flex; align-items: center; gap: 5px; padding: 0 9px; border: 1px solid #dce4f5; border-radius: 11px; color: var(--accent-dark); background: linear-gradient(145deg, #ffffff, #f0f4ff); box-shadow: 0 5px 14px rgba(48, 77, 155, .09); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.language-button:hover { border-color: #b9c9f5; box-shadow: 0 8px 18px rgba(48, 77, 155, .15); transform: translateY(-1px); }
.language-button:active { transform: translateY(0) scale(.96); }
.language-button:focus-visible { outline: 3px solid rgba(79,117,239,.25); outline-offset: 2px; }
.language-flag { font-size: 17px; line-height: 1; filter: saturate(1.08); }
.language-code { color: var(--accent-dark); font: 700 10px "IBM Plex Mono", monospace; letter-spacing: .05em; }

@media (max-width: 620px) {
  .language-button { width: 40px; height: 40px; justify-content: center; padding: 0; border-radius: 12px; }
  .language-flag { font-size: 19px; }
  .language-code { display: none; }
}
