/* =====================================
   GLOBAL
===================================== */

* {
  box-sizing: border-box;
}

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

  font-family:
    Arial,
    Helvetica,
    sans-serif;

  background: #000000;
}

button,
input {
  font: inherit;
}

.screen {
  position: fixed;
  inset: 0;

  width: 100%;
  height: 100%;

  opacity: 1;
  visibility: visible;

  transition:
    opacity 0.9s ease,
    visibility 0.9s ease;
}

.is-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}


/* =====================================
   INTRO SCREEN
===================================== */

.intro-screen {
  z-index: 300;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #000000;
}

.intro-content {
  position: relative;

  width: 100%;
  height: 100%;

  padding: 8vw;

  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;

  border: none;
  outline: none;

  background: transparent;
  color: #ffffff;

  text-align: left;
  cursor: pointer;
}

.intro-content h1 {
  max-width: 1300px;
  margin: 0;

  font-size: clamp(
    55px,
    7.4vw,
    142px
  );

  line-height: 0.94;
  font-weight: 500;
  letter-spacing: -0.055em;

  transition:
    transform 0.7s ease,
    opacity 0.7s ease;
}

.intro-content:hover h1 {
  transform: translateX(14px);
}

.intro-location {
  margin-top: 34px;

  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.23em;
  text-transform: uppercase;

  color: rgba(
    255,
    255,
    255,
    0.52
  );
}

.intro-instruction {
  position: absolute;
  right: 5vw;
  bottom: 5vh;

  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;

  color: rgba(
    255,
    255,
    255,
    0.65
  );
}

.intro-instruction::before {
  content: "";

  display: inline-block;

  width: 38px;
  height: 1px;

  margin-right: 12px;
  margin-bottom: 4px;

  background: currentColor;
}


/* =====================================
   EARTH SCREEN
===================================== */

.earth-screen {
  z-index: 200;

  overflow: hidden;
  background: #000000;
}

#cesiumContainer {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;
}

.earth-header {
  position: absolute;
  z-index: 10;

  top: 32px;
  left: 38px;
  right: 38px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  color: #ffffff;

  pointer-events: none;
}

.earth-project {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

#flight-status {
  font-size: 11px;
  letter-spacing: 0.09em;

  color: rgba(
    255,
    255,
    255,
    0.75
  );
}

.route-information {
  position: absolute;
  z-index: 10;

  left: 50%;
  bottom: 35px;

  display: flex;
  align-items: center;
  gap: 16px;

  transform: translateX(-50%);

  color: #ffffff;

  font-size: 9px;
  letter-spacing: 0.16em;

  white-space: nowrap;
  pointer-events: none;
}

.route-line {
  width: 90px;
  height: 1px;

  background: rgba(
    255,
    255,
    255,
    0.5
  );
}

.enter-model-button {
  position: absolute;
  z-index: 20;

  right: 38px;
  bottom: 35px;

  padding: 14px 22px;

  border: 1px solid rgba(
    255,
    255,
    255,
    0.65
  );

  border-radius: 100px;

  background: rgba(
    0,
    0,
    0,
    0.45
  );

  color: #ffffff;

  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;

  cursor: pointer;
  backdrop-filter: blur(12px);

  transition:
    color 0.25s ease,
    background 0.25s ease,
    transform 0.25s ease,
    opacity 0.8s ease;
}

.enter-model-button:hover {
  color: #000000;
  background: #ffffff;

  transform: translateY(-2px);
}


/* Keep Cesium attribution visible */

.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-fullscreenContainer {
  display: none !important;
}


/* =====================================
   MODEL VIEWER
===================================== */

.model-screen {
  z-index: 100;
  background: #4b5159;
}

#viewer {
  position: absolute;
  inset: 0;

  width: 100vw;
  height: 100vh;
}

.sidebar {
  position: absolute;
  z-index: 20;

  top: 22px;
  right: 22px;

  width: 280px;
  max-height: calc(100vh - 44px);
  padding: 22px;
  overflow-y: auto;

  background: rgba(
    248,
    248,
    248,
    0.94
  );

  border: 1px solid rgba(
    255,
    255,
    255,
    0.35
  );

  border-radius: 16px;

  box-shadow:
    0 18px 50px
    rgba(0, 0, 0, 0.25);

  backdrop-filter: blur(16px);
}

.sidebar-header {
  margin-bottom: 20px;
}

.project-label {
  margin: 0 0 8px;

  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;

  color: #777777;
}

.sidebar h2 {
  margin: 0;

  font-size: 21px;
  line-height: 1.15;
}

.subtitle {
  margin: 6px 0 0;

  font-size: 12px;
  color: #777777;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;

  margin: 8px 0;
  padding: 11px;

  background: #eeeeee;
  border-radius: 9px;

  font-size: 13px;
  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.layer-item:hover {
  background: #e3e3e3;
  transform: translateX(-2px);
}

.layer-item input {
  width: 16px;
  height: 16px;
  margin: 0;

  cursor: pointer;
}

.layer-item-model {
  display: block;
  padding: 10px 11px 11px;
}

.layer-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;

  width: 100%;
  cursor: pointer;
}

.mesh-display-select {
  width: 100%;
  margin-top: 9px;
  padding: 8px 30px 8px 10px;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 7px;
  outline: none;

  background: rgba(255, 255, 255, 0.78);
  color: #292929;

  font-size: 11px;
  cursor: pointer;
}

.mesh-display-select:hover,
.mesh-display-select:focus {
  border-color: rgba(0, 0, 0, 0.32);
  background: #ffffff;
}

.buttons {
  display: grid;
  gap: 8px;

  margin-top: 18px;
}

.buttons button,
.section-controls button {
  border: none;
  border-radius: 9px;

  background: #222222;
  color: #ffffff;

  font-size: 12px;
  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.buttons button {
  width: 100%;
  padding: 11px 12px;
}

.buttons button:hover,
.section-controls button:hover {
  background: #414141;
  transform: translateY(-1px);
}


/* =====================================
   TOP-LEFT MEASUREMENT TOOLS
===================================== */

.viewer-measure-tools {
  position: absolute;
  z-index: 30;

  top: 22px;
  left: 22px;

  width: min(360px, calc(100vw - 340px));
}

.measure-button-row {
  display: flex;
  gap: 7px;
}

.measure-tool-button {
  padding: 9px 13px;

  border: 1px solid rgba(
    255,
    255,
    255,
    0.28
  );

  border-radius: 999px;

  background: rgba(
    20,
    20,
    20,
    0.78
  );

  color: rgba(
    255,
    255,
    255,
    0.82
  );

  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;

  cursor: pointer;
  backdrop-filter: blur(12px);

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.measure-tool-button:hover {
  color: #ffffff;
  transform: translateY(-1px);
}

.measure-tool-button.is-active {
  border-color: #ffd56a;
  background: #ffd56a;
  color: #1a1a1a;
}

.measure-clear-button {
  color: rgba(
    255,
    255,
    255,
    0.62
  );
}

.measurement-status {
  display: inline-block;

  max-width: 340px;
  margin: 8px 0 0;
  padding: 7px 10px;

  border-radius: 7px;

  background: rgba(
    10,
    10,
    10,
    0.58
  );

  color: rgba(
    255,
    255,
    255,
    0.76
  );

  font-size: 10px;
  line-height: 1.35;

  backdrop-filter: blur(10px);
}

.measurement-label-layer {
  position: absolute;
  inset: 0;

  z-index: 6;
  pointer-events: none;
}

.measurement-label {
  padding: 6px 9px;

  border: 1px solid rgba(
    255,
    255,
    255,
    0.7
  );

  border-radius: 999px;

  background: rgba(
    10,
    10,
    10,
    0.86
  );

  color: #ffffff;

  font-size: 11px;
  font-weight: 700;
  line-height: 1;

  white-space: nowrap;

  transform: translate(-50%, -50%);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}


/* =====================================
   LEFT SURVEY CONTENT BUTTONS
===================================== */

.viewer-content-tools {
  position: absolute;
  z-index: 29;

  top: 108px;
  left: 22px;

  display: grid;
  gap: 8px;

  width: 214px;
}

.viewer-content-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;

  width: 100%;
  padding: 13px 15px;

  border: 1px solid rgba(
    255,
    255,
    255,
    0.24
  );

  border-radius: 12px;

  background: rgba(
    20,
    20,
    20,
    0.76
  );

  color: #ffffff;

  text-align: left;
  cursor: pointer;

  backdrop-filter: blur(14px);

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.viewer-content-button:hover {
  background: rgba(
    38,
    38,
    38,
    0.9
  );

  border-color: rgba(
    255,
    255,
    255,
    0.48
  );

  transform: translateX(2px);
}

.viewer-content-title {
  font-size: 12px;
  font-weight: 700;
}

.viewer-content-subtitle {
  color: rgba(
    255,
    255,
    255,
    0.58
  );

  font-size: 9px;
  letter-spacing: 0.04em;
}


/* =====================================
   SURVEY DRAWERS
===================================== */

.viewer-drawer {
  position: absolute;
  z-index: 50;

  top: 22px;
  bottom: 22px;
  left: 22px;

  width: min(430px, calc(100vw - 44px));
  padding: 22px;

  overflow-y: auto;

  border: 1px solid rgba(
    255,
    255,
    255,
    0.42
  );

  border-radius: 16px;

  background: rgba(
    246,
    246,
    244,
    0.97
  );

  color: #202020;

  box-shadow:
    0 22px 70px
    rgba(0, 0, 0, 0.35);

  backdrop-filter: blur(20px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateX(-18px);

  transition:
    opacity 0.24s ease,
    visibility 0.24s ease,
    transform 0.24s ease;
}

.viewer-drawer.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;

  transform: translateX(0);
}

.viewer-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;

  margin-bottom: 18px;
}

.viewer-drawer-kicker {
  margin: 0 0 7px;

  color: #777777;

  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.viewer-drawer h3 {
  margin: 0;

  font-size: 24px;
  line-height: 1.05;
}

.viewer-drawer-close {
  width: 34px;
  height: 34px;
  padding: 0;

  border: none;
  border-radius: 50%;

  background: #222222;
  color: #ffffff;

  font-size: 22px;
  line-height: 1;

  cursor: pointer;
}

.photo-category-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;

  margin-bottom: 16px;
}

.photo-category-button {
  padding: 9px 7px;

  border: none;
  border-radius: 8px;

  background: #e4e4e1;

  color: #4a4a4a;

  font-size: 9px;
  white-space: nowrap;
  cursor: pointer;
}

.photo-category-button.is-active {
  background: #222222;
  color: #ffffff;
}

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

.survey-photo-card {
  position: relative;

  min-height: 150px;
  padding: 0;

  overflow: hidden;

  border: 1px dashed rgba(
    0,
    0,
    0,
    0.24
  );

  border-radius: 10px;

  background: #e9e9e6;

  color: #222222;
  text-align: left;
}

.survey-photo-card:not(:disabled) {
  border-style: solid;
  cursor: pointer;
}

.survey-photo-card img {
  display: none;

  width: 100%;
  height: 150px;

  object-fit: cover;
}

.survey-photo-card.has-image img {
  display: block;
}

.survey-photo-placeholder {
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;

  padding: 16px;

  color: #6e6e6e;

  text-align: center;
}

.survey-photo-placeholder strong {
  color: #313131;
  font-size: 11px;
}

.survey-photo-placeholder span {
  font-size: 9px;
  line-height: 1.35;
  word-break: break-word;
}

.survey-photo-card.has-image
.survey-photo-placeholder {
  display: none;
}

.survey-photo-caption {
  position: absolute;

  left: 8px;
  right: 8px;
  bottom: 8px;

  display: none;

  padding: 7px 9px;

  border-radius: 7px;

  background: rgba(
    0,
    0,
    0,
    0.68
  );

  color: #ffffff;

  font-size: 9px;
  line-height: 1.3;
}

.survey-photo-card.has-image
.survey-photo-caption {
  display: block;
}

.drawer-note {
  margin: 15px 1px 0;

  color: #777777;

  font-size: 10px;
  line-height: 1.45;
}

.survey-info-content {
  display: grid;
  gap: 10px;
}

.survey-info-card {
  padding: 14px;

  border-radius: 10px;
  background: #e9e9e6;
}

.survey-info-card h4 {
  margin: 0 0 7px;

  font-size: 12px;
}

.survey-info-card p {
  margin: 0;

  color: #5c5c5c;

  font-size: 11px;
  line-height: 1.55;
}


.survey-team-card {
  padding: 0;
  overflow: hidden;
}

.survey-team-card summary {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 14px;

  list-style: none;
  cursor: pointer;
  user-select: none;
}

.survey-team-card summary::-webkit-details-marker {
  display: none;
}

.survey-team-card summary::after {
  content: "+";

  flex: 0 0 auto;

  color: #6b6b6b;

  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}

.survey-team-card[open] summary::after {
  content: "−";
}

.survey-team-card summary > span:first-child {
  font-size: 12px;
  font-weight: 700;
}

.survey-team-summary-hint {
  margin-left: auto;

  color: #777777;

  font-size: 9px;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.survey-team-list {
  padding: 0 14px 14px;
}

.survey-equipment-intro {
  margin: 0;
  padding: 13px 0;

  border-top: 1px solid rgba(0, 0, 0, 0.10);

  color: #5c5c5c;

  font-size: 10px;
  line-height: 1.5;
}

.survey-team-member {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;

  padding: 15px 0;

  border-top: 1px solid rgba(0, 0, 0, 0.10);
}

.survey-team-avatar {
  position: relative;

  width: 56px;
  height: 56px;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50%;

  background: #d4d4d0;
  color: #5a5a56;

  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.survey-team-avatar img {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  border-radius: 50%;
  object-fit: cover;
}

.survey-team-member-content h5 {
  margin: 1px 0 6px;

  color: #242424;

  font-size: 12px;
  line-height: 1.3;
}

.survey-team-card .survey-team-affiliation,
.survey-team-card .survey-team-interests {
  margin: 0 0 8px;

  color: #5c5c5c;

  font-size: 10px;
  line-height: 1.5;
}

.survey-team-card .survey-team-interests strong {
  color: #383838;
}

.survey-team-email {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-width: 58px;
  padding: 7px 11px;

  border-radius: 999px;

  background: #222222;
  color: #ffffff;

  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.survey-team-email:hover {
  background: #454545;
  transform: translateY(-1px);
}


/* =====================================
   PHOTO LIGHTBOX
===================================== */

.photo-lightbox {
  position: absolute;
  z-index: 80;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 50px;

  background: rgba(
    0,
    0,
    0,
    0.88
  );

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.22s ease,
    visibility 0.22s ease;
}

.photo-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.photo-lightbox-content {
  max-width: min(1200px, 92vw);
  max-height: 88vh;
  margin: 0;

  text-align: center;
}

.photo-lightbox-content img {
  display: block;

  max-width: 100%;
  max-height: 80vh;

  border-radius: 8px;

  object-fit: contain;
}

.photo-lightbox-content figcaption {
  margin-top: 12px;

  color: rgba(
    255,
    255,
    255,
    0.78
  );

  font-size: 11px;
}

.photo-lightbox-close {
  position: absolute;

  top: 24px;
  right: 26px;

  width: 42px;
  height: 42px;
  padding: 0;

  border: 1px solid rgba(
    255,
    255,
    255,
    0.35
  );

  border-radius: 50%;

  background: rgba(
    0,
    0,
    0,
    0.42
  );

  color: #ffffff;

  font-size: 26px;
  cursor: pointer;
}


/* =====================================
   BOTTOM-LEFT VIEWER TOGGLES
===================================== */

.viewer-quick-tools {
  position: absolute;
  z-index: 25;

  left: 22px;
  bottom: 22px;

  display: flex;
  gap: 7px;
}

.viewer-tool-button {
  padding: 9px 13px;

  border: 1px solid rgba(
    255,
    255,
    255,
    0.28
  );

  border-radius: 999px;

  background: rgba(
    20,
    20,
    20,
    0.76
  );

  color: rgba(
    255,
    255,
    255,
    0.74
  );

  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;

  cursor: pointer;
  backdrop-filter: blur(12px);

  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.viewer-tool-button:hover {
  color: #ffffff;
  transform: translateY(-1px);
}

.viewer-tool-button.is-active {
  border-color: rgba(
    255,
    255,
    255,
    0.82
  );

  background: rgba(
    255,
    255,
    255,
    0.94
  );

  color: #111111;
}


/* =====================================
   LOADING MESSAGE
===================================== */

#loading {
  position: fixed;
  z-index: 30;

  left: 50%;
  bottom: 26px;

  padding: 10px 18px;

  transform: translateX(-50%);

  border-radius: 100px;

  background: rgba(
    0,
    0,
    0,
    0.78
  );

  color: #ffffff;

  font-size: 12px;
  letter-spacing: 0.04em;
}


/* =====================================
   OPTIONAL PROJECT / BACK BUTTONS
===================================== */

.earth-project-button {
  padding: 0;
  border: none;
  outline: none;

  background: transparent;
  color: #ffffff;

  font-family: inherit;
  cursor: pointer;

  pointer-events: auto;
}

.earth-project-button:hover {
  opacity: 0.65;
}

.back-to-map-button {
  position: absolute;
  z-index: 25;
  top: 22px;
  left: 22px;

  padding: 11px 16px;

  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;

  background: rgba(20, 20, 20, 0.88);
  color: #ffffff;

  font-size: 12px;
  letter-spacing: 0.04em;
  cursor: pointer;

  transition:
    background 0.2s ease,
    transform 0.2s ease,
    opacity 0.2s ease;
}

.back-to-map-button:hover {
  background: rgba(45, 45, 45, 0.95);
  transform: translateY(-1px);
}


/* =====================================
   MOBILE
===================================== */

@media (max-width: 700px) {

  .intro-content {
    padding: 28px;
  }

  .intro-content h1 {
    font-size: clamp(
      43px,
      14vw,
      76px
    );
  }

  .intro-instruction {
    right: 28px;
    bottom: 28px;
  }

  .earth-header {
    top: 22px;
    left: 20px;
    right: 20px;
  }

  .earth-project {
    max-width: 150px;
    line-height: 1.5;
  }

  #flight-status {
    max-width: 135px;
    text-align: right;
  }

  .route-information {
    left: 20px;
    bottom: 22px;

    max-width: calc(100vw - 40px);

    transform: none;
  }

  .route-information span {
    white-space: normal;
  }

  .route-line {
    width: 30px;
    flex-shrink: 0;
  }

  .enter-model-button {
    right: 20px;
    bottom: 72px;
  }

  .sidebar {
    top: 12px;
    right: 12px;

    width: 225px;
    max-height: calc(100vh - 24px);

    padding: 15px;
  }

  .viewer-quick-tools {
    left: 12px;
    bottom: 12px;
  }

  .viewer-tool-button {
    padding: 8px 11px;
    font-size: 9px;
  }

  .back-to-map-button {
    top: 12px;
    left: 12px;
    padding: 10px 14px;
    font-size: 11px;
  }

  .viewer-measure-tools {
    top: 12px;
    left: 12px;

    width: calc(100vw - 249px);
    min-width: 0;
  }

  .measure-button-row {
    flex-wrap: wrap;
  }

  .measure-tool-button {
    padding: 8px 10px;
    font-size: 9px;
  }

  .measurement-status {
    max-width: 100%;
  }

  .viewer-content-tools {
    top: 112px;
    left: 12px;

    width: 184px;
  }

  .viewer-content-button {
    padding: 11px 12px;
  }

  .viewer-drawer {
    top: 12px;
    bottom: 12px;
    left: 12px;

    width: calc(100vw - 24px);
    padding: 17px;
  }

  .survey-photo-grid {
    grid-template-columns: 1fr;
  }

  .photo-lightbox {
    padding: 18px;
  }
}


/* =====================================
   VIEWER UPDATE: SKIP / POINT CLOUD / PHOTOS
===================================== */

.skip-intro-button {
  position: absolute;
  z-index: 310;

  left: 5vw;
  bottom: 5vh;

  padding: 10px 15px;

  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;

  background: rgba(15, 15, 15, 0.72);
  color: rgba(255, 255, 255, 0.78);

  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  cursor: pointer;
  backdrop-filter: blur(12px);

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.skip-intro-button:hover {
  background: #ffffff;
  color: #111111;
  transform: translateY(-1px);
}

.sidebar {
  max-height: calc(100vh - 44px);
  overflow-y: auto;
}

.layer-item-point-cloud {
  display: block;
}

.point-display-select {
  width: 100%;
  margin-top: 9px;
  padding: 8px 30px 8px 10px;

  border: 1px solid rgba(0, 0, 0, 0.13);
  border-radius: 7px;
  outline: none;

  background: rgba(255, 255, 255, 0.78);
  color: #292929;

  font-size: 11px;
  cursor: pointer;
}

.point-display-select:hover,
.point-display-select:focus {
  border-color: rgba(0, 0, 0, 0.32);
  background: #ffffff;
}

.layer-performance-note {
  display: block;
  margin-top: 7px;

  color: #7a7a7a;
  font-size: 8px;
  line-height: 1.3;
  letter-spacing: 0.03em;
}

.back-to-map-button {
  z-index: 32;
  padding: 9px 13px;
  font-size: 10px;
}

.viewer-measure-tools {
  top: 68px;
}

.viewer-content-tools {
  top: 154px;
}

.measurement-label {
  padding: 5px 8px;
  font-size: 10px;
}

.load-more-photos-button {
  grid-column: 1 / -1;

  padding: 11px 14px;

  border: none;
  border-radius: 9px;

  background: #222222;
  color: #ffffff;

  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.load-more-photos-button:hover {
  background: #414141;
}

.photo-lightbox {
  padding: 28px 82px 68px;
}

.photo-lightbox-content {
  width: min(1280px, 86vw);
  max-width: none;
  max-height: none;
}

.photo-lightbox-stage {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: min(78vh, 860px);

  overflow: hidden;

  border-radius: 9px;
  background: rgba(12, 12, 12, 0.75);

  touch-action: none;
  user-select: none;
}

.photo-lightbox-stage img {
  max-width: 100%;
  max-height: 100%;

  border-radius: 7px;
  object-fit: contain;

  transform-origin: center center;
  will-change: transform;

  user-select: none;
  -webkit-user-drag: none;
}

.photo-lightbox-stage.is-dragging img {
  cursor: grabbing !important;
}

.photo-lightbox-content figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.photo-lightbox-counter {
  color: rgba(255, 255, 255, 0.52);
  white-space: nowrap;
}

.photo-lightbox-navigation {
  position: absolute;
  z-index: 83;
  top: 50%;

  width: 48px;
  height: 60px;
  padding: 0;

  transform: translateY(-50%);

  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;

  background: rgba(0, 0, 0, 0.42);
  color: #ffffff;

  font-size: 36px;
  line-height: 1;
  cursor: pointer;

  backdrop-filter: blur(12px);
}

.photo-lightbox-navigation:hover {
  background: rgba(255, 255, 255, 0.95);
  color: #111111;
}

.photo-lightbox-previous {
  left: 22px;
}

.photo-lightbox-next {
  right: 22px;
}

.photo-lightbox-zoom-tools {
  position: absolute;
  z-index: 84;

  left: 50%;
  bottom: 18px;

  display: flex;
  gap: 6px;

  transform: translateX(-50%);
}

.photo-lightbox-zoom-tools button {
  min-width: 42px;
  height: 36px;
  padding: 0 12px;

  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;

  background: rgba(0, 0, 0, 0.58);
  color: #ffffff;

  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.photo-lightbox-zoom-tools button:hover {
  background: #ffffff;
  color: #111111;
}

@media (max-width: 700px) {
  .skip-intro-button {
    left: 28px;
    bottom: 28px;
  }

  .back-to-map-button {
    top: 12px;
    left: 12px;
    padding: 8px 11px;
    font-size: 9px;
  }

  .viewer-measure-tools {
    top: 58px;
  }

  .viewer-content-tools {
    top: 166px;
  }

  .photo-lightbox {
    padding: 58px 48px 72px;
  }

  .photo-lightbox-stage {
    height: 68vh;
  }

  .photo-lightbox-navigation {
    width: 38px;
    height: 50px;
    font-size: 30px;
  }

  .photo-lightbox-previous {
    left: 6px;
  }

  .photo-lightbox-next {
    right: 6px;
  }
}


/* =====================================
   DECAY LAYERS
===================================== */

.earth-header-with-back-button {
  left: 158px;
}

.map-to-3d-button {
  position: absolute;
  top: 22px;
  left: 22px;
}


.layer-group {
  margin: 8px 0;
  padding: 10px 11px 11px;

  background: #e9e9e9;
  border-radius: 9px;
}

.layer-group-header {
  display: flex;
  align-items: center;
  gap: 10px;

  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.layer-group-header input,
.decay-sublayer-toggle input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.decay-thickness-control {
  margin-top: 10px;
  padding: 9px 10px;

  background: rgba(255, 255, 255, 0.56);
  border-radius: 7px;
}

.decay-thickness-control label {
  display: block;
  margin-bottom: 7px;

  color: #303030;
  font-size: 10px;
  font-weight: 700;
}

.decay-thickness-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.decay-thickness-row input[type="range"] {
  width: 100%;
  margin: 0;
}

.decay-thickness-row span {
  min-width: 44px;

  color: #4b4b4b;
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}

.decay-sublayers {
  display: grid;
  gap: 7px;

  margin-top: 10px;
  padding-top: 10px;

  border-top: 1px solid rgba(0, 0, 0, 0.09);
}

.decay-sublayer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;

  padding: 7px 8px;

  background: rgba(255, 255, 255, 0.58);
  border-radius: 7px;
}

.decay-sublayer-toggle {
  display: flex;
  align-items: center;
  gap: 8px;

  min-width: 0;
  color: #303030;
  font-size: 10px;
  line-height: 1.25;
  cursor: pointer;
}

.decay-sublayer-toggle span {
  overflow-wrap: anywhere;
}

.decay-color-input {
  width: 30px;
  height: 26px;
  padding: 2px;

  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 6px;

  background: #ffffff;
  cursor: pointer;
}

.decay-color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.decay-color-input::-webkit-color-swatch {
  border: none;
  border-radius: 3px;
}

@media (max-width: 700px) {
  .earth-header-with-back-button {
    left: 116px;
  }
}


/* Four photo archive categories */
@media (max-width: 700px) {
  .photo-category-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
}
.survey-equipment-card .survey-team-avatar img {
  object-fit: contain;
  padding: 5px;
  background: #ffffff;
}
/* Align all left-side controls */
.viewer-measure-tools,
.viewer-content-tools,
.viewer-quick-tools {
  width: 214px;
}

/* Distance / Angle / Clear */
.measure-button-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.measure-tool-button {
  width: 100%;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

.viewer-content-subtitle {
  white-space: nowrap;
  font-size: 10px;
  letter-spacing: -0.03em;
}

/* Ground / Section Box */
.viewer-quick-tools {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 7px;
}

.viewer-tool-button {
  width: 100%;
  padding-left: 4px;
  padding-right: 4px;
  text-align: center;
}

/* =====================================
   HERITAGE PLATFORM V2 — FAST CINEMATIC INTRO
===================================== */

.intro-screen {
  background:
    radial-gradient(circle at 78% 30%, rgba(255,255,255,0.08), transparent 30%),
    linear-gradient(135deg, #050505 0%, #111 55%, #050505 100%);
}

.intro-ambient-grid {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to right, transparent 0%, #000 45%, #000 100%);
}

.intro-route-glow {
  position: absolute;
  right: 12vw;
  top: 12vh;
  width: 1px;
  height: 76vh;
  background: linear-gradient(to bottom, transparent, rgba(255,255,255,0.35), transparent);
  box-shadow: 0 0 40px rgba(255,255,255,0.12);
  pointer-events: none;
}

.intro-kicker {
  margin-bottom: 22px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: rgba(255,255,255,0.52);
}

.intro-secondary-actions {
  position: absolute;
  z-index: 8;
  left: 5vw;
  bottom: 4.6vh;
  display: flex;
  gap: 10px;
}

.intro-secondary-actions .skip-intro-button {
  position: static;
  padding: 10px 14px;
  background: rgba(0,0,0,0.36);
  border: 1px solid rgba(255,255,255,0.16);
  backdrop-filter: blur(10px);
}

/* =====================================
   CINEMATIC EARTH FLIGHT
===================================== */

.earth-screen::before {
  content: "";
  position: absolute;
  z-index: 6;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 44%, transparent 38%, rgba(0,0,0,.22) 78%, rgba(0,0,0,.48) 100%),
    linear-gradient(to bottom, rgba(0,0,0,.14), transparent 24%, transparent 74%, rgba(0,0,0,.20));
}

.cinematic-letterbox {
  position: absolute;
  z-index: 7;
  left: 0;
  right: 0;
  height: clamp(22px, 3.2vh, 44px);
  background: rgba(0,0,0,.92);
  pointer-events: none;
}
.cinematic-letterbox-top { top: 0; }
.cinematic-letterbox-bottom { bottom: 0; }

.cinematic-landmark {
  position: absolute;
  z-index: 18;
  left: clamp(28px, 5vw, 84px);
  bottom: clamp(72px, 10vh, 128px);
  display: grid;
  gap: 4px;
  max-width: min(560px, 65vw);
  color: #fff;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .38s ease, transform .38s ease;
  pointer-events: none;
  text-shadow: 0 3px 24px rgba(0,0,0,.62);
}
.cinematic-landmark.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.cinematic-city {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .28em;
  color: rgba(255,255,255,.68);
}
.cinematic-name {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(26px, 4vw, 58px);
  line-height: .98;
  font-weight: 400;
  letter-spacing: -.03em;
}
.cinematic-sequence {
  margin-top: 7px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
  color: rgba(255,255,255,.46);
}

.earth-screen.is-flight-running .earth-header,
.earth-screen.is-flight-running .route-information {
  opacity: .72;
}

/* =====================================
   PROFESSIONAL LAYERS
===================================== */

.layer-section-label {
  margin: 15px 2px 6px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: #777;
}

.layer-inline-tools button {
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 7px;
  background: #fff;
  color: #222;
  cursor: pointer;
  font-size: 9px;
}

.layer-inline-tools {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.layer-inline-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8px;
  color: #777;
}

.layer-inline-tools input[type="range"] { width: 100%; min-width: 54px; }
.layer-inline-tools button { width: 24px; height: 24px; font-weight: 800; }

/* =====================================
   DRAWERS + METHODOLOGY
===================================== */

.methodology-flow { display: grid; gap: 10px; }
.methodology-step {
  display: grid;
  grid-template-columns: 34px 1fr;
  column-gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(0,0,0,0.035);
  border: 1px solid rgba(0,0,0,0.06);
}
.methodology-step > span { grid-row: 1 / 3; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: #999; }
.methodology-step h4 { margin: 0 0 4px; font-size: 13px; }
.methodology-step p { margin: 0; font-size: 11px; line-height: 1.55; color: #666; }

.analysis-inspector {
  position: absolute;
  z-index: 55;
  right: 320px;
  bottom: 22px;
  width: min(390px, calc(100vw - 360px));
  max-height: 64vh;
  overflow-y: auto;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 16px;
  background: rgba(16,17,19,0.92);
  color: #fff;
  box-shadow: 0 22px 60px rgba(0,0,0,0.35);
  backdrop-filter: blur(18px);
  opacity: 0;
  transform: translateY(12px);
  visibility: hidden;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}
.analysis-inspector.is-open { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; }
.analysis-inspector-close { position: absolute; right: 12px; top: 10px; border: 0; background: transparent; color: #fff; font-size: 22px; cursor: pointer; }
.analysis-inspector-kicker { margin: 0 0 9px; font-size: 8px; font-weight: 800; letter-spacing: .2em; color: #7a1f1f; }
.analysis-inspector h3 { margin: 0 28px 15px 0; font-size: 20px; }
.analysis-inspector-body h4 { margin: 16px 0 5px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #7a1f1f; }
.analysis-inspector-body p { margin: 0; font-size: 11px; line-height: 1.58; color: rgba(255,255,255,.76); }
.analysis-caution { margin-top: 16px !important; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: 9px !important; color: rgba(255,255,255,.5) !important; }
.viewer-content-button.is-active { border-color: #7a1f1f; box-shadow: inset 0 0 0 1px rgba(122,31,31,.22); }

/* =====================================
   MEASUREMENT PRO
===================================== */

.viewer-measure-tools { width: min(570px, calc(100vw - 340px)); }
.measure-button-row { flex-wrap: wrap; }
.measure-unit-select {
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  background: rgba(20,20,20,.78);
  color: #fff;
  font-size: 10px;
  backdrop-filter: blur(12px);
}

.measurement-history {
  display: none;
  width: min(360px, calc(100vw - 340px));
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.20);
  border-radius: 12px;
  background: rgba(14,14,14,.72);
  color: #fff;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}
.measurement-history.has-items { display: block; }
.measurement-history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
  padding: 0 2px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .16em;
  color: rgba(255,255,255,.48);
}
.measurement-history-list { display: grid; gap: 5px; }
.measurement-history-item {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.07);
}
.measurement-history-name {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.measurement-history-name:focus { color: #7a1f1f; }
.measurement-history-value {
  white-space: nowrap;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.78);
}
.measurement-history-delete {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255,255,255,.45);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.measurement-history-delete:hover { background: rgba(255,255,255,.10); color: #fff; }
.measurement-history-empty { display: none; font-size: 9px; color: rgba(255,255,255,.42); }

/* Final V2 toolbar overrides */
.measure-button-row { display: flex; flex-wrap: wrap; gap: 7px; }
.measure-tool-button { width: auto; min-width: 62px; flex: 0 0 auto; }
.measure-unit-select { width: 62px; }

@media (max-width: 700px) {
  .measurement-history { width: min(360px, calc(100vw - 44px)); }
  .cinematic-name { font-size: clamp(24px, 8vw, 42px); }
}

/* =====================================
   HERITAGE PLATFORM V4 — CLEAN VIEWER
===================================== */

/* Pure black title screen: no gradient, no decorative glow. */
.intro-screen {
  background: #000 !important;
}

.intro-content {
  background: transparent !important;
}

/* Keep the cinematic flight readable without a heavy dark overlay. */
.earth-screen::before {
  background: radial-gradient(circle at 50% 46%, transparent 58%, rgba(0,0,0,.12) 100%) !important;
}

#cesiumContainer canvas {
  filter: brightness(1.08) contrast(1.015) saturate(1.03);
}

/* Three quick tools fit on one clean row. */
.viewer-quick-tools {
  grid-template-columns: repeat(3, 1fr) !important;
}

/* Layer appearance controls */
.layer-display-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: center;
  margin-top: 9px;
}

.layer-display-row .mesh-display-select {
  margin-top: 0;
}

.model-color-input,
.decay-color-input,
.display-color-row input[type="color"] {
  width: 34px;
  height: 30px;
  padding: 2px;
  border: 1px solid rgba(0,0,0,.14);
  border-radius: 7px;
  background: rgba(255,255,255,.78);
  cursor: pointer;
}

.layer-opacity-control {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 34px;
  gap: 7px;
  align-items: center;
  margin-top: 8px;
  font-size: 9px;
  color: #686868;
}

.layer-opacity-control input[type="range"] {
  width: 100%;
  min-width: 0;
  accent-color: #262626;
}

.layer-opacity-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #333;
}

.decay-sublayer-row {
  grid-template-columns: minmax(0, 1fr) 30px 62px !important;
}

.decay-opacity-input {
  width: 62px;
  min-width: 0;
  accent-color: #222;
}

.viewer-display-settings {
  margin-top: 14px;
  padding: 11px;
  border-radius: 9px;
  background: #eeeeee;
}

.display-settings-title {
  margin-bottom: 7px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .18em;
  color: #777;
}

.display-color-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  font-size: 11px;
  color: #333;
}

/* Measurement line/label colour follows the user's colour picker. */
.measurement-label {
  border-color: var(--measurement-color, #ffd56a) !important;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--measurement-color, #ffd56a) 24%, transparent),
    0 6px 18px rgba(0,0,0,.25) !important;
}

/* =====================================
   CLOUDCOMPARE-LIKE CLIPPING BOX UI
   Controls live on the box itself; no preset panel.
===================================== */

#toggle-section.is-active {
  border-color: #7a1f1f !important;
  color: #111 !important;
  background: #7a1f1f !important;
}

/* =====================================
   HERITAGE PLATFORM V5 — UI REFINEMENT
===================================== */

/* Compact, aligned right sidebar */
.sidebar {
  width: 340px !important;
  padding: 16px !important;
  border-radius: 14px !important;
}

.sidebar-header { margin-bottom: 14px !important; }
.sidebar h2 { font-size: 19px !important; }
.subtitle { font-size: 10px !important; }

.layer-section-label {
  margin: 10px 1px 6px !important;
  font-size: 8px !important;
  letter-spacing: .16em !important;
}

.layer-item,
.layer-group {
  margin: 5px 0 !important;
  padding: 8px 9px !important;
  border-radius: 9px !important;
}

.layer-item:hover { transform: none !important; }

.layer-primary-row {
  display: grid;
  align-items: center;
  gap: 7px;
  width: 100%;
}

.layer-primary-row-model {
  grid-template-columns: minmax(0, 1fr) 30px 82px;
}

.layer-primary-row-point {
  grid-template-columns: minmax(0, 1fr) 82px;
}

.layer-toggle-row,
.decay-sublayer-toggle {
  min-width: 0;
  gap: 8px !important;
  font-size: 10px !important;
}

.layer-toggle-row span,
.decay-sublayer-toggle span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-toggle-row input[type="checkbox"],
.decay-sublayer-toggle input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
  flex: 0 0 14px;
}

.model-color-input,
.decay-color-input,
.display-color-row input[type="color"] {
  width: 30px !important;
  height: 26px !important;
  padding: 2px !important;
  border-radius: 7px !important;
  border: 1px solid rgba(0,0,0,.13) !important;
  background: rgba(255,255,255,.9) !important;
}

.layer-opacity-input,
.decay-opacity-input {
  width: 82px !important;
  min-width: 0;
  height: 18px;
  margin: 0;
  accent-color: #252525;
  cursor: ew-resize;
}

.layer-opacity-input::-webkit-slider-runnable-track,
.decay-opacity-input::-webkit-slider-runnable-track {
  height: 3px;
  border: 0;
  border-radius: 999px;
  background: #c7c7c7;
}

.layer-opacity-input::-webkit-slider-thumb,
.decay-opacity-input::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border: 0;
  border-radius: 50%;
  background: #252525;
  -webkit-appearance: none;
}

.layer-opacity-input::-moz-range-track,
.decay-opacity-input::-moz-range-track {
  height: 3px;
  border: 0;
  border-radius: 999px;
  background: #c7c7c7;
}

.layer-opacity-input::-moz-range-thumb,
.decay-opacity-input::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: #252525;
}

.layer-secondary-select,
.mesh-display-select,
.point-display-select {
  width: 100% !important;
  height: 29px !important;
  margin-top: 6px !important;
  padding: 4px 28px 4px 8px !important;
  border-radius: 7px !important;
  font-size: 9px !important;
}

.decay-layer-group { padding: 8px 9px 9px !important; }
.decay-thickness-control { margin-top: 7px !important; }
.decay-thickness-control > label { font-size: 8px !important; }
.decay-thickness-row { gap: 7px !important; }
#decay-line-thickness-value { font-size: 8px !important; min-width: 36px; }

.decay-sublayers { gap: 5px !important; }
.decay-sublayer-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 30px 82px !important;
  gap: 7px !important;
  align-items: center !important;
  min-height: 36px !important;
  padding: 5px 6px !important;
  border-radius: 8px !important;
}

/* Display controls: curated gradients instead of raw background picker */
.viewer-display-settings {
  margin-top: 9px !important;
  padding: 9px !important;
  border-radius: 9px !important;
}

.background-preset-row,
.display-color-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  min-height: 31px !important;
  font-size: 10px !important;
}

.background-swatches {
  display: flex;
  align-items: center;
  gap: 5px;
}

.background-swatch {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22), 0 0 0 1px rgba(0,0,0,.10);
  transition: transform .15s ease, border-color .15s ease;
}
.background-swatch:hover { transform: scale(1.08); }
.background-swatch.is-active { border-color: #202020; }
.background-swatch-studio { background: linear-gradient(145deg,#66717a,#3f474f); }
.background-swatch-slate { background: linear-gradient(145deg,#71808a,#44515b); }
.background-swatch-graphite { background: linear-gradient(145deg,#454a50,#25292e); }
.background-swatch-warm { background: linear-gradient(145deg,#77746f,#4b4a48); }
.background-swatch-bluegrey { background: linear-gradient(145deg,#657480,#3d4b57); }

.sidebar .buttons {
  grid-template-columns: 1fr 1fr !important;
  gap: 6px !important;
  margin-top: 9px !important;
}
.sidebar .buttons button {
  padding: 8px 9px !important;
  border-radius: 8px !important;
  font-size: 9px !important;
}

/* Measurement history belongs to the sidebar and never overlays the viewer tools. */
.sidebar .measurement-history,
.sidebar-measurement-history {
  position: static !important;
  display: block !important;
  width: 100% !important;
  margin: 9px 0 0 !important;
  padding: 9px !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: #eeeeee !important;
  color: #252525 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
.sidebar .measurement-history-header {
  margin-bottom: 6px !important;
  color: #777 !important;
}
.sidebar .measurement-history-item {
  padding: 6px 7px !important;
  gap: 6px !important;
  background: rgba(255,255,255,.82) !important;
  border-color: rgba(0,0,0,.06) !important;
}
.sidebar .measurement-history-name {
  color: #202020 !important;
  font-size: 9px !important;
}
.sidebar .measurement-history-name:focus { color: #000 !important; }
.sidebar .measurement-history-value {
  color: #555 !important;
  font-size: 9px !important;
}
.sidebar .measurement-history-delete {
  color: #888 !important;
}
.sidebar .measurement-history-delete:hover {
  background: #e3e3e3 !important;
  color: #111 !important;
}
.sidebar .measurement-history-empty {
  display: block;
  color: #999 !important;
  font-size: 8px !important;
}
.sidebar .measurement-history.has-items .measurement-history-empty { display: none !important; }

/* Thin, single-line top-left measurement toolbar */
.viewer-measure-tools {
  width: auto !important;
  max-width: calc(100vw - 390px) !important;
}
.measure-button-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 5px !important;
}
.measure-tool-button,
.measure-unit-select {
  min-width: 0 !important;
  height: 34px !important;
  padding: 0 13px !important;
  border-radius: 999px !important;
  font-size: 9px !important;
  white-space: nowrap !important;
}
.measure-unit-select { width: 58px !important; padding: 0 9px !important; }
.measurement-status {
  max-width: 310px !important;
  margin-top: 6px !important;
  padding: 5px 8px !important;
  font-size: 9px !important;
}

/* Left information cards align perfectly and never wrap internally. */
.viewer-content-tools {
  width: 266px !important;
  gap: 7px !important;
}
.viewer-content-button {
  width: 100% !important;
  min-height: 0 !important;
  height: 61px !important;
  padding: 11px 14px !important;
  border-radius: 11px !important;
  overflow: hidden;
}
.viewer-content-title,
.viewer-content-subtitle {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}
.viewer-content-title { font-size: 11px !important; }
.viewer-content-subtitle { font-size: 9px !important; }

/* Only Ground + Section remain. */
.viewer-quick-tools {
  grid-template-columns: repeat(2, auto) !important;
  width: auto !important;
  gap: 7px !important;
}
.viewer-tool-button {
  min-width: 82px !important;
  padding: 9px 13px !important;
  font-size: 9px !important;
  white-space: nowrap !important;
}

#toggle-section.is-active {
  border-color: #7a1f1f !important;
  background: #7a1f1f !important;
  color: #111 !important;
}

@media (max-width: 760px) {
  .sidebar { width: min(340px, calc(100vw - 34px)) !important; }
  .viewer-measure-tools { max-width: calc(100vw - 44px) !important; }
  .viewer-content-tools { width: min(266px, calc(100vw - 44px)) !important; }
}

/* =====================================
   HERITAGE PLATFORM V6 — FINAL UI PASS
===================================== */

:root {
  --viewer-left: 28px;
  --viewer-left-width: 332px;
  --viewer-right-width: 420px;
}

/* Right layer panel: one disciplined grid, no wrapped labels. */
.sidebar {
  width: var(--viewer-right-width) !important;
  padding: 15px !important;
}

.layer-primary-row-model {
  grid-template-columns: minmax(0, 1fr) 24px 72px !important;
}
.layer-primary-row-point {
  grid-template-columns: minmax(0, 1fr) 72px !important;
}
.decay-sublayer-row {
  grid-template-columns: minmax(0, 1fr) 20px 24px 72px !important;
  min-height: 32px !important;
  padding: 4px 5px !important;
}
.layer-toggle-row span,
.decay-sublayer-toggle span {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Model colour controls now look exactly like the decay colour controls. */
.model-color-input,
.decay-color-input,
.display-color-row input[type="color"] {
  width: 24px !important;
  height: 22px !important;
  min-width: 24px !important;
  padding: 1px !important;
  border: 1px solid rgba(0,0,0,.14) !important;
  border-radius: 6px !important;
  background: #fff !important;
  cursor: pointer;
}
.model-color-input::-webkit-color-swatch-wrapper,
.decay-color-input::-webkit-color-swatch-wrapper,
.display-color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
.model-color-input::-webkit-color-swatch,
.decay-color-input::-webkit-color-swatch,
.display-color-row input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}

/* Thin, minimal range controls. The generous hit area stays invisible. */
.layer-opacity-input,
.decay-opacity-input,
#decay-line-thickness {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 72px !important;
  height: 14px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  cursor: ew-resize;
}
.layer-opacity-input::-webkit-slider-runnable-track,
.decay-opacity-input::-webkit-slider-runnable-track,
#decay-line-thickness::-webkit-slider-runnable-track {
  height: 2px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(30,30,30,.28) !important;
}
.layer-opacity-input::-webkit-slider-thumb,
.decay-opacity-input::-webkit-slider-thumb,
#decay-line-thickness::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 9px !important;
  height: 9px !important;
  margin-top: -3.5px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #252525 !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) !important;
}
.layer-opacity-input::-moz-range-track,
.decay-opacity-input::-moz-range-track,
#decay-line-thickness::-moz-range-track {
  height: 2px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(30,30,30,.28) !important;
}
.layer-opacity-input::-moz-range-thumb,
.decay-opacity-input::-moz-range-thumb,
#decay-line-thickness::-moz-range-thumb {
  width: 9px !important;
  height: 9px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #252525 !important;
}

.decay-info-button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(0,0,0,.13);
  border-radius: 50%;
  background: rgba(255,255,255,.72);
  color: #5a5a5a;
  font: 700 9px/1 Arial, sans-serif;
  cursor: pointer;
}
.decay-info-button:hover {
  background: #fff;
  color: #111;
  border-color: rgba(0,0,0,.28);
}

/* Background palette: two light architectural presets, three darker presets, plus Custom. */
.background-swatches { gap: 5px !important; }
.background-swatch,
.background-custom-swatch {
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 22px;
  border: 2px solid transparent;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.10), 0 0 0 1px rgba(255,255,255,.4);
}
.background-swatch-porcelain { background: linear-gradient(145deg,#f6f7f6,#d7dce0) !important; }
.background-swatch-ivory { background: linear-gradient(145deg,#f6f1e8,#d6cec1) !important; }
.background-swatch-graphite { background: linear-gradient(145deg,#51565c,#25292e) !important; }
.background-swatch-warm { background: linear-gradient(145deg,#87827a,#4b4946) !important; }
.background-swatch-bluegrey { background: linear-gradient(145deg,#788895,#43515d) !important; }
.background-swatch.is-active,
.background-custom-swatch.is-active { border-color: #202020 !important; }
.background-custom-swatch {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: conic-gradient(#f4b5b5,#f4e0a8,#b9e2bf,#b9d8ef,#d7bce8,#f4b5b5);
  cursor: pointer;
}
.background-custom-swatch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.background-custom-swatch span {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255,255,255,.88);
  color: #222;
  font-size: 10px;
  line-height: 1;
}

/* Measurement history is a dedicated right-side panel directly after the layers. */
.sidebar-measurement-history {
  margin-top: 8px !important;
  margin-bottom: 8px !important;
  border: 1px solid rgba(0,0,0,.05) !important;
}

/* All left-side UI shares one start and one end edge. */
.back-to-map-button {
  left: var(--viewer-left) !important;
  right: auto !important;
  width: var(--viewer-left-width) !important;
  height: 38px !important;
  padding: 0 14px !important;
  border-radius: 9px !important;
  text-align: left;
  font-size: 10px !important;
}

.viewer-measure-tools {
  left: var(--viewer-left) !important;
  width: var(--viewer-left-width) !important;
  max-width: none !important;
}
.measure-button-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr 1fr 64px !important;
  width: 100% !important;
  gap: 6px !important;
}
.measure-tool-button,
.measure-unit-select {
  width: 100% !important;
  height: 36px !important;
  min-width: 0 !important;
  padding: 0 10px !important;
  border-radius: 9px !important;
  white-space: nowrap !important;
  font-size: 9px !important;
}
.measure-unit-select { padding: 0 8px !important; }
.measurement-status {
  display: block;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box;
  margin-top: 6px !important;
  border-radius: 7px !important;
}

.viewer-content-tools {
  left: var(--viewer-left) !important;
  width: var(--viewer-left-width) !important;
  gap: 7px !important;
}
.viewer-content-button {
  width: 100% !important;
  height: 66px !important;
  border-radius: 10px !important;
  padding: 12px 16px !important;
}
.viewer-content-title,
.viewer-content-subtitle {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.viewer-quick-tools {
  left: var(--viewer-left) !important;
  right: auto !important;
  width: var(--viewer-left-width) !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 7px !important;
}
.viewer-tool-button {
  width: 100% !important;
  min-width: 0 !important;
  height: 38px !important;
  padding: 0 12px !important;
  border-radius: 9px !important;
}

/* Decay information panel sits cleanly beside the layer column instead of over it. */
.analysis-inspector {
  right: calc(var(--viewer-right-width) + 44px) !important;
  width: 360px !important;
  max-width: calc(100vw - var(--viewer-right-width) - 90px) !important;
}

/* The section box itself is intentionally thin; arrows are created in Three.js. */
#toggle-section.is-active {
  border-color: #7a1f1f !important;
  background: #7a1f1f !important;
  color: #111 !important;
}

@media (max-width: 820px) {
  :root {
    --viewer-left: 18px;
    --viewer-left-width: min(332px, calc(100vw - 36px));
  }
  .back-to-map-button,
  .viewer-measure-tools,
  .viewer-content-tools,
  .viewer-quick-tools {
    width: var(--viewer-left-width) !important;
  }
  .analysis-inspector {
    left: 18px !important;
    right: 18px !important;
    bottom: 82px !important;
    width: auto !important;
    max-width: none !important;
  }
}

/* Map screen keeps its compact Back to 3D control. */
#back-to-3d {
  width: auto !important;
  height: auto !important;
  left: 22px !important;
  right: auto !important;
  padding: 9px 13px !important;
  border-radius: 999px !important;
  text-align: center !important;
}


/* =====================================
   V7 — DECAY INFORMATION INTERACTION
===================================== */
.decay-sublayer-row {
  grid-template-columns: 18px minmax(0, 1fr) 24px 72px !important;
}
.decay-checkbox-only {
  width: 18px !important;
  min-width: 18px !important;
  display: grid !important;
  place-items: center !important;
  margin: 0 !important;
}
.decay-checkbox-only input[type="checkbox"] {
  margin: 0 !important;
}
.decay-name-button {
  min-width: 0;
  padding: 0 3px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #2c2c2c;
  font: inherit;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.decay-name-button:hover,
.decay-name-button:focus-visible {
  color: #000;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* The old circular i control is intentionally removed in V7. */
.decay-info-button { display: none !important; }

.analysis-inspector {
  width: 340px !important;
  max-height: 58vh !important;
  padding: 18px 18px 16px !important;
  border-radius: 12px !important;
}
.analysis-inspector h3 {
  margin-bottom: 11px !important;
  font-size: 17px !important;
  line-height: 1.15 !important;
}
.analysis-inspector-body h4 {
  margin: 11px 0 3px !important;
  font-size: 8.5px !important;
}
.analysis-inspector-body p {
  font-size: 10.5px !important;
  line-height: 1.45 !important;
}
.analysis-caution {
  margin-top: 12px !important;
  padding-top: 10px !important;
  font-size: 8.5px !important;
  line-height: 1.4 !important;
}


/* =====================================
   HERITAGE PLATFORM V8 — FINAL POLISH
===================================== */
:root {
  --burgundy-accent: #7a1f1f;
  --burgundy-accent-soft: rgba(122,31,31,.18);
  --burgundy-accent-mid: rgba(122,31,31,.28);
}

/* unify active accents */
.measure-tool-button.is-active,
.viewer-tool-button.is-active,
#toggle-section.is-active,
.viewer-content-button.is-active {
  border-color: var(--burgundy-accent) !important;
  background: var(--burgundy-accent) !important;
  color: #fff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 10px 24px rgba(122,31,31,.16) !important;
}

.measurement-status {
  border: 1px solid rgba(0,0,0,.08) !important;
  background: rgba(16,18,22,.92) !important;
  color: rgba(255,255,255,.85) !important;
}

/* decay rows */
.decay-sublayers {
  display: grid !important;
  gap: 8px !important;
}
.decay-sublayer-row {
  display: grid !important;
  grid-template-columns: 18px minmax(0,1fr) 24px 68px !important;
  align-items: center !important;
  column-gap: 10px !important;
  min-height: 38px !important;
  padding: 6px 10px !important;
  border: 1px solid rgba(0,0,0,.04) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.44) !important;
}
.decay-name-button {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  color: #232323 !important;
  font-size: 10.5px !important;
  font-weight: 500 !important;
  line-height: 1.15 !important;
  letter-spacing: 0 !important;
  text-align: left !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  background: transparent !important;
  border: 0 !important;
}
.decay-name-button:hover,
.decay-name-button:focus-visible {
  color: var(--burgundy-accent) !important;
  text-decoration: none !important;
}
.decay-checkbox-only,
.decay-checkbox-only input[type="checkbox"] {
  margin: 0 !important;
}
.decay-checkbox-only {
  width: 18px !important;
  min-width: 18px !important;
  display: grid !important;
  place-items: center !important;
}

/* thin minimal controls */
.model-color-input,
.decay-color-input,
.display-color-row input[type="color"] {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  padding: 2px !important;
  border-radius: 8px !important;
  border: 1px solid rgba(0,0,0,.12) !important;
  background: rgba(255,255,255,.96) !important;
  box-shadow: none !important;
}
.layer-opacity-input,
.decay-opacity-input,
#decay-line-thickness {
  width: 68px !important;
  height: 14px !important;
}
.layer-opacity-input::-webkit-slider-runnable-track,
.decay-opacity-input::-webkit-slider-runnable-track,
#decay-line-thickness::-webkit-slider-runnable-track,
.layer-opacity-input::-moz-range-track,
.decay-opacity-input::-moz-range-track,
#decay-line-thickness::-moz-range-track {
  background: rgba(26,26,26,.26) !important;
}
.layer-opacity-input::-webkit-slider-thumb,
.decay-opacity-input::-webkit-slider-thumb,
#decay-line-thickness::-webkit-slider-thumb,
.layer-opacity-input::-moz-range-thumb,
.decay-opacity-input::-moz-range-thumb,
#decay-line-thickness::-moz-range-thumb {
  background: #2b2b2b !important;
}

/* display palette rows */
.viewer-display-settings {
  display: grid !important;
  gap: 12px !important;
}
.background-preset-row,
.display-color-row {
  display: grid !important;
  grid-template-columns: 88px 1fr !important;
  align-items: center !important;
  gap: 12px !important;
}
.background-preset-row > span,
.display-color-row > span {
  margin: 0 !important;
  color: #2c2c2c !important;
  font-size: 10.5px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}
.background-swatches {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
}
.background-swatch,
.background-custom-swatch,
.display-color-row input[type="color"] {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(0,0,0,.12) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.45) !important;
}
.background-swatch.is-active,
.background-custom-swatch.is-active {
  border-color: #1e2125 !important;
  box-shadow: 0 0 0 1px rgba(30,33,37,.12), inset 0 0 0 1px rgba(255,255,255,.4) !important;
}
.display-color-row input[type="color"] {
  justify-self: start !important;
}

/* analysis inspector accent switched to dark red */
.analysis-inspector {
  background: rgba(14,15,18,.96) !important;
  color: #fff !important;
}
.analysis-inspector-kicker,
.analysis-inspector-body h4 {
  color: var(--burgundy-accent) !important;
}
.analysis-caution {
  color: rgba(255,255,255,.72) !important;
  border-top: 1px solid rgba(255,255,255,.1) !important;
}

.measurement-history-name:focus {
  color: var(--burgundy-accent) !important;
}
.measurement-history-item.is-active,
.measurement-chip,
.measurement-badge {
  border-color: var(--burgundy-accent-soft) !important;
}

/* section box accent */
#toggle-section.is-active {
  color: #fff !important;
}
.section-panel-button.is-active,
.section-mode-button.is-active {
  border-color: var(--burgundy-accent) !important;
  background: var(--burgundy-accent) !important;
  color: #fff !important;
}

@media (max-width: 820px) {
  .background-preset-row,
  .display-color-row {
    grid-template-columns: 82px 1fr !important;
  }
}


/* =====================================
   HERITAGE PLATFORM V10 — UI CONSISTENCY
===================================== */

/* The right panel uses a consistent, slightly larger type scale. */
#model-screen .layer-toggle-row,
#model-screen .layer-secondary-select,
#model-screen .mesh-display-select,
#model-screen .point-display-select,
#model-screen .decay-name-button,
#model-screen .background-preset-row > span,
#model-screen .display-color-row > span {
  font-size: 12.5px !important;
}
#model-screen .layer-group-header,
#model-screen .display-settings-title,
#model-screen .measurement-history-header {
  font-size: 11px !important;
}
#model-screen .decay-thickness-control > label,
#model-screen .layer-section-label,
#model-screen .analysis-layer-note,
#model-screen .measurement-history-empty,
#model-screen .layer-opacity-value {
  font-size: 10px !important;
}
#model-screen .back-to-map-button,
#model-screen .measure-tool-button,
#model-screen .measure-unit-select,
#model-screen .viewer-tool-button {
  font-size: 11px !important;
}
#model-screen .measurement-status { font-size: 11px !important; }
#model-screen .viewer-content-title { font-size: 13px !important; }
#model-screen .viewer-content-subtitle { font-size: 10.5px !important; }
#model-screen .drawer-note,
#model-screen .survey-info-card p,
#model-screen .survey-info-card li,
#model-screen .photo-lightbox-counter,
#model-screen .photo-lightbox-content figcaption { font-size: 12px !important; }

/* Decay rows: one line, no inherited button chrome, no overlap. */
.decay-sublayers {
  width: 100% !important;
  box-sizing: border-box !important;
}
.decay-sublayer-row {
  width: 100% !important;
  box-sizing: border-box !important;
  display: grid !important;
  grid-template-columns: 18px minmax(0,1fr) 26px 82px !important;
  align-items: center !important;
  column-gap: 10px !important;
  min-height: 42px !important;
  padding: 6px 10px !important;
}
.decay-name-button {
  appearance: none !important;
  -webkit-appearance: none !important;
  min-width: 0 !important;
  width: 100% !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  line-height: 1.2 !important;
  text-align: left !important;
}
.model-color-input, .decay-color-input {
  width: 26px !important;
  height: 26px !important;
  min-width: 26px !important;
}
.layer-opacity-input, .decay-opacity-input {
  width: 82px !important;
  height: 12px !important;
}
.layer-opacity-input::-webkit-slider-thumb,
.decay-opacity-input::-webkit-slider-thumb,
#decay-line-thickness::-webkit-slider-thumb {
  width: 11px !important;
  height: 11px !important;
}

/* Decay line thickness returns to a full-width control. */
.decay-thickness-control {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 10px 12px !important;
}
.decay-thickness-row {
  display: grid !important;
  grid-template-columns: minmax(0,1fr) 48px !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
}
#decay-line-thickness {
  width: 100% !important;
  min-width: 0 !important;
}
#decay-line-thickness-value {
  width: 48px !important;
  text-align: right !important;
  font-size: 10px !important;
}

/* Display rows share exactly the same grid, type and circular swatch language. */
.viewer-display-settings {
  gap: 13px !important;
}
.background-preset-row,
.display-color-row {
  display: grid !important;
  grid-template-columns: 112px minmax(0,1fr) !important;
  align-items: center !important;
  min-height: 30px !important;
  gap: 12px !important;
  padding: 0 !important;
}
.background-preset-row > span,
.display-color-row > span {
  width: 112px !important;
  font-weight: 500 !important;
  line-height: 1.2 !important;
}
.background-swatches {
  min-height: 30px !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}
.background-swatch,
.background-custom-swatch,
#measurement-color {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  padding: 2px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(0,0,0,.16) !important;
  background: #fff !important;
  box-sizing: border-box !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55) !important;
}
#measurement-color {
  justify-self: start !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  overflow: hidden !important;
}
#measurement-color::-webkit-color-swatch-wrapper {
  padding: 1px !important;
  border-radius: 50% !important;
}
#measurement-color::-webkit-color-swatch {
  border: 0 !important;
  border-radius: 50% !important;
}
#measurement-color::-moz-color-swatch {
  border: 0 !important;
  border-radius: 50% !important;
}

/* Left UI remains one aligned column and Back to Map stays full-width. */
.back-to-map-button,
.viewer-measure-tools,
.viewer-content-tools,
.viewer-quick-tools,
.section-mode-toolbar {
  width: var(--viewer-left-width) !important;
  box-sizing: border-box !important;
}
.back-to-map-button {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
}

/* Standard section-box modes: face arrows for resize, local gizmo for move/rotate. */
.section-mode-toolbar {
  position: absolute !important;
  left: var(--viewer-left) !important;
  bottom: 76px !important;
  z-index: 31 !important;
  display: none !important;
  grid-template-columns: repeat(4, minmax(0,1fr)) !important;
  gap: 4px !important;
  padding: 5px !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  border-radius: 10px !important;
  background: rgba(22,23,25,.92) !important;
  backdrop-filter: blur(8px) !important;
}
.section-mode-toolbar.is-open { display: grid !important; }
.section-mode-button {
  height: 31px !important;
  min-width: 0 !important;
  padding: 0 7px !important;
  border: 0 !important;
  border-radius: 6px !important;
  background: transparent !important;
  color: rgba(255,255,255,.78) !important;
  font-size: 10.5px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}
.section-mode-button:hover { background: rgba(255,255,255,.08) !important; color: #fff !important; }
.section-mode-button.is-active { background: #7a1f1f !important; color: #fff !important; }
.section-reset-button { border-left: 1px solid rgba(255,255,255,.10) !important; }

/* Decay information: readable +2px scale and a clean, even text block. */
.analysis-inspector {
  width: 370px !important;
  padding: 20px !important;
}
.analysis-inspector h3 {
  font-size: 19px !important;
  line-height: 1.2 !important;
  margin: 0 30px 13px 0 !important;
}
.analysis-inspector-kicker {
  font-size: 10px !important;
}
.analysis-inspector-body h4 {
  font-size: 10.5px !important;
  margin: 14px 0 4px !important;
  color: #7a1f1f !important;
}
.analysis-inspector-body p,
.analysis-caution {
  width: 100% !important;
  box-sizing: border-box !important;
  font-size: 12.5px !important;
  line-height: 1.52 !important;
  text-align: justify !important;
  text-align-last: left !important;
  hyphens: auto !important;
  overflow-wrap: break-word !important;
}
.analysis-caution {
  margin-top: 15px !important;
  padding-top: 12px !important;
}
.analysis-inspector-kicker,
.analysis-inspector-body h4,
.measurement-history-name:focus {
  color: #7a1f1f !important;
}

@media (max-width: 820px) {
  .background-preset-row, .display-color-row {
    grid-template-columns: 102px minmax(0,1fr) !important;
  }
  .background-preset-row > span, .display-color-row > span { width: 102px !important; }
  .section-mode-toolbar { bottom: 76px !important; }
}

.decay-layer-group { width: 100% !important; box-sizing: border-box !important; }

/* =====================================
   HERITAGE PLATFORM V11 — FINAL FIXES
===================================== */

/* Never create a horizontal scrollbar in the right explorer. */
#model-sidebar.sidebar {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
  transition: transform .28s ease, opacity .22s ease !important;
  will-change: transform;
}
#model-sidebar.sidebar > *,
#model-sidebar.sidebar .layer-item,
#model-sidebar.sidebar .layer-group,
#model-sidebar.sidebar .viewer-display-settings,
#model-sidebar.sidebar .buttons {
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
#model-sidebar.sidebar.is-collapsed {
  transform: translateX(calc(100% + 34px)) !important;
  opacity: .12;
  pointer-events: none;
}

/* External collapse tab stays available when the panel slides off screen. */
.sidebar-collapse-toggle {
  position: absolute;
  z-index: 34;
  top: 34px;
  right: calc(var(--viewer-right-width) + 30px);
  width: auto;
  height: 42px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 20px;
  background: rgba(20,20,20,.78);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  transition: right .28s ease, background .2s ease, transform .2s ease;
}
.sidebar-collapse-toggle:hover {
  background: #7a1f1f;
  transform: translateX(-1px);
}
#model-screen.sidebar-collapsed .sidebar-collapse-toggle {
  right: 22px;
}

/* Background / Measurement: same 28px circles, all six swatches fit on one row. */
.background-preset-row,
.display-color-row {
  grid-template-columns: 96px minmax(0,1fr) !important;
  gap: 10px !important;
  width: 100% !important;
  min-width: 0 !important;
}
.background-preset-row > span,
.display-color-row > span {
  width: auto !important;
  min-width: 0 !important;
}
.background-swatches {
  width: 100% !important;
  min-width: 0 !important;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
  overflow: visible !important;
}
.background-swatch,
.background-custom-swatch,
#measurement-color {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  flex: 0 0 28px !important;
  border-radius: 50% !important;
}

/* Re-apply preset fills after the generic circle rule (which previously forced them white). */
.background-swatch-porcelain { background: linear-gradient(145deg,#f6f7f6,#d7dce0) !important; }
.background-swatch-ivory { background: linear-gradient(145deg,#f6f1e8,#d6cec1) !important; }
.background-swatch-graphite { background: linear-gradient(145deg,#51565c,#25292e) !important; }
.background-swatch-warm { background: linear-gradient(145deg,#87827a,#4b4946) !important; }
.background-swatch-bluegrey { background: linear-gradient(145deg,#788895,#43515d) !important; }
.background-custom-swatch {
  background: conic-gradient(#f4b5b5,#f4e0a8,#b9e2bf,#b9d8ef,#d7bce8,#f4b5b5) !important;
}

/* Upper and decay opacity controls use one identical geometry and thumb style. */
.layer-opacity-input,
.decay-opacity-input {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 82px !important;
  min-width: 82px !important;
  height: 14px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  cursor: ew-resize !important;
}
.layer-opacity-input::-webkit-slider-runnable-track,
.decay-opacity-input::-webkit-slider-runnable-track {
  height: 2px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(30,30,30,.28) !important;
}
.layer-opacity-input::-webkit-slider-thumb,
.decay-opacity-input::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 12px !important;
  height: 12px !important;
  margin-top: -5px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #252525 !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) !important;
}
.layer-opacity-input::-moz-range-track,
.decay-opacity-input::-moz-range-track {
  height: 2px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(30,30,30,.28) !important;
}
.layer-opacity-input::-moz-range-thumb,
.decay-opacity-input::-moz-range-thumb {
  width: 12px !important;
  height: 12px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #252525 !important;
  box-shadow: 0 0 0 1px rgba(255,255,255,.55) !important;
}

/* Keep top layer grids within the panel after matching the 82px opacity width. */
.layer-primary-row-model {
  grid-template-columns: minmax(0,1fr) 26px 82px !important;
  min-width: 0 !important;
}
.layer-primary-row-point {
  grid-template-columns: minmax(0,1fr) 82px !important;
  min-width: 0 !important;
}

/* Section resize arrows are deliberately interactive controls. */
#viewer canvas {
  touch-action: none;
}

@media (max-width: 820px) {
  .sidebar-collapse-toggle {
    top: 24px;
    right: calc(min(340px, calc(100vw - 34px)) + 22px);
  }
  #model-screen.sidebar-collapsed .sidebar-collapse-toggle {
    right: 12px;
  }
  .background-preset-row,
  .display-color-row {
    grid-template-columns: 82px minmax(0,1fr) !important;
    gap: 8px !important;
  }
  .background-swatches { gap: 5px !important; }
}



/* =====================================
   V12 — display swatch geometry fixes
===================================== */
/* Background and Measurement controls are exactly the same 28px circle. */
.background-swatch,
.background-custom-swatch,
#measurement-color {
  width: 28px !important;
  height: 28px !important;
  min-width: 28px !important;
  min-height: 28px !important;
  flex: 0 0 28px !important;
  border-radius: 50% !important;
  box-sizing: border-box !important;
}

/* Remove the native white ring / inset ring around the Measurement color input. */
#measurement-color {
  padding: 0 !important;
  border: 1px solid rgba(0,0,0,.16) !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: hidden !important;
}
#measurement-color::-webkit-color-swatch-wrapper {
  padding: 0 !important;
  border: 0 !important;
}
#measurement-color::-webkit-color-swatch {
  border: 0 !important;
  border-radius: 50% !important;
}
#measurement-color::-moz-color-swatch {
  border: 0 !important;
  border-radius: 50% !important;
}

/* =====================================
   V14 — INTRO SCREEN MATCH
   Matches the supplied black title-screen reference.
===================================== */
.intro-screen {
  background: #000 !important;
}

.intro-content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 !important;
  display: block !important;
  border: 0;
  background: transparent !important;
  text-align: left;
}

.intro-content h1 {
  position: absolute;
  left: 9.8vw;
  top: 31.1vh;
  max-width: 84vw;
  margin: 0;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(68px, 8.25vw, 132px);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: -0.055em;
  white-space: nowrap;
  transform: none !important;
  transition: opacity .35s ease;
}

.intro-content:hover h1 {
  transform: none !important;
}

.intro-location {
  position: absolute;
  left: 8.8vw;
  top: 65.3vh;
  margin: 0;
  color: rgba(255,255,255,.58);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .27em;
  text-transform: uppercase;
}

.intro-instruction {
  position: absolute;
  right: 5.3vw;
  bottom: 5.4vh;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  color: rgba(255,255,255,.82);
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: .22em;
  text-transform: uppercase;
  white-space: nowrap;
}

.intro-instruction::before {
  content: "";
  display: block;
  width: 44px;
  height: 1px;
  margin: 0;
  background: rgba(255,255,255,.48);
}

.intro-secondary-actions {
  position: absolute;
  z-index: 310;
  left: 5.35vw;
  bottom: 5.25vh;
  display: block;
}

.intro-secondary-actions .skip-intro-button,
.skip-intro-button {
  position: static !important;
  min-width: 162px;
  height: 39px;
  padding: 0 18px !important;
  border: 1px solid rgba(255,255,255,.27) !important;
  border-radius: 999px;
  background: transparent !important;
  color: rgba(255,255,255,.78) !important;
  box-shadow: none;
  backdrop-filter: none !important;
  font-size: 10px;
  font-weight: 700;
  line-height: 37px;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  transform: none !important;
}

.intro-secondary-actions .skip-intro-button:hover,
.skip-intro-button:hover {
  border-color: rgba(255,255,255,.55) !important;
  background: rgba(255,255,255,.06) !important;
  color: #fff !important;
  transform: none !important;
}

@media (max-width: 900px) {
  .intro-content h1 {
    left: 8vw;
    top: 31vh;
    max-width: 88vw;
    font-size: clamp(50px, 10vw, 88px);
    white-space: normal;
  }
  .intro-location { left: 8vw; top: 64vh; }
  .intro-secondary-actions { left: 8vw; }
  .intro-instruction { right: 8vw; }
}

@media (max-width: 600px) {
  .intro-content h1 {
    left: 7vw;
    top: 29vh;
    max-width: 86vw;
    font-size: clamp(45px, 13vw, 70px);
    line-height: .96;
  }
  .intro-location {
    left: 7vw;
    top: 61vh;
    font-size: 10px;
  }
  .intro-secondary-actions {
    left: 7vw;
    bottom: 5vh;
  }
  .intro-instruction {
    right: 7vw;
    bottom: 11vh;
    font-size: 9px;
  }
}

/* =====================================
   V15 INTRO MONTAGE OVERRIDES
===================================== */

.intro-screen {
  background: #000000;
}

.intro-content {
  position: relative;
  z-index: 4;
}

.intro-content:hover h1 {
  transform: none;
}

.intro-secondary-actions {
  position: absolute;
  z-index: 5;
  left: 4.8vw;
  bottom: 4.3vh;
}

.intro-secondary-actions .skip-intro-button,
.skip-intro-button {
  min-width: 164px;
  padding: 13px 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(16, 16, 16, 0.72);
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.intro-secondary-actions .skip-intro-button:hover,
.skip-intro-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateY(-1px);
}

.intro-montage {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.intro-montage-slide {
  position: absolute;
  inset: 0;
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
  transform: scale(1.03);
  transition: opacity 0.24s ease, transform 0.55s ease;
  will-change: opacity, transform;
}

.intro-montage-slide.is-visible {
  opacity: 1;
  transform: scale(1);
}

.intro-montage-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.66) 0%, rgba(0, 0, 0, 0.12) 27%, rgba(0, 0, 0, 0.15) 100%),
    linear-gradient(to right, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0) 42%, rgba(0, 0, 0, 0.16) 100%);
}

.intro-montage-location {
  position: absolute;
  left: 50%;
  bottom: 7.6vh;
  z-index: 2;
  max-width: 88vw;
  transform: translateX(-50%);
  color: #ffffff;
  font-size: clamp(34px, 6.5vw, 94px);
  line-height: 0.94;
  font-weight: 500;
  letter-spacing: -0.045em;
  text-align: center;
  text-transform: uppercase;
  text-wrap: balance;
  text-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.intro-montage-location.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.intro-screen.is-playing-montage .intro-content {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-screen.is-playing-montage .intro-montage {
  opacity: 1;
  visibility: visible;
}

@media (max-width: 900px) {
  .intro-secondary-actions {
    left: 8vw;
    bottom: 5vh;
  }

  .intro-montage-location {
    bottom: 9vh;
    max-width: 92vw;
    font-size: clamp(28px, 11vw, 56px);
  }
}


/* =====================================
   V16 INTRO TYPOGRAPHY + QUALITY TUNING
===================================== */

.intro-montage-slide {
  transform: none;
  transition: opacity 0.22s ease;
  backface-visibility: hidden;
}

.intro-montage-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  image-rendering: auto;
}

.intro-montage-location {
  top: 50%;
  bottom: auto;
  left: 50%;
  max-width: 84vw;
  transform: translate(-50%, -50%);
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  font-size: clamp(52px, 8.6vw, 126px);
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: -0.035em;
  text-transform: none;
  text-shadow: 0 10px 34px rgba(0, 0, 0, 0.34);
}

.intro-montage-location.is-visible {
  transform: translate(-50%, -50%);
}

@media (max-width: 900px) {
  .intro-montage-location {
    top: 50%;
    bottom: auto;
    max-width: 90vw;
    font-size: clamp(38px, 12vw, 74px);
    line-height: 0.92;
  }
}


/* =====================================
   V22-BW CINEMATIC INTRO VARIANT
   Black & white, high contrast, filmic montage only
===================================== */

.intro-montage-slide {
  filter: grayscale(1) contrast(1.34) brightness(0.88);
}

.intro-montage-overlay {
  background:
    radial-gradient(circle at 50% 44%, rgba(255,255,255,0.025) 0%, rgba(0,0,0,0.08) 52%, rgba(0,0,0,0.50) 100%),
    linear-gradient(to top, rgba(0,0,0,0.62) 0%, rgba(0,0,0,0.08) 31%, rgba(0,0,0,0.14) 100%);
  mix-blend-mode: normal;
}

.intro-montage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.20;
  background-image:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.018) 0px,
      rgba(255,255,255,0.018) 1px,
      rgba(0,0,0,0.018) 1px,
      rgba(0,0,0,0.018) 2px
    );
}

.intro-montage-location {
  z-index: 3;
  color: #ffffff;
  text-shadow:
    0 3px 10px rgba(0,0,0,0.52),
    0 14px 38px rgba(0,0,0,0.40);
}


/* V23 BW intro refinements */
.cinematic-landmark { text-align: left; justify-items: start; align-items: start; }
.cinematic-city, .cinematic-name, .cinematic-sequence { text-align: left; }


/* =====================================
   V25 BW INTRO LAYOUT + TITLE FONT
===================================== */
:root {
  --intro-gutter-x: 8.6vw;
}

.intro-content h1 {
  left: var(--intro-gutter-x) !important;
  top: 30.5vh !important;
  max-width: 78vw !important;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif !important;
  font-size: clamp(74px, 8.6vw, 144px) !important;
  font-weight: 600 !important;
  line-height: 0.9 !important;
  letter-spacing: -0.03em !important;
}

.intro-location {
  left: var(--intro-gutter-x) !important;
  top: 63.8vh !important;
}

.intro-secondary-actions {
  left: var(--intro-gutter-x) !important;
  bottom: 5.35vh !important;
}

.intro-instruction {
  right: var(--intro-gutter-x) !important;
  bottom: 5.45vh !important;
}

.intro-instruction::before {
  width: 48px !important;
}

@media (max-width: 900px) {
  :root {
    --intro-gutter-x: 8vw;
  }

  .intro-content h1 {
    top: 31.5vh !important;
    max-width: 84vw !important;
    font-size: clamp(56px, 11vw, 96px) !important;
  }

  .intro-location {
    top: 63vh !important;
  }
}

@media (max-width: 600px) {
  :root {
    --intro-gutter-x: 7vw;
  }

  .intro-content h1 {
    top: 30vh !important;
    max-width: 86vw !important;
    font-size: clamp(46px, 13.6vw, 74px) !important;
    line-height: 0.92 !important;
  }

  .intro-location {
    top: 60.5vh !important;
  }

  .intro-secondary-actions {
    bottom: 5vh !important;
  }

  .intro-instruction {
    right: var(--intro-gutter-x) !important;
    bottom: 11vh !important;
  }
}


/* =====================================
   V27 BW DECAY INFO AFFORDANCE
===================================== */
.decay-info-hint {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin: 8px 0 10px !important;
  padding: 7px 10px !important;
  border: 1px solid rgba(0,0,0,.07) !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.44) !important;
  color: #6a6a6a !important;
  font-size: 10px !important;
  line-height: 1.2 !important;
}

.decay-info-hint-icon,
.decay-info-badge {
  display: inline-grid !important;
  place-items: center !important;
  border: 1px solid rgba(122, 31, 31, .34) !important;
  border-radius: 999px !important;
  color: #7a1f1f !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: italic !important;
  font-weight: 700 !important;
}

.decay-info-hint-icon {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  font-size: 11px !important;
  background: rgba(122, 31, 31, .05) !important;
}

.decay-name-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}

.decay-name-label {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.decay-info-badge {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px !important;
  font-size: 10px !important;
  background: rgba(122, 31, 31, .06) !important;
  transition: transform .16s ease, background .16s ease, border-color .16s ease !important;
}

.decay-name-button:hover .decay-info-badge,
.decay-name-button:focus-visible .decay-info-badge {
  transform: scale(1.08) !important;
  background: rgba(122, 31, 31, .12) !important;
  border-color: rgba(122, 31, 31, .56) !important;
}

/* =====================================
   V28 TITLE UNIFICATION + BALANCED INTRO GUTTERS
   All three cinematic serif titles use the same typeface.
===================================== */
:root {
  --intro-gutter-x: 8.6vw;
  --cinematic-title-font: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

/* Main black intro title — same face as the TORINO montage title. */
.intro-content h1 {
  left: var(--intro-gutter-x) !important;
  right: var(--intro-gutter-x) !important;
  width: auto !important;
  max-width: none !important;
  font-family: var(--cinematic-title-font) !important;
  font-size: clamp(78px, 9.45vw, 168px) !important;
  font-weight: 500 !important;
  line-height: 0.90 !important;
  letter-spacing: -0.035em !important;
}

/* Montage city title, including TORINO. */
.intro-montage-location {
  font-family: var(--cinematic-title-font) !important;
  font-weight: 500 !important;
  line-height: 0.90 !important;
  letter-spacing: -0.035em !important;
}

/* Large title over the Cesium map. */
.cinematic-name {
  font-family: var(--cinematic-title-font) !important;
  font-weight: 500 !important;
  line-height: 0.90 !important;
  letter-spacing: -0.035em !important;
}

/* One common horizontal gutter system for the intro composition. */
.intro-location,
.intro-secondary-actions {
  left: var(--intro-gutter-x) !important;
}

.intro-instruction {
  right: var(--intro-gutter-x) !important;
}

@media (max-width: 900px) {
  :root {
    --intro-gutter-x: 8vw;
  }

  .intro-content h1 {
    font-size: clamp(54px, 11.7vw, 96px) !important;
  }
}


/* =====================================
   V29 — REQUESTED MINIMAL UI CHANGES
===================================== */
:root {
  --viewer-right-width: 420px;
}

/* =====================================
   V31 — FINAL SIDEBAR WIDTH + DISPLAY ALIGNMENT
===================================== */
:root {
  --viewer-right-width: 405px;
}

.background-swatches {
  justify-content: flex-end !important;
}

/* =====================================
   V32 — ALIGN MEASUREMENT COLOUR WITH CUSTOM BACKGROUND
===================================== */
#measurement-color {
  justify-self: end !important;
}


/* =====================================
   V33 — MOBILE-READY RESPONSIVE LAYOUT
   Desktop rules above remain unchanged.
===================================== */

@media (max-width: 900px) {
  :root {
    --viewer-left: 12px;
    --viewer-left-width: calc(100vw - 24px);
    --viewer-right-width: calc(100vw - 24px);
    --mobile-safe-bottom: max(12px, env(safe-area-inset-bottom));
  }

  html,
  body {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overscroll-behavior: none;
  }

  /* Intro: keep the desktop visual language, but fit narrow screens. */
  .intro-content {
    padding: 0 !important;
  }

  .intro-content h1 {
    left: 7vw !important;
    right: 7vw !important;
    top: 27vh !important;
    width: auto !important;
    max-width: none !important;
    font-size: clamp(44px, 13.2vw, 86px) !important;
    line-height: 0.92 !important;
    letter-spacing: -0.03em !important;
  }

  .intro-secondary-actions {
    left: 7vw !important;
    bottom: max(5.5vh, calc(env(safe-area-inset-bottom) + 18px)) !important;
  }

  .skip-intro-button {
    min-height: 44px !important;
    padding: 0 16px !important;
    font-size: 10px !important;
  }

  .intro-instruction {
    right: 7vw !important;
    bottom: max(14vh, calc(env(safe-area-inset-bottom) + 78px)) !important;
    font-size: 10px !important;
  }

  /* Cesium / map screen. */
  .earth-header {
    top: max(18px, env(safe-area-inset-top)) !important;
    left: 16px !important;
    right: 16px !important;
    gap: 12px !important;
  }

  .earth-project {
    max-width: 56vw !important;
    font-size: 9px !important;
    line-height: 1.35 !important;
  }

  #flight-status {
    max-width: 34vw !important;
    font-size: 9px !important;
    text-align: right !important;
  }

  .cinematic-landmark {
    left: 7vw !important;
    right: 7vw !important;
    max-width: 86vw !important;
  }

  .cinematic-name {
    max-width: 86vw !important;
    font-size: clamp(42px, 12vw, 76px) !important;
    line-height: 0.92 !important;
  }

  .route-information {
    left: 16px !important;
    right: 16px !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none !important;
    transform: none !important;
    justify-content: center !important;
  }

  .map-to-3d-button,
  #back-to-map {
    width: auto !important;
    min-width: 112px !important;
    height: 44px !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    left: 12px !important;
    padding: 0 14px !important;
    text-align: center !important;
    font-size: 10px !important;
  }

  /* 3D viewer: the model gets priority; UI becomes drawers / compact controls. */
  #viewer,
  #viewer canvas,
  .measurement-label-layer {
    width: 100vw !important;
    height: 100dvh !important;
  }

  .sidebar {
    top: 64px !important;
    right: 12px !important;
    bottom: var(--mobile-safe-bottom) !important;
    left: 12px !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    padding: 14px !important;
    border-radius: 16px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  #model-sidebar.sidebar.is-collapsed {
    transform: translateX(calc(100% + 30px)) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  .sidebar-collapse-toggle,
  #model-screen.sidebar-collapsed .sidebar-collapse-toggle {
    position: absolute !important;
    z-index: 60 !important;
    top: max(12px, env(safe-area-inset-top)) !important;
    right: 12px !important;
    width: auto !important;
    padding: 0 16px !important;
    height: 44px !important;
    border-radius: 22px !important;
    font-size: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .viewer-measure-tools {
    top: calc(max(12px, env(safe-area-inset-top)) + 54px) !important;
    left: 12px !important;
    right: 12px !important;
    width: auto !important;
    max-width: none !important;
  }

  .measure-button-row {
    gap: 6px !important;
    flex-wrap: wrap !important;
  }

  .measure-tool-button {
    min-height: 40px !important;
    padding: 0 12px !important;
    font-size: 9px !important;
  }

  .measurement-status {
    max-width: calc(100vw - 24px) !important;
    font-size: 10px !important;
  }

  .viewer-content-tools {
    top: 128px !important;
    left: 12px !important;
    width: min(228px, calc(100vw - 78px)) !important;
    gap: 6px !important;
  }

  .viewer-content-button {
    height: 54px !important;
    padding: 9px 12px !important;
  }

  .viewer-quick-tools {
    left: 12px !important;
    right: auto !important;
    bottom: var(--mobile-safe-bottom) !important;
    gap: 6px !important;
  }

  .viewer-tool-button {
    min-width: 92px !important;
    min-height: 42px !important;
    padding: 0 12px !important;
    font-size: 9px !important;
  }

  /* Internal panel rows must stay readable on a narrow phone. */
  .layer-primary-row-model {
    grid-template-columns: minmax(0, 1fr) 26px 74px !important;
  }

  .layer-primary-row-point {
    grid-template-columns: minmax(0, 1fr) 74px !important;
  }

  .decay-sublayer-row {
    grid-template-columns: 22px minmax(0, 1fr) 24px 74px !important;
    column-gap: 6px !important;
  }

  .decay-name-label {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.15 !important;
  }

  .background-preset-row,
  .display-color-row {
    grid-template-columns: 88px minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  .background-swatches {
    justify-content: flex-end !important;
    gap: 5px !important;
  }

  /* Full-width content drawers for Photos / Information. */
  .viewer-drawer {
    top: 12px !important;
    right: 12px !important;
    bottom: var(--mobile-safe-bottom) !important;
    left: 12px !important;
    width: auto !important;
    max-width: none !important;
    padding: 16px !important;
    border-radius: 16px !important;
    -webkit-overflow-scrolling: touch;
  }

  .survey-photo-grid {
    grid-template-columns: 1fr !important;
  }

  .analysis-inspector {
    right: 12px !important;
    bottom: var(--mobile-safe-bottom) !important;
    left: 12px !important;
    width: auto !important;
    max-width: none !important;
  }

  .photo-lightbox {
    padding: 12px !important;
  }

  .photo-lightbox-content {
    width: 100% !important;
    max-width: none !important;
  }

  .photo-lightbox-stage {
    max-height: 72dvh !important;
  }

  .photo-lightbox-navigation,
  .photo-lightbox-close,
  .photo-lightbox-zoom-tools button {
    min-width: 44px !important;
    min-height: 44px !important;
  }

  .section-mode-toolbar {
    left: 12px !important;
    right: 12px !important;
    bottom: calc(var(--mobile-safe-bottom) + 54px) !important;
    width: auto !important;
    max-width: none !important;
    flex-wrap: wrap !important;
  }
}

@media (max-width: 520px) {
  .intro-content h1 {
    top: 25vh !important;
    font-size: clamp(40px, 13.8vw, 68px) !important;
  }

  .intro-instruction::before {
    width: 28px !important;
  }

  .viewer-content-tools {
    width: min(208px, calc(100vw - 78px)) !important;
  }

  .layer-primary-row-model {
    grid-template-columns: minmax(0, 1fr) 24px 68px !important;
  }

  .layer-primary-row-point {
    grid-template-columns: minmax(0, 1fr) 68px !important;
  }

  .decay-sublayer-row {
    grid-template-columns: 22px minmax(0, 1fr) 24px 68px !important;
  }

  .layer-opacity-input,
  .decay-opacity-input {
    width: 68px !important;
  }
}




/* =====================================
   V42 — WORKING POINT SIZE CONTROLS
   Matches Decay Line Thickness styling
===================================== */
.point-size-control {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin-top: 7px !important;
  padding: 10px 12px !important;
  background: rgba(255, 255, 255, 0.56) !important;
  border-radius: 7px !important;
}

.point-size-control > label {
  display: block !important;
  margin-bottom: 7px !important;
  color: #303030 !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

.point-size-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 48px !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
}

.point-size-row [data-point-size-value] {
  width: 48px !important;
  min-width: 48px !important;
  color: #303030 !important;
  font-size: 10px !important;
  font-variant-numeric: tabular-nums;
  text-align: right !important;
  white-space: nowrap !important;
}

.point-size-input {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 14px !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
  cursor: ew-resize !important;
}

.point-size-input::-webkit-slider-runnable-track {
  height: 2px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(30, 30, 30, 0.28) !important;
}

.point-size-input::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 11px !important;
  height: 11px !important;
  margin-top: -4.5px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #252525 !important;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.55) !important;
}

.point-size-input::-moz-range-track {
  height: 2px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(30, 30, 30, 0.28) !important;
}

.point-size-input::-moz-range-thumb {
  width: 11px !important;
  height: 11px !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: #252525 !important;
}

/* =====================================
   V46 — MOBILE PANEL COLLISION FIX
   When the 3D Model Explorer is open on a phone/tablet,
   hide the left floating tool stacks so they never overlap it.
   They return automatically when the sidebar is collapsed.
===================================== */
@media (max-width: 900px) {
  #model-screen:not(.sidebar-collapsed) .viewer-measure-tools,
  #model-screen:not(.sidebar-collapsed) .viewer-content-tools {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transform: translateX(-10px) !important;
  }

  #model-screen.sidebar-collapsed .viewer-measure-tools,
  #model-screen.sidebar-collapsed .viewer-content-tools {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .viewer-measure-tools,
  .viewer-content-tools {
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease !important;
  }
}


/* =====================================
   V47 — FINAL MOBILE UI + OPACITY LABELS
===================================== */
.layer-opacity-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
  white-space: nowrap;
}
.layer-opacity-label {
  flex: 0 0 auto;
  color: #8a8a8a;
  font-size: 7px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: .02em;
}
.layer-opacity-control .layer-opacity-input {
  flex: 0 0 72px;
  width: 72px !important;
  min-width: 0 !important;
}
.layer-primary-row-model {
  grid-template-columns: minmax(0, 1fr) 30px 116px !important;
}
.layer-primary-row-point {
  grid-template-columns: minmax(0, 1fr) 116px !important;
}
.decay-sublayer-row {
  grid-template-columns: 22px minmax(0, 1fr) 24px 110px !important;
}

/* When Photos / Information drawer is open on a phone, the sidebar handle
   is hidden so it can never sit underneath the drawer close button. */
@media (max-width: 900px) {
  #model-screen.viewer-drawer-open .sidebar-collapse-toggle {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .viewer-drawer-close {
    position: relative !important;
    z-index: 95 !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
  }

  .viewer-drawer-header {
    position: relative !important;
    z-index: 90 !important;
  }

  .layer-primary-row-model {
    grid-template-columns: minmax(0, 1fr) 26px 104px !important;
  }
  .layer-primary-row-point {
    grid-template-columns: minmax(0, 1fr) 104px !important;
  }
  .decay-sublayer-row {
    grid-template-columns: 22px minmax(0, 1fr) 24px 100px !important;
  }
  .layer-opacity-control {
    gap: 4px !important;
  }
  .layer-opacity-label {
    font-size: 6.5px !important;
  }
  .layer-opacity-control .layer-opacity-input,
  .layer-opacity-input,
  .decay-opacity-input {
    width: 64px !important;
    flex-basis: 64px !important;
  }
}

@media (max-width: 520px) {
  .layer-primary-row-model {
    grid-template-columns: minmax(0, 1fr) 24px 98px !important;
  }
  .layer-primary-row-point {
    grid-template-columns: minmax(0, 1fr) 98px !important;
  }
  .decay-sublayer-row {
    grid-template-columns: 22px minmax(0, 1fr) 24px 96px !important;
  }
  .layer-opacity-control .layer-opacity-input,
  .layer-opacity-input,
  .decay-opacity-input {
    width: 58px !important;
    flex-basis: 58px !important;
  }
}