:root {
  color-scheme: dark;
  --bg: #06101a;
  --panel: rgba(7, 20, 34, 0.82);
  --line: rgba(71, 176, 232, 0.30);
  --blue: #42a8ff;
  --cyan: #45e2e8;
  --text: #eff8ff;
  --muted: #82a0b8;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
}

button { font: inherit; }

#stage {
  position: fixed;
  inset: 0;
  background: #000;
}

#stage canvas { display: block; cursor: grab; }
#stage canvas:active { cursor: grabbing; }

#floor-labels {
  position: fixed;
  inset: 0;
  z-index: 9;
  overflow: hidden;
  pointer-events: none;
}

.floor-label {
  position: absolute;
  min-width: 122px;
  padding: 7px 10px 7px 13px;
  color: #b9d7e8;
  background: rgba(4, 16, 28, 0.84);
  border: 1px solid rgba(68, 190, 238, 0.34);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  opacity: 0;
  transform: translate(12px, -50%);
  transition: opacity 160ms ease, border-color 160ms ease, background 160ms ease;
  pointer-events: auto;
  cursor: pointer;
}

.floor-label::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #35cfff;
  box-shadow: 0 0 10px rgba(53, 207, 255, 0.72);
}

.floor-label::after {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 15px;
  border-top: 1px solid rgba(75, 215, 255, 0.62);
  box-shadow: 0 0 7px rgba(53, 207, 255, 0.36);
}

.floor-label b { display: block; color: #effaff; font-size: 12px; letter-spacing: 1px; }
.floor-label span { display: block; margin-top: 2px; color: #6f91a9; font-size: 9px; }
.floor-label.active {
  border-color: rgba(110, 218, 255, 0.92);
  background: linear-gradient(90deg, rgba(11, 61, 91, 0.97), rgba(5, 28, 46, 0.94));
  box-shadow: 0 0 18px rgba(45, 166, 220, 0.26);
}
.floor-label.active::before { width: 3px; background: #7cdcff; }
.floor-label.active b { color: #ffffff; }
.floor-label.active span { color: #9fc7dc; }

.campus-marker {
  position: absolute;
  min-width: 128px;
  padding: 7px 12px 8px;
  color: #eaf8ff;
  background: linear-gradient(180deg, rgba(7, 29, 46, 0.94), rgba(4, 17, 29, 0.90));
  border: 1px solid rgba(74, 200, 240, 0.46);
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36), 0 0 14px rgba(42, 169, 219, 0.10);
  transform: translate(-50%, calc(-100% - 29px));
  transition: opacity 160ms ease, border-color 160ms ease, filter 160ms ease;
  pointer-events: auto;
  cursor: pointer;
  font: inherit;
  text-align: center;
}

.campus-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 29px;
  background: linear-gradient(rgba(89, 215, 255, 0.80), rgba(89, 215, 255, 0.08));
  box-shadow: 0 0 7px rgba(66, 190, 232, 0.36);
}

.campus-marker b { display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; letter-spacing: 1px; }
.campus-marker span { display: block; margin-top: 3px; color: #799cb4; font-size: 9px; }
.campus-marker b em {
  display: inline-block;
  padding: 2px 5px;
  border: 1px solid rgba(255, 104, 91, 0.46);
  border-radius: 2px;
  color: #ff9d8f;
  background: rgba(133, 27, 31, .18);
  font-style: normal;
  font-weight: 600;
  font-size: 8px;
  letter-spacing: 0;
}
.campus-marker:hover,
.campus-marker.active {
  border-color: rgba(106, 224, 255, 0.94);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.36), 0 0 20px rgba(54, 185, 230, 0.24);
}
.campus-marker.muted { filter: saturate(0.65) brightness(0.72); }
.campus-name-marker {
  min-width: 154px;
  color: #83edf0;
  border-color: rgba(71, 226, 222, 0.52);
  background: rgba(4, 20, 31, 0.90);
  pointer-events: none;
}

/* V56: empty floors carry only their floor number; room floors carry the drill-down cue. */
.floor-label:not(.has-room) {
  min-width: 56px;
  padding: 6px 10px;
  text-align: center;
  background: rgba(4, 16, 28, .68);
  border-color: rgba(68, 190, 238, .22);
}

.floor-label:not(.has-room)::before { opacity: .46; }
.floor-label:not(.has-room) b { color: #afc7d5; font-size: 11px; font-weight: 500; letter-spacing: .8px; }

.floor-label.has-room {
  min-width: 164px;
  padding: 9px 12px 9px 14px;
  border-color: rgba(96, 220, 234, .62);
  background: linear-gradient(90deg, rgba(9, 54, 76, .96), rgba(4, 24, 38, .93));
  box-shadow: 0 0 20px rgba(48, 189, 218, .18), 0 8px 26px rgba(0, 0, 0, .34);
}

.floor-label.has-room b { color: #f1fcff; font-size: 13px; font-weight: 700; }
.floor-label.has-room span { margin-top: 4px; color: #a8d8e6; font-size: 11px; font-weight: 600; }
.floor-label.has-room::before { width: 3px; background: #69e4ec; }

.topbar {
  position: fixed;
  z-index: 10;
  top: 0;
  left: 0;
  right: 0;
  height: 72px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(4, 12, 22, 0.78);
  border-bottom: 1px solid rgba(73, 145, 199, 0.20);
  backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 13px; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(92, 191, 255, 0.72);
  transform: rotate(45deg);
  box-shadow: 0 0 22px rgba(42, 143, 255, 0.28);
}

.brand-mark span {
  width: 14px;
  height: 14px;
  display: block;
  border: 3px solid #58baff;
}

.brand h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: 3px; }
.brand p { margin: 4px 0 0; font-size: 8px; color: #6e90aa; letter-spacing: 3px; }

.status {
  padding: 7px 12px;
  color: #9bc0d8;
  font-size: 12px;
  border: 1px solid rgba(81, 168, 226, 0.22);
  background: rgba(7, 22, 36, 0.55);
}

.status i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #41dfa0;
  box-shadow: 0 0 9px #41dfa0;
}

.title-card {
  position: fixed;
  z-index: 10;
  left: 28px;
  top: 104px;
  width: 310px;
  padding: 20px 21px 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.title-card::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18px;
  width: 3px;
  height: 44px;
  background: var(--blue);
  box-shadow: 0 0 14px rgba(66, 168, 255, 0.72);
}

.eyebrow { margin: 0 0 10px; color: #59aff0; font-size: 11px; letter-spacing: 2px; }
.title-card h2 { margin: 0; font-size: 26px; font-weight: 500; letter-spacing: 2px; }
.title-card .desc { margin: 9px 0 18px; color: var(--muted); font-size: 11px; line-height: 1.7; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metrics div { padding: 10px 8px; background: rgba(35, 82, 116, 0.16); border-top: 1px solid rgba(74, 162, 224, 0.24); }
.metrics span { display: block; color: #ddf4ff; font: 600 15px/1.2 "Segoe UI", sans-serif; }
.metrics small { display: block; margin-top: 5px; color: #6f91a9; font-size: 9px; }

.scene-tools {
  position: fixed;
  z-index: 12;
  right: 28px;
  top: 96px;
  display: flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(73, 145, 199, 0.22);
  background: rgba(5, 17, 29, 0.76);
  backdrop-filter: blur(16px);
}

.scene-tools button {
  min-width: 64px;
  padding: 8px 12px;
  border: 1px solid transparent;
  color: #7f9db4;
  background: transparent;
  cursor: pointer;
  transition: 180ms ease;
}

.scene-tools button:hover { color: #dff6ff; border-color: rgba(72, 175, 235, 0.34); }
.scene-tools button.active { color: #04131c; background: #63b8f4; box-shadow: 0 0 14px rgba(66, 168, 255, 0.32); }
.scene-tools .divider { width: 1px; margin: 4px 2px; background: rgba(95, 156, 194, 0.20); }

.selection-card {
  position: fixed;
  z-index: 10;
  right: 28px;
  bottom: 76px;
  width: 280px;
  padding: 17px 18px;
  border: 1px solid rgba(80, 174, 233, 0.34);
  background: rgba(6, 19, 32, 0.86);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 220ms ease;
}

.selection-card.open { opacity: 1; transform: translateY(0); }
.selection-card.xray {
  border-color: rgba(100, 218, 255, 0.62);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.34), 0 0 34px rgba(51, 174, 255, 0.16);
}
.selection-card.xray::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 18px;
  width: 3px;
  height: 44px;
  background: #72e6ff;
  box-shadow: 0 0 16px rgba(76, 207, 255, 0.86);
}
.card-kicker { color: #49aae9; font-size: 10px; letter-spacing: 2px; }
.selection-card h3 { margin: 7px 0 13px; font-size: 18px; font-weight: 500; }
.selection-card dl { margin: 0; }
.selection-card dl div { display: flex; justify-content: space-between; padding: 6px 0; border-top: 1px solid rgba(87, 148, 187, 0.14); font-size: 11px; }
.selection-card dt { color: #7897ad; }
.selection-card dd { margin: 0; color: #d9eef9; }
.selection-card dd.ok { color: #42e4a3; }
.selection-card p { margin: 12px 0 0; color: #6e8da4; font-size: 10px; line-height: 1.6; }

.view-hint {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  gap: 18px;
  padding: 9px 17px;
  color: #6f91a9;
  font-size: 10px;
  background: rgba(4, 14, 24, 0.74);
  border: 1px solid rgba(73, 145, 199, 0.18);
  backdrop-filter: blur(14px);
}

.view-hint b { color: #b8d9ec; font-weight: 500; }

.loading {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 17px;
  background: #06101a;
  transition: opacity 420ms ease;
}

.loading.done { opacity: 0; pointer-events: none; }
.loading p { margin: 0; color: #7697b0; font-size: 11px; letter-spacing: 3px; }
.loader { width: 42px; height: 42px; border-radius: 50%; border: 2px solid rgba(91, 173, 229, 0.18); border-top-color: #57b5f3; animation: spin 900ms linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

html.embed .topbar,
html.embed .title-card,
html.embed .scene-tools,
html.embed .selection-card,
html.embed .view-hint { display: none !important; }

html.embed #floor-labels { display: block; }
html.embed .floor-label {
  min-width: 136px;
  padding: 6px 9px 6px 12px;
  background: linear-gradient(90deg, rgba(4, 19, 33, 0.94), rgba(4, 16, 28, 0.74));
  backdrop-filter: blur(8px);
}
html.embed .xray-floor-label { transform: translate(15px, -50%); }

@media (max-width: 900px) {
  .topbar { height: 62px; padding: 0 16px; }
  .brand h1 { font-size: 14px; }
  .brand p, .status { display: none; }
  .title-card { left: 14px; top: 78px; width: 270px; }
  .title-card h2 { font-size: 21px; }
  .scene-tools { top: auto; bottom: 18px; right: 14px; }
  .selection-card { display: none; }
  .view-hint { left: 14px; transform: none; bottom: 18px; }
}
.generated-floor-label { width:220px; padding:12px 14px; white-space:normal; }
.generated-floor-label strong { display:block; font-size:15px; color:#d9f5ff; }
.generated-floor-label button { display:block; width:100%; margin-top:8px; padding:8px 6px; background:#092532; border:1px solid #315b6d; color:#d5edf6; text-align:left; font-size:12px; cursor:pointer; }
.generated-floor-label button span { font-size:12px; color:#75d7e9; }
