/* Minecraft Temple Run UI & Styling */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #1a110c;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: #fffefa;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* start.ng Player Profile Card (Official Spec) */
.startng-card {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: rgba(41, 42, 35, 0.9);
  backdrop-filter: blur(8px);
  color: #fffefa;
  z-index: 50;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  border: 1px solid rgba(216, 253, 113, 0.3);
}

.startng-card img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #d8fd71;
  object-fit: cover;
  image-rendering: pixelated;
}

.startng-card b {
  display: block;
  font-size: 15px;
  font-weight: 700;
}

.startng-card span {
  font-size: 12px;
  opacity: 0.75;
}

.startng-card button {
  margin-left: 8px;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: #d8fd71;
  color: #111;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s;
}

.startng-card button:hover {
  background: #c3ef4e;
  transform: scale(1.05);
}

/* Audio Mute Button */
#mute-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 50;
  background: rgba(41, 42, 35, 0.85);
  border: 1px solid #555;
  color: white;
  font-size: 18px;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
}

/* Running In-Game HUD */
#hud {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24px;
  z-index: 20;
  pointer-events: none;
}

.hud-pill {
  background: rgba(20, 16, 12, 0.85);
  border: 2px solid #583c22;
  border-radius: 8px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

.hud-pill .label {
  font-size: 10px;
  letter-spacing: 1px;
  color: #e5b358;
  font-weight: 800;
  text-transform: uppercase;
}

.hud-pill .value {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  font-family: monospace;
}

/* Floating Alerts / Announcements */
#floating-notice {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 24px;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9), 2px 2px 0 #000;
  z-index: 30;
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#floating-notice.fade-out {
  opacity: 0;
  transform: translate(-50%, -20px);
}

/* Urgent Bridge Quick-Build Challenge Banner */
#bridge-prompt {
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 520px;
  background: rgba(18, 14, 10, 0.94);
  border: 3px solid #ff4400;
  border-radius: 12px;
  padding: 16px 20px;
  z-index: 40;
  box-shadow: 0 0 25px rgba(255, 68, 0, 0.7), inset 0 0 15px rgba(255, 68, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: promptPulse 0.8s infinite alternate ease-in-out;
}

@keyframes promptPulse {
  0% { border-color: #ff4400; box-shadow: 0 0 18px rgba(255, 68, 0, 0.6); }
  100% { border-color: #ffcc00; box-shadow: 0 0 30px rgba(255, 204, 0, 0.9); }
}

.bridge-header {
  font-size: 16px;
  font-weight: 900;
  color: #ffcc00;
  letter-spacing: 1px;
  text-shadow: 1px 1px 0 #000;
}

.bridge-timer-bar {
  width: 100%;
  height: 18px;
  background: #332211;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid #774422;
  position: relative;
}

#bridge-timer-fill {
  width: 100%;
  height: 100%;
  background: #2ecc71;
  transition: width 0.1s linear, background-color 0.2s;
}

.bridge-info {
  display: flex;
  justify-content: space-between;
  width: 100%;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  font-family: monospace;
}

.bridge-action-tip {
  font-size: 13px;
  color: #d8fd71;
  font-weight: 700;
  text-align: center;
}

/* Touch Controls */
#touch-controls {
  position: fixed;
  bottom: 20px;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 35;
  pointer-events: none;
}

.touch-cluster {
  display: flex;
  gap: 12px;
  pointer-events: auto;
}

.touch-btn {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  background: rgba(30, 24, 18, 0.85);
  border: 2px solid #6b4d30;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  cursor: pointer;
  transition: transform 0.05s, background 0.1s;
}

.touch-btn:active {
  transform: scale(0.92);
  background: #553920;
}

.build-btn {
  width: 130px;
  height: 60px;
  background: #ab7e47;
  border: 3px solid #ffcc00;
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #111;
  font-weight: 900;
}

.build-btn.pulse-build {
  background: #ffaa00;
  animation: buildButtonGlow 0.4s infinite alternate;
}

@keyframes buildButtonGlow {
  0% { transform: scale(1); box-shadow: 0 0 10px #ffaa00; }
  100% { transform: scale(1.08); box-shadow: 0 0 25px #ff4400; }
}

/* Modals & Screens (Start Menu, Game Over) */
.overlay-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 7, 5, 0.88);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-box {
  width: 90%;
  max-width: 480px;
  background: #251c14;
  border: 4px solid #63472c;
  box-shadow: 0 10px 40px rgba(0,0,0,0.9), inset 0 0 20px rgba(0,0,0,0.5);
  border-radius: 14px;
  padding: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.game-title {
  font-size: 28px;
  font-weight: 900;
  color: #f1c40f;
  text-shadow: 2px 2px 0 #5f3e09, 0 0 15px rgba(241, 196, 15, 0.4);
  letter-spacing: 1px;
}

.subtitle {
  font-size: 14px;
  color: #d8bb81;
  line-height: 1.4;
}

.instructions-card {
  background: rgba(15, 11, 8, 0.7);
  border: 1px solid #4a3420;
  border-radius: 8px;
  padding: 14px;
  text-align: left;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #e0d5c1;
}

.instructions-card b {
  color: #2ecc71;
}

.instructions-card .bridge-tip {
  color: #ff9f43;
}

.big-btn {
  background: #27ae60;
  color: white;
  border: 2px solid #2ecc71;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
  transition: transform 0.1s, background 0.15s;
}

.big-btn:hover {
  background: #2ecc71;
  transform: translateY(-2px);
}

.big-btn:active {
  transform: translateY(1px);
}

/* Game Over Stats */
.game-over-title {
  font-size: 28px;
  font-weight: 900;
  color: #e74c3c;
  text-shadow: 2px 2px 0 #5c1810;
}

#death-reason {
  font-size: 14px;
  color: #ff9f43;
  font-style: italic;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: rgba(15, 11, 8, 0.75);
  padding: 14px;
  border-radius: 8px;
  border: 1px solid #4a3420;
}

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

.stat-item .stat-title {
  font-size: 11px;
  color: #a89582;
  font-weight: 700;
  text-transform: uppercase;
}

.stat-item .stat-val {
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  font-family: monospace;
}

.stat-item.highlight .stat-val {
  color: #f1c40f;
  font-size: 24px;
}

#save-status {
  font-size: 13px;
  color: #2ecc71;
  font-weight: 700;
}

/* Leaderboard */
.leaderboard-box {
  background: rgba(15, 11, 8, 0.65);
  border: 1px solid #4a3420;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
  max-height: 140px;
  overflow-y: auto;
}

.leaderboard-box h4 {
  font-size: 12px;
  color: #e5b358;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#leaderboard-list {
  list-style: none;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#leaderboard-list li {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
}

#leaderboard-list .rank {
  font-weight: 900;
  color: #f1c40f;
  width: 28px;
}

#leaderboard-list .player-col {
  flex: 1;
  font-weight: 700;
}

#leaderboard-list .stat-col {
  color: #bbb;
  font-family: monospace;
}

.hidden {
  display: none !important;
}

