body {
  margin: 0;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgb(154, 187, 117);
  overflow: hidden;
  transition: all 0.3s ease;
}

.wrapper {
  width: 100%;
  max-width: 1000px;
  padding: 5vh 2vw;
  border-radius: 20px;
  background: linear-gradient(-65deg, #000, #222, #000, #666, #222 75%);
  box-shadow: inset 0 -1px 1px #ffffff70,
              inset -0.4rem 0.4rem #282828,
              0 0 50px #00000080 inset,
              0 5px 15px #00000080;
  box-sizing: border-box;
}

.piano-keys {
  padding: 0;
  margin: 0 auto;
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  justify-content: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.key {
  cursor: pointer;
  user-select: none;
  position: relative;
  text-transform: uppercase;
  flex-shrink: 0;
}

.key:hover {
  filter: brightness(1.2);
}

.key span {
  position: absolute;
  bottom: 10%;
  width: 100%;
  color: #0000004d;
  font-size: clamp(12px, 2vw, 18px);
  text-align: center;
  font-family: Roboto, sans-serif;
  font-weight: 500;
}

.white {
  height: 30vh;
  width: clamp(40px, 7vw, 70px);
  border: 1px solid #000;
  border-left: 1px solid #fff2;
  border-bottom: 1px solid #bababa;
  border-radius: 0 0 5px 5px;
  box-shadow: -1px 0 0 #ffffffcc inset,
              0 0 3px #00000033,
              inset -15px 0px 20px #0006,
              inset 3px 0px 20px #fff,
              0 5px 5px #000;
  background: linear-gradient(to bottom, hsl(0, 0%, 93%) 0%, white 100%);
}

.white.active {
  box-shadow: -1px 0 0 #ffffffcc inset,
              0 0 3px #00000033,
              inset -15px 0px 20px #0006,
              inset 3px 0px 20px #fff,
              0 1px 1px #000,
              inset -2px -49px 40px #0003;
}

.black {
  z-index: 2;
  height: 20vh;
  width: clamp(24px, 4vw, 44px);
  margin: 0 calc(clamp(24px, 4vw, 44px) * -0.5);
  border: 1px solid #000;
  border-radius: 0 0 3px 3px;
  box-shadow: -1px -1px 2px #ffffff33 inset,
               0 -5px 2px 3px #00000099 inset,
               0 2px 4px #00000080;
  background: linear-gradient(45deg, #212121 0%, #545454 100%);
}

.black.active {
  background: linear-gradient(-180deg, #313131 50%, #545454 100%);
}

/* Rotate piano for portrait mobile */
body.portrait .wrapper {
  transform: rotate(90deg);
  transform-origin: center center;
  width: 100vh;
  height: 100vw;
  position: absolute;
  top: 0;
  left: 0;
  overflow-x: auto;
}

/* Notice when in portrait mode */
.rotate-notice {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-family: sans-serif;
  background: rgba(0, 0, 0, 0.7);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 1rem;
  z-index: 99;
  display: none;
}

body.portrait .rotate-notice {
  display: block;
}
