body {
  padding: 0;
  margin: 0;
}

.ui {
  position: fixed;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
  pointer-events: none;
}

.apples {
  background: rgba(50, 50, 50, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 8px 14px;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  font-family: 'Comic Sans MS', 'Trebuchet MS', sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  top: 20px;
  left: 20px;
  position: fixed;
}

.apples::before {
  content: "🍎";
  font-size: 24px;
  filter: drop-shadow(0 0 2px rgba(255,0,0,0.6));
}

.apples span {
  font-size: 22px;
  color: #ffeb3b;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

.apples.updated {
  animation: pop 0.3s ease-out;
}

.score-wrapper {
  background: rgba(50, 50, 50, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 8px 14px;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  font-family: 'Comic Sans MS', 'Trebuchet MS', sans-serif;
  display: flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  top: 80px;
  left: 20px;
  position: fixed;
}

.score-wrapper::before {
  content: "🎯";
  font-size: 24px;
  filter: drop-shadow(0 0 2px rgba(255,0,0,0.6));
}

.score-wrapper span {
  font-size: 22px;
  color: #ffeb3b;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

.score-wrapper.updated {
  animation: pop 0.3s ease-out;
}

@keyframes pop {
  0% {transform: scale(1)}
  50% {transform: scale(1.2)}
  100% {transform: scale(1)}
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(3px);
}

.tutorial-content {
  background: rgba(30, 30, 30, 0.9);
  padding: 0 40px 30px;
  border-radius: 16px;
  color: #fff;
  font-family: 'Trebuchet MS', sans-serif;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  animation: popin 0.4s ease-out;
}

.tutorial-content h2 {
  font-size: 28px;
  margin-bottom: 16px;
  color: #ffeb3b;
}

.tutorial-content ul {
  list-style: none;
  padding: 0;
  margin: 0 0 15px;
  text-align: left;
}

.tutorial-content li {
  font-size: 18px;
  margin: 8px 0;
}

.tutorial-content .goal {
  font-size: 16px;
  margin-top: 10px;
  margin-bottom: 20px;
  color: #ffd54f;
}

.tutorial-content button {
  background: #ff9800;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.tutorial-content button:hover {
  background: #e68900;
}

.key {
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 2px 6px;
  font-family: monospace;
  font-size: 16px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
  margin: 2px;
}

.key.up {
  transform: rotate(0deg);
  width: 25px;
  height: 25px;
  padding: 0;
  text-align: center;
}

.key.down {
  transform: rotate(180deg);
  width: 25px;
  height: 25px;
  padding: 0;
  text-align: center;
}

.key.left {
  transform: rotate(-90deg);
  width: 25px;
  height: 25px;
  padding: 0;
  text-align: center;
}

.key.right {
  transform: rotate(90deg);
  width: 25px;
  height: 25px;
  padding: 0;
  text-align: center;
}

@keyframes popin {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.tutorial-overlay.hidden {
  animation: fadeout 0.4s forwards;
}

@keyframes fadeout {
  to { opacity: 0; visibility: hidden; }
}

#stamina-ui {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  pointer-events: none;
}

#stamina-container {
  width: 200px;
  background: rgba(50, 50, 50, 0.7);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  height: 16px;
  overflow: hidden;
}

#stamina-bar-wrapper {
  position: relative;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,0.06);
  display: flex;
  align-items: center;
}

#stamina-bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 120ms linear;
  background: linear-gradient(90deg, #ff3e00, #ffd166 70%);
  box-shadow: inset 0 -2px 6px rgba(0,0,0,0.25);
}

#game-clock {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: rgba(0,0,0,0.4);
  padding: 6px 12px;
  border-radius: 12px;
  font-family: monospace, system-ui;
  font-size: 16px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
  pointer-events: none;
  z-index: 1000;
}

/* NPC Chat UI */
#npc-prompt {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(50, 50, 50, 0.9);
  border: 2px solid #ffd54f;
  border-radius: 12px;
  padding: 10px 20px;
  color: #fff;
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 16px;
  z-index: 1500;
  display: none;
  animation: bounce 1s infinite;
}

#npc-prompt.visible {
  display: block;
}

@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-5px); }
}

#chat-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  max-width: 90vw;
  background: rgba(20, 20, 20, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 16px;
  z-index: 2000;
  display: none;
  flex-direction: column;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

#chat-container.open {
  display: flex;
}

#chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  background: rgba(255, 193, 7, 0.1);
  border-radius: 14px 14px 0 0;
}

#chat-header .npc-avatar {
  font-size: 32px;
}

#chat-header .npc-name {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 18px;
  font-weight: bold;
  color: #ffd54f;
}

#chat-header .npc-title {
  font-size: 12px;
  color: rgba(255,255,255,0.6);
}

#chat-close {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

#chat-close:hover {
  background: rgba(255,0,0,0.3);
}

#chat-messages {
  flex: 1;
  max-height: 250px;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.chat-message.npc {
  align-self: flex-start;
  background: rgba(255, 193, 7, 0.2);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.chat-message.player {
  align-self: flex-end;
  background: rgba(76, 175, 80, 0.3);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.typing {
  color: rgba(255,255,255,0.5);
  font-style: italic;
}

#chat-input-container {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

#chat-input {
  flex: 1;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 14px;
  font-family: 'Trebuchet MS', sans-serif;
  outline: none;
}

#chat-input:focus {
  border-color: #ffd54f;
}

#chat-input::placeholder {
  color: rgba(255,255,255,0.4);
}

#chat-send {
  background: #ff9800;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

#chat-send:hover {
  background: #e68900;
}

#chat-send:disabled {
  background: rgba(255,255,255,0.2);
  cursor: not-allowed;
}

/* AI Narrator Panel */
#ai-narrator {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 320px;
  background: rgba(20, 20, 30, 0.95);
  border: 2px solid rgba(138, 43, 226, 0.5);
  border-radius: 16px;
  z-index: 1500;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px rgba(138, 43, 226, 0.3);
  overflow: hidden;
}

#narrator-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(138, 43, 226, 0.3), rgba(75, 0, 130, 0.3));
  border-bottom: 1px solid rgba(138, 43, 226, 0.3);
}

#narrator-header .ai-icon {
  font-size: 24px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { filter: drop-shadow(0 0 5px #8a2be2); }
  50% { filter: drop-shadow(0 0 15px #8a2be2); }
}

#narrator-header .ai-title {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #d8b4fe;
}

#narrator-header .ai-status {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
}

#narrator-content {
  padding: 14px 16px;
  min-height: 60px;
  max-height: 100px;
  overflow-y: auto;
}

#narrator-text {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 14px;
  color: #fff;
  line-height: 1.5;
  margin: 0;
}

#narrator-text.typing::after {
  content: '|';
  animation: blink 0.7s infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Quest Panel */
#quest-panel {
  position: fixed;
  top: 180px;
  right: 20px;
  width: 320px;
  background: rgba(20, 30, 20, 0.95);
  border: 2px solid rgba(76, 175, 80, 0.5);
  border-radius: 16px;
  z-index: 1500;
  backdrop-filter: blur(8px);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
  overflow: hidden;
  display: none;
}

#quest-panel.active {
  display: block;
  animation: slide-in 0.3s ease-out;
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

#quest-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.3), rgba(46, 125, 50, 0.3));
  border-bottom: 1px solid rgba(76, 175, 80, 0.3);
}

#quest-header .quest-icon {
  font-size: 24px;
}

#quest-header .quest-label {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 14px;
  font-weight: bold;
  color: #a5d6a7;
}

#quest-timer {
  margin-left: auto;
  font-family: monospace;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  background: rgba(0,0,0,0.3);
  padding: 4px 10px;
  border-radius: 8px;
}

#quest-timer.urgent {
  color: #ff5252;
  animation: pulse-urgent 0.5s infinite;
}

@keyframes pulse-urgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

#quest-content {
  padding: 14px 16px;
}

#quest-title {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  margin: 0 0 8px 0;
}

#quest-description {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin: 0 0 12px 0;
  line-height: 1.4;
}

#quest-progress-container {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  height: 24px;
  overflow: hidden;
  position: relative;
}

#quest-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #4caf50, #8bc34a);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 8px;
}

#quest-progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#quest-reward {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 13px;
  color: #ffd54f;
}

/* Quest Complete Popup */
#quest-complete {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: rgba(20, 30, 20, 0.98);
  border: 3px solid #4caf50;
  border-radius: 20px;
  padding: 30px 50px;
  z-index: 3000;
  text-align: center;
  box-shadow: 0 0 50px rgba(76, 175, 80, 0.5);
}

#quest-complete.show {
  animation: quest-pop 0.5s ease-out forwards;
}

@keyframes quest-pop {
  0% { transform: translate(-50%, -50%) scale(0); }
  70% { transform: translate(-50%, -50%) scale(1.1); }
  100% { transform: translate(-50%, -50%) scale(1); }
}

#quest-complete h2 {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 28px;
  color: #4caf50;
  margin: 0 0 10px 0;
}

#quest-complete .reward-display {
  font-size: 24px;
  color: #ffd54f;
  margin: 15px 0;
}

/* Event Notification */
#event-notification {
  position: fixed;
  top: 140px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.95), rgba(255, 152, 0, 0.95));
  border-radius: 12px;
  padding: 12px 24px;
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
}

#event-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#event-notification p {
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 16px;
  font-weight: bold;
  color: #000;
  margin: 0;
  text-align: center;
}

/* Overlay Screens (Username, Leaderboard, Game Over) */
.overlay-screen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  backdrop-filter: blur(5px);
}

.overlay-screen.hidden {
  display: none;
}

.screen-content {
  background: linear-gradient(135deg, rgba(30, 30, 40, 0.98), rgba(20, 20, 30, 0.98));
  padding: 30px 50px;
  border-radius: 20px;
  color: #fff;
  font-family: 'Trebuchet MS', sans-serif;
  text-align: center;
  max-width: 450px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(138, 43, 226, 0.2);
  border: 2px solid rgba(138, 43, 226, 0.3);
  animation: modal-pop 0.3s ease-out;
}

@keyframes modal-pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.screen-content h2 {
  font-size: 28px;
  margin: 0 0 20px 0;
  color: #ffd54f;
}

.screen-content p {
  font-size: 16px;
  color: rgba(255,255,255,0.8);
  margin: 0 0 20px 0;
}

.screen-content input {
  width: 100%;
  padding: 14px 18px;
  font-size: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-family: 'Trebuchet MS', sans-serif;
  outline: none;
  margin-bottom: 20px;
  box-sizing: border-box;
}

.screen-content input:focus {
  border-color: #ffd54f;
}

.screen-content input::placeholder {
  color: rgba(255,255,255,0.4);
}

.screen-content button {
  background: linear-gradient(135deg, #ff9800, #ff5722);
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  padding: 14px 40px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Trebuchet MS', sans-serif;
}

.screen-content button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(255, 152, 0, 0.4);
}

/* Leaderboard Preview on Username Screen */
.leaderboard-preview {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.leaderboard-preview h3 {
  font-size: 18px;
  color: #ffd54f;
  margin: 0 0 15px 0;
}

#mini-leaderboard, #full-leaderboard {
  text-align: left;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: background 0.2s;
}

.leaderboard-entry:hover {
  background: rgba(255,255,255,0.1);
}

.leaderboard-entry.gold {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 193, 7, 0.1));
  border: 1px solid rgba(255, 215, 0, 0.3);
}

.leaderboard-entry.silver {
  background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(158, 158, 158, 0.1));
  border: 1px solid rgba(192, 192, 192, 0.3);
}

.leaderboard-entry.bronze {
  background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(139, 90, 43, 0.1));
  border: 1px solid rgba(205, 127, 50, 0.3);
}

.leaderboard-entry .rank {
  font-size: 20px;
  width: 40px;
  text-align: center;
}

.leaderboard-entry .player-name {
  flex: 1;
  font-size: 16px;
  color: #fff;
  margin-left: 10px;
}

.leaderboard-entry .player-score {
  font-size: 18px;
  font-weight: bold;
  color: #ffd54f;
}

.leaderboard-content {
  max-width: 500px;
}

#full-leaderboard {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

.no-scores {
  color: rgba(255,255,255,0.5);
  font-style: italic;
  padding: 20px;
}

/* Welcome Player Text */
.welcome-player {
  font-size: 20px;
  color: #4caf50;
  margin-bottom: 15px;
  font-weight: bold;
}

.welcome-player span {
  color: #ffd54f;
}

/* Final Stats */
.final-stats {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin: 25px 0;
  padding: 20px;
  background: rgba(0,0,0,0.3);
  border-radius: 12px;
}

.final-stats .stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.final-stats .stat-label {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
}

.final-stats .stat-value {
  font-size: 22px;
  font-weight: bold;
  color: #ffd54f;
}

#score-rank {
  font-size: 18px;
  color: #4caf50;
  margin-bottom: 20px;
}

.gameover-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.gameover-buttons button {
  padding: 12px 25px;
  font-size: 16px;
}

#view-leaderboard-btn {
  background: linear-gradient(135deg, #9c27b0, #673ab7);
}

/* Game UI Buttons */
#leaderboard-btn, #end-game-btn {
  position: fixed;
  bottom: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(50, 50, 50, 0.8);
  font-size: 24px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 1000;
  pointer-events: auto;
}

#leaderboard-btn {
  left: 20px;
}

#end-game-btn {
  left: 80px;
}

#leaderboard-btn:hover, #end-game-btn:hover {
  transform: scale(1.1);
  background: rgba(80, 80, 80, 0.9);
}

/* Tutorial Hidden State */
.tutorial-overlay.hidden {
  display: none;
}

/* Mode Selection Screen */
.mode-selection {
  max-width: 700px !important;
}

.mode-cards {
  display: flex;
  gap: 20px;
  margin: 25px 0;
}

.mode-card {
  flex: 1;
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
}

.mode-card:hover {
  border-color: rgba(255, 193, 7, 0.5);
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

#mode-timelimit:hover {
  border-color: rgba(33, 150, 243, 0.5);
  box-shadow: 0 10px 30px rgba(33, 150, 243, 0.2);
}

#mode-survival:hover {
  border-color: rgba(244, 67, 54, 0.5);
  box-shadow: 0 10px 30px rgba(244, 67, 54, 0.2);
}

.mode-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.mode-card h3 {
  font-size: 22px;
  color: #fff;
  margin: 0 0 10px 0;
}

.mode-card > p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  margin: 0 0 15px 0;
}

.mode-features {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  text-align: left;
}

.mode-features li {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.mode-select-btn {
  width: 100%;
  padding: 12px 20px !important;
  font-size: 16px !important;
  border-radius: 10px !important;
}

#mode-timelimit .mode-select-btn {
  background: linear-gradient(135deg, #2196f3, #1976d2) !important;
}

#mode-survival .mode-select-btn {
  background: linear-gradient(135deg, #f44336, #c62828) !important;
}

/* Leaderboard Tabs */
.leaderboard-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
}

.tab-btn {
  padding: 8px 20px !important;
  font-size: 14px !important;
  background: rgba(255,255,255,0.1) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 8px !important;
  color: rgba(255,255,255,0.7) !important;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn:hover {
  background: rgba(255,255,255,0.15) !important;
}

.tab-btn.active {
  background: rgba(255, 193, 7, 0.2) !important;
  border-color: rgba(255, 193, 7, 0.5) !important;
  color: #ffd54f !important;
}

/* Mode UI Elements */
.mode-ui {
  position: fixed;
  background: rgba(50, 50, 50, 0.9);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  padding: 10px 16px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Trebuchet MS', sans-serif;
  color: #fff;
}

.mode-ui.hidden {
  display: none !important;
}

#mode-timer {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  font-weight: bold;
  border-color: rgba(33, 150, 243, 0.5);
}

#mode-timer-text {
  color: #64b5f6;
  min-width: 60px;
  text-align: center;
}

#mode-timer.urgent {
  border-color: rgba(244, 67, 54, 0.5);
  animation: pulse-timer 0.5s infinite;
}

#mode-timer.urgent #mode-timer-text {
  color: #ff5252;
}

@keyframes pulse-timer {
  0%, 100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.05); }
}

#health-ui {
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  border-color: rgba(244, 67, 54, 0.5);
}

#health-icon {
  font-size: 24px;
}

#health-bar-container {
  width: 150px;
  height: 20px;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}

#health-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #f44336, #e91e63);
  transition: width 0.3s ease;
  border-radius: 10px;
}

#health-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

#health-ui.low #health-bar {
  background: linear-gradient(90deg, #ff5722, #ff9800);
  animation: pulse-health 0.5s infinite;
}

#health-ui.critical #health-bar {
  background: #f44336;
  animation: pulse-health 0.3s infinite;
}

@keyframes pulse-health {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

#survival-time {
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 16px;
  border-color: rgba(156, 39, 176, 0.5);
}

#survival-timer {
  color: #ce93d8;
  font-weight: bold;
}

#current-mode {
  position: fixed;
  top: 20px;
  left: 140px;
  background: rgba(50, 50, 50, 0.8);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: 'Trebuchet MS', sans-serif;
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  z-index: 1000;
}

/* Game Over Mode Display */
#final-mode {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  margin-top: 5px;
}

.final-stats .stat-item.survival-time {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 15px;
  margin-top: 5px;
}