/* VMESTA release polish: crop grid, space menu, poll voters and discussion poll. */
html:root body .vmesta-image-editor-crop {
  border: 2px solid #42e889 !important;
  outline: 9999px solid rgb(2 6 23 / .66) !important;
  background-image:
    linear-gradient(90deg, transparent 0 33%, rgb(255 255 255 / .92) 33% calc(33% + 1px), transparent calc(33% + 1px) 66%, rgb(255 255 255 / .92) 66% calc(66% + 1px), transparent calc(66% + 1px)),
    linear-gradient(0deg, transparent 0 33%, rgb(255 255 255 / .92) 33% calc(33% + 1px), transparent calc(33% + 1px) 66%, rgb(255 255 255 / .92) 66% calc(66% + 1px), transparent calc(66% + 1px)) !important;
  box-shadow: 0 0 0 1px #071425, 0 0 0 3px rgb(255 255 255 / .72), 0 0 1.4rem rgb(66 232 137 / .38) !important;
}

html:root body .vmesta-image-editor-crop::before,
html:root body .vmesta-image-editor-crop::after {
  content: "" !important;
  position: absolute !important;
  width: .75rem !important;
  height: .75rem !important;
  background: #20a957 !important;
  border: 2px solid #fff !important;
  border-radius: .2rem !important;
  box-shadow: 0 .15rem .55rem rgb(2 6 23 / .5) !important;
}

html:root body .vmesta-image-editor-crop::before { inset: -.42rem auto auto -.42rem !important; }
html:root body .vmesta-image-editor-crop::after { inset: auto -.42rem -.42rem auto !important; }

html:root body.space-route #profile-avatar-card > #space-safety-menu {
  top: 1rem !important;
  left: -2.8rem !important;
  right: auto !important;
  transform: none !important;
}

html:root body.space-route #profile-avatar-card > #space-safety-menu > .profile-safety-trigger {
  width: 2.25rem !important;
  height: 2.9rem !important;
  border-radius: .8rem 0 0 .8rem !important;
  box-shadow: 0 .55rem 1.2rem rgb(15 23 42 / .16) !important;
}

html:root body.space-route #profile-avatar-card > #space-safety-menu > .profile-safety-dropdown {
  top: -.3rem !important;
  left: calc(100% + .7rem) !important;
}

html:root body .space-poll-voters-backdrop {
  padding: 1rem;
  background: rgb(12 20 35 / .68);
  backdrop-filter: blur(12px) saturate(.8);
}

html:root body .space-poll-voters-backdrop > .space-poll-voters-dialog {
  display: flex;
  width: min(40rem, calc(100vw - 1.5rem));
  max-height: min(44rem, 88vh);
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / .62);
  border-radius: 1.45rem;
  background: #f7faff;
  box-shadow: 0 2rem 6rem rgb(5 16 35 / .42);
}

html:root body .space-poll-voters-dialog > header {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) 2.5rem;
  align-items: center;
  gap: .8rem;
  padding: 1.15rem 1.2rem .9rem;
  border: 0;
  background: #fff;
}

html:root body .space-poll-voters-header-icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 1rem;
  background: linear-gradient(145deg, #d9f4e4, #edf7ff);
  color: #168447;
  box-shadow: inset 0 0 0 1px rgb(22 132 71 / .08);
}

html:root body .space-poll-voters-header-icon svg {
  width: 1.45rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html:root body .space-poll-voters-dialog > header > div { min-width: 0; }
html:root body .space-poll-voters-dialog > header > div > span { display: block; color: #219653; font-size: .56rem; font-weight: 950; letter-spacing: .14em; }
html:root body .space-poll-voters-dialog h2 { margin: .14rem 0 0; color: #153f79; font-size: 1.16rem; line-height: 1.15; }
html:root body .space-poll-voters-dialog > header p { margin: .2rem 0 0; color: #7890ae; font-size: .67rem; font-weight: 750; }

html:root body .space-poll-voters-dialog > header > button {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 0;
  border-radius: .82rem;
  background: #e8f3ed;
  color: #287a59;
  transition: transform .18s ease, background .18s ease;
}

html:root body .space-poll-voters-dialog > header > button:hover { transform: rotate(4deg); background: #d7ede1; }
html:root body .space-poll-voters-dialog > header > button svg { width: 1.15rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

html:root body .space-poll-voters-toolbar {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .2rem 1.2rem 1rem;
  background: #fff;
}

html:root body .space-poll-voters-toolbar > label {
  display: grid;
  min-width: 0;
  height: 2.75rem;
  flex: 1;
  grid-template-columns: 1.15rem minmax(0, 1fr) 1.75rem;
  align-items: center;
  gap: .55rem;
  padding: 0 .65rem;
  border: 1px solid #dbe6f2;
  border-radius: .9rem;
  background: #f5f8fc;
  color: #7890ae;
  transition: border-color .18s ease, box-shadow .18s ease;
}

html:root body .space-poll-voters-toolbar > label:focus-within { border-color: #5abd85; box-shadow: 0 0 0 3px rgb(33 150 83 / .1); }
html:root body .space-poll-voters-toolbar svg { width: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }
html:root body .space-poll-voters-toolbar input { min-width: 0; border: 0; outline: 0; background: transparent; color: #173f76; font-size: .75rem; font-weight: 750; }
html:root body .space-poll-voters-toolbar input::placeholder { color: #8aa0ba; }

html:root body .space-poll-voters-toolbar label > button {
  display: grid;
  width: 1.7rem;
  height: 1.7rem;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #dfeaf4;
  color: #59738f;
  font-size: 1rem;
}

html:root body #space-poll-voters-result-count {
  display: grid;
  min-width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: .8rem;
  background: #dff1e7;
  color: #148044;
  font-size: .72rem;
  font-weight: 950;
}

html:root body .space-poll-voters-list {
  display: grid;
  gap: .8rem;
  max-height: none;
  overflow: auto;
  padding: 1rem 1.2rem 1.2rem;
  scrollbar-gutter: stable;
}

html:root body .space-poll-voters-list > .space-poll-voters-group {
  overflow: hidden;
  border: 1px solid #dce7f2;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 .35rem 1rem rgb(37 68 109 / .05);
}

html:root body .space-poll-voters-group > header {
  display: grid;
  grid-template-columns: .65rem minmax(0, 1fr) auto;
  align-items: center;
  gap: .55rem;
  padding: .72rem .82rem;
  border-bottom: 1px solid #e8eef5;
  background: #edf4fb;
  color: #174a8b;
}

html:root body .space-poll-voters-choice-dot { width: .55rem; height: .55rem; border-radius: 50%; background: #52b97f; box-shadow: 0 0 0 3px rgb(82 185 127 / .13); }
html:root body .space-poll-voters-group > header strong { overflow: hidden; font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
html:root body .space-poll-voters-group > header b { display: grid; min-width: 1.65rem; height: 1.65rem; place-items: center; border-radius: .55rem; background: #fff; color: #168447; font-size: .66rem; }

html:root body .space-poll-voters-group > div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; padding: .55rem; }

html:root body .space-poll-voters-group .space-poll-voter {
  display: grid;
  min-width: 0;
  grid-template-columns: 2.45rem minmax(0, 1fr) 1rem;
  align-items: center;
  gap: .62rem;
  padding: .5rem;
  border: 1px solid transparent;
  border-radius: .82rem;
  background: #f9fbfe;
  color: #174a8b;
  text-align: left;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

html:root body .space-poll-voters-group .space-poll-voter:hover { transform: translateY(-1px); border-color: #c9e6d6; background: #f1faf5; }
html:root body .space-poll-voters-list img,
html:root body .space-poll-voters-list .space-poll-voter > i { display: grid; width: 2.45rem; height: 2.45rem; place-items: center; object-fit: cover; border-radius: .75rem; background: #d9ede2; font-style: normal; }
html:root body .space-poll-voter > span { display: grid; min-width: 0; gap: .08rem; }
html:root body .space-poll-voter > span b { overflow: hidden; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
html:root body .space-poll-voter > span small { overflow: hidden; color: #7890ae; font-size: .56rem; text-overflow: ellipsis; white-space: nowrap; }
html:root body .space-poll-voter > svg { width: .9rem; fill: none; stroke: #80a0bd; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html:root body .space-poll-voters-option-empty { grid-column: 1 / -1; margin: .3rem; padding: .6rem; color: #7890ae; font-size: .66rem; text-align: center; }

html:root body .space-poll-voters-empty { display: grid; place-items: center; gap: .25rem; padding: 2.5rem 1rem; color: #7890ae; text-align: center; }
html:root body .space-poll-voters-empty.hidden { display: none; }
html:root body .space-poll-voters-empty svg { width: 2.3rem; fill: none; stroke: #64ac84; stroke-width: 1.6; stroke-linecap: round; }
html:root body .space-poll-voters-empty strong { color: #174a8b; font-size: .85rem; }
html:root body .space-poll-voters-empty span { font-size: .65rem; }

html:root body .viewer-post-poll:not(.hidden) { display: block; margin: .85rem 0 1rem; }
html:root body .viewer-post-poll .space-post-poll { margin: 0; }
html:root body [onclick*="pinSpacePostByNativeId"][aria-busy="true"] { opacity: .55; pointer-events: none; }

.dark .space-poll-voters-backdrop > .space-poll-voters-dialog { border-color: rgb(255 255 255 / .08); background: #101927; }
.dark .space-poll-voters-dialog > header,
.dark .space-poll-voters-toolbar { background: #111c2b; }
.dark .space-poll-voters-dialog h2,
.dark .space-poll-voters-toolbar input,
.dark .space-poll-voters-empty strong { color: #e8f1ff; }
.dark .space-poll-voters-toolbar > label { border-color: #2b3b4f; background: #182537; }
.dark .space-poll-voters-list > .space-poll-voters-group { border-color: #29394c; background: #152133; box-shadow: none; }
.dark .space-poll-voters-group > header { border-color: #2a3b50; background: #1b2a3e; color: #d7e7ff; }
.dark .space-poll-voters-group > header b { background: #132034; }
.dark .space-poll-voters-group .space-poll-voter { background: #192638; color: #e1ecfa; }
.dark .space-poll-voters-group .space-poll-voter:hover { border-color: #397658; background: #1b302b; }

@media (max-width: 700px) {
  html:root body.space-route #profile-avatar-card > #space-safety-menu { top: .55rem !important; right: .55rem !important; left: auto !important; }
  html:root body.space-route #profile-avatar-card > #space-safety-menu > .profile-safety-trigger { width: 2.2rem !important; height: 2.2rem !important; border-radius: .72rem !important; }
  html:root body.space-route #profile-avatar-card > #space-safety-menu > .profile-safety-dropdown { top: calc(100% + .45rem) !important; right: 0 !important; left: auto !important; }
  html:root body .space-poll-voters-backdrop { padding: .55rem; }
  html:root body .space-poll-voters-backdrop > .space-poll-voters-dialog { width: 100%; max-height: 92vh; border-radius: 1.15rem; }
  html:root body .space-poll-voters-dialog > header { grid-template-columns: 2.5rem minmax(0, 1fr) 2.25rem; padding: .9rem; }
  html:root body .space-poll-voters-header-icon { width: 2.5rem; height: 2.5rem; border-radius: .8rem; }
  html:root body .space-poll-voters-toolbar { padding: .1rem .9rem .8rem; }
  html:root body .space-poll-voters-list { padding: .75rem .9rem 1rem; }
  html:root body .space-poll-voters-group > div { grid-template-columns: 1fr; }
}

/* Stable video-note poster and an explicit upload/loading indicator. */
html:root body .messenger-video-note.has-media-frame:not(.is-uploading):not(.is-downloading) .messenger-media-loading-shimmer {
  opacity: 0 !important;
  visibility: hidden !important;
  animation: none !important;
}

html:root body .messenger-video-note.has-media-frame:not(.is-uploading):not(.is-downloading) {
  background: color-mix(in srgb, var(--msg-accent, #219653) 12%, var(--msg-panel, #e7f3ec)) !important;
}

html:root body .messenger-video-note.is-media-loading .messenger-media-buffer-indicator > svg { display: none; }

html:root body .messenger-video-note.is-media-loading .messenger-media-buffer-indicator::before {
  content: "";
  width: 1.15rem;
  height: 1.15rem;
  border: .16rem solid rgb(255 255 255 / .28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: messenger-video-note-loader-spin .72s linear infinite;
}

html:root body .messenger-video-note.is-uploading .messenger-media-buffer-indicator {
  opacity: 0 !important;
  visibility: hidden !important;
}

html:root body .messenger-video-note > .messenger-video-transfer-button {
  z-index: 18 !important;
  overflow: visible;
  opacity: 1 !important;
  isolation: isolate;
}

html:root body .messenger-video-transfer-button > .messenger-icon {
  position: relative;
  z-index: 2;
}

html:root body .messenger-video-note.is-uploading .messenger-video-transfer-button {
  background: rgb(8 24 38 / .7);
  box-shadow: 0 .5rem 1.4rem rgb(2 6 23 / .3);
}

html:root body .messenger-video-transfer-button .messenger-media-transfer-ring {
  position: absolute;
  z-index: 1;
  inset: -.42rem;
  display: block;
  border-radius: 50%;
  background: conic-gradient(var(--msg-accent, #21a35b) var(--media-transfer-progress, 0%), rgb(255 255 255 / .2) 0);
  box-shadow: 0 0 0 .12rem rgb(255 255 255 / .18), 0 0 1rem color-mix(in srgb, var(--msg-accent, #21a35b) 30%, transparent);
  pointer-events: none;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - .18rem), #000 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - .18rem), #000 0);
}

html:root body .messenger-video-note.is-uploading .messenger-video-transfer-button::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: -.22rem;
  border: .14rem solid transparent;
  border-top-color: #fff;
  border-right-color: rgb(255 255 255 / .55);
  border-radius: 50%;
  animation: messenger-video-note-loader-spin .72s linear infinite;
  pointer-events: none;
}

html:root body .messenger-media-transfer-value {
  position: absolute;
  z-index: 4;
  top: calc(100% + .42rem);
  left: 50%;
  min-width: 2.25rem;
  padding: .16rem .34rem;
  border: 1px solid rgb(255 255 255 / .2);
  border-radius: 999px;
  background: rgb(8 20 35 / .78);
  color: #fff;
  font-size: .5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
}

@keyframes messenger-video-note-loader-spin { to { transform: rotate(1turn); } }

@media (prefers-reduced-motion: reduce) {
  html:root body .messenger-video-note.is-media-loading .messenger-media-buffer-indicator::before,
  html:root body .messenger-video-note.is-uploading .messenger-video-transfer-button::after {
    animation-duration: 1.8s;
  }
}
