.photo-open,
#photoStudio button {
  border: 1px solid var(--archive-border);
  border-radius: 6px;
  background: var(--archive-surface-raised);
  color: var(--archive-text);
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}
.coord-controls .photo-open { margin-top: 8px; }
#avatarViewControls .photo-open { justify-self: start; }
#photoStudio {
  box-sizing: border-box;
  width: min(1024px, calc(100% - 24px));
  max-width: none;
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--archive-text);
  background: var(--archive-surface);
  border: 1px solid var(--archive-border);
  border-radius: 12px;
  box-shadow: 0 16px 64px #0006;
}
#photoStudio::backdrop { background: rgb(12 16 23 / 75%); }
.photo-header, .photo-map-fields, .photo-actions, .photo-location-body, #photoJump {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}
.photo-header, .photo-actions { justify-content: space-between; padding: 12px 18px; }
.photo-header { border-bottom: 1px solid var(--archive-border); }
.photo-header h2 { margin: 0; font-size: 1.16rem; }
.photo-map-fields { padding: 10px 18px; }
.photo-map-fields label { flex: 1 1 190px; }
.photo-map-fields label + label { flex-grow: 2; }
#photoStudio label { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
#photoStudio :is(input, select) {
  min-width: 0;
  padding: 5px 7px;
  color: var(--archive-text);
  background: var(--archive-surface-raised);
  border: 1px solid var(--archive-border);
  border-radius: 5px;
  font: inherit;
}
.photo-map-fields :is(input,select) { width: 1px; flex: 1; }
.photo-bgm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 0 18px 10px; font-size: .8rem; }
#photoStudio #photoBgmVolume { width: 80px; padding: 0; accent-color: var(--archive-accent); }
#photoBgmToggle[aria-pressed="true"] { border-color: var(--archive-accent); }
#photoBgmStatus { color: var(--archive-muted); }
.photo-music-options[hidden] { display: none; }
.photo-music-options label { max-width: 100%; }
.photo-music-options :is(select, input) { max-width: 100%; margin-inline-start: 6px; }
.photo-room { padding: 8px 18px 10px; font-size: .8rem; }
.photo-room-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.photo-room-controls[hidden] { display: none; }
.photo-room label { max-width: 100%; }
.photo-room input { max-width: 100%; }
#photoRoomInvite { width: min(30rem, 60vw); }
.photo-room p { margin: 4px 0 0; }
.photo-view {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: clamp(180px, 50dvh, 520px);
  overflow: hidden;
  background: #161d21;
}
#photoCanvas {
  display: block;
  image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
}
#photoCanvas:focus-visible { outline: 2px solid #88cfde; outline-offset: -2px; }
#photoStageStatus:not(:empty) {
  position: absolute;
  max-width: 90%;
  margin: 0;
  padding: 8px 14px;
  border-radius: 6px;
  color: white;
  background: rgb(13 18 22 / 88%);
  font-size: .85rem;
  text-align: center;
}
#photoStageStatus:empty, .photo-message:empty, .photo-overview[hidden] { display: none; }
.photo-help, .photo-message { margin: 0; padding: 6px 18px; color: var(--archive-muted); font-size: .8rem; }
#photoStudio #photoSave {
  padding: 9px 20px;
  font-weight: 700;
  background: var(--archive-accent);
  color: var(--archive-bg);
}
#photoStudio :is(button,select):disabled { opacity: .55; cursor: default; }
#photoStudio .photo-preview-close { display: block; margin: 8px 18px 8px auto; }
#photoLocation { padding: 8px 18px 12px; border-top: 1px solid var(--archive-border); }
#photoLocation summary { width: fit-content; cursor: pointer; font-size: .85rem; }
#photoPosition { margin-left: 6px; color: var(--archive-muted); font-variant-numeric: tabular-nums; }
.photo-location-body { margin-top: 10px; }
.photo-overview { position: relative; display: inline-flex; max-width: 100%; cursor: crosshair; }
#photoOverviewMap { display: block; width: auto; height: auto; max-width: min(330px, 100%); max-height: 160px; }
.photo-overview span {
  position: absolute;
  left: var(--photo-x);
  top: var(--photo-y);
  width: 9px;
  height: 9px;
  border: 2px solid white;
  border-radius: 50%;
  background: #b43e2d;
  box-shadow: 0 0 0 1px #311811;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#photoJump input { width: 6em; }
@media (max-width: 540px) {
  #photoStudio { width: calc(100% - 10px); max-height: calc(100dvh - 10px); }
  .photo-header, .photo-map-fields, .photo-bgm, .photo-actions, .photo-help, .photo-message, #photoLocation { padding-inline: 10px; }
  .photo-view { height: clamp(180px, 43dvh, 420px); }
}
