/* ============================================================
   wbapi 控制台
   暖纸 / 石墨两套主题，朱砂作唯一强调色。
   请求区偏编辑器，响应区偏终端，中间一条可拖动的分界线。
   ============================================================ */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
          "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
          Consolas, "Liberation Mono", monospace;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --top-h: 54px;
}

html[data-theme="light"] {
  --bg: #f4f1ea;
  --bg-deep: #ece7dc;
  --panel: #fffefb;
  --panel-2: #f8f5ee;
  --panel-3: #f1ece1;
  --ink: #17181c;
  --ink-2: #494b54;
  --muted: #8a8a92;
  --line: #e3ddd1;
  --line-strong: #d2cabb;
  --accent: #c2462a;
  --accent-hover: #a83a21;
  --accent-ink: #fffaf6;
  --accent-soft: #f8e7e0;
  --ok: #2c7457;
  --ok-soft: #e4f0e9;
  --warn: #9a6b12;
  --warn-soft: #f7ecd6;
  --err: #a92c22;
  --err-soft: #f8e3df;
  --console: #1b1c20;
  --console-2: #26282e;
  --console-ink: #e8e6e0;
  --console-muted: #8f9098;
  --shadow-sm: 0 1px 2px rgba(35, 28, 18, .05);
  --shadow-md: 0 12px 30px -20px rgba(35, 28, 18, .38);
  --shadow-lg: 0 36px 80px -44px rgba(35, 28, 18, .5);
  --scrim: rgba(28, 24, 16, .42);
  --tok-key: #9a3b21;
  --tok-str: #2f6b46;
  --tok-num: #2a5b8f;
  --tok-bool: #7a4a8f;
  --tok-punc: #8b8578;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0e0f12;
  --bg-deep: #08090a;
  --panel: #15171b;
  --panel-2: #1a1c21;
  --panel-3: #202329;
  --ink: #ece9e2;
  --ink-2: #b4b2ac;
  --muted: #7e7f87;
  --line: #252830;
  --line-strong: #343842;
  --accent: #e0663f;
  --accent-hover: #ef7d59;
  --accent-ink: #180e0a;
  --accent-soft: #2c1c16;
  --ok: #56b389;
  --ok-soft: #14291f;
  --warn: #d8a345;
  --warn-soft: #2b2313;
  --err: #ef6f62;
  --err-soft: #2f1715;
  --console: #0a0b0d;
  --console-2: #14161a;
  --console-ink: #e7e4dd;
  --console-muted: #7d7f88;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-md: 0 12px 30px -20px rgba(0, 0, 0, .85);
  --shadow-lg: 0 36px 80px -44px rgba(0, 0, 0, .95);
  --scrim: rgba(0, 0, 0, .55);
  --tok-key: #e58b6d;
  --tok-str: #8fc9a4;
  --tok-num: #85b3e6;
  --tok-bool: #c39ad6;
  --tok-punc: #7c7a74;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

::selection { background: var(--accent-soft); color: var(--ink); }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { width: 18px; height: 18px; display: block; flex: none; }

kbd {
  font-family: var(--mono);
  font-size: 10px;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid currentColor;
  opacity: .6;
  line-height: 1.4;
}

/* ---------- 滚动条 ---------- */

.pane-body, .drawer-body, .model-list, .res-body, .code, .event-list {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.pane-body::-webkit-scrollbar, .drawer-body::-webkit-scrollbar,
.model-list::-webkit-scrollbar, .res-body::-webkit-scrollbar,
.code::-webkit-scrollbar, .event-list::-webkit-scrollbar { width: 9px; height: 9px; }
.pane-body::-webkit-scrollbar-thumb, .drawer-body::-webkit-scrollbar-thumb,
.model-list::-webkit-scrollbar-thumb, .res-body::-webkit-scrollbar-thumb,
.code::-webkit-scrollbar-thumb, .event-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* ---------- 骨架 ---------- */

.shell {
  height: 100%;
  display: grid;
  grid-template-rows: var(--top-h) minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, var(--req-w, 46%)) 7px minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--panel);
}

.pane-req { border-right: 1px solid var(--line); }

/* ---------- 顶栏 ---------- */

.topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px 0 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 9px; flex: none; }

.brand-mark { width: 24px; height: 24px; color: var(--accent); }
.brand-mark svg { width: 24px; height: 24px; }

.brand-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -.01em;
}
.brand-name i {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  color: var(--muted);
  text-transform: uppercase;
}

.conn-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 9px 0 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  max-width: 320px;
  min-width: 0;
  flex: 0 1 auto;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.conn-pill:hover { background: var(--panel-3); border-color: var(--line-strong); }
.conn-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted) 16%, transparent);
}
.conn-pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.conn-pill.err .dot { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.conn-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mono);
  font-size: 11.5px;
}
.conn-pill .chev { width: 14px; height: 14px; opacity: .5; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }

.tb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 12.5px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.tb:hover { background: var(--panel-2); color: var(--ink); }
.tb.icon { width: 32px; padding: 0; justify-content: center; }
.tb.sm { width: 28px; height: 28px; }
.tb.sm svg { width: 16px; height: 16px; }
.tb-sep { width: 1px; height: 18px; background: var(--line); margin: 0 6px; }

/* ---------- 请求区 ---------- */

.pane-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  padding: 0 14px 0 16px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.seg {
  display: inline-flex;
  padding: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.seg-item {
  height: 26px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.seg-item:hover { color: var(--ink); }
.seg-item.on {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  font-weight: 560;
}
.seg.wide { display: flex; width: 100%; }
.seg.wide .seg-item { flex: 1; height: 30px; }

.head-right { display: flex; align-items: center; gap: 10px; }

.size {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: .02em;
}

.mini {
  font-size: 11.5px;
  color: var(--ink-2);
  padding: 3px 8px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--panel);
  transition: all .15s var(--ease);
}
.mini:hover { border-color: var(--line-strong); background: var(--panel-2); }

.pane-body { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }

/* 终端风格的接口行 */
.endpoint {
  position: relative;
  display: flex;
  align-items: stretch;
  margin: 14px 16px 4px;
  height: 40px;
  border-radius: 10px;
  background: var(--console);
  border: 1px solid var(--console-2);
  overflow: hidden;
  transition: box-shadow .18s var(--ease), border-color .18s var(--ease);
}
.endpoint:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, var(--console-2)); box-shadow: 0 0 0 3px var(--accent-soft); }

.method {
  appearance: none;
  border: 0;
  padding: 0 26px 0 13px;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
  cursor: pointer;
  outline: none;
  border-right: 1px solid var(--console-2);
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 13px) 17px, calc(100% - 9px) 17px;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.method option { background: var(--console); color: var(--console-ink); }

.path {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  padding: 0 6px 0 11px;
  color: var(--console-ink);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: -.01em;
}

.path-more {
  width: 34px;
  display: grid;
  place-items: center;
  color: var(--console-muted);
  border-left: 1px solid var(--console-2);
  transition: color .15s var(--ease), background .15s var(--ease);
}
.path-more:hover { color: var(--console-ink); background: var(--console-2); }
.path-more svg { width: 14px; height: 14px; }

.path-pop {
  top: 46px;
  left: 0;
  width: 320px;
  padding: 5px;
}
.path-pop button {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--r-xs);
  text-align: left;
}
.path-pop button:hover { background: var(--panel-2); }
.path-pop code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
}
.path-pop span { font-size: 11px; color: var(--muted); margin-left: auto; }

/* 表单块 */
.block {
  padding: 14px 16px 16px;
  border-bottom: 1px solid var(--line);
}
.block:last-of-type { border-bottom: 0; }

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}
.block-head label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint { font-size: 11px; color: var(--muted); }

.link {
  font-size: 11.5px;
  color: var(--accent);
  padding: 2px 4px;
  border-radius: 4px;
}
.link:hover { background: var(--accent-soft); }

/* 模型选择 */
.combo { position: relative; display: flex; align-items: center; }

.combo-logo {
  position: absolute;
  left: 9px;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .07);
  overflow: hidden;
  pointer-events: none;
}
.combo-logo i {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0;
}
.combo-logo img { width: 100%; height: 100%; object-fit: contain; padding: 2px; }

.combo input {
  width: 100%;
  height: 38px;
  padding: 0 36px 0 39px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12.5px;
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.combo input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.combo-chev {
  position: absolute;
  right: 4px;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-radius: var(--r-xs);
}
.combo-chev:hover { color: var(--ink); background: var(--panel-2); }
.combo-chev svg { width: 14px; height: 14px; }

.pop {
  position: absolute;
  z-index: 40;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}

.model-pop { top: 42px; left: 0; right: 0; padding: 0; overflow: hidden; }

.pop-search {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.pop-search svg { width: 15px; height: 15px; }
.pop-search input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 12.5px;
}

.model-list { max-height: 280px; overflow-y: auto; padding: 5px; }

.model-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--r-xs);
  text-align: left;
}
.model-item:hover, .model-item.on { background: var(--panel-2); }
.model-item img {
  width: 18px; height: 18px;
  object-fit: contain;
  padding: 2px;
  background: #fff;
  border-radius: 4px;
  flex: none;
}
.model-item .mi-badge {
  width: 18px; height: 18px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: var(--panel-3);
  font-size: 9px;
  font-weight: 700;
  color: var(--muted);
  flex: none;
}
.model-item .mi-id {
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-item .mi-tag {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  flex: none;
}
.model-empty { padding: 18px 12px; text-align: center; color: var(--muted); font-size: 12px; }

/* 消息编辑 */
.msgs { display: flex; flex-direction: column; gap: 7px; }

.msg-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  overflow: hidden;
  transition: border-color .16s var(--ease);
}
.msg-card:focus-within { border-color: var(--line-strong); background: var(--panel); }

.msg-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px 5px 8px;
  border-bottom: 1px solid var(--line);
}

.msg-role {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
  padding: 2px 18px 2px 6px;
  border-radius: 5px;
  cursor: pointer;
  outline: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 8px) 8px, calc(100% - 5px) 8px;
  background-size: 3px 3px, 3px 3px;
  background-repeat: no-repeat;
}
.msg-role[data-role="system"] { color: var(--warn); }
.msg-role[data-role="user"] { color: var(--accent); }
.msg-role[data-role="assistant"] { color: var(--ok); }
.msg-role[data-role="tool"] { color: var(--ink-2); }

.msg-tools { margin-left: auto; display: flex; gap: 1px; }
.msg-tools button {
  width: 24px; height: 22px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-radius: 4px;
}
.msg-tools button:hover { background: var(--panel-3); color: var(--ink); }
.msg-tools button svg { width: 13px; height: 13px; }
.msg-tools button[disabled] { opacity: .25; pointer-events: none; }

.msg-card textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  max-height: 260px;
  padding: 8px 10px;
  border: 0;
  outline: none;
  resize: vertical;
  background: transparent;
  font-size: 13px;
  line-height: 1.6;
}

/* 参数 */
.params { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.p-field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.p-field span {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .01em;
}
.p-field input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0 9px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.p-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.p-field input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

.switches { margin-top: 12px; display: flex; flex-direction: column; gap: 1px; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  cursor: pointer;
}
.sw-label { display: flex; flex-direction: column; line-height: 1.35; font-size: 12.5px; }
.sw-label em { font-style: normal; font-size: 11px; color: var(--muted); margin-top: 1px; }

.switch-row input { position: absolute; opacity: 0; pointer-events: none; }

.sw {
  margin-left: auto;
  width: 36px; height: 21px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  flex: none;
  transition: background .2s var(--ease);
}
.sw::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s var(--ease);
}
.switch-row input:checked + .sw { background: var(--accent); }
.switch-row input:checked + .sw::after { transform: translateX(15px); }

/* 高级 */
.adv {
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
}
.adv summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.adv summary::-webkit-details-marker { display: none; }
.adv summary::before {
  content: "";
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
  transition: transform .16s var(--ease);
}
.adv[open] summary::before { transform: rotate(90deg) translateX(1px); }
.adv summary em {
  font-style: normal;
  margin-left: auto;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  color: var(--muted);
}
.adv textarea {
  margin-top: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
}
.adv textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.adv-note { margin: 7px 0 0; font-size: 11px; color: var(--muted); }

/* JSON 编辑器 */
.editor {
  display: flex;
  margin: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel-2);
  overflow: hidden;
  min-height: 300px;
}
.editor:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

.gutter {
  flex: none;
  width: 42px;
  padding: 10px 8px 10px 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  background: var(--panel-3);
  border-right: 1px solid var(--line);
  user-select: none;
  overflow: hidden;
  white-space: pre;
}

#json-area {
  flex: 1;
  min-width: 0;
  min-height: 300px;
  padding: 10px 12px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
}

.json-error {
  margin: 0 16px 16px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--err-soft);
  color: var(--err);
  font-family: var(--mono);
  font-size: 11.5px;
}

/* 底部操作条 */
.pane-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 132px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 560;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
  transition: background .16s var(--ease), transform .1s var(--ease);
}
.send:hover { background: var(--accent-hover); }
.send:active { transform: translateY(1px); }
.send[disabled] { opacity: .6; pointer-events: none; }
.send kbd { opacity: .7; }

.stop {
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  background: var(--err-soft);
  color: var(--err);
  font-size: 13px;
  border: 1px solid color-mix(in srgb, var(--err) 25%, transparent);
}

.foot-right { margin-left: auto; display: flex; gap: 6px; }
.ghost {
  height: 32px;
  padding: 0 11px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  background: var(--panel);
  transition: all .15s var(--ease);
}
.ghost:hover { border-color: var(--line-strong); background: var(--panel-2); color: var(--ink); }

/* ---------- 分界线 ---------- */

.splitter {
  cursor: col-resize;
  background: var(--bg-deep);
  position: relative;
  z-index: 5;
}
.splitter::after {
  content: "";
  position: absolute;
  inset: 0 3px;
  background: transparent;
  transition: background .15s var(--ease);
}
.splitter:hover::after, .splitter.dragging::after { background: var(--accent); opacity: .45; }
.splitter:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- 响应区 ---------- */

.pane-res { background: var(--panel); }

.res-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 46px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 25px;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11.5px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
  flex: none;
}
.status .s-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status b { font-weight: 600; letter-spacing: .02em; }
.status.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.status.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.status.err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 22%, transparent); }
.status.live { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.status.live .s-dot { animation: pulse 1.1s var(--ease) infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.7); }
}

.metrics {
  display: flex;
  align-items: center;
  gap: 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.metrics b { font-weight: 600; color: var(--ink-2); }
.metrics .m { padding: 0 11px; flex: none; }
.metrics .m:first-child { padding-left: 0; }
.metrics .m + .m { border-left: 1px solid var(--line-strong); }

.res-tools { margin-left: auto; display: flex; gap: 1px; }

.res-tabs {
  display: flex;
  gap: 2px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  flex: none;
  overflow-x: auto;
}
.rt {
  position: relative;
  height: 37px;
  padding: 0 10px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s var(--ease);
}
.rt:hover { color: var(--ink); }
.rt.on { color: var(--ink); font-weight: 560; }
.rt.on::after {
  content: "";
  position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.rt em {
  font-style: normal;
  margin-left: 5px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
}

.res-body { flex: 1; min-height: 0; overflow-y: auto; position: relative; }

/* 错误卡片 */
.err-card {
  border: 1px solid color-mix(in srgb, var(--err) 26%, var(--line));
  background: var(--err-soft);
  border-radius: var(--r-md);
  padding: 16px 18px;
}
.err-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--err);
  font-weight: 700;
  margin-bottom: 6px;
}
.err-body { font-size: 13.5px; line-height: 1.7; color: var(--ink); }
.err-hint {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--err) 18%, transparent);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  word-break: break-word;
}

/* 空状态 */
.res-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 32px;
  gap: 0;
  max-width: 460px;
  margin: 0 auto;
}
.empty-mark { color: var(--line-strong); margin-bottom: 18px; }
.empty-mark svg { width: 56px; height: 56px; }
.res-empty h2 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -.01em;
}
.res-empty p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
}
.res-empty p kbd { margin: 0 1px; }

.empty-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 20px;
}
.empty-presets button {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 11.5px;
  color: var(--ink-2);
  transition: all .15s var(--ease);
}
.empty-presets button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* 预览 */
.res-panel[data-panel="preview"] { padding: 20px 22px 60px; }

.answer { font-size: 13.5px; line-height: 1.75; color: var(--ink); word-wrap: break-word; }
.answer > *:first-child { margin-top: 0; }
.answer h1, .answer h2, .answer h3 { line-height: 1.35; margin: 1.4em 0 .5em; letter-spacing: -.01em; }
.answer h1 { font-size: 19px; }
.answer h2 { font-size: 16px; }
.answer h3 { font-size: 14px; }
.answer p { margin: .7em 0; }
.answer ul, .answer ol { margin: .7em 0; padding-left: 1.4em; }
.answer li { margin: .25em 0; }
.answer li::marker { color: var(--muted); }
.answer code {
  font-family: var(--mono);
  font-size: .88em;
  padding: .12em .38em;
  border-radius: 4px;
  background: var(--code-bg, var(--panel-3));
  border: 1px solid var(--line);
}
.answer pre {
  margin: .9em 0;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--console);
  color: var(--console-ink);
  overflow-x: auto;
  border: 1px solid var(--console-2);
}
.answer pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1.65;
  color: inherit;
}
.answer blockquote {
  margin: .9em 0;
  padding: .2em 0 .2em 12px;
  border-left: 2px solid var(--accent);
  color: var(--ink-2);
}
.answer table {
  border-collapse: collapse;
  margin: .9em 0;
  font-size: 12.5px;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.answer th, .answer td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.answer th { background: var(--panel-2); font-weight: 600; }
.answer a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.answer hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.answer img { max-width: 100%; border-radius: var(--r-sm); }

.cursor-blink::after {
  content: "";
  display: inline-block;
  width: 7px; height: 14px;
  margin-left: 2px;
  background: var(--accent);
  vertical-align: -2px;
  animation: blink .9s steps(2, start) infinite;
}
@keyframes blink { 0%, 50% { opacity: 1; } 50.1%, 100% { opacity: 0; } }

.answer-empty { color: var(--muted); font-size: 12.5px; }

/* JSON */
.code {
  margin: 0;
  padding: 16px 18px 60px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  tab-size: 2;
}
.tok-key { color: var(--tok-key); }
.tok-str { color: var(--tok-str); }
.tok-num { color: var(--tok-num); }
.tok-bool { color: var(--tok-bool); }
.tok-null { color: var(--muted); font-style: italic; }
.tok-punc { color: var(--tok-punc); }

/* 事件流 */
.event-list { padding: 8px 10px 60px; display: flex; flex-direction: column; gap: 2px; }

.ev {
  display: grid;
  grid-template-columns: 34px 58px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  font-family: var(--mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: background .12s var(--ease);
}
.ev:hover { background: var(--panel-2); }
.ev-idx { color: var(--muted); text-align: right; font-size: 10.5px; }
.ev-t { color: var(--muted); font-size: 10.5px; }
.ev-body {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-2);
}
.ev-body.has-text { color: var(--ink); }
.ev.done .ev-body { color: var(--ok); }
.ev.err .ev-body { color: var(--err); }
.ev.open .ev-body { white-space: pre-wrap; word-break: break-word; }

/* 响应头 */
.kv-block { padding: 16px 18px 4px; }
.kv-block h3 {
  margin: 0 0 8px;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.kv {
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: minmax(110px, 190px) minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--line);
}
.kv dt, .kv dd {
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
}
.kv dt { font-family: var(--mono); color: var(--muted); padding-right: 14px; word-break: break-all; }
.kv dd { font-family: var(--mono); color: var(--ink-2); word-break: break-all; }

/* ---------- 抽屉 ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 60;
  animation: fade .18s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 400px;
  max-width: 92vw;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  z-index: 70;
  display: flex;
  flex-direction: column;
  animation: slidein .22s var(--ease);
}
@keyframes slidein { from { transform: translateX(24px); opacity: 0; } }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.drawer-head h2 { margin: 0; font-size: 14px; font-weight: 600; }

.drawer-body { flex: 1; overflow-y: auto; padding: 8px; }

.d-group-title {
  padding: 10px 10px 6px;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.d-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  text-align: left;
  position: relative;
}
.d-item:hover { background: var(--panel-2); }

.d-main { min-width: 0; flex: 1; }
.d-title {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.d-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.d-status {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 0 6px;
  border-radius: 4px;
  flex: none;
  margin-top: 1px;
}
.d-status.ok { color: var(--ok); background: var(--ok-soft); }
.d-status.warn { color: var(--warn); background: var(--warn-soft); }
.d-status.err { color: var(--err); background: var(--err-soft); }
.d-time { font-family: var(--mono); font-size: 10px; color: var(--muted); flex: none; margin-top: 3px; }

.d-del {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  display: none;
  place-items: center;
  border-radius: 5px;
  background: var(--panel-3);
  color: var(--muted);
}
.d-item:hover .d-del { display: grid; }
.d-del:hover { color: var(--err); }

.d-go {
  display: grid;
  place-items: center;
  align-self: center;
  color: var(--muted);
  opacity: 0;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.d-go svg { width: 14px; height: 14px; }
.d-item:hover .d-go { opacity: .7; transform: translateX(1px); }

.d-empty { padding: 40px 16px; text-align: center; color: var(--muted); font-size: 12.5px; line-height: 1.8; }

/* ---------- 弹窗 ---------- */

.sheet {
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  color: var(--ink);
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 780px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.sheet.narrow { width: min(420px, calc(100vw - 32px)); }
.sheet::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
.sheet[open] { animation: pop .2s var(--ease); }
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0; } }

.sheet-inner { display: flex; flex-direction: column; max-height: inherit; }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  flex: none;
}
.sheet-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.sheet-head .sub { margin: 3px 0 0; font-size: 12px; color: var(--muted); }

.sheet-body { padding: 4px 18px 8px; overflow-y: auto; flex: 1; }

.sheet-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
  flex: none;
}
.sheet-foot .note { margin-right: auto; font-size: 11px; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 5px; margin: 13px 0; }
.field > span { font-size: 11.5px; font-weight: 550; color: var(--ink-2); }
.field > em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 12.5px;
  outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[type="url"], .field input[spellcheck="false"] { font-family: var(--mono); font-size: 12px; }

.with-eye { position: relative; display: flex; }
.with-eye input { padding-right: 52px; }
.eye {
  position: absolute;
  right: 4px; top: 4px;
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--muted);
  border-radius: 5px;
}
.eye:hover { color: var(--ink); background: var(--panel-2); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 .field { margin: 13px 0; }

.note { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.7; }

.test-row { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; }
.test-out { font-size: 11.5px; font-family: var(--mono); color: var(--muted); }
.test-out.ok { color: var(--ok); }
.test-out.err { color: var(--err); }

.btn {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  transition: all .15s var(--ease);
}
.btn:hover { border-color: var(--line-strong); background: var(--panel-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 11.5px; border-radius: 6px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); background: var(--err-soft); }

.sheet-sep { height: 1px; background: var(--line); margin: 18px 0 14px; }

.sec-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; }
.sec-row + .sec-row { border-top: 1px solid var(--line); }
.sec-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sec-text b { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.sec-text em { font-style: normal; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.sec-acts { display: flex; gap: 6px; flex: none; }

.snippet {
  max-height: 52vh;
  overflow: auto;
  white-space: pre;
  padding: 14px 16px;
  background: var(--console);
  color: var(--console-ink);
  border-radius: var(--r-sm);
  border: 1px solid var(--console-2);
}
#dlg-code { width: min(620px, calc(100vw - 32px)); }
#code-note { font-family: var(--mono); font-size: 10.5px; }

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--console);
  color: var(--console-ink);
  border: 1px solid var(--console-2);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 12px;
  box-shadow: var(--shadow-md);
  animation: toastin .2s var(--ease);
}
.toast.err { background: var(--err); color: #fff; border-color: transparent; }
@keyframes toastin { from { transform: translateY(6px); opacity: 0; } }

/* ---------- 移动端 ---------- */

.mobile-tabs { display: none; }

@media (max-width: 700px) {
  .m-usage, .m-chars, .m-model { display: none; }
}

@media (max-width: 900px) {
  :root { --top-h: 50px; }

  .workspace { grid-template-columns: minmax(0, 1fr); }
  .pane-req { border-right: 0; }

  .pane-res { display: none; }
  .workspace.show-res .pane-req { display: none; }
  .workspace.show-res .pane-res { display: flex; }

  .splitter { display: none; }

  .mobile-tabs {
    display: flex;
    border-top: 1px solid var(--line);
    background: var(--panel);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mt {
    flex: 1;
    height: 46px;
    font-size: 12.5px;
    color: var(--muted);
    position: relative;
  }
  .mt.on { color: var(--accent); font-weight: 560; }
  .mt.on::before {
    content: "";
    position: absolute;
    top: -1px; left: 30%; right: 30%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
  }
  .mt i {
    font-style: normal;
    font-size: 9px;
    font-family: var(--mono);
    color: var(--muted);
    margin-left: 2px;
  }

  .brand-name i { display: none; }
  .top-actions .tb span { display: none; }
  .top-actions .tb { width: 32px; padding: 0; justify-content: center; }
  .conn-pill { max-width: 42vw; }
  .conn-pill .chev { display: none; }

  .endpoint { margin: 10px 12px 4px; }
  .block { padding: 12px 12px 14px; }
  .adv { padding: 12px 12px 14px; }
  .pane-foot { padding: 8px 12px; }
  .send { flex: 1; justify-content: center; }
  .send kbd { display: none; }
  .foot-right .ghost { padding: 0 9px; }

  .res-head { gap: 8px; padding: 0 8px 0 10px; }
  .metrics .m { padding: 0 8px; }
  .res-panel[data-panel="preview"] { padding: 16px 14px 40px; }

  .sheet {
    width: 100vw;
    max-width: 100vw;
    max-height: 88vh;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    margin: 0;
    position: fixed;
    inset: auto 0 0 0;
  }
  .sheet[open] { animation: sheetup .24s var(--ease); }
  @keyframes sheetup { from { transform: translateY(30px); opacity: .6; } }

  .kv { grid-template-columns: 1fr; }
  .kv dt { border-bottom: 0; padding-bottom: 0; }
  .kv dd { padding-top: 2px; }
}

@media (max-width: 480px) {
  .params { grid-template-columns: 1fr 1fr; }
  .res-tabs { padding: 0 6px; }
  .rt { padding: 0 8px; font-size: 11.5px; }
  .m-ttft { display: none; }
  .topbar { gap: 8px; padding: 0 8px 0 12px; }
  .tb-sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   访问密码
   首次进入设置密码，之后靠一年期签名 Cookie 免登录。
   ============================================================ */

html[data-locked] .shell { visibility: hidden; }
html[data-locked] body { overflow: hidden; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px 20px;
  overflow: auto;
  background-color: var(--bg);
  background-image:
    radial-gradient(120% 90% at 50% -12%, var(--panel) 0%, transparent 62%),
    radial-gradient(rgba(122, 112, 96, .14) 1px, transparent 1px);
  background-size: auto, 22px 22px;
}

.gate-card {
  width: min(424px, 100%);
  padding: 32px 32px 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}

.gate-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 26px; }
.gate-mark { width: 26px; height: 26px; color: var(--accent); flex: none; }
.gate-mark svg { display: block; width: 100%; height: 100%; }
.gate-brand-text { font-size: 13px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.gate-brand-text em {
  font-style: normal;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--muted);
  margin-left: 8px;
}

.gate-view h1 {
  margin: 0 0 9px;
  font-size: 26px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.025em;
  color: var(--ink);
}
.gate-sub {
  margin: 0 0 20px;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--muted);
}
#gate-loading { display: flex; align-items: center; gap: 12px; padding: 6px 0 10px; }
#gate-loading .gate-sub { margin: 0; }

.gate-spin {
  width: 18px; height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: gate-spin .8s linear infinite;
}
@keyframes gate-spin { to { transform: rotate(360deg); } }

.gate-form { display: flex; flex-direction: column; gap: 12px; }

.gate-field { display: flex; flex-direction: column; gap: 6px; }
.gate-field > span { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.gate-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.gate-field input::placeholder { color: var(--muted); }
.gate-field input:focus {
  outline: none;
  background: var(--panel);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.gate-field .eye { top: 50%; transform: translateY(-50%); height: 30px; }

.gate-btn {
  width: 100%;
  height: 42px;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
}
.gate-btn:disabled { opacity: .55; cursor: default; }

.gate-err {
  margin: 0;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--err);
  background: var(--err-soft);
  border-radius: var(--r-xs);
}

.gate-tip {
  margin: 16px 0 0;
  font-size: 11px;
  line-height: 1.75;
  color: var(--muted);
}
.gate-tip code {
  font-family: var(--mono);
  font-size: 10.5px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--panel-3);
}

.gate-copy {
  margin: 0;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .02em;
  color: var(--muted);
}

@media (max-width: 520px) {
  .gate-card { padding: 24px 20px 20px; border-radius: var(--r-lg); }
  .gate-view h1 { font-size: 22px; }
  .gate-brand { margin-bottom: 22px; }
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-2);
  background: var(--bg);
}

/* ============================================================
   分享给别人：Base URL + 一把共享密钥
   ============================================================ */

.copy-row { display: flex; align-items: center; gap: 6px; }
.copy-row input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px; }
.copy-row .btn { flex: none; height: 36px; }

.share-card {
  margin: 10px 0 4px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--panel-2);
}
.sc-head { display: flex; align-items: center; gap: 8px; }
.sc-title { font-size: 12px; font-weight: 600; color: var(--ink); }
.sc-badge {
  margin-left: auto;
  padding: 2px 8px;
  font-size: 10px;
  line-height: 1.6;
  color: var(--muted);
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.sc-badge.on {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok) 24%, transparent);
}
.sc-key {
  margin-top: 9px;
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--ink);
  word-break: break-all;
}
.sc-key.off { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.sc-meta {
  margin-top: 4px;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.sc-acts { display: flex; gap: 6px; margin-top: 10px; }
.sc-acts .btn { flex: none; }

.share-fresh {
  margin: 12px 0 4px;
  padding: 12px;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}
.sf-head { margin-bottom: 8px; font-size: 11.5px; font-weight: 600; color: var(--ink); }
.sf-foot { margin-top: 8px; font-size: 10.5px; line-height: 1.7; color: var(--ink-2); }
.share-fresh .copy-row input { background: var(--panel); }

.armed { border-color: var(--err) !important; color: var(--err) !important; }

@media (max-width: 520px) {
  .copy-row input { font-size: 11px; }
  .copy-row .btn { padding: 0 10px; }
}
