/* style.css */
:root {
  --main-bg: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  --accent: #ffb347;
  --correct: #4caf50;
  --wrong: #e53935;
  --shadow: 0 4px 24px rgba(30,60,114,0.2);
  --radius: 18px;
  --font-main: 'Segoe UI', '微軟正黑體', Arial, sans-serif;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-main);
  background: var(--main-bg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.center-box {
  background: rgba(30,60,114,0.92);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  min-width: 320px;
  max-width: 95vw;
  margin: 2rem auto;
  text-align: center;
}

input[type="text"] {
  padding: 0.7em 1em;
  border-radius: var(--radius);
  border: none;
  font-size: 1.2em;
  margin: 1em 0;
  width: 80%;
  max-width: 320px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

button {
  background: var(--accent);
  color: #222;
  border: none;
  border-radius: var(--radius);
  padding: 0.7em 2em;
  font-size: 1.1em;
  margin: 0.5em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: background 0.2s, transform 0.2s;
}
button:hover, .lb-btn.active {
  background: #ffd580;
  transform: translateY(-2px) scale(1.04);
}

.hidden { display: none !important; }

.menu-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1em;
  margin: 1.5em 0 1em 0;
}

.leaderboard-switch {
  margin-bottom: 1em;
}

#leaderboard {
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 1em;
  max-width: 400px;
  margin: 0 auto;
  color: #fff;
  font-size: 1em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1em;
  font-size: 1.2em;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 0.7em 1em;
}

#words-area {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2em;
  justify-content: center;
  margin: 2em 0 1em 0;
  min-height: 60px;
}

.word {
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 1.5em;
  padding: 0.5em 1.2em;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  margin: 0.2em;
  position: relative;
  transition: background 0.2s, transform 0.2s;
  animation: wordAppear 0.5s;
}

@keyframes wordAppear {
  0% { opacity: 0; transform: scale(0.7) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.word.correct {
  background: var(--correct);
  color: #fff;
  animation: wordCorrect 0.5s;
}
@keyframes wordCorrect {
  0% { background: var(--correct); transform: scale(1.2); }
  100% { background: rgba(255,255,255,0.18); transform: scale(1); }
}

.word.wrong {
  background: var(--wrong);
  color: #fff;
  animation: wordWrong 0.4s;
}
@keyframes wordWrong {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

#final-score {
  font-size: 2.2em;
  color: var(--accent);
  margin: 1.5em 0;
  animation: scorePop 0.7s;
}
@keyframes scorePop {
  0% { transform: scale(0.7); opacity: 0; }
  80% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); }
}

/* 錯誤輸入時的動畫效果 */
.shake {
  animation: shake 0.4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-10px); }
  40%, 80% { transform: translateX(10px); }
}

@media (max-width: 600px) {
  .center-box {
    padding: 1.2rem 0.5rem;
    min-width: unset;
  }
  .game-header {
    flex-direction: column;
    gap: 0.5em;
    font-size: 1em;
  }
  #words-area {
    font-size: 1.1em;
    gap: 0.7em;
  }
  button, input[type="text"] {
    font-size: 1em;
    padding: 0.6em 1em;
  }
}

.zh { font-size: 0.8em; color: #ccc; } 