/* 共用设计令牌与基础组件 */
@font-face {
  font-family: "IQ Serif"; font-weight: 600 900; font-style: normal; font-display: swap;
  src: url("fonts/serif-700.woff2") format("woff2");
}
:root {
  --bg: #eceee9;
  --paper: #f8f9f6;
  --paper-2: #f2f4f0;
  --mist: #e3e8e2;
  --line: #d8ddd5;
  --line-2: #c9d0c7;
  --ink: #17221e;
  --ink-2: #44514b;
  --mute: #7f8a84;
  --pine: #1d4a3f;
  --pine-2: #2a6152;
  --jade: #2e7b5c;
  --jade-soft: #e2efe7;
  --cinnabar: #ad422b;
  --cinnabar-soft: #f5e4de;
  --amber: #b5862b;
  --amber-soft: #f4ecda;
  --serif: "IQ Serif", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", "Songti SC", "STSong", "SimSun", serif;
  --sans: "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 40px -28px rgba(23, 46, 38, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.65 var(--sans); font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #cfe2d7; }
:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; }
.serif { font-family: var(--serif); }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--mute); }
[hidden] { display: none !important; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--paper); cursor: pointer; white-space: nowrap; font-size: 14.5px; text-decoration: none; color: var(--ink);
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { background: #fff; border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--pine); border-color: var(--pine); color: #f3f7f4; }
.btn-primary:hover { background: var(--pine-2); border-color: var(--pine-2); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(29,74,63,.07); border-color: transparent; }
.btn-danger { color: var(--cinnabar); }
.btn-sm { height: 34px; padding: 0 12px; border-radius: 10px; font-size: 13.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label, .field > .label { font-size: 14px; color: var(--ink-2); }
.input, .textarea {
  width: 100%; height: 46px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--paper-2); outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 120px; padding: 12px 16px; resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus { border-color: var(--jade); background: #fff; box-shadow: 0 0 0 4px rgba(46,123,92,.1); }
.input::placeholder, .textarea::placeholder { color: #a3aca7; }
.hint { font-size: 12.5px; color: var(--mute); }

/* 自定义下拉（增强原生 select） */
.sel { position: relative; min-width: 0; }
.sel select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.sel-btn {
  width: 100%; height: 46px; padding: 0 40px 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--paper-2); text-align: left; cursor: pointer; position: relative;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: border-color .15s, background .15s;
}
.sel-btn::after {
  content: ""; position: absolute; right: 17px; top: 50%; width: 7px; height: 7px; margin-top: -6px;
  border: solid #9aa49f; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); transition: transform .2s var(--ease), margin .2s;
}
.sel.open .sel-btn { border-color: var(--jade); background: #fff; }
.sel.open .sel-btn::after { transform: rotate(-135deg); margin-top: -2px; }
.sel-menu {
  position: absolute; z-index: 60; left: 0; top: calc(100% + 8px); min-width: 100%; max-height: 320px; overflow: auto;
  padding: 8px; border-radius: 16px; background: #fbfcfb; border: 1px solid var(--line);
  box-shadow: 0 22px 50px -18px rgba(22, 40, 33, .28);
  opacity: 0; transform: translateY(-4px); pointer-events: none; transition: opacity .16s, transform .16s var(--ease);
}
.sel.open .sel-menu { opacity: 1; transform: none; pointer-events: auto; }
.sel.up .sel-menu { top: auto; bottom: calc(100% + 8px); }
.sel-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 11px 14px; border-radius: 11px;
  cursor: pointer; color: var(--ink-2); white-space: nowrap;
}
.sel-opt:hover, .sel-opt.kb { background: #eef3ef; }
.sel-opt.on { background: #e5efe8; color: var(--ink); }
.sel-opt.on::after {
  content: ""; width: 12px; height: 7px; border: solid #5f7a6e; border-width: 0 0 1.6px 1.6px; transform: rotate(-45deg) translate(1px, -2px);
}
.sel-opt small { color: var(--mute); margin-left: 6px; }

/* 分段切换 */
.seg { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--mist); gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; padding: 9px 18px; border-radius: 10px; cursor: pointer; color: var(--ink-2);
  transition: background .15s, color .15s, box-shadow .15s;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(20,40,30,.08), 0 4px 12px -6px rgba(20,40,30,.18); }

/* 判定标记 */
.tag { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.pass { background: var(--jade-soft); color: var(--jade); }
.tag.degraded { background: var(--cinnabar-soft); color: var(--cinnabar); }
.tag.fail { background: #ebecea; color: #6d7570; }
.tag.running { background: var(--amber-soft); color: var(--amber); }
.tag.running::before { animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* 提示条 */
.toast-wrap { position: fixed; left: 50%; top: 22px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 12px; background: var(--ink); color: #eef3ef; font-size: 14px;
  box-shadow: 0 16px 40px -16px rgba(0,0,0,.4); animation: toast-in .25s var(--ease);
}
.toast.err { background: var(--cinnabar); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* 缩略渲染：1280x800 虚拟视口等比缩放 */
.shot { position: relative; overflow: hidden; background: var(--paper-2); container-type: inline-size; }
.shot iframe {
  position: absolute; left: 0; top: 0; width: 1280px; height: 800px; border: 0; transform-origin: 0 0;
  transform: scale(var(--s, .25)); pointer-events: none; background: #fff;
}
.shot.live iframe { pointer-events: auto; }
.shot .shot-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--mute); font-size: 13px; text-align: center; padding: 16px; }

/* 弹窗 */
.modal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px; }
.modal-mask { position: absolute; inset: 0; background: rgba(20, 30, 26, .55); backdrop-filter: blur(6px); animation: fade .2s; }
.modal-box { position: relative; background: var(--paper); border-radius: var(--r-lg); box-shadow: 0 40px 80px -30px rgba(0,0,0,.5); animation: pop .25s var(--ease); max-height: calc(100vh - 48px); overflow: auto; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } }

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