.media-viewer-sidebar-action-form {
  display: inline;
  margin: 0;
}

.media-viewer-sidebar-link-button {
  background: none;
  border: 0;
  color: var(--emalm-ui-link);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-align: left;
}

.media-viewer-sidebar-link-button[disabled] {
  color: var(--emalm-ui-text-muted);
  cursor: wait;
}

.media-viewer-sidebar-link-button--destructive {
  color: var(--emalm-ui-danger-text);
}

.emalm-post-expunge-modal[hidden] {
  display: none;
}

.emalm-post-expunge-modal {
  align-items: center;
  background: rgba(0, 0, 0, 0.62);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 10030;
}

.emalm-post-expunge-dialog {
  background: var(--emalm-ui-surface-1);
  border: 1px solid var(--emalm-ui-border);
  box-shadow: var(--emalm-ui-shadow-soft);
  color: var(--emalm-ui-surface-text);
  max-width: 460px;
  padding: 18px;
  width: min(100%, 460px);
}

.emalm-post-expunge-dialog h3 {
  margin-top: 0;
}

.emalm-post-expunge-dialog-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
}

.emalm-post-expunge-confirm-button {
  background: var(--emalm-ui-danger-text);
  border: 1px solid var(--emalm-ui-danger-text);
  color: #fff;
}

.emalm-post-expunge-confirm-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.media-viewer-sidebar-status {
  color: var(--emalm-ui-success-text);
  display: block;
  font-size: 12px;
  margin-top: 6px;
}

.media-viewer-sidebar-status.is-error {
  color: var(--emalm-ui-danger-text);
}

.ui-dialog.emalm-edit-dialog-widget {
  background: var(--emalm-ui-surface-1);
  border: 1px solid var(--emalm-ui-border);
  box-shadow: var(--emalm-ui-shadow-soft);
  box-sizing: border-box;
  color: var(--emalm-ui-surface-text);
  max-width: calc(100vw - 24px);
  overflow: hidden;
  z-index: 10020;
}

.ui-dialog.emalm-edit-dialog-widget .ui-dialog-titlebar {
  align-items: center;
  background: var(--emalm-ui-surface-2);
  border-bottom: 1px solid var(--emalm-ui-border);
  cursor: move;
  display: flex;
  gap: 8px;
  min-height: 32px;
  padding: 5px 8px;
}

.ui-dialog.emalm-edit-dialog-widget .ui-dialog-title {
  flex: 1 1 auto;
  font-size: 14px;
  font-weight: 700;
}

.ui-dialog.emalm-edit-dialog-widget .ui-button {
  align-items: center;
  background: var(--emalm-ui-surface-1);
  border: 1px solid var(--emalm-ui-border);
  color: var(--emalm-ui-surface-text);
  display: inline-flex;
  font-size: 12px;
  justify-content: center;
  line-height: 1;
}

.ui-dialog.emalm-edit-dialog-widget .ui-button-icon-only {
  height: 22px;
  overflow: hidden;
  position: relative;
  text-indent: -999px;
  width: 24px;
}

.ui-dialog.emalm-edit-dialog-widget .ui-button-icon-only::before {
  display: block;
  text-indent: 0;
}

.ui-dialog.emalm-edit-dialog-widget .ui-dialog-titlebar-pin::before {
  content: "pin";
}

.ui-dialog.emalm-edit-dialog-widget .ui-dialog-titlebar-close::before {
  content: "x";
}

.ui-dialog.emalm-edit-dialog-widget .ui-dialog-content {
  box-sizing: border-box;
  height: calc(100% - 33px);
  overflow: auto;
  padding: 10px;
}

.ui-dialog.emalm-edit-dialog-widget #form {
  max-width: none;
}

.ui-dialog.emalm-edit-dialog-widget #post_tag_string {
  min-height: 180px;
}

.related-tags {
  font-size: 12px;
  line-height: 1.5;
}

.related-tags-label {
  color: var(--emalm-ui-text-muted);
  font-weight: 700;
  margin-right: 4px;
}

.related-tags-ai-details {
  display: inline-block;
  margin-left: 6px;
}

.related-tags-ai-details > summary {
  cursor: pointer;
  display: inline;
}

.related-tags-ai-body {
  display: inline;
}

.related-tag-suggestion {
  background: none;
  border: 0;
  color: var(--emalm-tag-general-color, #006ffa);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.related-tag-suggestion:hover,
.related-tag-suggestion:focus {
  text-decoration: underline;
}

.related-tag-suggestion--artist { color: var(--emalm-tag-artist-color, #ff0000); }
.related-tag-suggestion--copyright { color: var(--emalm-tag-copyright-color, #a0a000); }
.related-tag-suggestion--character { color: var(--emalm-tag-character-color, #00aa00); }
.related-tag-suggestion--meta { color: var(--emalm-tag-meta-color, #ff8800); }

.media-viewer-search-nav,
.media-viewer-resized-notice {
  background: var(--emalm-ui-notice-bg, var(--emalm-ui-surface-2));
  border: 1px solid var(--emalm-ui-border);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--emalm-ui-surface-text);
  margin: 0 0 10px;
  padding: 8px 10px;
}

.media-viewer-search-nav {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(64px, max-content) minmax(0, 1fr) minmax(64px, max-content);
  text-align: center;
}

.media-viewer-search-nav-prev { text-align: left; }
.media-viewer-search-nav-next { text-align: right; }
.media-viewer-search-nav-query { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.media-viewer-search-nav .is-disabled { color: var(--emalm-ui-text-muted); }

.media-viewer-resized-notice {
  color: var(--emalm-ui-text-muted);
}

.post-notice.post-notice-search {
  background: var(--emalm-ui-notice-bg, var(--emalm-ui-surface-2));
  border: 1px solid var(--emalm-ui-border);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--emalm-ui-surface-text);
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.post-notice.post-notice-search > li {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(64px, max-content) minmax(0, 1fr) minmax(64px, max-content);
  margin: 0;
  padding: 8px 10px;
}

.post-notice.post-notice-search > li + li {
  border-top: 1px solid var(--emalm-ui-border);
}

.post-notice .search-navbar .prev,
.post-notice .pool-navbar .prev,
.post-notice .pool-navbar .first {
  text-align: left;
}

.post-notice .search-navbar .next,
.post-notice .pool-navbar .next,
.post-notice .pool-navbar .last {
  text-align: right;
}

.post-notice .search-name,
.post-notice .pool-name {
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: center;
}

.post-notice .is-disabled {
  color: var(--emalm-ui-text-muted);
}

.post-rating-options {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.post-rating-option {
  align-items: center;
  background: var(--emalm-ui-surface-2);
  border: 1px solid var(--emalm-ui-border);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
}

.post-rating-option input {
  margin: 0;
}

.post-rating-option-key {
  align-items: center;
  background: var(--emalm-ui-surface-1);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 1.8rem;
  min-width: 1.8rem;
}

.post-rating-option-label {
  font-weight: 600;
}

@media (max-width: 640px) {
  .post-rating-options {
    grid-template-columns: 1fr;
  }

  .media-viewer-search-nav {
    grid-template-columns: 1fr;
    text-align: left;
  }
  .media-viewer-search-nav-next { text-align: left; }

  .post-notice.post-notice-search > li {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .post-notice .search-navbar .next,
  .post-notice .pool-navbar .next,
  .post-notice .pool-navbar .last,
  .post-notice .search-name,
  .post-notice .pool-name {
    text-align: left;
  }
}


.media-viewer-frame.image-container {
  align-items: flex-start !important;
  justify-content: flex-start !important;
  text-align: left !important;
}

.media-viewer-frame.image-container #image,
.media-viewer-frame.image-container picture,
.media-viewer-frame.image-container {
  margin-left: 0 !important;
  margin-right: auto !important;
}

.media-viewer-frame.image-container #image,
.media-viewer-frame.image-container .main-img {
  background: #fff;
}

.media-viewer-engagement {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
}

.media-viewer-engagement form {
  margin: 0;
}

.media-viewer-engagement-button {
  align-items: center;
  background: #fff7df;
  border: 1px solid #ffd36b;
  border-radius: 999px;
  color: #8a5a00;
  display: inline-flex;
  gap: 0.42rem;
  font-weight: 800;
  justify-content: center;
  min-height: 32px;
  min-width: 36px;
  padding: 0.35rem 0.7rem;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.media-viewer-engagement-button:hover,
.media-viewer-engagement-button:focus {
  background: #fff0b8;
  border-color: #ffbd2f;
  color: #6f4300;
  transform: translateY(-1px);
}

.media-viewer-engagement-button.is-active {
  background: linear-gradient(135deg, #ff4f8b, #ff8a4f);
  border-color: #ff4f8b;
  color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 79, 139, 0.2), 0 10px 22px rgba(166, 30, 77, 0.28);
  text-shadow: 0 1px 1px rgba(90, 0, 25, 0.34);
}

.media-viewer-vote-button.is-up.is-active {
  background: linear-gradient(135deg, #16883a, #35c96f);
  border-color: #11732f;
  box-shadow: 0 0 0 2px rgba(22, 136, 58, 0.24), 0 10px 22px rgba(22, 136, 58, 0.3);
}

.media-viewer-vote-button.is-down.is-active {
  background: linear-gradient(135deg, #c92a2a, #ff6b6b);
  border-color: #aa1f1f;
  box-shadow: 0 0 0 2px rgba(201, 42, 42, 0.24), 0 10px 22px rgba(201, 42, 42, 0.3);
}

.media-viewer-engagement-button.is-active {
  outline: 3px solid color-mix(in srgb, currentColor 24%, transparent);
  outline-offset: 2px;
}

.media-comment-vote-controls {
  align-items: center;
  display: inline-flex;
  gap: 4px;
  margin-right: 6px;
}

.media-comment-vote-form {
  display: inline-flex;
  margin: 0;
}

.media-comment-vote-button {
  align-items: center;
  background: color-mix(in srgb, var(--emalm-ui-surface, #fff) 88%, var(--emalm-ui-text-muted, #777));
  border: 1px solid color-mix(in srgb, var(--emalm-ui-border, #d6d6d6) 82%, transparent);
  border-radius: 999px;
  color: var(--emalm-ui-text-muted);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  line-height: 1;
  min-width: 24px;
  padding: 4px 7px;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

.media-comment-vote-button:hover,
.media-comment-vote-button:focus {
  color: var(--emalm-ui-link);
  transform: translateY(-1px);
}

.media-comment-vote-button.is-up.is-active {
  background: linear-gradient(135deg, #16883a, #35c96f);
  border-color: #11732f;
  box-shadow: 0 0 0 3px rgba(22, 136, 58, 0.26), 0 8px 18px rgba(22, 136, 58, 0.34);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 74, 24, 0.38);
}

.media-comment-vote-button.is-down.is-active {
  background: linear-gradient(135deg, #c92a2a, #ff6b6b);
  border-color: #aa1f1f;
  box-shadow: 0 0 0 3px rgba(201, 42, 42, 0.26), 0 8px 18px rgba(201, 42, 42, 0.34);
  color: #fff;
  text-shadow: 0 1px 1px rgba(99, 13, 13, 0.38);
}

.media-comment[data-current-vote="1"] .media-comment-score {
  color: #20a84a;
  font-weight: 800;
}

.media-comment[data-current-vote="-1"] .media-comment-score {
  color: #c92a2a;
  font-weight: 800;
}

.media-viewer-engagement-button:disabled {
  cursor: wait;
  opacity: 0.65;
  transform: none;
}

.emalm-interaction-pop {
  animation: emalm-interaction-pop 520ms cubic-bezier(.2, 1.4, .4, 1);
}

.emalm-interaction-burst {
  animation: emalm-interaction-burst 700ms ease-out forwards;
  color: #ff78a5;
  font-size: 18px;
  font-weight: 900;
  left: 0;
  line-height: 1;
  pointer-events: none;
  position: absolute;
  text-shadow: 0 1px 0 #fff, 0 6px 12px rgba(0, 0, 0, 0.16);
  top: 0;
  transform: translate(-50%, -50%);
  z-index: 9999;
}

.emalm-interaction-burst--upvote {
  color: #24b84f;
}

.emalm-interaction-burst--downvote {
  color: #7c6cff;
}

@keyframes emalm-interaction-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.22) rotate(-4deg); }
  100% { transform: scale(1); }
}

@keyframes emalm-interaction-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5) rotate(0deg); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -185%) scale(1.55) rotate(20deg); }
}

.sidebar-container[data-emalm-post-show-shell="danbooru"] {
  align-items: flex-start;
  display: flex;
  flex-direction: row-reverse;
  gap: 12px;
}

.sidebar-container[data-emalm-post-show-shell="danbooru"][data-emalm-sidebar-side="right"] {
  flex-direction: row;
}

.sidebar-container[data-emalm-post-show-shell="danbooru"] > #sidebar {
  flex: 0 0 280px;
  max-width: 280px;
  width: 280px;
}

.sidebar-container[data-emalm-post-show-shell="danbooru"] > #content {
  flex: 1 1 auto;
  min-width: 0;
}

@media (max-width: 767px) {
  .sidebar-container[data-emalm-post-show-shell="danbooru"] {
    flex-direction: column;
  }

  .sidebar-container[data-emalm-post-show-shell="danbooru"] > #sidebar,
  .sidebar-container[data-emalm-post-show-shell="danbooru"] > #content {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
  }
}

.media-viewer-frame.image-container .main-img {
  margin-left: 0 !important;
  margin-right: auto !important;
}

#add-to-pool-dialog[hidden],
.emalm-pool-dialog-widget[hidden] {
  display: none !important;
}

.ui-dialog.emalm-pool-dialog-widget {
  background: var(--jquery-ui-widget-content-background, var(--card-background-color, var(--emalm-ui-surface-1)));
  border: 1px solid var(--dialog-titlebar-background-color, var(--emalm-ui-border));
  border-radius: 0.25rem;
  box-shadow: var(--shadow-lg, 0 12px 30px rgba(0, 0, 0, 0.28));
  box-sizing: border-box;
  color: var(--text-color, var(--emalm-ui-text));
  height: auto !important;
  max-width: calc(100vw - 24px);
  min-width: 320px;
  overflow: visible;
  z-index: 10030 !important;
}

.ui-dialog.emalm-pool-dialog-widget .ui-dialog-titlebar {
  align-items: center;
  background-color: var(--dialog-titlebar-background-color, var(--emalm-ui-surface-2));
  color: var(--dialog-titlebar-color, var(--emalm-ui-text));
  display: flex;
  font-weight: 700;
  gap: 0.25rem;
  justify-content: space-between;
  padding: 0.375rem 0.375rem 0.375rem 0.75rem;
}

.ui-dialog.emalm-pool-dialog-widget .ui-dialog-content {
  padding: 0.5rem 0.75rem;
}

.ui-dialog.emalm-pool-dialog-widget form.simple_form {
  margin-bottom: 0;
}

.ui-dialog.emalm-pool-dialog-widget form.simple_form div.input {
  margin-bottom: 0.5em;
}

.ui-dialog.emalm-pool-dialog-widget input[type="text"] {
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
}

.ui-dialog.emalm-pool-dialog-widget .ui-button-icon-only {
  align-items: center;
  display: inline-flex;
  height: 22px;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
  text-indent: -999px;
  width: 24px;
}

.ui-dialog.emalm-pool-dialog-widget .ui-button-icon-only::before {
  content: "x";
  display: block;
  text-indent: 0;
}

.media-viewer-pool-status {
  color: var(--muted-text-color, var(--emalm-ui-text-muted));
  display: block;
  font-size: 12px;
}

.media-viewer-pool-status.is-error {
  color: var(--emalm-ui-danger-text, #ff7a7a);
}
.post-tag-editor-counter {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
}

.tag-counter-blob {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}
