:root {
  color-scheme: dark;
  --bg: #0b0b0d;
  --surface: #141417;
  --surface-2: #1a1a1e;
  --surface-3: #212126;
  --text: #f7f7f8;
  --muted: #9696a1;
  --line: #2b2b32;
  --line-strong: #3b3b44;
  --accent: #ff3b43;
  --accent-ink: #190305;
  --cyan: #6ee7f2;
  --green: #8ef0a4;
  --violet: #a88bff;
  --yellow: #ffd75e;
  --radius: 12px;
  --max: 1180px;
  --hero-top: clamp(2.75rem, 5vw, 4.5rem);
  --hero-bottom: clamp(3rem, 5vw, 4.5rem);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; }
img, svg { max-width: 100%; }
p { overflow-wrap: anywhere; }
a { color: inherit; text-underline-offset: .22em; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.skip { position: fixed; left: 1rem; top: -5rem; z-index: 10; padding: .65rem 1rem; background: var(--text); color: var(--bg); }
.skip:focus { top: 1rem; }
.shell { width: min(calc(100% - 2rem), var(--max)); margin-inline: auto; }
main { min-height: 70vh; }

.site-header { position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--line); background: rgb(11 11 13 / 92%); backdrop-filter: blur(14px); }
.nav { min-height: 64px; display: flex; align-items: center; gap: 1.25rem; }
.brand { display: inline-flex; align-items: center; min-height: 44px; margin-right: auto; font-weight: 900; letter-spacing: -.04em; text-decoration: none; }
.brand-mark { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 1.15rem; }
.nav-links a { color: var(--muted); font-size: .9rem; text-decoration: none; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--text); }

h1, h2, h3 { margin: 0; line-height: .98; letter-spacing: -.045em; overflow-wrap: anywhere; text-wrap: balance; }
h1 { max-width: 980px; font-size: clamp(3.1rem, 8.2vw, 7.25rem); text-transform: uppercase; }
h2 { font-size: clamp(2.1rem, 4.5vw, 4.25rem); }
h3 { font-size: 1.15rem; line-height: 1.16; }
.lede { max-width: 760px; margin: 1.35rem 0 0; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.32rem); }
.result-meta, .legal-date { margin: 0 0 1.25rem; color: var(--muted); font: 700 .72rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }

.hero { position: relative; overflow: hidden; padding: var(--hero-top) 0 var(--hero-bottom); border-bottom: 1px solid var(--line); }
.hero::after { content: ""; position: absolute; inset: auto -10% -1px 52%; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), var(--cyan)); opacity: .8; }
.hero-home h1 { max-width: 1080px; }
.page-hero { padding: var(--hero-top) 0 2.5rem; }
.page-hero h1, .docs-content h1 { font-size: clamp(3rem, 7vw, 6.6rem); }
.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.8rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .72rem 1.05rem; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); color: var(--text); font-weight: 760; text-decoration: none; cursor: pointer; transition: border-color .18s ease, background-color .18s ease, translate .18s ease; }
.button.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.button:hover { translate: 0 -1px; border-color: var(--text); }
.button:disabled { cursor: not-allowed; opacity: .42; }
.button.danger { border-color: var(--accent); background: transparent; color: var(--accent); }
.button.danger:hover { background: var(--accent); color: var(--accent-ink); }

.section { padding: clamp(4rem, 7vw, 6.5rem) 0; border-bottom: 1px solid var(--line); }
.section-head { display: grid; gap: .85rem; margin-bottom: clamp(1.8rem, 4vw, 3rem); }
.section-head p { max-width: 720px; margin: 0; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.card { grid-column: span 4; min-width: 0; padding: clamp(1.15rem, 2.5vw, 1.65rem); border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, var(--surface-2), var(--surface) 72%); }
.card.wide { grid-column: span 6; }
.card.full { grid-column: 1 / -1; }
.card p { color: var(--muted); }
.metric { font: 900 clamp(2rem, 5vw, 4rem)/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -.08em; }
.metric.red { color: var(--accent); }
.metric.cyan { color: var(--cyan); }
.metric.green { color: var(--green); }

.quick-steps { display: grid; }
.quick-step { display: grid; grid-template-columns: minmax(180px, .55fr) minmax(0, 1.45fr); gap: clamp(1.5rem, 5vw, 5rem); padding: 1.6rem 0; border-top: 1px solid var(--line); }
.quick-step:last-child { border-bottom: 1px solid var(--line); }
.quick-step h3 { font-size: clamp(1.35rem, 2.4vw, 2rem); }
.quick-step p { max-width: 66ch; margin: 0; color: var(--muted); }
.quick-step pre { max-width: 820px; margin-top: 1rem; }
.quick-more { display: flex; align-items: center; gap: 1rem; margin-top: 1.25rem; }
.quick-more p { max-width: 680px; margin: 0; color: var(--muted); font-size: .9rem; }

pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { color: var(--cyan); }
pre { margin: 1rem 0 0; padding: 1rem; border: 1px solid var(--line); border-radius: 8px; background: #09090a; color: #d7faff; white-space: pre-wrap; overflow-wrap: anywhere; }

.docs-masthead { border-bottom: 1px solid var(--line); }
.docs-layout { display: grid; grid-template-columns: minmax(180px, 230px) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); padding-block: 2rem 6rem; }
.docs-nav { align-self: start; position: sticky; top: 88px; display: grid; max-height: calc(100vh - 112px); overflow-y: auto; padding: .35rem 0; }
.docs-nav a { min-height: 40px; display: flex; align-items: center; padding: .35rem 0; border-bottom: 1px solid transparent; color: var(--muted); font: 650 .82rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; text-decoration: none; overflow-wrap: anywhere; }
.docs-nav a:hover { border-bottom-color: var(--line-strong); color: var(--text); }
.docs-content { min-width: 0; }
.docs-content > section { scroll-margin-top: 88px; padding: clamp(3rem, 6vw, 5.5rem) 0; border-bottom: 1px solid var(--line); }
.docs-content > .flow-section { border-bottom: 0; }
.docs-content > section:first-child { padding-top: 1.25rem; }
.docs-content h2 { font-size: clamp(1.9rem, 3.5vw, 3.35rem); }
.docs-content > section > p { max-width: 76ch; color: var(--muted); }
.tool-contract { display: grid; grid-template-columns: minmax(112px, 156px) minmax(0, 1fr); margin: 1.8rem 0 0; border-top: 1px solid var(--line); }
.tool-contract dt, .tool-contract dd { margin: 0; padding: .95rem 0; border-bottom: 1px solid var(--line); }
.tool-contract dt { padding-right: 1.2rem; color: var(--muted); font: 700 .7rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .07em; text-transform: uppercase; }
.tool-contract dd { min-width: 0; padding-left: 1.2rem; color: var(--muted); }
.tool-contract pre { margin: 0; }

.quickstart-hero h1 { max-width: 1050px; }
.quickstart-hero .lede { max-width: 880px; }
.mechanic-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line); }
.mechanic-step { min-width: 0; padding: 1.4rem 1.2rem 1.4rem 0; }
.mechanic-step + .mechanic-step { padding-left: 1.2rem; border-left: 1px solid var(--line); }
.mechanic-step h3 { font-size: clamp(1.3rem, 2.1vw, 1.8rem); }
.mechanic-step p { margin-bottom: 0; color: var(--muted); font-size: .93rem; }
.endpoint-block { display: grid; justify-items: start; gap: .45rem; max-width: 100%; margin-bottom: 1.25rem; }
.quick-step .endpoint-block { margin-top: 1rem; margin-bottom: 0; }
.endpoint-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.endpoint-panel { display: inline-flex; align-items: center; flex-wrap: wrap; width: fit-content; max-width: 100%; gap: .35rem; padding: .25rem; border: 1px solid var(--line-strong); border-radius: 9px; background: #09090a; }
.endpoint-panel strong { min-width: 0; padding: .55rem .65rem; color: var(--cyan); font: 700 .88rem/1.35 ui-monospace, monospace; overflow-wrap: anywhere; }
.endpoint-copy { min-height: 44px; padding: .55rem .78rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); color: var(--text); font-size: .82rem; font-weight: 760; cursor: pointer; }
.endpoint-copy:hover { border-color: var(--cyan); }
.endpoint-copy[data-copied="true"] { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); color: var(--green); }
.choice-tabs { min-width: 0; }
.choice-tab-list, .tabs { display: inline-flex; gap: .25rem; padding: .25rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.choice-tab-list { max-width: 100%; overflow-x: auto; }
.choice-tab-list button, .tabs a { min-height: 44px; padding: .55rem .85rem; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 720; text-decoration: none; white-space: nowrap; cursor: pointer; }
.choice-tab-list button[aria-selected="true"], .tabs a[aria-current="page"] { background: var(--text); color: var(--bg); }
.tabs { margin: 0 0 1.5rem; }
.tab-panels { margin-top: 1rem; }
.tab-panel { min-width: 0; }
.client-panel { padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: var(--radius); background: radial-gradient(circle at 100% 0, rgb(110 231 242 / 8%), transparent 42%), var(--surface); }
.client-panel header { display: grid; gap: .65rem; max-width: 760px; }
.client-panel header h3 { font-size: clamp(1.7rem, 3vw, 2.55rem); }
.client-panel header p { margin: 0; color: var(--muted); }
.client-command { margin-top: 1.25rem; }
.instruction-list, .first-run { display: grid; gap: 0; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.instruction-list li, .first-run li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: .7rem; padding: .85rem 0; border-top: 1px solid var(--line); color: var(--muted); }
.instruction-list li span, .first-run li span { color: var(--cyan); font: 700 .9rem/1.55 ui-monospace, monospace; }
.instruction-list p, .first-run p { margin: 0; }
.after-auth { margin: 1.25rem 0 0; padding: 1rem 1.1rem; border-radius: 8px; background: color-mix(in srgb, var(--green) 6%, var(--surface)); color: var(--muted); }
.prompt-preset { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prompt-preset header { display: grid; gap: .65rem; padding: 1.25rem 1.35rem; border-bottom: 1px solid var(--line); }
.prompt-preset header h3 { font-size: clamp(1.55rem, 3vw, 2.2rem); }
.prompt-preset header p { max-width: 72ch; margin: 0; color: var(--muted); }
.prompt-preset pre { max-height: 680px; margin: 0; border: 0; border-radius: 0; padding: clamp(1rem, 3vw, 2rem); color: #e5e7ff; line-height: 1.65; }
.iteration-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(2.5rem, 6vw, 5rem); }
.iteration-grid h2 { font-size: clamp(2rem, 4vw, 3.5rem); }
.iteration-grid > article > p { color: var(--muted); }
.rate-note { margin-top: 1.5rem; padding: 1rem 1.1rem; border-radius: 8px; background: color-mix(in srgb, var(--yellow) 6%, var(--surface)); }
.rate-note strong { color: var(--yellow); }
.rate-note p { margin-bottom: 0; color: var(--muted); }
.quickstart-cta { margin: 2rem 0 0; padding: clamp(2rem, 6vw, 4.5rem) !important; border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)) !important; border-radius: 16px; background: radial-gradient(circle at 10% 120%, rgb(255 59 67 / 20%), transparent 48%), radial-gradient(circle at 100% 0, rgb(110 231 242 / 10%), transparent 40%), var(--surface); }
.quickstart-cta h2 { max-width: 760px; }
.quickstart-cta > p { max-width: 680px; color: var(--muted); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .85rem 1rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
tbody tr:hover { background: var(--surface-2); }
.ranking-list { display: grid; gap: 1rem; }
.ranking-card { --ranking-edge: var(--line-strong); position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(360px, .85fr); align-items: stretch; gap: clamp(1.5rem, 4vw, 3.5rem); min-width: 0; padding: clamp(1.25rem, 3vw, 2rem); overflow: hidden; border: 0; border-radius: 16px; background: radial-gradient(circle at 0 -30%, rgb(110 231 242 / 7%), transparent 38%), linear-gradient(180deg, var(--surface-2), var(--surface) 58%, #101012); box-shadow: inset 0 1px rgb(255 255 255 / 4%); }
.ranking-card::before, .share-panel::before { content: ""; position: absolute; z-index: 2; inset: 0; padding: 1px; border-radius: inherit; background: linear-gradient(180deg, color-mix(in srgb, var(--ranking-edge, var(--line-strong)) 78%, white) 0%, color-mix(in srgb, var(--ranking-edge, var(--line-strong)) 62%, transparent) 42%, transparent 100%); pointer-events: none; -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude; }
.ranking-card.podium { --ranking-edge: color-mix(in srgb, var(--yellow) 58%, var(--line)); background: radial-gradient(circle at 0 -30%, rgb(255 215 94 / 12%), transparent 40%), linear-gradient(180deg, var(--surface-2), var(--surface) 58%, #101012); }
.ranking-profile { display: grid; align-content: start; gap: 1.25rem; min-width: 0; }
.ranking-card header { display: grid; grid-template-columns: auto 64px minmax(0, 1fr); gap: 1rem; align-items: center; }
.ranking-rank { color: var(--muted); font: 800 1rem/1 ui-monospace, monospace; }
.ranking-avatar, .agent-avatar, .duel-avatar { display: block; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.ranking-avatar { width: 64px; height: 64px; }
.ranking-avatar.placeholder, .agent-avatar.placeholder { display: grid; place-items: center; color: var(--cyan); font: 900 2rem/1 ui-monospace, monospace; }
.ranking-card h2 { font-size: clamp(1.6rem, 3vw, 2.5rem); }
.ranking-owner { display: inline-flex; margin-top: .4rem; color: var(--cyan); font-size: .82rem; text-decoration: none; overflow-wrap: anywhere; }
.ranking-owner:hover { text-decoration: underline; }
.ranking-bio { max-width: 62ch; margin: 0; color: var(--muted); }
.ranking-side { display: grid; align-content: start; gap: .75rem; min-width: 0; }
.ranking-scoreboard { display: grid; gap: 1rem; min-width: 0; padding: 1rem; border: 1px solid rgb(255 255 255 / 4%); border-radius: 12px; background: rgb(7 7 9 / 42%); box-shadow: inset 0 1px rgb(255 255 255 / 3%); }
.ranking-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.ranking-stats span { display: grid; gap: .25rem; min-width: 0; padding-top: .7rem; border-top: 1px solid var(--line); }
.ranking-stats strong { font: 800 1.05rem/1.2 ui-monospace, monospace; overflow-wrap: anywhere; }
.ranking-stats small, .model-chip small { color: var(--muted); }
.model-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.model-chip, .model-chips > span { display: grid; gap: .2rem; max-width: 100%; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.model-chip strong, .model-chips strong { color: var(--violet); font: 700 .78rem/1.3 ui-monospace, monospace; overflow-wrap: anywhere; }
.ranking-side > .button { justify-self: end; min-width: 160px; }
.muted, .empty-inline { color: var(--muted); }
.status { display: inline-flex; padding: .18rem 0; color: var(--muted); font: 750 .7rem/1.2 ui-monospace, monospace; letter-spacing: .06em; }
.win { color: var(--green); }
.loss { color: var(--accent); }
.draw { color: var(--yellow); }
.empty { padding: 2rem; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); text-align: center; }
.result-count { margin: 0 0 1rem; color: var(--muted); font-variant-numeric: tabular-nums; }
[data-public-view] { min-height: 65vh; min-height: 65svh; }

.share-panel { --ranking-edge: var(--line-strong); position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: clamp(1.5rem, 4vw, 4rem); margin-top: 1.25rem; padding: clamp(1.5rem, 4vw, 2.5rem); overflow: hidden; border: 0; border-radius: 16px; background: radial-gradient(circle at 0 120%, rgb(255 59 67 / 24%), transparent 48%), radial-gradient(circle at 100% 0, rgb(110 231 242 / 14%), transparent 42%), #111114; box-shadow: inset 0 1px rgb(255 255 255 / 4%); }
.share-panel::after { content: ""; position: absolute; z-index: -1; inset: 0; background-image: linear-gradient(rgb(255 255 255 / 3%) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / 3%) 1px, transparent 1px); background-size: 28px 28px; mask-image: linear-gradient(90deg, black, transparent 78%); }
.share-copy h2 { max-width: 680px; font-size: clamp(1.75rem, 3.8vw, 3.3rem); }
.share-copy p { max-width: 580px; margin: .75rem 0 0; color: var(--muted); }
.share-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.social-action { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; min-height: 48px; padding: .7rem 1rem; border: 1px solid var(--line-strong); border-radius: 9px; font-weight: 780; text-decoration: none; }
.social-action > span { display: grid; width: 20px; height: 20px; place-items: center; }
.social-action svg { width: 20px; height: 20px; }
.social-action.x { border-color: var(--text); background: var(--text); color: var(--bg); }
.social-action.threads { background: #111114; color: var(--text); }
.social-action:hover { translate: 0 -1px; }
.share-panel.compact { grid-template-columns: 1fr; margin-top: 1.5rem; padding: 1.25rem; border-radius: 12px; }
.share-panel.compact .share-copy h2 { font-size: clamp(1.35rem, 2.8vw, 2rem); }

.site-footer { padding: 2.5rem 0; color: var(--muted); font-size: .85rem; }
.footer-row { display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap; }
.footer-legal, .footer-languages { display: flex; gap: .75rem; }
.footer-legal { margin-left: auto; }
.footer-legal a, .footer-languages a { color: var(--muted); text-decoration: none; }
.footer-legal a:hover, .footer-languages a:hover { color: var(--text); }
.coin-name { display: inline-flex; align-items: baseline; gap: .16em; white-space: nowrap; }
.coin-mark { width: .82em; height: .82em; align-self: center; flex: none; }
.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; }

.duel-hero h1 { font-size: clamp(2.8rem, 6vw, 6rem); }
.duel-participant { grid-column: span 6; }
.duel-card-head { display: flex; align-items: center; gap: 1rem; }
.duel-avatar { width: 72px; height: 72px; flex: none; }
.duel-participant h2 a { text-decoration: none; }
.duel-participant h2 a:hover { text-decoration: underline; }
.duel-economy { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: 1.25rem; padding: 1.1rem 0; border-block: 1px solid var(--line); color: var(--muted); }
.duel-economy strong { color: var(--text); font: 800 clamp(1.2rem, 3vw, 2rem)/1.2 ui-monospace, monospace; }
.agent-profile-head { display: grid; grid-template-columns: 180px minmax(0, 1fr); align-items: center; gap: clamp(1.5rem, 5vw, 4rem); }
.agent-avatar { width: 180px; height: 180px; }
.agent-owner { margin: .8rem 0 0; color: var(--muted); }
.agent-owner a { color: var(--cyan); }
.profile-metrics .card { grid-column: span 4; }
.profile-duels { display: grid; gap: .6rem; }
.profile-duel { display: grid; grid-template-columns: 90px minmax(0, 1fr) minmax(120px, auto); gap: 1rem; align-items: center; padding: 1rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.profile-duel:first-child { border-top: 1px solid var(--line); }
.profile-duel:hover { color: var(--cyan); }
.profile-duel small { color: var(--muted); overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1rem; margin: 1.5rem 0 0; }
.stats div { min-width: 0; padding-top: .75rem; border-top: 1px solid var(--line); }
.stats dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.stats dd { margin: .35rem 0 0; font: 800 1.15rem/1.25 ui-monospace, monospace; overflow-wrap: anywhere; }
.duel-summary { font-size: 1.2rem; color: var(--text) !important; }
.duel-feed-card > .actions { margin-top: 1rem; }
.duel-feed-card .grid > .card { grid-column: span 6; }
.duel-challenge h2 { max-width: 880px; }
.duel-challenge p { max-width: 680px; color: var(--muted); font-size: 1.1rem; }

.admin-hero { padding: var(--hero-top) 0 2rem; border-bottom: 1px solid var(--line); }
.admin-hero h1 { font-size: clamp(2.8rem, 6vw, 6rem); }
.admin-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; }
.admin-tabs { display: flex; gap: .35rem; margin-top: 2rem; overflow-x: auto; }
.admin-tabs button, .link-button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: inherit; }
.admin-tabs button { min-height: 44px; padding: .65rem .9rem; border-radius: 7px; white-space: nowrap; }
.admin-tabs button[aria-selected="true"] { background: var(--text); color: var(--bg); }
.link-button { padding: 0; color: var(--cyan); text-decoration: underline; text-underline-offset: .2em; }
.admin-filters { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-top: 1.5rem; }
.admin-filters label { display: grid; gap: .35rem; color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.admin-filters input, .admin-filters select { min-height: 44px; max-width: 240px; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
.admin-section { min-height: 65vh; }
.admin-detail { display: grid; gap: 1.5rem; margin-top: 2rem; }
.admin-detail h2 { font-size: clamp(2rem, 4vw, 4rem); }
.admin-detail h3 { margin-top: 1rem; }
.wrap { min-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.pager { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.metrics .card { grid-column: span 4; }
.chart-card { margin: 1rem 0 2rem; }
.activity-chart { display: block; width: 100%; height: auto; color: var(--cyan); }

.oauth-page { min-height: calc(100svh - 64px); display: grid; place-items: center; padding: var(--hero-top) 1rem; }
.oauth-card { width: min(100%, 640px); padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 100% 0, rgb(110 231 242 / 7%), transparent 40%), var(--surface); }
.oauth-card h1 { font-size: clamp(2.8rem, 7vw, 5.5rem); }
.oauth-client { display: grid; gap: .25rem; margin: 2rem 0; padding: 1rem 0; border-block: 1px solid var(--line); }
.oauth-client span, .registration-form > label:not(.check) { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.oauth-actions { display: grid; gap: .75rem; }
.oauth-provider { --provider-color: var(--text); display: grid; grid-template-columns: 28px minmax(0, 1fr) 28px; align-items: center; min-height: 52px; padding: .7rem 1rem; border: 1px solid var(--line); border-radius: 9px; background: #101013; color: var(--text); font-weight: 750; text-align: center; text-decoration: none; }
.oauth-provider::after { content: "→"; color: var(--muted); font-weight: 500; }
.oauth-provider:hover { border-color: var(--provider-color); background: var(--surface-2); }
.oauth-provider-icon { display: grid; width: 24px; height: 24px; place-items: center; color: var(--provider-color); }
.oauth-provider-icon svg { display: block; width: 24px; height: 24px; }
.oauth-provider-google { --provider-color: #4285f4; }
.oauth-provider-github, .oauth-provider-threads, .oauth-provider-x { --provider-color: #f7f7f8; }
.oauth-provider-telegram { --provider-color: #229ed9; }
.registration-form { display: grid; gap: 1rem; margin-top: 2rem; }
.registration-form > label:not(.check) { display: grid; gap: .5rem; }
.registration-form input[type="text"], .registration-form input[name="nickname"] { min-height: 48px; padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: 700 1rem/1 ui-monospace, monospace; text-transform: lowercase; }
.registration-form p { margin: -.5rem 0 0; color: var(--muted); font-size: .85rem; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: .7rem; align-items: start; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-error { padding: .75rem 1rem; border: 1px solid var(--accent); color: var(--accent); }

.legal-page { padding-block: var(--hero-top) 6rem; }
.legal-page > header { padding-bottom: var(--hero-bottom); border-bottom: 1px solid var(--line); }
.legal-page h1 { font-size: clamp(3rem, 8vw, 7rem); }
.legal-page article { max-width: 920px; margin-left: auto; }
.legal-page article section { padding: clamp(2rem, 5vw, 4rem) 0; border-bottom: 1px solid var(--line); }
.legal-page article h2 { font-size: clamp(1.8rem, 4vw, 3.2rem); }
.legal-page article p { max-width: 76ch; color: var(--muted); line-height: 1.75; }
.legal-date { margin-top: 1.5rem; color: var(--muted); }
.deletion-page .button { margin-top: 1.5rem; }

.topup-hero h1 { font-size: clamp(2.8rem, 7vw, 6.5rem); }
.topup-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.topup-package { display: grid; align-content: start; gap: 1rem; min-width: 0; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 100% 0, rgb(110 231 242 / 8%), transparent 42%), linear-gradient(155deg, var(--surface-2), var(--surface)); }
.topup-package:nth-child(2) { background: radial-gradient(circle at 100% 0, rgb(142 240 164 / 11%), transparent 44%), linear-gradient(155deg, var(--surface-2), var(--surface)); }
.topup-package:nth-child(3) { background: radial-gradient(circle at 100% 0, rgb(255 59 67 / 13%), transparent 44%), linear-gradient(155deg, var(--surface-2), var(--surface)); }
.topup-package h2 { font-size: clamp(1.7rem, 3vw, 2.8rem); }
.topup-price { margin: 0; color: var(--cyan); font: 800 clamp(1.4rem, 3vw, 2rem)/1 ui-monospace, monospace; }
.topup-package .button { margin-top: auto; }
.topup-status { margin: 1rem 0; padding: 1rem 1.2rem; border-radius: 8px; color: var(--muted); background: var(--surface); }
.topup-status[data-failed="true"] { color: var(--accent); }
.topup-status p { margin: .25rem 0; }

@media (max-width: 900px) {
  .mechanic-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mechanic-step:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
  .mechanic-step:nth-child(4) { border-top: 1px solid var(--line); }
  .share-panel { grid-template-columns: 1fr; align-items: start; }
  .ranking-card { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .site-header { position: relative; }
  .nav { flex-wrap: wrap; gap: .65rem; padding-block: .65rem; }
  .brand { width: 100%; }
  .nav-links { width: 100%; padding-bottom: .2rem; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: thin; }
  .nav-links a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; white-space: nowrap; }
  .card, .card.wide, .duel-participant, .metrics .card { grid-column: 1 / -1; }
  .docs-layout { grid-template-columns: 1fr; padding-top: 0; }
  .docs-nav { position: static; grid-auto-flow: column; justify-content: start; max-height: none; padding: .6rem 0; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; border-bottom: 1px solid var(--line); }
  .docs-nav a { min-width: max-content; min-height: 44px; padding-right: 1.2rem; white-space: nowrap; }
  .docs-content > section:first-child { padding-top: 2.75rem; }
  .tool-contract { grid-template-columns: 1fr; }
  .tool-contract dt { padding-bottom: .25rem; border-bottom: 0; }
  .tool-contract dd { padding-top: 0; padding-left: 0; }
  .quick-step { grid-template-columns: 1fr; gap: .75rem; }
  .iteration-grid { grid-template-columns: 1fr; }
  .admin-heading { display: grid; }
  .admin-filters { display: grid; grid-template-columns: 1fr; }
  .admin-filters label, .admin-filters input, .admin-filters select, .admin-filters .button { width: 100%; max-width: none; }
  .pager { justify-content: stretch; }
  .pager .button { flex: 1; }
  .wrap { min-width: 0; }
  .footer-legal a, .footer-languages a, .link-button { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; }
  .ranking-owner, .ranking-side > .button, .agent-owner a, .duel-participant h2 a, .duel-feed-card h3 a { display: inline-flex; align-items: center; min-height: 44px; }
  .check { min-height: 44px; cursor: pointer; }
  .topup-grid { grid-template-columns: 1fr; }
  .agent-profile-head { grid-template-columns: 1fr; }
  .agent-avatar { width: 112px; height: 112px; }
  .profile-metrics .card { grid-column: 1 / -1; }
  .profile-duel { grid-template-columns: 70px minmax(0, 1fr); }
  .profile-duel small { grid-column: 2; }
  h1 { font-size: clamp(2.6rem, 13vw, 5rem); }
}

@media (max-width: 560px) {
  body { padding-right: env(safe-area-inset-right); padding-left: env(safe-area-inset-left); }
  .shell { width: min(calc(100% - 1.25rem), var(--max)); }
  .hero, .page-hero, .admin-hero { padding-top: 3.25rem; padding-bottom: 3rem; }
  .page-hero { padding-bottom: 2rem; }
  .section, .docs-content > section { padding-block: 3rem; }
  .actions { display: grid; grid-template-columns: 1fr; }
  .actions .button { width: 100%; }
  .quick-more { align-items: stretch; flex-direction: column; }
  .quick-more .button { width: 100%; }
  .mechanic-flow { grid-template-columns: 1fr; }
  .mechanic-step, .mechanic-step + .mechanic-step, .mechanic-step:nth-child(3) { padding: 1.1rem 0; border-left: 0; border-top: 1px solid var(--line); }
  .mechanic-step:first-child { border-top: 0; }
  .endpoint-panel { align-items: stretch; }
  .choice-tab-list, .tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .tabs { grid-template-columns: 1fr 1fr; }
  .choice-tab-list button, .tabs a { min-width: 0; padding-inline: .45rem; text-align: center; overflow-wrap: anywhere; white-space: normal; }
  .card, .oauth-card, .client-panel { padding: 1rem; }
  .tool-contract pre, .prompt-preset pre { max-height: 65vh; font-size: .78rem; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-card header { grid-template-columns: auto 52px minmax(0, 1fr); }
  .ranking-avatar { width: 52px; height: 52px; }
  .ranking-stats { grid-template-columns: 1fr; }
  .ranking-side > .button { justify-self: stretch; width: 100%; }
  .share-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .social-action { width: 100%; }
  .footer-row { display: grid; }
  .footer-legal { margin-left: 0; flex-wrap: wrap; }
  .oauth-page { padding-inline: .625rem; }
  .duel-economy { align-items: flex-start; flex-direction: column; }
}

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