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

:root {
    --bg-dark: #0a0e27;
    --bg-darker: #050814;
    --bg-light: #1a1f3a;
    --accent-primary: #00d9ff;
    --accent-secondary: #7b2cbf;
    --accent-gradient: linear-gradient(135deg, #00d9ff 0%, #7b2cbf 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0a8c0;
    --border-color: #2a3150;
    --success: #00ff88;
    --error: #ff3366;
    --warning: #ffaa00;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Screens */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Auth Screen */
#auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    position: relative;
    overflow: hidden;
}

#auth-screen::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 217, 255, 0.1) 0%, transparent 70%);
    top: -250px;
    right: -250px;
    animation: pulse 4s ease-in-out infinite;
}

#auth-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(123, 44, 191, 0.1) 0%, transparent 70%);
    bottom: -200px;
    left: -200px;
    animation: pulse 5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

.auth-container {
    position: relative;
    z-index: 1;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 50px 40px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.logo {
    font-size: 3em;
    font-weight: 700;
    text-align: center;
    margin-bottom: 10px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo .pro {
    font-size: 0.6em;
    vertical-align: super;
}

.auth-form {
    margin-top: 40px;
}

input[type="text"],
input[type="password"],
input[type="number"],
.country-select,
select {
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 15px;
    background: var(--bg-darker);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
.country-select:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.2);
}

.country-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.country-select {
    margin-bottom: 0;
}

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

.btn-primary {
    width: 100%;
    background: var(--accent-gradient);
    color: var(--text-primary);
    box-shadow: 0 10px 30px rgba(0, 217, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 217, 255, 0.5);
}

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

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    background: var(--bg-darker);
}

.auth-links {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
}

.auth-links a {
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

.auth-links a:hover {
    color: var(--accent-secondary);
}

/* Game Screen */
#game-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.game-header {
    background: var(--bg-darker);
    border-bottom: 2px solid var(--border-color);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.game-header h2 {
    font-size: 1.5em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-secondary);
}

.country-flags {
    display: flex;
    gap: 5px;
    font-size: 18px;
}

.round-info,
.score-display {
    background: var(--bg-light);
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.round-info span,
.score-display span {
    color: var(--accent-primary);
}

.game-container {
    flex: 1;
    display: flex;
    position: relative;
}

#mapillary-container {
    flex: 1;
    position: relative;
    background: var(--bg-darker);
}

#mapillary-viewer {
    width: 100%;
    height: 100%;
}

#map-container {
    width: 400px;
    position: relative;
    background: var(--bg-light);
    border-left: 2px solid var(--border-color);
}

#map {
    width: 100%;
    height: calc(100% - 80px);
}

#submit-guess {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 40px);
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

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

.modal-content h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-stats,
.final-stats {
    margin-bottom: 30px;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat label {
    color: var(--text-secondary);
}

.stat span {
    font-weight: 600;
    color: var(--accent-primary);
    font-size: 1.2em;
}

.final-score {
    text-align: center;
    padding: 30px;
    background: var(--bg-darker);
    border-radius: 15px;
    margin-bottom: 20px;
}

.final-score label {
    display: block;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 10px;
}

.final-score span {
    font-size: 3em;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-rank {
    text-align: center;
    font-size: 1.2em;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.final-actions {
    display: flex;
    gap: 15px;
}

.final-actions .btn-primary,
.final-actions .btn-secondary {
    flex: 1;
}

/* Leaderboard */
.leaderboard-container {
    min-height: 100vh;
    padding: 40px 20px;
    background: var(--bg-darker);
}

.leaderboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.leaderboard-header h1 {
    font-size: 3em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 16px;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: var(--accent-secondary);
}

.leaderboard-table {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    overflow: hidden;
}

.table-header,
.table-row {
    display: grid;
    grid-template-columns: 60px 1fr 150px 100px 120px;
    padding: 20px;
    gap: 15px;
    align-items: center;
}

.table-header {
    background: var(--bg-darker);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.table-row {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

.table-row:hover {
    background: var(--bg-darker);
}

.table-row:last-child {
    border-bottom: none;
}

.rank {
    font-size: 1.5em;
    font-weight: 700;
    color: var(--accent-primary);
    text-align: center;
}

.rank.gold { color: #ffd700; }
.rank.silver { color: #c0c0c0; }
.rank.bronze { color: #cd7f32; }

.player-name {
    font-weight: 600;
}

.player-score {
    font-size: 1.3em;
    font-weight: 700;
    color: var(--accent-primary);
    text-align: right;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

/* Admin Panel */
.admin-container {
    min-height: 100vh;
    padding: 40px 20px;
    background: var(--bg-darker);
}

.admin-login {
    max-width: 450px;
    margin: 100px auto;
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
}

.admin-login h1 {
    text-align: center;
    margin-bottom: 30px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.error-message {
    background: var(--error);
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.admin-panel {
    max-width: 1200px;
    margin: 0 auto;
}

.admin-header {
    text-align: center;
    margin-bottom: 40px;
}

.admin-header h1 {
    font-size: 2.5em;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.admin-sections {
    display: grid;
    gap: 30px;
}

.admin-section {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
}

.admin-section h2 {
    color: var(--accent-primary);
    margin-bottom: 20px;
    font-size: 1.5em;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.user-list,
.location-list {
    max-height: 400px;
    overflow-y: auto;
}

.user-item,
.location-item {
    background: var(--bg-darker);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-item-info,
.location-item-info {
    flex: 1;
}

.user-item-info h3,
.location-item-info h3 {
    margin-bottom: 5px;
}

.user-item-info p,
.location-item-info p {
    color: var(--text-secondary);
    font-size: 14px;
}

.btn-danger {
    background: var(--error);
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-danger:hover {
    background: #cc0044;
    transform: translateY(-2px);
}

.location-form {
    display: grid;
    gap: 15px;
    margin-top: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .game-container {
        flex-direction: column;
    }

    #map-container {
        width: 100%;
        height: 400px;
        border-left: none;
        border-top: 2px solid var(--border-color);
    }

    #map {
        height: calc(100% - 80px);
    }

    .table-header,
    .table-row {
        grid-template-columns: 50px 1fr 80px 100px;
        padding: 15px 10px;
        gap: 10px;
        font-size: 14px;
    }

    .table-header :nth-child(4),
    .table-row :nth-child(4) {
        display: none;
    }

    .admin-actions {
        flex-direction: column;
    }

    .final-actions {
        flex-direction: column;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}
