.image-share-open { overflow: hidden; }
.image-share-open .left-float-bar {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.image-share-modal {
  position: fixed;
  inset: 0;
  z-index: 10020;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 12, 13, 0.58);
  backdrop-filter: blur(8px);
}

.image-share-modal[hidden] { display: none; }
.image-share-dialog [hidden] { display: none !important; }

.image-share-dialog {
  position: relative;
  width: min(900px, 96vw);
  max-height: min(760px, 94dvh);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 16px;
  background: #f7f7f8;
  color: #1d1d1f;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.image-share-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px 14px 22px;
  border-bottom: 1px solid #dedee1;
  background: #fff;
}

.image-share-header h2 { margin: 0; font-size: 18px; line-height: 1.25; letter-spacing: 0; }
.image-share-header span { display: block; margin-top: 3px; color: #77777c; font-size: 12px; letter-spacing: 0; }

.image-share-form {
  min-height: 440px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  overflow: hidden;
}

.image-share-compose {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  border-right: 1px solid #dedee1;
  background: #f1f1f3;
}

.image-share-field,
.image-share-output { display: grid; gap: 7px; color: #56565b; font-size: 12px; font-weight: 650; letter-spacing: 0; }

.image-share-field input,
.image-share-output input,
.image-share-output textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cfcfd3;
  border-radius: 6px;
  outline: none;
  background: #fff;
  color: #202024;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.image-share-field input { height: 42px; padding: 0 12px; text-transform: uppercase; }
.image-share-output input { height: 42px; padding: 0 12px; }
.image-share-output textarea { min-height: 106px; resize: none; padding: 10px 12px; line-height: 1.55; }
.image-share-field input:focus,
.image-share-output input:focus,
.image-share-output textarea:focus { border-color: #7f7f85; box-shadow: 0 0 0 3px rgba(80, 80, 86, 0.12); }

.image-share-dropzone {
  min-height: 178px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 20px;
  border: 1px dashed #b9b9be;
  border-radius: 8px;
  background: #fff;
  color: #3f3f44;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 140ms cubic-bezier(.23, 1, .32, 1);
}

.image-share-dropzone:hover,
.image-share-dropzone.is-dragging { border-color: #8d7500; background: #fffbed; }
.image-share-dropzone:active { transform: scale(.985); }
.image-share-dropzone svg { width: 28px; height: 28px; fill: none; stroke: #846b00; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.image-share-dropzone strong { font-size: 14px; letter-spacing: 0; }
.image-share-dropzone span { color: #88888e; font-size: 10px; letter-spacing: 0; }

.image-share-library { min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 20px; overflow: hidden; }
.image-share-library-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 12px; }
.image-share-library-head strong { font-size: 14px; letter-spacing: 0; }
.image-share-library-head span { color: #77777c; font-size: 12px; }
.image-share-empty { display: grid; place-items: center; min-height: 300px; color: #99999e; font-size: 13px; }
.image-share-empty[hidden] { display: none; }

.image-share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 2px 4px 14px 2px;
}

.image-share-grid.is-busy { pointer-events: none; opacity: .72; }
.image-share-item {
  position: relative;
  aspect-ratio: 1 / 1;
  min-width: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #e8e8eb;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms cubic-bezier(.23, 1, .32, 1);
}

.image-share-item:hover { transform: scale(1.015); }
.image-share-item.is-cover { border-color: #e0b500; }
.image-share-item img { width: 100%; height: 100%; display: block; object-fit: cover; }
.image-share-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, .16);
  border-radius: 6px;
  background: rgba(255, 255, 255, .94);
  color: #c5343b;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms cubic-bezier(.23, 1, .32, 1);
}
.image-share-item:hover .image-share-remove,
.image-share-remove:focus-visible { opacity: 1; }
.image-share-remove:active { transform: scale(.94); }
.image-share-remove svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.image-share-cover-badge {
  position: absolute;
  left: 7px;
  bottom: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 5px;
  background: rgba(25, 25, 27, .78);
  color: #fff;
  backdrop-filter: blur(6px);
}
.image-share-item.is-cover .image-share-cover-badge { background: #ffd43b; color: #2c2600; }
.image-share-cover-badge svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.image-share-item.is-cover .image-share-cover-badge svg { fill: currentColor; }
.image-share-cover-badge b { font-size: 10px; font-weight: 700; letter-spacing: 0; }

.image-share-footer {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 18px 12px 22px;
  border-top: 1px solid #dedee1;
  background: #fff;
}

.image-share-status { min-width: 0; color: #6d6d72; font-size: 12px; letter-spacing: 0; }
.image-share-status.is-error { color: #b4232a; }
.image-share-status.is-success { color: #27734a; }
.image-share-status.is-progress { color: #715d00; }

.image-share-primary,
.image-share-secondary {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms cubic-bezier(.23, 1, .32, 1), opacity 140ms ease;
}
.image-share-primary { border: 1px solid #d0a900; background: #ffd43b; color: #272100; }
.image-share-primary:hover { background: #ffcc14; }
.image-share-secondary { border: 1px solid #ccccd1; background: #fff; color: #343438; }
.image-share-secondary:hover { background: #f0f0f2; }
.image-share-cancel { color: #b4232a; }
.image-share-cancel:hover { border-color: #e0a1a5; background: #fff3f3; }
.image-share-primary:active,
.image-share-secondary:active { transform: scale(.97); }
.image-share-primary:disabled,
.image-share-secondary:disabled { cursor: default; opacity: .42; transform: none; }
.image-share-primary[hidden] { display: none; }
.image-share-primary svg,
.image-share-secondary svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.image-share-result {
  min-height: 440px;
  align-content: center;
  gap: 18px;
  padding: 34px clamp(24px, 8vw, 110px);
  overflow: auto;
}
.image-share-result:not([hidden]) { display: grid; }
.image-share-result-mark { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 8px; background: #ffd43b; color: #292300; }
.image-share-result-mark svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.image-share-result > div:nth-child(2) span { color: #77777c; font-size: 12px; }
.image-share-result h3 { margin: 3px 0 0; font-size: 22px; letter-spacing: 0; }
.image-share-result-preview {
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #dedee1;
  border-radius: 8px;
  background: #fff;
}
.image-share-result-preview img { display: block; max-width: 150px; max-height: 150px; width: auto; height: auto; object-fit: contain; }
.image-share-result-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 4px; }

html.theme-dark .image-share-dialog { border-color: #46464b; background: #202022; color: #f1f1f3; }
html.theme-dark .image-share-header,
html.theme-dark .image-share-footer { border-color: #424247; background: #272729; }
html.theme-dark .image-share-header span,
html.theme-dark .image-share-library-head span,
html.theme-dark .image-share-result > div:nth-child(2) span { color: #a6a6ab; }
html.theme-dark .image-share-compose { border-color: #424247; background: #242426; }
html.theme-dark .image-share-field,
html.theme-dark .image-share-output { color: #c2c2c6; }
html.theme-dark .image-share-field input,
html.theme-dark .image-share-output input,
html.theme-dark .image-share-output textarea { border-color: #4b4b50; background: #18181a; color: #f3f3f5; }
html.theme-dark .image-share-dropzone { border-color: #55555b; background: #2b2b2e; color: #ededf0; }
html.theme-dark .image-share-dropzone:hover,
html.theme-dark .image-share-dropzone.is-dragging { border-color: #c7a500; background: #34301f; }
html.theme-dark .image-share-item { background: #303033; }
html.theme-dark .image-share-secondary { border-color: #4b4b50; background: #303033; color: #ededf0; }
html.theme-dark .image-share-secondary:hover { background: #3b3b3f; }
html.theme-dark .image-share-result-preview { border-color: #4b4b50; background: #18181a; }

@media (max-width: 680px) {
  .image-share-modal { padding: 8px; }
  .image-share-dialog { width: 100%; max-height: 96dvh; border-radius: 14px; }
  .image-share-form { grid-template-columns: 1fr; overflow: auto; }
  .image-share-compose { border-right: 0; border-bottom: 1px solid #dedee1; }
  .image-share-dropzone { min-height: 112px; }
  .image-share-library { min-height: 310px; overflow: visible; }
  .image-share-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  .image-share-footer { align-items: flex-start; flex-direction: column; }
  .image-share-footer .image-share-primary { width: 100%; }
  .image-share-result { min-height: 0; padding: 26px 18px; }
  .image-share-result-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .image-share-result-actions > * { min-width: 0; padding-inline: 10px; }
  .image-share-result-actions .image-share-primary { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .image-share-dropzone,
  .image-share-item,
  .image-share-primary,
  .image-share-secondary { transition: none; }
}
