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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background:
        linear-gradient(180deg, rgba(10,77,104,0.3) 0%, transparent 100%),
        repeating-linear-gradient(
            0deg,
            #1a5f7a 0px,
            #2a7f9a 40px,
            #1a5f7a 80px
        );
    background-size: 100% 100%, 100% 120px;
    animation: riverFlow 3s linear infinite;
    color: white;
    overflow: hidden;
}

@keyframes riverFlow {
    0% { background-position: 0 0, 0 0; }
    100% { background-position: 0 0, 0 120px; }
}

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

.screen.active {
    display: flex;
}

h1 {
    font-size: 4em;
    margin-bottom: 30px;
    text-shadow: 4px 4px 12px rgba(0,0,0,0.6);
    font-weight: 700;
    letter-spacing: -1px;
}

h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    font-weight: 600;
}

button {
    padding: 18px 40px;
    font-size: 1.1em;
    margin: 12px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

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

.btn-green {
    background: linear-gradient(135deg, #2ed573 0%, #26de81 100%);
    color: #000;
}

.btn-blue {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.btn-yellow {
    background: linear-gradient(135deg, #ffdd00 0%, #ffa502 100%);
    color: #000;
}

.btn-red {
    background: linear-gradient(135deg, #ff4757 0%, #ff3838 100%);
    color: white;
}

#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    display: none;
}

#stats {
    position: fixed;
    top: 20px;
    left: 20px;
    display: none;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
    transition: background-color 0.3s ease;
}

.stat-box {
    background:
        linear-gradient(135deg, rgba(101,67,33,0.95) 0%, rgba(139,90,43,0.95) 100%);
    padding: 12px 18px;
    border-radius: 10px;
    border-left: 4px solid #d4a574;
    backdrop-filter: blur(10px);
    min-width: 180px;
    box-shadow:
        0 4px 12px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

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

.stat-value {
    font-size: 1.6em;
    font-weight: 700;
    color: #fff;
}

#powerBar {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 50px;
    background:
        linear-gradient(135deg, rgba(101,67,33,0.95) 0%, rgba(139,90,43,0.95) 100%);
    border-radius: 25px;
    border: 3px solid #d4a574;
    overflow: hidden;
    display: none;
    z-index: 100;
    box-shadow:
        0 6px 24px rgba(0,0,0,0.6),
        inset 0 2px 4px rgba(0,0,0,0.3);
}

#powerBarFill {
    height: 100%;
    background: linear-gradient(90deg, #2ed573 0%, #ffdd00 50%, #ff4757 100%);
    transition: width 0.3s ease;
    width: 0%;
}

#powerText {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 1.3em;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.9);
    z-index: 1;
}

.info-text {
    background:
        linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%),
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255,255,255,0.03) 10px,
            rgba(255,255,255,0.03) 20px
        );
    padding: 25px 30px;
    border-radius: 15px;
    max-width: 700px;
    margin: 25px 0;
    line-height: 1.8;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(100,200,255,0.3);
    box-shadow:
        0 8px 32px rgba(0,0,0,0.3),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

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

.info-text strong {
    color: #ffdd00;
}

#connectionStatus {
    font-size: 1.2em;
    padding: 15px 25px;
    background:
        linear-gradient(135deg, rgba(10,77,104,0.8) 0%, rgba(26,95,122,0.8) 100%);
    border-radius: 10px;
    margin: 15px 0;
    min-width: 300px;
    text-align: center;
    border: 2px solid rgba(100,200,255,0.3);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

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

.countdown {
    font-size: 10em;
    font-weight: 800;
    animation: pulse 1s ease-in-out;
    text-shadow: 0 0 40px rgba(255,255,255,0.5);
}

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

.result-card {
    background:
        linear-gradient(135deg, rgba(10,77,104,0.9) 0%, rgba(26,95,122,0.9) 100%);
    padding: 30px 40px;
    border-radius: 15px;
    margin: 25px 0;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(100,200,255,0.4);
    box-shadow:
        0 8px 32px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

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

#home-button {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    font-size: 1em;
    background:
        linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    color: white;
    text-decoration: none;
    border: 3px solid white;
    border-radius: 50px;
    cursor: pointer;
    z-index: 1000;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-weight: 700;
    box-shadow:
        0 4px 15px rgba(0,0,0,0.4),
        inset 0 1px 0 rgba(255,255,255,0.3);
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

#home-button:hover {
    background:
        linear-gradient(135deg, #ff7b7b 0%, #ff6a62 100%);
    border-color: rgba(255,255,255,0.9);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 6px 20px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.4);
}