#user-content {
  overflow-wrap: anywhere;
  word-wrap: break-word;
  min-width: 0;
  max-width: 100%;
}

#user-content :where(p, li, blockquote, div, span) {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

/* A fixed author color does not read on both themes. Inherit hides it; UserContent::ExplanationNotes
   turns that color into .explanation, which has its own theme gray below.
   Inherit only on descendants: the container keeps text-fg (tales) or the chapter reader color.
   Forcing inherit on #user-content itself paints black text on the dark tale background.
   More specific theme rules in chapters_reader.css still color headings, links, and quotes. */
#user-content * {
  color: inherit !important;
  -webkit-text-fill-color: currentcolor !important;
}

/* One note color for every former text color. Softer than the body on a light page. */
#user-content .explanation {
  color: #4b5563 !important;
  -webkit-text-fill-color: currentcolor !important;
}

html.dark #user-content .explanation,
.dark #user-content .explanation {
  color: #a1a1aa !important;
}

#user-content a {
  color: #3598DB !important;
  text-decoration: underline;
  font-style: italic;
  transition: color 0.3s ease;
}

#user-content a:hover {
  color: #2980B9 !important;
}

#user-content blockquote {
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  border-left: 0.25rem solid #d1d5db;
  border-radius: 0.25rem;
  font-style: italic;
}

#user-content blockquote p {
  margin-bottom: 0;
}

#user-content p {
  margin-bottom: 1.5rem;
}

#user-content :is(h1, h2, h3, h4, h5, h6) {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* Tailwind's preflight resets headings to body text, and `prose` has no plugin behind it. The chapter reader
   sets sizes inline from the reader font size (reader_preferences.js HEADING_SCALE); keep the two in sync. */
#user-content :where(h1, h2, h3, h4, h5, h6) {
  font-weight: 700;
  line-height: 1.3;
}

#user-content :where(h1) { font-size: 1.75em; }
#user-content :where(h2) { font-size: 1.5em; }
#user-content :where(h3) { font-size: 1.25em; }
#user-content :where(h4, h5, h6) { font-size: 1.1em; }

#user-content img {
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Pixel widths (often 560) overflow a phone. The reader column is much wider than a
   comfortable video, so cap the embed and center it instead of stretching to the column. */
#user-content iframe {
  display: block !important;
  width: 100% !important;
  max-width: 48rem;
  height: auto !important;
  aspect-ratio: 16 / 9;
  margin: 1.5rem auto;
  border: 0;
  border-radius: 0.5rem;
}

#user-content ul,
#user-content ol {
  margin-left: 2rem;
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

#user-content ul {
  list-style-type: disc;
}

#user-content ol {
  list-style-type: decimal;
}

#user-content li {
  margin-bottom: 0.5rem;
  line-height: 1.7;
  padding-left: 0.25rem;
}

#user-content hr {
  margin-bottom: 2rem;
  border: none;
  border-top: 1px solid #d1d5db;
  margin-top: 2rem;
}

/* Strikethrough text styling */
#user-content strike,
#user-content s,
#user-content del {
  text-decoration: line-through;
  opacity: 0.7;
}

@media (max-width: 768px) {
  #user-content {
    font-size: 1rem;
  }
}

.selected-image {
  border: 3px solid pink;
  box-shadow: 0 0 5px pink;
}