
/* Gather avatar tools: accessible full-size preview + square cropper. */

.ga-avatar-clickable,
[data-avatar-view] {
  cursor: zoom-in;
}

.ga-avatar-clickable:focus-visible,
[data-avatar-view]:focus-visible {
  outline: 3px solid #f0c16c;
  outline-offset: 4px;
}

body.ga-modal-open {
  overflow: hidden;
}

.ga-viewer[hidden],
.ga-crop-modal[hidden] {
  display: none !important;
}

.ga-viewer,
.ga-crop-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: clamp(10px, 3vw, 28px);
}

.ga-viewer {
  background: rgba(1, 4, 8, .84);
  backdrop-filter: blur(16px);
}

.ga-viewer-backdrop,
.ga-crop-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: default;
}

.ga-viewer-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(94dvh, 1000px);
  overflow: auto;
  border: 1px solid rgba(241, 198, 119, .32);
  border-radius: 24px;
  padding: clamp(14px, 2.5vw, 24px);
  color: #f5f2ed;
  background: linear-gradient(
    145deg,
    rgba(23, 32, 42, .98),
    rgba(7, 12, 18, .99)
  );
  box-shadow:
    0 35px 100px rgba(0,0,0,.58),
    inset 0 1px rgba(255,255,255,.07);
}

.ga-viewer-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.ga-viewer-title {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
  font: 800 clamp(16px, 2.6vw, 22px)/1.3 Manrope, sans-serif;
}

.ga-viewer-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 13px;
  color: #f8dfb0;
  background: rgba(255,255,255,.06);
  cursor: pointer;
  font-size: 24px;
}

.ga-viewer-stage {
  display: grid;
  place-items: center;
  min-height: 180px;
  max-height: 74dvh;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 17px;
  background:
    radial-gradient(
      circle at 50% 25%,
      rgba(232,181,95,.08),
      transparent 55%
    ),
    #05090e;
}

.ga-viewer-image {
  display: block;
  max-width: 100%;
  max-height: 70dvh;
  width: auto;
  height: auto;
  object-fit: contain;
  cursor: zoom-in;
  transition: transform .18s ease;
}

.ga-viewer-image.is-zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.ga-viewer-initial {
  width: clamp(110px, 30vw, 220px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #2c1d0c;
  background: linear-gradient(145deg, #ffe7ac, #ba7c36);
  font: 900 clamp(46px, 12vw, 90px)/1 Manrope, sans-serif;
  box-shadow:
    0 0 0 7px rgba(235,186,100,.11),
    0 16px 55px rgba(0,0,0,.38);
}

.ga-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 15px;
}

.ga-viewer-action {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid rgba(239,193,111,.28);
  border-radius: 12px;
  color: #f4deb2;
  background: rgba(238,185,92,.08);
  text-decoration: none;
  font: 700 12px/1.2 'DM Sans', sans-serif;
  cursor: pointer;
}

.ga-viewer-action-primary {
  color: #231707;
  background: linear-gradient(145deg, #ffe5ad, #d49a49);
  border-color: #e6b66c;
}

/* Avatar cropper */

.ga-crop-modal {
  background: rgba(1, 4, 8, .87);
  backdrop-filter: blur(16px);
}

.ga-crop-panel {
  position: relative;
  z-index: 1;
  width: min(550px, 100%);
  max-height: 94dvh;
  overflow: auto;
  padding: clamp(15px, 3vw, 24px);
  border: 1px solid rgba(241,198,119,.34);
  border-radius: 23px;
  color: #f5f2ed;
  background: linear-gradient(145deg, #18232d, #080e14);
  box-shadow:
    0 30px 90px rgba(0,0,0,.6),
    inset 0 1px rgba(255,255,255,.06);
}

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

.ga-crop-heading h2 {
  margin: 0;
  font: 800 clamp(19px, 4vw, 25px)/1.25 Manrope, sans-serif;
}

.ga-crop-heading p {
  margin: 6px 0 0;
  color: #9eacb7;
  font-size: 12px;
  line-height: 1.6;
}

.ga-crop-stage {
  position: relative;
  width: min(78vw, 390px);
  max-width: 100%;
  aspect-ratio: 1;
  margin: 18px auto 12px;
  overflow: hidden;
  border: 2px solid rgba(240,193,108,.88);
  border-radius: 18px;
  background: #05090e;
  box-shadow:
    0 0 0 6px rgba(240,193,108,.08),
    0 15px 40px rgba(0,0,0,.3);
  cursor: grab;
  touch-action: none;
}

.ga-crop-stage.is-dragging {
  cursor: grabbing;
}

.ga-crop-stage img {
  position: absolute;
  display: block;
  max-width: none !important;
  max-height: none !important;
  width: auto;
  height: auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.ga-crop-hint {
  text-align: center;
  margin: 7px 0 14px;
  color: #9caab5;
  font-size: 11px;
}

.ga-crop-zoom-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #f0d8aa;
  font-size: 12px;
  font-weight: 700;
}

.ga-crop-zoom-label input {
  width: 56%;
  accent-color: #e7b765;
}

.ga-crop-status {
  min-height: 18px;
  margin: 10px 0 0;
  color: #ffcbcb;
  font-size: 11px;
}

.ga-crop-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 15px;
}

.ga-crop-button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px;
  color: #e9edf0;
  background: rgba(255,255,255,.05);
  font: 700 12px 'DM Sans', sans-serif;
  cursor: pointer;
}

.ga-crop-button-primary {
  border-color: #dfad5d;
  color: #251707;
  background: linear-gradient(145deg, #ffe4aa, #d49a49);
  box-shadow: 0 3px 0 #75491d;
}

.ga-crop-button:disabled {
  opacity: .55;
  cursor: wait;
}

.ga-crop-message {
  display: block;
  margin-top: 8px;
  color: #aebbc4;
  font-size: 11px;
  line-height: 1.55;
}

/* Avatar viewer and independent animated ring */

.ga-viewer-stage.is-avatar-viewer {
  position: relative;
  isolation: isolate;
  --ga-avatar-size: min(58vw, 360px);
  width: min(76vw, 520px);
  min-height: unset;
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  padding: clamp(22px, 5vw, 46px);
  overflow: auto;
  border-radius: 24px;
}

/* Never animate or filter the photo itself. */
.ga-viewer-stage.is-avatar-viewer
.ga-viewer-image.ga-viewer-avatar-image {
  position: relative;
  z-index: 1;
  width: var(--ga-avatar-size);
  height: var(--ga-avatar-size);
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  cursor: zoom-in;
  box-shadow: 0 16px 48px rgba(0,0,0,.45);
  filter: none !important;
  animation: none !important;
}

/* Rainbow ring is a separate pseudo-element behind the photo. */
.ga-viewer-stage.is-avatar-viewer.ga-viewer-effect-rainbow::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: calc(var(--ga-avatar-size) + 24px);
  height: calc(var(--ga-avatar-size) + 24px);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 8px rgba(255,93,162,.60),
    0 0 0 13px rgba(255,210,77,.48),
    0 0 28px rgba(139,92,246,.3);
  animation: ga-viewer-rainbow-pulse 3.4s ease-in-out infinite;
}

@keyframes ga-viewer-rainbow-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 8px rgba(255,93,162,.60),
      0 0 0 13px rgba(255,210,77,.48),
      0 0 28px rgba(139,92,246,.3);
  }

  50% {
    box-shadow:
      0 0 0 8px rgba(255,210,77,.75),
      0 0 0 13px rgba(74,222,128,.58),
      0 0 38px rgba(72,219,251,.4);
  }
}

/* Gold effect stays static. */
.ga-viewer-stage.is-avatar-viewer.ga-viewer-effect-gold
.ga-viewer-avatar-image {
  outline: 3px solid #ffe0a0;
  outline-offset: 5px;
  box-shadow:
    0 0 0 9px rgba(232,185,101,.17),
    0 0 30px rgba(232,185,101,.35);
}

/* Mobile layout */
@media (max-width: 480px) {
  .ga-viewer-panel {
    border-radius: 18px;
    padding: 12px;
  }

  .ga-viewer-stage {
    max-height: 68dvh;
  }

  .ga-viewer-actions > * {
    flex: 1 1 100%;
  }

  .ga-crop-panel {
    border-radius: 18px;
  }

  .ga-crop-actions > * {
    flex: 1 1 100%;
  }

  .ga-viewer-stage.is-avatar-viewer {
    --ga-avatar-size: min(66vw, 300px);
    width: min(84vw, 430px);
    padding: 24px;
  }
}

/* Respect reduced-motion preferences. */
@media (prefers-reduced-motion: reduce) {
  .ga-viewer-image {
    transition: none;
  }

  .ga-viewer-stage.ga-viewer-effect-rainbow::before {
    animation: none !important;
  }
}

/* Zoom support */
.ga-viewer-stage.is-avatar-viewer
.ga-viewer-image.ga-viewer-avatar-image.is-zoomed {
  width: min(86vw, 680px);
  height: min(86vw, 680px);
  max-width: none;
  max-height: none;
}

/* Never show the initial placeholder over an avatar photo. */
.ga-viewer-stage.is-avatar-viewer .ga-viewer-initial {
  display: none !important;
}
