:root {
  --font-sans: 'Geist', 'Inter', system-ui, sans-serif;
  --font-serif: 'Instrument Serif', 'Source Serif 4', Georgia, serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;
}
:root,
[data-theme='dark'] {
  color-scheme: dark;
  --bg-app: #0a0a0b;
  --bg-panel: #131315;
  --bg-card: #1c1c1f;
  --bg-card-hover: #232327;
  --bg-input: #17171a;
  --bg-active: #26262a;
  --bg-hover: #2f2f34;
  --bg-pop: #1a1a1d;
  --bg-code: #0f0f11;
  --bg-code-inline: #1f1f23;
  --bg-avatar: #2a2a2e;
  --border: #26262b;
  --border-strong: #34343a;
  --border-focus: #4a4a52;
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #6b6b73;
  --btn-bg: #f4f4f5;
  --btn-text: #0a0a0b;
  --scroll: #2c2c31;
  --scrim: rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 20px 60px rgba(0, 0, 0, 0.6);
  --px-rgb: 255, 255, 255;
  --eff-0: #4ade80;
  --eff-1: #38bdf8;
  --eff-2: #fbbf24;
  --eff-3: #c084fc;
  --eff: var(--eff-3);
}
[data-theme='light'] {
  color-scheme: light;
  --bg-app: #e9e9ec;
  --bg-panel: #ffffff;
  --bg-card: #f0f0f2;
  --bg-card-hover: #e7e7ea;
  --bg-input: #ffffff;
  --bg-active: #ececef;
  --bg-hover: #e2e2e6;
  --bg-pop: #ffffff;
  --bg-code: #f6f6f8;
  --bg-code-inline: #efeff2;
  --bg-avatar: #e4e4e8;
  --border: #ececf0;
  --border-strong: #dcdce2;
  --border-focus: #b8b8c2;
  --text-primary: #0a0a0b;
  --text-secondary: #52525b;
  --text-muted: #9a9aa3;
  --btn-bg: #0a0a0b;
  --btn-text: #ffffff;
  --scroll: #d4d4da;
  --scrim: rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 20px 60px rgba(0, 0, 0, 0.18);
  --px-rgb: 0, 0, 0;
  --eff-0: #16a34a;
  --eff-1: #0284c7;
  --eff-2: #d97706;
  --eff-3: #9333ea;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }
body {
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  height: 100%;
  height: 100dvh;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  display: flex;
  gap: 8px;
  overflow: hidden;
  overscroll-behavior: none;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 999px; }

.ic { display: inline-grid; place-items: center; }
.ic svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ───────── Sidebar ───────── */
.sidebar { width: 270px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; padding: 10px 8px 10px 6px; transition: width 0.25s ease; overflow: hidden; }
.side-top { height: 44px; display: flex; align-items: center; gap: 6px; }
.brand { display: flex; align-items: center; gap: 9px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; padding-left: 4px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; flex-shrink: 0; display: inline-grid; place-items: center; }
.brand-mark svg { width: 100%; height: 100%; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: transparent; border: 0; color: var(--text-primary); transition: background 0.15s; flex-shrink: 0; }
.icon-btn:hover { background: var(--bg-active); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; border-radius: 12px; color: var(--text-secondary); font-size: 15px; transition: 0.15s; white-space: nowrap; }
.nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--text-primary); }
.s-label { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); padding: 14px 10px 6px; }
.sessions { flex: 1; overflow-y: auto; }
.s-item { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 12px; color: var(--text-secondary); font-size: 14.5px; cursor: pointer; transition: 0.15s; }
.s-item:hover { background: var(--bg-card); color: var(--text-primary); }
.side-bottom { display: flex; align-items: center; gap: 12px; padding: 6px 4px 2px; white-space: nowrap; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--bg-avatar); display: grid; place-items: center; font-weight: 700; font-size: 20px; flex-shrink: 0; }
.who b { display: block; font-size: 14px; font-weight: 500; }
.who small { color: var(--text-muted); font-size: 12px; }
.s-logout { margin-left: auto; width: 38px; height: 38px; }
.menu-btn { display: none; margin-right: auto; }
.scrim { position: fixed; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity 0.25s; z-index: 15; }
.scrim.show { opacity: 1; pointer-events: auto; }
@media (min-width: 801px) {
  .sidebar.rail { width: 82px; padding: 10px 0; }
  .sidebar.rail .lbl, .sidebar.rail .sessions, .sidebar.rail .s-label { display: none; }
  .sidebar.rail .side-top { justify-content: center; }
  .sidebar.rail .brand { padding-left: 0; }
  .sidebar.rail .nav { width: 100%; }
  .sidebar.rail .nav-item { justify-content: center; padding: 0; }
  .sidebar.rail .side-bottom { margin-top: auto; justify-content: center; padding: 6px 0 8px; }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; left: 8px; top: max(8px, env(safe-area-inset-top)); bottom: max(8px, env(safe-area-inset-bottom)); width: min(300px, 86vw); z-index: 20; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 24px; transform: translateX(-120%); transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); padding: 12px; }
  .sidebar.mobile-open { transform: none; }
  .menu-btn { display: grid; }
}

/* ───────── Panel ───────── */
.panel { position: relative; flex: 1; min-width: 0; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 24px; overflow: hidden; display: flex; flex-direction: column; }
.topbar { height: 72px; flex-shrink: 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 18px; padding: 0 32px; position: relative; z-index: 3; background: var(--bg-panel); }
.topbar .title { font-family: var(--font-serif); font-size: 20px; font-weight: 700; margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar a { font-family: var(--font-mono); font-weight: 500; font-size: 15px; color: var(--text-primary); opacity: 0.9; }
.topbar a:hover { opacity: 1; text-decoration: underline; }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); border: 0; border-radius: 999px; height: 46px; padding: 0 22px; font-weight: 600; font-size: 15px; transition: transform 0.15s; }
.btn-primary:hover { transform: scale(1.03); }
.theme-btn { display: grid; place-items: center; }
.theme-btn .ic { grid-area: 1/1; transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.5, 1), opacity 0.3s; }
[data-theme='dark'] .theme-btn .sun { opacity: 0; transform: rotate(-90deg) scale(0.4); }
[data-theme='light'] .theme-btn .moon { opacity: 0; transform: rotate(90deg) scale(0.4); }
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, fill 0.4s ease, stroke 0.4s ease !important; }

.content { flex: 1; min-height: 0; overflow-y: auto; }
.page { max-width: 1060px; margin: 0 auto; padding: 34px 30px 70px; }
.page-head { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-family: var(--font-serif); font-weight: 700; font-size: clamp(30px, 3.4vw, 40px); letter-spacing: -0.01em; margin: 0 0 6px; }
.page-sub { color: var(--text-secondary); font-size: 14.5px; line-height: 1.55; max-width: 620px; margin: 0; }
.page-head .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.stat { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 15px 16px; }
.stat-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 7px; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.card { background: var(--bg-panel); border: 1px solid var(--border); border-radius: 20px; margin-bottom: 18px; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-head .sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 18px 20px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.input, .select { height: 42px; width: 100%; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-input); color: var(--text-primary); padding: 0 12px; font-size: 14px; outline: none; transition: border-color 0.15s; }
.textarea { width: 100%; min-height: 96px; resize: vertical; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-input); color: var(--text-primary); padding: 11px 12px; font-size: 14px; line-height: 1.55; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--border-focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.btn { height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-primary); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background 0.15s, opacity 0.15s; white-space: nowrap; }
.btn:hover { background: var(--bg-active); }
.btn.primary { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.btn.primary:hover { opacity: 0.9; }
.btn.ghost { background: transparent; }
.btn.danger { color: #f87171; border-color: color-mix(in srgb, #f87171 30%, transparent); }
.btn.small { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.form-grid { display: grid; grid-template-columns: 1.6fr 0.7fr 0.7fr auto; gap: 10px; align-items: end; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.strong { color: var(--text-primary); font-weight: 500; }
.table .mono { font-family: var(--font-mono); font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 500; border: 1px solid var(--border-strong); color: var(--text-secondary); background: var(--bg-card); white-space: nowrap; }
.badge.ok { color: #4ade80; border-color: color-mix(in srgb, #4ade80 25%, transparent); }
.badge.off { color: #f87171; border-color: color-mix(in srgb, #f87171 25%, transparent); }
.badge.web { color: #93c5fd; border-color: color-mix(in srgb, #93c5fd 25%, transparent); }
.empty { padding: 26px 16px; text-align: center; color: var(--text-muted); font-size: 13.5px; }

.key-created { margin-top: 14px; border: 1px solid color-mix(in srgb, #4ade80 30%, transparent); background: color-mix(in srgb, #4ade80 6%, transparent); border-radius: 14px; padding: 14px; }
.key-created .label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: #4ade80; margin-bottom: 7px; }
.key-value { display: flex; gap: 8px; align-items: center; }
.key-value code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; background: var(--bg-code); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; font-family: var(--font-mono); font-size: 12.5px; color: var(--text-primary); }
.hint { color: var(--text-muted); font-size: 12px; margin-top: 8px; line-height: 1.5; }

.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.model-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 15px 16px; display: flex; flex-direction: column; gap: 10px; }
.model-card .name { font-family: var(--font-mono); font-size: 13.5px; color: var(--text-primary); display: flex; align-items: center; gap: 9px; }
.glm-logo { display: inline-flex; width: 14px; height: 14px; flex-shrink: 0; }
.glm-logo svg, .glm-logo img { width: 100%; height: 100%; display: block; border-radius: 3.5px; }
.model-card .name .glm-logo { width: 15px; height: 15px; }
.model-card .meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.test-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.test-output { border: 1px solid var(--border); background: var(--bg-input); border-radius: 14px; padding: 14px; min-height: 210px; font-size: 14px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-primary); overflow-y: auto; max-height: 420px; }
.test-output .placeholder { color: var(--text-muted); }
.usage-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }

.docs h3 { font-size: 14px; margin: 22px 0 8px; }
.docs h3:first-child { margin-top: 0; }
.docs p, .docs li { color: var(--text-secondary); font-size: 13.5px; line-height: 1.65; }
.docs ul { margin: 8px 0; padding-left: 20px; }
.code-block { position: relative; margin: 10px 0 16px; }
.code-block pre { margin: 0; background: var(--bg-code); border: 1px solid var(--border); border-radius: 12px; padding: 14px 44px 14px 15px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; color: var(--text-secondary); }
.tok-c { color: var(--text-muted); font-style: italic; }
.tok-key { color: var(--eff-3); }
.tok-s { color: var(--eff-0); }
.tok-k { color: var(--eff-1); }
.tok-n { color: var(--eff-2); }
.tok-v { color: var(--eff-3); }
.code-block .copy { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; padding: 0; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted); display: grid; place-items: center; transition: transform .18s cubic-bezier(.34,1.4,.5,1), background .15s ease, color .15s ease; }
.code-block .copy:hover { color: var(--text-primary); background: var(--bg-active); transform: scale(1.1) rotate(-4deg); }
.code-block .copy:active { transform: scale(.92); }
.code-block .copy svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.code-block .copy.copied { color: var(--eff-0); border-color: color-mix(in srgb, var(--eff-0) 45%, transparent); animation: copyPop .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes copyPop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.endpoint { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12.5px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; margin-right: 6px; }
.method { font-weight: 700; font-size: 10.5px; color: #4ade80; }
.method.post { color: #fbbf24; }
.method.get { color: #93c5fd; }
.docs-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.docs-nav a { border: 1px solid var(--border); background: var(--bg-card); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--text-secondary); }
.docs-nav a:hover { color: var(--text-primary); background: var(--bg-active); }

.pill-f, .pill-o { display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 20px; border-radius: 999px; font-size: 15.5px; font-weight: 500; transition: transform 0.15s; }
.pill-f { background: var(--btn-bg); border: 1px solid transparent; color: var(--btn-text); }
.pill-o { background: transparent; border: 1px solid var(--border-strong); color: var(--text-primary); }
.pill-f:hover, .pill-o:hover { transform: translateY(-1px); }

/* ───────── Auth ───────── */
.auth-screen { position:fixed; inset:0; z-index:60; background:var(--bg-app); display:flex; align-items:center; justify-content:center; padding:20px; overflow-y:auto; }
.auth-screen[hidden] { display:none; }
.auth-bg { position:absolute; inset:0; pointer-events:none; background-image:radial-gradient(color-mix(in srgb,var(--px-rgb) 0.16,transparent) 1.2px, transparent 1.4px); background-size:10px 10px; -webkit-mask-image:radial-gradient(ellipse 60% 70% at 50% 26%, #000 10%, transparent 72%); mask-image:radial-gradient(ellipse 60% 70% at 50% 26%, #000 10%, transparent 72%); }
.auth-card { position:relative; width:100%; max-width:420px; background:var(--bg-panel); border:1px solid var(--border-strong); border-radius:24px; padding:26px; box-shadow:var(--shadow-pop); margin:auto; }
.auth-brand { display:flex; align-items:center; gap:11px; margin-bottom:20px; }
.auth-brand .brand-mark { width:38px; height:38px; }
.auth-name { font-size:18px; font-weight:600; letter-spacing:-.01em; }
.auth-tag { font-size:11.5px; color:var(--text-muted); letter-spacing:.08em; text-transform:uppercase; }
.auth-title { font-family:var(--font-serif); font-weight:700; font-size:27px; letter-spacing:-.01em; margin:0 0 6px; }
.auth-desc { color:var(--text-secondary); font-size:13.5px; line-height:1.55; margin:0 0 18px; }
.auth-tabs { display:flex; background:var(--bg-input); border:1px solid var(--border); border-radius:12px; padding:3px; margin-bottom:18px; }
.auth-tab { flex:1; height:38px; border:0; border-radius:9px; background:transparent; color:var(--text-muted); font-size:13.5px; font-weight:500; cursor:pointer; transition:.15s; }
.auth-tab.active { background:var(--bg-active); color:var(--text-primary); }
.auth-form { display:flex; flex-direction:column; gap:13px; }
.auth-field { display:flex; flex-direction:column; gap:6px; }
.auth-field label { font-size:12.5px; color:var(--text-secondary); }
.auth-input { height:44px; width:100%; border-radius:12px; border:1px solid var(--border-strong); background:var(--bg-input); color:var(--text-primary); padding:0 13px; font:400 15px Geist,system-ui,sans-serif; outline:none; transition:border-color .15s; }
.auth-input::placeholder { color:var(--text-muted); }
.auth-input:focus { border-color:var(--border-focus); }
.auth-captcha { display:flex; gap:9px; }
.auth-captcha-img { flex:1; min-width:0; height:46px; border-radius:10px; border:1px solid var(--border-strong); background:var(--bg-input); object-fit:cover; cursor:pointer; }
.auth-captcha-btn { width:46px; height:46px; flex-shrink:0; border-radius:10px; border:1px solid var(--border-strong); background:var(--bg-card); color:var(--text-secondary); display:grid; place-items:center; cursor:pointer; }
.auth-captcha-btn:hover { background:var(--bg-active); color:var(--text-primary); }
.auth-error { color:#f87171; font-size:12.5px; min-height:17px; line-height:1.45; }
.auth-submit { height:46px; border-radius:12px; border:0; background:var(--btn-bg); color:var(--btn-text); font:600 15px Geist,system-ui,sans-serif; cursor:pointer; }
.auth-submit:disabled { opacity:.55; cursor:not-allowed; }
.auth-foot { margin-top:14px; text-align:center; font-size:11.5px; color:var(--text-muted); line-height:1.55; }

/* ───────── Effort ───────── */
.eff-pills { display:flex; gap:6px; flex-wrap:wrap; }
.eff-pill { font-family:var(--font-mono); font-size:11px; padding:2px 8px; border-radius:999px; border:1px solid var(--border-strong); color:var(--text-secondary); }
.eff-pill.eff0 { color:var(--eff-0); border-color:color-mix(in srgb,var(--eff-0) 40%,transparent); }
.eff-pill.eff1 { color:var(--eff-1); border-color:color-mix(in srgb,var(--eff-1) 40%,transparent); }
.eff-pill.eff2 { color:var(--eff-2); border-color:color-mix(in srgb,var(--eff-2) 40%,transparent); }
.eff-pill.eff3 { color:var(--eff-3); border-color:color-mix(in srgb,var(--eff-3) 40%,transparent); }
.seg { display:flex; background:var(--bg-input); border:1px solid var(--border-strong); border-radius:12px; padding:3px; gap:3px; }
.seg-btn { flex:1; height:34px; border:0; border-radius:9px; background:transparent; color:var(--text-muted); font-size:13px; font-weight:500; cursor:pointer; transition:.15s; }
.seg-btn:hover { color:var(--text-primary); }
.seg-btn.active.eff0 { background:var(--eff-0); color:#052e16; }
.seg-btn.active.eff1 { background:var(--eff-1); color:#082f49; }
.seg-btn.active.eff2 { background:var(--eff-2); color:#451a03; }
.seg-btn.active.eff3 { background:var(--eff-3); color:#2e1065; }

/* ───────── Playground ───────── */
.pg { display:grid; grid-template-columns:minmax(280px, 380px) 1fr; gap:18px; align-items:start; }
.pg-config { display:flex; flex-direction:column; gap:12px; }
.pg-output { display:flex; flex-direction:column; gap:8px; min-width:0; }
.pg-out-head { display:flex; align-items:center; justify-content:space-between; font-size:12px; color:var(--text-muted); }
.pg-out-head .mono { font-family:var(--font-mono); }

@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .test-layout { grid-template-columns: 1fr; }
  .pg { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .field:first-child, .form-grid .btn { grid-column: span 2; }
}
@media (max-width: 800px) {
  body { padding: 0; }
  .panel { border-radius: 0; border: 0; }
  .topbar { padding: 0 16px; }
  .page { padding: 22px 16px 60px; }
  .model-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field:first-child, .form-grid .btn { grid-column: span 1; }
  .topbar .title { font-size: 17px; }
  .topbar a { display: none; }
}

/* Docs layout v2 */
.docs-layout { display:grid; grid-template-columns:190px minmax(0,1fr); gap:36px; align-items:start; }
.docs-toc { position:sticky; top:18px; display:flex; flex-direction:column; gap:2px; border-left:1px solid var(--border); padding-left:12px; }
.docs-toc a { font-size:13px; color:var(--text-muted); padding:5px 8px; border-radius:8px; transition:background .15s, color .15s; }
.docs-toc a:hover { color:var(--text-primary); background:var(--bg-card); }
.docs-toc a.active { color:var(--text-primary); background:var(--bg-active); font-weight:500; }
.docs-content { min-width:0; }
.docs-content h3 { font-family:var(--font-serif); font-size:22px; margin:28px 0 10px; letter-spacing:-.01em; }
.docs-content h3:first-child { margin-top:0; }
.docs-content p, .docs-content li { font-size:14px; line-height:1.7; color:var(--text-secondary); }
.docs-content code { font-family:var(--font-mono); font-size:.9em; background:var(--bg-code-inline); padding:1px 6px; border-radius:5px; }
.docs-content .code-block pre code { background:transparent; padding:0; }
@media (max-width:900px) {
  .docs-layout { grid-template-columns:1fr; gap:16px; }
  .docs-toc { position:static; flex-direction:row; flex-wrap:wrap; border-left:0; padding-left:0; gap:6px; }
  .docs-toc a { border:1px solid var(--border); background:var(--bg-card); padding:5px 10px; }
}

/* Usage bars */
.ubar { height:6px; min-width:90px; border-radius:999px; background:var(--bg-active); overflow:hidden; }
.ubar > span { display:block; height:100%; border-radius:999px; background:linear-gradient(90deg, var(--eff-1), var(--eff-3)); }

/* MCP */
.presets { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.preset { border:1px solid var(--border-strong); background:var(--bg-card); color:var(--text-secondary); border-radius:999px; padding:5px 12px; font-size:12.5px; cursor:pointer; transition:.15s; }
.preset:hover { color:var(--text-primary); background:var(--bg-active); }
.mcp-url { font-family:var(--font-mono); font-size:12px; color:var(--text-muted); max-width:320px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mcp-tools { display:flex; flex-wrap:wrap; gap:6px; }
.mcp-tool { font-family:var(--font-mono); font-size:11.5px; border:1px solid var(--border); border-radius:7px; padding:4px 9px; color:var(--text-secondary); background:var(--bg-card); }
.checkline { display:flex; align-items:center; gap:8px; font-size:13.5px; color:var(--text-secondary); cursor:pointer; }
.checkline input { accent-color: var(--eff-3); width:16px; height:16px; }

html { scroll-behavior: smooth; }
.content { scroll-behavior: smooth; }

.mcp-tool-icon { display:inline-grid; place-items:center; width:22px; height:22px; color:var(--eff); flex-shrink:0; }
.mcp-tool-icon svg { width:19px; height:19px; stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }

/* Playground chat */
.pg-chat { display:grid; grid-template-columns:300px minmax(0,1fr); gap:16px; align-items:start; }
.pg-side { display:flex; flex-direction:column; gap:10px; background:var(--bg-card); border:1px solid var(--border); border-radius:16px; padding:14px; position:sticky; top:12px; }
.pg-side-head { font-family:var(--font-serif); font-size:19px; margin-bottom:2px; }
.pg-main { display:flex; flex-direction:column; min-height:520px; border:1px solid var(--border); border-radius:16px; overflow:hidden; background:var(--bg-panel); }
.pg-thread { flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:14px; min-height:380px; max-height:560px; }
.pg-empty { margin:auto; color:var(--text-muted); font-size:13.5px; text-align:center; line-height:1.6; }
.pg-msg { display:flex; }
.pg-msg.user { justify-content:flex-end; }
.pg-msg .bubble { max-width:82%; padding:10px 14px; border-radius:14px; font-size:14px; line-height:1.65; overflow-wrap:anywhere; }
.pg-msg.user .bubble { background:var(--bg-card); border:1px solid var(--border); white-space:pre-wrap; }
.pg-msg.assistant .bubble { background:transparent; color:var(--text-primary); max-width:92%; }
.pg-msg.assistant .bubble p { margin:0 0 10px; }
.pg-msg.assistant .bubble p:last-child { margin-bottom:0; }
.pg-msg.assistant .bubble pre { background:var(--bg-code); border:1px solid var(--border); border-radius:12px; padding:12px; overflow-x:auto; font-family:var(--font-mono); font-size:12.5px; }
.pg-msg.assistant .bubble code { font-family:var(--font-mono); font-size:.9em; background:var(--bg-code-inline); padding:1px 5px; border-radius:5px; }
.pg-msg.assistant .bubble pre code { background:transparent; padding:0; }
.pg-msg.tool .bubble { background:var(--bg-code); border:1px solid var(--border); font-family:var(--font-mono); font-size:12px; white-space:pre-wrap; max-width:94%; color:var(--text-secondary); }
.pg-composer { border-top:1px solid var(--border); padding:10px; position:relative; }
.pg-composer textarea { width:100%; min-height:46px; max-height:140px; resize:none; border:1px solid var(--border-strong); background:var(--bg-input); border-radius:12px; padding:10px 12px; font-size:14px; line-height:1.5; outline:none; color:var(--text-primary); }
.pg-actions { display:flex; align-items:center; gap:8px; margin-top:8px; }
.pg-hint { flex:1; font-size:11.5px; color:var(--text-muted); }
.pg-mentions { position:absolute; left:10px; right:10px; bottom:100%; margin-bottom:6px; background:var(--bg-pop); border:1px solid var(--border-strong); border-radius:12px; box-shadow:var(--shadow-pop); max-height:220px; overflow-y:auto; z-index:20; }
.pg-mention { display:flex; align-items:center; gap:8px; padding:8px 10px; cursor:pointer; font-size:13px; color:var(--text-secondary); }
.pg-mention:hover, .pg-mention.active { background:var(--bg-active); color:var(--text-primary); }
.pg-mention-ic { width:18px; height:18px; display:inline-grid; place-items:center; color:var(--eff); flex-shrink:0; }
.pg-mention-ic svg { width:16px; height:16px; }
.pg-mention .nm { font-family:var(--font-mono); color:var(--eff); }
.pg-mention .ds { color:var(--text-muted); font-size:11.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media (max-width:980px){ .pg-chat{grid-template-columns:1fr;} .pg-side{position:static;} }

/* Playground polish */
.pg-msg { animation: pgpop .22s ease both; }
@keyframes pgpop { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.pg-mentions { animation: pgfade .16s ease both; }
@keyframes pgfade { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.pg-settings-toggle { display:none; }
.pg-composer textarea:focus { border-color: color-mix(in srgb, var(--eff) 55%, var(--border-strong)); }
@media (max-width: 980px) {
  .pg-side { display:none; position:static; }
  .pg-side.open { display:flex; }
  .pg-settings-toggle { display:inline-flex; }
  .pg-main { min-height:64vh; }
  .pg-thread { min-height:52vh; max-height:none; }
}

/* Playground animations */
.pg-dots { display:inline-flex; gap:4px; align-items:center; vertical-align:middle; }
.pg-dots i { width:6px; height:6px; border-radius:50%; background:var(--eff); animation:pgdot 1s infinite ease-in-out; }
.pg-dots i:nth-child(2) { animation-delay:.15s; }
.pg-dots i:nth-child(3) { animation-delay:.3s; }
@keyframes pgdot { 0%,100% { transform:translateY(0); opacity:.35; } 50% { transform:translateY(-3px); opacity:1; } }
.pg-shimmer { background:linear-gradient(90deg,var(--text-muted) 20%,var(--text-primary) 50%,var(--text-muted) 80%); background-size:200% 100%; -webkit-background-clip:text; background-clip:text; color:transparent; animation:pgshim 1.4s linear infinite; }
@keyframes pgshim { from { background-position:100% 0; } to { background-position:-100% 0; } }
.pg-typing::after { content:"\258D"; margin-left:2px; color:var(--eff); animation:pgblink 1s steps(2) infinite; }
@keyframes pgblink { 50% { opacity:0; } }
.pg-msg.assistant .bubble.thinking { display:flex; align-items:center; gap:8px; }
.pg-msg .bubble.loading { display:flex; align-items:center; gap:8px; color:var(--text-muted); }
