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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f8ff;
    color: #2c3e50;
    line-height: 1.6;
}

.screen {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    transition: all 0.5s;
}

.hidden {
    display: none;
}

#start-screen {
    padding-top: 100px;
}

#player-form {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#player-name {
    padding: 12px 15px;
    font-size: 1.1rem;
    border: 2px solid #3498db;
    border-radius: 8px;
    width: 250px;
}

#start-btn {
    background: #2ecc71;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

#start-btn:hover {
    background: #27ae60;
    transform: translateY(-2px);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #2c3e50;
    color: white;
    border-radius: 10px;
    margin-bottom: 20px;
}

#hud {
    display: flex;
    gap: 20px;
}

#timer, #score, #lives {
    font-size: 1.2rem;
}

.game-area {
    margin: 30px 0;
}

.oil-system {
    width: 200px;
    margin: 0 auto 30px;
}

.oil-tank {
    width: 120px;
    height: 200px;
    background: #34495e;
    margin: 0 auto;
    position: relative;
    border: 5px solid #2c3e50;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}

.oil {
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, #e67e22, #f39c12);
    position: absolute;
    bottom: 0;
    transition: height 0.7s ease-out;
    border-radius: 0 0 5px 5px;
}

.pipe {
    width: 100px;
    height: 30px;
    background: #7f8c8d;
    margin: 0 auto;
    border-radius: 0 0 10px 10px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(1, 100px);
    gap: 15px;
    margin: 30px auto;
    justify-content: center;
}

.cell {
    width: 100px;
    height: 100px;
    background: #ecf0f1;
    border: 3px solid #bdc3c7;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.3rem;
    border-radius: 10px;
    transition: all 0.3s;
    user-select: none;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.cell.placed {
    background: #3498db;
    color: white;
    border-color: #2980b9;
}

.mission-box {
    background: #e8f4fc;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 5px solid #3498db;
}

.mission-box h3 {
    margin-bottom: 10px;
    color: #2c3e50;
}

#mission-text {
    font-size: 1.1rem;
}

.controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.btn-logic {
    padding: 12px 15px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    min-width: 100px;
    transition: all 0.3s;
}

.btn-logic:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-logic.selected {
    background: #2c3e50;
    transform: translateY(2px);
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.2);
}

.btn-test {
    background: #e74c3c;
    color: white;
    padding: 12px 25px;
    font-size: 1.1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

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

#gameover-screen {
    padding-top: 50px;
}

#gameover-screen h1 {
    color: #e74c3c;
    margin-bottom: 20px;
}

#final-score {
    font-size: 1.5rem;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    display: inline-block;
}

#restart-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    margin: 20px 0;
    transition: all 0.3s;
}

#restart-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.ranking {
    background: #ecf0f1;
    padding: 20px;
    border-radius: 10px;
    margin-top: 30px;
    text-align: left;
}

#highscores {
    margin-top: 15px;
    list-style-position: inside;
}

#highscores li {
    margin: 10px 0;
    font-size: 1.1rem;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.3s;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 1.5s infinite;
}

.warning {
    color: #e74c3c;
    font-weight: bold;
}

@media (max-width: 600px) {
    .grid {
        grid-template-columns: repeat(3, 80px);
    }
    
    .cell {
        width: 80px;
        height: 80px;
        font-size: 1rem;
    }
    
    header {
        flex-direction: column;
        gap: 10px;
    }
    
    #hud {
        width: 100%;
        justify-content: space-between;
    }
}

.sensor-controls {
    background: #e8f4fc;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.sensors {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 15px;
}

.sensor-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    cursor: pointer;
}

.sensor-status {
    font-size: 1.3rem;
    width: 24px;
    display: inline-block;
    text-align: center;
}

input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}