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

body {
    font-family: 'Courier New', monospace;
    background: 
        radial-gradient(ellipse at top, #2d4059 0%, #1a1a2e 50%, #0f0f1e 100%),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 100px,
            rgba(255,255,255,0.02) 100px,
            rgba(255,255,255,0.02) 101px
        );
    color: white;
    overflow: hidden;
}

.screen {
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    min-height: 100vh;
    padding: 40px 20px;
    position: relative;
    z-index: 100;
}

.screen.active {
    display: flex;
}

h1 {
    font-size: 4.5em;
    margin-bottom: 30px;
    text-shadow: 
        0 0 20px rgba(0, 210, 255, 0.8),
        0 0 40px rgba(0, 210, 255, 0.4);
    font-weight: 900;
    letter-spacing: 4px;
    color: #00d2ff;
}

h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    font-weight: 700;
    color: #00d2ff;
}

button {
    padding: 20px 50px;
    font-size: 1.2em;
    margin: 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    font-family: 'Courier New', monospace;
}

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

button:hover:before {
    width: 300px;
    height: 300px;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.5);
}

button:active {
    transform: translateY(0);
}

.btn-play {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: white;
    box-shadow: 0 0 30px rgba(0, 210, 255, 0.6);
}

.btn-difficulty {
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.4);
}

.btn-retry {
    background: linear-gradient(135deg, #ff4757 0%, #ff3838 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.4);
}

#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    display: block;
    z-index: 1;
}

#gameCanvas canvas {
    display: block;
}

#hud {
    position: fixed;
    top: 20px;
    left: 20px;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
}

.stat-card {
    background: rgba(10, 10, 30, 0.85);
    padding: 12px 20px;
    border-radius: 8px;
    border-left: 4px solid #00d2ff;
    backdrop-filter: blur(15px);
    min-width: 180px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.stat-label {
    font-size: 0.85em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.stat-val {
    font-size: 1.6em;
    font-weight: 900;
    color: #00d2ff;
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
}

#simControls {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    background: rgba(10, 10, 30, 0.9);
    padding: 20px 25px;
    border-radius: 15px;
    border: 2px solid #00d2ff;
    text-align: center;
    width: 400px;
    box-shadow: 0 6px 30px rgba(0, 210, 255, 0.3);
    backdrop-filter: blur(10px);
}

.watt-display {
    font-size: 1.8em;
    color: #00d2ff;
    font-weight: 900;
    margin-bottom: 10px;
    display: block;
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.7);
}

input[type=range] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: rgba(255,255,255,0.1);
    outline: none;
    -webkit-appearance: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.8);
}

input[type=range]::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.8);
    border: none;
}

.info-text {
    background: rgba(255,255,255,0.05);
    padding: 25px 30px;
    border-radius: 12px;
    max-width: 700px;
    margin: 25px 0;
    line-height: 1.8;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 210, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.info-text p {
    margin: 12px 0;
    color: #ccc;
}

.info-text strong {
    color: #00d2ff;
}

.info-text ul {
    text-align: left;
    color: #aaa;
    list-style: none;
    padding: 0;
}

.info-text li {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.info-text li:last-child {
    border-bottom: none;
}

.countdown {
    font-size: 10em;
    font-weight: 900;
    animation: pulse 1s ease-in-out;
    text-shadow: 
        0 0 40px rgba(0, 210, 255, 1),
        0 0 80px rgba(0, 210, 255, 0.6);
    color: #00d2ff;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

.result-card {
    background: rgba(10, 10, 30, 0.9);
    padding: 30px 40px;
    border-radius: 15px;
    margin: 25px 0;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 210, 255, 0.4);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.result-card p {
    font-size: 1.3em;
    margin: 15px 0;
    color: #ccc;
}

#home-button {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    font-size: 1em;
    background: rgba(255, 71, 87, 0.9);
    color: white;
    text-decoration: none;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    cursor: pointer;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#home-button:hover {
    background: rgba(255, 71, 87, 1);
    border-color: rgba(255,255,255,0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.5);
}

#connectionStatus {
    font-size: 1.2em;
    padding: 15px 25px;
    background: rgba(10, 10, 30, 0.8);
    border-radius: 10px;
    margin: 15px 0;
    min-width: 300px;
    text-align: center;
    border: 2px solid rgba(0, 210, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#connectionStatus ul {
    text-align: left;
    padding-left: 20px;
    margin-top: 10px;
}

label {
    color: #aaa;
    font-size: 0.9em;
}

input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}