* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #dfe6ed;
  color: #1e242b;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#camera-bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  display: none;
}

#camera-bg.active {
  display: block;
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* Верхняя панель */
.top-bar {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
}

.property-badge {
  pointer-events: auto;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(30, 36, 43, 0.1);
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.badge-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #1f5c99;
  background: #e3f0fc;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.property-badge h1 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.property-badge .subtitle {
  font-size: 12.5px;
  color: #55606e;
  margin-top: 2px;
}

.top-actions {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.view-switch {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(30, 36, 43, 0.12);
  border-radius: 11px;
  padding: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.view-btn {
  border: none;
  background: transparent;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.view-btn.active {
  background: #0f172a;
  color: #ffffff;
}

.btn {
  border: none;
  border-radius: 11px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.12s ease, background 0.15s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-primary.ar-active {
  background: #dc2626;
}

.btn-primary .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #93c5fd;
}

.btn-primary.ar-active .dot {
  background: #fecaca;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.9);
  color: #1e242b;
  border: 1px solid rgba(30, 36, 43, 0.12);
}

.btn-secondary:hover {
  background: #ffffff;
}

/* Подсказка AR */
.ar-hint {
  position: fixed;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(17, 24, 39, 0.82);
  color: #f9fafb;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 999px;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}

/* Карточка комнаты */
.room-card {
  position: fixed;
  right: 14px;
  top: 86px;
  width: 270px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  padding: 14px;
  border: 1px solid rgba(30, 36, 43, 0.1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.room-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.room-card-header h2 {
  font-size: 15px;
  font-weight: 700;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
  padding: 2px 6px;
}

.room-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.metric {
  background: #f3f6fa;
  border-radius: 8px;
  padding: 7px 9px;
}

.metric-label {
  display: block;
  font-size: 11px;
  color: #64748b;
}

.metric-value {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.room-desc {
  font-size: 12.5px;
  line-height: 1.45;
  color: #334155;
  margin-bottom: 8px;
}

.room-finish {
  font-size: 12px;
  color: #475569;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

/* Нижняя панель */
.control-panel {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 24px));
  z-index: 10;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(30, 36, 43, 0.1);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.group-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  min-width: 105px;
}

.segmented {
  display: flex;
  background: #edf1f7;
  padding: 3px;
  border-radius: 10px;
  gap: 3px;
  flex: 1;
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.seg-btn.active {
  background: #ffffff;
  color: #1e242b;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.room-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.pill-btn {
  border: 1px solid #d5dde8;
  background: #ffffff;
  color: #334155;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.pill-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
}

.pill-btn.active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 6px;
  border-top: 1px solid #e5e9f0;
}

.toggles {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.active {
  background: #e0ecff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.scale-control {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}

.scale-control input[type="range"] {
  width: 110px;
  accent-color: #2563eb;
}

/* Уведомление */
.status-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: #1e293b;
  color: #ffffff;
  font-size: 12.5px;
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .room-card {
    top: auto;
    bottom: 200px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .property-badge h1 {
    font-size: 14px;
  }

  .group-label {
    min-width: 100%;
  }
}
