body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.86);
  z-index: 100;
  display: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 48px 24px 80px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.modal-backdrop.open {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  scroll-behavior: smooth;
  opacity: 1;
}

.modal-backdrop::-webkit-scrollbar {
  width: 10px;
}

.modal-backdrop::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.5);
}

.modal-backdrop::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 5px;
}

.modal-backdrop::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.38);
}

.modal-close-btn {
  position: fixed;
  top: 24px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: rgba(22, 24, 30, 0.65);
  backdrop-filter: blur(20px) saturate(190%);
  -webkit-backdrop-filter: blur(20px) saturate(190%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.28), 0 8px 24px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  cursor: pointer;
  will-change: transform;
  transition: background-color var(--transition-fast), transform var(--transition-spring), border-color var(--transition-fast);
}

.modal-close-btn:hover {
  background: rgba(36, 40, 52, 0.85);
  border-color: rgba(255, 255, 255, 0.32);
  transform: scale(1.10);
}

.modal-close-btn:active {
  transform: scale(0.88);
  transition: transform var(--transition-press);
}

.modal-content-wrap {
  width: min(1040px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  margin: 0 auto;
  flex-shrink: 0;
}

.modal-container {
  background: rgba(18, 20, 26, 0.78);
  backdrop-filter: blur(32px) saturate(190%);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 32px;
  width: 100%;
  height: auto;
  min-height: 560px;
  display: flex;
  flex-direction: row;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  transform: scale(0.98);
  transition: transform var(--transition-fast);
}

.modal-backdrop.open .modal-container {
  transform: scale(1);
}

.modal-media-col {
  flex: 1;
  min-width: 0;
  min-height: 560px;
  height: auto;
  align-self: stretch;
  background-color: #0b0c0e;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.modal-image {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
}

.modal-img-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.modal-info-col {
  width: 440px;
  flex-shrink: 0;
  height: auto;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  overflow: visible;
  scrollbar-width: none;
  -ms-overflow-style: none;
  gap: 20px;
  background-color: transparent;
}

.modal-info-col::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.modal-top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-icon-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-action-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.22), 0 4px 12px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  will-change: transform;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-spring);
}

.modal-action-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.32);
  transform: scale(1.08);
}

.modal-action-btn:active {
  transform: scale(0.88);
  transition: transform var(--transition-press);
}

.modal-action-btn.is-loading {
  opacity: 0.6;
  pointer-events: none;
}

.modal-save-btn {
  background: linear-gradient(180deg, rgba(236, 72, 153, 0.95) 0%, rgba(219, 39, 119, 0.9) 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius-full);
  padding: 10px 24px;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.5), 0 4px 16px rgba(236, 72, 153, 0.38);
  cursor: pointer;
  will-change: transform;
  transition: background var(--transition-fast), transform var(--transition-spring), box-shadow var(--transition-fast);
}

.modal-save-btn:hover {
  background: linear-gradient(180deg, rgba(244, 114, 182, 0.98) 0%, rgba(236, 72, 153, 0.95) 100%);
  transform: scale(1.05);
  box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.6), 0 6px 22px rgba(236, 72, 153, 0.48);
}

.modal-save-btn:active {
  transform: scale(0.92);
  transition: transform var(--transition-press);
}

.modal-save-btn.is-saved {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.9) 0%, rgba(5, 150, 105, 0.85) 100%);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.45), 0 4px 14px rgba(16, 185, 129, 0.35);
  animation: bubble-pop 320ms var(--ease-spring);
}

.modal-save-btn.is-saved:hover {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.9) 100%);
  transform: scale(1.05);
}

.modal-author-platform {
  font-size: 0.8rem;
}

.modal-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.modal-author-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-author-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background-color: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--brand-lotus);
}

.modal-author-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 14px 18px;
  border-radius: 18px;
}

.modal-meta-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.modal-meta-item strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-top: 2px;
}

.modal-tags-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-tags-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.modal-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.modal-tag-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  will-change: transform;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-spring), box-shadow var(--transition-fast);
}

.modal-tag-chip:hover {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.9), rgba(219, 39, 119, 0.85));
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 4px 14px rgba(236, 72, 153, 0.35);
  transform: translateY(-1px) scale(1.05);
}

.modal-tag-chip:active {
  transform: scale(0.91);
  transition: transform var(--transition-press);
}

.modal-scroll-cue {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 20px;
  padding: 11px 26px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 1;
  transform: translateY(0);
  will-change: transform, opacity;
  transition: opacity 320ms ease, transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
  z-index: 25;
}

.modal-scroll-cue:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px) scale(1.03);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.35), 0 10px 28px rgba(0, 0, 0, 0.45);
}

.modal-scroll-cue:active {
  transform: translateY(0) scale(0.94);
  transition: transform var(--transition-press);
}

.modal-scroll-cue svg {
  color: var(--brand-lotus);
  transition: transform var(--transition-fast);
}

.modal-scroll-cue:hover svg {
  transform: translateY(3px);
}

.modal-scroll-cue.hide {
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  pointer-events: none;
}

.modal-divider {
  display: none;
}

.modal-related-section {
  width: 100%;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-bottom: 24px;
}

.modal-related-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  text-align: left;
  width: 100%;
  padding: 0 4px;
  letter-spacing: -0.01em;
}

.modal-related-grid {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

.modal-related-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.modal-related-card {
  display: block;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  background-color: #171922;
  cursor: pointer;
  position: relative;
  border: 1px solid var(--border-subtle);
  transition: transform var(--transition-fast);
}

.modal-related-card:hover {
  transform: scale(1.02);
}

.modal-related-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.modal-related-img.loaded {
  opacity: 1;
}

.modal-related-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0 24px;
  width: 100%;
}

.modal-related-loader .spinner {
  width: 32px;
  height: 32px;
  border-width: 3px;
}

.modal-related-sentinel {
  width: 100%;
  height: 40px;
  pointer-events: none;
}

.toast-notification {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(22, 24, 29, 0.95);
  color: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  backdrop-filter: blur(8px);
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (min-width: 769px) {
  .toast-notification {
    bottom: 32px;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .modal-backdrop {
    padding: 32px 16px 64px;
  }
  .modal-content-wrap {
    width: 100%;
  }
  .modal-container {
    width: 100%;
    height: auto;
    min-height: 500px;
    border-radius: 24px;
  }
  .modal-media-col {
    padding: 16px;
    min-height: 500px;
    height: auto;
    align-self: stretch;
  }
  .modal-info-col {
    width: 360px;
    height: auto;
    overflow: visible;
    padding: 24px 20px;
    gap: 16px;
  }
  .modal-related-grid {
    gap: 12px;
  }
  .modal-related-col {
    gap: 12px;
  }
}

@media (max-width: 768px) {
  .modal-backdrop {
    padding: 0;
    background: #08090d;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .modal-backdrop::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
  .modal-backdrop.open {
    display: block;
    scroll-behavior: auto;
  }
  .modal-close-btn {
    position: fixed;
    top: 14px;
    left: 14px;
    right: auto;
    width: 42px;
    height: 42px;
    background: rgba(22, 25, 34, 0.95);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--radius-full);
    z-index: 250;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  }
  .modal-content-wrap {
    width: 100%;
    margin: 0;
  }
  .modal-container {
    width: 100%;
    min-height: auto;
    height: auto;
    max-height: none;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-direction: column;
    overflow: visible;
    background: #0e1117;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
    transform: none;
  }
  .modal-backdrop.open .modal-container {
    transform: none;
  }
  .toast-notification {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-color: rgba(22, 24, 29, 0.98);
  }
  .modal-media-col {
    width: 100%;
    padding: 0;
    background-color: #0b0c0e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    height: auto;
    max-height: 70vh;
    min-height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: pan-y;
    position: relative;
  }
  .modal-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    display: block;
    object-fit: contain;
    border-radius: 0;
    touch-action: pan-y;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
  }
  .modal-info-col {
    width: 100%;
    height: auto;
    padding: 16px 16px 8px;
    gap: 14px;
    overflow: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
    background-color: transparent;
  }
  .modal-info-col::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }
  .modal-top-actions {
    padding-right: 0;
    width: 100%;
  }
  .modal-action-btn {
    width: 40px;
    height: 40px;
  }
  .modal-save-btn {
    padding: 10px 22px;
    font-size: 0.92rem;
  }
  .modal-meta-grid {
    padding: 12px 16px;
    gap: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), 0 4px 16px rgba(0, 0, 0, 0.25);
    border-radius: 18px;
  }
  .modal-tags-list {
    gap: 6px;
  }
  .modal-tag-chip {
    font-size: 0.74rem;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }
  .modal-scroll-cue {
    display: none;
  }
  .modal-divider {
    display: block;
    width: calc(100% - 32px);
    height: 1px;
    margin: 8px auto 14px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2) 15%, rgba(255, 255, 255, 0.2) 85%, transparent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
  .modal-related-section {
    width: 100%;
    margin-top: 0;
    padding: 0 12px 96px;
  }
  .modal-related-title {
    font-size: 1.15rem;
    text-align: left;
    padding: 0 4px;
    margin-bottom: 12px;
  }
  .modal-related-grid {
    gap: 8px;
  }
  .modal-related-col {
    gap: 8px;
  }
  .modal-related-card {
    border-radius: 12px;
  }
}
