:root {
  --gold: #e8c37a;
  --gold-2: #f6e3b6;
  --gold-deep: #b5853c;
  --ember: #d98b3a;
  --blood: #a8402f;
  --ink: #100b06;
  --ink-2: #1b1409;
  --ink-3: #2a2012;
  --panel: rgba(22, 16, 9, 0.86);
  --panel-2: rgba(35, 26, 15, 0.92);
  --line: rgba(232, 195, 122, 0.28);
  --line-strong: rgba(232, 195, 122, 0.6);
  --text: #efe4cf;
  --text-dim: #b3a288;
  --ok: #7fc08a;
  --warn: #e0b64e;
  --err: #e0705f;
  --font-title: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --font-body: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #070503;
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app { position: relative; width: 100vw; height: 100vh; }

.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }

/* ---------------- 通用按钮 ---------------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(60, 44, 24, 0.9), rgba(28, 20, 11, 0.95));
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.16s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--line-strong); color: var(--gold-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(180deg, #dcae5a, #a9762f);
  color: #251705;
  font-weight: 700;
  border-color: #e8c37a;
}
.btn-danger { border-color: rgba(224, 112, 95, 0.6); color: #f0b3a8; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  background: rgba(16, 11, 6, 0.6);
  color: var(--gold);
  cursor: pointer;
  font-size: 15px;
  transition: 0.16s;
  backdrop-filter: blur(4px);
}
.icon-btn:hover { border-color: var(--gold); background: rgba(60, 42, 20, 0.75); }

/* ---------------- 表单 ---------------- */
.fld { display: block; margin-bottom: 10px; }
.fld-label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; letter-spacing: 0.4px; }
.fld-hint { display: block; font-size: 11px; color: #8a7a62; margin-top: 3px; }
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  background: rgba(10, 7, 4, 0.75);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: var(--font-body);
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { resize: vertical; }
select option { background: #191106; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.chk input { width: auto; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1; }

/* ---------------- Toast / Modal ---------------- */
#toast-layer {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  z-index: 9000; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 18px; border-radius: 20px; font-size: 13px;
  background: rgba(20, 14, 8, 0.94); border: 1px solid var(--line);
  color: var(--text); opacity: 0; transform: translateY(-8px); transition: 0.25s;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}
.toast.in { opacity: 1; transform: translateY(0); }
.toast-ok { border-color: rgba(127, 192, 138, 0.6); color: #cdeed3; }
.toast-warn { border-color: rgba(224, 182, 78, 0.6); color: #f2dfa8; }
.toast-err { border-color: rgba(224, 112, 95, 0.6); color: #f5c3ba; }

#modal-layer { position: fixed; inset: 0; z-index: 9500; display: none; }
#modal-layer.show { display: grid; place-items: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.66); backdrop-filter: blur(2px); }
.modal-box {
  position: relative; min-width: 340px; max-width: 92vw; max-height: 86vh;
  background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column;
}
.modal-wide { width: 900px; }
.modal-title {
  font-family: var(--font-title); font-size: 17px; color: var(--gold-2);
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-x { cursor: pointer; color: var(--text-dim); font-size: 14px; }
.modal-x:hover { color: var(--gold); }
.modal-body { padding: 16px 18px; overflow: auto; font-size: 13px; line-height: 1.7; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------------- 装饰 ---------------- */
.orn-line {
  height: 1px; background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}
.tag {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 3px;
  border: 1px solid var(--line); color: var(--text-dim);
}
.tag-fail { border-color: rgba(224, 112, 95, 0.6); color: #eba79b; }
.tag-good { border-color: rgba(232, 195, 122, 0.7); color: var(--gold-2); }
.tag-neutral { border-color: rgba(143, 176, 200, 0.6); color: #b6cede; }

/* ---------------- 启动遮罩 ---------------- */
.boot { position: fixed; inset: 0; z-index: 9800; background: #070503; display: grid; place-items: center; transition: opacity .4s; }
.boot.hide { opacity: 0; pointer-events: none; }
.boot-title { font-family: var(--font-title); font-size: 40px; letter-spacing: 14px; color: var(--gold); }
.boot-sub { text-align: center; margin-top: 10px; font-size: 12px; color: var(--text-dim); letter-spacing: 2px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.3); }
::-webkit-scrollbar-thumb { background: rgba(232, 195, 122, 0.25); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: rgba(232, 195, 122, 0.45); }
