html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

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;
}



.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;
}

.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: 1200px;             /* Fixed width for perfect alignment */
  height: auto;
  margin: 8px auto;          /* Center with auto margins */
  border-radius: 10px;
  padding: 0;                /* No padding for perfect alignment */
  display: flex;
  justify-content: center;   /* Center the scroll wrapper inside */
}

/* Wrapper for piano roll and chips */
.piano-roll-wrapper {
  position: relative;
  width: 1200px;               /* Fixed width to match piano roll */
  margin: 60px auto 4px auto;  /* Added top margin for chips space */
  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: 1200px;               /* Fixed width for perfect alignment */
  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: 900px; /* match visibleWidth */
  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 */
#controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 1200px;             /* Match piano roll width exactly - now inside main-container */
  margin: 8px auto;          /* Slightly more margin, centered */
  padding: 0;                /* No padding for perfect alignment */
  gap: 12px;
}

.controls-left,
.controls-right {
  display: flex;
  align-items: center;
  gap: 6px;               /* Reduced from 8px */
}

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

/* Common button styles - square and minimal */
#controls button {
  background: #1A1C2C;
  border: 1px solid #2a2d45;
  border-radius: 4px; /* minimal corners */
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: #E0E0E0;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#controls button:hover {
  background: #22243a;
  border-color: #3b3f5f;
  color: #ffffff;
}

#controls button:active {
  transform: translateY(1px);
}

/* Icon-only square buttons --------------------------------------yeeboi*/ 
.btn.btn-icon {
  width: 44px;
  height: px;
  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;
}

/* 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 inherit color correctly */
#controls button svg path,
#controls button svg polyline {
  stroke: currentColor;
}
#controls button svg {
  display: block;
}

/* 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: 12px 0 0 0;     /* Reduced top margin, removed bottom */
}

.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*/

}

.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: 14px 60px 14px 16px;
  padding-right: 60px; /* leave space for the button */
  resize: none;
  font-family: inherit;
  font-weight: 400;
}
.prompt-input:focus { outline: none; }
.prompt-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

.submit-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 65px;
  height: 65px;
  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: 0;
  backdrop-filter: blur(8px);
  right: 10px; /* keep inside prompt-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); }


/* 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;
}




