@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: var(--mono);
  font-synthesis: none;
  color: var(--ink);
  background: var(--bg);
  --bg: #0a0a0a;
  --rail: #101010;
  --surface: #151515;
  --raised: #1c1c1c;
  --hover: #262626;
  --ink: #ededed;
  --muted: #b3b3b3;
  --faint: #949494;
  --line: #2c2c2c;
  --line-soft: #232323;
  --line-strong: #4a4a4a;
  --accent: #f5f5f5;
  --accent-ink: #151515;
  --accent-surface: #222222;
  --accent-border: #525252;
  --mono: "Geist Mono", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --radius: 14px;
  accent-color: var(--accent);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 300px; }
[hidden], .symbol-library { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
code, kbd, pre, samp { font-family: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
button, a, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: #555; color: var(--accent); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, p { margin: 0; }
.loading { display: grid; place-content: center; min-height: 100dvh; color: var(--muted); font-size: 14px; }

.brand { display: inline-flex; align-items: center; gap: 10px; width: fit-content; white-space: nowrap; font-size: 17px; font-weight: 650; letter-spacing: -.035em; }
.brand-icon { display: grid; place-items: center; width: 34px; height: 34px; }
.brand-emoji { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-size: 22px; font-weight: 400; line-height: 1; }

.login-view { display: grid; grid-template-columns: minmax(390px, .9fr) minmax(0, 1.1fr); gap: 22px; min-height: 100dvh; padding: 22px; }
.login-panel { display: flex; flex-direction: column; padding: 19px clamp(14px, 3vw, 46px) 14px; }
.login-content { width: min(100%, 370px); margin: auto; padding: 60px 0; }
.login-content h1, .page-head h1 { font-weight: 650; letter-spacing: -.035em; }
.login-content h1 { font-size: clamp(36px, 4.1vw, 52px); line-height: 1.15; }
.login-content > p { margin-top: 15px; font-size: 14px; color: var(--muted); line-height: 1.65; }
.login-content form { display: grid; margin-top: 34px; }
.login-content label { font-size: 13px; margin-bottom: 8px; font-weight: 580; }
.login-content input, .manage-form input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}
.login-content input { padding: 12px 14px; min-height: 48px; }
input::placeholder { color: var(--faint); }
input:hover:not(:disabled), input:focus { border-color: var(--accent-border); }
.login-content input + label { margin-top: 19px; }
.login-footer { font-size: 12px; color: var(--faint); }

.login-visual {
  display: grid;
  place-items: center;
  min-height: 410px;
  padding: clamp(18px, 4vw, 64px);
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 50% 52%, rgba(255, 255, 255, .06), transparent 54%),
    linear-gradient(0deg, rgba(255, 255, 255, .025) 1px, transparent 1px) center / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px) center / 32px 32px,
    var(--rail);
}
.network-card {
  width: min(100%, 530px);
  margin: 0;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 25px 72px #0009;
}
.network-card figcaption { display: flex; align-items: center; gap: 8px; padding: 13px 17px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.network-card figcaption svg { width: 15px; height: 15px; color: var(--accent); }
.network { display: flex; align-items: center; padding: clamp(16px, 3vw, 34px) clamp(10px, 2.1vw, 24px); }
.network-node { flex: 1; min-width: 0; display: grid; justify-items: center; gap: 12px; text-align: center; padding: 18px 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--raised); color: var(--muted); font-size: clamp(10px, 1vw, 13px); font-weight: 560; white-space: nowrap; }
.network-node svg { width: 22px; height: 22px; }
.relay-node { background: var(--accent-surface); border-color: var(--accent-border); color: var(--accent); }
.network-line { position: relative; width: clamp(9px, 2vw, 28px); height: 1px; background: var(--accent-border); }
.network-line::after { content: ""; position: absolute; top: -2px; right: 3px; width: 4px; height: 4px; border: solid var(--accent); border-width: 1px 1px 0 0; transform: rotate(45deg); opacity: .68; }

.shell { display: grid; grid-template-columns: 222px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; background: var(--rail); border-right: 1px solid var(--line); padding: 24px 15px 13px; }
.sidebar .brand { margin: 0 6px; }
.nav { display: grid; gap: 21px; margin-top: 31px; }
.nav-group { display: grid; gap: 4px; }
.nav-group-label { margin: 0 11px 3px; color: var(--faint); font-size: 11px; font-weight: 650; letter-spacing: .045em; }
.nav-link { position: relative; display: flex; gap: 11px; align-items: center; color: var(--muted); min-height: 40px; padding: 0 11px; border: 1px solid transparent; border-radius: 7px; font-size: 14px; font-weight: 520; white-space: nowrap; }
.nav-link:hover { background: var(--raised); color: var(--ink); }
.nav-link.active { background: var(--raised); border-color: var(--line); color: var(--ink); font-weight: 640; }
.nav-link.active::before { content: ''; position: absolute; inset: 7px auto 7px -1px; width: 2px; border-radius: 2px; background: var(--accent); }
.nav-link.active svg { color: var(--accent); }
.nav-link svg { width: 16px; height: 16px; }
.profile { margin-top: auto; display: flex; align-items: center; gap: 8px; padding: 15px 3px 2px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; border: 1px solid var(--line); background: var(--raised); color: var(--ink); font-size: 12px; font-weight: 650; flex: none; }
.profile-email { color: var(--muted); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.profile .icon-button { padding: 6px; flex: none; }
.workspace { min-width: 0; }
.topbar { min-height: 63px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(22px, 4vw, 56px); border-bottom: 1px solid var(--line); background: var(--rail); color: var(--muted); font-size: 13px; }
.connection { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--raised); white-space: nowrap; color: var(--muted); font-size: 11px; }
.connection i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.connection[data-state="online"] { color: var(--accent); border-color: var(--accent-border); background: var(--accent-surface); }
.connection[data-state="online"] i { background: var(--accent); }
.connection[data-state="offline"] { color: var(--muted); border-color: var(--line-strong); background: var(--surface); }
.connection[data-state="offline"] i { background: transparent; border: 1px solid currentColor; }

.content { max-width: 1360px; margin: 0 auto; padding: 40px clamp(22px, 4vw, 56px) 56px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 28px; }
.page-head h1 { font-size: clamp(29px, 3.3vw, 42px); line-height: 1.2; }
.page-head p { margin-top: 10px; color: var(--muted); font-size: 14px; line-height: 1.6; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; min-height: 38px; border: 1px solid transparent; border-radius: 999px; white-space: nowrap; font-size: 13px; font-weight: 610; transition: background-color .16s, border-color .16s, color .16s; }
.button svg { width: 15px; height: 15px; }
.primary { background: var(--ink); color: var(--bg); }
.primary:hover:not(:disabled) { background: #d8d8d8; border-color: #d8d8d8; }
.secondary { background: var(--raised); color: var(--ink); border-color: var(--line-strong); }
.secondary:hover:not(:disabled) { background: var(--hover); border-color: var(--accent-border); }
.small { min-height: 32px; padding: 6px 11px; font-size: 12px; }
.login-submit { height: 47px; margin-top: 24px; justify-content: space-between; padding-inline: 18px; }

.metrics, .overview-grid { display: grid; gap: 16px; margin-bottom: 16px; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.overview-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric { padding: 16px 19px 18px; min-height: 132px; min-width: 0; }
.metric > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.metric-label { font-size: 13px; color: var(--muted); font-weight: 570; }
.metric-icon { width: 32px; height: 32px; display: grid; place-items: center; color: var(--muted); background: var(--raised); border: 1px solid var(--line); border-radius: 9px; flex: none; }
.metric-icon svg { width: 16px; height: 16px; }
.metric strong { font-size: clamp(23px, 3vw, 34px); font-weight: 620; letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1.2; display: block; overflow-wrap: anywhere; }
.metric small { display: block; font-size: 12px; color: var(--faint); margin-top: 8px; }
.balance-card { background: linear-gradient(140deg, var(--raised), var(--surface) 80%); border-color: var(--line-strong); }
.balance-card .metric-icon, .agent-card .metric-icon { color: var(--accent); background: var(--accent-surface); border-color: var(--accent-border); }

.section-card { padding: 21px 22px; min-width: 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 19px; }
.section-head h2, dialog h2 { font-size: 17px; font-weight: 630; line-height: 1.4; }
.section-head p, dialog p { font-size: 13px; line-height: 1.6; margin-top: 4px; color: var(--muted); }
.plan, .status { display: inline-block; border-radius: 999px; padding: 4px 9px; border: 1px solid var(--line); background: var(--raised); color: var(--muted); font-size: 11px; line-height: 1.25; font-weight: 570; }
.plan { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status.good { color: var(--accent); background: var(--accent-surface); border-color: var(--accent-border); }
.quota-row + .quota-row { margin-top: 20px; }
.quota-heading, .quota-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.quota-heading strong { font-weight: 600; }
.quota-heading .quota-value { color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }
progress { display: block; width: 100%; height: 6px; margin: 10px 0 8px; appearance: none; overflow: hidden; border: none; border-radius: 999px; accent-color: var(--accent); background: var(--hover); }
progress::-webkit-progress-bar { background: var(--hover); }
progress::-webkit-progress-value { border-radius: 999px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 999px; background: var(--accent); }
progress.nearly-full::-webkit-progress-value { background: var(--faint); }
progress.nearly-full::-moz-progress-bar { background: var(--faint); }
.quota-meta { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.quota-meta span:last-child { text-align: right; }
.section-foot { color: var(--faint); font-size: 12px; line-height: 1.6; margin-top: 15px; overflow-wrap: anywhere; }
.section-foot:empty { display: none; }
.empty { background: var(--rail); color: var(--muted); border: 1px dashed var(--line); border-radius: 9px; text-align: center; font-size: 13px; line-height: 1.6; padding: 18px 12px; }
.notice, .form-error { padding: 9px 12px; background: var(--raised); color: var(--ink); border: 1px solid var(--line-strong); border-inline-start: 2px solid var(--muted); border-radius: 8px; font-size: 13px; line-height: 1.5; }
.notice { margin: 0 0 16px; }
.form-error { margin-top: 14px; }
.field-label { display: block; width: fit-content; color: var(--muted); font-size: 12px; font-weight: 590; margin-bottom: 6px; }
.code-field { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 38px; padding: 5px 7px 5px 11px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; color: var(--ink); }
.code-field code { flex: 1; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.icon-button { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 6px; padding: 0; background: transparent; color: var(--muted); }
.icon-button:hover { color: var(--accent); background: var(--raised); }
.icon-button svg { width: 15px; height: 15px; }
.action-link { display: inline-flex; align-items: center; gap: 6px; width: fit-content; margin-top: 17px; color: var(--accent); font-size: 13px; font-weight: 580; }
.action-link svg { width: 14px; height: 14px; }
.action-link:hover { text-decoration: underline; text-underline-offset: 4px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 9px; }
table { border-collapse: collapse; width: 100%; text-align: left; white-space: nowrap; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { border-bottom: 1px solid var(--line-soft); padding: 11px 12px; }
th { background: var(--raised); color: var(--muted); font-weight: 590; }
td { color: var(--muted); }
td.model-name { font-family: var(--mono); }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255, 255, 255, .025); }

.access-card + .access-card { margin-top: 16px; }
.key-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.key-actions .code-field { flex: 1 1 275px; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 13px 0 7px; }
.snippet-head .field-label { margin: 0; }
pre { overflow-x: auto; background: var(--bg); color: var(--ink); border: 1px solid var(--line); margin: 0; border-radius: 9px; padding: 15px; font-size: 12px; line-height: 1.8; }
pre code { font-family: var(--mono); }
dialog { max-width: min(425px, calc(100% - 28px)); padding: 23px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); box-shadow: 0 24px 85px #000a; }
dialog::backdrop { background: #000b; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.toast { position: fixed; right: 18px; bottom: 18px; z-index: 2; max-width: calc(100% - 36px); background: var(--raised); color: var(--ink); border: 1px solid var(--accent-border); border-radius: 10px; font-size: 13px; padding: 10px 15px; box-shadow: 0 8px 24px #0007; }
.manage-form label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 590; }
.manage-form input { min-height: 39px; padding: 8px 10px; font-size: 13px; }
.manage-form .field-help { margin-top: 6px; font-size: 12px; }
#new-user-dialog, #user-password-dialog, #user-upstream-dialog, #managed-key-dialog, #managed-key-test-dialog { width: 425px; }
.upstream-card { max-width: 660px; }
.upstream-card label:first-child { margin-top: 0; }
.upstream-actions { margin-top: 16px; }
td.user-upstream-value { max-width: 215px; overflow: hidden; text-overflow: ellipsis; }
.credential-output { display: grid; gap: 5px; margin-top: 15px; }
.credential-output .field-label { margin: 0; }
.credential-output .code-field + .field-label { margin-top: 7px; }
.user-actions { display: flex; gap: 6px; }
.user-actions .button { min-height: 30px; }
.admin-key-field { margin-top: 12px; }
.key-cell { display: grid; justify-items: start; gap: 5px; }
.key-cell code { font-size: 10px; font-family: var(--mono); color: var(--faint); }
.clipboard-buffer { position: fixed; top: 0; left: -9999px; opacity: 0; }

@media (max-width: 920px) {
  .login-view { grid-template-columns: minmax(320px, 1fr) minmax(0, 1fr); padding: 16px; gap: 12px; }
  .login-visual { padding-inline: 12px; }
  .shell { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .overview-grid { grid-template-columns: 1fr; }
  .metric { padding-inline: 13px; }
  .metric-label { font-size: 12px; }
}

@media (max-width: 680px) {
  .login-view { grid-template-columns: 1fr; padding: 0; }
  .login-panel { min-height: 100dvh; padding: 22px 23px; }
  .login-visual { display: none; }
  .shell { display: block; }
  .sidebar { position: static; padding: 14px 14px 0; height: auto; display: grid; grid-template-columns: 1fr minmax(0, auto); gap: 10px 7px; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar .brand { margin: 0; }
  .profile { grid-area: 1 / 2; margin: 0; border: 0; padding: 0; }
  .profile .avatar { display: none; }
  .profile-email { max-width: 100px; }
  .nav { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 8px; margin: 0; padding-bottom: 8px; }
  .nav-group { display: flex; flex-wrap: wrap; align-items: center; }
  .nav-group-label { display: none; }
  .nav-link { min-height: 35px; font-size: 13px; }
  .topbar { min-height: 46px; padding-inline: 16px; background: var(--bg); }
  .content { padding: 23px 14px 35px; }
  .page-head { align-items: flex-start; margin-bottom: 16px; }
  .page-head p { font-size: 13px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .balance-card { grid-column: 1 / -1; }
  .metric { min-height: 113px; padding: 11px 12px 13px; }
  .metric > div { margin-bottom: 7px; }
  .metric-icon { width: 26px; height: 26px; }
  .metric small { font-size: 11px; margin-top: 6px; }
  .overview-grid { gap: 10px; margin-bottom: 10px; }
  .section-card { padding: 15px; }
}

.playground, .play-dialog {
  --play-accent: var(--accent);
  --play-accent-ink: var(--accent-ink);
  --play-bg: var(--bg);
  --play-panel: var(--surface);
  --play-border: var(--line);
  --play-soft: var(--muted);
  --play-radius: 11px;
}
.with-playground .topbar { display: none; }
.with-playground .content { max-width: none; padding: 12px 14px; }
.playground { display: flex; flex-direction: column; min-height: 540px; height: calc(100dvh - 24px); overflow: hidden; border: 1px solid var(--play-border); border-radius: var(--play-radius); background: var(--play-bg); }
.play-header { padding: 13px 18px; border-bottom: 1px solid var(--play-border); background: var(--play-panel); }
.play-header h1 { font-size: 17px; font-weight: 630; letter-spacing: -.015em; line-height: 1.4; }
.play-toolbar, .play-toolbar-fields, .play-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.play-toolbar { justify-content: space-between; min-width: 0; padding: 10px 14px; border-bottom: 1px solid var(--play-border); }
.play-toolbar-fields { min-width: 0; }
.play-toolbar-field { position: relative; display: grid; align-items: center; min-width: 0; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--play-panel); }
.play-toolbar-field:focus-within { border-color: var(--play-soft); }
.play-toolbar-field select { appearance: none; min-width: 0; height: 34px; max-width: 100%; padding-block: 4px; border: 0; border-radius: inherit; background: transparent; color: var(--ink); font: inherit; font-size: 12px; font-weight: 550; text-overflow: ellipsis; cursor: pointer; }
.play-model-control select { width: 235px; padding-inline: 34px 72px; }
.play-key-control select { width: 203px; padding-inline: 37px 27px; }
.play-key-control label { position: absolute; left: 10px; z-index: 1; color: var(--play-soft); font-size: 11px; pointer-events: none; }
.play-selector-icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--play-soft); pointer-events: none; }
.play-selector-chevron { position: absolute; right: 9px; width: 14px; height: 14px; color: var(--play-soft); pointer-events: none; }
.play-toolbar-field kbd { position: absolute; right: 27px; padding: 2px 4px; border: 1px solid var(--play-border); border-radius: 4px; color: var(--play-soft); font: 9px/1.15 var(--mono); pointer-events: none; }
.play-toolbar-field select:disabled { opacity: .78; }
.play-toolbar-field:has(select:disabled) .play-selector-chevron { opacity: .4; }
.play-toolbar-field option { background: var(--play-panel); }
.play-toolbar-tokens { color: var(--play-soft); padding-inline: 3px; font: 11px var(--mono); white-space: nowrap; }
.play-toolbar .button { min-height: 34px; padding: 6px 9px; border-radius: 7px; background: var(--play-panel); border-color: var(--play-border); font-size: 12px; }
.play-toolbar .button:hover:not(:disabled) { border-color: var(--play-accent); }
.play-toolbar .play-code-button { color: var(--play-accent); }
.play-notices { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-bottom: 1px solid var(--play-border); }
.play-notices:not(:has(> :not([hidden]))) { display: none; }
.play-main-button { background: var(--play-accent); color: var(--play-accent-ink); border-color: transparent; }
.play-main-button:not(:disabled):hover { background: #d8d8d8; }
.playground :focus-visible, .play-dialog :focus-visible { outline-color: var(--play-accent); }
.play-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(230px, 23%, 294px); flex: 1; min-height: 0; }
.play-conversation { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-height: 0; min-width: 0; overflow: hidden; }
.play-transcript { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: var(--play-border) transparent; }
.play-empty { min-height: 100%; display: grid; align-content: center; justify-items: center; text-align: center; padding: 32px 18px; }
.play-mark { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--accent-border); border-radius: 9px; background: var(--accent-surface); color: var(--play-accent); margin-bottom: 14px; }
.play-mark svg { width: 20px; height: 20px; }
.play-empty h2 { font-size: 20px; letter-spacing: -.015em; }
.play-empty p { color: var(--play-soft); margin-top: 8px; font-size: 13px; }
.play-starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 21px; }
.play-starters button { padding: 7px 11px; background: var(--play-panel); border: 1px solid var(--play-border); color: var(--ink); border-radius: 8px; font-size: 12px; }
.play-starters button:hover { border-color: var(--play-accent); }
.play-starters span { color: var(--play-accent); margin-left: 4px; }
.play-turns { display: grid; gap: 28px; max-width: 800px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 33px); }
.play-turns:empty { display: none; }
.play-turn { max-width: 100%; min-width: 0; justify-self: start; }
.play-turn h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 9px; margin: 0 0 8px; color: var(--play-soft); font-size: 12px; font-weight: 580; }
.play-turn h3 code { padding: 3px 6px; border-radius: 4px; background: var(--raised); color: var(--muted); font: 10px var(--mono); overflow-wrap: anywhere; }
.play-turn p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; font-size: 14px; }
.play-turn.user p { width: fit-content; padding: 9px 12px; border: 1px solid var(--play-border); border-radius: 9px; background: var(--raised); }
.play-turn small { display: block; color: var(--play-soft); font: 11px/1.5 var(--mono); margin-top: 9px; }
.play-turn small:empty { display: none; }
.play-composer { width: 100%; max-width: 800px; margin: 0 auto; padding: 8px clamp(16px, 3vw, 33px) 14px; }
.play-input { display: flex; align-items: end; gap: 8px; border: 1px solid var(--play-border); border-radius: 9px; padding: 7px 8px 7px 11px; background: var(--play-panel); }
.play-input:focus-within { border-color: var(--muted); }
.play-input textarea { flex: 1; width: 0; min-width: 0; resize: vertical; max-height: 175px; padding: 8px 0 5px; border: 0; background: transparent; color: var(--ink); font: inherit; outline: none; }
.play-input textarea:focus-visible { outline: none; }
.play-send { height: 33px; min-height: 33px; width: 33px; padding: 0; border-radius: 7px; }
.play-composer-foot { display: flex; justify-content: space-between; gap: 10px; min-height: 16px; margin-top: 7px; font-size: 11px; color: var(--play-soft); }
#play-status { text-align: right; overflow-wrap: anywhere; }
.play-settings { min-width: 0; min-height: 0; overflow: auto; border-left: 1px solid var(--play-border); background: var(--play-panel); }
.play-panel { min-width: 0; border-bottom: 1px solid var(--play-border); }
.play-panel summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 610; list-style: none; }
.play-panel summary::-webkit-details-marker { display: none; }
.play-panel summary::after { content: ''; width: 6px; height: 6px; border-bottom: 1px solid var(--play-soft); border-right: 1px solid var(--play-soft); transform: rotate(-45deg); }
.play-panel[open] summary::after { transform: rotate(45deg); }
.play-panel-body { display: grid; gap: 9px; padding: 0 14px 13px; }
.play-model-detail { grid-template-columns: auto minmax(0, 1fr); align-items: baseline; font-size: 12px; color: var(--play-soft); }
.play-model-detail code { overflow-wrap: anywhere; text-align: right; color: var(--ink); font: 11px var(--mono); }
.play-parameters { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 11px 8px; }
.play-parameters label { font-size: 12px; color: var(--play-soft); }
.play-panel textarea, .play-panel input:not([type=checkbox]) { width: 100%; padding: 7px 8px; border: 1px solid var(--play-border); border-radius: 6px; background: var(--play-bg); color: var(--ink); font: inherit; font-size: 12px; }
.play-panel textarea { resize: vertical; min-height: 55px; }
.play-parameters input:not([type=checkbox]) { width: 76px; }
.play-switch { appearance: none; position: relative; justify-self: end; width: 29px; height: 17px; margin: 0; border: 1px solid var(--play-border); border-radius: 100px; background: var(--play-bg); cursor: pointer; }
.play-switch::before { content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--play-soft); }
.play-switch:checked { background: var(--play-accent); border-color: var(--play-accent); }
.play-switch:checked::before { left: 14px; background: var(--play-accent-ink); }
.play-usage dl { margin: 0; display: grid; gap: 9px; }
.play-usage dl > div { display: flex; justify-content: space-between; gap: 8px; color: var(--play-soft); font-size: 12px; }
.play-usage dd { margin: 0; color: var(--ink); font-family: var(--mono); }
.play-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.play-dialog { width: 1050px; max-width: calc(100% - 26px); max-height: calc(100dvh - 32px); overflow: auto; padding: 0; background: var(--play-panel); border: 1px solid var(--play-border); border-radius: var(--play-radius); }
.play-dialog::backdrop { background: #000c; }
.play-dialog-heading { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--play-border); }
.play-dialog-heading h2 { font-size: 18px; }
.play-dialog-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.5fr); gap: 13px; padding: 13px; }
.play-api-fields, .play-code-pane { min-width: 0; border: 1px solid var(--play-border); border-radius: 11px; background: var(--play-panel); }
.play-api-fields { display: grid; align-content: start; gap: 7px; padding: 14px; background: var(--play-bg); }
.play-api-fields h3 { margin: 0 0 7px; font-size: 15px; font-weight: 620; }
.play-api-format { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-bottom: 9px; border-bottom: 1px solid var(--play-border); }
.play-api-format span:last-child { color: var(--play-accent); font-size: 12px; font-weight: 600; }
.play-api-fields > .field-label { margin-top: 4px; }
.play-api-fields .code-field { min-height: 34px; padding: 3px 4px 3px 8px; border-color: var(--play-border); border-radius: 6px; background: var(--play-panel); }
.play-api-fields .code-field code { overflow-wrap: anywhere; min-width: 0; white-space: normal; }
.play-api-fields .button, .play-api-fields .action-link { justify-self: start; }
.play-api-fields p { overflow-wrap: anywhere; }
.play-code-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--play-border); padding: 8px 10px 8px 14px; }
.play-code-top strong { position: relative; color: var(--play-accent); font-size: 13px; }
.play-code-top strong::after { content: ''; position: absolute; inset: auto 0 -14px; height: 2px; background: var(--play-accent); }
.play-code-pane { display: grid; grid-template-rows: auto minmax(0, 1fr); align-content: start; }
.play-code-pane pre { max-height: 60dvh; min-height: 260px; margin: 0; border: 0; border-radius: 0 0 11px 11px; padding: 13px; background: var(--bg); overflow: auto; }

@media (max-width: 770px) {
  .playground { height: auto; }
  .play-grid { grid-template-columns: minmax(0, 1fr); }
  .play-settings { border-left: 0; border-top: 1px solid var(--play-border); }
  .play-conversation { height: min(610px, 65dvh); min-height: 330px; }
}
@media (max-width: 540px) {
  .with-playground .content { padding: 6px; }
  .play-toolbar { gap: 7px; padding: 8px; }
  .play-toolbar-fields { width: 100%; }
  .play-toolbar-field { flex: 1; }
  .play-toolbar-field select { width: 100%; }
  .play-model-control select { padding-right: 26px; }
  .play-toolbar-field kbd { display: none; }
  .play-toolbar-actions { width: 100%; justify-content: end; }
  .play-toolbar-tokens { margin-right: auto; }
  .play-dialog-grid { grid-template-columns: minmax(0, 1fr); }
  .play-dialog-grid { padding: 10px; }
  .play-code-pane pre { min-height: 190px; max-height: 33dvh; }
  .play-composer { padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}
