@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Outfit:wght@400;600;700;800&display=swap');

:root {
  --primary-red: #d32f2f;
  --dark-red: #8e0000;
  --gold: #ffd700;
  --dark-gold: #b8860b;
  --bg-dark: #0a0a0a;
  --font-title: 'Ma Shan Zheng', cursive;
  --font-ui: 'Outfit', sans-serif;
}

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

body {
  font-family: var(--font-ui);
  background: radial-gradient(circle at center, #1a0000 0%, var(--bg-dark) 100%);
  color: white;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#gameContainer {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 95vh;
  max-width: 100%;
}

#gameCanvas {
  background-color: #111;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(211, 47, 47, 0.4), 0 0 40px rgba(142, 0, 0, 0.6);
  border: 2px solid var(--dark-red);
  max-height: calc(95vh - 80px);
  object-fit: contain;
}

#hud {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  padding: 10px 20px;
  margin-top: 15px;
  background: linear-gradient(to right, #4a0000, var(--dark-red), #4a0000);
  border: 2px solid var(--gold);
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hud-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dark-gold);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.hud-value {
  font-family: var(--font-title);
  font-size: 2.2rem;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
  line-height: 1.2;
}

.overlay {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  height: 750px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 12px;
  z-index: 10;
  animation: fadeIn 0.5s ease-out;
}

.overlay.hidden {
  display: none !important;
}

.overlay-content {
  text-align: center;
  padding: 2rem;
  border-radius: 16px;
}

.game-title {
  font-size: 5rem;
  margin-bottom: 0.5rem;
  animation: float 3s ease-in-out infinite;
}

.game-subtitle {
  font-family: var(--font-title);
  font-size: 4rem;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  background: linear-gradient(45deg, var(--gold), #ff8c00, var(--gold));
  background-size: 200% auto;
  color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

.controls-info {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.3);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  font-size: 1.1rem;
  line-height: 1.6;
  color: #eee;
}

.controls-info p {
  margin: 5px 0;
}

.action-btn {
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 1.5rem;
  padding: 15px 40px;
  color: var(--gold);
  background: linear-gradient(to bottom, var(--primary-red), var(--dark-red));
  border: 2px solid var(--gold);
  border-radius: 50px;
  cursor: pointer;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.5);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: pulse 2s infinite;
}

.action-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(211, 47, 47, 0.8), 0 0 15px var(--gold);
  animation: none;
}

.game-over-title {
  font-family: var(--font-title);
  font-size: 5rem;
  color: var(--primary-red);
  text-shadow: 0 0 20px rgba(211, 47, 47, 0.8), 2px 2px 0px #fff;
  margin-bottom: 1rem;
}

.final-score-label {
  font-size: 1.2rem;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.final-score {
  font-family: var(--font-title);
  font-size: 6rem;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  margin: 0.5rem 0 1.5rem 0;
  animation: bounceIn 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.new-high-score {
  font-size: 1.5rem;
  font-weight: 700;
  color: #00ffaa;
  margin-bottom: 1.5rem;
  animation: pulse 1s infinite;
}

.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(211, 47, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(211, 47, 47, 0); }
}

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); opacity: 1; }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* Responsive adjustments */
@media (max-height: 700px) {
  .game-subtitle { font-size: 3rem; }
  .game-over-title { font-size: 4rem; }
  .final-score { font-size: 4.5rem; }
  .action-btn { font-size: 1.2rem; padding: 10px 30px; }
  .hud-value { font-size: 1.8rem; }
}
