/* Arena FX — animations, leaderboard bar-race, audio widget */

/* === Audio control widget (top-right, fixed) === */
.arena-fx-widget {
    position: fixed; top: 12px; right: 12px; z-index: 9999;
    display: flex; align-items: center; gap: 6px;
    background: rgba(15,23,42,0.85); color: #fff;
    border-radius: 999px; padding: 6px 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3); backdrop-filter: blur(6px);
}
.arena-fx-btn {
    background: transparent; border: 0; color: #fff;
    width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0; font-size: 18px;
}
.arena-fx-btn:hover { color: #facc15; }
.arena-fx-vol {
    width: 90px; height: 4px;
    -webkit-appearance: none; appearance: none;
    background: rgba(255,255,255,0.3); border-radius: 2px; outline: none;
}
.arena-fx-vol::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: #facc15; cursor: pointer; border: 0;
}
.arena-fx-vol::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: #facc15; cursor: pointer; border: 0;
}

/* === Choice button click pulse === */
@keyframes arena-pulse {
    0% { transform: scale(1); }
    40% { transform: scale(0.94); box-shadow: 0 0 0 6px rgba(255,255,255,0.4) inset; }
    100% { transform: scale(1); }
}
.arena-choice-btn.pulsing { animation: arena-pulse 0.35s ease-out; }

/* === Question countdown bar pulse when low === */
@keyframes arena-low-pulse {
    0%, 100% { background: #ef4444; }
    50% { background: #f87171; }
}
.timer-bar.low { animation: arena-low-pulse 0.6s infinite; }

/* === Leaderboard rows === */
.lb-list { max-width: 760px; margin: 0 auto; }
.lb-row {
    display: grid;
    grid-template-columns: 36px 40px minmax(0, 1fr) auto auto;
    align-items: center; gap: 12px;
    background: rgba(255,255,255,0.06); border-radius: 12px;
    padding: 8px 16px; margin-bottom: 8px;
    position: relative; overflow: hidden;
    animation: lb-row-in .45s ease both;
}
.lb-row::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0;
    background: rgba(37,99,235,0.22);
    width: var(--lb-pct, 0%); transition: width 0.9s cubic-bezier(.2,.9,.3,1.2); z-index: 0;
}
.lb-row > * { position: relative; z-index: 1; }
.lb-row .lb-rank {
    width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.12); color:#fff;
    display: flex; align-items: center; justify-content: center; font-weight: 800;
}
.lb-row.lb-rank-1 .lb-rank { background: #F2B705; color: #3A2C00; }
.lb-row.lb-rank-2 .lb-rank { background: #DCE3EC; color: #1E293B; }
.lb-row.lb-rank-3 .lb-rank { background: #E7B48A; color: #4A2A10; }
.lb-row .lb-avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; }
.lb-row .lb-name { font-weight: 700; font-size: 18px; color: #fff !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-time { font-size: 14px; color: #94a3b8 !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-row .lb-score { color: #fff !important; font-weight: 900; font-size: 20px; font-variant-numeric: tabular-nums; }
.lb-row .lb-delta { display: inline-block; font-size: 12px; color: #22c55e; margin-left: 6px; }
.lb-row .lb-delta.minus { color: #ef4444; }
.lb-row .lb-delta.lb-streak { color: #facc15; }
.lb-more { text-align: center; color: #94a3b8; font-size: 15px; padding: 6px 0 2px; }
@keyframes lb-row-in { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }

/* === Podium top 3: hạng 2 trái, hạng 1 giữa (cao nhất), hạng 3 phải; số hạng in trên bậc === */
.lb-podium {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end; gap: 14px;
    max-width: 640px; margin: 8px auto 22px;
}
.lb-podium-step {
    display: flex; flex-direction: column; align-items: center;
    min-width: 0; text-align: center; color: #fff;
    animation: lb-rise 0.6s cubic-bezier(.2,.9,.3,1.1) both;
}
.lb-podium-step.empty { visibility: hidden; }
.lb-podium-step .lb-podium-medal { height: 30px; font-size: 26px; line-height: 1; color: #F2B705; }
.lb-podium-step .lb-podium-avatar {
    width: 68px; height: 68px; border-radius: 50%;
    background: #fff; border: 4px solid #DCE3EC;
    margin: 0 auto 8px; display: block;
}
.lb-podium-step.gold .lb-podium-avatar { width: 88px; height: 88px; border-color: #F2B705; }
.lb-podium-step.bronze .lb-podium-avatar { border-color: #E7B48A; }
.lb-podium-step .lb-podium-name {
    max-width: 100%; font-weight: 800; font-size: 18px; line-height: 1.25; color: #fff !important;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lb-podium-step .lb-podium-score { font-size: 15px; margin-top: 4px; color: #cbd5e1 !important; }
.lb-podium-step .lb-podium-score b { font-size: 20px; color: #fff !important; }
.lb-podium-step .lb-podium-score i { font-size: 12px; }
.lb-podium-step .lb-podium-streak { font-size: 13px; margin-top: 2px; color: #facc15 !important; }
.lb-podium-block {
    width: 100%; margin-top: 10px; padding-top: 12px;
    border-radius: 12px 12px 0 0;
    font-size: 44px; font-weight: 900; line-height: 1;
}
.lb-podium-step.gold .lb-podium-block { height: 150px; background: #F2B705; color: #3A2C00 !important; }
.lb-podium-step.silver .lb-podium-block { height: 112px; background: #DCE3EC; color: #1E293B !important; }
.lb-podium-step.bronze .lb-podium-block { height: 84px; background: #E7B48A; color: #4A2A10 !important; }
@keyframes lb-rise {
    0% { transform: translateY(40px); opacity: 0; }
    100% { transform: none; opacity: 1; }
}
@media (max-width: 640px) {
    .lb-podium { gap: 8px; }
    .lb-podium-step .lb-podium-avatar { width: 52px; height: 52px; }
    .lb-podium-step.gold .lb-podium-avatar { width: 64px; height: 64px; }
    .lb-podium-step .lb-podium-name { font-size: 14px; }
    .lb-podium-step.gold .lb-podium-block { height: 108px; }
    .lb-podium-step.silver .lb-podium-block { height: 80px; }
    .lb-podium-step.bronze .lb-podium-block { height: 60px; }
    .lb-podium-block { font-size: 32px; }
    .lb-row { grid-template-columns: 30px 32px minmax(0, 1fr) auto; padding: 8px 10px; gap: 8px; }
    .lb-row .lb-time { display: none; }
    .lb-row .lb-rank { width: 30px; height: 30px; }
    .lb-row .lb-avatar { width: 32px; height: 32px; }
    .lb-row .lb-name { font-size: 15px; }
}

/* === Podium rise animation === */
@keyframes arena-rise {
    0% { transform: translateY(120%); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* === Player feedback symbol pop === */
@keyframes arena-pop { 0% { transform: scale(0); } 60% { transform: scale(1.2); } 100% { transform: scale(1); } }
.arena-big { animation: arena-pop 0.45s cubic-bezier(.2,.9,.3,1.4) both; }

/* === Player chip slide-in (lobby) === */
@keyframes arena-slide-in { 0% { transform: translateX(-30px); opacity: 0; } 100% { transform: translateX(0); opacity: 1; } }
.arena-player-chip { animation: arena-slide-in 0.35s ease-out both; }

/* === Avatar img inside player chip === */
.arena-player-chip img { width: 22px; height: 22px; border-radius: 50%; vertical-align: middle; margin-right: 4px; background: #fff; }

/* === Stat bar fill (reveal stats) === */
.stat-bar { transition: width 0.8s cubic-bezier(.2,.9,.3,1.2); }

/* Màn chiếu thấp (laptop 768px): thu bục để thấy được cả top 10 không phải cuộn */
@media (max-height: 820px) and (min-width: 641px) {
    .lb-podium { margin: 4px auto 12px; }
    .lb-podium-step .lb-podium-avatar { width: 52px; height: 52px; margin-bottom: 4px; }
    .lb-podium-step.gold .lb-podium-avatar { width: 64px; height: 64px; }
    .lb-podium-step .lb-podium-medal { height: 22px; font-size: 20px; }
    .lb-podium-step .lb-podium-name { font-size: 16px; }
    .lb-podium-block { font-size: 32px; padding-top: 6px; }
    .lb-podium-step.gold .lb-podium-block { height: 92px; }
    .lb-podium-step.silver .lb-podium-block { height: 68px; }
    .lb-podium-step.bronze .lb-podium-block { height: 50px; }
    .lb-row { padding: 6px 14px; margin-bottom: 6px; }
}
