* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(255, 255, 255, 0.05);
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent-cyan: #00d9ff;
    --accent-green: #00ff88;
    --accent-orange: #ff8e53;
    --accent-purple: #a855f7;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 25px;
}

.header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 217, 255, 0.3);
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 5px;
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-card);
    padding: 15px 20px;
    border-radius: 15px;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.username {
    font-weight: bold;
    font-size: 1.1rem;
}

.user-stats {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Games Grid */
.games-grid {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.game-card {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-card);
    padding: 20px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-card:hover:not(.disabled) {
    transform: translateX(5px);
    border-color: var(--accent-cyan);
    box-shadow: 0 0 20px rgba(0, 217, 255, 0.2);
}

.game-card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.game-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.game-info h3 {
    margin-bottom: 5px;
}

.game-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.game-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: bold;
}

.game-tag.online {
    background: rgba(0, 255, 136, 0.2);
    color: var(--accent-green);
}

.game-tag.multiplayer {
    background: rgba(168, 85, 247, 0.2);
    color: var(--accent-purple);
}

.game-tag.coming {
    background: rgba(255, 142, 83, 0.2);
    color: var(--accent-orange);
}

/* Menu Buttons */
.menu-buttons {
    display: flex;
    gap: 15px;
}

.menu-btn {
    flex: 1;
    padding: 15px;
    border: none;
    border-radius: 12px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-cyan);
}

/* Screen Header */
.screen-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.screen-header h2 {
    font-size: 1.3rem;
}

.back-btn {
    padding: 10px 15px;
    border: none;
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.tab {
    padding: 10px 20px;
    border: none;
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    font-size: 0.9rem;
}

.tab.active {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    color: #000;
    font-weight: bold;
}

/* Leaderboard List */
.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-item.me {
    border-color: var(--accent-green);
    background: rgba(0, 255, 136, 0.1);
}

.rank {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.rank.gold { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #000; }
.rank.silver { background: linear-gradient(135deg, #c0c0c0, #a0a0a0); color: #000; }
.rank.bronze { background: linear-gradient(135deg, #cd7f32, #a0522d); color: #fff; }
.rank.normal { background: var(--bg-card); color: var(--text-secondary); }

.player-info {
    flex: 1;
}

.player-name {
    font-weight: bold;
    display: block;
}

.player-games {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.player-score {
    font-weight: bold;
    color: var(--accent-cyan);
    font-size: 1.1rem;
}

/* Profile */
.profile-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-green));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 15px;
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 20px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-cyan);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Game Stats */
.game-stats {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.game-stats h4 {
    margin-bottom: 15px;
    color: var(--text-secondary);
}

.game-stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.game-stat-item:last-child {
    border-bottom: none;
}

.game-name {
    font-weight: bold;
}

.game-stat-details {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.game-stat-details b {
    color: var(--accent-cyan);
}

/* Game Container */
#gameContainer {
    padding: 0;
}

.game-header {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.8);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.game-header .back-btn {
    padding: 8px 12px;
    font-size: 0.9rem;
}

#currentGameName {
    font-weight: bold;
}

#gameFrame {
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: calc(100vh - 50px);
    border: none;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}
