body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    align-items: center;
}

header {
    width: 100%;
    background: #333;
    color: white;
    text-align: center;
    padding: 1rem 0;
}

.subtitle {
    color: #aaa;
    margin-top: -10px;
    font-size: 14px;
}

.game-container {
    display: flex;
    margin-top: 20px;
    gap: 20px;
    max-width: 1200px;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

.grid-container {
    flex: 1;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 10px;
    position: relative;
}

.grid {
    display: grid;
    gap: 2px;
    background: #333;
    border-radius: 8px;
    padding: 3px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    width: 100%;
    height: 600px;
    aspect-ratio: 1 / 1;
}

.cell {
    transition: background-color 0.3s, transform 0.2s;
    cursor: pointer;
    box-shadow: inset 0 0 1px rgba(0,0,0,0.3);
    border-radius: 2px;
}

.cell:hover {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 0 5px rgba(0,0,0,0.3);
}


.cell.red { background: #e04a4a; }
.cell.blue { background: #26d0ce; }
.cell.yellow { background: #feca57; }
.cell.green { background: #5ac249; }
.cell.purple { background: #a55eea; }

.controls {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.panel {
    background: white;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.panel h2 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.info-text {
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

.color-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.color-option {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: transform 0.2s, box-shadow 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.color-option.selected {
    border: 3px solid black;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.color-option.red { background: #e04a4a; }
.color-option.blue { background: #26d0ce; }
.color-option.yellow { background: #feca57; }
.color-option.green { background: #5ac249; }
.color-option.purple { background: #a55eea; }

.level-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.level-btn {
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
    padding: 8px;
    cursor: pointer;
    position: relative;
}

.level-btn.current {
    background: #4a6fa5;
    color: white;
}

.level-btn.completed {
    background: #b8e0b8;
}

.button {
    background: #4a6fa5;
    color: white;
    border: none;
    padding: 10px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
}

.button:hover {
    background: #3a5b8c;
}

.win-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
    border-radius: 8px;
}

.win-message.show {
    opacity: 1;
    pointer-events: all;
}

.scoreboard {
    max-height: 200px;
    overflow-y: auto;
}

.scoreboard table {
    width: 100%;
    border-collapse: collapse;
}

.scoreboard th, .scoreboard td {
    padding: 5px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 12px;
}

@keyframes fillAnimation {
    0% {transform: scale(1);}
    50% {transform: scale(1.1);}
    100% {transform: scale(1);}
}

.animated {
    animation: fillAnimation 0.3s ease;
}