.uploaded-media .thumb .media-card-toolbar {
  position: absolute;
  z-index: 5;
  top: 0;
  inset-inline: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  height: 25px;
  padding: 0 2px;
  pointer-events: none;
}
.uploaded-media .thumb .media-card-toolbar.is-open {
  background: #101923;
  border-bottom: 1px solid rgba(185, 204, 225, .42);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .44);
}
.media-card-toolbar .media-more-button,
.media-card-menu button {
  flex: 1 1 0;
  min-width: 0;
  height: 21px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #edf4f9;
  background: #2a3746;
  cursor: pointer;
  pointer-events: auto;
  transition: filter .16s ease, background .16s ease, border-color .16s ease;
}
.media-card-toolbar .media-more-button { flex: 0 0 23px; background: #172632; border-color: #72899b; box-shadow: 0 2px 7px rgba(0,0,0,.38); }
.media-card-toolbar.is-open .media-more-button { background: #34576b; border-color: #91c1d6; }
.media-card-menu { display: flex; flex: 1 1 0; align-items: center; gap: 2px; min-width: 0; pointer-events: auto; }
.media-card-menu[hidden] { display: none !important; }
.uploaded-media .thumb .media-quick-add {
  position: absolute;
  z-index: 5;
  inset-inline-end: 4px;
  bottom: 4px;
  width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #49c58c;
  border-radius: 7px;
  color: #e8fff4;
  background: #176449;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
  font: 700 16px/1 Arial, sans-serif;
  cursor: pointer;
}
.uploaded-media .thumb .media-quick-add:hover { background: #228a62; }
.media-card-toolbar button:hover { filter: brightness(1.25); }
.media-card-toolbar button:focus-visible,
.uploaded-media .thumb .media-quick-add:focus-visible { outline: 2px solid #f4faff; outline-offset: -1px; }
.media-card-toolbar .media-trim-button { color: #ffe8c5; background: #5b4425; }
.media-card-toolbar .media-crop-button { color: #d9f5ff; background: #285165; }
.media-card-toolbar .media-remove-button { color: #fff0f2; background: #8b3044; border-color: #b8556a; }
.media-card-toolbar .media-remove-button:hover { background: #ba405b; }
.media-card-menu button.is-locked,
.media-card-menu button.is-locked:hover { border-color: #56616c; color: #9da8b3; background: #35404a; filter: none; cursor: not-allowed; }
.media-tool-lock-notice {
  position: fixed;
  z-index: 10020;
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: 6px 10px;
  border: 1px solid #697480;
  border-radius: 8px;
  color: #f3f5f8;
  background: #222b36;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  pointer-events: none;
}
dialog .media-tool-lock-notice { position: absolute; }
.media-tool-lock-notice::after {
  position: absolute;
  left: calc(50% - 4px);
  width: 8px;
  height: 8px;
  border-inline-end: 1px solid #697480;
  border-bottom: 1px solid #697480;
  background: #222b36;
  content: '';
}
.media-tool-lock-notice[data-side="above"]::after { bottom: -5px; transform: rotate(45deg); }
.media-tool-lock-notice[data-side="below"]::after { top: -5px; transform: rotate(225deg); }
.media-card-toolbar .media-more-button svg circle { fill: currentColor; stroke: none; }
.media-card-toolbar svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.media-preview-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: min(720px, calc(100dvh - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #343744;
  border-radius: 18px;
  color: #f4f4f9;
  background: #13151d;
  box-shadow: 0 26px 90px rgba(0, 0, 0, .75);
}
.media-preview-dialog::backdrop {
  background: rgba(4, 5, 10, .76);
  backdrop-filter: blur(6px);
}
.media-preview-dialog [hidden] { display: none !important; }
.media-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 13px 16px;
  border-bottom: 1px solid #2a2d38;
}
.media-preview-heading { min-width: 0; }
.media-preview-heading > span { color: #a28bff; font-size: 10px; font-weight: 700; }
.media-preview-heading h2 {
  overflow: hidden;
  margin: 3px 0 0;
  color: #f6f5ff;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-preview-close {
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #3a3d4a;
  border-radius: 9px;
  color: #cacbd6;
  background: #20232e;
  cursor: pointer;
}
.media-preview-close:hover { border-color: #9582f4; color: #fff; background: #3a325e; }
.media-preview-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.media-preview-stage {
  position: relative;
  min-height: 230px;
  height: min(50vh, 370px);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #202536, #0a0d15 70%);
}
.media-preview-stage video,
.media-preview-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.media-preview-stage > img {
  position: absolute;
  inset: 0;
  min-width: 0;
  min-height: 0;
}
.media-preview-audio-art {
  width: min(290px, 85%);
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}
.media-preview-audio-art span {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(104, 225, 217, .38);
  border-radius: 28px;
  color: #a9eee9;
  background: linear-gradient(145deg, #17343d, #1e5059);
  box-shadow: 0 16px 42px rgba(10, 79, 82, .3);
  font-size: 43px;
}
.media-preview-audio-art b { max-width: 100%; overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.media-preview-failure { padding: 16px; color: #f5c3c8; font-size: 12px; text-align: center; }
.media-preview-transport {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border-top: 1px solid #2a2d38;
  border-bottom: 1px solid #2a2d38;
  direction: ltr;
}
.media-preview-transport button {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #44485b;
  border-radius: 9px;
  color: #e9e7ff;
  background: #292b3a;
  cursor: pointer;
}
.media-preview-transport button:hover { border-color: #9d8afa; background: #44377a; }
.media-preview-transport button svg { width: 16px; height: 16px; fill: currentColor; }
.media-preview-transport #mediaPreviewMute svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.media-preview-pause-glyph,
.media-preview-dialog.is-playing .media-preview-play-glyph { display: none; }
.media-preview-dialog.is-playing .media-preview-pause-glyph { display: block; }
.media-preview-time { min-width: 37px; color: #d8d8e1; font: 700 10px/1 ui-monospace, Consolas, monospace; text-align: center; }
.media-preview-transport input[type="range"] { min-width: 0; accent-color: #9177fa; cursor: pointer; }
#mediaPreviewSeek { flex: 1 1 auto; }
#mediaPreviewVolume { width: 68px; flex: 0 0 68px; }
.media-preview-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 14px; }
.media-preview-actions button {
  min-height: 33px;
  padding: 6px 12px;
  border: 1px solid #404453;
  border-radius: 9px;
  color: #e3e3ed;
  background: #222530;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}
.media-preview-actions button:last-child { border-color: #419c76; color: #f4fff9; background: #157750; }
.media-preview-actions button:hover { filter: brightness(1.16); }
.media-preview-actions button.is-locked,
.media-preview-actions button.is-locked:hover { border-color: #535b68; color: #9da5b0; background: #303742; filter: none; cursor: not-allowed; }
.media-preview-actions button span { margin-inline-end: 5px; font: 700 17px/1 Arial, sans-serif; vertical-align: -1px; }
@media (max-width: 540px) {
  .media-preview-stage { height: min(43vh, 300px); min-height: 170px; }
  .media-preview-header { padding: 10px 12px; }
  .media-preview-transport { gap: 5px; padding: 9px 10px; }
  #mediaPreviewVolume { width: 42px; flex-basis: 42px; }
  .media-preview-actions { padding: 10px 12px; }
}
