body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    text-align: center;
    margin: 0;
    padding: 0;
    color: white;
    min-height: 100vh;
}

.game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.game-header {
    text-align: center;
    margin-bottom: 30px;
}

.game-header h1 {
    margin: 0 0 20px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    font-weight: 700;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px 20px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
}

.stat .label {
    display: block;
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
    font-weight: 500;
}

.stat span:last-child {
    font-size: 1.2rem;
    font-weight: 600;
}

.game-area {
    display: flex;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.game-area-container {
    width : 520px;
    height: 520px;
    position: relative;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#game {
    margin: 0 auto;
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

#grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin: 20px auto;
    width: 400px;
}

.cell {
    width: 70px;
    height: 70px;
    background: #2c3e50;
    border: 3px solid #34495e;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.pipe {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pipe-segment {
    background: linear-gradient(45deg, #7f8c8d, #95a5a6);
    border: 2px solid #2c3e50;
    border-radius: 4px;
    position: absolute;
}

.pipe-straight {
    width: 20px;
    height: 50px;
    background: linear-gradient(90deg, #7f8c8d, #95a5a6);
}

.pipe-straight.horizontal {
    width: 50px;
    height: 20px;
    background: linear-gradient(0deg, #7f8c8d, #95a5a6);
}

/* Redesigned L-shaped pipe with two connected pipes and cube center */
.pipe-corner {
    position: relative;
    width: 100%;
    height: 100%;
    background: transparent !important;
}

.pipe-corner-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 25px;
    height: 25px;
    background: linear-gradient(45deg, #34495e, #2c3e50);
    border: 2px solid #1a252f;
    border-radius: 4px;
    z-index: 2;
}

.pipe-corner-horizontal {
    position: absolute;
    width: 35px;
    height: 15px;
    background: linear-gradient(0deg, #7f8c8d, #95a5a6);
    border: 2px solid #2c3e50;
    border-radius: 2px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.pipe-corner-vertical {
    position: absolute;
    width: 15px;
    height: 35px;
    background: linear-gradient(90deg, #7f8c8d, #95a5a6);
    border: 2px solid #2c3e50;
    border-radius: 2px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.pipe-corner-horizontal.left {
    left: 5px;
}

.pipe-corner-horizontal.right {
    right: 5px;
}

.pipe-corner-vertical.top {
    top: 5px;
}

.pipe-corner-vertical.bottom {
    bottom: 5px;
}

.pipe-connection {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #3498db;
    border-radius: 50%;
    border: 2px solid #2980b9;
}

.pipe-extension {
    background: linear-gradient(45deg, #7f8c8d, #95a5a6);
    border: 2px solid #2c3e50;
    border-radius: 4px;
    position: absolute;
}

.water-flow {
    position: absolute;
    border-radius: 50%;
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.6);
    animation: flow 1s ease-in-out infinite alternate;
}

@keyframes flow {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

#source {
    background: linear-gradient(45deg, #3498db, #5dade2);
    border: 3px solid #2980b9;
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.8);
}

#source .pipe-segment {
    background: linear-gradient(45deg, #3498db, #5dade2) !important;
    border-color: #2980b9 !important;
}

#fire {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    position: relative;
    overflow: hidden;
    border: 3px solid #c0392b;
}

#fire .pipe-segment {
    background: linear-gradient(45deg, #e74c3c, #c0392b) !important;
    border-color: #c0392b !important;
}

#fire::before {
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #f39c12, transparent 70%);
    animation: flicker 0.5s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

#cat {
    font-size: 2rem;
    transition: transform 0.3s;
}

.angry {
    color: #e74c3c;
    animation: shake 0.5s infinite;
}

.happy {
    color: #27ae60;
    animation: bounce 0.5s infinite;
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.pipe-corner-center.water-on,
.pipe-corner-horizontal.water-on,
.pipe-corner-vertical.water-on,
.pipe-segment.water-on {
    background: linear-gradient(45deg, #3498db, #5dade2) !important;
    border-color: #1e90ff !important;
    box-shadow: 0 0 10px #3498db88;
}

/* Remove the central blue circle for water flow */
.water-flow {
    display: none !important;
}

.source-cube {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #34495e, #2c3e50);
    border: 3px solid #2980b9;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(52, 152, 219, 0.6);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.fire-cube {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #2c3e50, #34495e);
    border: 3px solid #c0392b;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.6);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.source-cube.water-on,
.fire-cube.water-on {
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.8);
}

/* Start Screen and Game Over Overlays */
#start-screen,
#game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 16px;
    z-index: 100;
    text-align: center;
    padding: 40px;
}

#start-screen h2,
#game-over h2 {
    margin: 0 0 20px 0;
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
}

#start-screen p,
#game-over p {
    margin: 10px 0;
    font-size: 1.1rem;
    line-height: 1.6;
    color: #ccc;
    max-width: 400px;
}

.game-over-time {
    font-size: 1.3rem !important;
    font-weight: 600;
    color: #fff !important;
    margin: 20px 0 !important;
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 30px;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    margin: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
}

/* Game Instructions */
.game-instructions {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-instructions h3 {
    margin: 0 0 20px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

.game-instructions ul {
    text-align: left;
    margin: 0;
    padding-left: 20px;
}

.game-instructions li {
    margin: 10px 0;
    font-size: 1rem;
    line-height: 1.6;
    color: #ccc;
}

/* Back Link */
.back-link-container {
    text-align: center;
    margin-top: 30px;
}

.back-link {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    display: inline-block;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* AdSense Container */
.adsense-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
    min-width: 300px;
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .adsense-container {
        min-width: 100%;
        max-width: 400px;
    }
    
    .game-stats {
        gap: 15px;
    }
    
    .stat {
        min-width: 100px;
        padding: 10px 15px;
    }
    
    #game {
        width: 350px;
        height: 450px;
    }
    
    #grid {
        width: 350px;
    }
    
    .cell {
        width: 60px;
        height: 60px;
    }
}

/* Flame animation for game over */
.flame {
    position: absolute;
    width: 10px;
    height: 20px;
    background: linear-gradient(to top, #e74c3c, #f39c12);
    border-radius: 50% 50% 20% 20%;
    opacity: 0;
} 