:root {
  --bg: #050b11;
  --panel: rgba(11, 22, 31, 0.82);
  --line: rgba(255, 255, 255, 0.07);
  --text: #dbe7ee;
  --muted: #7d93a3;
  --gold: #f5c542;
  --green: #35c48a;
  --orange: #f08c4a;
  --purple: #a78bfa;
  --cyan: #56c8e8;
  --teal: #3ec6c0;
  --danger: #e5606c;
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 55% 18%, #0e2130 0%, #071018 45%, var(--bg) 100%) fixed,
    var(--bg);
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  overflow-y: scroll;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(10, 21, 30, 0.97), rgba(6, 13, 19, 0.94));
  backdrop-filter: blur(8px);
}

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

.logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700;
  color: #2a1c00;
  background: linear-gradient(145deg, #ffe08a, #e8a92a);
  box-shadow: 0 4px 14px rgba(232, 169, 42, 0.28);
}

.brand-text h1 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: 0.5px; }
.stats { margin-top: 2px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.stats b { color: #9fe8ff; font-weight: 600; }
.stats .sep { margin: 0 5px; color: rgba(255, 255, 255, 0.18); }

.actions { display: flex; gap: 8px; }

.btn {
  height: 30px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.16); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.38; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(160deg, #ffe08a, #e8a92a);
  color: #2a1c00;
  border-color: transparent;
  font-weight: 600;
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); }
.btn.teal {
  background: linear-gradient(160deg, #46cfd0, #1f9e9a);
  color: #04211f;
  border-color: transparent;
  font-weight: 600;
  height: 34px;
}
.btn.purple {
  background: linear-gradient(160deg, #a98ef5, #7d5bd6);
  color: #14082b;
  border-color: transparent;
  font-weight: 600;
  height: 34px;
}
.btn.danger {
  background: linear-gradient(160deg, #ef7280, #cf4354);
  color: #2b0409;
  border-color: transparent;
  font-weight: 600;
  height: 34px;
}

/* ---------- 页面 ---------- */
.page {
  width: min(1240px, calc(100% - 28px));
  margin: 0 auto;
  padding: 14px 0 30px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
}

.section-head { display: flex; align-items: center; gap: 9px; margin-top: 8px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.section-desc { margin: -6px 0 0 16px; font-size: 11.5px; color: var(--muted); }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(86, 200, 232, 0.8);
  flex: 0 0 auto;
}
.dot.big { width: 9px; height: 9px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.card-title { display: flex; align-items: center; gap: 8px; }
.card-title h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-stats { margin-left: auto; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.card-stats b { color: #9fe8ff; }
.card-stats i { color: var(--gold); font-style: normal; }
.card-stats .warn { color: #ff9a9a; }

.card-desc { margin: 5px 0 0; font-size: 11.5px; line-height: 1.6; color: rgba(125, 147, 163, 0.95); }
.card-desc b { color: #9fc6d8; font-weight: 600; }

/* 说明 chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  font-size: 11px; color: var(--muted);
}
.chip b { color: var(--text); font-weight: 500; }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; }
.chip-dot.gold { background: var(--gold); }
.chip-dot.orange { background: var(--orange); }
.chip-dot.purple { background: var(--purple); }
.chip-dot.cyan { background: var(--cyan); }
.chip-dot.green { background: var(--green); }
.chip-dot.red { background: #e05555; }

/* 双击添加炉子的内联输入框 */
.inline-name {
  position: absolute;
  z-index: 30;
  transform: translate(-50%, -130%);
  width: 190px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 200, 112, 0.6);
  background: rgba(6, 16, 22, 0.94);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
}
.inline-name:focus { border-color: #6ceca0; }

/* 表单 */
.field { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; color: var(--muted); }
.field.block { margin-top: 10px; }
.field input, .field textarea {
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.field input {
  height: 32px;
  padding: 0 10px;
  font-size: 13px;
  font-family: var(--mono);
}
.field textarea {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
}
.field input:focus, .field textarea:focus { border-color: rgba(159, 232, 255, 0.35); }
.field input:disabled, .field textarea:disabled { opacity: 0.5; }
.field-label { margin-top: 10px; font-size: 10.5px; color: var(--muted); }

.center-row { display: flex; align-items: flex-end; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.center-row .field input { width: 92px; }
.center-row .btn { height: 32px; }

.row2 { display: flex; gap: 10px; }
.row2 .field { flex: 1; }

/* 分类 chips 按钮 */
.chip-btns { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.chip-btn {
  height: 26px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
  transition: all .14s ease;
}
.chip-btn:hover:not(:disabled) { color: var(--text); border-color: rgba(255, 255, 255, 0.2); }
.chip-btn.active {
  background: linear-gradient(160deg, #46cfd0, #1f9e9a);
  color: #04211f;
  border-color: transparent;
  font-weight: 600;
}
.chip-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.sel-info {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed rgba(159, 232, 255, 0.3);
  background: rgba(86, 200, 232, 0.06);
  font-size: 11px;
  color: #9fd7e8;
}
.sel-info.ok { border-style: solid; color: #c6f3e6; border-color: rgba(62, 198, 192, 0.45); background: rgba(62, 198, 192, 0.08); }

.btn-col { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.btn-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn-row .btn { flex: 0 0 auto; }

/* 待排队列 */
.queue-box {
  margin-top: 12px;
  min-height: 74px;
  max-height: 150px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  font-size: 11px;
  color: var(--muted);
}
.queue-box .qchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(62, 198, 192, 0.35);
  background: rgba(62, 198, 192, 0.1);
  color: #bdeeea;
  cursor: pointer;
  font-size: 11px;
}
.queue-box .qchip:hover { border-color: rgba(62, 198, 192, 0.7); }
.queue-box .qchip i { font-style: normal; color: rgba(189, 238, 234, 0.5); font-family: var(--mono); font-size: 10px; }

/* 已排成员列表 */
.placed-list {
  margin-top: 10px;
  height: 320px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  padding: 4px;
}
.placed-list::-webkit-scrollbar { width: 6px; }
.placed-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 3px; }
.placed-list::-webkit-scrollbar-track { background: transparent; }

.prow {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  font-size: 12px;
}
.prow:hover { background: rgba(255, 255, 255, 0.045); }
.prow.active { background: rgba(62, 198, 192, 0.12); border-color: rgba(62, 198, 192, 0.4); }
.prow .cat-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.prow .pname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .pcoord { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted); }

.search-wrap {
  display: flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 8px; margin-top: 10px;
  border-radius: 8px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22); color: var(--muted);
}
.search-wrap input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-family: inherit; font-size: 12px;
}
.search-wrap input::placeholder { color: rgba(125, 147, 163, 0.6); }

/* ---------- 画布卡 ---------- */
.canvas-card { padding-bottom: 40px; }

.canvas-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-bottom: 8px;
}
.tool-label { font-size: 11px; color: var(--muted); }
.tool-sep {
  width: 1px; height: 16px;
  background: var(--line);
  margin: 0 2px;
}
.zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: rgba(10, 24, 33, 0.7);
}
.zoom-btn {
  min-width: 26px; height: 26px;
  padding: 0 7px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.zoom-btn:hover { background: rgba(86, 200, 232, 0.14); color: var(--cyan); }
.zoom-btn:active { background: rgba(86, 200, 232, 0.24); }
.zoom-btn.reset {
  border-left: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.zoom-btn.reset:hover { color: var(--cyan); }
.zoom-btn:disabled { opacity: 0.35; cursor: default; background: transparent; color: var(--text); }
.zoom-val {
  min-width: 44px;
  cursor: pointer;
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--cyan);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0 4px;
  line-height: 26px;
}
#ringsSlider { width: 140px; accent-color: var(--cyan); cursor: pointer; }
#ringsLabel { color: var(--cyan); font-size: 12px; font-family: var(--mono); min-width: 14px; }
.tool-check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted); cursor: pointer;
  user-select: none;
}
.tool-check input { accent-color: var(--cyan); cursor: pointer; }

.canvas-wrap {
  position: relative;
  height: 560px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:
    radial-gradient(620px 420px at 50% 46%, rgba(24, 62, 74, 0.5) 0%, rgba(8, 18, 26, 0.15) 60%, transparent 100%),
    rgba(4, 10, 15, 0.6);
  overflow: hidden;
}
#map { display: block; width: 100%; height: 100%; cursor: crosshair; }
#map.panning { cursor: grabbing; }

.legend {
  position: static;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 10.5px;
  color: var(--muted);
}
.legend .item { display: flex; align-items: center; gap: 5px; }
.legend .swatch {
  width: 10px; height: 10px;
  transform: rotate(45deg);
  border-radius: 2px;
  border: 1px solid;
}

.tip {
  position: absolute;
  pointer-events: none;
  padding: 6px 9px;
  border-radius: 7px;
  background: rgba(6, 16, 23, 0.94);
  border: 1px solid rgba(159, 232, 255, 0.25);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text);
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  z-index: 5;
}
.tip .t-name { font-weight: 600; }
.tip .t-sub { color: var(--muted); font-family: var(--mono); font-size: 10.5px; }

/* ---------- 底栏 ---------- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 14px;
  font-size: 10px;
  color: rgba(125, 147, 163, 0.65);
}
.footer .sign { font-family: var(--mono); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 11, 0.72);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  z-index: 50;
}
.modal[hidden] { display: none; }

.modal-card {
  width: min(560px, calc(100vw - 40px));
  background: linear-gradient(180deg, #0d1a24, #08121a);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.modal-card h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.modal-card .hint { margin: 0 0 12px; font-size: 11.5px; }

#ta {
  width: 100%;
  height: 220px;
  resize: vertical;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  outline: none;
}
#ta:focus { border-color: rgba(159, 232, 255, 0.35); }

.file-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.file-btn { cursor: pointer; }
.file-name {
  font-size: 11px; color: var(--muted);
  font-family: var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-name.ok { color: var(--cyan); }

.modal-row { display: flex; gap: 14px; margin: 12px 0 4px; }
.modal-row label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 11px; color: var(--muted);
}
.modal-row input {
  width: 150px; height: 30px; padding: 0 9px;
  border-radius: 8px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3); color: var(--text);
  font-family: var(--mono); font-size: 12px; outline: none;
}

.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.spacer { flex: 1; }
