:root {
  --bg: #070a0f;
  --panel: rgba(13, 18, 26, .74);
  --line: rgba(255, 255, 255, .12);
  --text: #e9eef5;
  --muted: rgba(233, 238, 245, .62);
  --accent: #3ee0b0;
  --accent-2: #63a9ff;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#stage { position: fixed; inset: 0; }
#viewer { position: absolute; inset: 0; }
#viewer canvas { display: block; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: absolute; inset: 0 0 auto 0;
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding: 18px 20px 48px;
  background: linear-gradient(180deg, rgba(3, 6, 10, .72), rgba(3, 6, 10, .28) 55%, transparent);
  pointer-events: none;
  z-index: 12;
}
.brand { display: flex; align-items: center; gap: 12px; pointer-events: auto; min-width: 0; }
.logo {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(62, 224, 176, .22), rgba(99, 169, 255, .18));
  border: 1px solid rgba(62, 224, 176, .38);
  color: #d8fff2; font-size: 13px; font-weight: 700; letter-spacing: -.5px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}
.logo small { font-size: 8px; vertical-align: super; }
.logo.big { width: 56px; height: 56px; font-size: 17px; border-radius: 16px; }
.titles { min-width: 0; }
.titles h1 {
  margin: 0; font-size: 17px; font-weight: 600; letter-spacing: .2px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.titles p { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }

.tools { display: flex; gap: 8px; pointer-events: auto; }
.tool {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; cursor: pointer;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: .18s ease;
}
.tool:hover { background: rgba(30, 40, 54, .9); border-color: rgba(255, 255, 255, .24); transform: translateY(-1px); }
.tool.on { color: #06231b; background: linear-gradient(140deg, var(--accent), #7ef0cb); border-color: transparent; }
.tool svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 场景条 ---------- */
.scenes {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; gap: 10px; padding: 8px;
  max-width: min(92vw, 980px); overflow-x: auto; scrollbar-width: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  z-index: 12;
}
.scenes::-webkit-scrollbar { display: none; }
.sceneThumb {
  position: relative; flex: none; width: 108px; height: 62px; border-radius: 10px;
  overflow: hidden; cursor: pointer; border: 2px solid transparent; opacity: .72;
  transition: .2s ease; background: #0b1220;
}
.sceneThumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sceneThumb span {
  position: absolute; inset: auto 0 0 0; padding: 3px 6px;
  font-size: 10.5px; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .8));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sceneThumb:hover { opacity: 1; transform: translateY(-2px); }
.sceneThumb.active { opacity: 1; border-color: var(--accent); }

.hint {
  position: absolute; right: 20px; bottom: 24px; z-index: 11;
  font-size: 11.5px; color: rgba(255, 255, 255, .55);
  background: rgba(6, 10, 16, .5); padding: 6px 10px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .08);
  transition: opacity .5s ease;
}
.scenes:not([hidden]) ~ .hint { opacity: 0; pointer-events: none; }

/* ---------- 说明面板 ---------- */
.infoPanel {
  position: absolute; top: 78px; right: 20px; width: 300px; z-index: 13;
  padding: 18px 20px 16px; border-radius: var(--radius);
  background: rgba(10, 14, 21, .9); border: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
  animation: pop .18s ease;
}
.infoPanel h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; }
.infoPanel p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--muted); white-space: pre-wrap; }
.infoPanel dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 12.5px; }
.infoPanel dt { color: rgba(255, 255, 255, .42); }
.infoPanel dd { margin: 0; color: var(--text); }
.infoPanel .infoFoot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 11.5px; color: rgba(255, 255, 255, .4); }

/* ---------- 加载层 ---------- */
.loader {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px;
  background: radial-gradient(circle at 50% 45%, #101822, #05080c 70%);
  z-index: 20; transition: opacity .5s ease;
}
.loader.hide { opacity: 0; pointer-events: none; }
.loader p { margin: 0; font-size: 13px; color: var(--muted); letter-spacing: .3px; }
.ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .12);
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- 密码锁 ---------- */
.lock { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(4, 7, 11, .93); backdrop-filter: blur(6px); }
.lockCard {
  width: min(90vw, 360px); padding: 30px 28px; border-radius: 20px; text-align: center;
  background: rgba(14, 20, 29, .96); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  display: grid; justify-items: center; gap: 12px;
}
.lockCard h2 { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.lockCard p { margin: 0; font-size: 13px; color: var(--muted); }
.lockCard input {
  width: 100%; margin-top: 6px; padding: 12px 14px; border-radius: 10px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--text);
  font-size: 14px; outline: none;
}
.lockCard input:focus { border-color: rgba(62, 224, 176, .6); }
.lockCard button {
  width: 100%; padding: 12px; border-radius: 10px; border: 0; cursor: pointer;
  background: linear-gradient(140deg, var(--accent), #7ef0cb); color: #04241b;
  font-size: 14px; font-weight: 600;
}
.lockErr { min-height: 16px; font-size: 12px; color: #ff8080; }

/* ---------- 分享弹窗 ---------- */
.modal { position: absolute; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(4, 7, 11, .72); backdrop-filter: blur(4px); }
.modalCard {
  width: min(92vw, 430px); padding: 22px 24px 24px; border-radius: 18px;
  background: rgba(13, 19, 27, .98); border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .65); display: grid; gap: 10px;
}
.modalCard header { display: flex; align-items: center; justify-content: space-between; }
.modalCard h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modalCard .x { background: none; border: 0; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 4px; }
.modalCard label { font-size: 12px; color: rgba(255, 255, 255, .45); margin-top: 6px; }
.copyRow { display: flex; gap: 8px; }
.copyRow input, .modalCard textarea {
  flex: 1; width: 100%; padding: 11px 12px; border-radius: 10px; resize: none;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--text);
  font-size: 12.5px; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.copyRow button {
  padding: 0 16px; border-radius: 10px; border: 0; cursor: pointer; white-space: nowrap;
  background: rgba(62, 224, 176, .16); color: #9cf5da; font-size: 13px; font-weight: 600;
  border: 1px solid rgba(62, 224, 176, .3);
}
.qrWrap { display: grid; place-items: center; padding: 12px; background: #fff; border-radius: 14px; }
.qrWrap img { width: 168px; height: 168px; display: block; }
.openLink { font-size: 12.5px; color: var(--accent-2); text-decoration: none; justify-self: start; }
.openLink:hover { text-decoration: underline; }

/* ---------- 嵌入模式 ---------- */
body.embed .topbar { padding: 12px 14px 36px; }
body.embed .sceneThumb { width: 86px; height: 50px; }
body.embed .hint { display: none; }
body.embed .infoPanel { top: 64px; }

/* ---------- 热点 ---------- */
.pnlm-about-msg { display: none !important; }
.pnlm-hotspot-base { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5)); }
.pnlm-tooltip span {
  background: rgba(10, 15, 22, .92) !important;
  border: 1px solid rgba(255, 255, 255, .15);
  padding: 7px 11px !important; border-radius: 9px !important;
  font-size: 12.5px !important; color: #e9eef5 !important; max-width: 240px;
}
.pnlm-hotspot-base.pnlm-info {
  background-image: none; background: rgba(62, 224, 176, .95);
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .92);
  box-shadow: 0 0 0 7px rgba(62, 224, 176, .16), 0 4px 16px rgba(0, 0, 0, .45);
  animation: hsPulse 2.6s ease-in-out infinite;
}
@keyframes hsPulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(62, 224, 176, .14), 0 4px 16px rgba(0, 0, 0, .45); }
  50% { box-shadow: 0 0 0 12px rgba(62, 224, 176, .05), 0 4px 16px rgba(0, 0, 0, .45); }
}

@media (max-width: 640px) {
  .titles h1 { font-size: 15px; }
  .tool { width: 36px; height: 36px; }
  .scenes { bottom: 14px; }
  .hint { display: none; }
  .infoPanel { top: 70px; left: 12px; right: 12px; width: auto; }
}
