body {
  background: #f5f5f5;
  font-family: "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  box-sizing: border-box;
}

/* 文本显示区 */
.display-area {
  width: 100%;
  max-width: 600px;
  height: 60px;
  background: white;
  border: 2px solid #bebebe;
  border-radius: 8px;
  font-size: 28px;
  font-weight: bold;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
  padding: 0 10px;
  box-sizing: border-box;
  overflow: hidden;
  text-align: center;
  line-height: 1.4;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  font-family: "STKaiti", "KaiTi", "华文楷体", "楷体", serif;
}

/* 高亮待录入字符样式 */
.target-char {
  color: #FF4500; /* 橘红色 */
  font-size: 44px; /* 更大字体 */
  font-weight: bold;
  /* text-decoration: underline; */
}

/* 已录入字符基础样式 */
.completed-char {
  color: #4A90E2;
  font-weight: bold;
}

/* 弹跳放大动画 */
@keyframes bounceScale {
  0% { transform: scale(1); color: #FF4500;}
  20% { transform: scale(2.2);color: #FF4500; }
  50% { transform: scale(0.9); color: #FF4500;}
  70% { transform: scale(1.1); color: #4A90E2;} 
  100% { transform: scale(1); color: #4A90E2;}
}

.animate-char {
  animation: bounceScale 2.5s ease-out forwards;
}

/* 3D旋转放大动画 */
/* @keyframes rotateScale {
  0% {
    transform: perspective(500px) rotateY(0deg) scale(1);
  }
  50% {
    transform: perspective(500px) rotateY(180deg) scale(2.6);
  }
  100% {
    transform: perspective(500px) rotateY(360deg) scale(1);
  }
} */
/* 动画类 - 只应用于刚完成的字符 */
/* .animate-char {
  animation: rotateScale 1.s ease-out forwards;
} */

/* 键盘容器 */
.keyboard {
  background: #333;
  padding: 15px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  display: block; /* 默认显示 */
}

.row {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  overflow-y: hidden;
}

.key {
  width: 50px;
  height: 50px;
  margin: 0 4px;
  background: #e0e0e0;
  border: 1px solid #999;
  border-radius: 6px;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  user-select: none;
  transition: background 0.15s, transform 0.1s;
  opacity: 0.5; /* 默认半透明 */
  position: relative; /* 为数字标号提供定位上下文 */
}

/* 提示信息 */
.hint {
  margin-top: 20px;
  font-size: 16px;
  color: #666;
}

/* 三键一字提示文字 */
.tip-text {
  font-size: 18px;
  font-weight: bold;
  /* color: #555555; */
  color: #555555;
  text-align: center;
  margin: 15px 0;
}

/* 刷新按钮样式 */
.refresh-btn {
  margin-top: 25px;
  padding: 12px 24px;
  font-size: 18px;
  font-weight: bold;
  color: white;
  background: linear-gradient(135deg, #6060ff 0%, #4a55e0 100%);
  border: none;
  border-radius: 25px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(96, 96, 255, 0.3);
  transition: all 0.3s ease;
  font-family: "Microsoft YaHei", sans-serif;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.refresh-btn:hover {
  background: linear-gradient(135deg, #4a55e0 0%, #3a43c0 100%);
  box-shadow: 0 6px 20px rgba(96, 96, 255, 0.4);
  transform: translateY(-2px);
}

.refresh-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(96, 96, 255, 0.3);
  outline: none;
}

.refresh-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(96, 96, 255, 0.5);
}

/* 防止点击时出现默认矩形框 */
.refresh-btn {
  -webkit-tap-highlight-color: transparent; /* 移动端点击高亮 */
  user-select: none; /* 防止文本选中 */
  outline: none; /* 移除默认轮廓 */
}

/* 图片显示区域 */
.image-display-area {
  width: 100%;
  max-width: 600px;
  height: 160px;
  background: white;
  border: 2px solid #bebebe;
  border-radius: 8px;
  /* margin-bottom: 15px; */
  /* padding: 10px; */
  box-sizing: border-box;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  position: relative;
  display: flex;
  justify-content: space-around;
  align-items: center;
  flex-wrap: nowrap;
}

/* 进度条样式 */
.progress-container {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 5px;
  background-color: #e0e0e0;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  overflow: hidden;
  z-index: 1;
}

.progress-bar {
  height: 100%;
  background-color: #4A90E2;
  width: 0;
  transition: width 0.3s ease;
}

.image-display-area img {
  max-width: 90px;
  max-height: 136px;
  width: 100%;
  flex: 1;
  object-fit: contain;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.5s ease;
  z-index: 0;
  /* margin: 0 5px; */
}

/* 响应式设计 */
@media (max-width: 480px) {
  body {
    padding: 10px;
  }
  
  .key {
    width: 40px;
    height: 40px;
    margin: 0 2px;
    font-size: 16px;
  }
  
  .space {
    width: 200px;
  }
  
  .display-area, 
  .image-display-area {
    width: 100%;
  }
  
  .tip-text {
    font-size: 18px;
    margin: 10px 0;
  }
  
  .refresh-btn {
    padding: 10px 20px;
    font-size: 16px;
  }
  
  .keyboard {
    padding: 10px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .row {
    margin-bottom: 6px;
    width: 100%;
  }
}

@media (max-width: 360px) {
  .key {
    width: 35px;
    height: 35px;
    font-size: 14px;
  }
  
  .space {
    width: 150px;
  }
  
  .display-area,
  .image-display-area {
    width: 100%;
  }
  
  .tip-text {
    font-size: 14px;
    margin: 6px 0;
  }
  
  .tip-text {
    font-size: 16px;
    margin: 8px 0;
  }
}

@media (max-width: 320px) {
  .key {
    width: 30px;
    height: 30px;
    font-size: 12px;
    margin: 0 1px;
  }
  
  .space {
    width: 120px;
  }
  
  .keyboard {
    padding: 8px;
  }
  
  .display-area {
    font-size: 20px;
  }
  
  .target-char {
    font-size: 28px;
  }
  
  .display-area,
  .image-display-area {
    width: 100%;
  }
  
  .tip-text {
    font-size: 14px;
    margin: 6px 0;
  }
  
  .refresh-btn {
    padding: 8px 16px;
    font-size: 14px;
  }
}

@media (max-width: 280px) {
  .key {
    width: 25px;
    height: 25px;
    font-size: 10px;
    margin: 0 1px;
  }
  
  .space {
    width: 100px;
  }
  
  .keyboard {
    padding: 6px;
  }
  
  .display-area {
    font-size: 18px;
    height: 50px;
  }
  
  .target-char {
    font-size: 24px;
  }
  
  .image-display-area {
    height: 120px;
  }
  
  .image-display-area img {
    max-width: 60px;
    max-height: 60px;
  }
  
  .display-area,
  .image-display-area {
    width: 100%;
  }
  
  .tip-text {
    font-size: 12px;
    margin: 5px 0;
  }
  
  .refresh-btn {
    padding: 6px 12px;
    font-size: 12px;
    margin-top: 15px;
  }
}

/* 确保键盘不会溢出屏幕 */
.keyboard {
  max-width: 100%;
  overflow-x: hidden;
}

.row {
  flex-wrap: nowrap;
  overflow-x: hidden;
}

.key.normal {
  opacity: 0.5;
}

.key.target {
  background: #FF4500 !important; /* 橘红色背景 */
  color: white !important;
  border-color: #cc3700 !important;
  opacity: 1; /* 完全显示 */
  /* transform: scale(1.1); 稍微放大 */
  box-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
}

.key:hover:not(.target) {
  background: #d0d0d0;
}

.key:active {
  background: #b0b0b0;
  transform: translateY(2px);
}
.key.active {
  background: #b0b0b0;
  transform: translateY(2px);
}


.key.target:active {
  background: #cc3700 !important;
}

.key.pressed {
  background: #4A90E2 !important; /* 森林绿色背景，表示已按下 */
  color: white !important;
  border-color: #1a6b1a !important;
  opacity: 1;
  transform: scale(1.05);
  box-shadow: 0 0 10px rgba(34, 139, 34, 0.5);
}

.space {
  width: 300px;
}

/* 按键数字标号样式 */
.key .key-counter {
  position: absolute;
  top: 0px;
  right: 0px;
  background: #4A90E2;
  color: white;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
  z-index: 10;
}

