.kadath-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2rem 1.5rem;
}

.kadath-visualizer {
  width: 100%;
  height: auto;
  /* Backing pane: the strokes wash out on busy theme backgrounds — a whitish
     circular glow behind the animation keeps it readable anywhere. The ellipse
     percentages (22.5% of width, 45% of height) resolve to equal radii on the
     2:1 canvas, so it renders as a circle. The vertical radius stays below 50%
     of the height so the fade completes inside the canvas — larger glows get
     clipped at the top/bottom edges and show as hard horizontal lines. */
  background:
    radial-gradient(
      ellipse 30% 55% at 68% 44%,
      rgba(255, 249, 244, 0.16) 0%,
      rgba(255, 255, 255, 0) 72%
    ),
    radial-gradient(
      ellipse 30% 55% at 32% 44%,
      rgba(245, 242, 252, 0.18) 0%,
      rgba(255, 255, 255, 0) 72%
    ),
    radial-gradient(
      ellipse 22.5% 45% at center,
      rgba(253, 251, 255, 0.8) 0%,
      rgba(249, 246, 252, 0.72) 55%,
      rgba(255, 255, 255, 0) 100%
    );
}

.kadath-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.875rem;
  max-width: 100%;
}

.kadath-controls-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.875rem;
}

.kadath-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: #1c2333;
  color: #c8d0e7;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}

.kadath-btn:hover {
  background: #252f45;
}

.kadath-btn:active {
  transform: scale(0.93);
}

/* Volume icon — shared base (span or button) */
.kadath-vol-icon {
  display: flex;
  align-items: center;
  color: #3c4a6e;
  opacity: 0.7;
  flex-shrink: 0;
  position: relative; /* needed for the FX mute slash overlay */
}

.kadath-vol-icon svg {
  width: 16px;
  height: 16px;
}

/* Mute button — strip button chrome, inherit icon appearance */
.kadath-mute-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 0;
  transition: color 0.15s, opacity 0.15s;
}

.kadath-mute-btn:hover {
  opacity: 1;
  color: #7a8ab0;
}

/* Muted state — music vol: feather icon swaps to volume-x (handled in JS);
   tint both icons red so state is unmistakable */
.kadath-mute-btn.is-muted {
  color: #b44040;
  opacity: 0.9;
}

/* FX mute slash — diagonal line drawn over the sliders icon via ::after */
.kadath-fx-vol-icon.is-muted::after {
  content: '';
  position: absolute;
  /* line from top-left to bottom-right across the icon area */
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(
    to bottom right,
    transparent calc(50% - 1px),
    currentColor calc(50% - 1px),
    currentColor calc(50% + 1px),
    transparent calc(50% + 1px)
  );
  pointer-events: none;
  border-radius: 1px;
}

/* Volume icon + slider group — keeps them adjacent when the row wraps */
.kadath-vol-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* Volume slider */
.kadath-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 96px;
  height: 3px;
  border-radius: 2px;
  background: #22293a;
  outline: none;
  cursor: pointer;
}

.kadath-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #3c50b4;
  cursor: pointer;
  transition: background 0.15s;
}

.kadath-volume::-webkit-slider-thumb:hover {
  background: #5068d0;
}

.kadath-volume::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #3c50b4;
  border: none;
  cursor: pointer;
}

.kadath-status {
  color: #3c4a6e;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* The AI disclosure lives in assets/css/ai-notice.css -- the site footer needs
   the same rules without dragging the whole player stylesheet onto pages that
   have no player. The `kadath-player` style declares it as a dependency. */

/* FX vol icon — slightly smaller to visually separate from main vol icon */
.kadath-fx-vol-icon svg {
  width: 14px;
  height: 14px;
}

/* FX toggle buttons — same pill shape as main buttons but smaller */
.kadath-fx-btn {
  width: 36px;
  height: 36px;
  color: #5a6a90;
  background: #161d2e;
}

.kadath-fx-btn:hover {
  background: #1e2840;
  color: #8899bb;
}

/* Text-only noise buttons (W / P / B) */
.kadath-fx-text {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: inherit;
}

/* Active / pressed state */
.kadath-fx-btn.is-active {
  background: #2a3a7a;
  color: #a0b4ff;
  box-shadow: 0 0 0 1px #3c50b4 inset;
}

.kadath-fx-btn.is-active:hover {
  background: #334494;
}

/* Fullscreen — player.js puts the .kadath-player element itself into
   fullscreen and copies the theme's *background* onto it (inline, on enter) so
   the theme's foreground (header, nav) is hidden while its background is kept.
   The transparent element + transparent ::backdrop here are the pre-paint
   fallback (and cover the frame before the inline background lands). Layout is
   sized so the whole control stack always fits: the canvas is 2:1, so capping
   its width by 120vh keeps its height ≤ 60vh, leaving room for the controls;
   `justify-content: safe center` plus `overflow: auto` guarantee the controls
   can never be clipped off the top edge (they scroll instead) on a short
   viewport. Standard and legacy-WebKit selectors are split into separate
   rules: one unrecognised pseudo-class invalidates the whole selector list in
   some engines. */
.kadath-player:fullscreen {
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  justify-content: safe center;
  gap: 1.5rem;
  padding: 2rem 1.5rem;
  overflow: auto;
  background: transparent;
}

.kadath-player:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  justify-content: safe center;
  gap: 1.5rem;
  padding: 2rem 1.5rem;
  overflow: auto;
  background: transparent;
}

.kadath-player:fullscreen::backdrop {
  background: transparent;
}

.kadath-player:-webkit-full-screen::backdrop {
  background: transparent;
}

.kadath-player:fullscreen .kadath-visualizer {
  width: min(90vw, 120vh);
  height: auto;
}

.kadath-player:-webkit-full-screen .kadath-visualizer {
  width: min(90vw, 120vh);
  height: auto;
}

@media (max-width: 640px) {
  .kadath-player { padding: 1.25rem 0.75rem; }
  .kadath-controls { flex-direction: column; gap: 0.75rem; }
  .kadath-controls-row { width: 100%; gap: 0.625rem; }
  .kadath-vol-group { flex-basis: 100%; justify-content: center; }
  .kadath-volume { width: 140px; }
}

/* Keyboard focus — PRD §6 claims every control is keyboard-operable, but there
   was no focus style anywhere, so a keyboard user had no idea where they were.
   :focus-visible keeps the ring off mouse clicks. The offset puts it outside
   the (dark) control, against the page background, so it reads on either. */
.kadath-btn:focus-visible,
.kadath-mute-btn:focus-visible,
.kadath-volume:focus-visible {
  outline: 2px solid #3c50b4;
  outline-offset: 2px;
}

.kadath-player--auth {
  max-width: 22rem;
  margin-inline: auto;
}

.kadath-auth-lead {
  margin: 0 0 0.25rem;
  color: #3b3b3b;
  font-size: 0.95rem;
  text-align: center;
}

.kadath-auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.kadath-auth-form[hidden] {
  display: none;
}

.kadath-auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: #5f5f5f;
  font-size: 0.8rem;
}

.kadath-auth-field input[type="text"],
.kadath-auth-field input[type="email"],
.kadath-auth-field input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.85rem;
  border: 1px solid #e4dcf2;
  border-radius: 12px;
  background: #fbf8ff;
  color: #191919;
  font: inherit;
}

.kadath-auth-field input[type="text"]:focus-visible,
.kadath-auth-field input[type="email"]:focus-visible,
.kadath-auth-field input[type="password"]:focus-visible,
.kadath-auth-submit:focus-visible,
.kadath-auth-switch:focus-visible {
  outline: 2px solid #650dd4;
  outline-offset: 2px;
}

.kadath-auth-field input[type="text"]:focus,
.kadath-auth-field input[type="email"]:focus,
.kadath-auth-field input[type="password"]:focus {
  border-color: #650dd4;
  background: #ffffff;
}

.kadath-auth-remember {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.kadath-auth-remember input {
  margin: 0;
}

.kadath-auth-submit {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: #650dd4;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

.kadath-auth-submit:hover {
  background: #4f0aa8;
}

.kadath-auth-submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.kadath-auth-error {
  min-height: 1em;
  margin: 0;
  color: #b44040;
  font-size: 0.8rem;
  text-align: center;
}

.kadath-auth-links {
  margin: 0;
  text-align: center;
  font-size: 0.8rem;
}

.kadath-auth-links a {
  color: #650dd4;
}

.kadath-auth-links a:hover,
.kadath-auth-switch:hover {
  color: #4f0aa8;
}

.kadath-auth-switch {
  background: none;
  border: none;
  padding: 0;
  color: #650dd4;
  font: inherit;
  cursor: pointer;
}

/* --- Installed app (PWA) -------------------------------------------------

   Two things change once the player runs in its own window instead of a tab:
   the theme's chrome is dead weight (there is nowhere to navigate to, and the
   window is often narrow), and the install button has nothing left to offer.

   `.kadath-standalone` on <html> is set by assets/js/pwa.js. The media query
   alone would miss iOS, which reports standalone only through
   navigator.standalone; the class alone would miss a window opened before the
   script ran. Both, matching the same rules. */
@media (display-mode: standalone), (display-mode: window-controls-overlay) {
  .kadath-player {
    /* The window is the app: let the visualizer use the height the browser
       chrome is no longer taking. */
    min-height: 100vh;
    justify-content: center;
  }

  .kadath-install-btn {
    display: none;
  }
}

.kadath-standalone .kadath-player {
  min-height: 100vh;
  justify-content: center;
}

.kadath-standalone .kadath-install-btn {
  display: none;
}

/* Site chrome around the player. Hidden only in the installed window, where a
   header linking back into the site would open pages the app window is not
   meant to show. Kept as a separate, themeable list rather than a blanket
   `body > *:not(main)`, which would take the player itself out with it on any
   theme that nests differently. */
.kadath-standalone :is(header.site-header, .wp-site-blocks > header, footer.site-footer, .wp-site-blocks > footer, .wp-block-template-part.site-header, .wp-block-template-part.site-footer) {
  display: none;
}

.kadath-install-btn[hidden] {
  display: none;
}
