* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    min-height: 100vh;
    font-family: 'Orbitron', 'Segoe UI', monospace;
    background: radial-gradient(ellipse at 30% 40%, #0a0a2a, #010105);
    overflow-x: hidden;
}

body.light-theme {
    background: radial-gradient(ellipse at 30% 40%, #e0e0ff, #ffffff);
}

body.light-theme .lobby {
    background: rgba(255, 255, 255, 0.88);
    border-color: #0066aa;
}

body.light-theme .game-card {
    background: rgba(240, 245, 255, 0.96);
}

body.light-theme .leaderboard-card,
body.light-theme .info-box {
    background: rgba(200, 220, 255, 0.92);
}

.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    opacity: 0.5;
    animation: starTwinkle 4s infinite alternate;
}

@keyframes starTwinkle {
    0% { opacity: 0.15; }
    100% { opacity: 0.7; }
}

.lobby {
    position: relative;
    z-index: 10;
    max-width: 1600px;
    width: 95%;
    margin: 1rem auto;
    background: rgba(5, 12, 20, 0.55);
    backdrop-filter: blur(12px);
    border-radius: 2rem;
    border: 1px solid rgba(0, 255, 255, 0.3);
    padding: 1rem;
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(0, 255, 255, 0.3);
}

.site-title {
    font-size: 1.5rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFD966, #0ff, #f0f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.site-sub {
    color: #aaffdd;
    font-size: 0.6rem;
}

.name-input-section {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 10px;
    border-radius: 40px;
}

.name-input-section input {
    background: transparent;
    border: 1px solid cyan;
    padding: 4px 8px;
    border-radius: 30px;
    color: white;
    font-size: 0.7rem;
    width: 100px;
    outline: none;
}

.name-input-section button {
    background: cyan;
    border: none;
    padding: 4px 10px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: bold;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 50px;
}

.avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #ffcc44, #ff44aa);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.profile-info h3 {
    color: #ffdd99;
    font-size: 0.75rem;
}

.profile-info p {
    color: #aaffdd;
    font-size: 0.55rem;
}

.level-badge {
    background: cyan;
    color: #0a0f1e;
    padding: 2px 6px;
    border-radius: 20px;
    font-size: 0.6rem;
    font-weight: bold;
}

.stats-mini {
    display: flex;
    gap: 12px;
    background: rgba(0, 0, 0, 0.5);
    padding: 4px 12px;
    border-radius: 50px;
}

.stat-mini {
    text-align: center;
}

.stat-mini .value {
    color: #0ff;
    font-size: 0.9rem;
    font-weight: bold;
}

.stat-mini .label {
    color: #ffdd99;
    font-size: 0.5rem;
}

.theme-toggle {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid cyan;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
}

.music-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.5);
    padding: 3px 8px;
    border-radius: 40px;
}

.music-btn {
    background: cyan;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.6rem;
}

.volume-slider {
    width: 50px;
    cursor: pointer;
    accent-color: cyan;
}

.spin-section {
    background: linear-gradient(135deg, rgba(0, 30, 40, 0.8), rgba(10, 10, 30, 0.8));
    border-radius: 1rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.spin-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spin-icon {
    font-size: 1.5rem;
    animation: spinRotate 3s infinite linear;
}

@keyframes spinRotate {
    100% { transform: rotate(360deg); }
}

.spin-text h3 {
    color: #ffdd88;
    font-size: 0.7rem;
}

.timer-display {
    background: #000000aa;
    padding: 0.2rem 0.6rem;
    border-radius: 40px;
    color: #0ff;
    font-size: 0.7rem;
}

.spin-button {
    background: radial-gradient(circle at 30% 20%, #ffcc44, #e6a017);
    border: none;
    padding: 0.25rem 0.8rem;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.7rem;
}

.spin-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quests-section {
    background: rgba(0, 20, 30, 0.7);
    border-radius: 1rem;
    padding: 0.6rem;
    margin-bottom: 1rem;
}

.quests-title {
    color: #ffdd88;
    font-size: 0.8rem;
    margin-bottom: 0.4rem;
}

.quest-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.quest-card {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0.6rem;
    padding: 0.3rem 0.5rem;
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-left: 3px solid #ffcc44;
}

.claim-btn {
    background: #00a6c4;
    border: none;
    padding: 2px 6px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.55rem;
}

.report-section {
    text-align: center;
    margin-bottom: 1rem;
}

.report-win-btn {
    background: linear-gradient(135deg, #ffcc44, #ff8800);
    border: none;
    padding: 5px 15px;
    border-radius: 40px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.7rem;
}

.report-win-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.cooldown-text {
    margin-left: 10px;
    color: cyan;
    font-size: 0.7rem;
}

.main-layout {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.sidebar-left {
    flex: 1;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.games-area {
    flex: 2.5;
    min-width: 300px;
}

.leaderboard-card {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 1rem;
    padding: 0.6rem;
    border: 1px solid cyan;
}

.leaderboard-card h3 {
    color: #ffdd99;
    font-size: 0.8rem;
    text-align: center;
    margin-bottom: 0.5rem;
}

.leaderboard-list {
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-list::-webkit-scrollbar {
    width: 4px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: cyan;
    border-radius: 10px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.65rem;
}

.leaderboard-item .rank {
    color: gold;
    width: 35px;
}

.leaderboard-item .name {
    flex: 1;
    color: #aaffdd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-item .level {
    color: cyan;
    width: 45px;
    text-align: center;
}

.leaderboard-item .wins {
    color: #ffcc44;
    width: 45px;
    text-align: right;
}

.top-1 {
    background: rgba(255, 215, 0, 0.15);
    border-radius: 4px;
}

.top-2 {
    background: rgba(192, 192, 192, 0.1);
    border-radius: 4px;
}

.top-3 {
    background: rgba(205, 127, 50, 0.1);
    border-radius: 4px;
}

.info-box {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 1rem;
    padding: 0.6rem;
    border: 1px solid cyan;
}

.info-box h3 {
    color: #0ff;
    font-size: 0.75rem;
    text-align: center;
    margin-bottom: 0.4rem;
}

.info-text {
    color: #aaffdd;
    font-size: 0.6rem;
    line-height: 1.5;
}

.info-text span {
    color: #ffcc44;
    font-weight: bold;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.6rem;
    margin: 0.5rem 0;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 4px;
}

.games-grid::-webkit-scrollbar {
    width: 4px;
}

.games-grid::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

.games-grid::-webkit-scrollbar-thumb {
    background: cyan;
    border-radius: 10px;
}

.game-card {
    background: rgba(17, 23, 31, 0.95);
    border-radius: 0.8rem;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.1s ease;
    border: 1px solid rgba(42, 64, 85, 0.5);
}

.game-card:hover {
    transform: translateY(-2px);
    border-color: #0ff;
}

.game-icon-img {
    width: 55px;
    height: 55px;
    object-fit: contain;
    margin: 0 auto 5px;
    display: block;
}

.game-name {
    color: #ffdd99;
    font-size: 0.65rem;
    margin: 0.2rem 0;
    font-weight: bold;
}

.play-btn {
    background: linear-gradient(95deg, #00a6c4, #0077aa);
    border: none;
    padding: 3px 8px;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    font-size: 0.55rem;
    width: 100%;
    transition: 0.1s;
}

.play-btn:hover {
    background: cyan;
    color: #0a0f1e;
}

.game-launch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.5rem;
    visibility: hidden;
    opacity: 0;
    transition: 0.1s;
}

.game-launch-overlay.active {
    visibility: visible;
    opacity: 1;
}

.launch-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 255, 255, 0.2);
    border-top: 3px solid cyan;
    border-radius: 50%;
    animation: launchSpin 0.4s linear infinite;
}

@keyframes launchSpin {
    100% { transform: rotate(360deg); }
}

.launch-text {
    color: cyan;
    font-size: 0.9rem;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    visibility: hidden;
    opacity: 0;
    transition: 0.1s;
}

.modal.active {
    visibility: visible;
    opacity: 1;
}

.modal-content {
    background: linear-gradient(145deg, #1a2530, #0a121c);
    border-radius: 1rem;
    padding: 0.8rem;
    text-align: center;
    border: 2px solid gold;
}

.modal-content button {
    margin-top: 8px;
    padding: 4px 12px;
    background: cyan;
    border: none;
    border-radius: 20px;
    cursor: pointer;
}

.level-up-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ffcc44, #ff44aa);
    padding: 1rem;
    border-radius: 1.5rem;
    text-align: center;
    z-index: 10002;
    display: none;
}

.level-up-modal button {
    margin-top: 8px;
    padding: 4px 12px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
}

.lobby-footer {
    text-align: center;
    margin-top: 0.5rem;
    padding-top: 0.3rem;
    font-size: 0.5rem;
    color: #88bbff;
}

@media (max-width: 850px) {
    .main-layout {
        flex-direction: column;
    }
    .site-header {
        flex-direction: column;
    }
    .game-icon-img {
        width: 45px;
        height: 45px;
    }
}