/* Finalize gives lighting its own primary control and keeps framing secondary. */
.final-stage {
  gap: 12px;
}

.final-stage .final-lighting {
  flex: none;
  width: 64px;
}

.final-stage .final-light-button {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  min-height: 64px;
  padding: 0;
  border: 1px solid var(--red);
  border-radius: 50%;
  background: var(--control-wash);
  color: var(--red);
  transition: background-color 220ms var(--ease-settle),
    border-color 220ms var(--ease-settle), color 220ms var(--ease-settle),
    box-shadow 260ms var(--ease-settle), transform 160ms var(--ease-press);
}

.final-stage .final-light-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
}

.final-stage .final-light-icon .ui-icon {
  width: 28px;
  height: 28px;
}

.final-stage .final-light-icon .ui-icon path {
  transition: fill 220ms var(--ease-settle);
}

.final-stage .final-light-button.is-on {
  border-color: rgba(240, 190, 83, .55);
  background: rgba(240, 190, 83, .10);
  color: #f0c765;
  box-shadow: 0 0 22px rgba(240, 190, 83, .12);
}

.final-stage .final-light-button.is-on .ui-icon path {
  fill: rgba(240, 190, 83, .22);
}

.final-stage .final-light-button:active {
  transform: scale(.99);
}

.final-stage .final-light-button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.final-stage .final-framing-tools {
  display: flex;
  justify-content: center;
  width: min(100%, 290px);
  flex: none;
  color: var(--muted);
}

.final-stage .final-framing-tools .zoom-controls {
  justify-content: center;
  gap: 2px;
}

.final-stage .final-framing-tools .icon-btn {
  position: relative;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.final-stage .final-framing-tools .icon-btn::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid var(--line);
  border-radius: 50%;
  pointer-events: none;
  transition: border-color 180ms var(--ease-settle),
    background-color 180ms var(--ease-settle);
}

.final-stage .final-framing-tools .reset-view {
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  text-underline-offset: 3px;
}

/* Rotation stays with framing controls, in the same place in both modes. */
.final-orbit-toggle { display: none; }
.final-stage .final-framing-tools { width: min(100%, 340px); }
.final-stage .final-framing-tools .zoom-controls { flex-wrap: wrap; }

@media (max-width: 720px) {
  .final-stage .final-orbit-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 116px;
    gap: 6px;
    min-height: 44px;
    padding: 0 7px;
    border: 1px solid var(--line);
    border-radius: var(--ui-radius, 6px);
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.3;
    white-space: nowrap;
  }
  .final-stage .final-orbit-toggle .ui-icon {
    width: 16px;
    height: 16px;
    flex: none;
  }
  .final-stage .final-orbit-toggle.is-active {
    border-color: var(--red);
    background: var(--control-wash);
    color: var(--red);
  }
}

@media (hover: hover) and (pointer: fine) {
  .final-stage .final-light-button:hover {
    background: rgba(165, 9, 35, .075);
  }

  .final-stage .final-light-button.is-on:hover {
    background: rgba(240, 190, 83, .16);
    box-shadow: 0 0 26px rgba(240, 190, 83, .09);
  }

  .final-stage .final-framing-tools .icon-btn:hover,
  .final-stage .final-framing-tools .reset-view:hover {
    color: var(--red);
    background: transparent;
  }

  .final-stage .final-framing-tools .icon-btn:hover::before {
    border-color: var(--border);
    background: var(--control-wash);
  }
}

@media (min-width: 961px) and (max-height: 950px) {
  .final-stage {
    gap: 10px;
  }
}

@media (max-width: 720px) and (max-height: 450px) {
  .final-stage { padding-top: 0; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .final-stage .final-light-button,
  .final-stage .final-light-icon .ui-icon path,
  .final-stage .final-framing-tools .icon-btn::before {
    transition: none;
  }

  .final-stage .final-light-button:active {
    transform: none;
  }
}
