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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.08) 0%, transparent 50%);
    animation: drift 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes drift {
    0%, 100% { transform: translate(-10%, -10%) rotate(0deg); }
    50% { transform: translate(10%, 10%) rotate(5deg); }
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3),
                0 0 0 1px rgba(255, 255, 255, 0.3) inset;
    max-width: 500px;
    width: 100%;
    position: relative;
    z-index: 1;
}

h1 {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
    font-size: 2.5em;
    font-weight: 800;
    letter-spacing: -1px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 0.9em;
}

.traffic-light {
    background: linear-gradient(145deg, #34495e, #2c3e50);
    border-radius: 30px;
    padding: 30px;
    margin: 30px auto;
    width: 200px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4),
                inset 0 2px 4px rgba(255, 255, 255, 0.1),
                inset 0 -2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
}

.traffic-light::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 30px;
    background: linear-gradient(145deg, #34495e, #2c3e50);
    border-radius: 10px 10px 0 0;
}

.light {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    margin: 20px auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.5);
    position: relative;
}

.light::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 20%;
    width: 40%;
    height: 30%;
    background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.light.active::before {
    opacity: 1;
}

.light.red {
    background: radial-gradient(circle at 30% 30%, #4a0000, #1a0000);
    border: 3px solid #2a0000;
}

.light.red.active {
    background: radial-gradient(circle at 30% 30%, #ff3333, #cc0000);
    border: 3px solid #ff0000;
    box-shadow: 0 0 60px rgba(255, 0, 0, 0.9),
                0 0 100px rgba(255, 0, 0, 0.6),
                inset 0 4px 8px rgba(255, 255, 255, 0.3),
                inset 0 -4px 8px rgba(0, 0, 0, 0.3);
    animation: pulse-red 0.5s ease, glow-red 2s ease-in-out infinite;
}

.light.green {
    background: radial-gradient(circle at 30% 30%, #004a00, #001a00);
    border: 3px solid #002a00;
}

.light.green.active {
    background: radial-gradient(circle at 30% 30%, #33ff33, #00cc00);
    border: 3px solid #00ff00;
    box-shadow: 0 0 60px rgba(0, 255, 0, 0.9),
                0 0 100px rgba(0, 255, 0, 0.6),
                inset 0 4px 8px rgba(255, 255, 255, 0.3),
                inset 0 -4px 8px rgba(0, 0, 0, 0.3);
    animation: pulse-green 0.5s ease, glow-green 2s ease-in-out infinite;
}

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

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

@keyframes glow-red {
    0%, 100% { 
        box-shadow: 0 0 60px rgba(255, 0, 0, 0.9),
                    0 0 100px rgba(255, 0, 0, 0.6),
                    inset 0 4px 8px rgba(255, 255, 255, 0.3),
                    inset 0 -4px 8px rgba(0, 0, 0, 0.3);
    }
    50% { 
        box-shadow: 0 0 80px rgba(255, 0, 0, 1),
                    0 0 120px rgba(255, 0, 0, 0.7),
                    inset 0 4px 8px rgba(255, 255, 255, 0.3),
                    inset 0 -4px 8px rgba(0, 0, 0, 0.3);
    }
}

@keyframes glow-green {
    0%, 100% { 
        box-shadow: 0 0 60px rgba(0, 255, 0, 0.9),
                    0 0 100px rgba(0, 255, 0, 0.6),
                    inset 0 4px 8px rgba(255, 255, 255, 0.3),
                    inset 0 -4px 8px rgba(0, 0, 0, 0.3);
    }
    50% { 
        box-shadow: 0 0 80px rgba(0, 255, 0, 1),
                    0 0 120px rgba(0, 255, 0, 0.7),
                    inset 0 4px 8px rgba(255, 255, 255, 0.3),
                    inset 0 -4px 8px rgba(0, 0, 0, 0.3);
    }
}

.status {
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin: 20px 0;
    min-height: 30px;
}

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

.btn {
    padding: 15px 40px;
    font-size: 1.1em;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #00cc00, #00aa00);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 204, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #00dd00, #00bb00);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 204, 0, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #ff3333, #cc0000);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 51, 51, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff4444, #dd0000);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 51, 51, 0.4);
}

.btn-fullscreen {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-fullscreen:hover:not(:disabled) {
    background: linear-gradient(135deg, #7788ff, #8855bb);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.settings {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border-radius: 20px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.settings h3 {
    margin-bottom: 20px;
    color: #333;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    color: #555;
    font-weight: 500;
}

.value {
    color: #667eea;
    font-weight: bold;
}

.toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
}

.toggle-container label {
    color: #555;
    font-weight: 500;
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(145deg, #ccc, #aaa);
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
    transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #00dd00, #00aa00);
    box-shadow: 0 0 10px rgba(0, 204, 0, 0.4),
                inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

input[type="range"]::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #7788ff, #8855bb);
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

input[type="range"]::-moz-range-thumb:hover {
    background: linear-gradient(135deg, #7788ff, #8855bb);
    transform: scale(1.3);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

.info {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    text-align: center;
}

.info p {
    color: #856404;
    margin: 0;
}

/* Fullscreen mode */
.fullscreen-mode {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.fullscreen-mode .traffic-light {
    width: 300px;
    padding: 50px;
    margin: 0;
}

.fullscreen-mode .light {
    width: 200px;
    height: 200px;
    margin: 30px auto;
}

.fullscreen-mode .status {
    font-size: 3em;
    color: white;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    margin-top: 30px;
}

.exit-fullscreen-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 30px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    color: #333;
    transition: all 0.3s ease;
    z-index: 10000;
}

.exit-fullscreen-btn:hover {
    background: white;
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    .traffic-light {
        width: 160px;
        padding: 20px;
    }

    .light {
        width: 100px;
        height: 100px;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
    
    .fullscreen-mode .traffic-light {
        width: 200px;
        padding: 30px;
    }

    .fullscreen-mode .light {
        width: 140px;
        height: 140px;
    }

    .fullscreen-mode .status {
        font-size: 2em;
    }
}

