:root {
  --bg: #000000;
  --panel: rgba(15, 23, 42, 0.92);
  --panel2: rgba(30, 41, 59, 0.96);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --line: rgba(148, 163, 184, 0.25);
  --accent: #38bdf8;
  --danger: #fb7185;
  --ok: #34d399;
  --warning: #fbbf24;
  --shadow: 0 18px 40px rgba(0,0,0,0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overscroll-behavior: none;
}

body {
  padding: env(safe-area-inset-top) 12px env(safe-area-inset-bottom);
}

.app {
  width: min(100%, 620px);
  margin: 0 auto;
  padding: 12px 0 18px;
  background: #000000;
}

.brand-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0 auto 18px;
  text-align: center;
}

.brand-logo {
  display: block;
  width: min(84vw, 326px);
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

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



.title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #F7931A;
}

.title .fa-location-dot {
  font-size: 16px;
  line-height: 1;
}


.status {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  min-width: auto;
}

.header-actions .start-ar-button {
  width: auto;
  min-width: 64px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
}

.map-card {
  margin-top: 12px;
  position: relative;
  width: 100%;
  height: min(68vh, 620px);
  min-height: 430px;
  overflow: hidden;
  border-radius: 24px;
  background: #111827;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  touch-action: none;
  user-select: none;
}

.map-card::before {
  content: "";
  display: none;
}
.map-card.map-intro-state {
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 35%, rgba(56, 189, 248, 0.2), transparent 44%),
    linear-gradient(145deg, rgba(15,23,42,0.98), rgba(2,6,23,0.96));
}

.map-card.map-intro-state .mapbox-map,
.map-card.map-intro-state .h3-overlay,
.map-card.map-intro-state .map-overlay,
.map-card.map-intro-state .user-dot,
.map-card.map-intro-state .map-mode-toggle {
  display: none;
}

.map-mode-toggle {
  position: absolute;
  top: 58px;
  right: 8px;
  z-index: 5;
  padding: 1px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(8px);
}

.map-mode-button {
  width: 28px;
  height: 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  overflow: visible;
}

.map-mode-button.heading {
  color: #111827;
  background: #F7931A;
}

.map-mode-button.north {
  color: var(--muted);
  background: transparent;
}

.mapbox-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.map-card.polar-map-mode {
  background: #0f5f8f;
}

.map-card.polar-map-mode.polar-north {
  background: #0f6f9f;
}

.map-card.polar-map-mode.polar-south {
  background: #f8fafc;
}

.map-card.polar-map-mode .mapbox-map {
  display: none;
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background:
    linear-gradient(rgba(15,23,42,0.84), rgba(15,23,42,0.84)),
    repeating-linear-gradient(0deg, rgba(148,163,184,0.12) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(90deg, rgba(148,163,184,0.12) 0 1px, transparent 1px 42px);
  pointer-events: none;
}

.map-loading.map-intro .map-loading-spinner {
  display: none;
}

.map-intro-cta {
  color: #F7931A;
  font-size: 20px;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.map-intro-text {
  max-width: min(92%, 390px);
  text-align: left;
}

.map-intro-text strong {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 16px;
}

.map-intro-text ul {
  margin: 0;
  padding-left: 18px;
}

.map-intro-text li + li {
  margin-top: 7px;
}

.map-loading-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(255,255,255,0.22);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

.map-loading-title {
  font-size: 15px;
  font-weight: 750;
}

.map-loading-text {
  max-width: 260px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.map-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.h3-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.h3-domain-area {
  fill-opacity: 0.18;
  stroke: rgba(239, 68, 68, 0.96);
  stroke-opacity: 1;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.h3-domain-area.spot-allowed {
  fill-opacity: 0.14;
  stroke: rgba(52, 211, 153, 0.92);
  stroke-width: 2;
}

.h3-domain-area.spot-blocked {
  fill-opacity: 0.22;
  stroke: rgba(239, 68, 68, 0.96);
  stroke-width: 3;
}

.map-toast {
  position: absolute;
  left: 50%;
  top: 12px;
  z-index: 20;
  max-width: min(86%, 360px);
  transform: translateX(-50%);
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 8px;
  background: rgba(15,23,42,0.92);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(0,0,0,0.28);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}

.map-toast.warning {
  border-color: rgba(247,147,26,0.72);
  background: rgba(65,42,14,0.94);
}

.user-dot {
  position: absolute;
  z-index: 2;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -50%) rotate(var(--user-heading, 0deg));
  transform-origin: 50% 50%;
  pointer-events: none;
}

.user-dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 24px solid #ffffff;
  filter: drop-shadow(0 8px 14px rgba(0,0,0,0.36));
}

.user-dot::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 7px;
  width: 0;
  height: 0;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 17px solid #0ea5e9;
}

.object-marker {
  position: absolute;
  z-index: 2;
  width: 30px;
  height: 30px;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  display: grid;
  place-items: center;
}

.object-marker::before {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--warning);
  border: 2px solid white;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}

.object-marker.selected::before {
  background: var(--danger);
  box-shadow: 0 0 0 6px rgba(251,113,133,0.22), 0 4px 14px rgba(0,0,0,0.4);
}

.domain-space-marker,
.domain-object-marker {
  position: absolute;
  z-index: 2;
  width: 32px;
  height: 32px;
  transform: translate(-50%, -100%);
  pointer-events: auto;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 7px 12px rgba(0,0,0,0.38));
}

.domain-space-marker {
  width: 38px;
  height: 46px;
  z-index: 3;
}

.domain-object-marker {
  width: 22px;
  height: 22px;
}

.domain-space-marker.selected,
.domain-object-marker.selected {
  filter: drop-shadow(0 0 10px rgba(0,255,255,1)) drop-shadow(0 7px 12px rgba(0,0,0,0.38));
}

.domain-object-marker.selected {
  background-color: rgba(14, 165, 233, 0.36);
  border-radius: 999px;
}

.install-marker {
  position: absolute;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -100%);
  pointer-events: none;
  display: grid;
  place-items: center;
}

.install-marker::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--ok);
  border: 2px solid white;
  box-shadow: 0 0 0 6px rgba(52,211,153,0.22), 0 4px 14px rgba(0,0,0,0.4);
}

.install-marker::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: white;
  position: absolute;
  top: 9px;
}

.panel {
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.panel-title {
  font-size: 14px;
  font-weight: 750;
}

.panel > .panel-title {
  margin-bottom: 10px;
}

.panel-coords {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
  max-width: 62%;
}

.start-context-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px;
  gap: 10px 14px;
  align-items: end;
}

.location-field {
  grid-column: 1;
  grid-row: 1;
}


.start-context-grid > .field:nth-of-type(1) {
  grid-column: 1;
  grid-row: 1;
}

.start-context-grid > .field:nth-of-type(2) {
  grid-column: 1;
  grid-row: 2;
}

.start-context-grid .posture-canvas {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  align-self: start;
}

.start-ar-button {
  width: 100%;
  min-height: 54px;
}

.view3d-button {
  background: #38bdf8;
}

.map-toggle-button {
  min-height: 42px;
  align-self: center;
}

.posture-canvas {
  width: 140px;
  height: 140px;
  display: block;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 50%, rgba(15,23,42,0.88), rgba(2,6,23,0.96));
  border: 2px solid rgba(255,255,255,0.72);
  box-shadow:
    inset 0 0 18px rgba(56,189,248,0.14),
    0 10px 24px rgba(0,0,0,0.28);
}

.start-minimap {
  cursor: default;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.field.full {
  grid-column: 1 / -1;
}

label {
  color: var(--muted);
  font-size: 12px;
}

input, select, textarea {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(15,23,42,0.7);
  color: white;
  padding: 0 11px;
  font-size: 15px;
  outline: none;
}

textarea {
  min-height: 92px;
  padding: 10px 11px;
  line-height: 1.35;
  resize: vertical;
}

input:disabled {
  color: #dbeafe;
  opacity: 0.9;
}

input.limit-reached, textarea.limit-reached {
  background: rgba(251, 191, 36, 0.22);
  border-color: rgba(251, 191, 36, 0.85);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.12);
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

input[type="radio"] {
  width: 10px;
  min-width: 10px;
  height: 10px;
  min-height: 10px;
  padding: 0;
  margin: 0;
  accent-color: var(--accent);
}

input[type="color"] {
  min-height: 42px;
  padding: 4px;
  cursor: pointer;
}

.text-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  align-items: end;
}

.youtube-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  align-items: end;
}

.drawing-canvas {
  width: 100%;
  aspect-ratio: 32 / 27;
  display: block;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background:
    linear-gradient(45deg, rgba(255,255,255,0.08) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.08) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.08) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.08) 75%),
    rgba(15,23,42,0.72);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  touch-action: none;
}

.drawing-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(76px, 0.75fr) minmax(76px, 0.75fr);
  gap: 10px;
  margin-top: 10px;
  align-items: end;
}

.drawing-options button {
  min-height: 42px;
}

.hidden-file-input {
  display: none;
}

.drawing-placement-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
  align-items: end;
}

 .rotation-mode-field {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 42px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(15,23,42,0.7);
}

.rotation-mode-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
}

.rotation-mode-option:has(input:checked) {
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
}

.rotation-mode-degree-option {
  flex: 1 1 auto;
  justify-content: flex-start;
}

.direction-inline {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 3px;
}

.direction-inline-label {
  color: var(--muted);
  font-size: 12px;
}

.direction-inline input {
  width: 62px;
  min-height: 30px;
  border-radius: 9px;
  padding: 0 7px;
  font-size: 13px;
}

input:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.check-field {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 11px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(15,23,42,0.7);
  color: var(--text);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(15,23,42,0.7);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

button.segment {
  min-height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
}

.youtube-segment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.youtube-button-icon {
  width: 18px;
  height: 13px;
  border-radius: 4px;
  background: #ff0033;
  position: relative;
  flex: 0 0 auto;
}

.youtube-button-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  border-left: 5px solid #fff;
  border-top: 3.5px solid transparent;
  border-bottom: 3.5px solid transparent;
}

button.segment.active {
  background: var(--accent);
  color: #03111f;
}

.info-grid {
  display: grid;
  grid-template-columns: minmax(92px, 0.35fr) minmax(0, 1fr);
  gap: 9px 12px;
  padding: 12px;
  border-radius: 12px;
  background: rgba(15,23,42,0.46);
  border: 1px solid rgba(148, 163, 184, 0.24);
}

.info-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.info-value {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.info-value a {
  color: #93c5fd;
  text-decoration: none;
}

.info-value a:hover {
  text-decoration: underline;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.actions button {
  width: 100%;
}

button {
  min-height: 46px;
  border: 0;
  border-radius: 14px;
  font-weight: 750;
  color: #03111f;
  background: var(--accent);
  padding: 0 14px;
  cursor: pointer;
}

button.secondary {
  background: #94a3b8;
}

button.danger {
  background: var(--danger);
  color: white;
}

button.ok {
  background: var(--ok);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.message {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.hidden {
  display: none !important;
}

.ar-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: black;
}

#arCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.exit-ar {
  position: fixed;
  z-index: 1003;
  top: calc(env(safe-area-inset-top) + 14px);
  right: 14px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: transparent;
  color: white;
  border: 0;
  font-size: 22px;
}

.ar-note {
  display: none;
  position: fixed;
  z-index: 1001;
  inset: 0;
  align-items: center;
  justify-content: center;
  padding: max(28px, env(safe-area-inset-top)) 28px max(28px, env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 50% 38%, rgba(247,147,26,0.18), transparent 34%),
    rgba(2,6,23,0.96);
  color: white;
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1.28;
  font-weight: 800;
  text-align: center;
  white-space: pre-line;
  border: 0;
}

.ar-note.visible {
  display: flex;
}

.view3d-view {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #020617;
}

#view3dCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.view3d-mapbox {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.view3d-mapbox .mapboxgl-ctrl-bottom-left,
.view3d-mapbox .mapboxgl-ctrl-bottom-right {
  display: none;
}

.exit-3d {
  position: fixed;
  z-index: 1001;
  top: calc(env(safe-area-inset-top) + 14px);
  right: 14px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: transparent;
  color: white;
  border: 0;
  font-size: 22px;
  text-shadow:
    0 2px 5px rgba(0, 0, 0, 0.95),
    0 0 10px rgba(0, 0, 0, 0.95),
    0 0 2px rgba(0, 0, 0, 1);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.9));
}

.view3d-toolbar {
  position: fixed;
  z-index: 1001;
  top: calc(env(safe-area-inset-top) + 14px);
  left: 14px;
  display: flex;
  gap: 8px;
}

.view3d-toolbar button {
  min-width: 92px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(15,23,42,0.76);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.view3d-toolbar button:active {
  transform: translateY(1px);
  background: rgba(247,147,26,0.82);
}

.view3d-origin {
  position: fixed;
  z-index: 1001;
  top: calc(env(safe-area-inset-top) + 62px);
  left: 14px;
  right: 72px;
  max-width: 520px;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(15,23,42,0.72);
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  line-height: 1.35;
}

.view3d-note {
  position: fixed;
  z-index: 1001;
  left: 14px;
  right: 72px;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15,23,42,0.84);
  color: white;
  font-size: 13px;
  border: 1px solid rgba(255,255,255,0.22);
}

.view3d-info-panel {
  position: fixed;
  z-index: 1002;
  left: 14px;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  max-width: 560px;
  max-height: min(52vh, 420px);
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(15,23,42,0.9);
  color: #fff;
  box-shadow: 0 18px 48px rgba(0,0,0,0.42);
}

.ar-domain-info-panel {
  z-index: 1002;
}

.view3d-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.view3d-info-title {
  min-width: 0;
  color: #f7931a;
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.view3d-info-header button {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.view3d-info-body {
  max-height: calc(min(52vh, 420px) - 56px);
  overflow: auto;
  padding: 8px 12px 12px;
}

.view3d-info-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.42fr) minmax(0, 1fr);
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
  line-height: 1.35;
}

.view3d-info-row:last-child {
  border-bottom: 0;
}

.view3d-info-label {
  color: rgba(255,255,255,0.58);
  font-weight: 700;
}

.view3d-info-value {
  color: rgba(255,255,255,0.94);
  overflow-wrap: anywhere;
}

.view3d-info-actions {
  display: flex;
  gap: 10px;
  padding-top: 12px;
}

.view3d-info-actions button {
  min-width: 112px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: #f7931a;
  color: #111827;
  font-size: 14px;
  font-weight: 800;
}

.view3d-info-actions button:active {
  transform: translateY(1px);
}

@media (max-width: 460px) {
  .view3d-toolbar button {
    min-width: 82px;
    height: 34px;
    padding: 0 10px;
    font-size: 12px;
  }

  .view3d-origin {
    top: calc(env(safe-area-inset-top) + 56px);
    font-size: 11px;
  }

  .view3d-info-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }
}

.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 1010;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0,0,0,0.72);
}

.video-dialog {
  position: relative;
  width: min(100%, 720px);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 18px 48px rgba(0,0,0,0.42);
}

.video-dialog iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 999px;
  background: rgba(15,23,42,0.76);
  color: #fff;
  padding: 0;
}

.video-open-link {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(15,23,42,0.8);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 390px) {
  .segmented,
  .youtube-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .drawing-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Mapbox Search JS SearchBox on the Spot map */
.map-card .mapboxgl-ctrl-top-left {
  top: 10px;
  left: 10px;
  right: auto;
  width: min(50%, 380px);
  max-width: calc(100% - 74px);
  z-index: 6;
}

.map-card .mapboxgl-ctrl-top-left .mapboxgl-ctrl {
  margin: 0;
}

.map-card mapbox-search-box,
.map-card .mapbox-search-box,
.map-card .mapboxgl-ctrl-geocoder {
  width: 100%;
  max-width: 100%;
}


/* N button removed */
.map-mode-toggle {
  display: none !important;
}


.map-loading.map-intro .map-intro-text {
  max-width: min(92%, 390px);
  text-align: left;
}

.map-loading.map-intro .map-intro-cta {
  max-width: min(92%, 430px);
}

/* Fallback/polar map search box. Mapbox SearchBox cannot be mounted when no Mapbox map instance exists. */
.fallback-search-box {
  position: absolute;
  top: 10px;
  left: 10px;
  right: auto;
  width: min(50%, 380px);
  max-width: calc(100% - 74px);
  z-index: 22;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 10px 26px rgba(0,0,0,0.32);
  backdrop-filter: blur(10px);
  pointer-events: auto;
}

.map-card.polar-map-mode:not(.map-intro-state) .fallback-search-box {
  display: flex;
}

.fallback-search-box.hidden {
  display: none !important;
}

.map-card.polar-map-mode:not(.map-intro-state) .fallback-search-box:not(.hidden) {
  display: flex !important;
}

.fallback-search-box input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(2, 6, 23, 0.74);
  color: #ffffff;
  padding: 0 10px;
  font-size: 14px;
}

.fallback-search-box input::placeholder {
  color: rgba(203, 213, 225, 0.82);
}

.fallback-search-box button {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 0;
  background: #F7931A;
  color: #111827;
  font-size: 15px;
  font-weight: 900;
}

@media (max-width: 420px) {
  .map-card .mapboxgl-ctrl-top-left,
  .fallback-search-box {
    left: 8px;
    right: auto;
    top: 8px;
    width: calc(100% - 64px);
    max-width: calc(100% - 64px);
  }

  .fallback-search-box input {
    font-size: 13px;
  }
}



.map-qr-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 24;
  width: 48px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 14px;
  background: #F7931A;
  color: #111827;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
  pointer-events: auto;
}

.map-card.map-intro-state .map-qr-button {
  display: none;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 22px;
}

.qr-modal.hidden {
  display: none !important;
}

.qr-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(6px);
}

.qr-modal-card {
  position: relative;
  z-index: 1;
  width: min(92vw, 360px);
  padding: 16px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.98);
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 22px 60px rgba(0,0,0,0.46);
}

.qr-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.qr-modal-title {
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
}

.qr-modal-close {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
}

.qr-code-box {
  display: grid;
  place-items: center;
  min-height: 276px;
  margin-bottom: 12px;
  padding: 10px;
  border-radius: 16px;
  background: #ffffff;
}

.qr-code-box canvas,
.qr-code-box img {
  width: 256px;
  height: 256px;
  image-rendering: pixelated;
}

.qr-url-text {
  width: 100%;
  min-height: 70px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.35;
  resize: none;
}

.qr-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}


.qr-code-js {
  display: grid;
  place-items: center;
  width: 256px;
  height: 256px;
}

.qr-code-js canvas,
.qr-code-js img {
  display: block;
  width: 256px;
  height: 256px;
  image-rendering: pixelated;
}

.qr-code-loading,
.qr-code-error {
  display: grid;
  place-items: center;
  width: 256px;
  min-height: 128px;
  padding: 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
}
/* Delete panel selected object preview */
.delete-object-preview {
  display: grid;
  gap: 8px;
  margin: 2px 0 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.68);
}

.delete-object-preview.hidden {
  display: none;
}

.delete-preview-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.delete-preview-text {
  max-height: 148px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}

.delete-preview-image {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}

.delete-preview-link {
  color: var(--accent);
  word-break: break-all;
  font-size: 13px;
  line-height: 1.4;
}

.delete-preview-muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}



/* Sub Object / Relative Edit Mode */
#spotObjectMenuPanel .actions button,
.relative-edit-buttons button {
  min-width: 0;
}

.relative-edit-actions {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 16;
  padding: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
  backdrop-filter: blur(10px);
}

.relative-edit-title {
  font-size: 15px;
  font-weight: 850;
  color: #ffffff;
  margin-bottom: 4px;
}

.relative-edit-summary {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin-bottom: 10px;
}

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

.relative-edit-buttons button {
  flex: 1 1 120px;
  min-height: 40px;
  border-radius: 12px;
}

.relative-edit-reference-selected {
  outline: 3px solid rgba(56, 189, 248, 0.9);
}

/* Relative Edit Sub Object install overlay */
.relative-subobject-install-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 18;
  max-height: min(78vh, 720px);
  overflow: auto;
  margin: 0;
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(10px);
}

.relative-subobject-install-panel .grid {
  max-height: none;
}
