:root {
  --ink: #f6f4ed;
  --muted: rgba(246, 244, 237, 0.72);
  --panel: rgba(9, 11, 15, 0.68);
  --panel-strong: rgba(9, 11, 15, 0.86);
  --line: rgba(255, 255, 255, 0.13);
  --accent: #8fd3ff;
  --gold: #ffd280;
}

* { box-sizing: border-box; }

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(circle at 30% 20%, rgba(135, 175, 220, 0.2), transparent 34%),
    linear-gradient(145deg, #11151e 0%, #252938 48%, #11131a 100%);
}

button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  padding: 10px 15px;
  font: inherit;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

a {
  color: inherit;
}

button:hover,
button.active,
.nav-button:hover,
.nav-button.active {
  background: rgba(143, 211, 255, 0.2);
  border-color: rgba(143, 211, 255, 0.55);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
  padding: 10px 15px;
  text-decoration: none;
  backdrop-filter: blur(12px);
}

.stage,
.view,
#panorama {
  position: absolute;
  inset: 0;
}

.view {
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.view.active {
  opacity: 1;
  pointer-events: auto;
}

.hud {
  position: fixed;
  z-index: 20;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(18px);
}

.top-left {
  top: 22px;
  left: 24px;
  max-width: 360px;
  padding: 18px 20px;
  border-radius: 22px;
}

.top-left h1 {
  margin: 4px 0 8px;
  font-size: 30px;
  letter-spacing: 0.02em;
}

.top-left p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  color: var(--accent);
}

.top-right {
  top: 20px;
  right: 22px;
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: 999px;
}

.side-panel {
  right: 22px;
  top: 96px;
  bottom: 78px;
  width: 300px;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
}

.scene-heading {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

#scene-count {
  color: var(--gold);
  font-size: 28px;
  font-weight: 700;
}

#scene-title {
  font-size: 18px;
}

#scene-meta {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

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

.scene-actions button {
  flex: 1;
  padding: 9px 10px;
}

.scene-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-right: 4px;
}

.scene-card {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  padding: 10px 12px;
  text-align: left;
}

.scene-card.active {
  color: #071018;
  background: linear-gradient(135deg, #8fd3ff, #ffd280);
}

.bottom-left {
  left: 24px;
  bottom: 22px;
  max-width: min(560px, calc(100vw - 48px));
  padding: 12px 16px;
  border-radius: 999px;
  color: var(--muted);
}

#model-stage canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
}

.model-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  pointer-events: none;
}

.model-label {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  user-select: none;
  will-change: transform, opacity;
}

.model-label:hover,
.model-label.selected {
  border-color: rgba(143, 211, 255, 0.85);
  box-shadow: 0 12px 34px rgba(143, 211, 255, 0.2);
}

.space-label {
  transform: translate(-50%, -50%);
  padding: 9px 13px 9px 10px;
  border-radius: 12px;
  border-color: rgba(255, 210, 128, 0.62);
  background:
    linear-gradient(135deg, rgba(255, 210, 128, 0.2), rgba(98, 67, 24, 0.72)),
    rgba(13, 12, 8, 0.74);
  color: #ffe4a8;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.space-label::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #ffd280;
  box-shadow: 0 0 0 4px rgba(255, 210, 128, 0.16);
  transform: rotate(45deg);
}

.point-label {
  transform: translate(-50%, -100%);
  min-width: 32px;
  justify-content: center;
  padding: 7px 9px;
  border-color: rgba(143, 211, 255, 0.58);
  background:
    radial-gradient(circle at 50% 100%, rgba(143, 211, 255, 0.25), transparent 55%),
    rgba(5, 12, 20, 0.8);
  color: #d9f3ff;
  font-size: 11px;
  font-weight: 700;
}

.point-label::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #8fd3ff;
  box-shadow: 0 0 0 4px rgba(143, 211, 255, 0.18);
}

body.editing #edit-link {
  display: none;
}

body.editing .side-panel {
  display: none;
}

.editor-panel {
  right: 22px;
  top: 96px;
  bottom: 22px;
  width: min(430px, calc(100vw - 44px));
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto 110px;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
}

.editor-panel[hidden] {
  display: none;
}

.editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.editor-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.close-editor {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

.editor-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.editor-switches,
.editor-tabs,
.editor-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-switches label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
}

.editor-tabs button,
.editor-tools button {
  padding: 8px 12px;
}

.add-room-button {
  margin-left: auto;
  border-color: rgba(255, 210, 128, 0.42);
  background: rgba(255, 210, 128, 0.13);
}

.editor-list {
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding-right: 4px;
}

.edit-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.07);
}

.edit-card.selected {
  border-color: rgba(143, 211, 255, 0.7);
  background: rgba(143, 211, 255, 0.12);
}

.sortable-card {
  cursor: grab;
}

.sortable-card.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.sortable-card.drag-over {
  border-color: rgba(255, 210, 128, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 210, 128, 0.25);
}

.sortable-card input,
.sortable-card button {
  cursor: auto;
}

.edit-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.edit-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.edit-card input[type="text"],
.edit-card input[type="number"],
#label-json {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
  outline: none;
}

.edit-card input:focus,
#label-json:focus {
  border-color: rgba(143, 211, 255, 0.65);
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.edit-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.edit-actions button {
  padding: 7px 10px;
  font-size: 12px;
}

.edit-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.danger-button {
  border-color: rgba(255, 130, 130, 0.32);
  color: #ffd1d1;
  background: rgba(255, 80, 80, 0.1);
}

#label-json {
  resize: none;
  min-height: 100px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.45;
}

.pnlm-hotspot-base.route-hotspot {
  width: 0;
  height: 0;
  background: none !important;
  border: none !important;
  cursor: pointer;
}

.route-hotspot-target {
  position: absolute;
  left: 0;
  top: 0;
  width: 128px;
  height: 116px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transform: translate(-50%, -100%);
  transform-origin: 50% 100%;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.45));
}

.route-hotspot-target:hover .route-hotspot-ring,
.route-hotspot-target:focus-visible .route-hotspot-ring {
  border-color: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 7px rgba(143, 211, 255, 0.22),
    inset 0 0 16px rgba(143, 211, 255, 0.38);
}

.route-hotspot-label {
  position: absolute;
  left: 50%;
  top: 0;
  min-width: 86px;
  max-width: 128px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(8, 13, 20, 0.84);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.route-hotspot-leader {
  position: absolute;
  left: 50%;
  top: 33px;
  height: 46px;
  border-left: 1px dashed rgba(255, 255, 255, 0.68);
  transform: translateX(-50%);
}

.route-hotspot-ring {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 38px;
  height: 22px;
  border: 2px solid rgba(143, 211, 255, 0.88);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center, rgba(143, 211, 255, 0.22), transparent 58%),
    rgba(4, 13, 20, 0.16);
  box-shadow:
    0 0 0 5px rgba(143, 211, 255, 0.12),
    inset 0 0 14px rgba(143, 211, 255, 0.28);
  transform: translateX(-50%) perspective(80px) rotateX(58deg);
}

@media (max-width: 900px) {
  .top-left {
    max-width: calc(100vw - 44px);
    right: 22px;
  }

  .top-right {
    top: auto;
    bottom: 18px;
    left: 18px;
    right: 18px;
    justify-content: center;
  }

  .side-panel {
    display: none;
  }

  .bottom-left {
    display: none;
  }
}
