/* Wizard Academy — UI upgrades: lazy skeletons, live search, player facade,
   control bar, theater mode and vote counters. */

/* ---------- Game card skeletons ---------- */
.gc-skeleton {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, #0b1220 18%, #1a2740 42%, #0b1220 66%);
  background-size: 220% 100%;
  animation: waUiShimmer 1.45s linear 3;
}

@media (prefers-reduced-motion: reduce) {
  .gc-skeleton,
  .wa-skeleton-block,
  .wa-sentinel-dot { animation: none !important; }
}

.gc-skeleton::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
}

@keyframes waUiShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -20% 0; }
}

.wa-skeleton-block {
  position: relative;
  overflow: hidden;
  background: linear-gradient(100deg, #0b1220 18%, #1a2740 42%, #0b1220 66%);
  background-size: 220% 100%;
  animation: waUiShimmer 1.45s linear infinite;
}

/* ---------- Infinite scroll sentinel ---------- */
.wa-scroll-sentinel {
  width: 100%;
  height: 44px;
  margin: 4px 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.wa-scroll-sentinel.is-loading {
  opacity: 1;
}

.wa-sentinel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
  animation: waSentinelPulse 1s ease-in-out infinite;
}

@keyframes waSentinelPulse {
  0%, 100% { transform: scale(0.7); opacity: 0.45; }
  50% { transform: scale(1.25); opacity: 1; }
}

/* ---------- Live search dropdown ---------- */
#search-suggestions-dropdown .wa-search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.18s ease;
}

#search-suggestions-dropdown .wa-search-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.wa-search-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #1c2333;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.wa-search-thumb-fallback {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: linear-gradient(135deg, #1d2740, #111827);
  flex-shrink: 0;
}

.wa-search-name {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-search-cat {
  font-size: 10px;
  color: #94a3b8;
  text-transform: capitalize;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wa-search-cat .wa-search-rating {
  color: #facc15;
  font-family: 'JetBrains Mono', monospace;
}

.wa-search-viewall {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  font-weight: 800;
  color: #38bdf8;
  cursor: pointer;
  text-decoration: none;
}

.wa-search-viewall:hover {
  background: rgba(56, 189, 248, 0.08);
  color: #7dd3fc;
}

/* ---------- Player stage ---------- */
#gameFrameWrap {
  position: relative;
}

/* ---------- Player control bar ---------- */
.wa-player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 1280px;
  margin: 10px auto 0;
  padding: 8px 12px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.18);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 20;
}

.wa-ctrl-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(30, 41, 59, 0.75);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
}

.wa-ctrl-btn:hover {
  background: rgba(51, 65, 85, 0.9);
  border-color: rgba(56, 189, 248, 0.4);
  color: #fff;
}

.wa-ctrl-btn:active {
  transform: scale(0.96);
}

.wa-ctrl-btn[aria-pressed="true"] {
  background: rgba(14, 165, 233, 0.18);
  border-color: rgba(56, 189, 248, 0.55);
  color: #7dd3fc;
}

.wa-ctrl-ico {
  font-size: 14px;
  line-height: 1;
}

.wa-vote-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.wa-vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.wa-vote-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.wa-vote-btn:active {
  transform: scale(0.94);
}

.wa-vote-btn.is-active[data-vote="like"] {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.wa-vote-btn.is-active[data-vote="dislike"] {
  background: rgba(248, 113, 113, 0.16);
  color: #f87171;
}

.wa-vote-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  min-width: 12px;
  text-align: center;
}

/* Theater mode dim layer */
#waTheaterDim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(2, 6, 23, 0.86);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

body.wa-theater-mode #waTheaterDim {
  opacity: 1;
  pointer-events: auto;
}

body.wa-theater-mode .game-theater {
  position: relative;
  z-index: 60;
}

body.wa-theater-mode .wa-player-controls {
  position: relative;
  z-index: 60;
}

body.wa-theater-mode #gameFrameWrap {
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.45), 0 30px 80px rgba(0, 0, 0, 0.8), 0 0 60px rgba(56, 189, 248, 0.18);
}

@media (max-width: 640px) {
  .wa-player-controls {
    gap: 6px;
    padding: 7px 8px;
    margin-top: 8px;
  }
  .wa-ctrl-btn {
    padding: 7px 10px;
    font-size: 10px;
  }
  .wa-ctrl-btn .wa-ctrl-label {
    display: none;
  }
  .wa-ctrl-ico {
    font-size: 15px;
  }
  .wa-vote-btn {
    padding: 6px 8px;
    font-size: 10px;
  }
}

/* ---------- Continue Playing: initial-letter cover tile ----------
   Sits under the real poster and stands alone when no cover can be
   resolved, so a saved game never renders a broken-image icon. */
.wa-recent-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(34, 211, 238, 0.22), transparent 62%),
    linear-gradient(145deg, #16233a, #0b1220 72%);
  color: #67e8f9;
  font-weight: 900;
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
  user-select: none;
}
.wa-recent-fallback span {
  opacity: 0.92;
}
