/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #2c3e50;
    color: #ecf0f1;
}

#game-container {
    background-color: #34495e;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 800px;
    width: 90%;
    position: relative;
}

#header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#version-indicator {
    color: #95a5a6;
    font-size: 0.9em;
}

h1 {
    margin-top: 0;
    margin-bottom: 0;
    color: #3498db;
    flex-grow: 1;
}

#score-info {
    font-size: 1.5em;
    color: #f1c40f;
    margin-bottom: 10px;
}

#level-info {
    margin-bottom: 20px;
}

#target-instruction {
    font-size: 1.2em;
    font-weight: bold;
    color: #e74c3c;
}

#moves-info {
    font-size: 1.1em;
    color: #bdc3c7;
    margin-top: 5px;
}

#bottles-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    margin: 40px 0;
    min-height: 300px;
    flex-wrap: wrap;
}

/* Bottle Wrapper Styles to contain label outside hidden overflow */
.bottle-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.bottle-wrapper:hover .bottle {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.bottle-wrapper.selected .bottle {
    border-color: #f1c40f;
    box-shadow: 0 0 15px #f1c40f;
}

.bottle-wrapper.selected .bottle::before {
    border-color: #f1c40f;
}

/* Bottle Styles */
.bottle {
    position: relative;
    width: 80px; /* Base width */
    border: 4px solid #bdc3c7;
    border-top: none;
    border-radius: 0 0 10px 10px;
    background-color: rgba(255, 255, 255, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden; /* To keep liquid inside border-radius */
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

/* Neck of the bottle */
.bottle::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 20px;
    border: 4px solid #bdc3c7;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    background-color: transparent;
    z-index: 10;
}



.liquid {
    width: 100%;
    background-color: #3498db;
    transition: height 0.5s ease-in-out;
    /* initial height set via JS */
    height: 0%;
    z-index: 1;
}

.bottle-label {
    margin-top: 15px;
    text-align: center;
    font-weight: bold;
    color: #bdc3c7;
}

/* Scale marks container */
.scale-marks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* Don't block clicks on bottle */
    z-index: 5;
    display: flex;
    flex-direction: column-reverse; /* Bottom up */
    justify-content: space-between;
}

.scale-mark {
    width: 10px;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.5);
    margin-left: auto; /* Push to right edge */
}

/* Make every 5th or last mark slightly longer/visible differently if needed */
.scale-mark:nth-child(5n) {
    width: 15px;
    background-color: rgba(255, 255, 255, 0.8);
}


/* Controls */
#controls {
    margin-top: 30px;
}

button {
    background-color: #2ecc71;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1.1em;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin: 0 10px;
}

button:hover {
    background-color: #27ae60;
}

#restart-level-btn {
    background-color: #e67e22;
}
#restart-level-btn:hover {
    background-color: #d35400;
}

#show-solution-btn {
    background-color: #9b59b6;
}
#show-solution-btn:hover {
    background-color: #8e44ad;
}

#install-btn {
    background-color: #e74c3c;
    font-size: 0.9em;
    padding: 5px 10px;
}
#install-btn:hover {
    background-color: #c0392b;
}

#message-area {
    margin-top: 20px;
    font-size: 1.2em;
    font-weight: bold;
    min-height: 1.5em; /* Prevent layout jump */
}

.success-message {
    color: #2ecc71;
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.error-message {
    color: #e74c3c;
}

/* Solution Table */
#solution-container {
    margin-top: 30px;
    background-color: rgba(0,0,0,0.2);
    padding: 20px;
    border-radius: 8px;
}

#solution-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

#solution-table th, #solution-table td {
    border: 1px solid #7f8c8d;
    padding: 8px;
    text-align: center;
}

#solution-table th {
    background-color: #2c3e50;
    color: #3498db;
}

#continue-btn {
    background-color: #c0392b;
}

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