/* Authentication and Leaderboard UI Styles */

/* Modal Overlay */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.auth-modal.active {
    display: flex;
}

/* Modal Content */
.auth-modal-content {
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    border: 3px solid transparent;
    background-clip: padding-box;
    position: relative;
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 480px;
    width: 90%;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(138, 43, 226, 0.3),
        inset 0 0 80px rgba(138, 43, 226, 0.05);
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-modal-content::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(135deg, #8a2be2, #00ff88, #00d4ff, #ff1493);
    border-radius: 24px;
    z-index: -1;
    opacity: 0.8;
    animation: borderGlow 3s ease-in-out infinite;
}

@keyframes borderGlow {

    0%,
    100% {
        opacity: 0.6;
        filter: hue-rotate(0deg);
    }

    50% {
        opacity: 1;
        filter: hue-rotate(30deg);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Close Button */
.auth-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.auth-modal-close:hover {
    background: rgba(255, 77, 77, 0.2);
    transform: rotate(90deg);
    box-shadow: 0 0 20px rgba(255, 77, 77, 0.4);
}

/* Title and Subtitle */
.auth-modal-content h2 {
    color: #fff;
    text-align: center;
    margin-bottom: 8px;
    font-size: 36px;
    font-weight: 900;
    letter-spacing: 2px;
    text-shadow:
        0 0 30px rgba(138, 43, 226, 0.6),
        0 2px 4px rgba(0, 0, 0, 0.5);
    background: linear-gradient(135deg, #fff, #8a2be2, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-bottom: 32px;
    font-size: 15px;
    line-height: 1.5;
    font-weight: 400;
}

/* Auth Buttons Container */
.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

/* Auth Buttons */
.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 28px;
    border: 2px solid transparent;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-transform: none;
    letter-spacing: 0.3px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.auth-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.auth-btn:hover::before {
    width: 400px;
    height: 400px;
}

.auth-btn:active {
    transform: scale(0.97);
}

.auth-icon {
    font-size: 22px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.auth-btn span {
    position: relative;
    z-index: 1;
}

/* Google Button */
.google-btn {
    background: linear-gradient(135deg, #4285f4 0%, #357ae8 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.google-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(66, 133, 244, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

/* GitHub Button */
.github-btn {
    background: linear-gradient(135deg, #24292e 0%, #1a1e22 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(36, 41, 46, 0.3);
}

.github-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(36, 41, 46, 0.6);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Discord Button */
.discord-btn {
    background: linear-gradient(135deg, #5865F2 0%, #4752C4 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(88, 101, 242, 0.3);
}

.discord-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(88, 101, 242, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Auth Info */
.auth-info {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    font-size: 13px;
    margin-top: 8px;
    font-weight: 400;
}

/* Nickname Modal */
.nickname-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}

.nickname-modal.active {
    display: flex;
}

.nickname-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ff88;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.3);
}

.nickname-content h2 {
    color: #00ff88;
    text-align: center;
    margin-bottom: 10px;
    font-size: 28px;
}

.nickname-content p {
    color: #aaa;
    text-align: center;
    margin-bottom: 25px;
    font-size: 14px;
}

/* Nickname Input Container */
.nickname-input-container {
    position: relative;
    margin-bottom: 24px;
}

.nickname-input {
    width: 100%;
    padding: 18px 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 3px solid rgba(138, 43, 226, 0.4);
    border-radius: 14px;
    color: white;
    font-size: 18px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.nickname-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-weight: 400;
}

.nickname-input:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow:
        0 0 0 4px rgba(138, 43, 226, 0.1),
        0 0 30px rgba(138, 43, 226, 0.4),
        inset 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* Nickname Feedback */
.nickname-feedback {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.nickname-feedback.success {
    background: rgba(0, 255, 136, 0.15);
    color: #00ff88;
    border: 2px solid rgba(0, 255, 136, 0.3);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.nickname-feedback.error {
    background: rgba(255, 68, 68, 0.15);
    color: #ff6b6b;
    border: 2px solid rgba(255, 68, 68, 0.3);
    box-shadow: 0 0 20px rgba(255, 68, 68, 0.2);
}

/* Nickname Rules */
.nickname-rules {
    background: rgba(138, 43, 226, 0.1);
    border: 2px solid rgba(138, 43, 226, 0.3);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.nickname-rules p {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 15px;
}

.nickname-rules ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nickname-rules li {
    color: rgba(255, 255, 255, 0.7);
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
    font-size: 14px;
}

.nickname-rules li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #00ff88;
    font-weight: bold;
}

/* Primary Button */
.primary-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #8a2be2 0%, #6a1bb2 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    color: white;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 20px rgba(138, 43, 226, 0.4);
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(138, 43, 226, 0.6);
    background: linear-gradient(135deg, #9d3bf5 0%, #7a2bc2 100%);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #555 0%, #444 100%);
    box-shadow: none;
}

.nickname-feedback {
    margin-top: 10px;
    font-size: 14px;
    min-height: 20px;
}

.nickname-feedback.success {
    color: #00ff88;
}

.nickname-feedback.error {
    color: #ff4444;
}

.nickname-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.nickname-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nickname-btn-primary {
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    color: #1a1a2e;
}

.nickname-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0, 255, 136, 0.4);
}

.nickname-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nickname-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.nickname-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Leaderboard Modal */
.leaderboard-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.leaderboard-modal.active {
    display: flex;
}

.leaderboard-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #00ff88;
    border-radius: 20px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 40px rgba(0, 255, 136, 0.3);
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.leaderboard-header h2 {
    color: #00ff88;
    font-size: 32px;
    margin: 0;
}

.leaderboard-close {
    background: rgba(255, 68, 68, 0.2);
    border: 2px solid #ff4444;
    color: #ff4444;
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.leaderboard-close:hover {
    background: rgba(255, 68, 68, 0.4);
}

.leaderboard-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.leaderboard-tab {
    flex: 1;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 136, 0.3);
    color: #aaa;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-align: center;
}

.leaderboard-tab.active {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    color: #00ff88;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-entry {
    display: grid;
    grid-template-columns: 50px 2fr 1fr 1fr auto;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(0, 255, 136, 0.2);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.leaderboard-entry:hover {
    background: rgba(0, 255, 136, 0.1);
    border-color: #00ff88;
    transform: translateX(5px);
}

.leaderboard-entry.user-entry {
    background: rgba(0, 255, 136, 0.15);
    border-color: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.2);
}

.leaderboard-rank {
    font-size: 24px;
    font-weight: bold;
    color: #00ff88;
    text-align: center;
}

.leaderboard-rank.rank-1 {
    color: #ffd700;
}

.leaderboard-rank.rank-2 {
    color: #c0c0c0;
}

.leaderboard-rank.rank-3 {
    color: #cd7f32;
}

.leaderboard-nickname {
    font-size: 18px;
    font-weight: bold;
    color: white;
}

.leaderboard-stat {
    text-align: right;
    color: #aaa;
}

.leaderboard-stat strong {
    color: white;
    font-size: 18px;
}

.leaderboard-loading {
    text-align: center;
    padding: 40px;
    color: #00ff88;
    font-size: 18px;
}

/* Seed display in leaderboard */
.leaderboard-stat.seed-stat {
    color: #8a2be2;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaderboard-stat.seed-stat:hover {
    color: #00ff88;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.5);
}

/* User Info Display */
.user-info {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #00ff88;
    border-radius: 15px;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 1000;
}

.user-info-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #00ff88;
}

.user-info-name {
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.user-info-logout {
    background: rgba(255, 68, 68, 0.2);
    border: 2px solid #ff4444;
    color: #ff4444;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.user-info-logout:hover {
    background: rgba(255, 68, 68, 0.4);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .leaderboard-entry {
        grid-template-columns: 40px 1fr;
        gap: 10px;
    }

    .leaderboard-stat {
        grid-column: 2;
    }

    .leaderboard-stat.seed-stat {
        font-size: 11px;
    }

    /* Hide user-info during gameplay on mobile */
    .user-info {
        display: none !important;
    }
}

/* User info in pause modal for mobile */
.pause-user-info {
    display: none;
    /* Hidden by default, shown via JS when logged in */
}

@media (max-width: 768px) {
    .pause-user-info.visible {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 15px;
        background: rgba(0, 0, 0, 0.4);
        border-radius: 12px;
        border: 2px solid rgba(0, 255, 136, 0.3);
        margin-bottom: 20px;
    }


    .pause-user-info .user-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 2px solid #00ff88;
    }

    .pause-user-info .user-nickname {
        color: #ffffff;
        font-weight: 700;
        font-size: 16px;
        flex: 1;
    }

    .pause-user-info .user-logout-btn {
        background: rgba(255, 68, 68, 0.2);
        border: 2px solid #ff4444;
        color: #ff4444;
        padding: 8px 12px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 14px;
    }
}

/* Auth Modal - User Info (when logged in) */
.auth-user-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.auth-user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid #8a2be2;
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.5);
}

.auth-user-name {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

/* Secondary Button Style */
.auth-btn.secondary-btn {
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.auth-btn.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}