/* Button and control styles */
.bottom-actions{
  position:fixed;
  z-index: 1002;
  left:50%;
  transform: translateX(-50%);
  bottom:110px;
  margin-top:0;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:0;
  opacity: 0;
  pointer-events: none;
  width: 300px;
  max-width: 80vw;
  transition: opacity 2.0s ease;
}

.volume-control-group {
  position: relative;
  margin-right: 12px;
  display: flex;
  align-items: center;
}

#volumeToggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background: #000 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.81 5 3.52 5 6.71s-2.11 5.9-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>') center center / 60% no-repeat;
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 16px rgba(var(--skin-glow-color), 0.7), 
    0 10px 22px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
#volumeToggle:active {
  transform: translateY(1px);
}

.volume-popup {
  position: absolute;
  bottom: 75px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 10, 20, 0.75);
  backdrop-filter: blur(8px);
  padding: 10px 14px;
  border-radius: 12px;
  width: 140px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4), 0 0 12px rgba(var(--skin-glow-color), 0.3);
  z-index: 1005;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.volume-popup[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

#volumeSlider {
  width: 100%;
  margin: 0;
}

#settingsToggle,
#playRound{
  width:75px; height:75px; border-radius:50%;
  border:none; cursor:pointer;
  background:#000;
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 16px rgba(var(--skin-glow-color), 0.7),
    0 10px 22px rgba(0,0,0,0.35);
  position:relative;
}

.bpm-stepper{
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 30px;
  display: flex;
  gap: 12px;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.0s ease;
}
.bpm-stepper button{
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  background:#000;
  color: var(--fg);
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 16px rgba(var(--skin-glow-color), 0.7),
    0 10px 22px rgba(0,0,0,0.35);
}
.bpm-stepper button:active{
  transform: translateY(1px);
}

#settingsToggle {
  width: 60px;
  height: 60px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#fullscreenToggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

#settingsToggle {
  background: #000 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.38-1.09-.69-1.7-.93L13.9 3.19c-.04-.2-.22-.34-.41-.34h-4c-.19 0-.37.14-.41.34L8.09 6.27c-.6.24-1.18.55-1.7.93l-2.49-1c-.23-.09-.49-.01-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.38 1.09.69 1.7.93l.35 3.09c.04.2.22.34.41.34h4c.19 0 .37-.14.41-.34l.35-3.09c.6-.24 1.18-.55 1.7-.93l2.49 1c.23.09.49.01.61-.22l2-3.46c.13-.22.07-.49-.12-.64l-2.11-1.65zm-4.47-2.92c-.59.59-.59 1.54 0 2.12.59.59 1.54.59 2.12 0 .59-.59.59-1.54 0-2.12-.59-.59-1.54-.59-2.12 0z"/></svg>') center center / 60% no-repeat;
}

#playRound{
  width: 250px;
  max-width: 100%;
  height: 60px;
  border-radius: 30px; 
  opacity: 1; 
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg);
  transition: background 0.1s ease;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 16px rgba(var(--skin-glow-color), 0.7),
    0 10px 22px rgba(0,0,0,0.35);
}

#playRound::before{
  content:'START';
  position: static;
}
#playRound.playing::before{
  content:'Pause';
}

#playRound.playing{
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  box-shadow:
    inset 6px 6px 14px rgba(0,0,0,0.2),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 8px rgba(var(--skin-glow-color), 0.4),
    0 4px 12px rgba(0,0,0,0.5);
}

#settingsToggle::before{
  content:none;
}

.corner-actions {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  z-index: 1002;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.0s ease;
}

#helpToggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: #000;
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 16px rgba(var(--skin-glow-color), 0.7),
    0 10px 22px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.0s ease;
}
#helpToggle::before {
  content: 'i';
  font-size: 28px;
  font-weight: 800;
  font-style: italic;
  color: white;
  line-height: 1;
}

#helpToggle:hover {
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 16px rgba(0,0,0,0.8),
    0 10px 22px rgba(0,0,0,0.35);
}

body.ui-visible #helpToggle { opacity: 1; pointer-events: auto; }
body.inactive-ui #helpToggle { opacity: 0.1; }

.help-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-y: auto;
  padding: 20px;
}
.help-popup[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}
.help-content {
  background: linear-gradient(135deg, rgba(5,15,30,0.95), rgba(0,10,20,0.95));
  border: 1px solid rgba(var(--skin-glow-color), 0.3);
  border-radius: 16px;
  width: min(680px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 
    0 20px 60px rgba(0,0,0,0.6), 
    0 0 30px rgba(var(--skin-glow-color), 0.2),
    inset 0 1px 0 rgba(255,255,255,0.05);
  padding: 0;
  color: var(--fg);
  position: relative;
}
.help-close {
  position: sticky;
  top: 12px;
  right: 12px;
  float: right;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 12px rgba(var(--skin-glow-color), 0.4);
  z-index: 10;
  transition: transform 0.2s ease;
}
.help-close:hover {
  transform: scale(1.1);
}
.help-body {
  padding: 24px 28px 28px;
  clear: both;
}
.help-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 24px;
}
.help-logo {
  width: 80px;
  height: 80px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(var(--skin-glow-color), 0.4));
}
.help-header h2 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff, rgba(var(--skin-glow-color), 1));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.help-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 1px;
}
.help-section {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.help-section:last-of-type {
  border-bottom: none;
}
.help-section h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.feature-item {
  margin-bottom: 16px;
  padding-left: 12px;
  border-left: 2px solid rgba(var(--skin-glow-color), 0.3);
}
.feature-item:last-child {
  margin-bottom: 0;
}
.feature-item strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: 0.3px;
}
.feature-item p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
}
.feature-item p:last-child {
  margin-bottom: 0;
}
.help-steps {
  margin: 0;
  padding-left: 24px;
  font-size: 13px;
  line-height: 1.8;
  color: rgba(255,255,255,0.9);
}
.help-steps li {
  margin: 6px 0;
}
.help-steps strong {
  color: #fff;
  font-weight: 700;
}
.help-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  text-align: center;
}
.help-footer p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Custom scrollbar for help content */
.help-content::-webkit-scrollbar {
  width: 8px;
}
.help-content::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
}
.help-content::-webkit-scrollbar-thumb {
  background: rgba(var(--skin-glow-color), 0.4);
  border-radius: 4px;
}
.help-content::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--skin-glow-color), 0.6);
}

#volumeToggle:hover,
#settingsToggle:hover,
#playRound:hover,
#bpmDown:hover,
#bpmUp:hover,
#fullscreenToggle:hover {
  box-shadow:
    inset 6px 6px 14px rgba(255,255,255,0.06),
    inset -10px -14px 22px rgba(0,0,0,0.5),
    0 0 16px rgba(0,0,0,0.8),
    0 10px 22px rgba(0,0,0,0.35);
}

/* Mobile bottom row */
@media (max-width: 600px) {
  .bpm-stepper{
    bottom: 24px;
    gap: 10px;
    left: 12px;
    transform: none;
    justify-content: flex-start;
  }

  .bottom-actions { 
    position:fixed;
    left:50%;
    transform:translateX(-50%);
    bottom:110px;
    width: 90vw;
  }
  .volume-control-group {
    margin-right: 10px;
  }
  #settingsToggle { 
    width: 60px;
    height: 60px; 
    border-radius:50%; 
  }
  #playRound {
    width: 125px;
    height: 50px;
    border-radius: 25px;
  }
  #volumeToggle {
    width: 50px;
    height: 50px;
  }
  .volume-popup {
    bottom: 60px;
    width: 120px;
    padding: 8px 10px;
  }
  .corner-actions {
    right: 12px;
    bottom: 24px;
    gap: 10px;
  }
  #settingsToggle {
    width: 50px;
    height: 50px;
  }
  #fullscreenToggle {
    display: none;
  }

  .bottom-actions,
  .bpm-stepper,
  .corner-actions {
    display: none !important;
  }

  .mobile-bottom-row {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 24px;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    padding: 0 12px;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 2.0s ease;
  }
  body.ui-visible .mobile-bottom-row { opacity: 1; pointer-events: auto; }

  .mobile-bottom-row #bpmDown,
  .mobile-bottom-row #bpmUp {
    width: 45px;
    height: 45px;
    font-size: 26px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--skin-glow-color),0.2) 0%, rgba(var(--skin-glow-color),0.2) 55%, rgba(0,0,0,1) 100%);
    filter: saturate(var(--mask-saturation));
    box-shadow: inset 6px 6px 14px rgba(255,255,255,0.06), inset -10px -14px 22px rgba(0,0,0,0.5), 0 0 16px rgba(var(--skin-glow-color),0.49), 0 10px 22px rgba(0,0,0,0.35);
  }

  #helpToggle {
    top: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
  }

  .help-content {
    width: 94vw;
    max-height: 82vh;
    border-radius: 12px;
  }
  .help-body {
    padding: 20px 16px;
  }
  .help-logo {
    width: 64px;
    height: 64px;
  }
  .help-header h2 {
    font-size: 24px;
  }
  .help-section h3 {
    font-size: 16px;
  }
  .feature-item strong {
    font-size: 13px;
  }
  .feature-item p {
    font-size: 12px;
  }
}

/* Desktop bottom row */
@media (min-width: 601px) {
  .bottom-actions,
  .bpm-stepper,
  .corner-actions {
    display: none !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }

  .desktop-bottom-row {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    gap: 10px;
    z-index: 1100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 2.0s ease;
  }

  .desktop-bottom-row #bpmDown,
  .desktop-bottom-row #bpmUp {
    width: 60px;
    height: 60px;
    font-size: 30px;
    border-radius: 50%;
    background: rgba(var(--skin-glow-color), 0.2);
    filter: saturate(var(--mask-saturation));
    box-shadow: none;
    border: none;
    outline: none;
    color: var(--fg);
    font-weight: 800;
    line-height: 1;
  }

  .desktop-bottom-row #playRound {
    width: 180px;
    height: 60px;
    border-radius: 30px;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--fg);
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
    box-shadow:
      inset 6px 6px 14px rgba(255,255,255,0.06),
      inset -10px -14px 22px rgba(0,0,0,0.5),
      0 0 16px rgba(var(--skin-glow-color), 0.7),
      0 10px 22px rgba(0,0,0,0.35);
  }

  .desktop-bottom-row #volumeToggle,
  .desktop-bottom-row #settingsToggle,
  .desktop-bottom-row #fullscreenToggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: #000;
    box-shadow:
      inset 6px 6px 14px rgba(255,255,255,0.06),
      inset -10px -14px 22px rgba(0,0,0,0.5),
      0 0 16px rgba(var(--skin-glow-color), 0.7),
      0 10px 22px rgba(0,0,0,0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
  }

  .desktop-bottom-row #volumeToggle,
  .desktop-bottom-row #settingsToggle,
  .desktop-bottom-row #fullscreenToggle {
    background-color: rgba(var(--skin-glow-color), 0.2);
    filter: saturate(var(--mask-saturation));
  }

  .desktop-bottom-row #volumeToggle {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.81 5 3.52 5 6.71s-2.11 5.9-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60%;
  }

  .desktop-bottom-row #settingsToggle {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.38-1.09-.69-1.7-.93L13.9 3.19c-.04-.2-.22-.34-.41-.34h-4c-.19 0-.37.14-.41.34L8.09 6.27c-.6.24-1.18.55-1.7.93l-2.49-1c-.23-.09-.49-.01-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.38 1.09.69 1.7.93l.35 3.09c.04.2.22.34.41.34h4c.19 0 .37-.14.41-.34l.35-3.09c.6-.24 1.18-.55 1.7-.93l2.49 1c.23.09.49.01.61-.22l2-3.46c.13-.22.07-.49-.12-.64l-2.11-1.65zm-4.47-2.92c-.59.59-.59 1.54 0 2.12.59.59 1.54.59 2.12 0 .59-.59.59-1.54 0-2.12-.59-.59-1.54-.59-2.12 0z"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 60%;
  }

  #fullscreenToggle::before{
    content: 'F';
    font-size: 28px;
    font-weight: 700;
    color: var(--fg);
    line-height: 1;
  }

  .desktop-bottom-row #helpToggle {
    background-color: rgba(var(--skin-glow-color), 0.2);
    filter: saturate(var(--mask-saturation));
  }


}