html, body {
  height: 100%;
  margin: 0;
  background: #111;
  color: #e0e0e0;
  font-family: 'Lato', sans-serif;
  overflow: hidden;
}

/* === Layout === */
.wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  padding: 20px 0;
}

/* === Title === */
h1 {
  margin: 10px 0 15px;
  font-family: 'Alumni Sans Pinstripe', sans-serif;
  font-size: 2.4em;
  font-weight: 400;
  letter-spacing: 1px;
  color: #f5f5f5;
  text-transform: uppercase;
}

/* === Piano area === */
#piano-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 95vw;
  max-width: 1800px;
  flex-shrink: 0;
  margin: 0;
}

.piano-top {
  width: 100%;
  height: 4px;
  background: #b71c1c;
  border-radius: 2px;
}

#piano {
  display: flex;
  justify-content: center;
  align-items: start;
  position: relative;
  width: 100%;
  aspect-ratio: 6 / 1;
  background: #111;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
  overflow: hidden;
}

/* === White keys === */
.white-key {
  flex: 0 0 calc(100% / 52);
  height: 100%;
  background: linear-gradient(to bottom, #ffffff 0%, #f6f6f6 100%);
  border-right: 1px solid rgba(0,0,0,0.25);
  border-left: 1px solid rgba(255,255,255,0.4);
  box-sizing: border-box;
  transition: transform 0.05s;
  z-index: 2;
}

.white-key:last-child {
  border-right: none;
}

/* === Black keys === */
.black-key {
  width: calc((100% / 52) * 0.66);
  height: 60%;
  background: #000;
  border: 1px solid #111;
  position: relative;
  margin-left: calc((100% / 52) * -0.33);
  margin-right: calc((100% / 52) * -0.33);
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0,0,0,0.7);
  transition: transform 0.05s;
}

/* === Active & sustained states (color mode on) === */
.white-key.active,
.white-key.sustained {
  background: var(--active-color, #2979ff);
  transform: translateY(1px);
  border-left: 1px solid rgba(255,255,255,0.4);
  border-right: 1px solid rgba(0,0,0,0.25);
  border-bottom: 2px solid rgba(0,0,0,0.3);
}

.black-key.active,
.black-key.sustained {
  background: var(--active-color, #2979ff);
  transform: translateY(1px);
}

/* === Color-off tactile realism (subtle bottom shadow) === */
body.color-off .white-key.active,
body.color-off .white-key.sustained {
  background: linear-gradient(to bottom, #f5f5f5 0%, #d8d8d8 90%);
  /* light gray top → soft shadow near bottom */
  border-left: 1px solid rgba(255,255,255,0.5);
  border-right: 1px solid rgba(0,0,0,0.35);
  border-bottom: 2px solid rgba(0,0,0,0.4);
  transform: translateY(1.6px);
}

body.color-off .black-key.active,
body.color-off .black-key.sustained {
  background: #1a1a1a;
  border-color: #000;
  transform: translateY(1.6px);
}

/* === Interactivity feedback === */
.white-key:hover,
.black-key:hover {
  cursor: pointer;
  opacity: 0.92;
}

/* === Indicator bar === */
.indicator-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  margin-top: 25px;
}

#pedal-indicator, 
#midi-indicator, 
#vibrato-indicator, 
#color-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity 0.3s ease;
  cursor: pointer;
}

.light {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #444;
  box-shadow: 0 0 6px #000;
  transition: background 0.25s, box-shadow 0.25s;
}

/* === Pedal ON === */
#pedal-indicator.on .light {
  background: #ffb300;
  box-shadow: 0 0 14px #ffb300, 0 0 28px rgba(255,179,0,0.6);
  animation: pedalPulse 1.8s ease-in-out infinite alternate;
}

/* === MIDI ON === */
#midi-indicator.on .light {
  background: #00e676;
  box-shadow: 0 0 14px #00e676, 0 0 28px rgba(0,230,118,0.6);
  animation: midiPulse 2s ease-in-out infinite alternate;
}

/* === Vibrato ON === */
#vibrato-indicator.on .light {
  background: #00e676;
  box-shadow: 0 0 14px #00e676, 0 0 28px rgba(0,230,118,0.6);
}

/* === Color indicator (starts gray) === */
#color-indicator .light {
  background: #444;
  box-shadow: 0 0 6px #000;
}

/* === Indicator text === */
#pedal-indicator p,
#midi-indicator p,
#vibrato-indicator p,
#color-indicator p {
  font-size: 0.9rem;
  color: #bbb;
  margin: 0;
}

/* === Light animations === */
@keyframes pedalPulse {
  from { box-shadow: 0 0 8px #ffb300; }
  to   { box-shadow: 0 0 18px #ffb300; }
}

@keyframes midiPulse {
  from { box-shadow: 0 0 8px #00e676; }
  to   { box-shadow: 0 0 18px #00e676; }
}

/* === Control panel === */
.control-panel {
  margin-top: 25px;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#status {
  margin: 10px 0 5px;
  font-size: 1rem;
  color: #bbb;
  opacity: 1;
  transition: opacity 1s ease;
}

button {
  background: #2196f3;
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.3s ease;
}

button:hover {
  background: #1976d2;
}

/* === Responsive === */
@media (max-width: 700px) {
  #piano-container {
    width: 140vw;
  }
  #piano {
    aspect-ratio: 5 / 1;
  }
  h1 {
    font-size: 2em;
  }
}
