

/* 项目主题色彩变量 */
:root {
  --gold-primary: #D4AF37;
  --earth-brown: #8B4513;
  --chocolate: #582a18;
  --dark-brown: #3C1F0D;
  --pure-white: #FFFFFF;
  --soft-gold: #F5E6B3;
  --medium-brown: #5E2F12;
  --translucent-dark: rgba(60, 31, 13, 0.95);
  --glass-surface: rgba(60, 31, 13, 0.8);
  --gold-glow: rgba(212, 175, 55, 0.3);
}

html, body {
  margin: 0;
  overflow: hidden;
  height: 100%;
  width: 100%;
  position: relative;
  font-family: "Comfortaa", cursive;
  background: linear-gradient(135deg, var(--dark-brown) 0%, var(--chocolate) 50%, var(--medium-brown) 100%);
}

#container {
  width: 100%;
  height: 100%;
  position: relative;
}

#container #score {
  position: absolute;
  top: 20px;
  width: 100%;
  text-align: center;
  font-size: 10vh;
  font-weight: 700;
  transition: all 0.5s ease;
  color: var(--gold-primary);
  text-shadow: 0 0 20px var(--gold-glow), 0 2px 4px rgba(0,0,0,0.5);
  transform: translatey(-200px) scale(1);
  z-index: 100;
}
#container #game {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

#container #level-indicator {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--soft-gold);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  z-index: 80;
  padding: 10px 16px;
  background: var(--glass-surface);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 -6px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.06);
}

#container #instructions {
  color: var(--gold-primary);
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(255, 200, 100, 0.35), 0 1px 2px rgba(0,0,0,0.45);
}
#container .game-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 50;
  pointer-events: none; /* 默认不拦截点击 */
}

#container .level-passed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 60;
  pointer-events: none; /* 默认不拦截点击 */
}

#container .game-over * {
  transition: all 0.5s ease;
  opacity: 0;
  transform: translatey(-50px);
  color: var(--pure-white);
}

#container .level-passed .badge {
  transition: all 0.5s ease;
  opacity: 0;
  transform: translatey(-50px);
  color: var(--pure-white);
  display: inline-block;
  padding: 10px 16px;
  font-size: 16px;
  font-weight: 600;
  background: var(--glass-surface);
  backdrop-filter: blur(14px);
  border-radius: 10px;
  border: 1px solid var(--soft-gold);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.08);
}

#container .game-over h2 {
  margin: 0 0 20px 0;
  padding: 0;
  font-size: 40px;
  font-weight: 700;
  color: #4a2e1a; /* 深棕色 */
  background: none;
  backdrop-filter: none;
  border-radius: 0;
  border: none;
  box-shadow: none;
  text-shadow: none;
}

/* 过关小标签已替代原大标题样式 */

#container .game-over p {
  margin: 10px 0;
  padding: 15px 30px;
  background: var(--glass-surface);
  backdrop-filter: blur(15px);
  border-radius: 15px;
  border: 1px solid var(--soft-gold);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  font-weight: 400;
}

/* 过关小标签统一使用 .badge 样式，无需附加文案块 */
#container .game-ready {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  z-index: 40;
}

#container .game-ready #start-button {
  transition: all 0.5s ease;
  opacity: 0;
  transform: translatey(-50px);
  border: 2px solid var(--gold-primary);
  padding: 20px 40px;
  background: var(--glass-surface);
  backdrop-filter: blur(20px);
  color: var(--pure-white);
  font-size: 30px;
  font-weight: 600;
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
  cursor: pointer;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#container .game-ready #start-button:hover,
#container .game-ready #start-button:active {
  background: var(--gold-primary);
  color: var(--dark-brown);
  transform: translatey(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
}

#container #instructions {
  position: absolute;
  width: 100%;
  top: 16vh;
  left: 0;
  text-align: center;
  transition: all 0.5s ease;
  opacity: 0;
  color: var(--soft-gold);
  font-weight: 400;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  padding: 0 20px;
  font-size: 16px;
}

#container #instructions.hide {
  opacity: 0 !important;
}
#container.playing #score, #container.resetting #score {
  transform: translatey(0px) scale(1);
}
#container.playing #instructions {
  opacity: 1;
}
#container.ready .game-ready #start-button {
  opacity: 1;
  transform: translatey(0);
}
#container.ended #score {
  transform: translatey(6vh) scale(1.5);
}
#container.ended .game-over * {
  opacity: 1;
  transform: translatey(0);
}
#container.ended .game-over { pointer-events: auto; }
#container.ended .game-over p {
  transition-delay: 0.3s;
}

#container.level-passed #score {
  transform: translatey(6vh) scale(1.5);
}
#container.level-passed .level-passed .badge {
  opacity: 1;
  transform: translatey(0);
}
#container.level-passed .level-passed { pointer-events: auto; }

/* 移动端适配 */
@media screen and (max-width: 768px) {
  #container #score {
    font-size: 8vh;
    top: 10px;
  }
  
  #container .game-over h2 {
    font-size: 28px;
    padding: 15px 30px;
    margin: 0 0 15px 0;
  }
  
  #container .game-over p {
    font-size: 16px;
    padding: 12px 25px;
    margin: 8px 15px;
    text-align: center;
  }
  
  #container .game-ready #start-button {
    font-size: 24px;
    padding: 15px 30px;
  }
  
  #container #instructions {
    font-size: 14px;
    top: 12vh;
    padding: 0 20px;
  }
}

@media screen and (max-width: 480px) {
  #container #score {
    font-size: 6vh;
    top: 5px;
  }
  
  #container .game-over h2 {
    font-size: 24px;
    padding: 12px 25px;
    margin: 0 0 12px 0;
  }
  
  #container .game-over p {
    font-size: 14px;
    padding: 10px 20px;
    margin: 6px 10px;
  }
  
  #container .game-ready #start-button {
    font-size: 20px;
    padding: 12px 24px;
  }
  
  #container #instructions {
    font-size: 12px;
    top: 10vh;
  }
}

/* 触摸优化已集成到按钮样式中 */

/* 防止移动端双击缩放 */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* 游戏区域触摸优化 */
#game {
  touch-action: manipulation;
}
