* { margin: 0; padding: 0; box-sizing: border-box; user-select: none; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: #1a0f0a;
  touch-action: none;
  font-family: 'Georgia', 'Times New Roman', serif;
  color: #d4c4a8;
}

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

#ui-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 10;
}

#ui-overlay > * { pointer-events: auto; }

.screen {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(26, 15, 10, 0.85);
  text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.title {
  font-size: clamp(2rem, 8vw, 5rem);
  color: #e8d5b0;
  text-align: center;
  margin-bottom: 0.2em;
  letter-spacing: 0.15em;
  text-shadow:
    0 0 20px rgba(200, 160, 100, 0.3),
    2px 2px 0 #2a1a10;
  font-weight: normal;
  font-style: italic;
}

.subtitle {
  font-size: clamp(0.8rem, 2.5vw, 1.2rem);
  color: #b8a080;
  font-style: italic;
  margin-bottom: 2em;
  letter-spacing: 0.3em;
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  align-items: center;
}

.menu-btn {
  background: transparent;
  border: 1px solid #8a7a5a;
  color: #d4c4a8;
  font-family: 'Georgia', serif;
  font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  padding: 0.5em 2em;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 200px;
  letter-spacing: 0.1em;
}

.menu-btn:hover, .menu-btn:focus {
  background: rgba(200, 160, 100, 0.15);
  border-color: #c8a864;
  color: #f0e0c0;
  text-shadow: 0 0 10px rgba(200, 160, 100, 0.5);
}

#fullscreen-btn, #mute-btn {
  position: fixed;
  z-index: 20;
  background: rgba(26, 15, 10, 0.6);
  border: 1px solid #8a7a5a;
  color: #d4c4a8;
  font-size: 1.2rem;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#fullscreen-btn { top: 10px; right: 10px; }
#mute-btn { top: 10px; right: 58px; }

#fullscreen-btn:hover, #mute-btn:hover {
  background: rgba(200, 160, 100, 0.2);
  border-color: #c8a864;
}

#hud {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  padding: 10px 20px;
  pointer-events: none;
  z-index: 5;
}

#translation-bar {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, 80vw);
  height: 20px;
  background: rgba(26, 15, 10, 0.7);
  border: 1px solid #8a7a5a;
  border-radius: 2px;
  overflow: hidden;
}

#translation-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #8a5a3a, #c8a864, #e8d5b0);
  transition: width 0.3s;
}

#translation-label {
  position: absolute;
  bottom: 55px;
  left: 50%;
  transform: translateX(-50%);
  color: #b8a080;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

#score-display {
  position: absolute;
  top: 10px;
  left: 20px;
  font-size: 1.1rem;
  color: #e8d5b0;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

#level-display {
  position: absolute;
  top: 10px;
  right: 120px;
  font-size: 1rem;
  color: #b8a080;
  font-style: italic;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.8);
}

#lives-display {
  position: absolute;
  top: 36px;
  left: 20px;
  font-size: 0.9rem;
  color: #a04040;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

#pause-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(26, 15, 10, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 15;
}

.pause-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1em;
  align-items: center;
}

.pause-content h2 {
  font-size: 2rem;
  font-style: italic;
  color: #d4c4a8;
  letter-spacing: 0.3em;
}

#gameover-overlay h2 {
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  color: #a04040;
  font-style: italic;
  margin-bottom: 0.5em;
}

#gameover-overlay p {
  margin: 0.3em 0;
  font-size: 1.1rem;
}

#high-score-notice {
  color: #c8a864;
  font-size: 1.3rem;
  font-style: italic;
  margin: 0.5em 0;
  text-shadow: 0 0 15px rgba(200, 160, 100, 0.6);
}

.name-entry {
  margin: 1em 0;
  display: flex;
  gap: 0.5em;
  align-items: center;
}

.name-entry p {
  font-size: 0.9rem;
}

#initials-input {
  width: 80px;
  background: rgba(200, 160, 100, 0.1);
  border: 1px solid #8a7a5a;
  color: #d4c4a8;
  font-family: 'Georgia', serif;
  font-size: 1.2rem;
  text-align: center;
  padding: 0.3em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#initials-input:focus {
  outline: none;
  border-color: #c8a864;
}

#leaderboard-screen h2 {
  font-size: 2rem;
  font-style: italic;
  margin-bottom: 1em;
}

#leaderboard-list {
  list-style: none;
  margin-bottom: 1.5em;
  font-size: 1.1rem;
}

#leaderboard-list li {
  padding: 0.3em 0;
  text-align: center;
  letter-spacing: 0.05em;
}

#leaderboard-list li:first-child {
  color: #c8a864;
  font-size: 1.2rem;
}

.tutorial-content {
  max-width: 500px;
  padding: 0 2em;
  text-align: center;
  line-height: 1.8;
}

.tutorial-content h2 {
  font-size: 1.8rem;
  font-style: italic;
  margin-bottom: 1em;
}

.tutorial-step p {
  margin: 0.5em 0;
  font-size: 1rem;
}

.tutorial-content .menu-btn {
  margin-top: 1.5em;
}

.version {
  position: absolute;
  bottom: 15px;
  font-size: 0.7rem;
  color: #6a5a4a;
  letter-spacing: 0.1em;
}

@media (max-width: 600px) {
  .menu-btn { min-width: 160px; font-size: 0.9rem; }
  #fullscreen-btn, #mute-btn { width: 36px; height: 36px; font-size: 1rem; }
  #score-display { font-size: 0.9rem; }
  #level-display { font-size: 0.8rem; right: 100px; }
}
