.image-list,
.comment-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.image-list {
  --active-image-index: 0;
  display: flex;
  width: 100%;
  transform: translateX(calc(var(--active-image-index) * -100%));
  transition: transform 360ms ease;
}

.image-list > li {
  flex: 0 0 100%;
  padding: 0 0.4rem;
  box-sizing: border-box;
}

.empty-gallery-message {
  padding: 2rem;
  text-align: center;
  font-weight: 700;
  color: #607086;
}

#gallery-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-top: 0.9rem;
}

#gallery-list > li {
  padding: 0;
}

#gallery-list > li.gallery-card {
  padding: 0.9rem 1rem;
}

.gallery-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  min-width: 0;
}

.gallery-page-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.update-indicator-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 0.42rem 0.85rem;
  margin: 0;
  border: 1px solid #d7dee8;
  border-radius: 999px;
  background: #f8fbfe;
  color: #234360;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(31, 41, 51, 0.08);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.update-indicator-button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.01);
  background: #f1f6fb;
  border-color: #bcc9d8;
  box-shadow: 0 10px 22px rgba(31, 41, 51, 0.1);
}

.update-indicator-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.gallery-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  background: #fbfcfe;
  border: 1px solid #dfe6ee;
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(31, 41, 51, 0.05);
}

.gallery-username {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.98rem;
  font-weight: 700;
  color: #23374d;
}

#add-image-form-toggle-button {
  min-width: 8.5rem;
}

.view-gallery-button {
  margin-left: auto;
}

main > .row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  margin: 0 auto;
}

#image-display-component,
#add-image-component {
  padding: 1.35rem;
  box-sizing: border-box;
  background: #fcfdff;
  border: 1px solid #e5ebf1;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

#image-display-component {
  overflow: hidden;
  overscroll-behavior: contain;
}

#add-image-component {
  margin-bottom: 0;
}

.image-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 2.6rem 1.8rem 1.3rem;
  box-sizing: border-box;
  background: #fcfdff;
  border: 1px solid #e5ebf1;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(31, 41, 51, 0.07);
}

.display-image {
  width: 100%;
  max-height: 58vh;
  margin: 0 0 0.8rem;
  object-fit: contain;
  background: #f3f6fa;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(31, 41, 51, 0.08);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease;
}

.display-image:hover {
  transform: translateY(-3px) scale(1.01);
  box-shadow: 0 10px 24px rgba(31, 41, 51, 0.12);
}

.display-image-title,
.display-image-author,
.display-comment-author,
.display-comment-date,
.display-comment-content {
  margin: 0;
}

.display-image-title {
  margin-bottom: 0.15rem;
  font-size: 1.35rem;
}

.display-image-author {
  margin-bottom: 0.75rem;
  color: #607086;
}

.add-comment-form-toggle-button {
  margin: 0;
}

.comment-display {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
}

.comment-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
}

.comment-left-controls,
.comment-right-controls,
.comment-page-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 0.55rem 0 0;
  padding: 0;
}

.comment-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.95rem 2.75rem 0.95rem 0.95rem;
  background: #fcfdff;
  border: 1px solid #e5ebf1;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgba(31, 41, 51, 0.05);
}

.display-comment-meta {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin: 0;
}

.display-comment-author {
  font-weight: 700;
}

.display-comment-date {
  color: #607086;
  font-size: 0.9rem;
}

#add-image-form-toggle-button,
.add-comment-form-toggle-button,
#new-image-submit,
.new-comment-submit-button {
  display: block;
  width: 100%;
  margin-bottom: 0;
  box-sizing: border-box;
}

.display-image-delete-button,
.display-comment-delete-button,
#load-more-galleries-button,
#previous-gallery-page-button,
#next-gallery-page-button,
.more-comments-button,
.less-comments-button,
.newer-comments-button,
.older-comments-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  padding: 0;
  border: 1px solid #d7dee8;
  border-radius: 999px;
  background: #ffffff;
  color: #1f2933;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.display-image-delete-button:hover,
.display-comment-delete-button:hover,
#load-more-galleries-button:hover:not(:disabled),
#previous-gallery-page-button:hover:not(:disabled),
#next-gallery-page-button:hover:not(:disabled),
.more-comments-button:hover,
.less-comments-button:hover,
.newer-comments-button:hover:not(:disabled),
.older-comments-button:hover:not(:disabled) {
  background: #f3f6fa;
  border-color: #bcc9d8;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 8px 18px rgba(31, 41, 51, 0.1);
}

.display-image-delete-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
}

.display-comment-delete-button {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
}

.newer-comments-button:disabled,
.older-comments-button:disabled,
#load-more-galleries-button:disabled,
#previous-gallery-page-button:disabled,
#next-gallery-page-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

@media (max-width: 576px) {
  body {
    padding: 0 0.65rem;
  }

  #image-display-component,
  #add-image-component {
    padding: 0.85rem;
  }

  .image-list > li {
    padding: 0 0.7rem;
  }

  .image-card {
    padding: 2.75rem 1rem 1rem;
  }

  .display-image {
    max-height: 48vh;
  }
}

/* Fix: remove the orange DevTools margin strip under Total images. */
#images-total-number {
  margin: 0;
}

#image-list {
  margin-top: 1rem;
}

#image-list:empty {
  margin-top: 0;
}

/* Fix: keep Add Comment separated from comment controls. */
.add-comment-form-toggle-button {
  margin: 0 0 0.75rem;
}

.add-comment-form.form-panel.is-open {
  margin-bottom: 0.75rem;
}

.comment-display {
  margin-top: 0;
}

.comment-controls {
  margin: 0 0 0.65rem;
}

.comment-list {
  margin-top: 0;
}
