/* ========== 全局样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans SC', sans-serif;
  background:
      linear-gradient(135deg, #a67b5b 0%, #8b5a2b 50%, #6b4423 100%),
    repeating-linear-gradient(
      45deg,
      rgb(0 0 0 / 10%) 0,
      rgb(0 0 0 / 10%) 2px,
      rgb(0 0 0 / 5%) 2px,
      rgb(0 0 0 / 5%) 4px
    );
  color: #333;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
}

.screen.active {
  display: flex;
}

/* ========== 窗户框架 ========== */
.window-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95vw;
  height: 85vh;
  max-width: 1300px;
  max-height: 900px;
  background: #8b4513;
  border: 12px solid #654321;
  border-radius: 20px;
  box-shadow:
      0 0 0 4px #a0522d,
    0 20px 40px rgb(0 0 0 / 30%),
    inset 0 2px 10px rgb(255 255 255 / 20%);
  z-index: 10;
  pointer-events: none;
}

/* 窗框内部的玻璃区域容器 */
.window-glass {
  position: absolute;
  inset: 12px;
  border-radius: 10px;
  overflow: hidden;
  pointer-events: auto;
}

.window-sill {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 110%;
  height: 40px;
  background: linear-gradient(to bottom, #a0522d, #8b4513);
  border-radius: 0 0 20px 20px;
  box-shadow: 0 10px 20px rgb(0 0 0 / 20%);
}

.window-sill::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 8px;
  background: linear-gradient(to bottom, #deb887, #a0522d);
  border-radius: 20px 20px 0 0;
}

/* ========== 窗帘 ========== */
.curtain {
  position: absolute;
  top: 0;
  width: 20%;
  height: 100%;
  background: linear-gradient(135deg, #ff69b4, #ff1493);
  z-index: 5;
  transition: transform 1s ease;
  box-shadow: 5px 0 15px rgb(0 0 0 / 30%);
}

.curtain.left {
  left: 0;
  border-radius: 0 20px 20px 0;
  transform: translateX(-100%);
}

.curtain.right {
  right: 0;
  border-radius: 20px 0 0 20px;
  transform: translateX(100%);
}

.curtain.open {
  transform: translateX(0);
}

.curtain::before {
  content: '';
  position: absolute;
  top: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 30%), transparent);
  animation: curtain-shine 3s ease-in-out infinite;
}

@keyframes curtain-shine {
  0%,
  100% { transform: translateX(-100%); }

  50% { transform: translateX(100%); }
}

/* ========== 按钮 ========== */
.btn {
  padding: 14px 48px;
  border: 2px solid #ff8e53;
  border-radius: 25px;
  font-size: 20px;
  font-weight: 700;
  cursor: pointer;
  transition: all .3s ease;
  font-family: 'Noto Sans SC', sans-serif;
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: white;
  box-shadow: 0 4px 15px rgb(255 107 107 / 40%);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgb(255 107 107 / 60%);
}

.btn:active {
  transform: translateY(0);
}

/* ========== 开始界面 ========== */
[id="start-screen"] {
  background: linear-gradient(135deg, #87ceeb 0%, #98d8e8 50%, #b0e0e6 100%);
  flex-direction: column;
  z-index: 20;
}

.start-content {
  text-align: center;
  animation: fade-in-up .8s ease;
  z-index: 20;
  position: relative;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.game-title {
  font-size: 72px;
  font-weight: 900;
  background: linear-gradient(135deg, #ff6b6b, #ff8e53, #ffd93d);
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  text-shadow: 2px 2px 4px rgb(0 0 0 / 10%);
}

.game-subtitle {
  font-size: 22px;
  color: #666;
  margin-bottom: 40px;
  font-weight: 700;
}

.instructions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgb(255 255 255 / 90%);
  padding: 12px 20px;
  border-radius: 15px;
  font-size: 16px;
  backdrop-filter: blur(10px);
  border: 2px solid rgb(255 255 255 / 30%);
  box-shadow: 0 4px 15px rgb(0 0 0 / 10%);
}

.instruction-item .icon {
  font-size: 28px;
}

.high-score-display {
  font-size: 18px;
  color: #ff8e53;
  margin-bottom: 30px;
  background: rgb(255 255 255 / 80%);
  padding: 10px 20px;
  border-radius: 20px;
  border: 2px solid #ffd93d;
}

.camera-hint {
  margin-top: 16px;
  font-size: 13px;
  color: #666;
}

/* ========== 游戏界面 ========== */
[id="game-screen"] {
  background: linear-gradient(135deg, #87ceeb 0%, #98d8e8 50%, #b0e0e6 100%);
  flex-direction: column;
}

/* HUD - 窗户风格 */
[id="game-hud"] {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 12px 30px;
  background: rgb(139 69 19 / 90%);
  backdrop-filter: blur(10px);
  border: 3px solid #654321;
  border-radius: 25px;
  box-shadow: 0 8px 25px rgb(0 0 0 / 30%);
}

.hud-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-label {
  font-size: 13px;
  color: #f5deb3;
  text-transform: uppercase;
  font-weight: 700;
}

.hud-value {
  font-size: 24px;
  font-weight: 900;
  color: #ffd93d;
  text-shadow: 1px 1px 2px rgb(0 0 0 / 30%);
}

.hud-timer .hud-value {
  color: #4ecdc4;
  min-width: 40px;
  text-align: center;
}

.hud-timer .hud-value.warning {
  color: #ff6b6b;
  animation: pulse .5s ease infinite;
}

@keyframes pulse {
  0%,
  100% { opacity: 1; }

  50% { opacity: .5; }
}

.progress-bar {
  width: 200px;
  height: 20px;
  background: rgb(255 255 255 / 20%);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  border: 2px solid #654321;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ecdc4, #ffd93d);
  border-radius: 8px;
  transition: width .3s ease;
  width: 0%;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: #333;
  text-shadow: 0 1px 2px rgb(255 255 255 / 50%);
}

.hud-combo {
  animation: combo-pop-in .3s ease;
}

@keyframes combo-pop-in {
  0%  {
    transform: scale(.5);
    opacity: 0;
  }

  50% { transform: scale(1.2); }

  100%  {
    transform: scale(1);
    opacity: 1;
  }
}

.combo-text {
  font-size: 28px;
  font-weight: 900;
  color: #ff6b6b;
  text-shadow: 0 0 10px rgb(255 107 107 / 50%);
}

/* 游戏区域 - 窗户玻璃（现在是窗框的子元素） */
[id="game-area"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
      inset 0 2px 10px rgb(0 0 0 / 20%),
    0 0 0 1px rgb(255 255 255 / 10%);
  background: rgb(200 220 240 / 30%);
  backdrop-filter: blur(2px);
}

.game-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

[id="canvas-image"] { 
  z-index: 1; 

  /* 背景图片在玻璃后面 */
  border-radius: 8px;
}

[id="canvas-dirt"] { 
  z-index: 2; 

  /* 脏污层在玻璃表面 */
  border-radius: 8px;
}

[id="canvas-cursor"] { 
  z-index: 3; 
  pointer-events: none;

  /* 光标在玻璃前面 */
}

/* 玻璃反光效果 */
[id="game-area"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgb(255 255 255 / 10%) 0%,
    rgb(255 255 255 / 5%) 50%,
    rgb(255 255 255 / 10%) 100%
  );
  pointer-events: none;
  z-index: 4;
  border-radius: 8px;
  mix-blend-mode: overlay;
}

/* 玻璃边缘高光 */
[id="game-area"]::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 8px;
  pointer-events: none;
  z-index: 5;
  box-shadow:
      inset 0 1px 0 rgb(255 255 255 / 40%),
    inset 0 -1px 0 rgb(0 0 0 / 20%);
}

/* 摄像头预览 - 窗户小镜子 */
[id="camera-preview"] {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 200px;
  height: 150px;
  border-radius: 15px;
  overflow: hidden;
  border: 3px solid #654321;
  box-shadow: 0 4px 20px rgb(0 0 0 / 40%);
  z-index: 50;
  background: #000;
}

[id="camera-video"] {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

[id="camera-overlay"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

.camera-label {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-size: 11px;
  color: rgb(255 255 255 / 70%);
  background: rgb(139 69 19 / 80%);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid #654321;
}

/* 场景元素解锁提示 */

@keyframes element-reveal {
  0%  {
    transform: scale(0);
    opacity: 0;
  }

  50%  {
    transform: scale(1.2);
    opacity: 1;
  }

  100%  {
    transform: scale(1);
    opacity: 1;
  }
}

.element-sparkle {
  position: absolute;
  width: 20px;
  height: 20px;
  background: radial-gradient(circle, #ffd93d, transparent);
  border-radius: 50%;
  animation: sparkle .5s ease-out;
  pointer-events: none;
}

@keyframes sparkle {
  0%  {
    transform: scale(0);
    opacity: 1;
  }

  100%  {
    transform: scale(3);
    opacity: 0;
  }
}

/* 覆盖层 */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(5px);
}

/* 倒计时覆盖层 - 透明背景，不遮挡游戏画面 */
[id="countdown-overlay"] {
  background: rgb(0 0 0 / 20%);
  backdrop-filter: none;
}

.countdown-number {
  font-size: 150px;
  font-weight: 900;
  color: #fff;
  animation: countdown-pop 1s ease;
  text-shadow: 0 0 40px rgb(102 126 234 / 80%);
}

@keyframes countdown-pop {
  0%  {
    transform: scale(2);
    opacity: 0;
  }

  30%  {
    transform: scale(.9);
    opacity: 1;
  }

  50% { transform: scale(1.1); }

  100%  {
    transform: scale(1);
    opacity: 1;
  }
}

/* 关卡完成 */
.level-complete-content {
  text-align: center;
  animation: fade-in-up .5s ease;
}

.level-complete-content h2 {
  font-size: 48px;
  margin-bottom: 20px;
}

.level-complete-content p {
  font-size: 20px;
  margin-bottom: 10px;
  color: #ccc;
}

.level-complete-content .btn {
  margin-top: 20px;
}

/* ========== 场景元素解锁 ========== */
.element-unlock {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgb(255 255 255 / 95%);
  border: 3px solid #ffd93d;
  border-radius: 20px;
  padding: 20px 30px;
  text-align: center;
  box-shadow: 0 10px 30px rgb(255 217 61 / 30%);
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.unlock-icon {
  font-size: 48px;
  margin-bottom: 10px;
  animation: bounce .5s ease infinite alternate;
}

.unlock-text {
  font-size: 18px;
  font-weight: 700;
  color: #8b4513;
}

@keyframes unlock-fade-in {
  0%  {
    opacity: 0;
    transform: translate(-50%, -50%) scale(.5);
  }

  50%  {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }

  100%  {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* ========== 结算界面 ========== */
[id="end-screen"] {
  background: linear-gradient(135deg, #87ceeb 0%, #98d8e8 50%, #b0e0e6 100%);
  flex-direction: column;
  overflow-y: auto;
  z-index: 20;
}

.end-content {
  text-align: center;
  padding: 40px;
  animation: fade-in-up .8s ease;
  max-width: 800px;
  width: 100%;
  background: rgb(255 255 255 / 95%);
  border-radius: 20px;
  border: 4px solid #8b4513;
  box-shadow: 0 20px 40px rgb(0 0 0 / 30%);
  margin: 20px;
}

.end-content h1 {
  font-size: 56px;
  margin-bottom: 30px;
  background: linear-gradient(135deg, #ff6b6b, #ff8e53, #ffd93d);
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.end-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-bottom: 40px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgb(139 69 19 / 10%);
  padding: 20px 30px;
  border-radius: 16px;
  border: 2px solid #8b4513;
  backdrop-filter: blur(10px);
}

.stat-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
  font-weight: 700;
}

.stat-value {
  font-size: 36px;
  font-weight: 900;
  color: #ff8e53;
}

/* 场景统计 */
.scene-stats {
  margin-bottom: 30px;
  text-align: left;
}

.scene-stats h3 {
  font-size: 20px;
  margin-bottom: 16px;
  color: #666;
  font-weight: 700;
  text-align: center;
}

.scene-progress {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scene-item {
  display: flex;
  align-items: center;
  gap: 15px;
}

.scene-name {
  width: 120px;
  font-weight: 600;
  color: #8b4513;
}

.scene-bar {
  flex: 1;
  height: 20px;
  background: rgb(139 69 19 / 20%);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

.scene-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff8e53, #ffd93d);
  border-radius: 10px;
  transition: width .5s ease;
}

.scene-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 600;
  color: #8b4513;
}

[id="end-gallery"] h3 {
  font-size: 20px;
  margin-bottom: 16px;
  color: #666;
  font-weight: 700;
}

.gallery-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
}

.gallery-item {
  width: 120px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  border: 3px solid #8b4513;
  transition: transform .3s ease;
  box-shadow: 0 4px 15px rgb(0 0 0 / 20%);
  position: relative;
}

.gallery-item:hover {
  transform: scale(1.1);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgb(139 69 19 / 90%);
  color: white;
  padding: 5px;
  font-size: 10px;
  opacity: 0;
  transition: opacity .3s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

.gallery-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.gallery-stats {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
}

.end-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

/* ========== 手掌状态提示 ========== */
.hand-status {
  position: absolute;
  bottom: 210px;
  right: 20px;
  z-index: 60;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  backdrop-filter: blur(10px);
}

.hand-status.open {
  background: rgb(78 205 196 / 30%);
  color: #4ecdc4;
  border: 1px solid rgb(78 205 196 / 50%);
}

.hand-status.closed {
  background: rgb(255 107 107 / 30%);
  color: #ff6b6b;
  border: 1px solid rgb(255 107 107 / 50%);
}

/* ========== 水光特效 ========== */
@keyframes water-shine {
  0% { opacity: .8; }

  100% { opacity: 0; }
}

/* ========== Boss 战样式 ========== */

/* Boss 来袭覆盖层 */
.boss-overlay {
  background: rgb(20 0 0 / 85%) !important;
}

.boss-incoming-content {
  text-align: center;
  animation: boss-appear .5s ease;
}

.boss-incoming-icon {
  font-size: 120px;
  animation: boss-icon-bounce .6s ease infinite alternate;
  margin-bottom: 10px;
}

@keyframes boss-icon-bounce {
  0% { transform: scale(1) rotate(-5deg); }

  100% { transform: scale(1.15) rotate(5deg); }
}

.boss-incoming-content h2 {
  font-size: 56px;
  font-weight: 900;
  color: #f44;
  text-shadow: 0 0 30px rgb(255 0 0 / 60%), 0 0 60px rgb(255 0 0 / 30%);
  margin-bottom: 10px;
  letter-spacing: 4px;
}

.boss-incoming-content p {
  font-size: 24px;
  color: #ffd700;
  animation: fade-in-up .5s ease .3s both;
}

@keyframes boss-appear {
  0%  {
    transform: scale(.3) rotate(-10deg);
    opacity: 0;
  }

  60%  {
    transform: scale(1.1) rotate(3deg);
    opacity: 1;
  }

  100%  {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

.boss-shake {
  animation: screen-shake .1s ease infinite;
}

@keyframes screen-shake {
  0% { transform: translate(0, 0); }

  25% { transform: translate(-3px, 2px); }

  50% { transform: translate(3px, -2px); }

  75% { transform: translate(-2px, -3px); }

  100% { transform: translate(2px, 3px); }
}

/* Boss 血条 HUD */
[id="boss-hud"] {
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 20px;
  background: rgb(0 0 0 / 70%);
  backdrop-filter: blur(10px);
  border-radius: 30px;
  border: 1px solid rgb(255 68 68 / 30%);
  animation: fade-in-up .3s ease;
}

.boss-hud-label {
  font-size: 16px;
  font-weight: 900;
  color: #f44;
  text-shadow: 0 0 10px rgb(255 0 0 / 50%);
  white-space: nowrap;
}

.boss-hp-bar {
  width: 300px;
  height: 18px;
  background: rgb(100 0 0 / 40%);
  border-radius: 9px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgb(255 68 68 / 30%);
}

.boss-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #f44, #ff6b6b);
  border-radius: 9px;
  transition: width .3s ease;
  width: 100%;
}

.boss-hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgb(0 0 0 / 80%);
}

/* Boss 战完成界面 */
.boss-complete-content {
  text-align: center;
  animation: fade-in-up .5s ease;
}

.boss-complete-content h2 {
  font-size: 52px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #ffd700, #ff6b6b, #f44);
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.boss-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
}

.boss-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgb(255 255 255 / 8%);
  padding: 16px 24px;
  border-radius: 12px;
  border: 1px solid rgb(255 68 68 / 20%);
}

.boss-stat-label {
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
}

.boss-stat-value {
  font-size: 32px;
  font-weight: 900;
  color: #ffd700;
}

.boss-complete-content p {
  font-size: 20px;
  margin-bottom: 8px;
  color: #ccc;
}

.boss-bonus-text {
  font-size: 15px !important;
  color: #aaa !important;
  margin-bottom: 20px !important;
}

.boss-complete-content .btn {
  margin-top: 16px;
}

/* ========== 语言切换按钮 ========== */
.lang-toggle-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgb(255 255 255 / 90%);
  border: 2px solid #8b4513;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #8b4513;
  box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
  transition: all .3s ease;
  backdrop-filter: blur(10px);
}

.lang-toggle-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgb(0 0 0 / 25%);
  background: rgb(255 255 255 / 100%);
}

.lang-toggle-btn:active {
  transform: translateY(0);
}

.lang-toggle-btn .lang-icon {
  font-size: 18px;
}

.lang-toggle-btn .lang-text {
  font-size: 14px;
  min-width: 28px;
  text-align: center;
}

/* ========== 掌纹认证区域 ========== */
.palm-auth-section {
  margin-bottom: 20px;
  padding: 16px 24px;
  background: rgb(255 255 255 / 85%);
  border-radius: 16px;
  border: 2px solid #deb887;
  box-shadow: 0 4px 12px rgb(0 0 0 / 8%);
}

.palm-status {
  display: flex;
  flex-flow: column wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.palm-user-select {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

.palm-select {
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid #deb887;
  background: rgb(255 255 255 / 90%);
  font-size: 14px;
  font-weight: 600;
  color: #8b4513;
  cursor: pointer;
  min-width: 160px;
  outline: none;
  transition: border-color .2s;
}

.palm-select:focus {
  border-color: #4ecdc4;
}

.palm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.palm-welcome {
  font-size: 16px;
  font-weight: 700;
  color: #8b4513;
}

.palm-message {
  margin-top: 10px;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  animation: fade-in-up .3s ease;
}

.palm-message.success {
  background: rgb(78 205 196 / 15%);
  color: #2d9a8f;
  border: 1px solid rgb(78 205 196 / 30%);
}

.palm-message.error {
  background: rgb(255 107 107 / 15%);
  color: #d44;
  border: 1px solid rgb(255 107 107 / 30%);
}

.palm-message.info {
  background: rgb(255 142 83 / 15%);
  color: #c66a30;
  border: 1px solid rgb(255 142 83 / 30%);
}

/* 小按钮 */
.btn-small {
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .3s ease;
  font-family: 'Noto Sans SC', sans-serif;
}

.btn-palm {
  background: linear-gradient(135deg, #4ecdc4, #44b8a8);
  color: white;
  box-shadow: 0 3px 10px rgb(78 205 196 / 30%);
}

.btn-palm:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgb(78 205 196 / 50%);
}

.btn-outline {
  background: transparent;
  color: #8b4513;
  border: 2px solid #deb887;
}

.btn-outline:hover {
  background: rgb(139 69 19 / 8%);
}

.btn-secondary {
  padding: 14px 36px;
  border-radius: 25px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all .3s ease;
  font-family: 'Noto Sans SC', sans-serif;
  background: linear-gradient(135deg, #4ecdc4, #44b8a8);
  color: white;
  box-shadow: 0 4px 15px rgb(78 205 196 / 30%);
  border: 2px solid #44b8a8;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgb(78 205 196 / 50%);
}

.start-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgb(0 0 0 / 60%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(5px);
}

.modal-content {
  background: rgb(255 255 255 / 98%);
  border-radius: 20px;
  padding: 36px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  border: 3px solid #8b4513;
  box-shadow: 0 20px 50px rgb(0 0 0 / 30%);
  animation: fade-in-up .3s ease;
}

.modal-content h2 {
  font-size: 28px;
  margin-bottom: 12px;
  color: #8b4513;
}

.modal-content p {
  font-size: 15px;
  color: #666;
  margin-bottom: 20px;
}

/* 掌纹注册弹窗 */
.palm-register-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 16px;
}

.palm-input {
  padding: 12px 20px;
  border: 2px solid #deb887;
  border-radius: 12px;
  font-size: 16px;
  font-family: 'Noto Sans SC', sans-serif;
  outline: none;
  transition: border-color .3s ease;
  text-align: center;
}

.palm-input:focus {
  border-color: #8b4513;
  box-shadow: 0 0 0 3px rgb(139 69 19 / 10%);
}

/* ========== 排行榜 ========== */
.leaderboard-modal {
  max-width: 550px;
  max-height: 80vh;
  overflow-y: auto;
}

.leaderboard-content {
  margin-bottom: 20px;
}

.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgb(139 69 19 / 5%);
  border-radius: 12px;
  border: 1px solid rgb(139 69 19 / 10%);
  transition: background .2s ease;
}

.leaderboard-item:hover {
  background: rgb(139 69 19 / 10%);
}

.leaderboard-item.current-user {
  background: rgb(78 205 196 / 12%);
  border-color: rgb(78 205 196 / 30%);
  box-shadow: 0 2px 8px rgb(78 205 196 / 15%);
}

.lb-rank {
  font-size: 20px;
  font-weight: 900;
  min-width: 40px;
  text-align: center;
  color: #8b4513;
}

.lb-name {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
  color: #333;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font-size: 18px;
  font-weight: 900;
  color: #ff8e53;
  min-width: 60px;
  text-align: right;
}

.lb-levels {
  font-size: 12px;
  color: #888;
  min-width: 35px;
  text-align: center;
}

.lb-date {
  font-size: 12px;
  color: #aaa;
  min-width: 40px;
  text-align: right;
}

.leaderboard-empty {
  padding: 30px;
  color: #999;
  font-size: 15px;
}

/* 结算界面排行榜 */
.end-leaderboard-info {
  margin-bottom: 16px;
}

.end-rank-text {
  font-size: 18px;
  font-weight: 700;
  color: #4ecdc4;
  padding: 10px 20px;
  background: rgb(78 205 196 / 10%);
  border-radius: 12px;
  border: 1px solid rgb(78 205 196 / 20%);
  display: inline-block;
}

.end-leaderboard-container {
  margin-bottom: 20px;
  max-height: 250px;
  overflow-y: auto;
  border-radius: 12px;
}

/* ========== 掌纹摄像头预览窗口 ========== */
.palm-camera-preview {
  position: relative;
  width: 240px;
  height: 180px;
  margin: 12px auto;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid #4ecdc4;
  box-shadow: 0 4px 16px rgb(78 205 196 / 30%);
  background: #000;
}

.palm-camera-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.palm-preview-guide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.palm-guide-frame {
  width: 120px;
  height: 120px;
  border: 3px dashed rgb(78 205 196 / 80%);
  border-radius: 50%;
  animation: palm-guide-breath 2s ease-in-out infinite;
}

@keyframes palm-guide-breath {
  0%,
  100% {
    transform: scale(1);
    opacity: .7;
  }

  50%  {
    transform: scale(1.05);
    opacity: 1;
  }
}

.palm-guide-text {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: rgb(0 0 0 / 60%);
  padding: 4px 8px;
  border-radius: 4px;
}
