* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    animation: gradientShift 10s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%); }
    50% { background: linear-gradient(135deg, #2a5298 0%, #7e22ce 50%, #1e3c72 100%); }
}

#game-wrapper {
    width: 100%;
    max-width: 1000px;
    background: linear-gradient(to bottom, #ffffff 0%, #f0f9ff 100%);
    border-radius: 25px;
    box-shadow: 0 25px 70px rgba(30, 60, 114, 0.5), 0 0 0 3px rgba(59, 130, 246, 0.3);
    overflow: hidden;
    border: 3px solid rgba(59, 130, 246, 0.2);
}

.screen {
    padding: 40px;
    min-height: 600px;
}

.screen.hidden {
    display: none;
}

h1 {
    font-size: 3em;
    text-align: center;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(59, 130, 246, 0.2);
    font-weight: bold;
    animation: titleGlow 3s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.5)); }
    50% { filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.8)); }
}

h2 {
    font-size: 1.5em;
    color: #1e40af;
    margin: 20px 0 10px 0;
    font-weight: 600;
}

p {
    text-align: center;
    color: #666;
    font-size: 1.2em;
    margin-bottom: 30px;
}

.instructions {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    padding: 30px;
    border-radius: 20px;
    margin: 30px 0;
    border: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.1);
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    padding: 8px;
    font-size: 1.1em;
    color: #333;
}

.main-btn {
    display: block;
    margin: 20px auto;
    padding: 15px 50px;
    font-size: 1.3em;
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.5);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.main-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.main-btn:hover::before {
    left: 100%;
}

.main-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.7);
}

.main-btn.secondary {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
}

#game-screen {
    padding: 20px;
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.info {
    display: flex;
    gap: 20px;
    font-size: 1.1em;
    color: #333;
}

.info strong {
    color: #3b82f6;
    font-weight: 700;
}

.buttons {
    display: flex;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    font-size: 1em;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
    font-weight: 600;
}

.btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.5);
}

#game-canvas {
    display: block;
    width: 100%;
    max-width: 960px;
    height: 600px;
    margin: 0 auto;
    border: 6px solid #3b82f6;
    border-radius: 15px;
    background: #87CEEB;
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4), inset 0 0 20px rgba(59, 130, 246, 0.1);
}

#controls-hint {
    text-align: center;
    margin-top: 15px;
    font-size: 1.1em;
    color: #666;
    font-style: italic;
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding: 20px;
}

.control-btn {
    width: 80px;
    height: 80px;
    font-size: 2em;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.5);
    transition: all 0.1s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
}

.control-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.7);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.control-btn.jump {
    width: 100px;
    height: 100px;
    font-size: 2.5em;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    box-shadow: 0 5px 20px rgba(139, 92, 246, 0.5);
}

.control-btn.jump:active {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}

/* Show mobile controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    #mobile-controls {
        display: flex;
    }
    
    #controls-hint {
        display: none;
    }
}

.stats {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    padding: 30px;
    border-radius: 20px;
    margin: 30px auto;
    max-width: 400px;
    text-align: center;
    border: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.2);
}

.stats p {
    font-size: 1.5em;
    margin: 15px 0;
    color: #333;
}

.stats p {
    font-size: 1.5em;
    margin: 15px 0;
    color: #333;
}

.name-input-section {
    margin: 30px auto;
    max-width: 400px;
}

.name-input-section label {
    display: block;
    font-size: 1.2em;
    color: #1e40af;
    margin-bottom: 10px;
    font-weight: 600;
}

.name-input-section input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 3px solid #3b82f6;
    border-radius: 15px;
    background: #fff;
    color: #333;
    text-align: center;
    transition: all 0.3s;
}

.name-input-section input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.leaderboard-container {
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
    padding: 30px;
    border-radius: 20px;
    margin: 30px auto;
    max-width: 600px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 5px 20px rgba(59, 130, 246, 0.2);
}

#leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 10px 0;
    background: #fff;
    border-radius: 15px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    transition: all 0.3s;
}

.leaderboard-entry:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.leaderboard-entry .rank {
    font-size: 1.5em;
    font-weight: bold;
    color: #3b82f6;
    min-width: 50px;
}

.leaderboard-entry .player-name {
    flex: 1;
    font-size: 1.2em;
    color: #333;
    font-weight: 600;
}

.leaderboard-entry .player-time {
    font-size: 1.3em;
    color: #8b5cf6;
    font-weight: bold;
}

.leaderboard-entry:nth-child(1) .rank {
    color: #fbbf24;
    font-size: 1.8em;
}

.leaderboard-entry:nth-child(2) .rank {
    color: #94a3b8;
    font-size: 1.7em;
}

.leaderboard-entry:nth-child(3) .rank {
    color: #cd7f32;
    font-size: 1.6em;
}

.no-scores {
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 1.2em;
    font-style: italic;
}

.loading {
    text-align: center;
    padding: 30px;
    color: #3b82f6;
    font-size: 1.2em;
    font-style: italic;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    #game-wrapper {
        border-radius: 15px;
    }
    
    .screen {
        padding: 20px 15px;
    }
    
    h1 {
        font-size: 2em;
        margin-bottom: 15px;
    }
    
    h2 {
        font-size: 1.2em;
    }
    
    p {
        font-size: 1em;
    }
    
    .name-input-section {
        margin: 20px auto;
    }
    
    .name-input-section input {
        font-size: 1em;
        padding: 12px;
    }
    
    .instructions {
        padding: 20px;
    }
    
    .instructions li {
        font-size: 0.95em;
    }
    
    #game-screen {
        padding: 10px;
    }
    
    #game-canvas {
        height: auto;
    }
    
    .info {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
        font-size: 0.9em;
    }
    
    .btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    
    #mobile-controls {
        display: flex;
    }
    
    #controls-hint {
        display: none;
    }
    
    .control-btn {
        width: 65px;
        height: 65px;
        font-size: 1.6em;
    }
    
    .control-btn.jump {
        width: 80px;
        height: 80px;
        font-size: 2em;
    }
    
    .main-btn {
        padding: 12px 35px;
        font-size: 1.1em;
    }
    
    .leaderboard-container {
        padding: 20px;
    }
    
    .leaderboard-entry {
        padding: 12px;
    }
    
    .leaderboard-entry .rank {
        font-size: 1.2em;
    }
    
    .leaderboard-entry .player-name {
        font-size: 1em;
    }
    
    .leaderboard-entry .player-time {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 3px;
    }
    
    #game-wrapper {
        border-radius: 10px;
    }
    
    .screen {
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    h2 {
        font-size: 1em;
    }
    
    p {
        font-size: 0.9em;
    }
    
    .name-input-section {
        margin: 15px auto;
    }
    
    .name-input-section label {
        font-size: 1em;
    }
    
    .name-input-section input {
        font-size: 0.95em;
        padding: 10px;
    }
    
    .instructions {
        padding: 15px;
    }
    
    .instructions li {
        font-size: 0.85em;
    }
    
    #game-screen {
        padding: 8px;
    }
    
    #game-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .info {
        font-size: 0.85em;
        width: 100%;
    }
    
    .buttons {
        width: 100%;
        justify-content: flex-end;
    }
    
    .btn {
        padding: 6px 12px;
        font-size: 0.85em;
    }
    
    #game-canvas {
        border: 2px solid #3b82f6;
    }
    
    .control-btn {
        width: 55px;
        height: 55px;
        font-size: 1.4em;
    }
    
    .control-btn.jump {
        width: 70px;
        height: 70px;
        font-size: 1.8em;
    }
    
    .main-btn {
        padding: 10px 25px;
        font-size: 1em;
    }
    
    .stats {
        padding: 15px;
    }
    
    .stats p {
        font-size: 1em;
    }
    
    .leaderboard-container {
        padding: 15px;
    }
    
    .leaderboard-entry {
        padding: 10px;
        flex-wrap: wrap;
    }
    
    .leaderboard-entry .rank {
        font-size: 1.1em;
        min-width: 35px;
    }
    
    .leaderboard-entry .player-name {
        font-size: 0.9em;
        flex: 1;
        min-width: 120px;
    }
    
    .leaderboard-entry .player-time {
        font-size: 1em;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .screen {
        padding: 10px;
    }
    
    h1 {
        font-size: 1.4em;
        margin-bottom: 5px;
    }
    
    .instructions {
        padding: 10px;
        margin: 10px 0;
    }
    
    .name-input-section {
        margin: 10px auto;
    }
    
    #game-screen {
        padding: 5px;
    }
    
    #game-header {
        margin-bottom: 5px;
    }
    
    .control-btn {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }
    
    .control-btn.jump {
        width: 60px;
        height: 60px;
        font-size: 1.5em;
    }
}
