form.inplaceeditor-form input[type="submit"] {
	width:auto;
	min-width: 72px;
	vertical-align:bottom;
}

/* Full-width gallery content shell
   #body is inline in markup and would otherwise shrink-wrap to ~3 tiles */
.body_mc:has(#sortlist) #body,
.body_mc:has(.gallery_sortlist) #body,
.body_mc:has(.gallery_desc) #body,
.body_mc:has(#img_div_id) #body,
.body_mc:has(.gallery_picture_table) #body {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
  overflow-x: clip;
}

/* Legacy HTML width="715" etc. must not force horizontal overflow */
.body_mc:has(#sortlist) table[width],
.body_mc:has(.gallery_sortlist) table[width],
.body_mc:has(.gallery_desc) table[width],
.body_mc:has(.gallery_toolbar) table[width],
.body_mc:has(#sortlist) table,
.body_mc:has(.gallery_sortlist) table,
.body_mc:has(.gallery_desc) table {
  width: 100% !important;
  max-width: 100% !important;
}

.body_mc:has(#sortlist) #body > center,
.body_mc:has(.gallery_sortlist) #body > center,
.body_mc:has(.gallery_desc) #body > center {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.body_mc table:has(#sortlist),
.body_mc table:has(.gallery_sortlist),
.body_mc table:has(.gallery_desc),
.body_mc table:has(.gallery_toolbar),
.body_mc table.gallery_picture_table,
.body_mc table:has(#img_div_id) {
  display: block !important;
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

/* display:block on table shrink-wraps cells to content – force full width */
.body_mc table:has(#sortlist) > tbody,
.body_mc table:has(.gallery_sortlist) > tbody,
.body_mc table:has(.gallery_desc) > tbody,
.body_mc table:has(.gallery_toolbar) > tbody,
.body_mc table.gallery_picture_table > tbody,
.body_mc table:has(#sortlist) > tbody > tr,
.body_mc table:has(.gallery_sortlist) > tbody > tr,
.body_mc table:has(.gallery_desc) > tbody > tr,
.body_mc table:has(.gallery_toolbar) > tbody > tr,
.body_mc table.gallery_picture_table > tbody > tr,
.body_mc table:has(#sortlist) > tbody > tr > th,
.body_mc table:has(.gallery_sortlist) > tbody > tr > th,
.body_mc table:has(.gallery_desc) > tbody > tr > th,
.body_mc table:has(.gallery_toolbar) > tbody > tr > th,
.body_mc table.gallery_picture_table > tbody > tr > th,
.body_mc table:has(#sortlist) > tbody > tr > td,
.body_mc table:has(.gallery_sortlist) > tbody > tr > td,
.body_mc table:has(.gallery_desc) > tbody > tr > td,
.body_mc table:has(.gallery_toolbar) > tbody > tr > td,
.body_mc table.gallery_picture_table > tbody > tr > td {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.gallery_toolbar,
.gallery_tags_panel,
.gallery_restriction {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

/* Toolbar: keep action buttons on one row (Fotos sortieren / hochladen) */
.gallery_toolbar,
.gallery_toolbar > tbody,
.gallery_toolbar > tbody > tr {
  display: flex !important;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  width: 100% !important;
  max-width: 100%;
}

.gallery_toolbar > tbody {
  flex: 1 1 auto;
}

.gallery_toolbar > tbody > tr > td {
  display: contents !important;
  width: auto !important;
  max-width: none !important;
  white-space: nowrap !important;
}

.gallery_toolbar > tbody > tr > td.button_separator,
.gallery_toolbar > tbody > tr > td:has(> img:only-child) {
  display: none !important;
}

.gallery_toolbar .standardButton,
.gallery_toolbar .adminButton {
  display: inline-flex !important;
  flex: 0 0 auto;
  width: auto !important;
  max-width: none !important;
  min-width: 0;
  margin: 0 !important;
  white-space: nowrap;
}

/* Legacy template cells with nowrap / fixed widths */
.body_mc:has(#sortlist) td[nowrap],
.body_mc:has(.gallery_sortlist) td[nowrap],
.body_mc:has(.gallery_desc) td[nowrap] {
  white-space: normal !important;
  max-width: 100%;
}

/* Comment form: inline width:600px / table width=715 */
.body_mc textarea.textarea,
.body_mc .textarea {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}

.body_mc form table,
.body_mc form table[width] {
  width: 100% !important;
  max-width: 100% !important;
}

.body_mc form .standardButton {
  width: auto !important;
  max-width: 100%;
}

.body_mc:has(#sortlist) table,
.body_mc:has(.gallery_sortlist) table,
.body_mc:has(.gallery_desc) table,
.body_mc:has(.gallery_toolbar) table {
  width: 100% !important;
  max-width: 100%;
}

.gallery_desc {
  width: 100%;
  max-width: 100%;
  min-height: 40px;
  box-sizing: border-box;
  overflow: hidden;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
  cursor: text;
  transition: border-color var(--ease), box-shadow var(--ease), background-color var(--ease);
}

.gallery_desc:hover {
  border-color: #547089;
  background: var(--field);
}

/* Editing: only the field border, not container + field */
.gallery_desc:has(form) {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  cursor: default;
}

.gallery_desc form[action="javascript:void(0);"] {
  width: 100%;
}

.gallery_desc form[action="javascript:void(0);"] input[type="text"],
.gallery_desc form[action="javascript:void(0);"] textarea {
  width: 100%;
  min-height: inherit;
}

.album_desc {
  cursor: text;
  border-radius: 4px;
  transition: background-color var(--ease), box-shadow var(--ease);
}

.album_desc:hover {
  background: rgba(62, 207, 255, 0.08);
}

.album_desc:has(form) {
  white-space: normal !important;
  overflow: visible !important;
  height: auto !important;
  min-height: 34px;
  padding: 2px !important;
}

.album_desc form[action="javascript:void(0);"] input[type="text"] {
  width: 100%;
  min-height: 32px;
  font-size: 14px;
  font-weight: 650;
  padding: 4px 8px;
}

.album_tags_div {
  position: relative;
  line-height: 2.5;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 25px;
  text-align: left;
  padding: 8px;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.album_tags_span {
  font-size: 13px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background-color: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
  display: inline-block;
  margin: 0 4px 4px 0;
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background-color var(--ease);
}

.album_tags_span:hover {
  color: var(--text);
  border-color: var(--accent);
  background-color: rgba(62, 207, 255, 0.12);
}

/* Album card meta: title > photo count > visibility */
#sortlist .album_desc {
  width: min(158px, 100%) !important;
  max-width: 100%;
  height: auto !important;
  min-height: 18px;
  margin: 6px auto 2px;
  padding-top: 0 !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  line-height: 1.25;
  color: var(--text) !important;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  box-sizing: border-box;
}

#sortlist .album_meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: min(158px, 100%);
  max-width: 100%;
  min-height: 18px;
  margin: 0 auto;
  box-sizing: border-box;
}

#sortlist .album_count {
  float: none !important;
  width: auto !important;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1.2;
  color: var(--muted) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#sortlist .album_visibility {
  float: none !important;
  width: auto !important;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  min-height: 16px;
  cursor: help;
  opacity: 0.72;
  transition: opacity var(--ease);
}

#sortlist .album_visibility:hover {
  opacity: 1;
}

#sortlist .album_visibility_text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#sortlist .album_visibility::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

#sortlist .album_visibility[data-vis="public"]::before {
  background-image: url("../../images/general/gallery/visibility_public.svg");
}

#sortlist .album_visibility[data-vis="community"]::before {
  background-image: url("../../images/general/gallery/visibility_community.svg");
}

#sortlist .album_visibility[data-vis="clan"]::before {
  background-image: url("../../images/general/gallery/visibility_clan.svg");
}

#sortlist .album_visibility[data-vis="private"]::before {
  background-image: url("../../images/general/gallery/visibility_private.svg");
}

/* Delete control on album/picture hover */
.gallery_delete {
  pointer-events: none;
  z-index: 5 !important;
  width: auto !important;
  padding: 8px 8px 0 0 !important;
  right: 0;
  left: auto !important;
  text-align: right;
}

.gallery_album_cover .gallery_delete,
.gallery_photo_tile .gallery_delete {
  position: absolute !important;
  top: 0;
  right: 0;
}

.gallery_delete_btn {
  width: 22px;
  height: 22px;
  display: inline-block;
  vertical-align: top;
  cursor: pointer;
  pointer-events: auto;
  border: 0;
  border-radius: 50%;
  content: url("../../images/general/gallery/delete_bg.svg");
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: transform var(--ease), box-shadow var(--ease), filter var(--ease);
}

.gallery_delete_btn:hover {
  transform: scale(1.1);
  filter: brightness(1.1);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2), 0 4px 10px rgba(0, 0, 0, 0.45);
}

/* ---- Modern gallery tiles (full content width, centered) ---- */
#sortlist,
.gallery_sortlist {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 14px 16px;
  width: 100% !important;
  max-width: 100% !important;
  padding: 12px 8px 0;
  margin: 0;
  overflow: hidden;
  box-sizing: border-box;
  list-style: none;
}

#sortlist::after,
.gallery_sortlist::after {
  content: none;
}

#sortlist > .gallery_item,
.gallery_sortlist > .gallery_item {
  float: none !important;
  flex: 0 1 168px;
  max-width: 100%;
  background: transparent !important;
  border: 0 !important;
  margin: 0 !important;
  padding: 4px 8px 8px !important;
  list-style: none;
  overflow: hidden;
  box-sizing: border-box;
}

#sortlist > .gallery_item_album,
.gallery_sortlist > .gallery_item_album {
  padding-top: 14px !important;
  padding-right: 14px !important; /* room for stacked pages */
}

/* Album: stacked cover / collection look */
.gallery_album_card {
  width: min(168px, 100%) !important;
  max-width: 100%;
  margin: 0 auto;
}

.gallery_album_cover {
  position: relative !important;
  width: min(158px, 100%) !important;
  max-width: 100% !important;
  height: 118px !important;
  margin: 10px auto 4px !important;
  padding: 0 !important;
  background: none !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  overflow: hidden !important;
  box-sizing: border-box;
  transition: transform var(--ease);
}

.gallery_album_cover::before,
.gallery_album_cover::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(160deg, rgba(62, 207, 255, 0.08), transparent 42%),
    var(--surface-2);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.gallery_album_cover::before {
  z-index: 0;
  transform: translate(6px, -6px) rotate(2.4deg);
  opacity: 0.72;
}

.gallery_album_cover::after {
  z-index: 1;
  transform: translate(3px, -3px) rotate(1deg);
  opacity: 0.9;
}

.gallery_album_media {
  position: relative !important;
  z-index: 2 !important;
  top: auto !important;
  left: auto !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 118px !important;
  overflow: hidden !important;
  border: 1px solid rgba(62, 207, 255, 0.28) !important;
  border-radius: 12px;
  background: var(--inset);
  box-shadow:
    inset 10px 0 18px rgba(0, 0, 0, 0.28),
    0 12px 26px rgba(0, 0, 0, 0.38);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  box-sizing: border-box;
  text-align: center;
}

.gallery_album_media::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12px;
  background: linear-gradient(
    90deg,
    rgba(14, 17, 22, 0.72) 0%,
    rgba(62, 207, 255, 0.18) 45%,
    transparent 100%
  );
  pointer-events: none;
}

.gallery_album_media::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  pointer-events: none;
}

.gallery_album_media img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  padding: 0 !important;
  padding-left: 0 !important;
  padding-top: 0 !important;
  margin: 0 !important;
  object-fit: cover;
  object-position: center;
}

.gallery_album_cover.is-highlighted,
.gallery_album_card:hover .gallery_album_cover {
  transform: translateY(-2px);
}

.gallery_album_cover.is-highlighted .gallery_album_media,
.gallery_album_card:hover .gallery_album_media {
  border-color: rgba(62, 207, 255, 0.55);
  box-shadow:
    inset 10px 0 18px rgba(0, 0, 0, 0.28),
    0 0 0 2px rgba(62, 207, 255, 0.28),
    0 16px 30px rgba(0, 0, 0, 0.45);
}

#sortlist .album_desc,
#sortlist .album_meta {
  width: min(158px, 100%) !important;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* Photo: single print / flat photo look */
.gallery_photo_card {
  width: min(160px, 100%);
  max-width: 100%;
  margin: 0 auto;
}

.gallery_photo_tile {
  position: relative !important;
  width: min(160px, 100%) !important;
  max-width: 100% !important;
  height: 128px !important;
  margin: 4px auto 0 !important;
  padding: 0 !important;
  padding-right: 0 !important;
  background: none !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  overflow: hidden !important;
  transition: transform var(--ease);
  box-sizing: border-box;
}

.gallery_photo_media {
  position: relative !important;
  z-index: 1 !important;
  top: auto !important;
  left: auto !important;
  margin: 0 !important;
  margin-top: 0 !important;
  margin-left: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 120px !important;
  overflow: hidden !important;
  border-radius: 6px;
  padding: 6px !important;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, #2a3340 0%, #1b222c 100%);
  border: 1px solid rgba(232, 238, 246, 0.16) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.34);
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
  text-align: center;
}

.gallery_photo_media img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  object-fit: cover;
  object-position: center;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.gallery_photo_tile.is-highlighted,
.gallery_photo_card:hover .gallery_photo_tile {
  transform: translateY(-2px);
}

.gallery_photo_tile.is-highlighted .gallery_photo_media,
.gallery_photo_card:hover .gallery_photo_media {
  border-color: rgba(232, 238, 246, 0.32);
  box-shadow:
    0 0 0 2px rgba(232, 238, 246, 0.12),
    0 14px 26px rgba(0, 0, 0, 0.42);
}

/* Comment badges */
.gallery_comment_wrap {
  z-index: 4 !important;
  width: calc(100% - 12px) !important;
  left: 6px !important;
  padding-left: 0 !important;
  padding-top: 0 !important;
  bottom: 8px;
  top: auto !important;
}

.gallery_comment_badge {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 3px 7px !important;
  border-radius: 999px;
  background: rgba(14, 17, 22, 0.88) !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong);
  font-size: 10px !important;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

.gallery_comment_badge img {
  flex: 0 0 auto;
}

/* Responsive gallery tiles */
@media (max-width: 980px) {
  #sortlist,
  .gallery_sortlist {
    gap: 12px 10px;
    padding: 10px 4px 0;
  }

  #sortlist > .gallery_item,
  .gallery_sortlist > .gallery_item {
    flex: 0 1 148px;
  }

  .gallery_album_card {
    width: min(148px, 100%) !important;
  }

  .gallery_album_cover,
  .gallery_album_media {
    height: 110px !important;
  }

  .gallery_album_media,
  #sortlist .album_desc,
  #sortlist .album_meta {
    max-width: 148px !important;
  }

  .gallery_photo_card,
  .gallery_photo_tile {
    width: min(148px, 100%) !important;
  }

  .gallery_photo_media {
    max-width: 148px !important;
    height: 112px !important;
  }

  .gallery_photo_tile {
    height: 120px !important;
  }
}

@media (max-width: 480px) {
  #sortlist,
  .gallery_sortlist {
    gap: 12px 10px;
    justify-content: center;
    padding: 10px 0 0;
  }

  #sortlist > .gallery_item,
  .gallery_sortlist > .gallery_item {
    flex: 0 1 148px;
    width: min(148px, 100%);
    min-width: 0;
    max-width: 100%;
    padding-right: 8px !important;
  }

  .gallery_album_card,
  .gallery_photo_card,
  .gallery_album_cover,
  .gallery_photo_tile {
    width: 100% !important;
    max-width: 100% !important;
  }

  .gallery_album_media,
  .gallery_photo_media,
  #sortlist .album_desc,
  #sortlist .album_meta {
    width: 100% !important;
    max-width: 100% !important;
  }

  .gallery_album_cover::before {
    transform: translate(4px, -4px) rotate(2deg);
  }

  .gallery_album_cover::after {
    transform: translate(2px, -2px) rotate(0.8deg);
  }

  .gallery_toolbar,
  .gallery_toolbar > tbody,
  .gallery_toolbar > tbody > tr {
    flex-wrap: nowrap;
    justify-content: center;
  }

  .gallery_toolbar .standardButton,
  .gallery_toolbar .adminButton {
    flex: 0 0 auto;
    width: auto !important;
  }
}

/* ---- Single picture view ---- */
.gallery_picture_table {
  width: 100% !important;
  max-width: 100%;
  border-collapse: collapse;
}

.gallery_picture_header {
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  font-weight: normal;
}

.gallery_picture_crumb {
  float: none !important;
  display: block;
  width: 100%;
  margin: 0 0 14px;
  text-align: left;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.gallery_picture_nav {
  float: none !important;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin: 0 0 16px;
}

.gallery_nav_btn.standardButton,
input.standardButton.gallery_nav_btn {
  width: auto !important;
  min-width: 110px;
  margin: 0 !important;
}

.gallery_picture_back {
  justify-content: center;
  margin-top: 20px;
}

.gallery_picture_back .cc-back-btn {
  width: auto;
}

/* Foto-Details: gleiche Spaltenbreite wie das Bild, nicht die volle Viewport-Breite */
.gallery_picture_details {
  width: min(96%, 920px);
  margin: 22px auto 0;
  text-align: left;
}

.gallery_picture_panel {
  padding: 16px 18px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.gallery_picture_field {
  margin: 0 0 14px;
}

.gallery_picture_label {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery_picture_details .gallery_desc {
  width: 100%;
  max-width: 100%;
  height: auto !important;
  min-height: 44px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.gallery_picture_details .gallery_desc form[action="javascript:void(0);"] textarea {
  width: 100%;
  max-width: 100%;
  min-height: 88px;
  resize: vertical;
}

.gallery_picture_options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.gallery_picture_check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.4;
  cursor: pointer;
}

.gallery_picture_check input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.gallery_picture_move {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.gallery_picture_move .gallery_picture_label {
  margin: 0;
  flex: 1 1 100%;
}

.gallery_picture_move .select {
  flex: 1 1 220px;
  width: auto !important;
  max-width: 420px;
}

.gallery_picture_rotate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.gallery_picture_rotate_btn {
  --gallery-rotate-icon: none;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-sizing: border-box;
  cursor: pointer;
  text-decoration: none;
  transition:
    border-color var(--ease),
    background-color var(--ease),
    box-shadow var(--ease);
}

.gallery_picture_rotate_btn--left {
  --gallery-rotate-icon: url("../../images/general/gallery/rotate_left.svg");
}

.gallery_picture_rotate_btn--right {
  --gallery-rotate-icon: url("../../images/general/gallery/rotate_right.svg");
}

.gallery_picture_rotate_btn::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 22px;
  height: 22px;
  pointer-events: none;
  background-color: var(--muted);
  -webkit-mask: var(--gallery-rotate-icon) center / contain no-repeat;
  mask: var(--gallery-rotate-icon) center / contain no-repeat;
  transition: background-color var(--ease), transform var(--ease);
}

.gallery_picture_rotate_btn:hover {
  border-color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.1);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.gallery_picture_rotate_btn:hover::before {
  background-color: var(--accent);
}

.gallery_picture_rotate_btn--left:hover::before {
  transform: rotate(-18deg);
}

.gallery_picture_rotate_btn--right:hover::before {
  transform: rotate(18deg);
}

.gallery_picture_notice {
  display: none;
  margin-top: 12px;
  color: var(--orange);
  font-size: 0.92rem;
  line-height: 1.45;
}

.gallery_picture_details > a[name="anchor_comments"] + br,
.gallery_picture_details > br {
  display: none;
}

.gallery_picture_details #num_comments_div {
  margin: 18px 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.gallery_picture_details table {
  width: 100% !important;
  max-width: 100% !important;
}

.gallery_picture_details #comments_div > table {
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.gallery_picture_details #comments_div td {
  padding: 10px 12px;
  vertical-align: top;
}

.gallery_picture_details #comments_div img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.gallery_picture_details #further_comments_div {
  margin: 4px 0 16px;
  color: var(--accent);
  font-weight: 650;
  text-align: center;
}

.gallery_picture_details #new_comment_div,
.gallery_picture_details #spamprotection_div,
.gallery_picture_details #further_comments_div {
  width: 100%;
  max-width: 100%;
}

.gallery_picture_details #new_comment_div[style*="inline"],
.gallery_picture_details #spamprotection_div[style*="inline"],
.gallery_picture_details #further_comments_div:not([style*="none"]) {
  display: block !important;
}

.gallery_picture_details #spamprotection_div {
  margin: 8px 0 0;
  color: var(--orange);
  line-height: 1.45;
}

.gallery_picture_details #new_comment_div form {
  margin-top: 8px;
}

.gallery_picture_details textarea.textarea {
  width: 100% !important;
  max-width: 100% !important;
  min-height: 110px;
  height: 110px !important;
  resize: vertical;
}

.gallery_picture_details .gallery_picture_back {
  margin-top: 18px;
}

.gallery_picture_stage_cell {
  text-align: center !important;
}

.gallery_picture_stage,
#img_div_id.gallery_picture_stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  text-align: center;
  box-sizing: border-box;
}

.gallery_picture_stage > a,
#img_div_id.gallery_picture_stage > a {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  line-height: 0;
}

.gallery_picture_stage img,
#img_div_id.gallery_picture_stage #img_id,
#img_id {
  display: block;
  max-width: min(100%, 920px);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
  background: var(--inset);
}

#high_quality_div {
  display: block;
  width: 100%;
  text-align: center;
}

#high_quality_div a {
  color: var(--accent);
}

/* ==========================================================================
   Night section shell – Upload & Processing
   ========================================================================== */

table:has(> tbody > tr > td.body_mc .gal) {
  width: 100%;
  table-layout: fixed;
}

.gal,
.gal * {
  box-sizing: border-box;
}

.gal {
  width: 100%;
  max-width: 1280px;
  min-width: 0;
  margin: 0 auto 8px;
  text-align: left;
  color: var(--text);
}

.gal-head {
  margin: 0 0 16px;
}

.gal-kicker {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.gal-head h1,
.body_mc .gal-head h1 {
  margin: 0 0 8px;
  text-align: left;
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
}

.gal-lead {
  margin: 0;
  max-width: 42em;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.5;
}

.gal-notices {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 14px;
}

.gal-error-files ul {
  margin: 8px 0 0;
  padding: 0 0 0 1.1em;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.gal-error-files li {
  margin: 0 0 4px;
}

.gal-error-files strong {
  color: var(--text);
}

.gal-panel {
  margin: 0 0 18px;
  padding: 16px 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  min-width: 0;
}

.gal-panel--compact {
  padding: 12px 16px;
}

.gal-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
}

.gal-panel-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(62, 207, 255, 0.12);
  color: var(--accent);
}

.gal-panel-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gal-panel-head h2,
.body_mc .gal-panel-head h2 {
  margin: 0 0 4px;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}

.gal-panel-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.gal-form {
  margin: 0;
}

.gal-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

.gal-label,
.gal-field-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gal-field .text,
.gal-field .select,
.gal-field .textarea {
  width: 100%;
  max-width: 100%;
}

.gal-new-album {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.gal-empty {
  margin: 0 0 16px;
  padding: 18px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.gal-upload-legal,
.gal-upload-quota,
.gal-upload-hint,
.gal-upload-wait {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.gal-upload-quota strong {
  color: var(--text);
}

.gal-upload-legal a {
  color: var(--accent);
}

.gal-uploader {
  margin-top: 8px;
}

.gal-upload-wait {
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: var(--inset);
  color: var(--text);
  text-align: center;
}

/* Uploadifive – Button, Queue, Progress (overrides lib CSS) */
.gal-upload .uploadifive-button {
  background: var(--surface) !important;
  background-image: none !important;
  border: 1px solid var(--border-strong, var(--border)) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  text-shadow: none !important;
  box-shadow: none !important;
  font: inherit !important;
  font-weight: 650 !important;
  text-transform: none !important;
}

.gal-upload .uploadifive-button:hover {
  background: rgba(62, 207, 255, 0.1) !important;
  background-image: none !important;
  border-color: var(--accent) !important;
  color: var(--text) !important;
}

.gal-upload .uploadifive-queue-item {
  background: var(--inset) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
  margin-top: 8px !important;
  padding: 12px 14px !important;
}

.gal-upload .uploadifive-queue-item .filename,
.gal-upload .uploadifive-queue-item .fileinfo {
  color: var(--text);
}

.gal-upload .uploadifive-queue-item.error {
  border-color: rgba(255, 107, 107, 0.55) !important;
  background: rgba(255, 107, 107, 0.08) !important;
}

.gal-upload .uploadifive-queue-item .progress {
  border: 1px solid var(--border) !important;
  background: var(--surface-2) !important;
  height: 6px !important;
  margin-top: 8px !important;
  width: 100% !important;
  border-radius: 999px !important;
  overflow: hidden;
}

.gal-upload .uploadifive-queue-item .progress-bar {
  background-color: var(--accent) !important;
  background-image: none !important;
  height: 6px !important;
  border-radius: 999px;
  transition: width 0.15s ease;
}

.gal-upload .uploadifive-queue-item.error .progress-bar {
  background-color: var(--red, #ff6b6b) !important;
}

.gal-upload .uploadifive-queue-item .close {
  opacity: 0.75;
  filter: invert(1);
}

/* Processing – picture rows */
.gal-pic-list-head {
  display: none;
}

.gal-pic-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gal-pic-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1.2fr) minmax(0, 1fr) 80px 110px 80px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--inset);
  min-width: 0;
}

.gal-thumb {
  position: relative;
  display: block;
  width: 84px;
  height: 84px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--surface-2);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  overflow: hidden;
  flex: 0 0 auto;
}

.gal-thumb-mark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.gal-thumb-mark--delete {
  background: rgba(0, 0, 0, 0.45);
  object-fit: none;
  object-position: center;
}

.gal-pic-row .textarea {
  width: 100%;
  height: 2.75em;
  min-height: 2.75em;
  max-height: 6em;
  resize: vertical;
  line-height: 1.35;
}

.gal-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  text-align: center;
  cursor: pointer;
  align-self: center;
}

.gal-opt .gal-field-label {
  display: none;
}

.gal-check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
  cursor: pointer;
}

.gal-check-row input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.gal-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 8px;
}

.gal-form-actions .standardButton {
  width: auto !important;
  margin: 0 !important;
}

@media (min-width: 901px) {
  .gal-pic-list-head {
    display: grid;
    grid-template-columns: 96px minmax(0, 1.2fr) minmax(0, 1fr) 80px 110px 80px;
    gap: 12px;
    align-items: center;
    margin: 0 0 8px;
    padding: 0 12px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .gal-pic-list-head .gal-col-opt {
    text-align: center;
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .gal-panel {
    padding: 14px;
  }

  .gal-fields {
    grid-template-columns: 1fr;
  }

  .gal-pic-row {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px 12px;
  }

  .gal-thumb {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 84px;
    height: 84px;
  }

  .gal-col-desc,
  .gal-col-tags {
    grid-column: 2;
  }

  .gal-pic-row > .gal-opt {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
  }

  .gal-pic-row .gal-opt .gal-field-label {
    display: inline;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.85rem;
    font-weight: 650;
    color: var(--text);
  }

  .gal-form-actions .standardButton {
    width: 100% !important;
    justify-content: center;
  }
}

/* Gallery page shell */
.gallery_page {
  width: 100%;
  max-width: 100%;
  margin: 0 auto 8px;
  text-align: left;
}

.gallery_page_header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(96%, 1100px);
  margin: 0 auto 16px;
}

.gallery_page_title,
.body_mc h1.gallery_page_title {
  margin: 0;
  text-align: left;
  font-size: clamp(1.35rem, 2.6vw + 0.8rem, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.gallery_notices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(96%, 1100px);
  margin: 0 auto 14px;
  text-align: left;
}

