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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', 'Trebuchet MS', sans-serif;
  background: #2e3d6e;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

canvas {
  display: block;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#score-panel {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 10px 18px;
  color: #fff;
  text-align: center;
}

#score-label {
  font-size: 12px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#score-value {
  font-size: 28px;
  font-weight: 800;
}

#leaderboard {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  color: #fff;
  min-width: 170px;
}

#lb-title {
  font-size: 12px;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
  text-align: center;
}

#lb-list {
  list-style: none;
  font-size: 13px;
}

#lb-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  opacity: 0.85;
}

#lb-list li.me {
  color: #ffd75e;
  font-weight: 700;
  opacity: 1;
}

#boost-bar {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  width: 190px;
  height: 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

#boost-fill {
  height: 100%;
  width: 100%;
  border-radius: 6px;
  background: #ffb92e;
  transition: background 0.2s;
}

#boost-fill.exhausted {
  background: #d63031;
}

#boost-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  background: rgba(0, 0, 0, 0.25);
  padding: 6px 14px;
  border-radius: 20px;
}

#boost-btn {
  display: none;
  position: absolute;
  bottom: 30px;
  right: 26px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 190, 60, 0.75);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  pointer-events: auto;
}

body.touch #boost-btn {
  display: block;
}

body.touch #boost-hint {
  display: none;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 28, 58, 0.82);
  backdrop-filter: blur(4px);
}

.overlay.hidden {
  display: none;
}

.panel {
  text-align: center;
  color: #fff;
  padding: 36px 44px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 20px;
  max-width: 92vw;
}

.panel h1,
.panel h2.gameover-title {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 10px;
}

.panel h1 span {
  color: #ffd75e;
}

.panel h2.how-to {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  opacity: 0.85;
  margin: 16px 0 6px;
}

.panel p {
  opacity: 0.8;
  margin-bottom: 18px;
}

#name-input {
  display: block;
  margin: 0 auto 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  outline: none;
  font-size: 16px;
  text-align: center;
  width: 220px;
}

.panel button {
  padding: 13px 44px;
  font-size: 18px;
  font-weight: 800;
  border: none;
  border-radius: 10px;
  background: #ffb92e;
  color: #4a3200;
  cursor: pointer;
  transition: transform 0.1s;
}

.panel button:hover {
  transform: scale(1.05);
}

.help {
  margin-top: 22px;
  font-size: 13px;
  opacity: 0.65;
  line-height: 1.9;
}

/* ---------------- Mobil ---------------- */
@media (max-width: 768px) {
  /* skor panelini kucult */
  #score-panel {
    top: 10px;
    left: 10px;
    padding: 5px 12px;
    border-radius: 10px;
  }
  #score-label {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
  #score-value {
    font-size: 18px;
  }

  /* leaderboard: kompakt ve en saga yasli */
  #leaderboard {
    top: 10px;
    right: 6px;
    padding: 6px 9px;
    min-width: 0;
    border-radius: 10px;
  }
  #lb-title {
    font-size: 9px;
    margin-bottom: 3px;
  }
  #lb-list {
    font-size: 11px;
  }
  #lb-list li {
    gap: 8px;
    padding: 1px 0;
  }
  #lb-list li.lb-sep {
    justify-content: center;
    opacity: 0.5;
    padding: 0;
    line-height: 0.7;
  }
}
