.oyz-global-player {
  --gp-surface: var(--color-paper, #fffdf8);
  --gp-page: var(--color-page, #f7f4ef);
  --gp-text: var(--color-text, #1f2328);
  --gp-muted: var(--color-muted, #73777d);
  --gp-line: var(--color-line, rgba(31, 35, 40, .16));
  --gp-accent: var(--color-accent, #176b72);
  /* Keep the player above the existing quick-note FAB in the same corner. */
  bottom: max(86px, env(safe-area-inset-bottom) + 72px);
  color: var(--gp-text);
  font-family: var(--font-ui, system-ui, sans-serif);
  position: fixed;
  /* The editor page has a broad aside rule (sticky + top/max-height).
     Override every layout property that could leak into this fixed overlay. */
  top: auto;
  left: auto;
  width: max-content;
  /* Give the fixed wrapper the same height as its closed tab. With a zero-
     height wrapper, bottom anchors the tab's top edge and lets it drift
     down into the quick-note FAB's reserved corner. */
  height: 50px;
  max-height: none;
  min-height: 0;
  overflow: visible;
  align-self: auto;
  padding: 0;
  right: max(18px, env(safe-area-inset-right) + 14px);
  isolation: isolate;
  z-index: 2147483000;
}

.oyz-global-player[hidden] { display: none; }

.oyz-global-player button,
.oyz-global-player input { font: inherit; }

.oyz-player-tab {
  align-items: center;
  background: var(--gp-text);
  border: 1px solid var(--gp-text);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
  color: var(--gp-surface);
  cursor: pointer;
  display: inline-flex;
  gap: 9px;
  height: 50px;
  justify-content: center;
  min-width: 50px;
  padding: 0 16px;
  transition: transform .2s ease, background .2s ease, color .2s ease;
}

.oyz-player-tab:hover,
.oyz-player-tab:focus-visible {
  background: var(--gp-accent);
  border-color: var(--gp-accent);
  color: var(--gp-surface);
  transform: translateY(-2px);
}

.oyz-player-tab-icon { font-size: 1.35rem; line-height: 1; }
.oyz-player-tab-label { font-size: .78rem; letter-spacing: .06em; }

.oyz-player-panel {
  background: var(--gp-surface);
  border: 1px solid var(--gp-line);
  border-radius: 22px;
  /* Keep the expanded panel clear of the notes footer action row. On a
     tall desktop viewport the footer sits near the lower edge; a viewport-
     relative offset separates the two rows without pushing the panel off
     shorter desktop screens. */
  bottom: clamp(62px, calc(10vh + 4px), 112px);
  box-shadow: 0 22px 70px rgba(0, 0, 0, .22);
  display: none;
  overflow: hidden;
  position: absolute;
  right: 0;
  z-index: 1;
  width: min(348px, calc(100vw - 28px));
}

.oyz-global-player.is-open .oyz-player-panel { display: block; }
.oyz-global-player.is-open .oyz-player-tab { display: none; }

.oyz-player-main { padding: 18px; }

.oyz-player-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 16px;
}

.oyz-player-kicker {
  color: var(--gp-muted);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.oyz-player-close,
.oyz-player-mode,
.oyz-player-list-toggle {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 1px solid var(--gp-line);
  border-radius: 999px;
  color: var(--gp-muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: var(--font-ui, system-ui, sans-serif);
  font-size: .72rem;
  font-weight: 500;
  gap: 6px;
  height: 32px;
  justify-content: center;
  line-height: 1;
  min-width: 0;
  padding: 0 12px;
  white-space: nowrap;
}

.oyz-player-close:hover,
.oyz-player-close:focus-visible,
.oyz-player-mode:hover,
.oyz-player-mode:focus-visible,
.oyz-player-list-toggle:hover,
.oyz-player-list-toggle:focus-visible { color: var(--gp-text); }
.oyz-player-close { min-width: 32px; padding: 0; width: 32px; }

.oyz-player-cover {
  align-items: center;
  background:
    radial-gradient(circle at center, #f7f4ef 0 5px, transparent 6px),
    radial-gradient(circle at center, #c9a86a 0 18px, transparent 19px),
    repeating-radial-gradient(circle at center, #25282b 0 2px, #17191b 3px 5px);
  border: 8px solid #101214;
  border-radius: 50%;
  box-shadow: 0 14px 28px rgba(0, 0, 0, .25), inset 0 0 0 1px rgba(255, 255, 255, .12);
  color: rgba(255, 255, 255, .92);
  display: flex;
  font-size: 48px;
  height: 154px;
  justify-content: center;
  margin: 0 auto 16px;
  overflow: hidden;
  position: relative;
  width: 154px;
}

.oyz-player-cover::after {
  background: radial-gradient(circle, #f7f4ef 0 4px, #c9a86a 5px 17px, transparent 18px);
  border-radius: 50%;
  content: "";
  height: 38px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
}

.oyz-player-cover.is-playing { animation: oyz-player-disc-spin 8s linear infinite; }
.oyz-player-cover img { border-radius: 50%; height: 100%; object-fit: cover; width: 100%; }

@keyframes oyz-player-disc-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.oyz-player-meta { min-width: 0; text-align: center; }
.oyz-player-title { font-family: var(--font-heading, inherit); font-size: 1.1rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oyz-player-artist { color: var(--gp-muted); font-size: .82rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.oyz-player-progress { appearance: none; background: linear-gradient(to right, var(--gp-accent) 0 var(--gp-progress, 0%), var(--gp-line) var(--gp-progress, 0%) 100%); border-radius: 4px; cursor: pointer; display: block; height: 5px; margin: 19px 0 7px; outline: none; width: 100%; }
.oyz-player-progress::-webkit-slider-thumb { appearance: none; background: var(--gp-accent); border: 2px solid var(--gp-surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--gp-accent); height: 14px; width: 14px; }
.oyz-player-progress::-moz-range-thumb { background: var(--gp-accent); border: 2px solid var(--gp-surface); border-radius: 50%; height: 14px; width: 14px; }
.oyz-player-time { color: var(--gp-muted); display: flex; font-family: var(--font-mono, ui-monospace, monospace); font-size: .68rem; justify-content: space-between; }

.oyz-player-controls { align-items: center; display: flex; gap: 12px; justify-content: center; margin-top: 17px; }
.oyz-player-control { align-items: center; background: transparent; border: 0; border-radius: 999px; color: var(--gp-text); cursor: pointer; display: inline-flex; font-size: 1.2rem; height: 40px; justify-content: center; width: 40px; }
.oyz-player-control:hover, .oyz-player-control:focus-visible { background: color-mix(in srgb, var(--gp-accent) 13%, transparent); color: var(--gp-accent); }
.oyz-player-control.is-primary { background: var(--gp-accent); color: var(--gp-surface); font-size: 1.3rem; height: 52px; width: 52px; }
.oyz-player-control.is-primary:hover, .oyz-player-control.is-primary:focus-visible { filter: brightness(1.1); }

.oyz-player-status { color: var(--gp-muted); font-size: .72rem; min-height: 1.1em; text-align: center; }
.oyz-player-options { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 15px; min-width: 0; width: 100%; }
.oyz-player-mode,
.oyz-player-options .oyz-player-list-toggle { margin: 0; }
.oyz-player-mode::before { content: "↻"; font-size: 1rem; }
.oyz-player-list-toggle::before { content: "☷"; font-size: 1rem; }

.oyz-player-playlist { border-top: 1px solid var(--gp-line); display: none; max-height: 240px; overflow-y: auto; padding: 8px; }
.oyz-global-player.is-playlist .oyz-player-playlist { display: block; }
.oyz-player-track { align-items: center; background: transparent; border: 0; border-radius: 12px; color: var(--gp-text); cursor: pointer; display: flex; gap: 10px; padding: 10px; text-align: left; width: 100%; }
.oyz-player-track:hover, .oyz-player-track.is-active { background: color-mix(in srgb, var(--gp-accent) 12%, transparent); }
.oyz-player-track-number { color: var(--gp-muted); font-family: var(--font-mono, ui-monospace, monospace); font-size: .7rem; width: 20px; }
.oyz-player-track-info { min-width: 0; }
.oyz-player-track-title { display: block; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oyz-player-track-artist { color: var(--gp-muted); display: block; font-size: .72rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .oyz-global-player { bottom: max(92px, env(safe-area-inset-bottom) + 84px); height: 46px; right: max(12px, env(safe-area-inset-right) + 8px); }
  .oyz-player-tab { height: 46px; min-width: 46px; padding: 0 14px; }
  .oyz-player-tab-label { display: none; }
  .oyz-player-panel {
    bottom: 0;
    max-height: min(calc(100svh - 96px), 620px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    width: min(360px, calc(100vw - 24px));
  }
  .oyz-player-main { padding: 16px; }
  .oyz-player-cover { height: min(52vw, 180px); width: min(52vw, 180px); }
}

@media (prefers-reduced-motion: reduce) {
  .oyz-player-tab, .oyz-player-control { transition: none; }
  .oyz-player-cover.is-playing { animation: none; }
}
