/* Sharing cards follow the site's light/dark palette. Native checkboxes and text
   communicate selection in addition to the highlighted card border. */
.favorites-share, #sharedFavoritesContent {
  --share-accent: #9db1ff;
  --share-on-accent: #111827;
  color: var(--text, #f7f8fb);
}
html[data-theme="light"] .favorites-share,
html[data-theme="light"] #sharedFavoritesContent {
  --share-accent: #3851ae;
  --share-on-accent: #fff;
}
.favorites-share { margin: 24px 0 28px; }
.share-launch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  border: 1px solid var(--line, #394356);
  border-radius: 18px;
  background: var(--panel, #141821);
  padding: 22px 24px;
}
.share-launch h2 { font-size: 1.1rem; margin: 0 0 7px; }
.share-launch p { color: var(--muted, #a8b2c3); margin: 0; font-size: .9rem; line-height: 1.7; }
.share-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line, #394356);
  border-radius: 10px;
  background: var(--panel-2, #1a1f2a);
  color: var(--text, #f7f8fb);
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
  text-align: center;
  white-space: normal;
  cursor: pointer;
}
.share-button:hover:not(:disabled) { background: var(--card-hover, #242d40); }
.share-button.share-primary { background: var(--share-accent); border-color: var(--share-accent); color: var(--share-on-accent); }
.share-button.share-primary:hover:not(:disabled) {
  background: var(--share-accent);
  color: var(--share-on-accent);
  filter: brightness(1.08);
}
.share-button:disabled { opacity: .48; cursor: not-allowed; }
.share-launch-button { padding: 13px 24px; font-size: 1rem; flex-shrink: 0; }
.favorites-share :focus-visible, #sharedFavoritesContent :focus-visible {
  outline: 3px solid var(--share-accent);
  outline-offset: 3px;
}
.share-panel {
  padding: 24px;
  margin-top: 14px;
  border: 1px solid var(--line, #394356);
  border-radius: 18px;
  background: var(--panel, #141821);
}
.share-panel[hidden], .share-work-card[hidden], .share-poster [hidden], .share-generated-image[hidden] { display: none; }
.share-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.share-panel h3 { font-size: 1.2rem; margin: 0; line-height: 1.6; }
.share-panel h3:focus { outline: none; }
.share-help { color: var(--muted, #a8b2c3); font-size: .9rem; line-height: 1.8; margin: 10px 0 18px; }
.share-search, .share-link-field { display: grid; gap: 8px; font-size: .875rem; font-weight: 700; margin: 20px 0; }
.share-search input, .share-link-field input {
  width: 100%; min-width: 0; min-height: 46px; padding: 11px 14px;
  border: 1px solid var(--line, #394356); border-radius: 10px;
  color: var(--text, #f7f8fb); background: var(--input-bg, #0f131b); font: inherit;
  font-size: 1rem;
}
.share-search input::placeholder { color: var(--muted, #a8b2c3); font-weight: 400; }
.share-toolbar, .share-toolbar-actions, .share-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.share-toolbar { justify-content: space-between; margin: 16px 0 10px; }
.share-selection-count { margin: 0; font-weight: 800; font-size: .95rem; }
.share-match-count { color: var(--muted, #a8b2c3); font-size: .8rem; margin: 8px 0; }
.share-picker-pane, .share-preview-pane {
  max-height: min(56vh, 560px);
  min-height: 140px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border: 1px solid var(--line, #394356);
  border-radius: 12px;
  background: var(--nested-bg, #0e1219);
  padding: 12px;
}
.share-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(145px, 1fr)); align-items: stretch; gap: 14px; }
.share-work-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--line, #394356);
  border-radius: 12px;
  background: var(--panel, #141821);
}
.share-work-card[data-selected="true"] { border-color: var(--share-accent); }
.share-choice-card { cursor: pointer; }
.share-choice-card:focus-within { outline: 2px solid var(--share-accent); outline-offset: 2px; }
.share-choice-card:hover { background: var(--card-hover, #171c26); }
.share-poster { width: 100%; aspect-ratio: 2 / 3; position: relative; overflow: hidden; background: var(--panel-2, #1a1f2a); flex: none; }
.share-poster img { width: 100%; height: 100%; object-fit: contain; display: block; }
.share-poster-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted, #a8b2c3); font-size: .8rem; }
.share-work-title { display: block; color: var(--text, #f7f8fb); margin: 0; padding: 11px 12px; font-size: .875rem; font-weight: 700; line-height: 1.65; overflow-wrap: anywhere; }
.share-card-choice {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  min-height: 46px; margin-top: auto; border-top: 1px solid var(--line, #394356);
  color: var(--text, #f7f8fb); font-size: .8rem; font-weight: 700; cursor: pointer;
}
.share-card-choice input, .share-consent input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--share-accent); cursor: pointer; }
.share-card-choice input:disabled { cursor: not-allowed; }
.share-actions { margin-top: 18px; }
.share-status { font-size: .9rem; line-height: 1.7; margin: 12px 0; overflow-wrap: anywhere; }
.share-status:empty { display: none; }
.share-preview-pane { margin: 20px 0 24px; }
.share-preview-grid { margin: 0; }
.share-consent { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line, #394356); border-radius: 12px; background: var(--panel-2, #1a1f2a); font-weight: 700; line-height: 1.8; cursor: pointer; }
.share-generated-image { display: block; width: min(100%, 800px); height: auto; margin: 20px auto; border: 1px solid var(--line, #394356); border-radius: 12px; background: var(--panel-2, #1a1f2a); }
.share-link-result > .share-button { margin: 10px 10px 0 0; }
.share-image-preview { margin: 18px 0; border: 1px solid var(--line, #394356); border-radius: 12px; padding: 14px 16px; background: var(--panel, #141821); }
.share-image-preview summary { cursor: pointer; font-weight: 700; font-size: .9rem; }
.share-recipient-actions { position: sticky; bottom: 12px; z-index: 5; border: 1px solid var(--line, #394356); border-radius: 14px; padding: 12px; background: var(--panel, #141821); box-shadow: 0 6px 24px #0002; }
#sharedFavoritesContent { max-width: 1180px; margin: auto; padding: 24px 0 40px; }
#sharedFavoritesContent h1 { margin: 0 0 16px; font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.5; }
.share-lead { color: var(--muted, #a8b2c3); line-height: 1.8; margin: 0 0 20px; }
.shared-work-list { margin: 20px 0; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 20px; }
.share-work-link { display: block; color: var(--text, #f7f8fb); text-decoration: none; }
.share-work-link:hover .share-work-title { text-decoration: underline; }
@media (max-width: 600px) {
  .share-launch { padding: 18px; gap: 16px; }
  .share-launch-button { width: 100%; }
  .share-panel { padding: 16px; }
  .share-panel-heading h3 { font-size: 1.1rem; }
  .share-card-grid, .shared-work-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .share-picker-pane, .share-preview-pane { padding: 8px; max-height: min(52vh, 480px); }
  .share-work-title { padding: 9px; font-size: .8rem; }
  .share-card-choice { padding: 9px; }
  .share-toolbar { align-items: flex-start; gap: 12px; }
  .share-toolbar-actions { gap: 8px; }
  .share-toolbar-actions .share-button { padding: 9px 12px; font-size: .8rem; }
  .share-actions .share-primary { flex: 1 1 100%; }
  .share-consent { padding: 12px; font-size: .875rem; align-items: flex-start; }
  .share-consent input { margin-top: 3px; }
  #sharedFavoritesContent { padding-top: 10px; }
}
@media (max-width: 340px) {
  .share-card-grid, .shared-work-list { grid-template-columns: 1fr; }
}
@media (forced-colors: active) {
  .share-work-card[data-selected="true"] { border-width: 4px; }
  .share-button { border: 1px solid ButtonText; }
}
