@import url('https://fonts.googleapis.com/css2?family=Fjalla+One:wght@700&family=Libre+Franklin:wght@400&family=Rakkas&family=Hubot+Sans:wght@400&family=Fraunces:opsz,wght@9..144,400;9..144,600;9..144,700&display=swap');

body {
    font-family: 'Libre Franklin';
    /* or Hubot Sans, Rubik */
    font-weight: 400;
    background: #09090b;
    min-height: 100vh;
}
  
h1, h2, h3, h4, h5 {
    font-family: 'Rakkas';
    font-weight: 400;
}

#pianoRoll {
    display: flex;
    align-items: flex-start;
    height: 180px;
    margin: 20px auto;
    border: 1px solid rgba(255, 255, 255, 0.12);
    max-width: 800px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 255, 255, 0.03);
}
.key {
    position: relative;
    border: 1px solid #000;
    text-align: center;
    vertical-align: top;
    font-size: 12px;
    line-height: 1;
}
.white-key {
    width: 40px;
    height: 180px;
    background-color: rgb(255, 255, 255);
    margin-left: -1.5px;
    margin-right: -1.5px;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}
.black-key {
    width: 25px;
    height: 100px;
    background-color: rgb(0, 0, 0);
    color: white;
    margin-left: -12.5px;
    margin-right: -12.5px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    align-self: flex-start;
    flex-direction: column;
    padding-bottom: 5px; /* black key height */
}
.black-key.half-width {
    width: 12.5px;
    margin-left: 0;
    margin-right: -12.5px;
}
.black-key.half-width-trailing {
    width: 12.5px;
    margin-left: -12.5px;
    margin-right: 0;
}
.highlight {
    background: linear-gradient(135deg, rgb(140, 90, 50) 0%, rgb(166, 116, 74) 35%, rgb(190, 140, 90) 74%, rgb(220, 180, 130) 100%);
}
.btn {
    padding: 10px;
    background-color: rgb(42, 42, 42);
    color: white;
    align-items: center;
}
.buttonBox {
    display: flex;
    justify-content: center;
    margin-top: 20px; /* Space between piano roll and buttons */
    gap: 10px; /* Space between buttons */
    
}
.instructionText {
    color: white;
    font-size: 20px;
    text-align: center;
    margin-top: 20px; /* Space between instruction text and buttons */
}
body {
    background: radial-gradient(
      circle at 90% 100%, 
      #09090b 0%, 
      #1a1a1c 100%
    );
    min-height: 100vh; /* Full browser height */
}

h1 {
    font-family: 'Rakkas', serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem); /* Responsive sizing */
    font-weight: 400;
    color: white;
    text-align: left;
    margin-left: 2rem;
    margin-bottom: 2rem;
    text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
}  

.controls {
  display: flex;
  align-items: center; /* Handle vertical alignment of control elements */
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
  padding-left: 2rem;
}
.controls label {
    font-size: 1rem;
    color: white;
    margin-bottom: 0; /* No vertical spacing */
}

select,
button {
    padding: 0.5rem 1.2rem;
    font-size: 1rem;
    font-family: 'Fraunces', serif;
    background: linear-gradient(135deg, rgb(140, 90, 50) 0%, rgb(166, 116, 74) 35%, rgb(190, 140, 90) 74%, rgb(220, 180, 130) 100%);
    color: rgba(24, 24, 24, 0.95);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 
        0 2px 8px rgba(166, 116, 74, 0.3),
        0 0 20px rgba(190, 140, 90, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

select:hover,
button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 4px 12px rgba(166, 116, 74, 0.4),
        0 0 30px rgba(190, 140, 90, 0.3);
}

select:active,
button:active {
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeIn 1s ease-out forwards;
}
  
@keyframes fadeIn {
    to {
      opacity: 1;
      transform: translateY(0);
    }
}

#scaleGrid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    padding: 1rem;
    max-width: 1000px;
    margin: 0 auto;
}

.scaleBox {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1rem;
    padding: 1rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: transform 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #fff;
  }
  
.scaleBox:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(255, 255, 255, 0.05);
    }
  

.scaleLabel {
    margin-top: 1rem;
    text-align: center;
    font-weight: bold;
}

.pianoRollInstance {
    display: flex;
    align-items: flex-start;
    height: 180px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    max-width: 800px;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.3),
        0 0 20px rgba(255, 255, 255, 0.03);
}

.back-button-container {
    padding-left: 2rem;
  }
  
/* --- Make panels size to piano-roll width + center last row --- */

#scaleGrid {
  /* switch from grid to wrapping flex so the last row centers naturally */
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* centers incomplete last row */
  gap: 2rem;

  padding: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.scaleBox {
  /* don't stretch; size to content */
  width: fit-content;
  max-width: 100%;
  box-sizing: border-box;

  /* keep roll from visually escaping if it ever exceeds max-width */
  overflow: hidden;
}

.pianoRollInstance {
  /* size exactly to the generated keys */
  width: max-content;
  max-width: 100%;

  box-sizing: border-box;
  display: flex;

  /* if the roll is wider than the card/screen, scroll instead of overflow */
  overflow-x: hidden;
  overflow-y: hidden;

  height: 180px;
  border: 1px solid #ccc;

  align-items: flex-end;
  -webkit-overflow-scrolling: touch;
}
