html,
body {
  margin: 0;
  height: 100%;
  background: #d0e7f9;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

.main {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  max-width: 80%;
  min-width: 1440px;
  aspect-ratio: 14 / 7;
  border-radius: 10px;
  margin: auto;
  box-shadow: 0 0 0 5px #da4a4a, 0 0 0 10px #474f51;
  background: #da4a4a;
  padding: 0.625rem;
}
.btn {
  max-width: 90%;
  min-width: 1440px;
  margin: 20px auto;
  display: flex;
}
.game-window > div {
  width: 100%;
  height: 100%;
}
.game-window > div > canvas {
  width: 100%;
  height: 100%;
}
.function-area .screen {
  width: 100%;
  height: 100%;
}

.panel {
  position: relative;
  height: 100%;
  padding: 10px;
  box-sizing: border-box;
  background: #f8f1d7;
  border-radius: 10px;
  display: flex;
  flex-direction: row;
  box-shadow: inset 4px 4px #fffef7;
}

.function-area {
  flex: 1;
  display: flex;
  padding: 0 10px;
  justify-content: center;
  flex-direction: column;
}

.action-area {
  display: flex;
  flex-direction: row;
}

.controller {
  position: relative;
  width: 160px;
  height: 160px;
  align-self: flex-end;
  filter: drop-shadow(5px 5px 0px rgba(255, 255, 255, 0.8));
}

.controller button {
  position: absolute;
  z-index: 1;
  border: 4px solid #474f51;
  background: #857b7a;
  border-radius: 50px;
  box-sizing: border-box;
  outline: 0;
  width: 70px;
  height: 70px;
  left: 50%;
  top: 50%;
  user-select: none;
  transform: translate(-50%, -50%);
}

button.up.joydirection {
  top: 0;
  transform: translate(-50%, 0);
  height: 4rem;
  width: 4rem;
  box-shadow: inset 0px 4px 0 0px rgba(255, 255, 255, 0.5);
}

button.right.joydirection {
  left: auto;
  right: 0;
  transform: translate(0, -50%);
  height: 4rem;
  width: 4rem;
  box-shadow: inset 4px 0 0 0px #857b7a,
    inset 4px 4px 0 0px rgba(255, 255, 255, 0.4),
    inset 4px -4px 0 0px rgba(0, 0, 0, 0.1);
}

button.down.joydirection {
  top: auto;
  transform: translate(-50%, 0);
  bottom: 0;
  height: 4rem;
  width: 4rem;
  box-shadow: inset 0px -4px 0 0px rgba(0, 0, 0, 0.1);
}

button.left.joydirection {
  left: 0;
  transform: translate(0, -50%);
  height: 4rem;
  width: 4rem;
  box-shadow: inset 0px 4px 0 0px rgba(255, 255, 255, 0.4),
    inset -4px 0px 0 0px #857b7a, inset -4px -4px 0 0px rgba(0, 0, 0, 0.1);
}

.function {
  display: flex;
  padding: 4px 15px;
  margin-right: 10px;
  border-radius: 50px;
  align-self: center;
  background: #da4a4a;
  box-shadow: 5px 5px 0 rgba(255, 255, 255, 0.8);
}

.function button {
  user-select: none;
  margin: 10px;
  height: 24px;
  width: 60px;
  outline: 0;
  border: 4px solid #474f51;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1),
    inset 4px 4px 0 0px rgba(255, 255, 255, 0.4);
  background: #857b7a;
  color: transparent;
  border-radius: 15px;
}

.action {
  display: flex;
  align-self: flex-end;
}

.action button {
  user-select: none;
  width: 60px;
  height: 60px;
  background: #857b7a;
  border-radius: 50%;
  outline: 0;
  color: transparent;
  border: 4px solid #474f51;
  box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.8),
    inset 5px 4px 0 0px rgba(255, 255, 255, 0.4),
    inset -5px -4px 0 0px rgba(0, 0, 0, 0.1);
}

.action button:first-child {
  margin-right: 24px;
}

.sign {
  position: absolute;
  font-weight: bold;
  font-size: 20px;
  font-style: italic;
  height: 50px;
  right: 0;
  top: 0;
  background: #da4a4a;
  color: #f8f1d7;
  text-shadow: 0 -2px #fffef7;
  padding: 0 0 15px 15px;
  letter-spacing: 0.1em;
  border-bottom-left-radius: 15px;
  filter: drop-shadow(0 4px #fffef7);
}

.sign::before {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  left: -15px;
  top: 0;
  background: radial-gradient(
    circle at left bottom,
    transparent 14px,
    #da4a4a 15px
  );
}

.sign::after {
  content: "";
  position: absolute;
  width: 15px;
  height: 15px;
  bottom: -15px;
  right: 0;
  background: radial-gradient(
    circle at left bottom,
    transparent 14px,
    #da4a4a 15px
  );
}

.joy {
  position: absolute;
  left: 0;
  top: 0;
  width: 50px;
  height: 50px;
  background: #857b7a;
  border-radius: 5px;
  text-align: center;
  line-height: 50px;
  color: #f8f1d7;
  font-weight: bold;
  font-size: 30px;
}

.readme {
  position: absolute;
  bottom: 10px;
  width: 50px;
  height: 30px;
  background: #857b7a;
  border-radius: 5px;
  text-align: center;
  line-height: 30px;
  color: #f8f1d7;
  font-weight: bold;
  font-size: 20px;
}

.screen {
  flex: 1;
  display: flex;
  width: 100%;
  transition: 0.3s;
  background: #000;
  margin-bottom: 5px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
}

.screen canvas {
  max-width: 100%;
  max-height: 100%;
}

.nes-roms > select {
  width: 100px;
  height: 18px;
  font-size: 9px;
  padding: 0 1px;
  border: 1px solid #ccc;
}

.nes-controls {
  margin-top: 1px;
  display: flex;
  gap: 2px;
  align-items: center;
  transform: scale(0.8);
  transform-origin: left center;
}

.nes-controls button {
  padding: 1px 3px;
  font-size: 8px;
  height: 16px;
  min-width: 25px;
  max-width: 40px;
  border: 1px solid #999;
  margin: 0;
}

.controller-area {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: row;
}
