:root {
  /* 主题：科技创新助力非遗文化传承 */
  --bg: #100c0a;           /* 墨黑 */
  --panel: rgba(24, 18, 15, 0.93);
  --panel-solid: #171210;
  --border: #3a2c25;
  --text: #f3ece0;          /* 宣纸米白 */
  --muted: #a89b8c;
  --accent: #c8443a;        /* 朱红 */
  --accent-deep: #7d2620;   /* 绛红 */
  --accent-2: #5d8b86;      /* 青瓷（科技冷色点缀） */
  --brass: #c9a86a;         /* 鎏金 */
  --dai: #2f4a4f;           /* 黛青 */
  --paper: #f3ece0;
  --danger: #e5674f;
  --radius: 12px;
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --font-title: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", serif;
}

h1, h2, h3, .title, .brand, .plaque {
  font-family: var(--font-title);
  letter-spacing: 0.06em;
}
.seal {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: linear-gradient(180deg, #c8443a, #8f2b23);
  border: 1px solid rgba(201, 168, 106, 0.65);
  color: #fdf6ea;
  font-family: var(--font-title);
  font-size: 12px;
  letter-spacing: 0.12em;
}
.rule-gold {
  height: 2px;
  background: linear-gradient(90deg, rgba(201, 168, 106, 0) 0%, rgba(201, 168, 106, 0.85) 50%, rgba(201, 168, 106, 0) 100%);
  margin: 12px 0;
}
.tech-tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid rgba(93, 139, 134, 0.65);
  border-radius: 3px;
  color: #8fc0ba;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-family: ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(93, 139, 134, 0.10) 0%, rgba(0, 0, 0, 0) 55%),
    radial-gradient(ellipse at 12% 108%, rgba(200, 68, 58, 0.12) 0%, rgba(0, 0, 0, 0) 45%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #1b2130;
  color: var(--text);
  padding: 9px 16px;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
button:hover { background: #232b3d; border-color: #3a4459; }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #6ba0ff; }
button.danger { background: transparent; border-color: #503; color: var(--danger); }
button.danger:hover { background: rgba(255, 107, 107, 0.12); }

input, textarea {
  font-family: inherit;
  font-size: 15px;
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: #0f1319;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 62px; }
label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 13px; }

.hint { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }
.ok { color: var(--accent-2); font-size: 14px; min-height: 20px; }

/* ---------------- 登录 / 注册 ---------------- */
.auth-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: radial-gradient(circle at 20% 10%, #16203a 0%, #0d1017 55%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tabs button { flex: 1; background: transparent; }
.tabs button.active { background: #1f2739; border-color: var(--accent); color: #fff; }
.field { margin-bottom: 14px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.form-actions button { width: 100%; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-solid);
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .who { color: var(--muted); font-size: 13px; }
.topbar nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }

/* 角色徽章 */
.who { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.7;
  border: 1px solid transparent;
}
.badge-admin { background: rgba(79, 140, 255, 0.18); border-color: #4f8cff; color: #9dc0ff; }
.badge-viewer { background: rgba(148, 161, 184, 0.14); border-color: #4a5468; color: #aab6c9; }

.notice {
  border: 1px solid #4a5468;
  border-left: 3px solid var(--accent);
  background: #141a26;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
}
.notice b { color: var(--text); }

.container { max-width: 1120px; margin: 0 auto; padding: 24px 22px 60px; }
.card {
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 22px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .desc { color: var(--muted); font-size: 13px; margin: 0 0 16px; }

/* ---------------- 上传 ---------------- */
.drop {
  border: 1px dashed #33405a;
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--muted);
  background: #0f1319;
  cursor: pointer;
}
.drop.over { border-color: var(--accent); color: var(--text); }
.upload-list { margin-top: 18px; display: grid; gap: 14px; }
.upload-item {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0f1319;
}
.upload-item img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; background: #05070b; }
.upload-item .col { display: grid; gap: 8px; }
.row-actions { margin-top: 16px; display: flex; gap: 12px; align-items: center; }

/* ---------------- 展品列表 ---------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.exhibit {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #0f1319;
  display: flex;
  flex-direction: column;
}
.exhibit .thumb { width: 100%; height: 150px; object-fit: cover; background: #05070b; }
.exhibit .body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.exhibit .title { font-weight: 600; word-break: break-all; }
.exhibit .meta { color: var(--muted); font-size: 12px; }
.exhibit .foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.empty { color: var(--muted); text-align: center; padding: 26px; }

/* ---------------- 3D 展厅 ---------------- */
#scene { position: fixed; inset: 0; display: block; touch-action: none; }
html, body { overscroll-behavior: none; }
.overlay { position: fixed; z-index: 5; }

.hud-top {
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 18px;
  background: linear-gradient(180deg, rgba(9, 12, 18, 0.85), rgba(9, 12, 18, 0));
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.hud-top .title { font-weight: 700; letter-spacing: 1px; }
.hud-top .stats { color: var(--muted); font-size: 13px; }
.hud-top nav { display: flex; gap: 10px; align-items: center; }
.hud-top nav a, .hud-top nav button { font-size: 13px; padding: 7px 12px; border-radius: 8px; background: rgba(24, 30, 43, 0.85); border: 1px solid var(--border); color: var(--text); }
.hud-top nav a { display: inline-block; }

.crosshair {
  top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
  z-index: 15;
  pointer-events: none; opacity: 0.85;
}
.crosshair::before, .crosshair::after {
  content: ""; position: absolute; background: #eef3ff;
}
.crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; }
.crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }

.guide {
  top: 74px; left: 50%; transform: translateX(-50%);
  z-index: 20;
  pointer-events: none;
  background: rgba(18, 22, 31, 0.88);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 18px;
  font-size: 13px;
  color: #d7e0f0;
  max-width: calc(100vw - 60px);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.info-panel {
  left: 50%; bottom: 42px; transform: translateX(-50%);
  z-index: 12;
  width: min(680px, calc(100vw - 40px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  display: none;
  backdrop-filter: blur(4px);
}
.info-panel.show { display: block; }
.info-panel h3 { margin: 0 0 4px; font-size: 17px; }
.info-panel .meta { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.info-panel p { margin: 0; white-space: pre-wrap; }

.help {
  right: 18px; bottom: 18px;
  z-index: 20;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--muted);
  max-width: 280px;
}
.help.collapsed { display: none; }
.help b { color: var(--text); }

.gate {
  inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 9, 14, 0.82);
  z-index: 10;
  /* 全屏遮罩只作为视觉背景，不拦截点击；只有中间的对话框可交互 */
  pointer-events: none;
}
.gate.hidden { display: none; }
.gate .box {
  pointer-events: auto;
  text-align: center;
  background: var(--panel-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 40px;
  max-width: 460px;
}
.gate h2 { margin: 0 0 10px; }
.gate p { color: var(--muted); margin: 0 0 20px; }
.gate kbd {
  background: #222a3a; border: 1px solid var(--border); border-radius: 5px;
  padding: 1px 6px; font-family: inherit; font-size: 13px;
}

.toast {
  left: 50%; top: 76px; transform: translateX(-50%);
  z-index: 22;
  pointer-events: none;  background: rgba(20, 26, 38, 0.95);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  display: none;
}
.toast.show { display: block; }

/* ---------------- 触摸端：虚拟摇杆 ---------------- */.joystick {
  width: 112px;
  height: 112px;
  margin: -56px 0 0 -56px;
  border: 2px dashed rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  background: rgba(20, 26, 38, 0.28);
  z-index: 14;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s;
}
.joystick.active { opacity: 1; }
.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46px;
  height: 46px;
  margin: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.8);
  transform: translate(-50%, -50%);
}

.kb-touch { display: none; }

/* ---------------- 移动端 / 窄屏适配 ---------------- */
@media (max-width: 760px), (pointer: coarse) {
  .kb-desktop { display: none; }
  .kb-touch { display: inline; }
  .crosshair { display: none; }
  .hud-top {
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
  }
  .hud-top .title { font-size: 14px; }
  .hud-top .stats { font-size: 11px; }
  .hud-top nav { gap: 6px; flex-wrap: wrap; justify-content: flex-start; }
  .hud-top nav a,
  .hud-top nav button {
    font-size: 11px;
    padding: 6px 9px;
  }
  .who { font-size: 11px; }
  .badge { font-size: 10px; padding: 1px 7px; }
  .guide {
    top: auto;
    bottom: 132px;
    font-size: 11px;
    padding: 6px 12px;
    white-space: normal;
    border-radius: 12px;
    max-width: calc(100vw - 20px);
  }
  .help {
    right: 8px;
    bottom: 8px;
    left: 8px;
    max-width: none;
    font-size: 12px;
    padding: 10px 12px;
  }
  .info-panel {
    bottom: 8px;
    width: calc(100vw - 16px);
    padding: 12px 14px;
  }
  .info-panel h3 { font-size: 15px; }
  .gate .box { padding: 24px 20px; }
  .toast { top: auto; bottom: 190px; font-size: 12px; }
}

/* 手机横屏：HUD 更紧凑，避免遮住画面中心 */
@media (max-height: 520px) and (orientation: landscape) {
  .hud-top { padding: 5px 8px; }
  .hud-top .title { font-size: 12px; }
  .hud-top .stats { display: none; }
  .hud-top nav a,
  .hud-top nav button { font-size: 10px; padding: 4px 7px; }
  .guide { bottom: 8px; font-size: 10px; padding: 4px 10px; }
  .info-panel { bottom: 6px; width: min(560px, calc(100vw - 12px)); padding: 8px 12px; }
  .info-panel h3 { font-size: 14px; }
  .info-panel p { font-size: 12px; }
  .help { display: none; }
  .toast { bottom: 60px; }
}

/* ---------------- 氛围与层次 ---------------- */
.vignette {
  inset: 0;
  z-index: 11;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 45%,
    rgba(0, 0, 0, 0) 42%,
    rgba(4, 7, 12, 0.28) 78%,
    rgba(3, 5, 9, 0.55) 100%
  );
}

.fade-in { animation: fadeIn 0.6s var(--ease) both; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.guide { animation: fadeIn 0.8s var(--ease) 0.15s both; }

.info-panel {
  transition: opacity 0.22s var(--ease), transform 0.28s var(--ease);
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
}
.info-panel.show {
  display: block;
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast {
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* HUD 按钮：悬浮/按下反馈更明确 */
.hud-top nav a,
.hud-top nav button { transition: background 0.16s var(--ease), border-color 0.16s var(--ease), transform 0.12s var(--ease); }
.hud-top nav a:hover,
.hud-top nav button:hover { background: rgba(40, 50, 70, 0.95); border-color: var(--brass); }
.hud-top nav a:active,
.hud-top nav button:active { transform: translateY(1px); }

/* ---------------- 登录 / 注册页视觉 ---------------- */
.auth-wrap {
  background: radial-gradient(circle at 18% 8%, #17203a 0%, #0d1017 52%), radial-gradient(circle at 82% 92%, #1a2436 0%, rgba(0, 0, 0, 0) 45%);
}
.auth-card {
  box-shadow: var(--shadow-lg);
  border-color: #303a4d;
  animation: fadeIn 0.5s var(--ease) both;
  background-image: linear-gradient(180deg, rgba(30, 38, 53, 0.65), rgba(18, 22, 31, 0) 40%);
}
.auth-card h1 {
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #f2f5fb, var(--brass));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-card .sub { margin-bottom: 20px; }
.tabs button { transition: background 0.18s var(--ease), color 0.18s var(--ease), border-color 0.18s var(--ease); }
.tabs button.active { box-shadow: inset 0 0 0 1px rgba(201, 168, 106, 0.35); }
input:focus, textarea:focus { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(201, 168, 106, 0.12); }
button.primary { background: linear-gradient(180deg, #6ba0ff, #3f7ae8); border-color: #5b93ff; }
button.primary:hover { background: linear-gradient(180deg, #7dacff, #4a86f0); }
button:disabled { filter: saturate(0.6); }
.spin { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 管理页视觉 ---------------- */
.topbar { box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35); }
.card { transition: border-color 0.2s var(--ease), transform 0.2s var(--ease); }
.drop { transition: border-color 0.2s var(--ease), background 0.2s var(--ease), transform 0.15s var(--ease); }
.drop:hover { border-color: #3d4a63; background: #111722; }
.drop.over { border-color: var(--brass); background: #141b26; transform: scale(1.005); }
.upload-item { animation: fadeIn 0.3s var(--ease) both; transition: border-color 0.2s var(--ease); }
.upload-item:hover { border-color: #3a4459; }
.exhibit { transition: transform 0.22s var(--ease), border-color 0.22s var(--ease), box-shadow 0.22s var(--ease); }
.exhibit:hover { transform: translateY(-3px); border-color: #3d4a63; box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45); }
.exhibit .thumb { transition: transform 0.35s var(--ease); }
.exhibit:hover .thumb { transform: scale(1.04); }
.grid { animation: fadeIn 0.35s var(--ease) both; }
.hint, .ok, .error { transition: color 0.2s var(--ease); }

/* 窄屏下管理页/登录页的额外收紧 */
@media (max-width: 520px) {
  .container { padding: 16px 12px 40px; }
  .card { padding: 16px 14px; }
  .upload-item { grid-template-columns: 72px 1fr; }
  .upload-item img { width: 72px; height: 72px; }
  .auth-card { padding: 22px 18px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .exhibit .thumb { height: 116px; }
}

/* ---------------- 用户管理 / 操作日志（超管） ---------------- */
.badge-super {
  background: linear-gradient(180deg, #c8443a, #8f2b23);
  border-color: rgba(201, 168, 106, 0.7);
  color: #fdf6ea;
  font-family: var(--font-title);
  letter-spacing: 0.08em;
}
.edit-input {
  width: 100%;
  box-sizing: border-box;
  margin: 4px 0;
  padding: 6px 8px;
  background: #0f141c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
}
.edit-input:focus { border-color: var(--brass); outline: none; }
.admin-list { display: flex; flex-direction: column; gap: 8px; }
.admin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(22, 17, 14, 0.62);
}
.admin-row .name { font-weight: 600; }
.admin-row .foot { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-row select,
.admin-row button { font-size: 12px; padding: 5px 8px; }
.admin-row.disabled .name { text-decoration: line-through; opacity: 0.6; }
.audit-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
  font-size: 12.5px;
}
.audit-row .act {
  color: var(--brass);
  font-family: ui-monospace, Consolas, monospace;
  margin-right: 6px;
}
@media (max-width: 520px) {
  .audit-row { grid-template-columns: 1fr; }
}

/* ---------------- 立轴特写（展厅内放大查看） ---------------- */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 5, 4, 0.82);
  backdrop-filter: blur(3px);
}
.detail-modal.show { display: flex; animation: fadeIn 0.24s var(--ease) both; }
.detail-card {
  width: min(760px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: linear-gradient(180deg, rgba(28, 21, 17, 0.98), rgba(18, 14, 12, 0.98));
  border: 1px solid rgba(201, 168, 106, 0.5);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
  animation: detailIn 0.3s var(--ease) both;
}
@keyframes detailIn {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.detail-scroll {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 18px;
}
.detail-scroll img {
  width: 100%;
  border: 1px solid rgba(201, 168, 106, 0.45);
  border-radius: 6px;
  background: #120e0c;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5);
}
.detail-mount {
  padding: 10px;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #7d2620, #7d2620 6px, #71211c 6px, #71211c 12px);
}
.detail-card h3 { margin: 0 0 4px; font-size: 22px; }
.detail-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.detail-card p { white-space: pre-wrap; }
@media (max-width: 640px) {
  .detail-scroll { grid-template-columns: 1fr; }
  .detail-card { padding: 14px; }
}
