/* Import ControlXY Launcher styles */
@import url("controlxy-minimal.css");
@import url("oscillaMenu.css");
@import url("oscillaLoader.css");

/* Modular component imports */
@import url("oscillaTimersStopwatch.css");
@import url("oscillaColorPicker.css");
@import url("oscillaMarkers.css");
@import url("oscillaCueButtons.css");
@import url("oscillaTransport.css");
@import url("playheadOffset.css");
@import url("oscillaLightTheme.css");
@import url("oscillaSplash.css");
@import url("oscillaAnnotations.css");
@import url("oscillaDrawing.css");
@import url("oscillaPreferences.css");
@import url("o2p.css");
@import url("livecode.css");




/* General body styling */

/* Fallback to Google Fonts when online */
/* @import url('https://fonts.googleapis.com/css2?family=Antonio:wght@400;700&display=swap'); */

html {
  /* scrollbar-gutter: stable both-edges; */
}

body {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  background-color: white;
  color: black;
  font-family: 'Iosevka Term Web', monospace;
  overflow: hidden !important;

}



/* 🔹 Remove focus outlines and blue flash from all major containers and SVGs */
#scoreContainer,
#scoreContainer:focus,
#scoreContainer *:focus,
#singlePage-container,
#singlePage-container:focus,
#singlePage-container *:focus,
#animation-popup,
#animation-popup:focus,
#animation-popup *:focus,
svg:focus,
svg *:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

/* 🔹 Prevent text selection & focus flashing on click */
#scoreContainer,
#singlePage-container,
#animation-popup,
svg {
  user-select: none !important;
  -webkit-touch-callout: none !important; /* suppress long-press callout on iOS/Safari */
  -webkit-tap-highlight-color: transparent !important; /* ✅ removes blue flash on mobile/webkit */
  -webkit-focus-ring-color: transparent !important;    /* ✅ removes blue outline in Chrome/Safari */
   /* pointer-events: none !important; */

}



:focus-visible {
  outline: none;
}



#scoreOverlay,
#singlePage-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;       /* <-- Bring overlay above SVG */
  pointer-events: none; /* <-- Overlay does not capture clicks */
}





/* ----------------------------------------------------
   CORE LAYOUT + UTILITIES
---------------------------------------------------- */

:root {
  --transport-scale: 1;
}

.gui-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.gui-cluster {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.gui-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 0.3rem;
}

.gui-sticky-top {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
}

.gui-sticky-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
}

.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.is-dismissed {
  transform: translateY(100%);
  opacity: 0;
}

/* ////////////////////////////////////////// */

html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

#scoreContainer {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow-x: hidden !important;  /* ADD THIS - force no horizontal scroll */
  background: white;
  white-space: nowrap;
  margin: 0 !important;
  padding: 0 !important;
}

:root { --oscilla-zoom: 1; }

/* Zoom cluster (transport bar): the percentage doubles as "back to fit".
 *
 * Sized to the bar it is in rather than the topbar it came from. It had 16px
 * icons in a 34x29 box — the smallest icons on the bar, next to 18px speed
 * buttons and 20px side buttons, and under the 44px that a finger wants. The
 * three now share one height so the block reads as one control. */
.gui-button.zoom-level {
  min-width: 3.4em;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.gui-button.zoom-level.is-zoomed { font-weight: 700; }

/* The three carry .side-button, so they are exactly the size of the mute and
 * freeze buttons at the other end of the bar — and track them at every
 * breakpoint without this file having to know what those are.
 *
 * The readout is the one exception: it is text, so it needs its own width
 * rather than a square. Height comes from .side-button. */
.zoom-cluster .gui-button.zoom-level {
  width: auto;
  min-width: 3.4em;
  padding: 0 10px;
  font-size: 13px;
}

#scrollStage {
  display: block;
  width: max-content;
  height: 100%;
  transform-origin: left top;
  will-change: transform;
  padding-left: 0 !important; /* will be virtual via translate, not real padding */
}

#scoreInner {
  display: inline-block;
  height: 100%;
  line-height: 0;
  width: max-content; /* Let SVG determine width */
  position: relative; /* offset parent for absolutely-positioned overlays */
}

/* --oscilla-zoom multiplies the score's fit size. Local view setting only:
   the transport is world-space, so this never affects sync (scoreZoom.js).
   Set on :root so only the score scales — the UI chrome stays put. */
#scoreInner svg {
  display: block !important;
  max-width: none !important;
  max-height: none !important;
  width: auto;
  height: calc(100vh * var(--oscilla-zoom, 1)) !important; /* fit height × zoom */
}


#scrollStage,
#scoreInner,
#scoreContainer svg {
  /* height: auto !important; */

}

/* ❗ Remove #scoreContainer svg rule entirely */




/* ── Vertical scroll mode overrides ──────────────────────────────── */

body.vertical-scroll #scrollStage {
  width: 100%;
  height: max-content;
}

body.vertical-scroll #scoreInner {
  display: block;
  width: 100%;
  height: max-content;
}

body.vertical-scroll #scoreInner svg {
  display: block !important;
  width: calc(100vw * var(--oscilla-zoom, 1)) !important;
  height: auto !important;
}

/* Playhead becomes a horizontal line spanning the full viewport width */
body.vertical-scroll #playhead {
  top: 50%;
  bottom: auto;
  left: 0;
  right: 0;
  width: 100%;
  height: 4px;
  transform: translateY(-50%);
  border-left: none;
  border-top: 1px dashed rgba(0, 255, 0, 0.8);
}

/* Playzone becomes a full-width horizontal band */
body.vertical-scroll #playzone {
  top: 30% !important;
  left: 0 !important;
  width: 100% !important;
  height: 40% !important;
}

/* Drag handle doesn't apply in vertical mode */
body.vertical-scroll #playhead-offset-handle {
  display: none;
}

/* ─────────────────────────────────────────────────────────────────── */

/* Playzone Styling */
#playzone {
  position: fixed;
  top: 0;
  left: 32.5%;
  /* Center the playzone horizontally (50% - half the width) */
  width: 40%;
  height: 100%;
  /* Full height of the scoreContainer */
  background-color: green;
  opacity: 0.1;
  pointer-events: none;
  /* Prevent interactions with the playzone */
  z-index: 19;
  /* Ensure it is on the correct layer */
}

/* Playhead styling */
#playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: rgba(0, 255, 179, 0.9);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 1;
}

/* Fade-out and Fade-in Effects for Playzone */
#scoreContainer.fade-out,
#playhead.fade-out,
#playzone.fade-out {
  transition: opacity 1s ease-out;
  opacity: 0;
}

#scoreContainer.fade-in,
#playhead.fade-in,
#playzone.fade-in {
  transition: opacity 1s ease-in;
  opacity: 1;
}

/* Keybindings Popup Styling */
#keybindings-popup,
#score-options-popup {
  background: rgba(251, 251, 253, 0.97) !important;
  color: #1f2430 !important;
  border: 1px solid rgba(0, 0, 0, 0.12) !important;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14) !important;
  line-height: 1s.4;
  /* ✅ Adjusts vertical spacing for better readability */


  z-index: 20000;
  /* Ensure it is above the score and playhead */
}

.hidden {
  display: none;
}


/* Remove bullet points from the popup list */
#score-options-popup ul {
  list-style: none;
  padding-left: 0;
  margin: 0.5em 0;
}

/* Style the score option links */
#score-options-popup ul li a {
  text-decoration: none;
  color: #1a6fe0;
  /* sky-300 */
  font-family: 'Courier New', monospace;
  font-weight: bold;
  display: inline-block;
  padding: 4px 0;
}

/* Optional: hover effect for better UX */
#score-options-popup ul li a:hover {
  color: #0d5aaa;
  /* sky-400 */
  text-decoration: underline;
}


#score-options-popup button {
  margin-top: 10px;
  padding: 6px 12px;
  font-size: 14px;
  background-color: #eef0f5;
  color: #1f2430;
  border: 1px solid #c3cad6;
  border-radius: 4px;
  cursor: pointer;
}

#score-options-popup button:hover {
  background-color: #e2e7f0;
}






svg,
svg * {
  pointer-events: all;
  /* Ensure clicks pass through to elements */
}

#black-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0;
  /* Hidden initially */
  pointer-events: none;
  /* Ignore interactions */
  transition: opacity 2s ease;
  /* Smooth fade effect */
  z-index: 9999;
  /* Ensure it overlays everything */
}


/* Score (SVG) styling */

body.inverted #score {
  filter: invert(1);
}

/* #score positioning removed - breaks multi-client sync!
   See dev-sync-architecture.md: position:absolute removes SVG from 
   document flow (parent containers collapse to 0 width) and 
   transition causes visual lag during playback */


/* Fullscreen mode for the score clock - DEPRECATED, see below for fixed version */
/* This is overridden by the .fullscreen-clock styles below */

/*  */

.hidden {
  display: none !important;
}

#keybindings-popup,
#score-options-popup {
  display: block;
  /* Flex or grid if needed */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 400px;
  padding: 20px;
  border: 2px solid black;
  border-radius: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 11200;
  text-align: center;
  pointer-events: all;
}

#ws-toggle-button {
  border: 4px solid;
  /* Define a border */
  border-radius: 5px;
  /* Optional: Rounded corners */
  padding: 5px 10px;
  /* Optional: Padding for better appearance */
  font-size: 16px;
  /* Optional: Adjust font size */
  cursor: pointer;
  /* Indicate it's clickable */
  background-color: gray;
}

#ws-toggle-button.enabled {
  border-color: green;
  /* Green for enabled state */
  color: green;
  /* Optional: Change text color too */
}

#ws-toggle-button.disabled {
  border-color: red;
  /* Red for disabled state */
  color: red;
  /* Optional: Change text color too */
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  border: 2px solid #000;
  border-radius: 10px;
  padding: 0px;
  z-index: 2000;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
  width: 400px;
  max-width: 100%;
  cursor: pointer;
  pointer-events: none;

}

.popup.hidden {
  display: none;
}

.popup h2,
.popup h3 {
  margin: 0 0 10px 0;
  font-size: 1.5em;
}

.popup ul {
  margin: 0;
  padding: 0;
  list-style-type: disc;
  padding-left: 20px;
}

.popup hr {
  border: none;
  border-top: 1px solid #ccc;
  margin: 20px 0;
}

.popup button {
  display: block;
  margin: 10px auto 0 auto;
  padding: 10px 20px;
  background-color: gray;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 1em;
  cursor: pointer;
}

.popup button:hover {
  background-color: #0056b3;
}








/* -------------------------------------  */


/* Active Popup */

#animation-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 70%;
  height: 70%;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid black;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  pointer-events: all;
  overflow: hidden;
  /* Ensures the SVG is contained within the popup */
}

#animation-content {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Maintains aspect ratio while fitting within the container */
  pointer-events: none;
  /* Prevent interaction if not required */
}

#animation-popup svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
  /* Ensure the SVG scales properly */
  pointer-events: all;
  /* Enable interaction with SVG elements */
}


#animation-popup.hidden {
  display: none;
}

/* -------------------------------------  */
#singlePage-container {
  display: none;
  /* Hide by default */
  /* .popup sets cursor:pointer, which turns the whole page into a hand.
     Interactive children (buttons, the countdown) set their own. */
  cursor: default;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 1);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 29999;
  opacity: 0;
  transition: opacity 1s ease-in-out;
  /* pointer-events: auto; ✅ Allows clicking */
  /* cursor: pointer !important; */
}


/* ✅ Make visible when active */
#singlePage-container.active {
  display: flex !important;
  opacity: 1;
}


#singlePage-content {
  /* Center the SVG within the flex container */
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* SVG inside singlePage-content — scale to fit and stay centered.
 *
 * width/height rather than max-*: a max only ever shrinks. Pages carry their
 * authored width="1200" height="800" (12 of the 15 in the corpus do), so a
 * page smaller than the window sat at 1:1 with margins round it and a page
 * larger was scaled down — the same file a different size on every display,
 * and a different size again from the scrolling score, which has always sized
 * itself to the viewport.
 *
 * Giving the element the full box instead lets the viewBox and the default
 * preserveAspectRatio (xMidYMid meet) contain the page inside it, scaling UP
 * as readily as down and keeping its aspect. CSS beats the presentation
 * attributes, so no page file needs editing. The three pages with no viewBox
 * are 0-byte placeholders.
 */
#singlePage-content svg {
  width: 100%;
  height: 100%;
}
/* =========================================
   BASE BUTTON (uses CSS variables from JS)
   JS sets: --btn-bg, --btn-fg (optional)
   ========================================= */
.oscilla-cue-button {
  position: absolute;
  background: var(--btn-bg, #2f2f2f);
  color: var(--btn-fg, #eee);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  padding: 5px 5px 5px 5px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  z-index: 100002;
    box-sizing: border-box;

  transition:
    background-color 0.18s,
    box-shadow 0.18s,
    transform 0.18s,
    color 0.18s,
    border-color 0.18s;
}

/* Hover — subtle lift */
.oscilla-cue-button:hover {
  background: color-mix(in oklab, var(--btn-bg, #2f2f2f) 85%, white 15%);
}

/* Focus ring (keyboard nav) */
.oscilla-cue-button:focus-visible {
  outline: 2px solid #8ecae6;
  outline-offset: 2px;
}

/* =========================================
   TOGGLE MODE (toggle:true)
   While playing: slow, soft pulse + glow
   JS ensures: .oscilla-toggle + .is-on
   ========================================= */
.oscilla-toggle.is-on {
  /* you can override the "on" palette via CSS var if desired */
  --_on-bg: var(--btn-on-bg, #e6b84a);
  --_on-fg: var(--btn-on-fg, #111);

  background: var(--_on-bg);
  color: var(--_on-fg);
  border-color: rgba(0,0,0,0.45);
  box-shadow:
    0 0 10px rgba(255, 210, 90, 0.45),
    inset 0 0 2px rgba(255,255,255,0.5);

  /* Slow pulse while playing */
  animation: oscillaTogglePulse 1.6s ease-in-out infinite;
}

/* Slow pulsing glow for toggle */
@keyframes oscillaTogglePulse {
  0% {
    transform: scale(1);
    box-shadow:
      0 0 8px rgba(255, 210, 90, 0.40),
      inset 0 0 2px rgba(255,255,255,0.45);
    filter: brightness(1.00);
  }
  50% {
    transform: scale(1.03);
    box-shadow:
      0 0 18px rgba(255, 210, 90, 0.75),
      0 0 36px rgba(255, 170, 40, 0.35),
      inset 0 0 3px rgba(255,255,255,0.65);
    filter: brightness(1.06);
  }
  100% {
    transform: scale(1);
    box-shadow:
      0 0 8px rgba(255, 210, 90, 0.40),
      inset 0 0 2px rgba(255,255,255,0.45);
    filter: brightness(1.00);
  }
}

/* =========================================
   MOMENTARY MODE (toggle:false)
   On trigger: quick pulse/flash
   JS ensures: .oscilla-momentary + .flash (brief)
   ========================================= */
.oscilla-momentary.flash {
  animation: oscillaMomentaryFlash 0.26s cubic-bezier(0.25, 0, 0.1, 1);
}

/* Quick flash/pulse — red accent, then settle */
@keyframes oscillaMomentaryFlash {
  0%   { background: #ff4a4a; transform: scale(1.03); box-shadow: 0 0 10px rgba(255,74,74,0.75); }
  60%  { background: #552727; transform: scale(0.985); box-shadow: 0 0 4px rgba(85,39,39,0.35); }
  100% { background: var(--btn-bg, #2f2f2f); transform: scale(1); box-shadow: none; }
}

/* Momentary buttons: show a faster pulse while audio is playing */
.oscilla-momentary.is-on {
  /* You can theme via --btn-on-bg/--btn-on-fg if you like */
  --_on-bg: var(--btn-on-bg, color-mix(in oklab, var(--btn-bg, #814040) 70%, rgb(141, 142, 224) 30%));
  --_on-fg: var(--btn-on-fg, #111);

  background: var(--_on-bg);
  color: var(--_on-fg);
  border-color: rgba(0,0,0,0.4);
  box-shadow:
    0 0 8px rgba(177, 190, 58, 0.5),
    inset 0 0 2px rgba(204, 83, 83, 0.5);

  /* Faster/lighter pulse than toggle */
  animation: oscillaMomentaryPlayingPulse 0.9s ease-in-out infinite;
}

@keyframes oscillaMomentaryPlayingPulse {
  0% {
    transform: scale(1);
    box-shadow:
      0 0 6px rgba(189, 82, 231, 0.45),
      inset 0 0 2px rgba(255,255,255,0.45);
    filter: brightness(1.00);
  }
  50% {
    transform: scale(1.025);
    box-shadow:
      0 0 14px rgba(255, 120, 100, 0.78),
      0 0 26px rgba(255, 110, 90, 0.30),
      inset 0 0 3px rgba(255,255,255,0.6);
    filter: brightness(1.05);
  }
  100% {
    transform: scale(1);
    box-shadow:
      0 0 6px rgba(250, 120, 243, 0.45),
      inset 0 0 2px rgba(255,255,255,0.45);
    filter: brightness(1.00);
  }
}


/* =========================================
   Motion preferences (gentler animations)
   ========================================= */
@media (prefers-reduced-motion: reduce) {
  .oscilla-toggle.is-on { animation: none; }
  .oscilla-momentary.flash { animation-duration: 0.12s; }
}


/* 🔹 Countdown styling */
#singlePage-countdown {
  /* .popup sets pointer-events:none for the whole overlay; #singlePage-content
     opts back in, but the countdown is its sibling — without this the
     click-to-skip handler never sees a click. */
  pointer-events: auto;
  cursor: pointer;
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 48px;
  font-weight: bold;
  color: white;
  background: rgba(0, 0, 0, 0.7);
  padding: 10px 20px;
  border-radius: 10px;
  z-index: 100000;
  display: none;
  /* ✅ Hidden by default */
}

/* 🔹 Ensure the animation container fills the screen */
#singlePage-container object {
  width: auto;
  height: auto;
}

/* 🔹 Prevent interactions with background when the popup is active */
#singlePage-container::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9998;
}

.singlePage-close-button {
  position: absolute !important;
  top: 10px !important;
  right: 10px !important;
  font-size: 48px !important;
  padding: 35px !important;
  background: yellow !important;
  color: black !important;
  border: none !important;
  cursor: pointer !important;
  z-index: 10000 !important;
}


.singlePage-close-button:hover {
  background: darkred;
}

/* Keybindings popup contents — generated from the keymap in
   js/system/keyboardShortcuts.js, so this styles whatever it renders. */
#keybindings-popup,
#midi-popup {
  max-height: 80vh;
  overflow-y: auto;
}

/* .popup is pointer-events:none at z-index 2000 (the page overlay needs
   that); the MIDI panel is a dialog: it takes clicks, and sits above the
   score, the bars and the live console's code over the window (38000) --
   below the start page (40000). It never had this: nothing in it could be
   clicked. */
#midi-popup { min-width: 420px; padding: 18px 22px; pointer-events: auto; z-index: 39000; cursor: default; }
#midi-popup h2 { margin: 0 0 10px; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; }
#midi-popup .midi-status { font-size: 12px; opacity: 0.75; margin-bottom: 12px; }
#midi-popup .midi-status.live { color: #4caf70; opacity: 1; }
#midi-popup table { width: 100%; border-collapse: collapse; font-size: 12px; }
#midi-popup td { padding: 4px 4px; vertical-align: middle; }
#midi-popup td.key { font-family: monospace; white-space: nowrap; }
#midi-popup .learn { font-size: 11px; padding: 3px 8px; }
#midi-popup .learn.armed { background: #e6a700; color: #000; }
#midi-popup .midi-last { font-family: monospace; font-size: 12px; margin-top: 12px; opacity: 0.8; }
#midi-popup .midi-hint { font-size: 11px; opacity: 0.6; margin-top: 10px; line-height: 1.4; }
#midi-popup .midi-chase { margin-top: 14px; padding-top: 10px; border-top: 1px solid rgba(127,127,127,0.3); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 13px; }
#midi-popup .midi-chase input[type="text"], #midi-popup #midi-chase-start { font-family: monospace; font-size: 12px; padding: 2px 4px; }
#midi-popup .midi-chase-status { flex-basis: 100%; font-family: monospace; font-size: 12px; opacity: 0.8; }

#keybindings-popup h2 {
  margin: 0 0 14px;
  font-size: 15px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#keybindings-popup h3 {
  margin: 14px 0 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #5a6b7d;
}

#keybindings-popup table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

#keybindings-popup td {
  padding: 2px 0;
  vertical-align: top;
}

#keybindings-popup td:first-child {
  width: 5.5em;
  white-space: nowrap;
}

#keybindings-popup kbd {
  display: inline-block;
  min-width: 1em;
  padding: 1px 5px;
  border: 1px solid #c3cad6;
  border-bottom-width: 2px;
  border-radius: 3px;
  background: #f3f5f9;
  color: #1f2430;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
}

#close-keybindings {
  position: relative;
  /* ✅ Ensures it stays above any overlapping elements */
  z-index: 5000;
  /* ✅ Ensure it's above other elements */
  pointer-events: auto;
  /* ✅ Allows clicking */
}


#media-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#media-popup.hidden {
  display: none;
}


#pause-countdown {
  position: fixed;
  top: 45px;
  right: 20px;
  width: 70px;
  height: 70px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 3vw;
  font-weight: bold;
  text-align: center;
  border-radius: 10px;
  z-index: 99999;

  /* Start hidden */
  display: none;

  /* ✅ Center contents */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  pointer-events: auto;
  padding: 10px;
}


#pause-countdown:hover {
  z-index: 9999 !important;
  /* ✅ Ensure it's above everything */

  background: white !important;
  /* Invert background */
  color: black !important;
  /* Invert text color */
  border: 2px solid black !important;
  /* Ensure visibility */
}

.pause-header {
  font-size: 12px;
  /* ✅ Smaller font size for header */
  font-weight: normal;
  margin-bottom: 5px;
  /* ✅ Adds space between header and countdown */
}



#video-popup,
#p5-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  padding: 20px;
  border-radius: 10px;
}

#video-content {
  width: 600px;
  height: 400px;
}

#p5-container {
  width: 600px;
  height: 400px;
}



/* ✅ Main container for cue choices */
#cue-choice-container {
  position: fixed;
  width: 100vw;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* width: auto; */
  height: auto;
  /* background: rgba(0, 0, 0, 0.9); */
  padding: 2px;
  border-radius: 10px;
  display: flex;
  /* ✅ Flexbox for horizontal layout */
  flex-wrap: wrap;
  /* ✅ Allows choices to wrap if too many */
  justify-content: center;
  /* ✅ Center items in the container */
  align-items: flex-start;
  /* ✅ Align items at the top */
  gap: 5px;
  /* ✅ Space between choices */
  z-index: 10002;
}

#cue-choice-container.hidden {
  display: none !important;
  /* ✅ Ensures it's hidden properly */
}

#cue-choice-header {
  width: 100%;
  text-align: center;
  /* ✅ Centers the text */
  font-size: 16px;
  /* ✅ Adjust size as needed */
  font-weight: bold;
  margin-bottom: 10px;
  /* ✅ Adds spacing between header and choices */
}


/* ✅ Styling for each cue choice item */
.cue-choice-item {
  display: flex;
  flex-direction: column;
  /* ✅ Ensures SVG is stacked above text */
  align-items: center;
  justify-content: center;
  padding: 10px;
  background: white;
  border-radius: 5px;
  cursor: pointer;
  text-align: center;
  width: 28vw;
  /* ✅ Adjust thumbnail width */
  height: 28vw;
  /* ✅ Adjust thumbnail height */
  overflow: hidden;
  border: 2px solid #000;
  position: relative;
  /* ✅ Allows text to position properly */
}

/* ✅ Style for the SVG thumbnail */
.cue-choice-thumbnail {
  width: 100%;
  height: 150px;
  /* ✅ Adjusted for correct aspect ratio */
  object-fit: contain;
  /* ✅ Keep aspect ratio */
  pointer-events: none;
  /* ✅ Prevents interference with clicks */
}

/* ✅ Style for the text label below the SVG */
.cue-choice-text {
  font-size: 14px;
  color: black;
  margin-top: 5px;
  /* ✅ Space between SVG and text */
  text-align: center;
}

/* ✅ Hover effect */
.cue-choice-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* ✅ Ensures text overlay is properly positioned */
.cue-choice-item div {
  font-size: 14px;
  color: black;
  background: rgba(255, 255, 255, 0.8);
  padding: 5px 10px;
  border: 1px solid black;
  pointer-events: none;
  /* ✅ Prevents blocking clicks */
}

/* ✅ Fix redundant pointer-events */
.cue-choice-item>* {
  pointer-events: none;
  /* ✅ Ensures children do not interfere */
}




.blur-background {
  transition: filter 2s ease-in-out;
  filter: blur(25px);
  pointer-events: none;
  /* Prevent interaction with blurred content */
  user-select: none;
  /* Prevent text selection on blurred content */
}

.unblur-background {
  transition: filter 2s ease-in-out;
  filter: blur(0px);
}


.fade-in {
  opacity: 0;
  transition: opacity 1.5s ease-in-out;
}

.fade-in.active {
  opacity: 1;
}

.fade-out {
  opacity: 1;
  transition: opacity 1.5s ease-in-out;
}

.fade-out.hidden {
  opacity: 0;
}


#rehearsal-popup {
  position: fixed;
  top: 50%;
  left: 10%;
  flex-direction: column;

  /* Start with a centered translate; scale will be applied via JS */
  transform: translate(-20%, -50%) scale(1);
  transform-origin: center;
  /* Optionally constrain maximum width */
  max-width: 35vw;
  z-index: 10002;
  display: none;
  align-items: center;
  background: rgba(0, 0, 0, 0.9);
  /* Dark background for visibility */
  padding: 20px;

  /* Let height be determined by content */
}

#rehearsal-popup.hidden {
  display: none !important;
}

#rehearsal-grid {
  display: flex;
  flex-direction: column;
  /* gap: 8px; */
  /* max-width: 35vw; */

}

.rehearsal-row {
  display: flex;
  gap: 2px;
  justify-content: center;
  /* max-width: 15vw; */

}

.rehearsal-button {
  /* font-size: 1.5vw;  /* Adjust based on desired scaling */

  /* width: 3vw; /* Adjust size as needed */
  /* height: 60px; */
  /* font-size: 30px; */
  color: black;
  text-align: center;
  background: white;
  border: 5px solid black;
  cursor: pointer;
  border-radius: 5px;
  padding: 1px;
  margin: 1px;

}

/* ✅ Button hover effect */
.rehearsal-button:hover {
  background: #ddd;
}





/* ✅ Ensure buttons have a uniform size */
.rehearsal-button {
  width: 60px;
  /* Adjust size as needed */
  height: 60px;
  font-size: 20px;
  color: black;
  text-align: center;
  background: white;
  border: 2px solid black;
  cursor: pointer;
  border-radius: 5px;
}

/* ✅ Button hover effect */
.rehearsal-button:hover {
  background: #ddd;
}

#rehearsal-header {
  color: white;
  font-size: 18px;
  margin-bottom: 10px;
}

/* custom style for button as android makes the unicode one orange yuck */
.custom-pause {
  display: inline-block;
  width: 30px;
  height: 30px;
  position: relative;
  color: white;
}

.custom-pause::before,
.custom-pause::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 100%;
  background: white;
  /* Set desired color here */
  border-radius: 2px;
}

.custom-pause::before {
  left: 4px;
}

.custom-pause::after {
  right: 4px;
}



@keyframes osc-flash {

  0%,
  100% {
    filter: none;
  }

  50% {
    filter: brightness(1.6);
  }
}

@keyframes osc-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

@keyframes osc-fade {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .6;
  }
}



















#oscilla-uid-sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 200px;
  width: 240px;
  background: #111;
  border-right: 1px solid #444;
  z-index: 100000;
  padding: 6px 0 0 0;
  display: none;
}

#oscilla-uid-search {
  width: 100%;
  box-sizing: border-box;
  background: #222;
  color: #eee;
  border: none;
  border-bottom: 1px solid #333;
  padding: 6px 8px;
  font-family: monospace;
  font-size: 13px;
  outline: none;
}

#oscilla-uid-list {
  overflow-y: auto;
  height: calc(100% - 36px);
  padding-top: 4px;
}

.oscilla-uid-item {
  padding: 3px 8px;
  cursor: pointer;
  font-family: monospace;
  border-bottom: 1px solid #222;
  color: #ccc;
}

.oscilla-uid-item:hover {
  background: #333;
  color: #0f0;
}



.cue-video-fullscreen {
  z-index: 999999;        /* ensure on top */
  pointer-events: none;   /* prevent blocking overlay interaction */
  object-fit: cover;      /* fill frame gracefully */
}




/* Before JS runs, hide any element declaring a cue text(...) */
/* [id^="text("] {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
} */




/* Oscilla animation hit labels */
.oscilla-hitlabel {
    position: absolute;
    padding: 2px 6px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: auto;
    cursor: pointer;
    z-index: 99999999 !important;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 120ms ease;
}

.oscilla-hitlabel.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Keep OSC cluster stable */
.osc-monitor {
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
}

.osc-monitor .osc-line {
  min-width: 220px;
  max-width: 320px;
  font-size: x-small;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* (Shoelace safe-triangle workaround removed — no longer needed) */


/* Annotation styles moved to oscillaAnnotations.css */


.oscilla-synth-overlay {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;          /* ← key line */
  line-height: 1.4;
  white-space: nowrap;

  padding: 2px 7px;
  border-radius: 4px;

  background: rgba(255, 255, 255, 0.2);
  color: #000;

  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Default: always readable */
.oscilla-synth-overlay {
  opacity: 0.75;
  transition:
    opacity 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

/* Active moment (when cue fires or retriggers) */
.oscilla-synth-overlay.is-active {
  opacity: 1;
  background: rgba(200, 0, 200, 0.12);
  border-left: 3px solid rgba(200, 0, 200, 0.7);
}


.oscilla-audio-overlay {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  color: #000;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  opacity: 0.75;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.oscilla-audio-overlay.is-active {
  opacity: 1;
  background: rgba(0, 150, 200, 0.12);
  border-left: 3px solid rgba(0, 150, 200, 0.7);
}



/* =============================================================================
/* ============================================================================
 * MINIMAL CSS PATCH - ONLY adds missing styles
 * Does NOT change any existing layout, z-index, or display logic
 * ============================================================================ */

/* ============================================================================
/* ============================================================================
 * 3. NIGHT MODE / INVERT
 * ============================================================================ */

body.inverted #score {
  filter: invert(1);
}

/* #score positioning removed - see note above */

/* ============================================================================
 * 5. ANNOTATION BUTTON - Float to right near mode toggle
 * ============================================================================ */

#annotation-toggle {
  margin-left: auto;  /* Float to the right */
  margin-right: 6px;
}
/* ============================================================================
 * MODALS & POPUPS - CLEANER BACKDROP
 * ============================================================================ */

#error-modal {
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

#error-content {
  background: #1a1a1e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}


/* ============================================================================
 * SCORE BROWSER - REFINED
 * ============================================================================ */

#score-browser {
  background: rgba(0, 0, 0, 0.97);
  backdrop-filter: blur(10px);
}

.score-card {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.score-card:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ============================================================================
 * PAGE MODE Z-INDEX FIX
 * ============================================================================ */

/* 
 * Z-INDEX HIERARCHY (lowest to highest):
 * 
 * 25000 - Page content (singlePage-container)
 * 30000 - Controls bar (bottom transport)
 * 35000 - Top bar  
 * 40000 - ControlXY panels
 * 50000 - Modals/dialogs
 */

/* Page content - base layer when in page mode */
#singlePage-container {
  z-index: 25000;
  touch-action: none;
}

#singlePage-container.active {
  z-index: 25000 !important;
}

/* Transport bars - above page content so always accessible */
#controls {
  z-index: 30000 !important;
}

#top-bar {
  z-index: 35000 !important;
}

/* Shortcut help is a modal: above both transport bars, below screen lock.
   Overrides the two lower z-index values this popup picks up earlier in
   the file (20000, then 11200 — the later of which was winning, putting
   it under the toolbars). */
#keybindings-popup {
  z-index: 45000 !important;
}

/* Ensure content inside is interactive */
#singlePage-content {
  z-index: 1;
  position: relative;
  touch-action: none;
}

/* SVG inside page content needs touch-action: none for controlXY dragging */
#singlePage-content svg {
  touch-action: none;
}

/* ControlXY panels need to be above transport */
#controlxy-preset-panel,
.controlxy-panel,
.controlxy-container,
[class*="controlxy-panel"] {
  z-index: 40000 !important;
}

/* Waveform overlays should not capture pointer events */
.oscilla-waveform,
.oscilla-waveform * {
  pointer-events: none !important;
}

/* =========================================
   SCREEN LOCK OVERLAY (Pocket Mode)
   ========================================= */
.screen-lock-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  /* Use dynamic viewport so iOS Safari doesn't include URL-bar /
   * home-indicator regions — those were hiding the unlock buttons. */
  height: 100dvh;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Allow scrolling on short viewports so the audio-unlock button is
   * always reachable in iPhone landscape. */
  overflow-y: auto;
  /* Reserve space below the lock-message for the home-indicator. */
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)) 16px;
  touch-action: none;
  backdrop-filter: blur(2px);
}

/* Compact layout for short viewports (typically iPhone landscape).
 * Shrinks padding and font sizes so all unlock controls fit on
 * screen without scrolling. */
@media (max-height: 500px) {
  .screen-lock-overlay .lock-message {
    padding: 12px 20px !important;
  }
  .screen-lock-overlay .lock-message svg {
    width: 28px;
    height: 28px;
    margin-bottom: 6px !important;
  }
  .screen-lock-overlay .lock-project-info { margin-bottom: 8px !important; }
  .screen-lock-overlay .lock-project-info h1 { font-size: 18px !important; }
  .screen-lock-overlay .lock-project-info p  { font-size: 12px !important; margin: 2px 0 !important; }
  .screen-lock-overlay .lock-project-info .lock-client { margin-top: 6px !important; font-size: 12px !important; }
  .screen-lock-overlay .lock-message p { font-size: 13px !important; margin: 4px 0 !important; }
  .screen-lock-overlay .lock-buttons { gap: 8px !important; margin-top: 10px !important; }
  .screen-lock-overlay .lock-btn { padding: 8px 14px !important; min-width: 96px; font-size: 12px !important; }
  .screen-lock-overlay .lock-btn svg { width: 18px; height: 18px; }
}

.screen-lock-overlay.hidden {
  display: none;
}

.screen-lock-overlay .lock-message {
  text-align: center;
  color: #888;
  user-select: none;
  cursor: pointer;
  padding: 32px 48px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px dashed rgba(255, 255, 255, 0.2);
  transition: all 0.2s ease;
}

.screen-lock-overlay .lock-message:active {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(0.98);
}

.screen-lock-overlay .lock-message svg {
  color: #ccc;
  margin-bottom: 16px;
}

.screen-lock-overlay .lock-message p {
  margin: 8px 0;
  font-size: 18px;
  color: #ddd;
}

/* Lock overlay project info */
.screen-lock-overlay .lock-project-info {
  margin-bottom: 24px;
}

.screen-lock-overlay .lock-project-info h1 {
  margin: 0 0 8px 0;
  font-size: 28px;
  font-weight: 600;
  color: #fff;
}

.screen-lock-overlay .lock-project-info p {
  margin: 4px 0;
  font-size: 16px;
  color: #aaa;
}

.screen-lock-overlay .lock-project-info p:empty {
  display: none;
}

.screen-lock-overlay .lock-project-info .lock-client {
  margin-top: 16px;
  font-size: 14px;
  color: #6af;
}

/* Lock overlay buttons */
.screen-lock-overlay .lock-buttons {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  justify-content: center;
}

.screen-lock-overlay .lock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ddd;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 120px;
}

.screen-lock-overlay .lock-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.screen-lock-overlay .lock-btn:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.3);
}

.screen-lock-overlay .lock-btn svg {
  color: #ccc;
  margin-bottom: 0;
}

/* Audio unlocked state */
.screen-lock-overlay .lock-btn.audio-unlocked {
  border-color: #44cc44;
  background: rgba(68, 204, 68, 0.2);
}

.screen-lock-overlay .lock-btn.audio-unlocked svg {
  color: #44cc44;
}

/* Lock button active state */
#screen-lock-button.active {
  background: #446688 !important;
  color: white !important;
}

/* Transport-only lock state (different color) */
#screen-lock-button.transport-locked {
  background: #664488 !important;
  color: white !important;
}

/* Transport isolated — receives OSC but ignores incoming transport messages */
#screen-lock-button.transport-isolated {
  background: #336688 !important;
  color: white !important;
}

/* Lock options popup - positioned by JS */
.lock-options-popup {
  position: fixed;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 100000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.lock-options-popup.hidden {
  display: none;
}

.lock-option-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: #ccc;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
}

.lock-option-btn:hover {
  background: #444;
  color: white;
}

.lock-option-btn svg {
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────────────────────────────
   Print / PDF export — hide UI chrome.
   Layout (container position, scrollStage transform, SVG size) is
   handled by printScore() in projectScoreSetup.js via inline styles —
   CSS @media print cannot reliably override position:fixed + overflow:hidden
   in Chrome.
   ──────────────────────────────────────────────────────────────────── */
@media print {
  @page {
    size: auto;
    margin: 0;
  }

  #topbar,
  .gui-cluster,
  #bottomBar,
  .bottom-bar,
  #playhead,
  #playzone,
  #playhead-offset-handle,
  .oscilla-overlay,
  .oscilla-dialog-panel,
  .screen-lock-overlay,
  #inkscape-hint-overlay,
  #inkscape-hint-dialog,
  #black-overlay,
  #singlePage-overlay,
  .oscilla-dropdown,
  .oscilla-hitlabel,
  .oscilla-synth-overlay,
  .oscilla-audio-overlay {
    display: none !important;
  }

  html, body {
    overflow: visible !important;
    height: auto !important;
    width: auto !important;
    background: white !important;
  }
}

/* Top-bar page picker (page view only); colours come from the transport theme */
#page-select {
  font: inherit;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  max-width: 160px;
}

/* Public preview: a guest only reads (socket.js becomePublicGuest), so what
   would edit the project, rejoin the room or command the other clients is
   not offered. The server refuses it anyway. */
.public-guest #ws-toggle-button,
.public-guest #new-project-btn,
.public-guest #import-project-btn,
.public-guest #notation-edit-toggle,
.public-guest #dsl-record-object,
.public-guest #oscilla-demo-notice,
.public-guest #hamburger-dropdown .oscilla-menu-item:is(
  [data-value="project-new"], [data-value="project-duplicate"],
  [data-value="score-versions"], [data-value="page-new"],
  [data-value="audio-files"], [data-value="project-import"],
  [data-value="force-reload-all"], [data-value="reload-from-disk"],
  [data-value="mute-all"], [data-value="unmute-all"],
  [data-value="kill-audio-all"]) {
  display: none !important;
}
