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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.lang-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 1000;
}

.lang-switcher a {
    font-size: 24px;
    text-decoration: none;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.lang-switcher a:hover,
.lang-switcher a.active {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.auth-icon {
    font-size: 64px;
    text-align: center;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.auth-card h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.auth-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: bold;
}

.error-message {
    background: #ff6b6b;
    color: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.game-page {
    background: #1a1a2e;
    color: white;
}

.game-header {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-left h1 {
    font-size: 28px;
    margin: 0;
}

.username {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.stat-icon {
    font-size: 24px;
}

.stat-label {
    font-size: 14px;
    opacity: 0.8;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #4ecca3;
}

.btn-logout {
    background: #e74c3c;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s;
}

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

.game-main {
    padding: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 88px);
}

.city-grid {
    display: grid;
    grid-template-columns: repeat(10, 70px);
    grid-template-rows: repeat(10, 70px);
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.grid-cell {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 36px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(78, 204, 163, 0.3);
}

.grid-cell.occupied {
    background: rgba(78, 204, 163, 0.2);
    border-color: #4ecca3;
}

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

.modal.active {
    display: flex;
}

.modal-content {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    padding: 40px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
}

.building-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.building-option {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.building-option:hover {
    background: rgba(78, 204, 163, 0.2);
    border-color: #4ecca3;
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(78, 204, 163, 0.3);
}

.building-emoji {
    font-size: 48px;
    margin-bottom: 10px;
}

.building-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
}

.building-info {
    font-size: 14px;
    color: #4ecca3;
    margin-bottom: 8px;
}

.building-cost {
    font-size: 16px;
    color: #ffd700;
}

.btn-cancel {
    width: 100%;
    padding: 15px;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

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

@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }
    
    .header-stats {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .city-grid {
        grid-template-columns: repeat(10, 50px);
        grid-template-rows: repeat(10, 50px);
        gap: 3px;
    }
    
    .grid-cell {
        font-size: 24px;
    }
    
    .building-options {
        grid-template-columns: 1fr;
    }
}

.level-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ffd700;
    color: #000;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
}

.btn-menu {
    background: rgba(78, 204, 163, 0.2);
    color: white;
    padding: 10px 15px;
    border: 2px solid #4ecca3;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    margin: 0 5px;
}

.btn-menu:hover {
    background: rgba(78, 204, 163, 0.4);
    transform: translateY(-2px);
}

.panel-content {
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-close {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

.btn-close:hover {
    background: #c0392b;
}

.panel-section {
    margin-bottom: 30px;
}

.panel-section h3 {
    color: #4ecca3;
    margin-bottom: 15px;
    font-size: 20px;
}

.deposits-list,
.market-list,
.quests-list,
.leaderboard-list,
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.deposit-item,
.market-item,
.quest-item,
.leaderboard-item,
.message-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.market-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.market-resource {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.resource-name {
    font-size: 18px;
    font-weight: bold;
    text-transform: capitalize;
}

.resource-price {
    color: #ffd700;
    font-size: 16px;
}

.market-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-buy {
    background: #4ecca3;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-buy:hover {
    background: #3dbb8f;
    transform: translateY(-2px);
}

.deposit-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.deposit-form input,
.deposit-form select {
    padding: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
}

.quest-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.quest-info {
    display: flex;
    justify-content: space-between;
}

.quest-type {
    font-weight: bold;
    text-transform: capitalize;
}

.quest-progress {
    background: rgba(0, 0, 0, 0.3);
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #4ecca3, #45b393);
    height: 100%;
    transition: width 0.5s;
}

.quest-reward {
    color: #ffd700;
    font-weight: bold;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
}

.leaderboard-item.current-user {
    border: 2px solid #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.player-rank {
    font-size: 24px;
    min-width: 50px;
}

.player-name {
    font-weight: bold;
    flex: 1;
    font-size: 18px;
}

.player-level {
    background: #667eea;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 14px;
}

.player-stats {
    font-size: 14px;
}

.player-score {
    color: #4ecca3;
    font-weight: bold;
}

.send-message-form {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.send-message-form input,
.send-message-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    font-family: inherit;
}

.message-item {
    margin-bottom: 10px;
}

.message-item.unread {
    border-left: 4px solid #4ecca3;
    background: rgba(78, 204, 163, 0.1);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
    opacity: 0.8;
}

.message-from {
    font-weight: bold;
    color: #4ecca3;
}

.message-text {
    font-size: 16px;
    line-height: 1.5;
}

.upgrade-info {
    text-align: center;
}

.building-display {
    margin-bottom: 20px;
}

.building-emoji-large {
    font-size: 80px;
    margin-bottom: 10px;
}

.building-level {
    font-size: 24px;
    color: #ffd700;
    font-weight: bold;
}

.upgrade-details {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.upgrade-details p {
    margin: 10px 0;
    font-size: 18px;
}

.loading {
    text-align: center;
    padding: 40px;
    font-size: 18px;
    color: #4ecca3;
}

@media (max-width: 1200px) {
    .header-right {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .btn-menu {
        font-size: 12px;
        padding: 8px 10px;
    }
}

@media (max-width: 768px) {
    .panel-content {
        max-width: 95vw;
    }
    
    .leaderboard-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .market-item {
        flex-direction: column;
        gap: 10px;
    }
}

.stats-controls {
    margin-bottom: 20px;
}

.stats-controls select {
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 5px;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #4ecca3;
}

canvas {
    width: 100% !important;
    height: auto !important;
    margin-bottom: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.building-stats,
.zone-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.building-stat-item,
.zone-stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.building-stat-emoji,
.zone-stat-emoji {
    font-size: 32px;
}

.building-stat-name,
.zone-stat-name {
    flex: 1;
    font-weight: bold;
}

.building-stat-count,
.zone-stat-count {
    background: #4ecca3;
    padding: 5px 12px;
    border-radius: 15px;
    font-weight: bold;
}

.zone-stat-satisfaction {
    background: #667eea;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
}

.zone-residential {
    background: rgba(76, 175, 80, 0.3) !important;
    border-color: #4caf50 !important;
}

.zone-commercial {
    background: rgba(33, 150, 243, 0.3) !important;
    border-color: #2196f3 !important;
}

.zone-industrial {
    background: rgba(158, 158, 158, 0.3) !important;
    border-color: #9e9e9e !important;
}