body {
  margin: 0;
  font-family: "Trebuchet MS", sans-serif;
  background: #f3eee7;
  color: #1b1b1b;
  overflow: hidden;
}

#game {
  display: block;
  width: 100vw;
  height: 100vh;
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 10;
  background: rgba(255, 248, 236, 0.85);
  padding: 12px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  max-width: 260px;
}

.title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.note {
  font-size: 12px;
  margin-top: 6px;
  color: #5c3c2a;
}

#stamina-widget {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 320px;
  height: 90px;
  background: url("_Assets/stamina.png") no-repeat center;
  background-size: contain;
  z-index: 10;
  pointer-events: none;
}

#banana-score {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}

#banana-score img {
  width: 36px;
  height: 36px;
}

#banana-count {
  font-size: 22px;
  font-weight: 700;
  color: #1b1b1b;
}

#minimap {
  position: fixed;
  left: 16px;
  top: 16px;
  width: 160px;
  height: 90px;
  background: rgba(255, 248, 236, 0.85);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  z-index: 10;
  pointer-events: none;
}

#debug {
  position: fixed;
  left: 16px;
  top: 118px;
  width: 260px;
  max-height: 160px;
  overflow: hidden;
  padding: 8px 10px;
  background: rgba(20, 18, 28, 0.75);
  color: #f6f1e6;
  font-family: "Courier New", monospace;
  font-size: 11px;
  line-height: 1.3;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  z-index: 10;
  pointer-events: none;
  white-space: pre-wrap;
}

.debug-hidden {
  display: none;
}

#leaderboard {
  position: fixed;
  top: 80px;
  right: 16px;
  width: 180px;
  background: rgba(255, 248, 236, 0.85);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  z-index: 10;
  pointer-events: none;
}

.leaderboard-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
}

#leaderboard-list {
  font-size: 13px;
  line-height: 1.4;
}

.leaderboard-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.leaderboard-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#login {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 18, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}

.login-hidden {
  display: none;
}

#login.login-hidden {
  display: none;
}

.login-panel {
  background: #fdf6ec;
  border-radius: 14px;
  padding: 18px 20px;
  min-width: 220px;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.login-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

#name-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  font-size: 14px;
  margin-bottom: 10px;
}

#name-submit {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: none;
  background: #d86e4a;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.login-note {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.6);
}

.login-note a {
  color: #3a2bd8;
  text-decoration: none;
  font-weight: 700;
}

#stamina-widget::after {
  content: "Stamina";
  position: absolute;
  left: 124px;
  right: 24px;
  top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.6);
}

#menu-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 22;
  background: rgba(20, 18, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f7f1e3;
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.user-bar {
  position: fixed;
  top: 16px;
  right: 90px;
  z-index: 22;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 18, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f7f1e3;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.user-badge {
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 10px;
  letter-spacing: 0.6px;
}

.user-badge.guest {
  background: rgba(255, 255, 255, 0.15);
  color: #f7f1e3;
}

.user-badge.logged {
  background: rgba(207, 255, 77, 0.9);
  color: #1b1b1b;
}

.user-name-display {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-logout {
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  color: inherit;
  border-radius: 8px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 11px;
}

.user-logout:hover {
  border-color: #cfff4d;
  color: #cfff4d;
}

#controls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  z-index: 12;
  pointer-events: none;
}

#controls button {
  pointer-events: auto;
  width: 70px;
  height: 70px;
  border-radius: 20px;
  border: none;
  background: rgba(31, 29, 43, 0.85);
  color: #f8f2e9;
  font-size: 26px;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
  transition: transform 0.1s ease, background 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

#minigame {
  position: fixed;
  inset: 0;
  background: rgba(10, 8, 14, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 18;
  pointer-events: none;
}

.minigame-hidden {
  display: none;
}

#minigame.minigame-hidden {
  display: none;
}

.minigame-panel {
  background: url("_Assets/minigame_bg.png") no-repeat center;
  background-size: contain;
  border: none;
  border-radius: 0;
  padding: 0 16px;
  width: 260px;
  height: 260px;
  color: #f6f1e6;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: none;
}

.minigame-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #000000;
  text-shadow: none;
}

#minigame-seq {
  font-size: 48px;
  letter-spacing: 4px;
  margin-bottom: 8px;
  color: #000000;
  text-shadow: none;
}

#minigame-seq .done {
  opacity: 0.35;
}

#minigame-seq span {
  position: relative;
  display: inline-block;
  transform-origin: center;
}

#minigame-seq .blink {
  background: rgba(255, 255, 255, 0.35);
  border: 2px solid rgba(0, 0, 0, 0.85);
  border-radius: 10px;
  padding: 2px 10px;
  animation: blink-pulse 0.8s ease-in-out infinite;
}

#minigame-seq .flash-correct {
  background: rgba(60, 210, 120, 0.7);
  border-color: rgba(10, 120, 60, 0.9);
}

#minigame-seq .flash-wrong {
  background: rgba(230, 80, 80, 0.7);
  border-color: rgba(160, 20, 20, 0.9);
}

#minigame-seq .pop {
  display: inline-block;
  animation: pop-in 0.25s ease-out;
}

#minigame-seq .hit {
  color: #000000;
  text-shadow: none;
  animation: hit-flash 0.35s ease-out;
}

#minigame-seq .hit::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 153, 0, 0.8);
  transform: translate(-50%, -50%);
  animation: particle-burst 0.45s ease-out;
}

@keyframes pop-in {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  80% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes blink-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(1.08);
  }
}

@keyframes hit-flash {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes particle-burst {
  0% {
    box-shadow: none;
    opacity: 1;
  }
  100% {
    box-shadow:
      -12px -6px 0 0 rgba(255, 153, 0, 0.7),
      12px -6px 0 0 rgba(255, 153, 0, 0.7),
      -10px 10px 0 0 rgba(255, 153, 0, 0.7),
      10px 10px 0 0 rgba(255, 153, 0, 0.7),
      0 -14px 0 0 rgba(255, 210, 120, 0.7),
      0 14px 0 0 rgba(255, 210, 120, 0.7);
    opacity: 0;
  }
}

#minigame-count {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #000000;
  text-shadow: none;
}

#minigame-timer {
  font-size: 16px;
  color: #000000;
  text-shadow: none;
}

.minigame-result {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(20, 18, 28, 0.85);
  color: #f6f1e6;
  font-weight: 700;
  font-size: 16px;
  z-index: 22;
  pointer-events: none;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.minigame-result-hidden {
  display: none;
}

#controls button.active {
  background: #d86e4a;
  transform: translateY(2px) scale(0.98);
}

#controls button:active {
  background: #d86e4a;
  transform: translateY(2px) scale(0.98);
}

#jump {
  margin-left: 0;
}

#boost {
  background: rgba(216, 110, 74, 0.85);
}

#menu {
  position: fixed;
  inset: 0;
  background: rgba(15, 12, 20, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.menu-hidden {
  display: none;
}

#menu.menu-hidden {
  display: none;
}

.menu-panel {
  background: rgba(32, 27, 38, 0.95);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  padding: 20px 26px;
  min-width: 260px;
  color: #f6f1e6;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.menu-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.menu-item {
  font-size: 14px;
  color: #cfc5b5;
}

.menu-label {
  display: block;
  margin-top: 12px;
  font-size: 13px;
  color: #cfc5b5;
}

#volume {
  width: 100%;
  margin-top: 6px;
}

.menu-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #cfc5b5;
}

#menu-close {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #f7f1e3;
  padding: 6px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 640px) {
  #hud {
    max-width: 200px;
  }
  #stamina-widget {
    width: 220px;
    height: 62px;
    left: 10px;
    bottom: 10px;
  }
  #stamina-widget::after {
    left: 88px;
    right: 16px;
    top: 6px;
    font-size: 14px;
    padding: 1px 6px;
  }
  #controls {
    display: flex;
    bottom: 80px;
  }
  #controls button {
    width: 64px;
    height: 64px;
  }
  #minimap {
    width: 120px;
    height: 68px;
  }
  #debug {
    top: 96px;
    width: 200px;
    font-size: 10px;
  }
  #leaderboard {
    width: 140px;
    padding: 8px 10px;
  }
  .leaderboard-title {
    font-size: 12px;
    margin-bottom: 4px;
  }
  #leaderboard-list {
    font-size: 11px;
  }
  .minigame-panel {
    width: 220px;
    height: 220px;
    padding: 0 12px;
  }
  #minigame-seq {
    font-size: 28px;
  }
  #minigame-count {
    font-size: 18px;
  }
  #minigame-timer {
    font-size: 14px;
  }
}

