/* Lunaria/Moonverse quality layer: accessibility and viewport corrections.
   Palette, display fonts, corners, gradients and atmospheric styling stay intact. */
:root {
  scroll-padding-top: 5rem;
  scrollbar-gutter: stable;
}
:where(
  a,
  button,
  summary,
  [role="tab"],
  [role="switch"]
):focus-visible {
  outline: 1.5px solid color-mix(in srgb, var(--ring, #818cf8) 70%, transparent);
  outline-offset: 2px;
}
:where(
  input,
  textarea,
  select
):focus,
:where(
  input,
  textarea,
  select
):focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
}
:where(button, [role="button"]):disabled {
  cursor: not-allowed;
}
:where(img, svg, video, canvas, iframe) {
  max-width: 100%;
}
:where(input, textarea, select) {
  min-width: 0;
}
main,
[id] {
  scroll-margin-top: 5rem;
}
.lunaria-skip {
  position: fixed;
  inset: 0.75rem auto auto 0.75rem;
  z-index: 99999;
  padding: 0.75rem 1.1rem;
  border: 2px solid var(--ring, #818cf8);
  border-radius: 0.75rem;
  background: var(--card, #161f32);
  color: var(--foreground, #fff);
  font-size: 0.875rem;
  font-weight: 700;
  box-shadow: 0 8px 28px #0005;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.lunaria-skip:focus {
  transform: translateY(0);
}
body.lunaria-dialog-open {
  overflow: hidden;
}
[role="dialog"][aria-modal="true"] {
  overscroll-behavior: contain;
}
[role="dialog"][aria-modal="true"] > div {
  max-height: min(92dvh, 60rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* Keep densely packed information panels readable on narrow screens. */
@media (max-width: 480px) {
  :where(main, section, article) {
    min-width: 0;
  }
  :where(.overflow-x-auto, .overflow-auto) {
    overscroll-behavior-x: contain;
  }
  [role="dialog"][aria-modal="true"] {
    padding: 0.65rem;
  }
  [role="dialog"][aria-modal="true"] > div {
    max-height: calc(100dvh - 1.3rem);
  }
  .lunaria-skip {
    inset: max(0.75rem, env(safe-area-inset-top)) auto auto 0.75rem;
  }
}
@media (pointer: coarse) {
  /* Larger controls for touch without enlarging decorative pills and badges. */
  :where(header, nav, footer) button:not([role="switch"]),
  :where(header, nav, footer) a {
    touch-action: manipulation;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
@media (forced-colors: active) {
  :where(button, a, input, textarea, select):focus-visible {
    outline: 2px solid Highlight !important;
  }
  [role="switch"] {
    border: 1px solid ButtonText;
  }
}
/* Nonblocking illustration fallback for disconnected external cover services. */
.lunaria-cover-fallback {
  position: relative;
  background-image:
    radial-gradient(
      ellipse at 35% 25%,
      color-mix(in srgb, var(--primary, #818cf8) 18%, transparent),
      transparent 65%
    ),
    linear-gradient(150deg, var(--card, #161f32), var(--background, #0f1523));
}
.lunaria-cover-fallback::after {
  content: "✦";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  font-size: clamp(1.5rem, 4vw, 3.5rem);
  color: var(--primary, #818cf8);
  opacity: 0.32;
}
.lunaria-image-error {
  opacity: 0 !important;
}
