:root {
  --ink: #f3ead9;
  --ink-dim: rgba(243, 234, 217, 0.62);
  --glass: rgba(24, 20, 27, 0.62);
  --glass-line: rgba(233, 200, 160, 0.18);
  --accent: #e6b26a;
  --accent-dim: #a97f47;
  --danger: #e0755f;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
}

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

html, body {
  height: 100%;
  background: #120f16;
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app { position: relative; width: 100vw; height: 100vh; overflow: hidden; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- 进入页 ---------- */
.intro {
  position: absolute; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 50% 78%, rgba(230, 178, 106, 0.16), transparent 42%),
    linear-gradient(180deg, #14111a 0%, #1d1822 45%, #2a211f 100%);
  transition: opacity 0.8s ease;
}
.intro.fade { opacity: 0; pointer-events: none; }
.intro-inner { text-align: center; padding: 32px; }
.intro-mark {
  font-family: var(--serif);
  font-size: 15px; letter-spacing: 0.9em; text-indent: 0.9em;
  color: var(--accent-dim); margin-bottom: 22px;
}
.intro h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(34px, 6vw, 58px); letter-spacing: 0.32em; text-indent: 0.32em;
  margin-bottom: 18px;
}
.intro p { color: var(--ink-dim); font-size: 14px; line-height: 2; letter-spacing: 0.06em; }
.intro .primary { margin-top: 30px; }
/* ---------- 通用按钮 ---------- */
button { font-family: inherit; color: inherit; cursor: pointer; border: none; background: none; }

.primary {
  padding: 12px 34px;
  border-radius: 999px;
  border: 1px solid rgba(230, 178, 106, 0.45);
  background: linear-gradient(180deg, rgba(230, 178, 106, 0.22), rgba(230, 178, 106, 0.08));
  color: var(--ink);
  font-size: 14px; letter-spacing: 0.22em; text-indent: 0.22em;
  transition: background 0.25s, transform 0.2s;
  text-decoration: none;
  display: inline-block;
}
.primary:hover { background: rgba(230, 178, 106, 0.32); transform: translateY(-1px); }
.text-btn { margin-top: 14px; color: var(--ink-dim); font-size: 12.5px; letter-spacing: 0.1em; }
.text-btn:hover { color: var(--ink); }

/* ---------- 顶部 ---------- */
.hud-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  background: linear-gradient(180deg, rgba(12, 10, 14, 0.66), transparent);
  pointer-events: none;
}
.hud-top .pill, .hud-top .icon-btn { pointer-events: auto; }

.pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px);
  font-size: 13px;
}
.pill-label { color: var(--ink-dim); font-size: 11.5px; letter-spacing: 0.16em; }
.pill strong { font-weight: 500; letter-spacing: 0.08em; }

.bow-pill { position: relative; min-width: 178px; }
.bow-bar {
  position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px;
  background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden;
}
.bow-bar i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.4s ease;
}

.top-right { margin-left: auto; display: flex; gap: 8px; }

/* 小地图：贴在顶栏下方，随顶栏换行自动下移 */
.minimap {
  position: absolute; top: 100%; right: 18px;
  width: 112px; height: 144px;
  border-radius: 14px;
  background: rgba(18, 15, 21, 0.55);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(8px);
  pointer-events: none;
}

.net-pill { color: var(--ink-dim); font-size: 12px; transition: color 0.3s; }
.net-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #8d8378;
  box-shadow: 0 0 6px rgba(141, 131, 120, 0.6);
  transition: background 0.3s, box-shadow 0.3s;
}
.net-pill.online { color: var(--ink); }
.net-pill.online .dot {
  background: #6fc39a;
  box-shadow: 0 0 8px rgba(111, 195, 154, 0.85);
}

.icon-btn {
  padding: 8px 14px; border-radius: 999px; font-size: 12.5px; letter-spacing: 0.08em;
  background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(10px);
  transition: background 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: rgba(40, 34, 44, 0.8); border-color: rgba(230, 178, 106, 0.4); }
.icon-btn.off { color: rgba(243, 234, 217, 0.4); }

/* ---------- 底部动作 ---------- */
.hud-bottom {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 20; display: flex; gap: 10px;
  padding: 9px 12px;
  border-radius: 26px;
  background: rgba(18, 15, 21, 0.55);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(14px);
}
.action {
  width: 76px; height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  border-radius: 18px;
  font-size: 12.5px; letter-spacing: 0.1em;
  color: var(--ink-dim);
  transition: color 0.2s, background 0.2s, transform 0.15s;
}
.action .dot {
  width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid rgba(233, 200, 160, 0.34);
  position: relative;
}
.action .dot::after {
  content: ""; position: absolute; inset: 7px; border-radius: 50%;
  background: rgba(233, 200, 160, 0.22);
  transition: background 0.2s;
}
.action:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.action:hover .dot::after { background: var(--accent); }
.action.active { color: var(--accent); background: rgba(230, 178, 106, 0.12); }
.action.active .dot::after { background: var(--accent); }
.action:active { transform: scale(0.96); }

/* ---------- 提示 / toast ---------- */
.hint {
  position: absolute; left: 50%; bottom: 118px; transform: translateX(-50%);
  z-index: 18;
  padding: 8px 16px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: 0.08em;
  background: rgba(18, 15, 21, 0.72); border: 1px solid var(--glass-line);
  backdrop-filter: blur(10px); color: var(--ink-dim);
  pointer-events: none;
}
.hint b { color: var(--accent); font-weight: 500; }

.toasts {
  position: absolute; left: 50%; top: 76px; transform: translateX(-50%);
  z-index: 30; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 9px 18px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: 0.06em;
  background: rgba(18, 15, 21, 0.82); border: 1px solid rgba(230, 178, 106, 0.3);
  backdrop-filter: blur(10px);
  animation: toastIn 0.35s ease both;
}
.toast.out { animation: toastOut 0.5s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px); } }

/* ---------- 面板 / 弹窗 ---------- */
.panel {
  position: absolute; right: 20px; bottom: 118px; z-index: 32;
  width: 268px; padding: 20px;
  border-radius: 20px;
  background: rgba(22, 18, 25, 0.88);
  border: 1px solid var(--glass-line);
  backdrop-filter: blur(16px);
  animation: panelIn 0.28s ease both;
}
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel h3, .modal h3 { font-family: var(--serif); font-weight: 500; font-size: 17px; letter-spacing: 0.16em; }
.panel .muted, .modal .muted { color: var(--ink-dim); font-size: 12px; margin-top: 6px; line-height: 1.8; }

.colors { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.color {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-line);
  font-size: 12px;
}
.color i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.color:hover { border-color: var(--c); }

.modal {
  position: absolute; inset: 0; z-index: 35;
  display: grid; place-items: center;
  background: rgba(9, 7, 11, 0.62);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  width: min(360px, 88vw); padding: 26px;
  border-radius: 22px;
  background: rgba(24, 20, 28, 0.96);
  border: 1px solid var(--glass-line);
  text-align: center;
  animation: panelIn 0.3s ease both;
}
.modal-card.wide { width: min(460px, 90vw); }
.modal-card .close {
  position: absolute; top: 12px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 18px; line-height: 1; color: var(--ink-dim);
}
.modal-card .close:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
#qrImage { margin: 18px auto 6px; border-radius: 12px; background: #fff; padding: 8px; display: block; width: 220px; height: auto; }
.qr-note { font-size: 11px; color: rgba(243, 234, 217, 0.4); line-height: 1.7; margin-top: 8px; }
.wide-btn { width: 100%; margin-top: 16px; }
#photoImg { width: 100%; border-radius: 14px; margin-top: 16px; }

.server-list { list-style: none; margin-top: 16px; max-height: 46vh; overflow-y: auto; }
.server-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; margin-bottom: 8px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid var(--glass-line);
  font-size: 13px; cursor: pointer;
}
.server-list li:hover { border-color: rgba(230, 178, 106, 0.45); }
.server-list li.full { opacity: 0.4; cursor: not-allowed; }
.server-list li.here { border-color: var(--accent); color: var(--accent); }
.server-list em { font-style: normal; font-size: 11.5px; color: var(--ink-dim); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 16px 0; font-size: 13px; }
.row span { color: var(--ink-dim); letter-spacing: 0.08em; }
.row input[type="range"] { width: 150px; accent-color: var(--accent); }
.ambient-row { flex-direction: column; align-items: flex-start; gap: 10px; }
.segs { display: flex; flex-wrap: wrap; gap: 8px; }
.segs button {
  padding: 6px 13px; border-radius: 999px; font-size: 12px; letter-spacing: 0.08em;
  color: var(--ink-dim); background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-line); transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.segs button:hover { color: var(--ink); }
.segs button.on {
  color: var(--ink); background: rgba(230, 178, 106, 0.16);
  border-color: rgba(230, 178, 106, 0.55);
}

/* ---------- 满堂排队 ---------- */
.wait-layer {
  position: absolute; inset: 0; z-index: 36;
  display: grid; place-items: center;
  background: rgba(9, 7, 11, 0.58);
  backdrop-filter: blur(4px);
}
.wait-card {
  width: min(340px, 86vw); padding: 28px 26px;
  border-radius: 22px;
  background: rgba(24, 20, 28, 0.96);
  border: 1px solid var(--glass-line);
  text-align: center;
  animation: panelIn 0.3s ease both;
}
.wait-card h3 { font-family: var(--serif); font-weight: 500; font-size: 17px; letter-spacing: 0.16em; }
.wait-card .muted { color: var(--ink-dim); font-size: 12.5px; margin-top: 10px; line-height: 1.9; }

.help {
  position: absolute; left: 18px; bottom: 22px; z-index: 15;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 11px; color: rgba(243, 234, 217, 0.32); letter-spacing: 0.06em;
  pointer-events: none;
}
.help strong { color: rgba(243, 234, 217, 0.5); font-weight: 500; letter-spacing: 0.2em; margin-bottom: 2px; }

@media (max-width: 720px) {
  .hud-top { padding: 12px; flex-wrap: wrap; }
  .bow-pill { min-width: 150px; }
  .hud-bottom { bottom: 18px; gap: 4px; padding: 8px; }
  .action { width: 64px; height: 58px; font-size: 11.5px; }
  .help { display: none; }
  .panel { right: 12px; left: 12px; width: auto; bottom: 104px; }
  .minimap { width: 94px; height: 124px; right: 12px; border-radius: 12px; }
}
