.field-media-section,
.pin-media-section {
  display: grid;
  gap: 0.75rem;
}

.field-media-section-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  justify-content: space-between;
}

.field-media-section-meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.photo-uploader {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px dashed rgba(31, 45, 36, 0.2);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.76));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.photo-uploader.is-disabled {
  opacity: 0.72;
}

.photo-uploader__dropzone {
  position: relative;
  display: grid;
  gap: 0.5rem;
  align-items: center;
  justify-items: start;
  padding: 1rem;
  border-radius: 16px;
  background: rgba(109, 141, 89, 0.08);
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.photo-uploader__dropzone:hover,
.photo-uploader__dropzone.is-dragover {
  transform: translateY(-1px);
  background: rgba(109, 141, 89, 0.14);
}

.photo-uploader__title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
}

.photo-uploader__meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.photo-uploader--touch > .photo-uploader__dropzone > .photo-uploader__meta:not([data-uploader-count]) {
  display: none;
}

.photo-uploader__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.photo-uploader__action {
  flex: 0 0 auto;
}

.photo-uploader__action.icon-button {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  border: 1px solid rgba(33, 77, 55, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 244, 0.94));
  color: #305847;
  box-shadow: 0 12px 24px rgba(25, 40, 31, 0.1);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, color 160ms ease;
}

.photo-uploader__action.icon-button:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 16px 28px rgba(25, 40, 31, 0.14);
}

.photo-uploader__action.icon-button svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.05;
}

.photo-uploader__action[data-photo-uploader-action="camera"] {
  color: #d86255;
  background: linear-gradient(180deg, rgba(255, 245, 242, 0.99), rgba(255, 233, 228, 0.95));
}

.photo-uploader__action[data-photo-uploader-action="file"] {
  color: #497f93;
  background: linear-gradient(180deg, rgba(247, 251, 255, 0.99), rgba(233, 242, 248, 0.95));
}

.photo-uploader__action[data-photo-uploader-action="file"] svg {
  width: 24px;
  height: 30px;
  transform: scale(0.92, 1.08);
  transform-origin: center;
}

.photo-uploader--touch .photo-uploader__action.icon-button {
  width: 62px;
  height: 62px;
  border-radius: 22px;
}

.photo-uploader__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.photo-uploader__progress {
  display: grid;
  gap: 0.35rem;
}

.photo-uploader__progress-bar {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 45, 36, 0.1);
}

.photo-uploader__progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 180ms ease;
}

.photo-uploader__status {
  font-size: 0.9rem;
  color: var(--muted);
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.6rem;
}

.photo-thumb {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: rgba(31, 45, 36, 0.06);
  box-shadow: 0 10px 24px rgba(25, 40, 31, 0.1);
  cursor: pointer;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-thumb:hover {
  transform: translateY(-1px);
}

.photo-thumb-delete {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.65rem;
  height: 1.65rem;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 34, 27, 0.82);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(20, 34, 27, 0.2);
}

.photo-thumb-delete:hover {
  background: rgba(157, 77, 77, 0.95);
}

.photo-empty {
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(31, 45, 36, 0.05);
  color: var(--muted);
}

.photo-empty.is-muted {
  background: transparent;
  padding: 0.2rem 0;
}

.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.lightbox-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 14, 11, 0.78);
  backdrop-filter: blur(8px);
}

.lightbox-panel {
  position: relative;
  width: min(92vw, 1200px);
  max-height: 92vh;
  display: grid;
  gap: 0.75rem;
  align-items: center;
  justify-items: center;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(12, 20, 15, 0.72);
  box-shadow: 0 28px 120px rgba(0, 0, 0, 0.42);
}

.lightbox-image {
  max-width: 90vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
}

.lightbox-caption {
  max-width: min(90vw, 1000px);
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  font-size: 0.94rem;
}

.lightbox-nav,
.lightbox-close {
  position: absolute;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.24);
}

.lightbox-nav {
  top: 50%;
  width: 2.8rem;
  height: 2.8rem;
  transform: translateY(-50%);
}

.lightbox-nav--prev {
  left: 0.5rem;
}

.lightbox-nav--next {
  right: 0.5rem;
}

.lightbox-close {
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
}

body.is-lightbox-open {
  overflow: hidden;
}

.pin-marker {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  transform: translateY(-2px);
  filter: drop-shadow(0 10px 16px rgba(20, 34, 27, 0.18));
}

.pin-marker__body {
  position: relative;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px 999px 999px 0;
  transform: rotate(-45deg);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.pin-marker__body svg {
  width: 18px;
  height: 18px;
  transform: rotate(45deg);
  fill: currentColor;
}

.pin-marker.is-selected .pin-marker__body {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 0 0 4px rgba(255, 255, 255, 0.45);
  transform: rotate(-45deg) scale(1.05);
}

.pin-popup {
  min-width: 220px;
  max-width: 280px;
}

.pin-popup__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.pin-popup__memo {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.pin-popup__thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  margin-top: 0.65rem;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(31, 45, 36, 0.08);
}

.pin-popup__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pin-popup__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.pin-popup__actions button {
  flex: 1;
}

.pin-icon-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.pin-icon-option {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  padding: 0.65rem 0.45rem;
  border: 1px solid rgba(31, 45, 36, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  font-size: 0.82rem;
}

.pin-icon-option input {
  margin: 0;
}

.pin-icon-option.is-active {
  border-color: rgba(109, 141, 89, 0.8);
  background: rgba(109, 141, 89, 0.1);
}

.pin-list {
  display: grid;
  gap: 0.65rem;
}

.field-detail-pin-list {
  display: grid;
  gap: 0.65rem;
}

.pin-list-item {
  display: grid;
  gap: 0.3rem;
  grid-template-columns: auto 1fr;
  align-items: start;
  padding: 0.75rem 0.85rem;
  border: 1px solid rgba(31, 45, 36, 0.1);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 18px rgba(25, 40, 31, 0.06);
  cursor: pointer;
}

.pin-list-item.is-selected {
  border-color: rgba(109, 141, 89, 0.85);
  box-shadow: 0 10px 24px rgba(109, 141, 89, 0.16);
}

.pin-list-item:focus-visible {
  outline: 2px solid rgba(109, 141, 89, 0.42);
  outline-offset: 2px;
}

.pin-list-item__icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  color: #fff;
}

.pin-list-item__title {
  font-weight: 700;
}

.pin-list-item__memo {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.86rem;
}

body.is-pin-placement-mode .field-map,
body.is-pin-placement-mode .pin-sheet,
body.is-pin-placement-mode .pin-sheet-backdrop {
  cursor: crosshair;
}

@media (max-width: 760px) {
  .pin-icon-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lightbox-nav {
    width: 2.4rem;
    height: 2.4rem;
  }
}
