/* A single presentation for active generation messages, including their timer.
   Important declarations in a layer take precedence over legacy unlayered panel rules. */
@layer cr-generation {
  [data-cr-elapsed] {
    display: inline-block !important;
    box-sizing: border-box !important;
    width: fit-content !important;
    min-width: 0 !important;
    max-width: 100% !important;
    padding: 4px 10px !important;
    border: 1px solid #557082 !important;
    border-radius: 8px !important;
    background: #112c43 !important;
    color: #ffe264 !important;
    font: italic 600 16px/1.4 Arial, sans-serif !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-shadow: none !important;
    text-align: start !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    animation: cr-generation-pulse 1.8s ease-in-out infinite !important;
  }
  [data-cr-elapsed]::before { content: none !important; }
  [data-cr-elapsed]::after {
    content: attr(data-cr-elapsed) !important;
    font: inherit !important;
    color: inherit !important;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
  }
  [data-cr-elapsed]:not(.cr-symbolic-image-status):not([data-cr-convergence-state="loading"] li > span)::before,
  [data-cr-convergence-state="loading"] .cr-convergence-point-mark,
  [data-cr-convergence-state="loading"] .cr-convergence-degree::before {
    content: "" !important;
    display: inline-block !important;
    box-sizing: border-box;
    width: 17px;
    height: 17px;
    border: 2px solid #ffe264;
    border-right-color: transparent;
    border-radius: 50%;
    background: transparent !important;
    font-size: 0 !important;
    vertical-align: -2px;
    margin-inline-end: 6px;
    animation: cr-convergence-spin 2s linear infinite;
  }
  /* The spinner must beat unlayered legacy animation rules, not just inherit
     the badge pulse; keeping the DOM node stable preserves its rotation phase. */
  [data-story-engine="external-pending"] .story-continuous[data-cr-elapsed]::before {
    animation: cr-convergence-spin 1.2s linear infinite !important;
  }
  [data-cr-convergence-state="loading"] .cr-convergence-degree[data-cr-elapsed]::before {
    margin-inline-end: 8px;
  }
  @media (prefers-reduced-motion: reduce) {
  [data-cr-elapsed]:not(.cr-symbolic-image-status):not([data-cr-convergence-state="loading"] li > span)::before,
    [data-cr-convergence-state="loading"] .cr-convergence-point-mark,
    [data-cr-convergence-state="loading"] .cr-convergence-degree::before { animation: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    [data-cr-elapsed],
    [data-story-engine="external-pending"] .story-continuous[data-cr-elapsed]::before { animation: none !important; }
  }
}
@keyframes cr-generation-pulse { 50% { opacity: .55; filter: brightness(.78); } }

@keyframes cr-convergence-spin { to { transform: rotate(1turn); } }

/* Relation astrology — permanent optional-reading badge on the visible disclosure title.
   The disclosure component already owns ::before for its triangle, so the badge must use ::after. */
#astrologyWorkspace #relationAstroTitle.cr-relation-astro-disclosure::after {
  content: "LECTURE OPTIONNELLE" !important;
  display: inline-block !important;
  flex: 0 0 auto;
  box-sizing: border-box;
  margin-left: auto;
  padding: 7px 13px;
  border: 1px solid rgba(217,181,109,.95);
  border-radius: 999px;
  background: #123b69 !important;
  color: #f4d98e !important;
  font: 700 0.68em/1.1 Inter, system-ui, -apple-system, "Segoe UI", sans-serif !important;
  letter-spacing: .07em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(5,23,40,.22), inset 0 0 0 1px rgba(255,255,255,.03);
}
html[lang="en"] #astrologyWorkspace #relationAstroTitle.cr-relation-astro-disclosure::after {
  content: "OPTIONAL READING" !important;
}
/* If the JS badge survives a later rewrite, keep only one visible badge. */
#astrologyWorkspace #relationAstroTitle .cr-relation-astro-optional-badge {
  display: none !important;
}
@media(max-width:800px){
  #astrologyWorkspace #relationAstroTitle.cr-relation-astro-disclosure::after {
    margin-left: calc(1.1em + 14px);
    margin-right: auto;
  }
}
