.sage-photo-studio {
  position: fixed;
  inset: 0;
  z-index: 30000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sage-photo-studio.open {
  display: flex;
}

.sage-photo-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2,1,4,.88);
  backdrop-filter: blur(14px);
}

.sage-photo-window {
  position: relative;
  width: min(1180px, 96vw);
  max-height: 94vh;
  overflow: hidden;
  border: 1px solid rgba(215,173,91,.46);
  border-radius: 34px 8px 34px 8px;
  color: #fbf7ff;
  background:
    linear-gradient(145deg,#17121e,#070509 65%);
  box-shadow:
    0 35px 100px rgba(0,0,0,.72),
    0 0 55px rgba(185,147,255,.12);
}

.sage-photo-header {
  min-height: 78px;
  padding: 16px 23px 15px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255,255,255,.07);
  background:
    linear-gradient(
      90deg,
      rgba(255,79,199,.11),
      rgba(185,147,255,.05),
      transparent
    );
}

.sage-photo-header p {
  margin: 0 0 4px;
  color: #3be3ad;
  font-size: .56rem;
  letter-spacing: .24em;
}

.sage-photo-header h2 {
  margin: 0;
  font: 500 1.9rem Georgia,serif;
}

.sage-photo-close {
  width: 43px;
  height: 43px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px 4px 14px 4px;
  color: white;
  background: rgba(255,255,255,.035);
  cursor: pointer;
  font-size: 1.55rem;
}

.sage-photo-layout {
  min-height: 590px;
  display: grid;
  grid-template-columns: 310px 1fr;
}

.sage-photo-controls {
  padding: 21px;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.07);
  background: rgba(0,0,0,.16);
}

.sage-upload-box {
  min-height: 145px;
  padding: 22px 15px;
  display: grid;
  place-items: center;
  align-content: center;
  border: 1px dashed rgba(185,147,255,.48);
  border-radius: 21px 6px 21px 6px;
  background: rgba(185,147,255,.06);
  cursor: pointer;
  text-align: center;
}

.sage-upload-box:hover {
  border-color: #ffe2a2;
}

.sage-upload-box > span {
  width: 41px;
  height: 41px;
  margin-bottom: 9px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #09070b;
  background:
    linear-gradient(135deg,#ffe2a2,#ff4fc7);
  font-size: 1.35rem;
}

.sage-upload-box strong,
.sage-upload-box small {
  display: block;
}

.sage-upload-box strong {
  font-size: .8rem;
  letter-spacing: .07em;
}

.sage-upload-box small {
  max-width: 235px;
  margin-top: 7px;
  color: rgba(251,247,255,.46);
  line-height: 1.5;
}

.sage-upload-box input {
  display: none;
}

.sage-photo-group {
  margin-top: 20px;
}

.sage-photo-group > label {
  display: flex;
  justify-content: space-between;
  color: rgba(251,247,255,.66);
  font-size: .64rem;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.sage-photo-group output {
  color: #ffe2a2;
}

.sage-photo-presets {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 7px;
}

.sage-photo-presets button {
  min-height: 38px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 11px 4px 11px 4px;
  color: rgba(251,247,255,.66);
  background: rgba(255,255,255,.035);
  cursor: pointer;
}

.sage-photo-presets button.active {
  border-color: #ff4fc7;
  color: white;
  background: rgba(255,79,199,.16);
}

.sage-photo-group input[type="range"] {
  width: 100%;
  margin-top: 12px;
  accent-color: #ff4fc7;
}

.sage-photo-convert,
.sage-photo-download {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(255,226,162,.56);
  border-radius: 16px 5px 16px 5px;
  cursor: pointer;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.sage-photo-convert {
  margin-top: 20px;
  color: #09070b;
  background:
    linear-gradient(100deg,#ffe2a2,#ff4fc7);
}

.sage-photo-download {
  color: #fbf7ff;
  background: rgba(215,173,91,.11);
}

.sage-photo-convert:disabled,
.sage-photo-download:disabled {
  opacity: .34;
  cursor: not-allowed;
}

.sage-photo-status {
  min-height: 18px;
  margin: 10px 0 0;
  color: rgba(251,247,255,.45);
  font-size: .64rem;
  line-height: 1.45;
  text-align: center;
}

.sage-photo-preview {
  min-width: 0;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.sage-photo-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.sage-photo-tabs button {
  padding: 8px 17px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  color: rgba(251,247,255,.55);
  background: rgba(255,255,255,.025);
  cursor: pointer;
}

.sage-photo-tabs button.active {
  border-color: rgba(185,147,255,.58);
  color: white;
  background: rgba(185,147,255,.14);
}

.sage-photo-canvas-area {
  position: relative;
  min-height: 445px;
  margin: 14px 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 26px 7px 26px 7px;
  background: #0c0a0f;
}

.sage-photo-canvas-area canvas {
  display: none;
  max-width: 96%;
  max-height: 65vh;
  width: auto;
  height: auto;
  background: white;
  box-shadow: 0 15px 50px rgba(0,0,0,.55);
}

.sage-photo-canvas-area canvas.visible {
  display: block;
}

.sage-photo-empty {
  display: grid;
  place-items: center;
  color: rgba(251,247,255,.42);
  text-align: center;
}

.sage-photo-empty span {
  margin-bottom: 11px;
  color: #ff4fc7;
  font-size: 1.8rem;
}

.sage-photo-empty strong,
.sage-photo-empty small {
  display: block;
}

.sage-photo-empty small {
  margin-top: 6px;
}

.sage-photo-processing {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  align-content: center;
  background: rgba(5,4,8,.9);
}

.sage-photo-processing.active {
  display: grid;
}

.sage-photo-processing span {
  width: 48px;
  height: 48px;
  margin-bottom: 13px;
  border: 3px solid rgba(255,255,255,.08);
  border-top-color: #ff4fc7;
  border-right-color: #ffe2a2;
  border-radius: 50%;
  animation: sagePhotoSpin .8s linear infinite;
}

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

@media (max-width: 760px) {
  .sage-photo-studio {
    padding: 7px;
    align-items: flex-start;
    overflow-y: auto;
  }

  .sage-photo-window {
    width: 100%;
    max-height: none;
    margin: 7px 0;
  }

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

  .sage-photo-controls {
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.07);
  }

  .sage-photo-canvas-area {
    min-height: 340px;
  }
}
