html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

body {
  background: #222;
  color: #fff;
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  width: 100vw; /* Ensure body takes full viewport width */
  position: relative; /* Establish positioning context */
}



.midimind-header {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  color: #f7b9a1; 
}

.logo-section {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 2px;
  height: 2px;
  padding: 100px 0;

}

/* Left sidebar tab - Claude style */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: 48px;
  height: 100vh;
  background: #000000;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(50px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  z-index: 1000;
}

/* Mobile header - hidden by default */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  background: #000000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(50px);
  z-index: 999;
  padding: 0 15px;
  align-items: center;
  justify-content: space-between;
}

.mobile-logo {
  display: flex;
  align-items: center;
}

.mobile-header-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-menu-btn {
  background: transparent;
  border: 1px solid #f7b9a1;
  border-radius: 6px;
  color: #f7b9a1;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
}

.mobile-menu-btn:active {
  background: rgba(247, 185, 161, 0.1);
}

.sidebar-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid #f7b9a1;
  border-radius: 6px;
  color: #f7b9a1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-bottom: 12px;
  font-size: 0; /* Hide any text, show only icon */
}

.sidebar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
  transform: translateX(2px);
}

.sidebar-btn svg {
  display: block;
}



/* Adjust main container to account for sidebar */
.main-container {
  margin-left: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;       /* Center all children */
  width: calc(100vw - 48px);
  
  /* Account for sidebar */
}

/* Landing page specific styles */
.landing-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
  background: url('/static/backboy.png');
}

.landing-container {
  margin-left: 48px;
  display: flex;
  flex-direction: column;  /* Stack header above prompt box */
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: calc(100vw - 48px);
}

/* Pre page specific header above prompt box */
.pre-landing-header {
  text-align: center;
  margin-bottom: 40px;
  width: 50%;              /* Match prompt box width */
  max-width: 1200px;       /* Match prompt box max-width */
}

.pre-landing-title {
  font-size: 2rem;
  font-weight: 700;
  color: #f7b9a1; /* yeeboi */
  margin: 0 0 12px 0;
  font-family: 'Inter', Arial, sans-serif;
  letter-spacing: -0.02em;
}

.landing-prompt-section {
  width: 50%;              /* Match the main page exactly */
  max-width: 1200px;       /* Match the main page exactly */
  margin: 0;
}

#piano-roll-container > div {
  scrollbar-width: thin;
  scrollbar-color: #444 #181818;
}

/* For Webkit browsers (Chrome, Edge, Safari) */
#piano-roll-container > div::-webkit-scrollbar {
  width: 10px;
  height: 10px;
  background: #181818;
}

#piano-roll-container > div::-webkit-scrollbar-thumb {
  background: #444;
  border-radius: 6px;
  border: 2px solid #181818;
}

#piano-roll-container > div::-webkit-scrollbar-thumb:hover {
  background: #666;
}

#piano-roll-container > div::-webkit-scrollbar-corner {
  background: #181818;
}

.piano-roll-container {
  position: relative;
  width: 100%;               /* Responsive width */
  max-width: 1200px;         /* Maximum width for large screens */
  height: auto;
  margin: 0 auto 8px auto;          /* Restored 8px bottom margin for desktop */
  border-radius: 10px;
  padding: 0;                /* No padding for perfect alignment */
  display: flex;
  justify-content: center;   /* Center the scroll wrapper inside */
}

/* Hide mobile chord info on desktop */
.mobile-chord-info {
  display: none;
}

/* Wrapper for piano roll and chips */
.piano-roll-wrapper {
  position: relative;
  width: 100%;                 /* Responsive width */
  max-width: 1200px;           /* Maximum width for large screens */
  margin: 60px auto 0 auto;  /* Reduced bottom margin from 4px to 0 */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Header above piano roll for chips */
.roll-header {
  position: absolute;
  top: -50px;  /* More space to prevent cutoff */
  right: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  z-index: 5;
}



.piano-roll-container::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    0 10px 30px rgba(0,0,0,0.35);
  pointer-events: none;
  z-index: 2;
}

.piano-roll-scroll-wrapper {
  width: 100%;                 /* Responsive width */
  max-width: 1200px;           /* Maximum width for large screens */
  height: 432px;
  overflow: auto;
  border: none;
  border-radius: 8px;
  background: #181818;
  position: relative;
  margin: 0 auto;              /* Center the scroll wrapper */
}

.piano-roll-bar-numbers {
  position: absolute;
  top: 0;
  left: 0;
  height: 32px;
  width: 100%; /* Responsive width to match container */
  max-width: 100%; /* Prevent overflow */
  background: #070707;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
  border-bottom: 1px solid #f7b9a1;
}
.piano-roll-bar-numbers span {
  position: absolute;
  color: #9c9c9c;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 16px;
  font-weight: bold;
  user-select: none;
  pointer-events: none;
  letter-spacing: 0px;
}



/* Controls container layout - perfectly aligned with piano roll */
#controls {
  display: flex;
  align-items: center;
  justify-content: space-between;  /* Space between left and right groups */
  position: relative;
  width: 100%;               /* Full available width */
  max-width: 1200px;         /* Match piano roll max-width */
  margin: 0 auto 20px calc(48px + (100vw - 48px - 1200px) / 2); /* Eliminated top margin */
  padding: 0;                /* No padding to match piano roll exactly */
  box-sizing: border-box;
  background: transparent;
  border: none;
  flex-wrap: nowrap;         /* Keep in single row */
}

/* For screens wider than 1248px (1200px + 48px sidebar) */
@media (min-width: 1248px) {
  #controls {
    margin-left: calc(48px + (100vw - 48px - 1200px) / 2);
    width: 1200px;
  }
}

/* For screens narrower than 1248px */
@media (max-width: 1247px) {
  #controls {
    margin-left: 48px;
    width: calc(100vw - 48px);
  }
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 8px;               /* Spacing between buttons */
  margin: 0;
  padding: 0;
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 6px;               /* Tighter spacing for octave buttons */
  margin: 0;
  padding: 0;
}

/* Group the octave buttons */
#octave-buttons {
  display: flex;
  gap: 6px;               /* Reduced from 8px */
}

/* Common button styles - clean and uniform */
#controls button {
  background: rgba(26, 28, 44, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  height: 44px;
  width: 44px;               /* Fixed square size for all buttons */
  min-width: 44px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
  color: #9c9c9c;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  flex-shrink: 0;
}

#controls button:hover {
  background: rgba(34, 36, 58, 0.9);
  border-color: rgba(247, 185, 161, 0.25);
  color: #b8b8b8;
  transform: translateY(-1px);
}

#controls button:active {
  transform: translateY(0);
  background: rgba(26, 28, 44, 0.95);
  border-color: rgba(247, 185, 161, 0.3);
}

/* Icon-only square buttons --------------------------------------yeeboi*/ 
.btn.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
}
.btn.btn-icon svg {
  color: #9c9c9c;
}

/* Unified glass style for controls */
.btn-glass {
  background: rgba(26, 28, 44, 0.6) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  backdrop-filter: blur(8px);
}
.btn-glass:hover {
  background: rgba(34, 36, 58, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
}

/* Special styling for download button */
#downloadBtn {
  background: rgba(247, 185, 161, 0.08) !important;
  border-color: rgba(247, 185, 161, 0.2) !important;
}

#downloadBtn:hover {
  background: rgba(247, 185, 161, 0.12) !important;
  border-color: rgba(247, 185, 161, 0.3) !important;
}

#downloadBtn svg path {
  stroke: #f7b9a1 !important;
}

/* Primary action button yeeboi */ 
.btn.btn--primary {
  background: #1A1C2C;
  border-color: #2a2d45;
  color: #E0E0E0;
}
.btn.btn--primary svg {
  color: #00ffc3;
}
.btn.btn--primary:hover {
  background: #22243a;
  border-color: #3b3f5f;
}

/* Ensure SVGs are properly sized and centered */
#controls button svg {
  display: block;
  width: 22px;
  height: 22px;
  pointer-events: none;
  margin: 0 auto;
}

/* Play button - filled icon */
#playBtn svg path {
  fill: currentColor;
  stroke: none;
}

/* Download, undo, redo buttons - stroke icons */
#downloadBtn svg path,
#undoBtn svg path,
#redoBtn svg path {
  stroke: currentColor;
  fill: none;
}

/* Octave buttons - polyline stroke icons */
#octaveUpBtn svg polyline,
#octaveDownBtn svg polyline {
  stroke: currentColor;
  fill: none;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1A1C2C;
  color: #E0E0E0;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid #2a2d45;
  z-index: 9999;
  font-size: 14px;
  font-weight: 500;
}
.toast.success { border-color: #00FFD1; color: #00FFD1; }
.toast.error { border-color: #ff4d4f; color: #ff4d4f; }

/* Chord info - clean and square */
.chord-info {
  display: flex;
  gap: 8px;
}

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1A1C2C;
  border: 1px solid #2a2d45;
  color: #9c9c9c;
  height: 44px;
  border-radius: 4px; /* minimal corners */
  padding: 0 12px;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
}
.chip--mini {
  height: 28px;
  border-radius: 6px;
  padding: 0 10px;
  background: rgba(26,28,44,0.6);
  border-color: rgba(255,255,255,0.12);
}
.chip svg { 
  color: #f7b9a1;
  display: block;
  width: 16px;
  height: 16px;
}
.chip .chip-accent { 
  color: #ffffff; 
  font-weight: 600;
}
.chip-text { 
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Minimal Sleek Prompt Box */
.prompt-section {
  width: 50%;
  max-width: 1200px;
  margin: 20px 0 20px 0;  /* Better spacing from controls */
}

.prompt-box {
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  display: flex;
  align-items: center;
  box-shadow: 0 8px 32px #f7b9a137; /* yeeboi*/
  position: relative;
  min-height: 50px;
  max-height: 50px;
}

.pre-prompt-box {
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 8px 32px #f7b9a137; /* yeeboi*/
}

.tweak-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 20px;
  background: rgba(10, 12, 20, 0.4);
  backdrop-filter: blur(8px);

}

.pre-tweak-panel {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 20px;
  background: rgba(10, 12, 20, 0.4);
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px #f7b9a137; /* yeeboi*/

}


.tweak-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.tweak-field label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 10px;
  text-transform: uppercase;
}

.tweak-field label svg {
  width: 12px;
  height: 12px;
  color: #f7e4a1;
  flex-shrink: 0;
}

.prompt-input {
  width: 100%;
  min-height: 20px;
  height: 50px;
  background: transparent;
  border: none;
  color: #ffffff; /* yeeboi */
  font-size: 15px;
  line-height: 1.4;
  padding: 12px 60px 12px 16px;
  padding-right: 60px; /* leave space for the button */
  resize: none;
  font-family: inherit;
  font-weight: 400;
  box-sizing: border-box;
}
.prompt-input:focus { outline: none; }
.prompt-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

.submit-button {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 45px;
  height: 45px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 8px;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
}
.submit-button:hover { 
  background: rgba(255, 255, 255, 0.15); 
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 1);
}
.submit-button:active { transform: scale(0.95); }

.submit-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}


/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: #fff;
  font-size: 20px;
}

.spinner {
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin-right: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Hide arrows in Chrome, Safari, Edge, Opera */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Hide arrows in Firefox */
input[type=number] {
  appearance: textfield;
  -moz-appearance: textfield;
}

/* Consistent input styling */
.tweak-input {
  width: 100%;
  height: 48px;
  background: rgba(10, 12, 20, 0.8);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 400;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  box-sizing: border-box;
}

.tweak-input:hover { 
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(15, 17, 25, 0.9);
}

.tweak-input:focus { 
  outline: none; 
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.tweak-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

/* Custom Key Selector */
.custom-key-selector {
  position: relative;
  width: 100%;
}

.custom-key-input {
  width: 100%;
  height: 48px;
  background: rgba(10, 12, 20, 0.8);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0 40px 0 14px; /* Add right padding for dropdown arrow */
  font-size: 12px;
  font-weight: 400;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
}

.custom-key-input:hover { 
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(15, 17, 25, 0.9);
}

.custom-key-input:focus { 
  outline: none; 
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.custom-key-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

/* Dropdown arrow */
.custom-key-selector::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.custom-key-selector.active::after {
  transform: translateY(-50%) rotate(180deg);
}

/* Dropdown menu */
.key-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: rgba(10, 12, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  border-bottom: none;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  backdrop-filter: blur(12px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  margin-bottom: 1px;
}

.key-dropdown.active {
  display: block;
}

.key-option {
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.key-option:last-child {
  border-bottom: none;
}

.key-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 1);
}

.key-option.selected {
  background: rgba(0, 255, 209, 0.2);
  color: #f7e4a1;
}

/* Custom Length Selector - same styling as key selector */
.custom-length-selector {
  position: relative;
  width: 100%;
}

.custom-length-input {
  width: 100%;
  height: 48px;
  background: rgba(10, 12, 20, 0.8);
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0 40px 0 14px; /* Add right padding for dropdown arrow */
  font-size: 12px;
  font-weight: 400;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
  cursor: pointer;
  user-select: none;
}

.custom-length-input:hover { 
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(15, 17, 25, 0.9);
}

.custom-length-input:focus { 
  outline: none; 
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.custom-length-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

/* Length dropdown arrow */
.custom-length-selector::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 4px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.custom-length-selector.active::after {
  transform: translateY(-50%) rotate(180deg);
}

/* Length dropdown menu */
.length-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: rgba(10, 12, 20, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  border-bottom: none;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  backdrop-filter: blur(12px);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  margin-bottom: 1px;
}

.length-dropdown.active {
  display: block;
}

.length-option {
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.length-option:last-child {
  border-bottom: none;
}

.length-option:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 1);
}

.length-option.selected {
  background: rgba(0, 255, 209, 0.2);
  color: #f7e4a1;
}

/* Tweak info text styling */
.tweak-info {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 16px;
  padding: 0 20px;
}

.tweak-info-text {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  text-align: center;
  line-height: 1.4;
  margin: 0;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  max-width: 400px;
  letter-spacing: 0.2px;
}

/* Tooltip styling - minimal and clean */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 10px;
  height: 10px;
  font-size: 10px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  cursor: help;
  margin-left: 4px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

/* new chord info icon on tab */

.info-icon:hover {
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.info-icon .tooltip {
  visibility: hidden;
  position: absolute;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
  width: 200px;
  padding: 8px 12px;
  background: rgba(10, 12, 20, 0.95);
  color: rgba(255, 255, 255, 0.9);
  font-size: 9px;
  font-weight: 400;
  line-height: 1.4;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1001;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  pointer-events: none;
}

.info-icon .tooltip::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -5px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 5px solid rgba(10, 12, 20, 0.95);
}

.info-icon:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

/* ========================================
   RESPONSIVE DESIGN - MEDIA QUERIES
   ======================================== */

/* Extra large screens (1400px and up) */
@media (min-width: 1400px) {
  .main-container {
    padding: 0 40px;
  }
}

/* Large screens (1200px to 1399px) */
@media (max-width: 1399px) and (min-width: 1200px) {
  .main-container {
    padding: 0 20px;
  }
}

/* Medium-large screens (992px to 1199px) */
@media (max-width: 1199px) {
  .piano-roll-container,
  .piano-roll-wrapper,
  .piano-roll-scroll-wrapper {
    max-width: 95%;
    width: 95%;
  }
  
  #controls {
    max-width: 95%;
    width: 95%;
  }
  
  .prompt-section {
    width: 70%;
    max-width: 95%;
  }
  
  .landing-prompt-section {
    width: 70%;
    max-width: 95%;
  }
}

/* Medium screens (768px to 991px) - merged with mobile styles below */

/* Mobile devices (up to 991px) */
@media (max-width: 991px) {
  /* Hide piano roll and main container on mobile for better performance and UX */
  .piano-roll-wrapper,
  .piano-roll-container,
  #piano-roll-container,
  .main-container {
    display: none !important;
  }
  
  /* Show mobile chord info and hide desktop chord info */
  .mobile-chord-info {
    display: flex !important;
    justify-content: center;
    gap: 12px;
    margin: 20px 0 30px 0; /* More spacing above and below */
    flex-wrap: wrap;
    padding: 0 15px; /* Side padding for better mobile spacing */
  }
  
  .chord-info {
    display: none !important;
  }
  
  /* Make controls appear right after mobile header with better spacing */
  #controls {
    margin-top: 70px !important; /* More space from mobile header */
    margin-bottom: 40px !important; /* More space before input box */
    padding: 0 15px; /* Side padding for mobile */
  }
  
  /* Adjust prompt section with better spacing */
  .prompt-section {
    margin-top: 0 !important;
    margin-bottom: 50px !important; /* More bottom space */
    padding: 0 15px; /* Consistent side padding */
  }
  
  /* Add spacing between control buttons on mobile */
  #controls .controls-left,
  #controls .controls-right {
    gap: 15px !important; /* More space between buttons */
  }
  
  /* Better spacing for mobile chips */
  .mobile-chord-info .chip {
    margin: 5px; /* Individual chip spacing */
  }
  
  /* Add spacing to tweak controls on mobile */
  .tweak-grid {
    gap: 20px !important; /* More space between KEY, LENGTH, BPM fields */
    margin-top: 20px !important;
  }
  
  .tweak-field {
    margin-bottom: 15px !important; /* Space between each field */
  }
  
  /* Better spacing for prompt input box */
  .prompt-box {
    margin-bottom: 25px !important; /* More space below input box */
  }
  
  /* Fix body height on mobile to allow scrolling */
  html, body {
    min-height: 100vh;
    height: auto;
    overflow-y: auto !important;
    overflow-x: hidden;
  }
  
  body {
    padding: 0;
    padding-bottom: 20px; /* Add bottom padding for scrolling */
  }
  
  /* Hide sidebar on mobile to prevent blocking content */
  .sidebar {
    display: none;
  }
  
  /* Show mobile header */
  .mobile-header {
    display: flex;
  }
  
  /* Adjust main container to use full width without sidebar and account for mobile header */
  .main-container {
    margin-left: 0;
    margin-top: 50px; /* Account for mobile header height */
    width: 100vw;
    padding: 0 15px 40px 15px; /* Add bottom padding for BPM section */
    box-sizing: border-box;
    min-height: calc(100vh - 50px); /* Ensure full height available */
  }
  
  .landing-container {
    margin-left: 0;
    margin-top: 50px; /* Account for mobile header height */
    width: 100vw;
    padding: 0 15px 40px 15px; /* Add bottom padding */
    box-sizing: border-box;
    min-height: calc(100vh - 50px); /* Ensure full height available */
  }
  
  /* Piano roll and controls responsive sizing */
  .piano-roll-container,
  .piano-roll-wrapper,
  .piano-roll-scroll-wrapper {
    max-width: 100%;
    width: calc(100% - 20px);
    margin: 0 10px;  /* Only horizontal margins, no vertical */
    position: relative;
    z-index: 1;
  }
  
  /* Adjust roll header for mobile */
  .roll-header {
    position: relative !important;
    top: 0 !important;
    right: auto !important;
    margin-bottom: 0 !important;  /* Eliminated bottom margin with !important */
  }
  
  #controls {
    max-width: 100%;
    width: calc(100% - 20px);
    margin: 0 auto 8px auto; /* Eliminated top margin */
  }
  
  .prompt-section {
    width: 85%;
    max-width: 100%;
  }
  
  .landing-prompt-section {
    width: 85%;
  }
  
  .tweak-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  /* Adjust piano roll */
  .piano-roll-container,
  .piano-roll-wrapper,
  .piano-roll-scroll-wrapper {
    width: 100% !important;
    margin: 0 !important;  /* Eliminated all margins with !important */
    position: relative;
    z-index: 1;
  }
  
  .piano-roll-scroll-wrapper {
    height: 300px; /* Reduce height on mobile */
    overflow: auto !important;
  }
  
  /* Ensure piano roll is visible on mobile */
  #piano-roll-container {
    min-height: 300px;
    display: block !important;
    visibility: visible !important;
  }
  
  
  .controls-left,
  .controls-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }
  
  /* Ensure proper button spacing and prevent overlap */
  .controls-left {
    justify-content: flex-start;
  }
  
  .controls-right {
    justify-content: flex-end;
  }
  
  /* Make sure buttons don't get too small */
  #controls button {
    flex-shrink: 0;
    white-space: nowrap;
  }
  
  /* Adjust prompt section for better mobile visibility */
  .prompt-section,
  .landing-prompt-section {
    width: calc(100% - 20px);
    margin: 20px 10px;
    padding: 0;
    box-sizing: border-box;
  }
  
  .prompt-box,
  .pre-prompt-box {
    width: 100%;
    position: relative;
    min-height: 50px;
    max-height: 50px;
    display: flex;
    align-items: center;
  }
  
  .prompt-input {
    padding: 12px 70px 12px 16px; /* Consistent padding */
    font-size: 16px; /* Prevent zoom on iOS */
    height: 50px; /* Snug height */
    min-height: 50px;
    max-height: 50px;
  }
  
  .submit-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .pre-landing-header {
    width: 100%;
    padding: 0 15px;
    margin-bottom: 20px;
  }
  
  .pre-landing-title {
    font-size: 1.5rem;
  }
  
  /* Adjust chips */
  .roll-header {
    position: relative;
    top: 0;
    margin-bottom: 0 !important;  /* Eliminated bottom margin with !important */
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .chip {
    height: 32px;
    font-size: 11px;
    padding: 0 8px;
  }
  
  .chip--mini {
    height: 24px;
    font-size: 10px;
  }
  
  
  .btn.btn-icon {
    width: 48px;
    height: 48px;
    padding: 0;
  }
  
  /* Primary button styling */
  .btn.btn--primary {
    background: rgba(247, 185, 161, 0.2);
    border-color: rgba(247, 185, 161, 0.4);
    color: #f7b9a1;
  }
  
  .btn.btn--primary:hover {
    background: rgba(247, 185, 161, 0.3);
    border-color: rgba(247, 185, 161, 0.6);
    color: #ffffff;
  }
  
  /* Tweak panel improvements */
  .tweak-panel {
    padding: 15px;
    margin-top: 10px;
    margin-bottom: 40px; /* Add bottom margin to ensure BPM is visible */
  }
  
  .tweak-grid {
    gap: 15px;
  }
  
  /* Ensure prompt section has enough bottom space */
  .prompt-section {
    margin-bottom: 40px !important;
    padding-bottom: 20px;
  }
  
  .tweak-field label {
    font-size: 10px;
    margin-bottom: 8px;
  }
  
  .tweak-input {
    height: 44px;
    font-size: 14px;
  }
}

/* Extra small screens (less than 576px) */
@media (max-width: 575px) {
  /* Hide sidebar completely */
  .sidebar {
    display: none;
  }
  
  /* Show mobile header */
  .mobile-header {
    display: flex;
  }
  
  
  /* Full width containers with mobile header offset */
  .main-container,
  .landing-container {
    margin-left: 0;
    margin-top: 50px; /* Account for mobile header */
    width: 100vw;
    padding: 0 10px;
  }
  
  /* Further reduce piano roll height */
  .piano-roll-scroll-wrapper {
    height: 250px;
  }
  
  /* Optimize prompt box for small screens */
  .prompt-section,
  .landing-prompt-section {
    width: calc(100% - 16px);
    margin: 8px;
  }
  
  .prompt-box,
  .pre-prompt-box {
    width: 100%;
  }
  
  .prompt-input {
    font-size: 16px; /* Prevent iOS zoom */
    padding: 12px 60px 12px 14px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .submit-button {
    width: 45px;
    height: 45px;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .submit-button img {
    width: 30px !important;
    height: 30px !important;
  }
  
  /* Stack tweak fields */
  .tweak-grid {
    grid-template-columns: 1fr;
  }
  
  /* Modal adjustments */
  .modal-card {
    margin: 5vh 10px;
    padding: 16px;
    width: calc(100% - 20px);
  }
  
  
  /* Adjust chips for very small screens */
  .chip--mini {
    height: 22px;
    font-size: 9px;
    padding: 0 6px;
  }
}

/* Handle landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .piano-roll-scroll-wrapper {
    height: 200px;
  }
  
  .piano-roll-wrapper {
    margin-top: 30px;
  }
  
  .roll-header {
    top: -30px;
  }
}

/* Prevent horizontal scroll */
@media (max-width: 1200px) {
  body {
    overflow-x: hidden;
  }
  
  .main-container,
  .landing-container {
    overflow-x: hidden;
  }
}

/* Proper mobile controls styling */
@media screen and (max-width: 991px) {
  /* Position controls between piano roll and input box - single row */
  #controls {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    z-index: 500 !important;
    width: calc(100% - 20px) !important;
    max-width: 100% !important;
    margin: 0 auto !important;  /* Eliminated top margin completely */
    padding: 8px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    border: none !important;
    border-radius: 12px !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;  /* Force single row */
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;  /* Smaller gap to fit all buttons */
    min-height: 64px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }
  
  /* Style buttons - optimized for mobile single row */
  #controls button {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: 44px !important;      /* Optimized size */
    width: 44px !important;        /* Square buttons */
    min-width: 44px !important;
    max-width: 44px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: rgba(26, 28, 44, 0.9) !important;
    border: 1px solid rgba(247, 185, 161, 0.2) !important;
    border-radius: 10px !important;
    color: #c0c0c0 !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    flex: 0 0 44px !important;    /* Prevent flex grow/shrink */
    white-space: nowrap !important;
    position: relative !important;
    z-index: 501 !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    transition: all 0.15s ease !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  
  /* Hover/active states for mobile */
  #controls button:active {
    background: rgba(34, 36, 58, 0.9) !important;
    border-color: rgba(247, 185, 161, 0.3) !important;
    color: #f7b9a1 !important;
    transform: translateY(0) !important;
  }
  
  /* Control groups layout - force single row on mobile */
  .controls-left,
  .controls-right {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-wrap: nowrap !important;  /* Never wrap */
    justify-content: center !important;
    align-items: center !important;
    gap: 6px !important;  /* Match container gap */
    flex: 0 0 auto !important;  /* Don't flex grow/shrink */
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* On mobile, don't separate left and right groups */
  #controls {
    justify-content: center !important;  /* Center all buttons */
  }
  
  /* Ensure octave buttons stay together */
  #octave-buttons {
    display: inline-flex !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  
  /* Ensure SVG icons are visible and properly styled */
  #controls button svg {
    width: 22px !important;
    height: 22px !important;
    display: block !important;
  }
}

