/* ============================================
   SLIM HEADER + HAMBURGER DRAWER
   ============================================ */
#bb-header {
  position: sticky;
  top: 0;
  z-index: 8000;
  background: rgba(10, 10, 20, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 16px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#bb-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

#bb-hamburger {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px;
  background: none;
  border: none;
  -webkit-tap-highlight-color: transparent;
}
#bb-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #e8e8e8;
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
#bb-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
#bb-hamburger.open span:nth-child(2) {
  opacity: 0;
}
#bb-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

#bb-logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 600;
  color: #e8e8e8;
  letter-spacing: 0.5px;
  text-decoration: none;
}

#bb-header-right {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.5px;
}

/* ---- NAV DRAWER (slides down from header) ---- */
#bb-nav-drawer {
  position: fixed;
  top: 48px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7999;
  background: rgba(10, 10, 20, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
#bb-nav-drawer.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

#bb-nav-drawer-content {
  padding: 8px 0 40px;
}

/* Prevent body scroll when drawer is open */
body.drawer-open {
  overflow: hidden;
}

/* ============================================
   CUBE CONTAINER — INCREASED HEIGHT
   ============================================ */
.housecube {
  margin: 0 auto;
  display: block;
  width: 100%;
  max-width: 650px;
  height: 620px !important;
  position: relative;
  cursor: grab;
  overflow: hidden;
}

@media (max-width: 600px) {
  .housecube {
    height: 700px !important;
  }
  #bottom-bar {
    gap: 6px !important;
    bottom: 8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    white-space: normal !important;
    max-width: 90vw !important;
    justify-content: center !important;
  }
  #controls-hud { display: none !important; }
  #pack-fab, #fullscreen-btn {
    padding: 0 12px !important;
    height: 34px !important;
    border-width: 1.5px !important;
    border-radius: 6px !important;
    font-size: 0.6rem !important;
    flex-shrink: 0 !important;
  }
  #fullscreen-btn svg { width: 12px !important; height: 12px !important; }
}

.grabbing { cursor: grabbing !important; }

/* ============================================
   A-FRAME CONTAINMENT OVERRIDES
   ============================================ */
.housecube {
  position: relative !important;
  overflow: hidden !important;
}
.housecube a-scene,
.housecube .a-scene {
  position: absolute !important;
  top: 0 !important; left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  z-index: 0 !important;
}
.housecube a-scene canvas,
.housecube .a-canvas {
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  top: 0 !important; left: 0 !important;
  aspect-ratio: unset !important;
}
html.a-html,
html.a-html body,
html.a-html body.a-body {
  overflow: visible !important;
  height: auto !important;
  width: auto !important;
  position: static !important;
  margin: initial !important;
}
.a-scene .a-canvas + div,
.a-scene > .a-enter-vr,
.a-scene > .a-orientation-modal {
  display: none !important;
}

/* ============================================
   BOTTOM BAR + HUD
   ============================================ */
#bottom-bar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 8px;
  z-index: 1000;
  white-space: nowrap;
}

#controls-hud, #pack-fab, #fullscreen-btn {
  background: rgba(0, 0, 0, 0.75);
  border: 2px solid #00ff00;
  border-radius: 8px;
  font-family: sans-serif;
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: 38px;
  box-sizing: border-box;
}

#controls-hud {
  gap: 15px;
  font-size: 0.75rem;
  color: white;
  pointer-events: none;
  white-space: nowrap;
}
.hud-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }

#pack-fab {
  color: #00ff00;
  font-size: 0.65rem;
  font-weight: bold;
  cursor: pointer;
  pointer-events: all;
  letter-spacing: 1px;
  text-transform: uppercase;
  flex-shrink: 0;
  gap: 4px;
}
#pack-fab:active { background: rgba(0, 255, 0, 0.2); }

/* ============================================
   PACK OVERLAY
   ============================================ */
#pack-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  font-family: 'Segoe UI', sans-serif;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 30px 0 20px;
}
#pack-overlay.visible { display: flex; }

#pack-header { text-align: center; margin-bottom: 20px; flex-shrink: 0; }
#pack-header h2 {
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 0 0 4px;
}
#pack-header p { color: #555; font-size: 0.65rem; letter-spacing: 1px; }

#pack-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  padding: 0 16px;
  flex-shrink: 0;
}

.pack-card {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 10px;
  cursor: pointer;
  pointer-events: all;
  transition: border-color 0.25s, background 0.25s, transform 0.15s;
  text-align: center;
}
.pack-card:active { transform: scale(0.96); }
.pack-card .pack-name {
  color: #ccc;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  transition: color 0.25s;
}
.pack-card .pack-badge {
  display: inline-block;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  margin-top: 5px;
}
.pack-card .badge-included { background: rgba(0,255,0,0.12); color: #00cc44; }
.pack-card .badge-cached  { background: rgba(0,180,255,0.12); color: #00aaff; }
.pack-card .badge-download { background: rgba(255,255,255,0.06); color: #666; }

.pack-card.active {
  border-color: #00ff00;
  background: linear-gradient(135deg, rgba(0,255,0,0.1) 0%, rgba(0,255,0,0.02) 100%);
}
.pack-card.active .pack-name { color: #00ff00; }
.pack-card.active .pack-badge { display: none; }
.pack-card.active::after {
  content: 'NOW PLAYING';
  display: block;
  font-size: 0.45rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #00ff00;
  margin-top: 5px;
}

.pack-card.loading { pointer-events: none; border-color: rgba(255,136,0,0.4); }
.pack-card.loading .pack-name { color: #ff8800; }
.pack-card.loading .pack-badge { display: none; }
.pack-card.loading::after {
  content: '';
  display: block;
  width: 80%;
  height: 3px;
  background: rgba(255,136,0,0.15);
  border-radius: 2px;
  margin: 6px auto 0;
  overflow: hidden;
  position: relative;
}
.pack-card.loading::before {
  content: '';
  position: absolute;
  bottom: 12px;
  left: 15%;
  width: 30%;
  height: 3px;
  background: #ff8800;
  border-radius: 2px;
  animation: packLoadSlide 1s ease-in-out infinite;
}
@keyframes packLoadSlide { 0%{left:15%} 50%{left:55%} 100%{left:15%} }

#pack-status {
  color: #ff8800;
  font-size: 0.65rem;
  margin-top: 12px;
  height: 1.2em;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
#pack-close-area {
  margin-top: 14px;
  padding: 10px 24px;
  color: #444;
  font-size: 0.65rem;
  letter-spacing: 1px;
  cursor: pointer;
  pointer-events: all;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 6px;
  transition: color 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
#pack-close-area:active { color: #888; border-color: rgba(255,255,255,0.15); }

/* ============================================
   FULLSCREEN BUTTON + MODE
   ============================================ */
#fullscreen-btn {
  color: #00ff00;
  cursor: pointer;
  pointer-events: all;
  flex-shrink: 0;
  gap: 5px;
  justify-content: center;
}
#fullscreen-btn:active { background: rgba(0, 255, 0, 0.2); }
#fullscreen-btn svg { width: 14px; height: 14px; fill: #00ff00; }

.housecube.is-fullscreen {
  position: fixed !important;
  top: 0 !important; left: 0 !important;
  width: 100vw !important; height: 100vh !important;
  max-width: none !important;
  z-index: 9999 !important;
  background: #050510 !important;
  border-radius: 0 !important;
}

/* ============================================
   FULLSCREEN STARFIELD CANVAS
   ============================================ */
#audio-bg-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  display: none;
}
.housecube.is-fullscreen #audio-bg-canvas {
  display: block;
}
.housecube.is-fullscreen .a-scene,
.housecube.is-fullscreen a-scene {
  z-index: 1 !important;
}
.housecube.is-fullscreen #bottom-bar,
.housecube.is-fullscreen #pack-overlay {
  z-index: 1002 !important;
}

/* ============================================
   TEMPO SLIDER
   ============================================ */
#tempoSlider {
  -webkit-appearance: none;
  appearance: none;
  width: 200px;
  height: 6px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
#tempoSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00ff00;
  border: 2px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 6px rgba(0, 255, 0, 0.4);
  cursor: pointer;
}
#tempoSlider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #00ff00;
  border: 2px solid rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 6px rgba(0, 255, 0, 0.4);
  cursor: pointer;
}

/* ============================================
   TEMPO + RECORDING ROWS
   ============================================ */
.tempo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
  margin-bottom: 8px;
}
.tempo-row label {
  color: white;
  font-family: sans-serif;
  font-size: 0.9rem;
}
.tempo-value {
  color: #00ff00;
  font-family: monospace;
  font-size: 0.85rem;
  min-width: 36px;
  text-align: center;
}
.tempo-reset-btn {
  background: rgba(0, 255, 0, 0.1);
  border: 1px solid rgba(0, 255, 0, 0.3);
  color: #00ff00;
  font-size: 0.7rem;
  font-family: sans-serif;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tempo-reset-btn:hover {
  background: rgba(0, 255, 0, 0.2);
  border-color: #00ff00;
}

.recording-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 20px;
}

.piano-drop-container {
  margin-top: 10px;
}