  .media-viewer-frame {
    margin-bottom: 16px;
  }

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

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

  .media-viewer-layout {
    display: block;
  }

  .media-viewer-header-shell {
    align-items: flex-start;
    display: flex;
    gap: 18px;
    margin-top: 16px;
  }

  .media-viewer-search-shell {
    margin-bottom: 14px;
    width: 100%;
  }

  .media-viewer-danbooru-sidebar {
    flex: 0 0 240px;
    max-width: 280px;
    order: 1;
  }

  .media-viewer-danbooru-content {
    flex: 1 1 auto;
    min-width: 0;
    order: 2;
  }

  .media-viewer-content-actions {
    margin-bottom: 12px;
  }

  .media-viewer-danbooru-sidebar section {
    margin-bottom: 16px;
  }

  .media-viewer-search-shell .media-viewer-post-search {
    width: 100%;
  }

  .media-viewer-danbooru-sidebar h2,
  .media-viewer-danbooru-sidebar h3 {
    font-size: 16px;
    margin: 0 0 6px;
  }

  .media-viewer-danbooru-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .media-viewer-danbooru-sidebar .tag-list.categorized-tag-list {
    display: block;
  }

  .media-viewer-danbooru-sidebar .tag-list.categorized-tag-list > ul {
    display: block;
  }

  .media-viewer-danbooru-sidebar li {
    line-height: 1.35;
    margin: 2px 0;
  }

  .media-viewer-danbooru-sidebar .tag-list.categorized-tag-list > ul > li {
    white-space: normal;
  }

  .media-viewer-danbooru-sidebar .emalm-tag-sidebar-row {
    align-items: baseline;
    display: grid;
    gap: 0 6px;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    min-width: 0;
  }

  .media-viewer-danbooru-sidebar .emalm-tag-sidebar-name {
    min-width: 0;
  }

  .media-viewer-danbooru-sidebar .emalm-tag-sidebar-name .search-tag {
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .media-viewer-danbooru-sidebar .emalm-tag-sidebar-actions {
    align-items: baseline;
    display: inline-flex;
    gap: 0.25rem;
    white-space: nowrap;
  }

  .media-viewer-danbooru-sidebar .emalm-tag-sidebar-count {
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
  }

  .media-viewer-danbooru-sidebar .x-tag-recently-added {
    background: var(--wiki-page-versions-diff-ins-background, rgba(120, 196, 74, 0.22));
    box-shadow: inset 3px 0 0 rgba(120, 196, 74, 0.7);
  }

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

  .media-viewer-sidebar-link-button {
    background: transparent;
    border: 0;
    color: var(--link-color, #06c);
    cursor: pointer;
    font: inherit;
    padding: 0;
    text-align: left;
    text-decoration: underline;
  }

  .media-viewer-sidebar-link-button[disabled] {
    cursor: wait;
    opacity: 0.65;
  }

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

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

  .media-viewer-danbooru-sidebar .wiki-link {
    color: #777;
  }

  .media-viewer-danbooru-sidebar .tag-type-system,
  .media-viewer-danbooru-sidebar .tag-type-system .search-tag {
    color: var(--emalm-tag-system-color, #000);
  }

  .media-viewer-danbooru-sidebar .tag-type-0,
  .media-viewer-danbooru-sidebar .tag-type-0 .search-tag {
    color: var(--emalm-tag-general-color, #006ffa);
  }

  .media-viewer-danbooru-sidebar .tag-type-1,
  .media-viewer-danbooru-sidebar .tag-type-1 .search-tag {
    color: var(--emalm-tag-artist-color, #ff0000);
  }

  .media-viewer-danbooru-sidebar .tag-type-3,
  .media-viewer-danbooru-sidebar .tag-type-3 .search-tag {
    color: var(--emalm-tag-copyright-color, #b000b0);
  }

  .media-viewer-danbooru-sidebar .tag-type-4,
  .media-viewer-danbooru-sidebar .tag-type-4 .search-tag {
    color: var(--emalm-tag-character-color, #00a000);
  }

  .media-viewer-danbooru-sidebar .tag-type-5,
  .media-viewer-danbooru-sidebar .tag-type-5 .search-tag {
    color: var(--emalm-tag-meta-color, #ff4a00);
  }

  .post-info-uploader-with-avatar {
    align-items: center;
    display: flex;
    gap: 8px;
  }

  .post-uploader-avatar {
    background: var(--card-background-color, var(--emalm-ui-surface-1)) center/cover no-repeat;
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 3px;
    display: block;
    height: 32px;
    width: 32px;
  }

  .post-uploader-text {
    min-width: 0;
  }

  #post-sections {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 18px 0 12px;
    padding: 0;
  }

  #post-sections a {
    border-bottom: 2px solid transparent;
    display: inline-block;
    padding: 4px 0;
  }

  #post-sections .active a {
    border-bottom-color: currentColor;
    font-weight: 700;
  }

  #artist-commentary {
    background: var(--card-background-color, var(--emalm-ui-surface-1));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 3px;
    margin: 12px 0;
    padding: 8px;
  }

  #artist-commentary h2 {
    font-size: 18px;
    margin: 0 0 6px;
  }

  #artist-commentary h3 {
    font-size: 15px;
    margin: 8px 0 4px;
  }

  #commentary-sections {
    display: flex;
    gap: 8px;
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
  }

  #commentary-sections .artist-commentary-tab {
    border-bottom: 2px solid transparent;
    color: inherit;
    display: inline-block;
    padding: 2px 0;
    text-decoration: none;
  }

  #commentary-sections .artist-commentary-tab.is-active {
    border-bottom-color: currentColor;
    font-weight: 700;
  }

  #original-artist-commentary,
  #translated-artist-commentary {
    max-height: 20em;
    overflow-y: auto;
  }

  .emalm-extra-artist-commentaries {
    border-top: 1px solid var(--default-border-color, var(--emalm-ui-border));
    margin-top: 8px;
    padding-top: 8px;
  }

  .media-viewer-post-edit {
    margin: 12px 0;
  }

  .media-viewer-post-edit .simple_form {
    max-width: 760px;
  }

  .media-viewer-post-edit .input {
    margin-bottom: 10px;
  }

  .media-viewer-post-edit label {
    display: block;
    font-weight: 700;
    margin-bottom: 4px;
  }

  .media-viewer-post-edit input[type="text"],
  .media-viewer-post-edit textarea {
    background: var(--form-input-background, var(--card-background-color, var(--emalm-ui-surface-1)));
    border: 1px solid var(--form-input-border-color, var(--default-border-color, var(--emalm-ui-border)));
    border-radius: 3px;
    color: var(--text-color, var(--emalm-ui-text));
    padding: 6px;
    width: 100%;
  }

  .media-viewer-post-edit .radio {
    display: inline-flex;
    gap: 4px;
    margin-right: 10px;
  }

  .media-viewer-post-edit .radio label {
    display: inline;
    font-weight: 400;
    margin: 0;
  }

  #post_tag_string {
    max-height: 10rem;
    min-height: 8rem;
    resize: vertical;
  }

  .source-data,
  .danbooru-parity-pending {
    background: var(--emalm-ui-warning-bg);
    border: 1px solid var(--emalm-ui-warning-border);
    border-radius: 3px;
    color: var(--emalm-ui-warning-text);
    margin-bottom: 10px;
    padding: 8px;
  }

  .media-viewer-edit-error {
    background: var(--emalm-ui-danger-bg);
    border: 1px solid var(--emalm-ui-danger-border);
    border-radius: 3px;
    color: var(--emalm-ui-danger-text);
    margin-bottom: 10px;
    padding: 8px;
  }

  .ui-dialog.emalm-edit-dialog-widget {
    background: var(--card-background-color, var(--emalm-ui-surface-1));
    border-color: var(--default-border-color, var(--emalm-ui-border));
    border-radius: 0.25rem;
    border-style: solid;
    border-width: 1px;
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.22));
    color: var(--text-color, var(--emalm-ui-text));
    max-height: calc(100vh - 40px);
    overflow: hidden;
    z-index: 1300 !important;
  }

  .ui-dialog.emalm-edit-dialog-widget .ui-dialog-titlebar {
    align-items: center;
    background-color: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border-bottom: 1px solid var(--default-border-color, var(--emalm-ui-border));
    color: var(--text-color, var(--emalm-ui-text));
    cursor: move;
    display: flex;
    font-weight: bold;
    gap: 6px;
    justify-content: space-between;
    min-height: 30px;
    padding: 0.375rem 0.375rem 0.375rem 0.75rem;
  }

  .ui-dialog.emalm-edit-dialog-widget .ui-dialog-title {
    display: block;
    flex: 1;
    font-size: 14px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
  }

  .ui-dialog.emalm-edit-dialog-widget .ui-button {
    align-items: center;
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 3px;
    color: var(--text-color, var(--emalm-ui-text));
    display: inline-flex;
    height: 22px;
    justify-content: center;
    min-width: 22px;
    padding: 0 5px;
  }

  .ui-dialog.emalm-edit-dialog-widget .ui-button-icon-only {
    font-size: 0;
    height: 1.25rem;
    min-width: 1.25rem;
    position: relative;
    text-indent: -9999px;
  }

  .ui-dialog.emalm-edit-dialog-widget .ui-button-icon-only::before {
    font-size: 13px;
    line-height: 1;
    text-indent: 0;
  }

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

  .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% - 31px);
    overflow: auto;
    padding: 0.5rem 0.75rem;
  }

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

  .ui-dialog.emalm-edit-dialog-widget #post_tag_string {
    min-height: 10rem;
    resize: none;
    width: 100%;
  }

  .related-tags {
    line-height: 1.8;
  }

  .related-tags-section {
    display: inline;
  }

  .related-tags-label {
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    margin-left: 0.5em;
  }

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

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

  .related-tags-ai-body {
    display: inline;
    margin-left: 0.35em;
  }

  .related-tag-suggestion {
    background: transparent;
    border: 0;
    color: var(--emalm-tag-general-color, #0073b7);
    cursor: pointer;
    font: inherit;
    padding: 0 2px;
  }

  .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); }

  .emalm-danbooru-dialog {
    background: var(--card-background-color, var(--emalm-ui-surface-1));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    color: var(--text-color, var(--emalm-ui-text));
    max-height: calc(100vh - 24px);
    overflow: auto;
    z-index: 1300;
  }

  .emalm-danbooru-dialog-titlebar {
    align-items: center;
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border-bottom: 1px solid var(--default-border-color, var(--emalm-ui-border));
    cursor: move;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 8px;
  }

  .emalm-danbooru-dialog-titlebar h2 {
    font-size: 15px;
    margin: 0;
  }

  .emalm-danbooru-dialog-actions {
    display: inline-flex;
    gap: 4px;
  }

  .emalm-danbooru-dialog button {
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 3px;
    padding: 2px 7px;
  }

  .emalm-danbooru-dialog-body {
    padding: 10px;
  }

  #edit-dialog .post_parent_id,
  #edit-dialog .post_source {
    display: none;
  }

  #add-commentary-dialog {
    left: 50%;
    position: fixed;
    top: 40px;
    transform: translateX(-50%);
    width: min(770px, calc(100vw - 24px));
  }

  #add-commentary-dialog[hidden] {
    display: none;
  }

  .post-notice-assets {
    background: var(--emalm-ui-info-bg);
    border: 1px solid var(--emalm-ui-info-border);
    color: var(--emalm-ui-info-text);
    margin: 0 0 12px;
    max-width: 100%;
    padding: 8px 10px;
  }

  .emalm-media-assets-notice-line {
    line-height: 1.35;
    margin-bottom: 8px;
  }

  .emalm-media-assets-actions {
    white-space: nowrap;
  }

  .emalm-media-assets-strip {
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .emalm-media-assets-strip .posts-container {
    align-items: flex-start;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .emalm-media-asset-preview {
    border: 1px solid transparent;
    color: inherit;
    flex: 0 0 auto;
    max-width: 118px;
    text-align: center;
    text-decoration: none;
  }

  .emalm-media-asset-preview:hover,
  .emalm-media-asset-preview:focus {
    background: var(--table-row-hover-background, var(--emalm-ui-surface-2));
    border-color: var(--button-primary-background-color, var(--emalm-ui-accent));
    text-decoration: none;
  }

  .emalm-media-asset-preview.is-current {
    background: var(--emalm-ui-warning-bg);
    border-color: var(--emalm-ui-warning-border);
  }

  .emalm-media-asset-preview .post-preview-container {
    align-items: center;
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    display: flex;
    height: 96px;
    justify-content: center;
    width: 96px;
  }

  .emalm-media-asset-preview-img {
    max-height: 96px;
    max-width: 96px;
    object-fit: contain;
  }

  .emalm-media-asset-preview-caption {
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    font-size: 11px;
    line-height: 1.2;
    margin-top: 3px;
    overflow-wrap: anywhere;
  }

  .emalm-multi-asset-stage {
    background: transparent;
    border: 0;
    margin-bottom: 14px;
    padding: 0;
  }

  .emalm-multi-asset-figure {
    display: block;
    margin: 0 0 14px;
  }

  .emalm-multi-asset-figure .main-img {
    display: block;
    height: auto;
    max-height: none;
    max-width: 100%;
    object-fit: contain;
  }

  .emalm-multi-asset-figure figcaption {
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    font-size: 12px;
    margin-top: 6px;
  }

  .emalm-multi-asset-all {
    align-items: flex-start;
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .emalm-multi-asset-all .emalm-multi-asset-figure {
    border-top: 1px solid var(--default-border-color, var(--emalm-ui-border));
    padding-top: 18px;
  }

  .emalm-multi-asset-all .emalm-multi-asset-figure:first-child {
    border-top: 0;
    padding-top: 0;
  }

  @media only screen and (min-width: 1027px) {
    .media-viewer-layout {
      align-items: flex-start;
      display: grid;
      gap: 3%;
      grid-template-columns: minmax(0, 70%) minmax(220px, 20%);
      margin-left: 50px;
      margin-right: 3%;
    }

    .media-viewer-layout .media-viewer-main {
      left: auto !important;
      margin: 0 !important;
      min-width: 0;
      position: relative;
      width: auto !important;
    }

    .media-viewer-layout .media-viewer-rside {
      display: block;
      left: auto !important;
      margin: 0 !important;
      min-width: 0;
      position: static !important;
      right: auto !important;
      width: auto !important;
    }
  }

  .media-viewer-rside {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .media-viewer-rside-toggle {
    align-items: center;
    background: var(--card-background-color, var(--emalm-ui-surface-1));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 999px;
    color: var(--text-color, var(--emalm-ui-text));
    display: inline-flex;
    gap: 8px;
    margin: 0 0 10px 1%;
    padding: 8px 14px;
  }

  .media-viewer-rside-inner {
    padding-left: 1%;
    padding-right: 1%;
  }

  .media-viewer-rside.is-collapsed .media-related-panel {
    margin-top: 8px;
  }

  .media-viewer-rside.is-collapsed .media-viewer-rside-toggle .glyphicon {
    transform: rotate(-90deg);
  }

  @media only screen and (max-width: 760px) {
    .media-viewer-header-shell {
      display: flex;
      flex-direction: column;
    }

    .media-viewer-danbooru-sidebar {
      flex: auto;
      max-width: none;
      order: 2;
      width: 100%;
    }

    .media-viewer-danbooru-content {
      order: 1;
      width: 100%;
    }
  }

  .media-viewer-video-frame {
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    width: 100%;
  }

  .media-viewer-video-frame .iframe-container,
  .media-viewer-video-frame .media-viewer-shaka-container,
  .media-viewer-video-frame .media-viewer-inline-video {
    border: 0;
    display: block;
    height: 100%;
    margin: 0;
    max-height: none;
    width: 100%;
  }

  .media-viewer-video-frame .media-viewer-inline-video {
    object-fit: contain;
  }

  .media-viewer-processing {
    background: var(--emalm-ui-warning-bg);
    border: 1px solid var(--emalm-ui-warning-border);
    color: var(--emalm-ui-warning-text);
    margin-bottom: 12px;
    padding: 10px 12px;
  }

  .media-viewer-header,
  .media-comments {
    background: var(--card-background-color, var(--emalm-ui-surface-1));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-top: 3px solid var(--button-primary-background-color, var(--emalm-ui-accent));
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    margin: 16px 0;
    padding: 16px;
  }

  .media-viewer-danbooru-content > .media-viewer-header {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    margin: 8px 0 12px;
    padding: 0;
  }

  .media-viewer-title-row,
  .media-viewer-stat-row,
  .media-viewer-uploader-row,
  .media-viewer-inline-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .media-viewer-title-row {
    justify-content: space-between;
  }

  .media-viewer-title {
    font-size: 24px;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
  }

  .media-viewer-stat-row {
    color: var(--text-color, var(--emalm-ui-text));
    margin-top: 10px;
  }

  .media-viewer-stat {
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 4px;
    padding: 5px 8px;
  }

  .media-viewer-score.is-positive strong {
    color: #147a32;
  }

  .media-viewer-score.is-negative strong {
    color: #a92525;
  }

  .media-vote-controls {
    align-items: center;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
  }

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

  .media-vote-button {
    border: 1px solid #aaa;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    gap: 5px;
    padding: 5px 9px;
  }

  .media-vote-button.is-up {
    background: #edf8ef;
    color: #147a32;
  }

  .media-vote-button.is-down {
    background: #faeeee;
    color: #a92525;
  }

  .media-vote-button.is-active {
    border-color: currentColor;
    box-shadow: inset 0 0 0 1px currentColor;
    font-weight: 700;
  }

  .post-vote-button {
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 999px;
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    cursor: pointer;
    font-weight: 800;
    line-height: 1;
    min-width: 24px;
    padding: 3px 7px;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .15s ease;
  }

  .post-vote-button:hover {
    background: var(--table-row-hover-background, var(--emalm-ui-surface-2));
    color: var(--text-color, var(--emalm-ui-text));
  }

  .post-vote-button.is-active {
    color: #fff;
    font-weight: 900;
    transform: translateY(-1px);
  }

  .post-upvote-link.is-active {
    background: linear-gradient(135deg, #16883a, #35c96f);
    border-color: #11732f;
    box-shadow: 0 0 0 2px rgba(22, 136, 58, .22), 0 6px 14px rgba(22, 136, 58, .22);
    color: #fff;
  }

  .post-downvote-link.is-active {
    background: linear-gradient(135deg, #c92a2a, #ff6b6b);
    border-color: #aa1f1f;
    box-shadow: 0 0 0 2px rgba(201, 42, 42, .22), 0 6px 14px rgba(201, 42, 42, .2);
    color: #fff;
  }

  .media-viewer-favorite-button.is-active {
    background: linear-gradient(135deg, #ff7aa8, #ffd166);
    border-color: #e45a86;
    box-shadow: 0 0 0 2px rgba(255, 122, 168, .22), 0 8px 18px rgba(228, 90, 134, .22);
    color: #2b0e17;
    font-weight: 900;
  }

  .media-viewer-vote-button.is-up.is-active,
  .media-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, .22), 0 8px 18px rgba(22, 136, 58, .2);
    color: #fff;
    font-weight: 900;
  }

  .media-viewer-vote-button.is-down.is-active,
  .media-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, .22), 0 8px 18px rgba(201, 42, 42, .2);
    color: #fff;
    font-weight: 900;
  }

  .media-vote-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
  }

  .media-viewer-uploader-row {
    border-top: 1px solid var(--default-border-color, var(--emalm-ui-border));
    margin-top: 14px;
    padding-top: 14px;
  }

  .media-viewer-avatar,
  .media-comment-avatar,
  .media-comment-form-avatar {
    background: var(--card-background-color, var(--emalm-ui-surface-1)) center/cover no-repeat;
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 50%;
    display: block;
    flex: 0 0 auto;
    height: 48px;
    width: 48px;
  }

  .media-viewer-uploader-text {
    flex: 1 1 220px;
    min-width: 0;
  }

  .media-viewer-uploader-name,
  .media-comment-author {
    color: var(--text-color, var(--emalm-ui-text));
    font-weight: 700;
  }

  .media-viewer-published,
  .media-comment-date,
  .media-comment-score,
  .media-comment-edited {
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    font-size: 13px;
  }

  .media-viewer-actions,
  .media-viewer-owner-actions,
  .media-viewer-post-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .media-viewer-post-nav {
    justify-content: flex-end;
    margin-bottom: 10px;
  }

  .media-viewer-action,
  .media-viewer-owner-actions a,
  .media-viewer-link-button,
  .media-comment-submit,
  .media-comment-delete,
  .media-comment-vote-button,
  .media-comment-sticky-button {
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 4px;
    color: var(--text-color, var(--emalm-ui-text));
    display: inline-flex;
    gap: 5px;
    padding: 7px 10px;
    text-decoration: none;
  }

  .media-viewer-action:hover,
  .media-viewer-owner-actions a:hover,
  .media-viewer-link-button:hover,
  .media-comment-submit:hover,
  .media-comment-delete:hover,
  .media-comment-vote-button:hover,
  .media-comment-sticky-button:hover {
    background: var(--table-row-hover-background, var(--emalm-ui-surface-2));
    color: var(--text-color, var(--emalm-ui-text));
    text-decoration: none;
  }

  .media-viewer-link-button {
    cursor: pointer;
    font: inherit;
  }

  .media-viewer-description {
    border-top: 1px solid var(--default-border-color, var(--emalm-ui-border));
    line-height: 1.5;
    margin-top: 14px;
    overflow-wrap: anywhere;
    padding-top: 14px;
  }

  .media-viewer-tag {
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 999px;
    display: inline-flex;
    font-size: 0.92em;
    font-weight: 700;
    margin: 0 4px 5px 0;
    padding: 2px 8px;
    text-decoration: none;
  }

  .media-viewer-tag--general {
    color: var(--emalm-tag-general-color, #006ffa);
  }

  .media-viewer-tag--artist {
    color: var(--emalm-tag-artist-color, #ff0000);
  }

  .media-viewer-tag--copyright {
    color: var(--emalm-tag-copyright-color, #b000b0);
  }

  .media-viewer-tag--character {
    color: var(--emalm-tag-character-color, #00a000);
  }

  .media-viewer-tag--meta {
    color: var(--emalm-tag-meta-color, #ff4a00);
  }

  .media-viewer-description-wrap {
    position: relative;
  }

  .media-viewer-description-collapsible {
    cursor: pointer;
    position: relative;
  }

  .media-viewer-description-collapsible.is-collapsed {
    max-height: 5.6em;
    overflow: hidden;
  }

  .media-viewer-description-collapsible.is-collapsed::after {
    background: linear-gradient(rgba(255, 255, 255, 0), var(--card-background-color, var(--emalm-ui-surface-1)));
    bottom: 0;
    content: "";
    height: 2.2em;
    left: 0;
    pointer-events: none;
    position: absolute;
    right: 0;
  }

  .media-viewer-description-toggle {
    background: transparent;
    border: 0;
    color: var(--link-color, var(--emalm-ui-link));
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    margin-top: 6px;
    padding: 0;
  }

  .media-viewer-description-toggle:hover,
  .media-viewer-description-toggle:focus {
    text-decoration: underline;
  }

  .media-viewer-description-toggle.is-hidden {
    display: none;
  }

  .media-viewer-relationships {
    margin: 0 0 14px;
  }

  .media-viewer-relationships .post-notice {
    border-radius: 8px;
    margin: 0 0 10px;
    overflow: hidden;
    padding: 10px 12px;
  }

  .media-viewer-relationships .post-notice:last-child {
    margin-bottom: 0;
  }

  .media-viewer-relationships .post-notice-parent {
    background: color-mix(in srgb, var(--emalm-post-status-has-parent) 14%, var(--card-background-color, var(--emalm-ui-surface-1)) 86%);
    border-color: color-mix(in srgb, var(--emalm-post-status-has-parent) 36%, var(--default-border-color, var(--emalm-ui-border)) 64%);
  }

  .media-viewer-relationships .post-notice-child {
    background: color-mix(in srgb, var(--emalm-post-status-has-children) 14%, var(--card-background-color, var(--emalm-ui-surface-1)) 86%);
    border-color: color-mix(in srgb, var(--emalm-post-status-has-children) 34%, var(--default-border-color, var(--emalm-ui-border)) 66%);
  }

  .media-viewer-relationship-summary {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
  }

  .media-viewer-relationship-summary a {
    white-space: nowrap;
  }

  #has-parent-relationship-preview,
  #has-children-relationship-preview,
  #has-parent-relationship-preview .media-viewer-relationship-gallery,
  #has-children-relationship-preview .media-viewer-relationship-gallery {
    display: inline-block;
    max-width: 100%;
    vertical-align: top;
  }

  #has-parent-relationship-preview .posts-container,
  #has-children-relationship-preview .posts-container {
    align-items: flex-start;
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
  }

  #has-parent-relationship-preview article.post-preview.current-post,
  #has-children-relationship-preview article.post-preview.current-post {
    background: color-mix(in srgb, var(--emalm-ui-surface-2) 60%, black 40%);
    border-radius: 0.25rem;
  }

  .media-viewer-relationship-gallery .post-preview.current-post .post-preview-container {
    background: color-mix(in srgb, var(--emalm-ui-surface-2) 72%, black 28%);
  }

  .media-viewer-relationship-gallery .post-preview {
    padding: 4px;
  }

  .media-viewer-pool-add-form {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
  }

  .media-viewer-pool-add-form input {
    max-width: 120px;
  }

  .media-viewer-moderation-box {
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 8px;
    margin-top: 8px;
    padding: 10px 12px;
  }

  .media-viewer-moderation-box summary {
    cursor: pointer;
  }

  .media-viewer-report-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    max-width: 620px;
  }

  .media-viewer-report-form label {
    display: grid;
    gap: 4px;
  }

  .media-viewer-report-form select,
  .media-viewer-report-form textarea {
    background: var(--form-input-background, var(--card-background-color, var(--emalm-ui-surface-1)));
    border: 1px solid var(--form-input-border-color, var(--default-border-color, var(--emalm-ui-border)));
    border-radius: 4px;
    color: var(--text-color, var(--emalm-ui-text));
    padding: 7px;
    width: 100%;
  }

  .media-viewer-report-form button {
    justify-self: start;
  }

  .media-comments-title {
    font-size: 20px;
    margin: 0 0 14px;
  }

  .media-comment-form-wrap,
  .media-comment {
    display: flex;
    gap: 12px;
  }

  .media-comment-compose {
    margin-top: 14px;
  }

  .media-comment-compose-summary {
    color: var(--link-color, var(--emalm-ui-link));
    cursor: pointer;
    font-weight: 700;
    list-style: none;
    margin-bottom: 10px;
  }

  .media-comment-compose-summary::-webkit-details-marker {
    display: none;
  }

  .media-comment-compose-summary::before {
    content: "+ ";
  }

  .media-comment-compose[open] > .media-comment-compose-summary::before {
    content: "- ";
  }

  .media-comment-form-wrap {
    border-top: 1px solid var(--default-border-color, var(--emalm-ui-border));
    margin-top: 8px;
    padding-top: 14px;
  }

  .media-comment-form {
    flex: 1 1 auto;
    min-width: 0;
  }

  .media-comment-form textarea,
  .media-comment-inline-form textarea {
    background: var(--form-input-background, var(--card-background-color, var(--emalm-ui-surface-1)));
    border: 1px solid var(--form-input-border-color, var(--default-border-color, var(--emalm-ui-border)));
    border-radius: 4px;
    color: var(--text-color, var(--emalm-ui-text));
    min-height: 92px;
    padding: 8px;
    resize: vertical;
    width: 100%;
  }

  .media-comment-submit {
    font-weight: 700;
    margin-top: 8px;
  }

  .media-comment-form-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .media-comment-no-bump {
    align-items: center;
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    display: inline-flex;
    gap: 5px;
    margin: 8px 0 0;
  }

  .media-comment {
    border-bottom: 1px solid var(--default-border-color, var(--emalm-ui-border));
    padding: 12px 0;
  }

  .media-comment.is-reply {
    border-left: 3px solid var(--default-border-color, var(--emalm-ui-border));
    margin-left: 48px;
    padding-left: 12px;
  }

  .media-comment.is-deleted {
    opacity: 0.74;
  }

  .media-comment-vote {
    border-left: 4px solid #777;
    border-radius: 4px;
    margin: 8px 0;
    padding-left: 10px;
  }

  .media-comment-vote.is-upvote {
    background: var(--emalm-ui-success-bg);
    border-left-color: var(--emalm-ui-success-border);
  }

  .media-comment-vote.is-downvote {
    background: var(--emalm-ui-danger-bg);
    border-left-color: var(--emalm-ui-danger-border);
  }

  .media-comment-vote-text {
    font-weight: 700;
  }

  .media-comment-vote.is-upvote .media-comment-vote-text {
    color: #147a32;
  }

  .media-comment-vote.is-downvote .media-comment-vote-text {
    color: #a92525;
  }

  .media-comment-body {
    flex: 1 1 auto;
    min-width: 0;
  }

  .media-comment-meta {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
  }

  .media-comment-badge {
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 999px;
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    display: inline-flex;
    font-size: 12px;
    line-height: 1.2;
    padding: 2px 7px;
  }

  .media-comment-text {
    line-height: 1.45;
    overflow-wrap: anywhere;
  }

  .media-comment-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
  }

  .media-comment-vote-controls,
  .media-comment-vote-form,
  .media-comment-sticky-form {
    align-items: center;
    display: inline-flex;
    gap: 4px;
    margin: 0;
  }

  .media-comment-vote-button,
  .media-comment-sticky-button {
    cursor: pointer;
    line-height: 1;
    padding: 4px 7px;
  }

  .media-comment-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, .2);
    color: #fff;
    font-weight: 900;
  }

  .media-comment-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, .2);
    color: #fff;
    font-weight: 900;
  }

  .media-comment-action summary {
    color: var(--text-color, var(--emalm-ui-text));
    cursor: pointer;
    font-weight: 700;
  }

  .media-comment-inline-form {
    margin-top: 8px;
    min-width: min(520px, 100%);
  }

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

  .media-comment-delete {
    color: var(--emalm-ui-danger-text);
    margin: 0;
    padding: 5px 8px;
  }

  .media-comment[data-is-dimmed="true"] {
    opacity: 0.35;
  }

  .media-comment[data-is-dimmed="true"]:hover,
  .media-comment[data-is-dimmed="true"]:focus-within {
    opacity: 1;
  }

  .media-comment[data-is-thresholded="true"][data-show-thresholded="false"] .media-comment-text {
    display: none;
  }

  .media-comment[data-is-thresholded="false"] .unhide-comment-link,
  .media-comment[data-is-thresholded="true"][data-show-thresholded="true"] .unhide-comment-link {
    display: none;
  }

  .media-comment-unhide {
    background: none;
    border: 0;
    color: var(--link-color, var(--emalm-ui-link));
    margin: 0 0 8px;
    padding: 0;
  }

  .media-comments-empty {
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border-radius: 4px;
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    padding: 12px;
  }

  .media-related-panel {
    background: var(--card-background-color, var(--emalm-ui-surface-1));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-top: 3px solid var(--button-primary-background-color, var(--emalm-ui-accent));
    border-radius: 8px;
    margin: 18px 0;
    overflow: hidden;
    padding: 0;
  }

  .media-related-heading {
    font-size: 16px;
    line-height: 1.25;
    margin: 0;
    overflow-wrap: anywhere;
    padding: 12px 12px 10px;
  }

  .media-related-list {
    display: grid;
    gap: 0;
  }

  .media-related-item {
    border: 0;
    border-bottom: 1px solid #e4e4e4;
    border-radius: 0;
    color: var(--text-color, var(--emalm-ui-text));
    display: block;
    margin: 0;
    padding: 0 0 14px;
    text-decoration: none;
    transition: background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
  }

  a.media-related-item:hover,
  a.media-related-item:focus {
    background: var(--table-row-hover-background, var(--emalm-ui-surface-2));
    box-shadow: 0 0 0 1px var(--button-primary-background-color, var(--emalm-ui-accent));
    color: var(--text-color, var(--emalm-ui-text));
    text-decoration: none;
  }

  .media-related-item.is-current {
    color: var(--text-color, var(--emalm-ui-text));
  }

  .media-related-item:last-child {
    border-bottom: 0;
  }

  .media-related-thumb {
    aspect-ratio: 16 / 9;
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    display: block;
    overflow: hidden;
    width: 100%;
  }

  .media-related-panel-img .media-related-thumb {
    aspect-ratio: 4 / 3;
  }

  .media-related-thumb img,
  .media-related-thumb video,
  .media-related-img,
  .media-related-thumb .list-img,
  .media-related-thumb .list-vid {
    height: 100%;
    margin: 0;
    object-fit: cover;
    width: 100%;
  }

  .media-related-copy {
    display: block;
    margin-top: 8px;
    min-width: 0;
    padding: 0 12px;
  }

  .media-related-title,
  .media-related-meta,
  .media-related-current {
    display: block;
  }

  .media-related-title {
    display: -webkit-box;
    font-weight: 700;
    line-height: 1.25;
    max-height: 2.5em;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .media-related-meta,
  .media-related-current {
    color: var(--muted-text-color, var(--emalm-ui-text-muted));
    font-size: 12px;
    margin-top: 3px;
  }

  .media-related-current {
    background: var(--table-even-row-background, var(--emalm-ui-surface-2));
    border: 1px solid var(--default-border-color, var(--emalm-ui-border));
    border-radius: 999px;
    color: var(--text-color, var(--emalm-ui-text));
    display: inline-block;
    font-weight: 700;
    padding: 2px 7px;
  }

  .media-related-more {
    border-top: 1px solid var(--default-border-color, var(--emalm-ui-border));
    color: var(--text-color, var(--emalm-ui-text));
    display: block;
    font-weight: 700;
    margin-top: 0;
    padding: 10px 12px 12px;
  }

  .main-img,
  .main-vid {
    display: block;
    image-orientation: from-image;
    margin: 0 0 14px;
    max-width: 100%;
    height: auto;
  }

  .main-img {
    width: 100%;
  }

  .pixiv-illustration-page > .main-img {
    height: auto;
    max-width: 100%;
    width: auto;
  }

  .image-viewer-stack.note-container {
    display: block;
    margin: 0 0 16px;
    max-width: 100%;
    width: 100%;
  }

  .image-viewer-stack.note-container > picture,
  .image-viewer-stack.note-container > picture > img,
  .image-viewer-stack.note-container > img,
  .image-viewer-stack.note-container > video {
    display: block;
    margin: 0;
    max-width: 100%;
    width: auto;
    height: auto;
  }

  body.emalm-viewer-fullsize .main-img,
  body.emalm-viewer-original-mode .main-img {
    max-width: none;
    width: auto;
  }

  body.emalm-viewer-fullsize .image-viewer-stack.note-container,
  body.emalm-viewer-original-mode .image-viewer-stack.note-container {
    display: inline-block;
    margin-left: 0;
    margin-right: 0;
    max-width: none;
    overflow: visible;
    width: auto;
    width: fit-content;
  }

  body.emalm-viewer-fullsize .image-viewer-stack.note-container > picture,
  body.emalm-viewer-fullsize .image-viewer-stack.note-container > picture > img,
  body.emalm-viewer-fullsize .image-viewer-stack.note-container > img,
  body.emalm-viewer-fullsize .image-viewer-stack.note-container > video,
  body.emalm-viewer-original-mode .image-viewer-stack.note-container > picture,
  body.emalm-viewer-original-mode .image-viewer-stack.note-container > picture > img,
  body.emalm-viewer-original-mode .image-viewer-stack.note-container > img,
  body.emalm-viewer-original-mode .image-viewer-stack.note-container > video {
    max-width: none;
    width: auto;
    height: auto;
  }

  body.emalm-viewer-fullsize .image-viewer-stack,
  body.emalm-viewer-original-mode .image-viewer-stack {
    overflow: auto;
  }

  @media (max-width: 640px) {
    .media-viewer-header,
    .media-comments {
      padding: 12px;
    }

    .media-viewer-title {
      font-size: 20px;
    }

    .media-comment.is-reply {
      margin-left: 20px;
    }
  }