* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #070b14;
  --bg-soft: #0b1220;
  --panel: rgba(17, 25, 43, .72);
  --panel-solid: #11192b;
  --line: rgba(120, 150, 200, .16);
  --line-strong: rgba(120, 170, 255, .35);
  --text: #e8eefc;
  --muted: #8293b5;
  --accent: #37b6ff;
  --accent-2: #7c5cff;
  --accent-grad: linear-gradient(135deg, #37b6ff, #7c5cff);
  --green: #34d399;
  --red: #fb7185;
  --radius: 14px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(55, 182, 255, .14), transparent 60%),
    radial-gradient(900px 500px at 0% 110%, rgba(124, 92, 255, .12), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
}

/* 背景网格装饰 */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(90, 140, 220, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90, 140, 220, .05) 1px, transparent 1px);
  background-size: 42px 42px;
  pointer-events: none;
  z-index: 0;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(600px 300px at 50% 0%, rgba(55, 182, 255, .06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}
header, .layout, .modal-mask, .toast { position: relative; z-index: 1; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  background: rgba(10, 16, 30, .75);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 20;
}
.brand {
  font-size: 19px; font-weight: 800; letter-spacing: .8px;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  display: flex; align-items: baseline; gap: 10px;
}
.brand-sub {
  font-size: 11px; font-weight: 500; letter-spacing: 2px; color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

button {
  font-size: 13px; padding: 8px 15px; border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(20, 30, 52, .6); color: var(--text);
  cursor: pointer; transition: all .18s;
  letter-spacing: .3px;
}
button:hover { border-color: var(--accent); color: #fff; box-shadow: 0 0 16px rgba(55, 182, 255, .18); }
button.primary {
  background: var(--accent-grad); border-color: transparent; color: #fff;
  font-weight: 700;
}
button.primary:hover { filter: brightness(1.15); box-shadow: 0 4px 22px rgba(55, 150, 255, .35); }
button.ghost { background: transparent; }
button.ghost:hover { background: rgba(55, 182, 255, .08); }
button.danger-ghost { background: transparent; color: var(--red); border-color: rgba(251, 113, 133, .35); }
button.danger-ghost:hover { background: rgba(251, 113, 133, .1); border-color: var(--red); color: var(--red); }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.hidden { display: none !important; }

select.mini-select {
  background: var(--panel, #12192b);
  color: var(--text, #dce6ff);
  border: 1px solid rgba(120, 150, 220, .25);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}

#perm-qr-wrap { margin-top: 12px; }
#perm-qr { max-width: 220px; margin-top: 10px; border-radius: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.layout {
  display: grid; grid-template-columns: 290px 1fr;
  min-height: calc(100vh - 58px);
}

aside {
  background: rgba(10, 16, 30, .6);
  border-right: 1px solid var(--line);
  padding: 18px 14px; overflow-y: auto;
  backdrop-filter: blur(8px);
}
.aside-title {
  font-size: 11px; letter-spacing: 2px; color: var(--muted);
  margin-bottom: 12px; text-transform: uppercase;
}
.project-list { display: flex; flex-direction: column; gap: 8px; }
.project-item {
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: rgba(20, 30, 52, .35);
  transition: all .18s;
}
.project-item:hover { border-color: var(--line-strong); background: rgba(55, 182, 255, .06); transform: translateX(2px); }
.project-item.active {
  border-color: var(--accent);
  background: linear-gradient(90deg, rgba(55, 182, 255, .16), rgba(124, 92, 255, .08));
  box-shadow: inset 0 0 0 1px rgba(55, 182, 255, .25);
}
.project-item .p-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-item .p-time { font-size: 11px; color: var(--muted); }

.editor { padding: 26px; display: flex; flex-direction: column; gap: 20px; max-width: 1040px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
h2 { font-size: 16px; margin-bottom: 2px; font-weight: 700; letter-spacing: .4px; }

.title-input {
  font-size: 20px; font-weight: 700; border: none; outline: none; background: transparent;
  color: var(--text); width: 100%;
  border-bottom: 2px solid transparent; padding: 2px 0;
  transition: border-color .18s;
}
.title-input:hover, .title-input:focus { border-bottom-color: var(--accent); }

.status-badge {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  background: rgba(130, 147, 181, .15); color: var(--muted);
  border: 1px solid rgba(130, 147, 181, .2);
}
.status-badge.ready { background: rgba(52, 211, 153, .12); color: var(--green); border-color: rgba(52, 211, 153, .3); }
.status-badge.building { background: rgba(55, 182, 255, .12); color: var(--accent); border-color: rgba(55, 182, 255, .3); }
.status-badge.error { background: rgba(251, 113, 133, .12); color: var(--red); border-color: rgba(251, 113, 133, .3); }

.build-result {
  display: flex; gap: 16px; align-items: center;
  background: rgba(10, 16, 30, .5); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; margin-top: 12px; flex-wrap: wrap;
}
.build-result img { width: 96px; height: 96px; border-radius: 8px; background: #0a1020; border: 1px solid var(--line); }
.link-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.link-row input {
  flex: 1; min-width: 260px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
  background: rgba(10, 16, 30, .6); color: var(--text); outline: none;
}
.link-row input:focus { border-color: var(--accent); }
.error-text { color: var(--red); font-size: 13px; margin-top: 10px; white-space: pre-wrap; }

.target-list, .model-list { display: flex; flex-direction: column; gap: 12px; }
.target-row, .model-row {
  display: flex; gap: 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  background: rgba(20, 30, 52, .3);
  transition: border-color .18s;
}
.target-row:hover, .model-row:hover { border-color: var(--line-strong); }
.target-row img.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; background: #0a1020; border: 1px solid var(--line); }
.target-info { flex: 1; min-width: 0; }
.target-info input.name, .model-info input.name {
  font-size: 14px; font-weight: 600; border: none; outline: none; background: transparent;
  color: var(--text); border-bottom: 1px dashed transparent; width: 100%;
}
.target-info input.name:hover, .model-info input.name:hover { border-bottom-color: var(--line-strong); }
.quality-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 999px; font-weight: 700; }
.quality-tip { font-size: 12px; color: var(--muted); margin-top: 4px; }

.model-row { flex-wrap: wrap; }
.model-thumb {
  width: 48px; height: 48px; border-radius: 10px;
  object-fit: cover; border: 1px solid var(--line-strong);
  background: #0a1020; flex-shrink: 0;
}
.model-icon {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, rgba(55, 182, 255, .25), rgba(124, 92, 255, .25));
  border: 1px solid var(--line-strong);
  color: var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.model-info { flex: 1; min-width: 180px; }
.model-info .file { font-size: 12px; color: var(--muted); margin-top: 4px; }
.model-controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.model-controls label { font-size: 12px; color: var(--muted); }
.model-controls input[type=range] { width: 130px; vertical-align: middle; accent-color: var(--accent); }

.perf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.perf-item {
  display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  background: rgba(20, 30, 52, .25);
}
.perf-item span { display: flex; justify-content: space-between; align-items: center; }
.perf-item span b { color: var(--accent); font-weight: 700; }
.perf-item input[type=range] { width: 100%; accent-color: var(--accent); }
.perf-item input[type=number] {
  width: 100px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
  background: rgba(10, 16, 30, .6); color: var(--text); outline: none;
}
.perf-item input[type=number]:focus { border-color: var(--accent); }
.perf-item select {
  padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
  background: #0d1526; color: var(--text); outline: none;
}
.perf-item.switch-row { flex-direction: row; justify-content: space-between; align-items: center; }
.perf-item.switch-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(4, 8, 16, .72);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(6px);
}
.modal {
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 16px; padding: 26px; width: 380px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .5);
}
.modal h3 { margin-bottom: 16px; font-size: 18px; background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.modal input, .modal select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px;
  background: rgba(10, 16, 30, .7); color: var(--text); outline: none;
}
.modal input:focus, .modal select:focus { border-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
  background: rgba(20, 30, 52, .92); color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 200;
  backdrop-filter: blur(10px); box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(120, 150, 200, .2); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 150, 200, .35); }

/* 登录鉴权 */
.header-right { display: flex; align-items: center; gap: 10px; }

.login-screen {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(5, 9, 18, .82);
  backdrop-filter: blur(12px);
}
.login-card {
  width: 360px; max-width: calc(100vw - 40px);
  background: var(--panel-solid); border: 1px solid var(--line-strong);
  border-radius: 18px; padding: 34px 30px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  text-align: center;
}
.login-brand {
  font-size: 22px; font-weight: 800; letter-spacing: 1px;
  background: var(--accent-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px;
}
.login-card h3 { font-size: 16px; margin: 8px 0 12px; color: var(--text); }
.login-card p { margin-bottom: 18px; line-height: 1.7; }
.login-card code {
  background: rgba(55, 182, 255, .12); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 6px; font-size: 12px;
}
.login-card input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; background: rgba(10, 16, 30, .7); color: var(--text); outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.login-card .error-text { margin: 10px 0 4px; }
.login-card .primary { width: 100%; margin-top: 16px; padding: 11px; font-size: 14px; }
.login-card .primary:disabled { opacity: .55; cursor: default; }

/* 发布体检 */
.health-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}
.health-meta { margin-bottom: 2px; }
.health-line {
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.health-line .quality-badge { flex: none; }
.health-item {
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(17, 25, 43, .45);
  font-size: 13px;
  line-height: 1.55;
}
.health-item b { margin-right: 6px; font-size: 12px; }
.health-item.pass { border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .08); }
.health-item.pass b { color: var(--green); }
.health-item.warn { border-color: rgba(234, 179, 8, .42); background: rgba(234, 179, 8, .09); }
.health-item.warn b { color: #eab308; }
.health-item.fail { border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .1); }
.health-item.fail b { color: var(--red); }
.health-gate {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(251, 113, 133, .5);
  background: rgba(251, 113, 133, .12);
  font-size: 13px;
}
.health-gate.warn { border-color: rgba(234, 179, 8, .45); background: rgba(234, 179, 8, .09); }
