body {
  width: 100%;
  height: 100%;
  display: block;
  position: fixed;
  top: 0;
  left: 0;
}

.function button,
.action button {
  color: #000;
}

.function button {
  height: 32px;
  width: auto;
}

.nes-roms > select {
  width: 100%;
  height: 30px;
}

.nes-controls {
  text-align: start;
}

.game-window {
  width: 100%;
  height: 100%;
}
@media screen and (max-width: 600px) {
  .function-area {
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    padding: 0;
  }
  .screen {
    max-height: 100%;
  }
  .screen canvas {
    max-width: none !important;
    max-height: none !important;
  }
  .game-window div canvas {
    margin-top: 0%;
    margin-left: 80%;
    box-sizing: border-box;
    transform: scaleX(2.2) scaleY(1.4);
  }
  .controller {
    transform: rotate(90deg);
    position: fixed;
    top: 20px;
  }
  .game-window > div {
    transform: rotate(90deg);
  }
  .function {
    z-index: 2;
    transform: rotate(90deg);
    position: fixed;
    z-index: 3;
    bottom: 46px;
    right: 12px;
  }
  .action-area {
    z-index: 4;
    position: fixed;
    transform: rotate(90deg);
    bottom: 105px;
    left: 0;
  }
  .action button:first-child {
    margin-right: 40px;
  }
  .controller {
    width: 220px;
    height: 220px;
  }
  button.left.joydirection,
  button.up.joydirection,
  button.right.joydirection,
  button.down.joydirection {
    width: 5rem;
    height: 5rem;
    opacity: 0.4;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
  }

  button.left.joydirection:active,
  button.up.joydirection:active,
  button.right.joydirection:active,
  button.down.joydirection:active {
    opacity: 0.9;
  }
  button.left.joydirection:focus,
  button.up.joydirection:focus,
  button.right.joydirection:focus,
  button.down.joydirection:focus {
    opacity: 0.9;
  }
  .nes-controls {
    transform: rotate(90deg);
    position: fixed;
    right: 30px;
    top: 0px;
    z-index: 2;
  }
  .nes-controls input {
    user-select: none;
    margin: 10px;
    height: 26px;
    width: 70px;
    padding: 3px;
    line-height: 14px;
    outline: 0;
    border: 4px solid #474f51;
    box-shadow: 0 0 0 4px rgb(255 255 255 / 10%),
      inset 4px 4px 0 0px rgb(255 255 255 / 40%);
    background: #857b7a;
    color: transparent;
    border-radius: 15px;
    color: #fff;
    display: block;
  }
  .nes-zoom {
    display: none !important;
  }
  .action button {
    width: 80px;
    height: 80px;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
    opacity: 0.4;
  }
  .action button:active {
    opacity: 0.9;
  }
  .action button:focus {
    opacity: 0.9;
  }
  .nes-roms {
    transform: rotate(90deg);
    width: 100px !important;
    position: fixed;
    right: -15px;
    bottom: 70px;
    z-index: 2;
  }
  .nes-roms option {
    transform: rotate(90deg);
  }
}

/* 美化游戏选择下拉菜单 */
.nes-roms select {
  width: 100%;
  height: 36px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 2px solid #474f51;
  background-color: #f8f1d7;
  font-size: 14px;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.8);
  margin-bottom: 10px;
}

/* 美化控制按钮 */
.nes-controls input[type="button"] {
  margin: 5px;
  padding: 8px 15px;
  border-radius: 8px;
  border: 2px solid #474f51;
  background: #857b7a;
  color: #fff;
  font-weight: bold;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.4),
    inset -2px -2px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.nes-controls input[type="button"]:hover {
  background: #857b7a;
  transform: none;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.4),
    inset -2px -2px 0 rgba(0, 0, 0, 0.1);
}

.nes-controls input[type="button"]:active {
  transform: translateY(2px);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.2),
    inset -1px -1px 0 rgba(0, 0, 0, 0.2);
}

/* 美化主容器 */
.main {
  background: linear-gradient(135deg, #e05a5a, #c43a3a);
  padding: 1rem;
  position: relative;
}

.main:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image: linear-gradient(
      to right,
      rgba(255, 255, 255, 0.1) 1px,
      transparent 1px
    ),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 8px 8px;
  z-index: 10;
}

/* 美化面板 */
.panel {
  border-radius: 15px;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.15), 0 5px 15px rgba(0, 0, 0, 0.2);
  background: linear-gradient(to bottom, #f9f2d8, #f8f1d7);
}

/* 美化游戏屏幕 */
.screen {
  position: relative;
  border-radius: 12px;
  border: 4px solid #474f51;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.3), inset 0 0 10px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.screen:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 1;
}

.screen:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(0, 0, 0, 0.05) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 2;
}

/* 美化功能按钮区域 */
.function {
  background: linear-gradient(135deg, #e05a5a, #c43a3a);
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 15px;
  padding: 8px 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px 0;
}

.function button {
  margin: 0 10px;
  padding: 8px 15px;
  border-radius: 10px;
  border: 2px solid #474f51;
  background: linear-gradient(to bottom, #857b7a, #706868);
  color: #fff;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.function button:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 50%;
  border-bottom-right-radius: 50%;
}

.nes-roms {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  gap: 10px;
  margin: 15px 0;
  padding: 10px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
  position: relative;
}

.nes-roms select {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 3px solid #474f51;
  background-color: #f8f1d7;
  font-size: 14px;
  font-weight: bold;
  color: #474f51;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.nes-roms select:hover {
  border-color: #474f51;
}

.nes-roms select:focus {
  outline: none;
  border-color: #da4a4a;
  box-shadow: 0 0 0 3px rgba(218, 74, 74, 0.3);
}

/* 美化控制按钮区域 */
.nes-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 15px 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.nes-controls input[type="button"] {
  flex: 1;
  min-width: 80px;
  padding: 10px 15px;
  border-radius: 10px;
  border: 3px solid #474f51;
  background: linear-gradient(to bottom, #857b7a, #706868);
  color: #fff;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.nes-controls input[type="button"]:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 50%;
  background: rgba(255, 255, 255, 0.1);
  border-bottom-left-radius: 50%;
  border-bottom-right-radius: 50%;
}

.nes-controls input[type="button"]:hover {
  background: #857b7a;
  transform: none;
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.4),
    inset -2px -2px 0 rgba(0, 0, 0, 0.1);
}

.nes-controls input[type="button"]:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 特殊按钮样式 */
.nes-pause {
  background: linear-gradient(to bottom, #da4a4a, #b43a3a) !important;
}

.nes-restart {
  background: linear-gradient(to bottom, #4a7bda, #3a5bb4) !important;
}

.nes-enablesound {
  background: linear-gradient(to bottom, #4ada7b, #3ab45b) !important;
}

.nes-zoom {
  background: linear-gradient(to bottom, #da9a4a, #b47a3a) !important;
}

/* 美化按钮样式 */
.function button,
.action button {
  text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

/* 添加游戏控制器的立体感 */
.controller {
  border-radius: 50%;
  background: linear-gradient(135deg, #8a8080, #706868);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  position: relative;
}

.controller button {
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.3);
}

.controller button:before {
  content: attr(role);
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: #474f51;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.controller button:hover:before {
  opacity: 0;
}

/* 美化下拉菜单选项 */
.nes-roms select option {
  padding: 8px;
  background-color: #f8f1d7;
}

.nes-roms select optgroup {
  font-weight: bold;
  color: #474f51;
  background-color: #e8e1c7;
}

/* 添加游戏标题样式 */
.game-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: #474f51;
  margin: 10px 0;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

.game-title:after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: titleShine 3s infinite;
}

@keyframes titleShine {
  0% {
    left: -100%;
  }
  20% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

/* 美化A和B按钮 */
.action button.a {
  background: linear-gradient(to bottom, #d44, #b22);
}

.action button.b {
  background: linear-gradient(to bottom, #44d, #22b);
}

.action button.a:hover {
  background: linear-gradient(to bottom, #d44, #b22);
}

.action button.b:hover {
  background: linear-gradient(to bottom, #44d, #22b);
}

.function button:active,
.action button:active,
.controller button:active {
  animation: buttonPress 0.2s ease;
}

@keyframes buttonPress {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

/* 添加游戏加载动画 */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #da4a4a;
  animation: spin 1s ease-in-out infinite;
}

/* 添加复古像素风格边框 */
.main {
  position: relative;
}

.main:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image: linear-gradient(
      to right,
      rgba(255, 255, 255, 0.1) 1px,
      transparent 1px
    ),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
  background-size: 8px 8px;
  z-index: 10;
}

/* 添加游戏屏幕扫描线效果 */
.screen:after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    transparent 50%,
    rgba(0, 0, 0, 0.05) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 2;
}

/* 添加游戏屏幕边角圆润效果 */
.screen canvas {
  border-radius: 8px;
}

/* 禁用所有过渡效果，防止悬停状态变化 */
.function button,
.action button,
.controller button,
.nes-controls input[type="button"],
.nes-roms select,
.controls-center-select,
.controls-center-start {
  transition: none !important;
}

/* 添加游戏标题动画效果 */
.game-title:after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  animation: titleShine 3s infinite;
}

/* 添加游戏控制器的阴影效果 */
.controller:after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 10%;
  right: 10%;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  filter: blur(5px);
  z-index: -1;
}

/* 添加下拉菜单的箭头样式 */
.nes-roms select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23474F51%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  padding-right: 30px;
}

/* 添加游戏屏幕加载状态 */
.screen.loading:before {
  content: "加载中...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 18px;
  font-weight: bold;
  z-index: 3;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* 添加按钮点击时的音量按钮效果 */
.nes-controls input[type="button"]:active:after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 0.5s ease-out;
}

/* 移动设备限制提示样式 */
.mobile-only-notice {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #f8f8f8;
  z-index: 9999;
  text-align: center;
  padding: 20px;
}

.mobile-only-notice h2 {
  margin-bottom: 15px;
  color: #333;
}

.mobile-only-notice p {
  color: #666;
}
