* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #2a2a4a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent-gold: #ffd700;
    --accent-orange: #ff8c00;
    --green: #00c853;
    --red: #ff5252;
    --blue: #2196f3;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    color: var(--text-primary);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

.btn {
    padding: 15px 30px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
    color: var(--bg-primary);
}

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

.btn-secondary {
    background: linear-gradient(135deg, var(--blue), #1976d2);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(33, 150, 243, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--green), #00a843);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--red), #d32f2f);
    color: white;
}

.btn-success:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 200, 83, 0.4);
}

.btn-danger:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(255, 82, 82, 0.4);
}

.card {
    background: linear-gradient(145deg, var(--bg-card), #1e1e3a);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.score-board {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    font-size: 1.5rem;
    font-weight: 600;
}

.score-board span {
    color: var(--accent-gold);
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 1.5rem;
}

.error {
    background: var(--red);
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 1rem;
    }
    
    .score-board {
        font-size: 1.2rem;
        gap: 20px;
    }
}

.nickname-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.nickname-modal-content {
    background: linear-gradient(145deg, var(--bg-card), #1e1e3a);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.nickname-modal-content h2 {
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.nickname-modal-content input {
    width: 100%;
    padding: 15px;
    font-size: 1.2rem;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-align: center;
    margin-bottom: 20px;
}

.nickname-modal-content input::placeholder {
    color: var(--text-secondary);
}

.photo-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.photo-viewer.show {
    display: flex;
}

.photo-viewer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
}

.photo-viewer-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.photo-viewer-content img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 10px;
    object-fit: contain;
}

.photo-viewer-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 10px;
}

.timer-display {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-align: center;
    margin-bottom: 20px;
}

.timer-display.warning {
    color: var(--red);
    animation: pulse 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.sound-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 100;
    transition: background 0.3s;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50px);
    }
}

.slide-in {
    animation: slideInRight 0.4s ease forwards;
}

.slide-out {
    animation: slideOutLeft 0.3s ease forwards;
}

.leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.leaderboard-content {
    background: linear-gradient(145deg, var(--bg-card), #1e1e3a);
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.leaderboard-content h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

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

.tab-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
    color: var(--bg-primary);
}

.leaderboard-list {
    margin-bottom: 20px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 10px;
    gap: 15px;
}

.leaderboard-item.top-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3), rgba(255, 215, 0, 0.1));
    border: 1px solid var(--accent-gold);
}

.leaderboard-item.top-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.3), rgba(192, 192, 192, 0.1));
    border: 1px solid #c0c0c0;
}

.leaderboard-item.top-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.3), rgba(205, 127, 50, 0.1));
    border: 1px solid #cd7f32;
}

.leaderboard-item .rank {
    font-size: 1.5rem;
    min-width: 40px;
}

.leaderboard-item .nickname {
    flex: 1;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-item .score {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--accent-gold);
}
.leaderboard-item .games {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.leaderboard-content .close-btn {
    width: 100%;
}

.leaderboard-content .no-data,
.leaderboard-content .loading {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
}


