/**
 * Components
 * Reusable UI components: badges, buttons, inputs, hints, tooltips, timers, guess history
 */

/* ===================================== */
/* GAME STATUS DISPLAY                   */
/* ===================================== */

#game-status-display {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--card-background);
    border-radius: 15px;
    box-shadow: 0 2px 8px var(--shadow-color);
    transition: all 0.3s ease;
    border: 1px solid rgba(13, 148, 136, 0.12);
}

#game-status-icon {
    font-size: 24px;
    margin-right: 10px;
    color: var(--primary-color);
}

#game-status-text {
    margin: 0;
    font-size: 1.7em;
    color: var(--primary-color);
}

/* ===================================== */
/* GAME HEADER & INLINE STATS            */
/* ===================================== */

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.game-header h2 {
    margin: 0;
    flex: 1;
    min-width: 200px;
    font-size: 1.3em;
}

.game-stats-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===================================== */
/* STAT BADGES                           */
/* ===================================== */

.stat-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(13, 148, 136, 0.1);
    border: 1px solid rgba(13, 148, 136, 0.2);
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.85em;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.stat-badge:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2);
}

.stat-icon {
    font-size: 1.1em;
}

.coin-icon {
    color: #ff8f00;
}

body.dark-mode .stat-badge {
    background: rgba(13, 148, 136, 0.15);
    border: 1px solid rgba(13, 148, 136, 0.3);
}

body.dark-mode .coin-icon {
    color: #e65100;
}

/* ===================================== */
/* HINT BUTTON                           */
/* ===================================== */

.hint-button {
    /* Reset ALL button defaults */
    all: unset;

    /* Match stat badge sizing for consistency */
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.85em;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s ease;
    box-sizing: border-box;

    /* Warm gold/orange background for action button */
    background: rgba(255, 143, 0, 0.15);
    border: 1px solid rgba(255, 143, 0, 0.3);
    color: var(--text-color);
}

.hint-button:hover:not(:disabled) {
    transform: translateY(-1px);
    background: rgba(255, 143, 0, 0.2);
    border-color: rgba(255, 143, 0, 0.4);
}

.hint-button:active:not(:disabled) {
    transform: translateY(0);
}

.hint-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Only show lock icon when actually locked */
.hint-button[data-locked="true"]::after {
    content: ' 🔒';
}

/* When locked, change to purple background */
.hint-button[data-locked="true"] {
    background: rgba(13, 148, 136, 0.1);
    border: 1px solid rgba(13, 148, 136, 0.2);
}

.hint-button .fa-coins {
    color: #ff8f00;
    font-size: 1.1em;
}

.hint-button .hint-text {
    color: #ff8f00;
    font-weight: 600;
}

.hint-button .hint-cost {
    color: var(--text-color);
    font-weight: 600;
}

/* Dark mode hint button */
body.dark-mode .hint-button {
    background: rgba(255, 143, 0, 0.2);
    border: 1px solid rgba(255, 143, 0, 0.4);
}

/* ===================================== */
/* HINTS DISPLAY                         */
/* ===================================== */

.hints-display {
    margin: 20px 0;
    padding: 16px;
    background: rgba(243, 156, 18, 0.1);
    border: 2px solid rgba(243, 156, 18, 0.3);
    border-radius: 12px;
    animation: fadeIn 0.3s ease-in;
}

.hints-display h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #f39c12;
}

.hints-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.hint-item {
    background: #fff3cd;
    border: 2px solid #f39c12;
    border-radius: 8px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 16px;
    color: #856404;
    animation: hintReveal 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===================================== */
/* TOOLTIPS                              */
/* ===================================== */

[data-tooltip] {
    position: relative;
}

[data-tooltip]:before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background-color: var(--text-color);
    color: var(--card-background);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 280px;
}

[data-tooltip]:hover:before {
    opacity: 0.95;
}

body.dark-mode [data-tooltip]:before {
    background-color: #f8f7fc;
    color: #3d3358;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

@media (max-width: 768px) {
    [data-tooltip]:before {
        font-size: 12px;
        padding: 6px 10px;
        max-width: 200px;
        white-space: normal;
        text-align: center;
    }
}

/* ===================================== */
/* BADGE (Difficulty buttons)            */
/* ===================================== */

.badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
    letter-spacing: 0.3px;
}

@media (max-width: 768px) {
    .badge {
        font-size: 10px;
        padding: 2px 6px;
    }
}

.difficulty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 18px;
}

/* ===================================== */
/* TIMER COMPONENTS                      */
/* ===================================== */

#timer-container {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 20px auto;
}

#timer-progress {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: bold;
    background: conic-gradient(var(--primary-color) 0deg, var(--card-background) 0deg);
    transition: background 0.3s ease;
}

#timer {
    position: relative;
    z-index: 1;
}

/* ===================================== */
/* ATTEMPTS PROGRESS                     */
/* ===================================== */

#attempts-progress {
    width: 100%;
    height: 10px;
    background-color: var(--background-color);
    border-radius: 5px;
    margin-top: 10px;
    overflow: hidden;
}

#attempts-progress::before {
    content: '';
    display: block;
    height: 100%;
    width: 0;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

/* ===================================== */
/* DIGIT INPUTS                          */
/* ===================================== */

.digit-input {
    width: 60px;
    height: 60px;
    font-size: 28px;
    text-align: center;
    margin: 0;
    border: 3px solid var(--input-border);
    border-radius: 0;
    border-right: none;
    background-color: var(--input-background);
    color: var(--primary-color);
    font-weight: 700;
    position: relative;
    z-index: 10;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    -moz-appearance: textfield;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.12);
}

.digit-input:first-child {
    border-top-left-radius: 15px;
    border-bottom-left-radius: 15px;
}

.digit-input:last-child {
    border-top-right-radius: 15px;
    border-bottom-right-radius: 15px;
    border-right: 3px solid var(--input-border);
}

/* Dynamic sizing for different digit counts */
#input-container.digits-5 .digit-input {
    width: 52px;
    height: 52px;
    font-size: 24px;
}

#input-container.digits-6 .digit-input {
    width: 48px;
    height: 48px;
    font-size: 22px;
}

.digit-input::-webkit-outer-spin-button,
.digit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.digit-input:focus {
    border-color: var(--primary-color);
    border-right: 3px solid var(--primary-color);
    outline: none;
    z-index: 20;
    box-shadow: 0 5px 20px var(--shadow-color);
    background-color: var(--card-hover-background);
}

body.dark-mode .digit-input:focus {
    background-color: var(--card-background);
    box-shadow: 0 5px 25px rgba(13, 148, 136, 0.4);
}

/* ===================================== */
/* GUESS HISTORY                         */
/* ===================================== */

/* Base guess history styling moved to game-regular.css for proper flex layout */

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    border: 1px solid rgba(13, 148, 136, 0.1);
    transition: all 0.2s ease;
}

body.dark-mode .history-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(13, 148, 136, 0.15);
}

.history-item:hover {
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.15);
    border-color: rgba(13, 148, 136, 0.3);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item .guess {
    font-weight: bold;
    font-size: 20px;
    letter-spacing: 2px;
    color: var(--primary-color);
}

.history-item .correct {
    color: var(--success-color);
    margin-right: 10px;
    font-weight: 600;
    font-size: 16px;
    padding: 2px 8px;
    background: rgba(46, 204, 113, 0.1);
    border-radius: 8px;
}

.history-item .misplaced {
    color: #f39c12;
    font-weight: 600;
    font-size: 16px;
    padding: 2px 8px;
    background: rgba(243, 156, 18, 0.1);
    border-radius: 8px;
}

/* ===================================== */
/* CONFETTI SYSTEM                       */
/* ===================================== */

#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-number {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    opacity: 0;
    user-select: none;
}

/* ===================================== */
/* FLOATING NUMBERS BACKGROUND           */
/* ===================================== */

.floating-number {
    position: fixed;
    font-size: 20px;
    color: rgba(74, 144, 226, 0.15);
    animation: float-numbers linear infinite;
    z-index: 0;
    user-select: none;
    pointer-events: auto;
    transition: color 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    will-change: transform;
}

.floating-number:hover {
    color: var(--primary-color);
    transform: scale(1.2);
}

body.dark-mode .floating-number:hover {
    color: var(--secondary-color);
}

/* ===================================== */
/* BANNER ACTIONS (Play + Leaderboard)  */
/* ===================================== */

.banner-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    justify-content: center;
}

.mode-play-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
    max-width: 200px;
}

.mode-play-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.mode-play-btn:active {
    transform: translateY(0);
}

.mode-play-btn i {
    font-size: 1em;
}

.mode-leaderboard-link {
    padding: 12px 24px;
    background: transparent;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-color);
    white-space: nowrap;
    max-width: 200px;
}

.mode-leaderboard-link:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

.mode-leaderboard-link i {
    font-size: 1em;
}

body.dark-mode .mode-leaderboard-link {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
}

body.dark-mode .mode-leaderboard-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

@media (max-width: 768px) {
    .banner-actions {
        flex-direction: column;
        gap: 10px;
    }

    .mode-play-btn,
    .mode-leaderboard-link {
        width: 100%;
        font-size: 1em;
        padding: 12px 24px;
    }
}

/* ===================================== */
/* DIFFICULTY SELECTION MODAL            */
/* ===================================== */

.difficulty-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.difficulty-modal-content {
    background: var(--card-background);
    padding: 40px 35px 35px;
    border-radius: 30px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(13, 148, 136, 0.2);
    position: relative;
    animation: slideUp 0.3s ease;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border: none;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close-btn:hover {
    background: rgba(220, 38, 38, 0.2);
    color: #dc2626;
    transform: rotate(90deg);
}

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.modal-header h2 {
    margin: 0 0 8px 0;
    font-size: 1.8em;
    color: var(--primary-color);
}

.modal-header p {
    color: var(--text-secondary);
    margin: 0;
    font-size: 0.95em;
}

.modal-difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.modal-difficulty-btn {
    padding: 20px 16px;
    border: 2px solid rgba(13, 148, 136, 0.2);
    border-radius: 15px;
    background: var(--card-background);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.modal-difficulty-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-difficulty-btn:hover::before {
    opacity: 1;
}

.modal-difficulty-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.modal-difficulty-btn .diff-name {
    font-size: 1.1em;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-color);
}

/* Easy Difficulty */
.modal-difficulty-btn.easy-diff {
    border-color: var(--success-color);
    background: var(--success-color);
}

.modal-difficulty-btn.easy-diff .diff-name {
    color: white;
}

.modal-difficulty-btn.easy-diff:hover {
    background: var(--success-color);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.4);
}

/* Medium Difficulty */
.modal-difficulty-btn.medium-diff {
    border-color: #f59e0b;
    background: #f59e0b;
}

.modal-difficulty-btn.medium-diff .diff-name {
    color: white;
}

.modal-difficulty-btn.medium-diff:hover {
    background: #d97706;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.4);
}

/* Hard Difficulty */
.modal-difficulty-btn.hard-diff {
    border-color: #dc2626;
    background: #dc2626;
}

.modal-difficulty-btn.hard-diff .diff-name {
    color: white;
}

.modal-difficulty-btn.hard-diff:hover {
    background: #b91c1c;
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.4);
}

/* Remove active state - all buttons should be fully visible */

/* View Leaderboard Button - Clean & Minimal */
.modal-view-leaderboard-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 20px auto 0;
    padding: 10px 20px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid rgba(13, 148, 136, 0.3);
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.modal-view-leaderboard-btn:hover {
    background: rgba(13, 148, 136, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.modal-view-leaderboard-btn:active {
    transform: translateY(0);
}

.modal-view-leaderboard-btn span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}


/* Time Attack Theme */
.time-attack-theme .modal-header h2 {
    color: #f59e0b;
}

.time-attack-theme .modal-icon {
    filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.3));
}

/* Survival Theme */
.survival-theme .modal-header h2 {
    color: #dc2626;
}

.survival-theme .modal-icon {
    filter: drop-shadow(0 0 10px rgba(220, 38, 38, 0.3));
}

/* Dark Mode */
body.dark-mode .difficulty-modal-content {
    background: #1e293b;
    border-color: rgba(13, 148, 136, 0.3);
}

body.dark-mode .modal-close-btn {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .modal-difficulty-btn.easy-diff {
    background: var(--success-color);
    border-color: var(--success-color);
}

body.dark-mode .modal-difficulty-btn.easy-diff .diff-name {
    color: white;
}

body.dark-mode .modal-difficulty-btn.easy-diff:hover {
    background: var(--success-color);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.5);
}

body.dark-mode .modal-difficulty-btn.medium-diff {
    background: #f59e0b;
    border-color: #f59e0b;
}

body.dark-mode .modal-difficulty-btn.medium-diff .diff-name {
    color: white;
}

body.dark-mode .modal-difficulty-btn.medium-diff:hover {
    background: #d97706;
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

body.dark-mode .modal-difficulty-btn.hard-diff {
    background: #dc2626;
    border-color: #dc2626;
}

body.dark-mode .modal-difficulty-btn.hard-diff .diff-name {
    color: white;
}

body.dark-mode .modal-difficulty-btn.hard-diff:hover {
    background: #b91c1c;
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.5);
}

/* ===================================== */
/* MODAL LEADERBOARD SECTION             */
/* ===================================== */

.modal-leaderboard-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid rgba(13, 148, 136, 0.15);
}

/* Hide leaderboard sections in all modals - use desktop leaderboard modals instead */
#time-attack-modal .modal-leaderboard-section,
#survival-modal .modal-leaderboard-section,
#daily-challenge-tile-modal .modal-leaderboard-section {
    display: none;
}

.modal-leaderboard-title {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Leaderboard Tabs - Hidden since difficulty buttons now control leaderboard */
.modal-leaderboard-tabs {
    display: none;
    gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}

.modal-lb-tab {
    padding: 8px 20px;
    border: 2px solid rgba(13, 148, 136, 0.3);
    background: transparent;
    color: var(--text-color);
    border-radius: 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.3s ease;
}

.modal-lb-tab:hover {
    background: rgba(13, 148, 136, 0.1);
    border-color: var(--primary-color);
}

.modal-lb-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Leaderboard Container */
.modal-leaderboard-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

/* Custom scrollbar */
.modal-leaderboard-container::-webkit-scrollbar {
    width: 6px;
}

.modal-leaderboard-container::-webkit-scrollbar-track {
    background: rgba(13, 148, 136, 0.1);
    border-radius: 3px;
}

.modal-leaderboard-container::-webkit-scrollbar-thumb {
    background: rgba(13, 148, 136, 0.3);
    border-radius: 3px;
}

.modal-leaderboard-container::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 148, 136, 0.5);
}

/* Loading State */
.modal-leaderboard-loading {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 14px;
}

/* Empty State */
.modal-leaderboard-empty {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
}

.modal-leaderboard-empty i {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.modal-leaderboard-empty p {
    font-size: 14px;
    margin: 0;
}

/* Leaderboard List */
.modal-leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Leaderboard Entry */
.modal-lb-entry {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: var(--card-background);
    border: 2px solid rgba(13, 148, 136, 0.15);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.modal-lb-entry:hover {
    border-color: rgba(13, 148, 136, 0.3);
    transform: translateX(3px);
}

/* Rank */
.modal-lb-rank {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 35px;
    text-align: center;
}

/* Top 3 medals */
.modal-lb-entry.rank-1 .modal-lb-rank {
    color: #FFD700;
    font-size: 24px;
}

.modal-lb-entry.rank-1 .modal-lb-rank::before {
    content: "🥇 ";
}

.modal-lb-entry.rank-2 .modal-lb-rank {
    color: #C0C0C0;
    font-size: 22px;
}

.modal-lb-entry.rank-2 .modal-lb-rank::before {
    content: "🥈 ";
}

.modal-lb-entry.rank-3 .modal-lb-rank {
    color: #CD7F32;
    font-size: 20px;
}

.modal-lb-entry.rank-3 .modal-lb-rank::before {
    content: "🥉 ";
}

.modal-lb-entry.rank-1 {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.3);
}

.modal-lb-entry.rank-2 {
    background: rgba(192, 192, 192, 0.1);
    border-color: rgba(192, 192, 192, 0.3);
}

.modal-lb-entry.rank-3 {
    background: rgba(205, 127, 50, 0.1);
    border-color: rgba(205, 127, 50, 0.3);
}

/* Player Info */
.modal-lb-player {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.modal-lb-username {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-color);
}

.modal-lb-stats {
    font-size: 12px;
    color: var(--text-muted);
}

/* Score */
.modal-lb-score {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-color);
    min-width: 80px;
    text-align: right;
}

/* Dark mode */
body.dark-mode .modal-leaderboard-section {
    border-top-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .modal-lb-entry {
    background: rgba(45, 39, 72, 0.5);
    border-color: rgba(13, 148, 136, 0.2);
}

body.dark-mode .modal-lb-entry:hover {
    border-color: rgba(13, 148, 136, 0.4);
}

/* Responsive */
@media (max-width: 600px) {
    .modal-difficulty-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .modal-difficulty-btn {
        padding: 14px 10px;
        font-size: 0.85em;
    }

    .difficulty-modal-content {
        padding: 35px 20px 20px;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header {
        margin-bottom: 15px;
    }

    .modal-header h2 {
        font-size: 1.3em;
    }

    .modal-icon {
        font-size: 2.2em;
        margin-bottom: 10px;
    }

    .modal-header p {
        font-size: 0.85em;
        margin-top: 5px;
    }

    /* Leaderboard button stays visible on mobile */
    .modal-view-leaderboard-btn {
        padding: 9px 18px;
        font-size: 0.8em;
    }

    /* Keep all modal leaderboards hidden - use desktop leaderboard modals */
    #time-attack-modal .modal-leaderboard-section,
    #survival-modal .modal-leaderboard-section,
    #daily-challenge-tile-modal .modal-leaderboard-section {
        display: none;
    }

    .modal-leaderboard-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .modal-leaderboard-container {
        max-height: 250px;
    }

    .modal-lb-entry {
        padding: 10px 12px;
        gap: 10px;
    }

    .modal-lb-rank {
        font-size: 16px;
        min-width: 30px;
    }

    .modal-lb-entry.rank-1 .modal-lb-rank {
        font-size: 20px;
    }

    .modal-lb-entry.rank-2 .modal-lb-rank {
        font-size: 19px;
    }

    .modal-lb-entry.rank-3 .modal-lb-rank {
        font-size: 18px;
    }

    .modal-lb-username {
        font-size: 14px;
    }

    .modal-lb-stats {
        font-size: 11px;
    }

    .modal-lb-score {
        font-size: 16px;
        min-width: 70px;
    }
}

/* Extra compact for small screens */
@media (max-width: 480px) {
    .modal-difficulty-buttons {
        gap: 6px;
    }

    .modal-difficulty-btn {
        padding: 12px 8px;
        font-size: 0.8em;
    }

    .difficulty-modal-content {
        padding: 30px 15px 15px;
    }

    .modal-header {
        margin-bottom: 12px;
    }

    .modal-header h2 {
        font-size: 1.2em;
    }

    .modal-icon {
        font-size: 2em;
        margin-bottom: 8px;
    }

    .modal-header p {
        font-size: 0.8em;
    }

    .modal-view-leaderboard-btn {
        padding: 8px 16px;
        font-size: 0.75em;
    }

    .modal-leaderboard-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .modal-leaderboard-container {
        max-height: 220px;
    }

    .modal-lb-entry {
        padding: 8px 10px;
    }
}