:root {
  --menv-bg: #ffffff;
  --menv-border: #e5e9ee;
  --menv-text: #1a202c;
}
:root[data-menv-theme="dark"] {
  --menv-bg: #1a1f2b;
  --menv-border: #333c4d;
  --menv-text: #f1f5f9;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: transparent;
}

/* Room for the pulse ring, which the iframe edge would otherwise clip */
.menv-bgm { display: flex; padding: 12px; }

.menv-bgm-toggle {
  position: relative;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 50%;
  background: var(--menv-bg);
  border: 1.5px solid var(--menv-border);
  color: var(--menv-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.14);
  transition: transform 0.15s ease, background 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.menv-bgm-toggle:hover { transform: scale(1.06); }
.menv-bgm-toggle:active { transform: scale(0.95); }
.menv-bgm-toggle:focus-visible { outline: 2px solid #00b894; outline-offset: 3px; }

.menv-bgm-note { width: 22px; height: 22px; }

.menv-bgm-bars { display: none; align-items: flex-end; gap: 3px; height: 20px; }
.menv-bgm-bars i {
  display: block;
  width: 3.5px;
  height: 100%;
  border-radius: 2px;
  background: currentColor;
  transform-origin: bottom;
  animation: menv-bgm-eq 1s ease-in-out infinite alternate;
}
.menv-bgm-bars i:nth-child(1) { animation-delay: -0.9s; animation-duration: 0.8s; }
.menv-bgm-bars i:nth-child(2) { animation-delay: -0.3s; animation-duration: 1.1s; }
.menv-bgm-bars i:nth-child(3) { animation-delay: -0.6s; animation-duration: 0.7s; }
.menv-bgm-bars i:nth-child(4) { animation-delay: -0.1s; animation-duration: 0.95s; }

.menv-bgm-toggle.is-playing {
  background: linear-gradient(135deg, #00b894, #0984e3);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(0, 184, 148, 0.4);
}
.menv-bgm-toggle.is-playing .menv-bgm-note { display: none; }
.menv-bgm-toggle.is-playing .menv-bgm-bars { display: flex; }
.menv-bgm-toggle.is-playing::after {
  content: "";
  position: absolute;
  inset: -1.5px;
  border-radius: 50%;
  border: 2px solid #00b894;
  animation: menv-bgm-ring 1.8s ease-out infinite;
  pointer-events: none;
}

@keyframes menv-bgm-eq {
  from { transform: scaleY(0.25); }
  to   { transform: scaleY(1); }
}
@keyframes menv-bgm-ring {
  from { transform: scale(1);    opacity: 0.7; }
  to   { transform: scale(1.42); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .menv-bgm-bars i { animation: none; transform: scaleY(0.7); }
  .menv-bgm-toggle.is-playing::after { animation: none; opacity: 0; }
}
