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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, #e8f4f8 0%, #d0e8f0 100%);
    color: #333333;
    user-select: none;
}

.hidden {
    display: none !important;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#start-screen {
    background: linear-gradient(135deg, #e8f4f8 0%, #d0e8f0 100%);
}

.start-container {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.game-title {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
    background: linear-gradient(90deg, #0099cc, #e74c3c, #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-subtitle {
    font-size: 16px;
    color: #666666;
    margin-bottom: 40px;
}

.settings-group {
    margin-bottom: 25px;
    text-align: left;
}

.settings-group label {
    display: block;
    font-size: 14px;
    color: #555555;
    margin-bottom: 8px;
    font-weight: 500;
}

.settings-group select {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 10px;
    background: #ffffff;
    color: #333333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings-group select:hover {
    border-color: #0099cc;
}

.settings-group select:focus {
    outline: none;
    border-color: #0099cc;
    box-shadow: 0 0 10px rgba(0, 153, 204, 0.2);
}

.settings-group select option {
    background: #ffffff;
    color: #333333;
}

.btn {
    padding: 15px 50px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-primary {
    background: linear-gradient(90deg, #0099cc, #0077aa);
    color: #ffffff;
    box-shadow: 0 5px 20px rgba(0, 153, 204, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0, 153, 204, 0.4);
}

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

.btn-secondary {
    background: #ffffff;
    color: #333333;
    border: 2px solid rgba(0, 0, 0, 0.2);
    margin-top: 15px;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: rgba(0, 0, 0, 0.3);
}

#game-screen {
    z-index: 1;
}

#game-canvas {
    display: block;
    cursor: none;
    pointer-events: none;
}

#end-screen {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
}

.end-container {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    padding: 40px 60px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.end-title {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #e74c3c;
}

.end-score {
    font-size: 24px;
    margin-bottom: 30px;
    color: #666666;
}

.end-score span {
    font-size: 48px;
    font-weight: bold;
    color: #0099cc;
    display: block;
    margin-top: 10px;
}

.end-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.instructions {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    text-align: left;
}

.instructions h3 {
    font-size: 14px;
    color: #888888;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.instructions ul {
    list-style: none;
    font-size: 13px;
    color: #555555;
    line-height: 1.8;
}

.instructions li::before {
    content: '•';
    color: #0099cc;
    margin-right: 8px;
}

@media (max-width: 600px) {
    .start-container,
    .end-container {
        padding: 30px 40px;
        margin: 20px;
    }
    
    .game-title {
        font-size: 32px;
    }
    
    .btn {
        padding: 12px 40px;
        font-size: 16px;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.start-container,
.end-container {
    animation: fadeIn 0.5s ease-out;
}

.joystick-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 120px;
    height: 120px;
    z-index: 50;
    display: none;
}

.joystick-base {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    position: relative;
}

.joystick-stick {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #0099cc, #0077aa);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: box-shadow 0.2s ease;
}

.joystick-stick:active {
    box-shadow: 0 4px 15px rgba(0, 153, 204, 0.4);
}

.joystick-stick.active {
    background: linear-gradient(135deg, #00b8e6, #0099cc);
}

.boost-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 80px;
    height: 80px;
    z-index: 50;
    display: none;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.boost-button:active,
.boost-button.active {
    background: rgba(255, 200, 0, 0.3);
    border-color: rgba(255, 200, 0, 0.8);
    transform: scale(0.95);
}

.boost-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
}

.boost-icon svg {
    width: 100%;
    height: 100%;
    fill: #f39c12;
}

.player-length-display {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 15px;
    z-index: 50;
    display: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.player-length-display .length-value {
    font-size: 24px;
    font-weight: bold;
    color: #0099cc;
}
