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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 10px;
    overflow: hidden;
    margin: 0;
}

.game-container {
    position: relative;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    max-height: 95vh;
}

#gameCanvas {
    display: block;
    background: linear-gradient(180deg, #87CEEB 0%, #E0F6FF 100%);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    transition: opacity 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.screen h1 {
    font-size: 48px;
    margin-bottom: 5px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

.screen p {
    font-size: 18px;
    margin-bottom: 15px;
}

.subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 25px;
}

.start-screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 20px;
    padding-bottom: 80px;
}

.btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 20px;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 20px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(245, 87, 108, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.high-score {
    margin-top: 20px;
    font-size: 18px;
    color: #ffd700;
}

.settings-sprocket {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.settings-sprocket:hover {
    transform: rotate(180deg) scale(1.15);
    color: rgba(255, 255, 255, 1);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.4));
}

.settings-sprocket:active {
    transform: rotate(180deg) scale(1.05);
}

.settings-panel {
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    max-width: 280px;
    transition: all 0.3s ease;
}

.settings-panel.hidden {
    display: none;
}

.settings-panel h3 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #fff;
}

.settings-content {
    margin: 30px 0;
    padding: 30px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    max-width: 350px;
}

.settings-content h3 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #fff;
}

.file-input {
    display: none;
}

.upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
    color: white;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-bottom: 15px;
}

.upload-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(9, 132, 227, 0.4);
}

.upload-label:active {
    transform: translateY(0);
}

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

.small-btn {
    padding: 10px 25px;
    font-size: 16px;
    margin-top: 5px;
    background: linear-gradient(135deg, #ff7675 0%, #d63031 100%);
    width: 100%;
}

.small-btn:hover {
    box-shadow: 0 5px 20px rgba(214, 48, 49, 0.4);
}

.back-btn {
    margin-top: 20px;
    background: linear-gradient(135deg, #a29bfe 0%, #6c5ce7 100%);
}

.back-btn:hover {
    box-shadow: 0 5px 20px rgba(108, 92, 231, 0.4);
}

.difficulty-selector {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    width: 100%;
    max-width: 400px;
}

.difficulty-selector h3 {
    font-size: 22px;
    margin-bottom: 5px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.difficulty-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
}

.difficulty-btn {
    min-width: unset;
    width: 100%;
    margin: 0;
    padding: 15px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 18px;
    position: relative;
}

.difficulty-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.difficulty-name {
    flex-grow: 1;
    text-align: left;
    font-size: 20px;
    font-weight: bold;
}

.difficulty-score {
    font-size: 13px;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.2);
    padding: 4px 10px;
    border-radius: 15px;
    flex-shrink: 0;
}

.difficulty-btn[data-difficulty="easy"] {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
}

.difficulty-btn[data-difficulty="easy"]:hover {
    box-shadow: 0 5px 20px rgba(132, 250, 176, 0.4);
}

.difficulty-btn[data-difficulty="medium"] {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
}

.difficulty-btn[data-difficulty="medium"]:hover {
    box-shadow: 0 5px 20px rgba(253, 203, 110, 0.4);
}

.difficulty-btn[data-difficulty="hard"] {
    background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%);
}

.difficulty-btn[data-difficulty="hard"]:hover {
    box-shadow: 0 5px 20px rgba(253, 121, 168, 0.4);
}

.score {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 48px;
    font-weight: bold;
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.score.hidden {
    display: none;
}

.instructions {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px 30px;
    border-radius: 10px;
    margin-top: 20px;
    max-width: 400px;
}

.instructions h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.instructions ul {
    list-style-position: inside;
    color: #333;
}

.instructions li {
    margin: 5px 0;
}

.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }
    
    * {
        margin: 0;
        padding: 0;
    }
    
    html, body {
        width: 100%;
        height: 100%;
        overflow: hidden;
        position: fixed;
    }
    
    body {
        padding: 0;
        justify-content: flex-start;
    }
    
    .game-container {
        border-radius: 0;
        box-shadow: none;
        width: 100vw;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0;
        padding: 0;
    }
    
    #gameCanvas {
        border-radius: 0;
        position: absolute;
        top: 0;
        left: 0;
        margin: 0;
        padding: 0;
    }
    
    .instructions {
        display: none;
    }
    
    .screen h1 {
        font-size: 42px;
    }
    
    .screen p {
        font-size: 16px;
    }
    
    .subtitle {
        font-size: 15px;
        margin-bottom: 20px;
    }
    
    .btn {
        padding: 14px 35px;
        font-size: 19px;
    }
    
    .difficulty-selector {
        width: 90%;
        max-width: 100%;
    }
    
    .difficulty-selector h3 {
        font-size: 20px;
    }
    
    .difficulty-btn {
        width: 100%;
        min-width: unset;
        display: flex;
        padding: 14px 20px;
        font-size: 17px;
    }
    
    .difficulty-icon {
        font-size: 22px;
    }
    
    .difficulty-name {
        font-size: 19px;
    }
    
    .difficulty-score {
        font-size: 12px;
        padding: 4px 9px;
    }
    
    .settings-panel {
        width: 85%;
        max-width: 280px;
    }
    
    .settings-panel h3 {
        font-size: 17px;
    }
    
    .settings-content {
        width: 85%;
        max-width: 320px;
        padding: 25px;
    }
    
    .settings-content h3 {
        font-size: 19px;
    }
    
    .upload-label {
        font-size: 17px;
        padding: 13px 26px;
    }
    
    .upload-icon {
        font-size: 22px;
    }
    
    .settings-sprocket {
        width: 38px;
        height: 38px;
        font-size: 30px;
        bottom: 18px;
        right: 18px;
    }
    
    .score {
        font-size: 40px;
        top: 15px;
    }
}

@media (max-width: 480px) {
    .screen h1 {
        font-size: 38px;
    }
    
    .screen p {
        font-size: 15px;
    }
    
    .subtitle {
        font-size: 14px;
    }
    
    .btn {
        padding: 12px 30px;
        font-size: 18px;
    }
    
    .difficulty-selector h3 {
        font-size: 19px;
    }
    
    .difficulty-btn {
        padding: 13px 18px;
        font-size: 16px;
    }
    
    .difficulty-icon {
        font-size: 20px;
    }
    
    .difficulty-name {
        font-size: 18px;
    }
    
    .difficulty-score {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .settings-content h3 {
        font-size: 18px;
    }
    
    .upload-label {
        font-size: 16px;
        padding: 12px 24px;
    }
    
    .upload-icon {
        font-size: 20px;
    }
    
    .settings-sprocket {
        width: 35px;
        height: 35px;
        font-size: 28px;
        bottom: 15px;
        right: 15px;
    }
    
    .score {
        font-size: 36px;
        top: 12px;
    }
}
