/* fifteen.css — 15 Puzzle. Immersive: site chrome is hidden; only the board,
   a slim HUD, and the start/solved overlay (with leaderboard) show. */

.wg-main.wg-main-game { max-width: none; width: 100%; margin: 0; padding: 0; }

.wg-f15 {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  gap: 10px; padding: 8px 10px 12px; background: #0b1016;
}

/* ── HUD ── */
.wg-f15-hud { width: 100%; max-width: 480px; display: flex; align-items: center; gap: 10px; color: #eaf0f5; }
.wg-f15-exit {
  flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center;
  font-size: 1.5rem; line-height: 1; color: #cdd6de; text-decoration: none;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12); border-radius: 10px;
}
.wg-f15-exit:hover { background: rgba(255,255,255,0.12); color: #fff; }
.wg-f15-score { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.05; }
.wg-f15-num { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.01em; }
.wg-f15-mini { font-size: 0.72rem; color: #8a99a8; font-weight: 600; }
.wg-f15-hud-btns { flex: 0 0 auto; display: flex; gap: 6px; }
.wg-f15-hbtn {
  font: inherit; font-size: 0.82rem; font-weight: 700; padding: 8px 12px; min-width: 40px;
  color: #eaf0f5; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14); border-radius: 10px; cursor: pointer;
}
.wg-f15-hbtn:hover { background: rgba(255,255,255,0.16); }
.wg-f15-hbtn:disabled { opacity: 0.4; cursor: default; }

/* ── Board ── */
.wg-f15-boardwrap { position: relative; flex: 1 1 auto; display: flex; align-items: center; justify-content: center; width: 100%; }
.wg-f15-board {
  position: relative;
  width: min(92vw, calc(100vh - 200px), 460px);
  width: min(92vw, calc(100dvh - 200px), 460px);
  aspect-ratio: 1 / 1;
  border-radius: 14px; padding: 0;
  background: #0f1720; border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 10px 40px rgba(0,0,0,0.45);
  touch-action: manipulation; overflow: hidden;
}
/* Each tile is EXACTLY a 25% cell so translate(col*100%,row*100%) lands on a
   clean grid; a transparent border (clipped background) makes the visual gap. */
.wg-f15-tile {
  position: absolute; top: 0; left: 0;
  width: calc(100% / var(--n, 4)); height: calc(100% / var(--n, 4));
  box-sizing: border-box; border: var(--bw, 5px) solid transparent; background-clip: padding-box;
  border-radius: 12px;
  display: grid; place-items: center;
  font: inherit; font-weight: 800; font-size: 1.4rem; color: #04120a;
  background-color: #0eaf4c;
  background-image: linear-gradient(180deg, #17c257 0%, #0eaf4c 100%);
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: transform 0.13s ease;
  will-change: transform;
}
.wg-f15-tile:active { filter: brightness(1.08); }
@media (prefers-reduced-motion: reduce) { .wg-f15-tile { transition: none; } }

/* ── Overlay (start / paused / solved + leaderboard) ── */
.wg-f15-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(9,14,20,0.92); border-radius: 14px; padding: 14px; }
.wg-f15-overlay[hidden] { display: none; }
.wg-f15-overlay-card {
  color: #fff; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: 100%; max-width: 320px; max-height: 100%; overflow: hidden;
}
.wg-f15-overlay-card h2 { margin: 0; font-size: 1.5rem; }
.wg-f15-overlay-card p { margin: 0; display: flex; flex-direction: column; gap: 5px; font-size: 0.9rem; }
.wg-f15-overlay-card .wg-btn { min-width: 160px; }
.wg-f15-final { font-size: 1.2rem; font-weight: 800; }
.wg-f15-best-tag { color: #ffd54a; font-weight: 700; }
.wg-f15-hint { font-size: 0.82rem; opacity: 0.82; }
.wg-f15-controls { flex: 0 0 auto; margin: 0; font-size: 0.72rem; line-height: 1.45; color: #9fb0be; max-width: 300px; }
.wg-f15-overlay-exit { color: #9fb0be; font-size: 0.85rem; text-decoration: underline; }
.wg-f15-overlay-exit:hover { color: #fff; }
.wg-f15-help { font-size: 0.76rem; color: #7f8c99; margin: 0; text-align: center; max-width: 480px; }

/* ── Leaderboard (its list is the only scroll region) ── */
.wg-f15-lb { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; text-align: left; margin-top: 4px; }
.wg-f15-lb-head { display: flex; align-items: baseline; gap: 8px; justify-content: center; margin-bottom: 6px; }
.wg-f15-lb-head h3 { margin: 0; font-size: 1rem; color: #eaf0f5; }
.wg-f15-lb-total { font-size: 0.78rem; color: #8a99a8; }
.wg-f15-lb-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.wg-f15-lb-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; font-size: 0.88rem; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; }
.wg-f15-lb-row.is-me { border-color: var(--wg-color); background: rgba(14,175,76,0.18); }
.wg-f15-lb-rank { flex: 0 0 auto; width: 22px; font-weight: 800; color: #8a99a8; text-align: center; }
.wg-f15-lb-row:nth-child(1) .wg-f15-lb-rank { color: #f5b301; }
.wg-f15-lb-row:nth-child(2) .wg-f15-lb-rank { color: #c4ced6; }
.wg-f15-lb-row:nth-child(3) .wg-f15-lb-rank { color: #cd7f32; }
.wg-f15-lb-name { flex: 1 1 auto; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wg-f15-lb-name em { color: #7ee0a2; font-style: normal; font-weight: 700; font-size: 0.85em; }
.wg-f15-lb-score { flex: 0 0 auto; font-weight: 800; }
.wg-f15-lb-empty { color: #8a99a8; font-size: 0.86rem; text-align: center; padding: 6px 2px; }
.wg-f15-lb-me { margin: 6px 0 0; font-size: 0.84rem; color: #7ee0a2; font-weight: 600; text-align: center; }
