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

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #1a237e 0%, #0d1b2a 100%);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-container {
    text-align: center;
    padding: 20px;
}

h1 {
    color: #fff;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

#level-display {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.2rem;
    margin-bottom: 25px;
    font-weight: 500;
}

#level-display.clickable {
    cursor: pointer;
    padding: 8px 20px;
    border-radius: 20px;
    transition: background 0.2s ease;
    display: inline-block;
}

#level-display.clickable:hover {
    background: rgba(255, 255, 255, 0.1);
}

#level-selector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#level-selector.hidden {
    display: none;
}

.level-selector-content {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    padding: 30px 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: popIn 0.3s ease;
    max-width: 90vw;
}

.level-selector-content h2 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

#level-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.level-btn {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.level-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.level-btn.current {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
}

#close-selector-btn {
    padding: 10px 25px;
    font-size: 1rem;
    background: linear-gradient(135deg, #546e7a 0%, #455a64 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

#close-selector-btn:hover {
    transform: scale(1.05);
}

.button-group {
    display: flex;
    gap: 15px;
    justify-content: center;
}

#bottles-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    max-width: 1000px;
    margin: 0 auto 30px;
}

.bottle {
    width: 36px;
    height: 120px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.bottle:hover {
    transform: translateY(-5px);
}

.bottle.selected {
    transform: translateY(-15px);
}

.bottle-neck {
    width: 36px;
    height: 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    margin: 0 auto;
    position: relative;
}

.bottle-neck::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -2px;
    right: -2px;
    height: 4px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

.bottle-body {
    width: 36px;
    height: 100px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: none;
    border-radius: 0 0 10px 10px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
}

/* Glass highlight / shine */
.bottle-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 3px;
    width: 5px;
    height: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.03) 100%);
    border-radius: 3px;
    z-index: 2;
    pointer-events: none;
}

.liquid-segment {
    width: 100%;
    /* height set dynamically by JS based on capacity */
    position: relative;
    transition: all 0.3s ease;
}

.liquid-segment:last-child::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 2px;
    right: 2px;
    height: 6px;
    background: inherit;
    border-radius: 50%;
    opacity: 0.8;
}

/* Liquid colors */
.color-blue {
    background: linear-gradient(180deg, #4FC3F7 0%, #29B6F6 100%);
}

.color-pink {
    background: linear-gradient(180deg, #F06292 0%, #EC407A 100%);
}

.color-green {
    background: linear-gradient(180deg, #81C784 0%, #66BB6A 100%);
}

.color-orange {
    background: linear-gradient(180deg, #FFB74D 0%, #FFA726 100%);
}

.color-purple {
    background: linear-gradient(180deg, #BA68C8 0%, #AB47BC 100%);
}

.color-yellow {
    background: linear-gradient(180deg, #FFF176 0%, #FFEE58 100%);
}

.color-teal {
    background: linear-gradient(180deg, #26A69A 0%, #00897B 100%);
}

.color-red {
    background: linear-gradient(180deg, #EF5350 0%, #E53935 100%);
}

#reset-btn, #play-again-btn, #start-over-btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

#start-over-btn {
    background: linear-gradient(135deg, #546e7a 0%, #455a64 100%);
    box-shadow: 0 4px 15px rgba(84, 110, 122, 0.4);
}

#reset-btn:hover, #play-again-btn:hover, #start-over-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

#start-over-btn:hover {
    box-shadow: 0 6px 20px rgba(84, 110, 122, 0.6);
}

#win-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#win-overlay.hidden {
    display: none;
}

.win-message {
    background: linear-gradient(135deg, #1a237e 0%, #283593 100%);
    padding: 40px 60px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.win-image {
    max-width: 300px;
    max-height: 300px;
    margin-bottom: 20px;
    border-radius: 10px;
}

/* Pour animation */
@keyframes pourOut {
    0% { transform: scaleY(1); }
    100% { transform: scaleY(0); transform-origin: top; }
}

@keyframes pourIn {
    0% { transform: scaleY(0); transform-origin: bottom; }
    100% { transform: scaleY(1); }
}

.pouring-out {
    animation: pourOut 0.3s ease forwards;
}

.pouring-in {
    animation: pourIn 0.3s ease forwards;
}
