/* ===== 背景與字體設定 ===== */
body {
  margin: 0;
  font-family: "Noto Sans TC", sans-serif;
  background: url('./../assets/4.png') no-repeat center center fixed;
  background-size: cover;
  color: white;
  overflow: hidden;
}

/* ===== 螢火蟲動畫背景 ===== */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.firefly {
  position: absolute;
  width: 6px;
  height: 6px;
  background: radial-gradient(white, transparent 70%);
  border-radius: 50%;
  animation: twinkle ease-in-out infinite;
  opacity: 0.8;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.1; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ===== 容器與內容樣式 ===== */
.container {
  position: relative;
  z-index: 1;
  max-width: 90%;
  width: 600px;
  margin: 12vh auto;
  padding: 30px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 20px;
  box-shadow: 0 0 30px rgba(255, 255, 255, 0.15);
  text-align: center;
  animation: fadeIn 1.2s ease-in forwards;
}

h1, h2 {
  margin-bottom: 1rem;
  color: #fff;
}

#username-display,
#avg-time-display {
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

#leaderboard ol {
  text-align: left;
  padding-left: 1.5em;
  margin-top: 1em;
}

#leaderboard li {
  margin: 6px 0;
  font-size: 1rem;
}

.player-result, #leaderboard-container {
  background: rgba(0, 0, 0, 0.5);
  padding: 20px;
  border-radius: 12px;
  margin: 20px auto;
  width: 80%;
  color: white;
  text-align: center;
}

button#view-leaderboard {
  background: #4a4086;
  color: white;
  border: none;
  padding: 12px 20px;
  font-size: 1.1rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

button#view-leaderboard:hover {
  background: #645aa8;
}

#player-rank-outside {
  font-weight: bold;
  color: #ffcc88;
  font-size: 1.2em;
}


/* ===== 動畫 ===== */
@keyframes fadeIn {
  to { opacity: 1; }
}
.fade-content {
  opacity: 0;
  animation: fadeIn 1.5s forwards;
}

/* ===== 響應式設計 ===== */
@media screen and (max-width: 600px) {
  .container {
    margin: 5vh auto;
    padding: 20px;
    width: 90%;
  }
}

.restart-button,
#view-leaderboard {
  display: inline-block;
  background: rgba(60, 50, 90, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 12px 20px;
  margin: 10px auto;
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.4s ease;
  cursor: pointer;
  min-width: 120px;
  text-align: center;
}

.restart-button:hover,
#view-leaderboard:hover {
  background: rgba(100, 90, 160, 0.8);
  transform: scale(1.05);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}


/* 排行清單可捲動 */
#leaderboard-list{
  max-height: 420px;   /* 想高一點就加大 */
  overflow-y: auto;
  padding-right: 8px;  /* 留點空間避免捲軸壓到字 */
  margin: 12px auto 0;
}

/* 每列的排版(如已經有可省略) */
#leaderboard-list .list-item{
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  margin-bottom: 8px;
}
#leaderboard-list .list-item:nth-child(odd){
  background: rgba(255,255,255,.03);
}

/* 手機可再矮一點 */
@media (max-width: 600px){
  #leaderboard-list{ max-height: 320px; }
}
