:root {
  --bg: #0b0e14;
  --glass: rgba(16, 20, 29, 0.78);
  --glass-border: rgba(255, 255, 255, 0.12);
  --text: #eef1f6;
  --muted: #9aa6b6;
  --accent: #6ea8fe;
  --accent-soft: rgba(110, 168, 254, 0.24);
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- загрузка ---------- */
.loading {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.02em;
  transition: opacity 0.5s ease;
}
.loading.hidden { opacity: 0; pointer-events: none; }

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- верхняя панель ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(to bottom, rgba(8, 10, 15, 0.72), rgba(8, 10, 15, 0));
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: linear-gradient(135deg, #6ea8fe, #8b6efe);
  box-shadow: 0 4px 16px rgba(110, 168, 254, 0.35);
}

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 600; white-space: nowrap; }
.brand-text span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { display: flex; gap: 8px; flex: 0 0 auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: rgba(30, 37, 50, 0.85); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-icon { padding: 9px; }

/* ---------- заголовок комнаты ---------- */
.room-title {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 15;
  padding: 8px 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
.room-title.visible { opacity: 1; }

/* ---------- план ---------- */
.plan-panel {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  width: 320px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px 14px;
}

.plan-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.plan-toggle {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.plan-toggle:hover { background: rgba(255, 255, 255, 0.08); }

.plan-body {
  padding: 0 10px 10px;
  text-align: center;
  transition: opacity 0.25s ease;
}

.plan-panel.collapsed .plan-body { display: none; }

.plan-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
}

.plan-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.plan-dot {
  position: absolute;
  width: 20px;
  height: 20px;
  padding: 0;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  background: rgba(110, 168, 254, 0.92);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.plan-dot:hover { transform: translate(-50%, -50%) scale(1.15); }
.plan-dot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.plan-dot.active {
  background: #2f6fed;
  box-shadow: 0 0 0 6px rgba(110, 168, 254, 0.22), 0 2px 12px rgba(0, 0, 0, 0.5);
}
.plan-dot.active::after {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(110, 168, 254, 0.55);
  animation: pulse 2s ease-out infinite;
}

.dot-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(12, 16, 24, 0.92);
  color: #eef1f6;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.plan-dot:hover .dot-label,
.plan-dot:focus-visible .dot-label,
.plan-dot.active .dot-label { opacity: 1; }

@keyframes pulse {
  0%   { transform: scale(0.8); opacity: 0.9; }
  70%  { transform: scale(1.5); opacity: 0; }
  100% { transform: scale(1.5); opacity: 0; }
}

.plan-hint {
  margin: 6px 4px 0;
  font-size: 11px;
  color: #6f7b8b;
  text-align: center;
}

/* ---------- уведомление ---------- */
.toast {
  position: fixed;
  top: 74px;
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 60;
  padding: 10px 18px;
  border-radius: 10px;
  background: rgba(20, 26, 36, 0.95);
  border: 1px solid var(--glass-border);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- хотспоты ---------- */
.pnlm-hotspot-base { cursor: pointer; }

/* ---------- штатные контролы Pannellum ---------- */
.pnlm-controls-container {
  top: auto !important;
  left: auto !important;
  right: 16px !important;
  bottom: 16px !important;
}

/* ---------- мобильный ---------- */
@media (max-width: 700px) {
  .topbar { padding: 10px 12px; }
  .brand-text span { display: none; }
  .btn-label { display: none; }
  .btn { padding: 9px; }

  .plan-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    border-radius: 16px 16px 0 0;
    border-bottom: none;
    max-height: 72vh;
  }
  .plan-body { overflow-y: auto; }
  .plan-wrap { width: auto; }
  .plan-img { max-height: calc(72vh - 104px); width: auto; max-width: 100%; }

  .room-title { bottom: auto; top: 64px; font-size: 13px; }

  /* поднимаем штатные контролы Pannellum над панелью плана */
  .pnlm-controls-container {
    bottom: 58px !important;
    right: 12px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
