@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

body {
    background-color: #060b16;
    color: #f1f5f9;
    font-family: 'Plus Jakarta Sans', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    transition: background-color 0.6s ease;
}

body.dark-mode-active { background-color: #020408; }

.game-container {
    text-align: center;
    background-color: rgba(15, 32, 67, 0.65);
    backdrop-filter: blur(20px);
    padding: 45px 40px;
    border-radius: 24px;
    border: 1px solid rgba(56, 189, 248, 0.15);
    box-shadow: 0 25px 50px -12px rgba(3, 7, 18, 0.6);
    width: 420px;
    max-width: 100%;
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease, border-color 0.5s ease, background-color 0.5s ease;
}

@keyframes screenShake {
    0%   { transform: translate(0,0) rotate(0deg); }
    10%  { transform: translate(-8px,-4px) rotate(-1deg); }
    20%  { transform: translate(8px,4px) rotate(1deg); }
    30%  { transform: translate(-6px,6px) rotate(0deg); }
    40%  { transform: translate(6px,-6px) rotate(1deg); }
    50%  { transform: translate(-4px,4px) rotate(-1deg); }
    60%  { transform: translate(4px,-2px) rotate(0deg); }
    70%  { transform: translate(-2px,2px) rotate(1deg); }
    80%  { transform: translate(2px,-2px) rotate(0deg); }
    90%  { transform: translate(-1px,1px) rotate(0deg); }
    100% { transform: translate(0,0) rotate(0deg); }
}
.shake { animation: screenShake 0.55s cubic-bezier(.36,.07,.19,.97) both; }

#flash-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none; z-index: 9999; opacity: 0;
    transition: opacity 0.08s ease;
}
#flash-overlay.flash-red  { background-color: rgba(239,68,68,0.35); opacity: 1; }
#flash-overlay.flash-green{ background-color: rgba(34,197,94,0.3);  opacity: 1; }

.game-container.blindfold-active {
    background-color: rgba(5,8,18,0.95);
    border-color: rgba(255,255,255,0.02);
}
.game-container.blindfold-active #game-header-bar,
.game-container.blindfold-active #game-title,
.game-container.blindfold-active #active-player-name,
.game-container.blindfold-active #instruction,
.game-container.blindfold-active #space-hint,
.game-container.blindfold-active #result-text,
.game-container.blindfold-active #feedback,
.game-container.blindfold-active #survival-tier-banner {
    opacity: 0;
    filter: blur(2px);
    pointer-events: none;
}
#game-header-bar, #game-title, #active-player-name, #instruction,
#space-hint, #result-text, #feedback, #survival-tier-banner {
    transition: opacity 0.4s ease, filter 0.4s ease;
}

.hidden { display: none !important; }

h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; margin: 0 0 8px 0; color: #ffffff; }
h2 { font-size: 1.6rem; font-weight: 700; margin: 0 0 20px 0; color: #ffffff; }

.menu-subtitle {
    font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: #38bdf8; margin: 0 0 10px 0;
}
.challenge-text { color: #64748b; font-size: 0.9rem; margin: 0 0 35px 0; }

.game-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 25px; width: 100%;
}
#round-indicator {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 3px;
    color: #475569; margin: 0; font-weight: 700;
}

.back-home-btn, #back-to-menu-btn, .back-multiplayer-btn, .back-sp-btn {
    width: auto; margin: 0; padding: 8px 14px; font-size: 0.8rem;
    font-weight: 700; background-color: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08); color: #64748b; border-radius: 8px;
}
.back-home-btn:hover, #back-to-menu-btn:hover, .back-multiplayer-btn:hover, .back-sp-btn:hover {
    color: #f1f5f9; background-color: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2);
}

#instruction { font-size: 1rem; letter-spacing: 0.5px; margin: 10px 0 4px 0; }
#target-time { color: #ef4444; font-weight: 800; font-size: 2.8rem; letter-spacing: 2px; display: block; margin-top: 4px; }

.active-player-banner {
    background-color: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.2);
    color: #38bdf8; padding: 6px 12px; border-radius: 8px; display: inline-block;
    font-weight: 700; font-size: 0.9rem; margin: 5px 0 15px 0;
    text-transform: uppercase; letter-spacing: 1px;
}

button {
    background-color: rgba(30,41,59,0.4); color: #ffffff;
    border: 1px solid rgba(255,255,255,0.1); padding: 16px 24px;
    font-size: 0.95rem; font-weight: 600; border-radius: 14px; cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
    width: 100%; margin: 10px 0; display: flex; justify-content: center; align-items: center;
    -webkit-tap-highlight-color: transparent;
}
button:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -10px rgba(0,0,0,0.5); }
button:active { transform: translateY(0); }

.menu-btn.easy   { border: 1px solid rgba(34,197,94,0.2); }
.menu-btn.easy:hover   { border-color:#22c55e; color:#22c55e; box-shadow:0 0 20px rgba(34,197,94,0.15); }
.menu-btn.medium { border: 1px solid rgba(249,115,22,0.2); }
.menu-btn.medium:hover { border-color:#f97316; color:#f97316; box-shadow:0 0 20px rgba(249,115,22,0.15); }
.menu-btn.hard   { border: 1px solid rgba(239,68,68,0.2); }
.menu-btn.hard:hover   { border-color:#ef4444; color:#ef4444; box-shadow:0 0 20px rgba(239,68,68,0.15); }
.menu-btn.sp-classic  { border: 1px solid rgba(56,189,248,0.2); }
.menu-btn.sp-classic:hover  { border-color:#38bdf8; color:#38bdf8; box-shadow:0 0 20px rgba(56,189,248,0.15); }
.menu-btn.sp-survival { border: 1px solid rgba(34,197,94,0.2); }
.menu-btn.sp-survival:hover { border-color:#22c55e; color:#22c55e; box-shadow:0 0 20px rgba(34,197,94,0.15); }

.player-count-control {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(3,7,18,0.3); border-radius: 12px; padding: 5px;
    margin-bottom: 20px; border: 1px solid rgba(255,255,255,0.05);
}
.count-adjust-btn {
    width: 45px; height: 45px; padding: 0; margin: 0;
    font-size: 1.5rem; border-radius: 10px; background: rgba(255,255,255,0.05);
}
#player-count-display, #round-count-display { font-size: 1.1rem; font-weight: 700; color: #38bdf8; }

#player-names-container { max-height: 150px; overflow-y: auto; padding-right: 5px; margin-bottom: 15px; }
.player-input-wrapper { margin-bottom: 10px; }
.player-input-wrapper input {
    width: 100%; box-sizing: border-box; background: rgba(15,23,42,0.6);
    border: 1px solid rgba(255,255,255,0.1); padding: 12px 16px;
    border-radius: 10px; color: #fff; font-family: inherit; font-size: 0.95rem; transition: all 0.2s;
}
.player-input-wrapper input:focus { outline: none; border-color: #38bdf8; background: rgba(15,23,42,0.9); }

.vs-difficulty-row { display: flex; gap: 10px; margin-bottom: 20px; }

.vs-diff-btn { margin: 0; padding: 12px; font-size: 0.9rem; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.08); }
.vs-diff-btn[data-mode="easy"]         { border-color: rgba(34,197,94,0.25); }
.vs-diff-btn[data-mode="easy"]:hover   { border-color: #22c55e; color: #22c55e; box-shadow: 0 0 20px rgba(34,197,94,0.15); }
.vs-diff-btn[data-mode="easy"].active  { background: rgba(34,197,94,0.12); border-color: #22c55e; color: #22c55e; }
.vs-diff-btn[data-mode="medium"]         { border-color: rgba(249,115,22,0.25); }
.vs-diff-btn[data-mode="medium"]:hover   { border-color: #f97316; color: #f97316; box-shadow: 0 0 20px rgba(249,115,22,0.15); }
.vs-diff-btn[data-mode="medium"].active  { background: rgba(249,115,22,0.12); border-color: #f97316; color: #f97316; }
.vs-diff-btn[data-mode="hard"]         { border-color: rgba(239,68,68,0.25); }
.vs-diff-btn[data-mode="hard"]:hover   { border-color: #ef4444; color: #ef4444; box-shadow: 0 0 20px rgba(239,68,68,0.15); }
.vs-diff-btn[data-mode="hard"].active  { background: rgba(239,68,68,0.12); border-color: #ef4444; color: #ef4444; }

.sp-diff-btn { margin: 0; padding: 12px; font-size: 0.9rem; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.08); }
.sp-diff-btn[data-mode="easy"]         { border-color: rgba(34,197,94,0.25); }
.sp-diff-btn[data-mode="easy"]:hover   { border-color: #22c55e; color: #22c55e; box-shadow: 0 0 20px rgba(34,197,94,0.15); }
.sp-diff-btn[data-mode="easy"].active  { background: rgba(34,197,94,0.12); border-color: #22c55e; color: #22c55e; }
.sp-diff-btn[data-mode="medium"]         { border-color: rgba(249,115,22,0.25); }
.sp-diff-btn[data-mode="medium"]:hover   { border-color: #f97316; color: #f97316; box-shadow: 0 0 20px rgba(249,115,22,0.15); }
.sp-diff-btn[data-mode="medium"].active  { background: rgba(249,115,22,0.12); border-color: #f97316; color: #f97316; }
.sp-diff-btn[data-mode="hard"]         { border-color: rgba(239,68,68,0.25); }
.sp-diff-btn[data-mode="hard"]:hover   { border-color: #ef4444; color: #ef4444; box-shadow: 0 0 20px rgba(239,68,68,0.15); }
.sp-diff-btn[data-mode="hard"].active  { background: rgba(239,68,68,0.12); border-color: #ef4444; color: #ef4444; }

.sp-round-btn { margin: 0; padding: 12px; font-size: 0.9rem; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.08); }
.sp-round-btn:hover  { border-color: #38bdf8; color: #38bdf8; box-shadow: 0 0 20px rgba(56,189,248,0.15); }
.sp-round-btn.active { background: rgba(56,189,248,0.12); border-color: #38bdf8; color: #38bdf8; }

#time-button, .action-btn-blue, .action-btn-green {
    font-size: 1.1rem; font-weight: 700; letter-spacing: 0.5px;
    border-radius: 16px; margin: 30px 0 0 0; padding: 18px;
}
#time-button { background-color: #1e293b; border: 1px solid #334155; }

.pulse-running {
    box-shadow: 0 0 28px rgba(239,68,68,0.5);
    border-color: rgba(239,68,68,0.9) !important;
}

.action-btn-blue { background-color: #0284c7; border: 1px solid #38bdf8; }
.action-btn-green { background-color: #16a34a; border: 1px solid #22c55e; font-weight: 700; }
#full-analysis-btn { background-color: #0284c7; border: 1px solid #38bdf8; }
#full-analysis-btn:hover { box-shadow: 0 0 25px rgba(56,189,248,0.2); }

.space-hint { font-size: 0.78rem; color: #334155; margin: 6px 0 8px 0; font-weight: 500; letter-spacing: 0.3px; transition: opacity 0.5s ease, filter 0.5s ease; }
.space-hint kbd {
    display: inline-block; background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12); border-radius: 5px;
    padding: 1px 7px; font-family: inherit; font-size: 0.78rem; color: #475569;
}

.stats-box, .round-history {
    background-color: rgba(3,7,18,0.4); border-radius: 14px; padding: 20px;
    margin: 15px 0; text-align: left; border: 1px solid rgba(255,255,255,0.03);
}
.vs-leaderboard-card {
    background-color: rgba(3,7,18,0.3); border-radius: 14px; padding: 14px 20px;
    margin: 10px 0; text-align: left; border: 1px solid rgba(255,255,255,0.05);
    display: flex; justify-content: space-between; align-items: center;
}
.vs-leaderboard-card.winner-card { border-color: #facc15; background-color: rgba(250,204,21,0.05); }

.stats-box h3, .round-history h3 {
    margin-top: 0; font-size: 0.8rem; text-transform: uppercase;
    letter-spacing: 2px; color: #475569;
    border-bottom: 1px solid rgba(255,255,255,0.05); padding-bottom: 10px;
}
.stats-box p, .round-history p { margin: 14px 0 0 0; font-size: 0.95rem; font-weight: 500; color: #94a3b8; }
.highlight { font-weight: 700; float: right; }

.summary-label { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 2px; color: #475569; margin: 0; font-weight: 700; }
#final-accuracy-title { font-size: 4rem; margin: 10px 0; color: #06b6d4; font-weight: 800; letter-spacing: -2px; }
#final-rank-text { font-size: 1rem; color: #cbd5e1; margin-bottom: 35px; font-weight: 500; line-height: 1.5; }

.secondary-btn, #analysis-back-btn {
    background-color: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); color: #94a3b8; font-weight: 600;
}
.secondary-btn:hover, #analysis-back-btn:hover { background-color: rgba(255,255,255,0.08); color: #ffffff; }

#result-text { font-size: 3.2rem; margin: 6px 0 4px 0; min-height: 65px; font-weight: 800; letter-spacing: -1px; color: #ffffff; }
#feedback { color: #cbd5e1; font-size: 1.2rem; min-height: 40px; margin-top: 0; margin-bottom: 0; font-weight: 600; }

/* ============================================
   DRAMATIC REVEAL OVERLAY
   ============================================ */
#reveal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #000; z-index: 10000;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 20px; box-sizing: border-box;
    opacity: 0; transition: opacity 0.8s ease; overflow-y: auto;
}
#reveal-overlay.fade-in { opacity: 1; }

.reveal-label {
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 4px; color: #334155; margin: 0 0 20px 0;
}
#reveal-percent {
    font-size: 6rem; font-weight: 800; letter-spacing: -4px;
    color: #ef4444; line-height: 1; margin-bottom: 16px; transition: color 0.3s ease;
}
#reveal-rank { font-size: 1.1rem; color: #64748b; font-weight: 500; margin: 0 0 36px 0; min-height: 28px; }

.reveal-actions {
    display: flex; flex-direction: column; gap: 10px;
    width: 100%; max-width: 300px;
    align-self: center; margin: 0 auto;
    opacity: 0; transition: opacity 0.5s ease;
}
.reveal-actions.visible { opacity: 1; }

.reveal-btn-primary {
    width: 100%; padding: 14px 24px; font-size: 0.95rem; font-weight: 700;
    background: #0284c7; border: 1px solid #38bdf8; color: #fff;
    border-radius: 14px; cursor: pointer; margin: 0;
    display: flex; justify-content: center; align-items: center; transition: all 0.25s ease;
}
.reveal-btn-primary:hover { background: #0369a1; box-shadow: 0 0 20px rgba(56,189,248,0.2); transform: translateY(-1px); }

.reveal-btn-secondary {
    width: 100%; padding: 14px 24px; font-size: 0.95rem; font-weight: 600;
    background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1); color: #94a3b8;
    border-radius: 14px; cursor: pointer; margin: 0;
    display: flex; justify-content: center; align-items: center; transition: all 0.25s ease;
}
.reveal-btn-secondary:hover { background: rgba(255,255,255,0.09); color: #fff; transform: translateY(-1px); }

/* ============================================
   VS PODIUM
   ============================================ */
#podium-container {
    display: flex; align-items: flex-end; justify-content: center;
    gap: 10px; margin: 24px 0 32px 0; min-height: 220px; flex-wrap: nowrap;
}
.podium-slot { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 72px; max-width: 90px; }
.podium-name {
    font-size: 0.8rem; font-weight: 700; color: #94a3b8;
    margin-bottom: 6px; text-align: center; word-break: break-word; max-width: 84px;
    opacity: 0; transform: translateY(10px); transition: opacity 0.4s ease, transform 0.4s ease;
}
.podium-name.revealed { opacity: 1; transform: translateY(0); }
.podium-name.rank-1 { color: #facc15; font-size: 0.9rem; }
.podium-name.rank-2 { color: #e2e8f0; }
.podium-name.rank-3 { color: #fb923c; }
.podium-score { font-size: 0.7rem; font-weight: 700; color: #475569; margin-bottom: 5px; opacity: 0; transition: opacity 0.4s ease 0.1s; }
.podium-score.revealed { opacity: 1; }
.podium-bar { width: 72px; border-radius: 6px 6px 0 0; transform: scaleY(0); transform-origin: bottom; transition: transform 0.7s cubic-bezier(0.34,1.56,0.64,1); }
.podium-bar.risen { transform: scaleY(1); }
.podium-bar.rank-1     { background: linear-gradient(to top, #92400e, #facc15); }
.podium-bar.rank-2     { background: linear-gradient(to top, #475569, #cbd5e1); }
.podium-bar.rank-3     { background: linear-gradient(to top, #9a3412, #f97316); }
.podium-bar.rank-other { background: linear-gradient(to top, #1e3a5f, #38bdf8); }
.podium-position-label { font-size: 1.2rem; font-weight: 800; color: rgba(255,255,255,0.12); margin-top: 6px; }

/* ============================================
   RIPPLE CANVAS
   ============================================ */
#ripple-canvas { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 0; }
.game-container { position: relative; z-index: 1; }
#reveal-overlay { z-index: 10000; }
#flash-overlay  { z-index: 9999; }

/* ============================================
   PROFILE BUTTON
   ============================================ */
#profile-btn {
    position: fixed; top: 18px; right: 18px;
    width: 42px; height: 42px; border-radius: 50%;
    background: rgba(15,32,67,0.8); border: 1px solid rgba(56,189,248,0.25);
    color: #38bdf8; cursor: pointer;
    display: flex; justify-content: center; align-items: center;
    padding: 0; margin: 0; z-index: 500; backdrop-filter: blur(10px);
    transition: all 0.2s ease; -webkit-tap-highlight-color: transparent;
}
#profile-btn:hover { background: rgba(56,189,248,0.15); border-color: #38bdf8; transform: translateY(0) scale(1.05); box-shadow: 0 0 16px rgba(56,189,248,0.2); }
#profile-btn svg { width: 18px; height: 18px; }

/* ============================================
   PB TOAST
   ============================================ */
#pb-toast {
    position: fixed; top: 18px; right: 72px;
    background: rgba(34,197,94,0.15); border: 1px solid #22c55e; color: #22c55e;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.82rem; font-weight: 700; letter-spacing: 0.5px;
    padding: 8px 14px; border-radius: 10px;
    z-index: 11000; pointer-events: none;
    opacity: 0; transform: translateY(-8px);
    transition: opacity 0.3s ease, transform 0.3s ease; white-space: nowrap;
}
#pb-toast.toast-show { opacity: 1; transform: translateY(0); }

/* ============================================
   PROFILE SCREEN
   ============================================ */
.profile-stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.92rem; font-weight: 500; color: #94a3b8;
}
.profile-stat-row:last-child { border-bottom: none; }
.profile-stat-val { font-weight: 700; color: #f1f5f9; }

.profile-section {
    background: rgba(3,7,18,0.4); border-radius: 14px;
    padding: 16px 20px; margin: 14px 0;
    border: 1px solid rgba(255,255,255,0.04); text-align: left;
}
.profile-section h3 {
    margin: 0 0 10px 0; font-size: 0.78rem; text-transform: uppercase;
    letter-spacing: 2px; color: #475569;
    padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.05);
}

.profile-nav-btn {
    display: flex; justify-content: space-between; align-items: center;
    background: rgba(3,7,18,0.3); border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px; padding: 15px 18px; margin-bottom: 10px;
    font-size: 0.95rem; font-weight: 600; color: #cbd5e1;
    cursor: pointer; transition: all 0.2s ease; -webkit-tap-highlight-color: transparent;
}
.profile-nav-btn:hover { background: rgba(56,189,248,0.08); border-color: rgba(56,189,248,0.2); color: #f1f5f9; }
.nav-arrow { font-size: 1.1rem; color: #334155; }

.profile-subscreen-header {
    display: grid; grid-template-columns: 1fr auto 1fr;
    align-items: center; margin-bottom: 4px;
}
.profile-subscreen-header span {
    font-size: 0.85rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 2px; color: #475569; text-align: center;
}
.profile-subscreen-header .profile-back-sub { justify-self: start; }

.profile-back-sub {
    width: auto; margin: 0; padding: 7px 12px; font-size: 0.8rem; font-weight: 700;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08);
    color: #64748b; border-radius: 8px; cursor: pointer; transition: all 0.2s;
    display: inline-flex; -webkit-tap-highlight-color: transparent;
}
.profile-back-sub:hover { background: rgba(255,255,255,0.08); color: #fff; }

.profile-collapsed { display: none; }

/* Sound slider */
.sound-slider-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.sound-slider-label { font-size: 0.75rem; color: #475569; font-weight: 600; white-space: nowrap; min-width: 22px; }
.sound-slider {
    flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px;
    background: linear-gradient(to right, #38bdf8 0%, #38bdf8 calc(var(--val, 100) * 1%), rgba(255,255,255,0.08) calc(var(--val, 100) * 1%), rgba(255,255,255,0.08) 100%);
    outline: none; cursor: pointer; border: none; padding: 0; margin: 0; width: 100%;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
}
.sound-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
    background: #38bdf8; cursor: pointer;
    border: 2px solid rgba(255,255,255,0.2); box-shadow: 0 0 10px rgba(56,189,248,0.5);
}
.sound-slider::-moz-range-thumb {
    width: 20px; height: 20px; border-radius: 50%; background: #38bdf8;
    cursor: pointer; border: 2px solid rgba(255,255,255,0.2);
}

/* Survival tier banner */
.survival-tier-banner {
    display: inline-block; font-size: 0.75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 2px;
    padding: 4px 10px; border-radius: 6px; margin-bottom: 6px;
    background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.3); color: #22c55e;
}
.survival-tier-banner.tier-2 { background: rgba(249,115,22,0.1); border-color: rgba(249,115,22,0.3); color: #f97316; }
.survival-tier-banner.tier-3 { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); color: #ef4444; }
.survival-tier-banner.tier-4 { background: rgba(168,85,247,0.1); border-color: rgba(168,85,247,0.3); color: #a855f7; }

/* Mobile */
#time-button { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; min-height: 64px; }
button { -webkit-tap-highlight-color: transparent; }

@media (max-width: 480px) {
    .game-container { padding: 32px 24px; border-radius: 18px; }
    h1 { font-size: 1.8rem; }
    #reveal-percent { font-size: 4.5rem; }
    #podium-container { gap: 6px; }
    .podium-bar { width: 58px; }
    .podium-slot { min-width: 58px; max-width: 72px; }
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

/* Scrollable analysis container for long survival runs */
#dynamic-analysis-container {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}
/* ============================================
   BATTLE ROYALE — ELIMINATION OVERLAY
   ============================================ */
#elimination-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #000;
    z-index: 10000;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 20px;
    box-sizing: border-box;
    opacity: 0; transition: opacity 0.7s ease;
}
#elimination-overlay.fade-in { opacity: 1; }

#elim-x {
    font-size: 7rem; font-weight: 800;
    color: #ef4444; line-height: 1;
    margin-bottom: 16px;
    animation: none;
}
#elim-x.elim-animate {
    animation: elimPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes elimPop {
    0%   { transform: scale(0); opacity: 0; }
    60%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

#elim-name {
    font-size: 2.4rem; font-weight: 800;
    color: #fff; letter-spacing: -1px;
    margin: 0 0 8px 0;
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
#elim-name.revealed { opacity: 1; transform: translateY(0); }

#elim-sub {
    font-size: 0.9rem; color: #475569;
    font-weight: 500; margin: 0 0 32px 0;
    opacity: 0; transition: opacity 0.4s ease 0.2s;
}
#elim-sub.revealed { opacity: 1; }

#elim-actions {
    opacity: 0; transition: opacity 0.4s ease;
}
#elim-actions.visible { opacity: 1; }

/* BR mode button purple */
.menu-btn.br {
    border: 1px solid rgba(168,85,247,0.3);
}
.menu-btn.br:hover {
    border-color: #a855f7; color: #a855f7;
    box-shadow: 0 0 20px rgba(168,85,247,0.15);
}

/* BR difficulty buttons — same as vs-diff-btn */
.br-diff-btn { margin: 0; padding: 12px; font-size: 0.9rem; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.08); }
.br-diff-btn[data-mode="easy"]         { border-color: rgba(34,197,94,0.25); }
.br-diff-btn[data-mode="easy"]:hover   { border-color: #22c55e; color: #22c55e; box-shadow: 0 0 20px rgba(34,197,94,0.15); }
.br-diff-btn[data-mode="easy"].active  { background: rgba(34,197,94,0.12); border-color: #22c55e; color: #22c55e; }
.br-diff-btn[data-mode="medium"]         { border-color: rgba(249,115,22,0.25); }
.br-diff-btn[data-mode="medium"]:hover   { border-color: #f97316; color: #f97316; box-shadow: 0 0 20px rgba(249,115,22,0.15); }
.br-diff-btn[data-mode="medium"].active  { background: rgba(249,115,22,0.12); border-color: #f97316; color: #f97316; }
.br-diff-btn[data-mode="hard"]         { border-color: rgba(239,68,68,0.25); }
.br-diff-btn[data-mode="hard"]:hover   { border-color: #ef4444; color: #ef4444; box-shadow: 0 0 20px rgba(239,68,68,0.15); }
.br-diff-btn[data-mode="hard"].active  { background: rgba(239,68,68,0.12); border-color: #ef4444; color: #ef4444; }

/* ============================================
   BATTLE ROYALE ELIMINATION OVERLAY — REDESIGN
   ============================================ */
#elimination-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #000;
    z-index: 10000;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 20px;
    box-sizing: border-box;
    opacity: 0; transition: opacity 0.6s ease;
}
#elimination-overlay.fade-in { opacity: 1; }

#elim-label {
    font-size: 0.8rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 4px; color: #334155; margin: 0 0 40px 0;
}

/* Name starts blurred, turns red when eliminated */
#elim-name {
    font-size: 3rem; font-weight: 800;
    color: #fff; letter-spacing: -1px;
    margin: 0 0 4px 0;
    filter: blur(20px); opacity: 0;
    transition: filter 1s ease, opacity 0.5s ease, color 0.5s ease;
}
#elim-name.revealed { filter: blur(0px); opacity: 1; }
#elim-name.eliminated { color: #ef4444; }

/* ELIMINATED text stamp */
#elim-x {
    font-size: 0.75rem; font-weight: 800; letter-spacing: 4px;
    color: #ef4444; text-transform: uppercase;
    margin: 0 0 8px 0;
    opacity: 0; transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
#elim-x.elim-animate { opacity: 1; transform: translateY(0); }

#elim-name-wrapper {
    position: relative;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    margin-bottom: 16px;
}

#elim-sub {
    font-size: 0.9rem; color: #475569;
    font-weight: 500; margin: 16px 0 32px 0;
    opacity: 0; transition: opacity 0.4s ease;
}
#elim-sub.revealed { opacity: 1; }

#elim-actions { opacity: 0; transition: opacity 0.4s ease; }
#elim-actions.visible { opacity: 1; }

/* Final round announcement — matches game formatting */
#final-round-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: rgba(3, 7, 18, 0.97); z-index: 10001;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 20px;
    opacity: 0; transition: opacity 0.6s ease;
}
#final-round-overlay.fade-in { opacity: 1; }

#final-round-name {
    font-size: 3.2rem; font-weight: 800;
    color: #22c55e; letter-spacing: -1px;
    margin: 0 0 32px 0;
    opacity: 0; transform: translateY(10px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
#final-round-name.revealed { opacity: 1; transform: translateY(0); }

#final-round-actions { opacity: 0; transition: opacity 0.4s ease; }
#final-round-actions.visible { opacity: 1; }

/* Smooth entrance for turn screen after final round */
#turn-screen.br-enter {
    animation: brTurnEnter 0.7s ease forwards;
}
@keyframes brTurnEnter {
    0%   { opacity: 0; transform: translateY(12px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Winner overlay */
#br-winner-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #000;
    z-index: 10001;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 20px;
    opacity: 0; transition: opacity 0.8s ease;
}
#br-winner-overlay.fade-in { opacity: 1; }

#winner-label {
    font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 5px; color: #475569; margin: 0 0 16px 0;
    opacity: 0; transition: opacity 0.4s ease;
}
#winner-label.revealed { opacity: 1; }

#winner-name {
    font-size: 3.5rem; font-weight: 800;
    color: #fff; letter-spacing: -1px;
    margin: 0 0 8px 0;
    filter: blur(24px); opacity: 0;
    transition: filter 2.4s ease, opacity 0.6s ease, color 0.15s ease, text-shadow 0.3s ease;
}
#winner-name.revealed { filter: blur(0px); opacity: 1; }
#winner-name.gold {
    color: #facc15;
    text-shadow: 0 0 24px rgba(250, 204, 21, 0.6);
    animation: winnerPop 0.4s ease;
}
@keyframes winnerPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.12); }
    100% { transform: scale(1); }
}

#winner-sub {
    font-size: 0.9rem; color: #475569; font-weight: 500;
    margin: 0 0 36px 0;
    opacity: 0; transition: opacity 0.4s ease;
}
#winner-sub.revealed { opacity: 1; }

#winner-actions { opacity: 0; transition: opacity 0.4s ease; }
#winner-actions.visible { opacity: 1; }

/* ============================================
   CHALLENGE A FRIEND
   ============================================ */
#challenge-share-overlay, #challenge-intro-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background-color: #000; z-index: 10002;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    text-align: center; padding: 24px; box-sizing: border-box;
    opacity: 0; transition: opacity 0.5s ease;
}
#challenge-share-overlay.fade-in, #challenge-intro-overlay.fade-in { opacity: 1; }

#challenge-share-intro {
    font-size: 0.95rem; color: #94a3b8; max-width: 340px;
    line-height: 1.5; margin: 0 0 28px 0;
}

#challenge-name-input {
    width: 100%; max-width: 320px; box-sizing: border-box;
    background: rgba(15,23,42,0.6); border: 1px solid rgba(255,255,255,0.15);
    padding: 14px 18px; border-radius: 12px; color: #fff;
    font-family: inherit; font-size: 1rem; text-align: center;
    margin: 0 0 12px 0; transition: border-color 0.2s;
}
#challenge-name-input:focus { outline: none; border-color: #a855f7; }

#challenge-share-overlay button, #challenge-intro-overlay button {
    width: 100%; max-width: 320px; margin: 6px 0;
}

#challenge-link-box {
    width: 100%; max-width: 320px; margin: 12px 0 6px 0;
    display: flex; flex-direction: column; align-items: center;
}
#challenge-link-text {
    font-size: 0.85rem; color: #94a3b8; word-break: break-word;
    white-space: pre-wrap; text-align: left;
    background: rgba(15,23,42,0.6); border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px; padding: 14px 16px; margin: 0 0 12px 0; width: 100%;
    box-sizing: border-box; line-height: 1.5;
}
#challenge-link-box button { margin: 0; }

#challenge-intro-name {
    font-size: 2.6rem; font-weight: 800; color: #c084fc;
    letter-spacing: -1px; margin: 8px 0;
}
#challenge-intro-detail {
    font-size: 1rem; color: #94a3b8; margin: 0 0 20px 0;
}
#challenge-intro-score {
    font-size: 3.5rem; font-weight: 800; color: #fff;
    letter-spacing: -2px; margin: 0 0 8px 0;
}
#challenge-intro-sub {
    font-size: 1rem; color: #64748b; font-weight: 600;
    margin: 0 0 32px 0;
}

/* Challenge result — beat/lost banner on reveal */
#challenge-result-banner {
    font-size: 1.3rem; font-weight: 800; letter-spacing: 0.5px;
    margin: 20px auto 28px auto; padding: 12px 24px; border-radius: 12px;
    display: block; width: fit-content; text-align: center;
}
#challenge-result-banner.won {
    color: #22c55e; background: rgba(34,197,94,0.1); border: 1px solid #22c55e;
}
#challenge-result-banner.lost {
    color: #ef4444; background: rgba(239,68,68,0.1); border: 1px solid #ef4444;
}

/* Challenge a Friend button — orange outline with glow */
.challenge-btn-outline {
    width: 100%; padding: 14px 24px; font-size: 0.95rem; font-weight: 700;
    background: transparent; border: 1px solid #f97316; color: #f97316;
    border-radius: 14px; cursor: pointer; margin: 0;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 0 16px rgba(249, 115, 22, 0.25);
    transition: all 0.25s ease;
}
.challenge-btn-outline:hover {
    background: rgba(249, 115, 22, 0.1);
    box-shadow: 0 0 24px rgba(249, 115, 22, 0.4);
    color: #fb923c; transform: translateY(-1px);
}