/* ═══════════ EMBEDDING LAB · 亮色图纸实验室主题 ═══════════ */
:root {
  --bg:        #f4f3ee;
  --bg-2:      #edece6;
  --panel:     #ffffff;
  --panel-2:   #f2f4f0;
  --line:      #d5dce4;
  --line-soft: #e6ebf1;
  --ink:       #1b2530;
  --ink-dim:   #55677a;
  --ink-faint: #8b9bab;
  --signal:    #4d7c0f;   /* 结果绿：强调实测值 */
  --signal-dim:#65a30d;
  --cyan:      #2f5fe0;   /* 图纸蓝：交互主色 */
  --rose:      #d4345c;
  --amber:     #b45309;
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  --sans: "IBM Plex Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --serif: "Fraunces", Georgia, "Noto Serif SC", serif;
  --radius: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1100px 500px at 85% -8%, rgba(47,95,224,.07), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(77,124,15,.06), transparent 55%),
    repeating-linear-gradient(0deg, transparent 0 43px, rgba(28,39,51,.045) 43px 44px),
    repeating-linear-gradient(90deg, transparent 0 43px, rgba(28,39,51,.045) 43px 44px),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.65;
}
.mono { font-family: var(--mono); }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ───── 顶栏 ───── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 30px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.8));
  backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 34px; height: 34px; color: var(--signal); filter: drop-shadow(0 1px 3px rgba(77,124,15,.4)); }
.brand h1 {
  font-family: var(--mono); font-size: 19px; font-weight: 600; letter-spacing: .18em;
  color: var(--ink);
}
.brand-sub { font-size: 12px; color: var(--ink-dim); letter-spacing: .04em; }
.topbar-right { display: flex; gap: 10px; align-items: center; }

.chip {
  font-family: var(--mono); font-size: 12px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-dim);
  background: var(--panel); cursor: default;
}
.chip-ok { color: var(--cyan); border-color: rgba(47,95,224,.4); background: rgba(47,95,224,.06); }
.chip-bad { color: var(--rose); border-color: rgba(212,52,92,.4); background: rgba(212,52,92,.06); }
button.chip { cursor: pointer; transition: all .18s ease; }
button.chip:hover { border-color: var(--signal); color: var(--signal); box-shadow: 0 2px 10px rgba(77,124,15,.18); }
.chip-key.configured { color: var(--signal); border-color: rgba(77,124,15,.5); background: rgba(101,163,13,.08); }

/* ───── 密钥抽屉 ───── */
.drawer {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20,28,38,.4); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding-top: 9vh;
}
.drawer[hidden] { display: none; }
.drawer-card {
  width: min(640px, 92vw); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 26px; position: relative;
  box-shadow: 0 24px 70px rgba(27,37,48,.22), 0 0 0 1px rgba(47,95,224,.05);
  animation: dropIn .25s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes dropIn { from { transform: translateY(-16px); opacity: 0; } }
.drawer-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 16px; }
.drawer-note { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; font-family: var(--mono); }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; }
.key-row-item { margin-bottom: 14px; }
.key-row-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.key-row-head b { font-size: 13.5px; }
.key-host { font-size: 11.5px; color: var(--ink-faint); }
.chip-mini { font-size: 10.5px; padding: 2px 8px; }
.hint-line { font-size: 12px; color: var(--ink-faint); }
.drawer-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.remember { font-size: 12.5px; color: var(--ink-dim); display: flex; gap: 6px; align-items: center; }
.test-result { margin-top: 10px; font-family: var(--mono); font-size: 12px; min-height: 18px; color: var(--ink-dim); }
.test-result.ok { color: var(--signal); } .test-result.bad { color: var(--rose); }
.drawer-close { position: absolute; top: 14px; right: 16px; background: none; border: none; color: var(--ink-faint); font-size: 13px; cursor: pointer; font-family: var(--mono); }
.drawer-close:hover { color: var(--ink); }

/* ───── Tab 导航 ───── */
.tabs {
  display: flex; gap: 6px; padding: 16px 30px 0; max-width: 1420px; margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.tab {
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  color: var(--ink-dim); background: transparent; cursor: pointer;
  border: 1px solid transparent; border-bottom: none;
  padding: 10px 22px 12px; border-radius: 10px 10px 0 0;
  display: flex; align-items: baseline; gap: 10px;
  transition: color .18s;
  position: relative; top: 1px;
}
.tab:hover { color: var(--ink); }
.tab .tab-idx { font-size: 11px; color: var(--ink-faint); letter-spacing: .1em; }
.tab.active {
  color: var(--signal); background: var(--panel);
  border-color: var(--line);
  box-shadow: inset 0 2px 0 var(--signal);
}
.tab.active .tab-idx { color: var(--signal-dim); }

/* ───── 主体 ───── */
main { max-width: 1420px; margin: 0 auto; padding: 26px 30px 40px; }
.panel { display: none; animation: fadeUp .35s ease; }
.panel.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }

.panel-head { margin-bottom: 20px; max-width: 860px; }
.panel-head h2 {
  font-family: var(--serif); font-weight: 500; font-size: 30px; letter-spacing: .01em;
  margin-bottom: 6px;
}
.panel-head h2 em { font-style: italic; color: var(--signal); margin-right: 10px; }
.panel-head p { color: var(--ink-dim); font-size: 14px; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 1080px) { .cols { grid-template-columns: 1fr; } }
.col { display: flex; flex-direction: column; gap: 18px; }

/* ───── 卡片 ───── */
.card {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px;
  box-shadow: 0 8px 26px rgba(27,37,48,.07);
}
.card-h {
  font-family: var(--mono); font-size: 12.5px; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--ink-dim);
  padding-bottom: 10px; margin-bottom: 14px;
  border-bottom: 1px dashed var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.card-h-sub { font-weight: 400; letter-spacing: .02em; text-transform: none; color: var(--ink-faint); font-size: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 6px rgba(101,163,13,.7); animation: pulse 1.6s infinite; margin-left: auto; }
@keyframes pulse { 50% { opacity: .35; } }

/* ───── 表单 ───── */
label.field-label {
  display: block; font-family: var(--mono); font-size: 12px; color: var(--cyan);
  letter-spacing: .06em; margin-bottom: 6px;
}
label.field-label .hint { color: var(--ink-faint); letter-spacing: 0; }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type=text], input[type=password], textarea, select {
  width: 100%; font-family: var(--mono); font-size: 13.5px;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
  resize: vertical;
}
textarea { line-height: 1.7; }
input:focus, textarea:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(47,95,224,.12); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%), linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; }

.btn {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  padding: 9px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  transition: all .16s ease;
}
.btn:hover { border-color: var(--ink-faint); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(27,37,48,.1); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-solid {
  background: var(--cyan); color: #fff; border-color: var(--cyan);
  box-shadow: 0 4px 16px rgba(47,95,224,.3);
}
.btn-solid:hover { box-shadow: 0 6px 22px rgba(47,95,224,.42); border-color: var(--cyan); }
.btn-ghost { background: transparent; color: var(--ink-dim); }
.btn-ghost:hover { color: var(--ink); }
.btn-danger:hover { color: var(--rose); border-color: var(--rose); }
.btn-fire { letter-spacing: .05em; }
.btn-row { display: flex; gap: 10px; align-items: center; }

/* ───── 报文预览 / JSON ───── */
.req-meta { font-size: 12px; color: var(--amber); margin-bottom: 4px; word-break: break-all; }
.req-note { font-size: 11.5px; color: var(--rose); margin-bottom: 8px; min-height: 15px; }
.jsonbox {
  background: #f8fafb; border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 14px 16px; font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  overflow: auto; max-height: 420px; white-space: pre; tab-size: 2;
  color: var(--ink-dim);
}
.jsonbox.small, pre.jsonbox.small { font-size: 12px; }
.j-key { color: var(--cyan); }
.j-str { color: var(--signal); }
.j-num { color: var(--amber); }
.j-bool,.j-null { color: var(--rose); }
.cmt { color: var(--ink-faint); font-style: italic; }
.annotated { color: var(--ink); max-height: none; }
.curl-wrap { margin-top: 10px; }
.curl-wrap summary { cursor: pointer; font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.curl-wrap summary:hover { color: var(--ink-dim); }

/* ───── 响应统计 ───── */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
@media (max-width: 760px){ .stats { grid-template-columns: repeat(3, 1fr); } }
.stat {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 8px;
  padding: 10px 8px; text-align: center;
}
.stat b { display: block; font-family: var(--mono); font-size: 17px; font-weight: 600; color: var(--signal); }
.stat span { font-size: 11px; color: var(--ink-faint); }

.errbox {
  background: rgba(212,52,92,.07); border: 1px solid rgba(212,52,92,.35);
  color: #b42355; font-family: var(--mono); font-size: 12.5px;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; word-break: break-all;
}

.empty {
  text-align: center; color: var(--ink-faint); font-size: 13px;
  border: 1px dashed var(--line); border-radius: 8px; padding: 34px 20px; line-height: 2;
  background: rgba(255,255,255,.5);
}
.empty-art { font-size: 34px; color: var(--line); margin-bottom: 4px; animation: pulse 2.4s infinite; }
.empty-sm { padding: 18px; }

/* ───── 向量指纹 ───── */
.fp-wrap { margin-bottom: 14px; }
.fp-head {
  display: flex; align-items: center; gap: 10px; font-family: var(--mono);
  font-size: 12px; color: var(--ink-dim); margin-bottom: 8px; flex-wrap: wrap;
}
.fp-picker { width: auto; padding: 3px 26px 3px 8px; font-size: 12px; margin-left: auto; }
#fingerprint { width: 100%; height: 120px; display: block; background: #fff; border: 1px solid var(--line-soft); border-radius: 8px; }
.fp-legend { font-size: 11px; color: var(--ink-faint); margin-top: 6px; }
.fp-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; vertical-align: -1px; }
.lg-pos { background: var(--signal-dim); } .lg-neg { background: var(--rose); }

/* ───── 表格 ───── */
.table-scroll { overflow-x: auto; }
table.dict { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.dict th {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-faint); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line);
}
table.dict td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); color: var(--ink-dim); vertical-align: top; }
table.dict tr:hover td { background: rgba(47,95,224,.05); color: var(--ink); }
table.dict td.mono { color: var(--cyan); white-space: nowrap; }
table.geom { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; }
table.geom td { padding: 8px 10px; border-bottom: 1px dashed var(--line-soft); color: var(--ink-dim); }
table.geom td:first-child { width: 40%; }
table.geom td.mono { color: var(--signal); font-size: 13px; }
table.geom td.small { font-size: 11.5px; color: var(--cyan); word-break: break-all; }

.teach-note { margin-top: 14px; font-size: 12.8px; color: var(--ink-faint); border-left: 2px solid var(--signal-dim); padding-left: 12px; line-height: 1.8; }
.teach-note b { color: var(--ink-dim); }

/* ───── EXP3 ───── */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin-bottom: 18px; background: var(--panel); }
.seg-btn {
  font-family: var(--sans); font-size: 14px; padding: 9px 22px; cursor: pointer;
  background: transparent; color: var(--ink-dim); border: none; transition: all .16s;
}
.seg-btn.active { background: var(--cyan); color: #fff; font-weight: 600; }
.match-controls { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.match-btn-field { margin-bottom: 14px; }
.preset-row { font-size: 13px; color: var(--ink-faint); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chip-btn { font-family: var(--sans); }
.result-card { min-height: 200px; }

.analogy-formula { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--ink-dim); font-size: 16px; }
.analogy-formula input { width: 96px; text-align: center; font-size: 15px; padding: 7px 8px; }
.analogy-formula .q { color: var(--amber); font-size: 20px; }
.formula-eq { color: var(--signal); margin-left: 10px; }
.formula-hint { font-size: 12px; color: var(--ink-faint); }

/* 排名条 */
.rank { display: flex; flex-direction: column; gap: 9px; }
.rank-row { display: grid; grid-template-columns: 26px 1.1fr 3fr 64px; gap: 10px; align-items: center; animation: fadeUp .4s ease both; }
.rank-pos { font-family: var(--mono); font-size: 13px; color: var(--ink-faint); text-align: center; }
.rank-text { font-size: 14px; color: var(--ink); word-break: break-all; }
.rank-bar { height: 16px; background: var(--panel-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--line-soft); }
.rank-fill { height: 100%; width: 0; border-radius: 3px; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.rank-val { font-family: var(--mono); font-size: 13px; text-align: right; }
.rank-row.is-query .rank-text { color: var(--amber); }
.rank-row.is-query .rank-pos::after { content: "◉"; color: var(--amber); }
.rank-row.top .rank-text { color: var(--signal); font-weight: 600; }
.verdict { margin-top: 16px; font-size: 13.5px; color: var(--cyan); border-top: 1px dashed var(--line); padding-top: 12px; }
.verdict .mono { color: var(--signal); }

/* ───── busy bar ───── */
#busybar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--signal-dim));
  box-shadow: 0 0 8px rgba(47,95,224,.6); z-index: 200; opacity: 0;
  transition: width .3s ease, opacity .3s ease;
}
#busybar.on { opacity: 1; }

/* ───── footer ───── */
.footer {
  display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 18px 30px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--ink-faint); font-family: var(--sans);
  background: rgba(255,255,255,.6);
}
.footer .mono { font-size: 11.5px; }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #c6cfd8; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
::selection { background: rgba(47,95,224,.18); }
