:root {
    --oil-color: rgba(255, 0, 0, 0.7);
    --water-color: rgba(0, 0, 255, 0.7);
    --grid-border: #333;
    --aquarium-border: #000;
    --background-color: #f5f5f5;
    --container-bg: #fff;
    --button-color: #4285f4;
    --button-hover: #2b6abc;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: var(--background-color);
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: var(--container-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

h2 {
    margin: 15px 0;
    color: #444;
}

.description {
    margin-bottom: 30px;
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
}

.description ul {
    margin-left: 20px;
}

.description li {
    margin: 5px 0;
}

.input-section, .solution-section {
    margin-bottom: 30px;
}

.method-tabs {
    display: flex;
    margin-bottom: 15px;
}

.tab-button {
    padding: 10px 20px;
    background-color: #e0e0e0;
    border: none;
    cursor: pointer;
    border-radius: 5px 5px 0 0;
    margin-right: 5px;
}

.tab-button.active {
    background-color: var(--button-color);
    color: white;
}

.input-method {
    display: none;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 0 5px 5px 5px;
}

.input-method.active {
    display: block;
}

.grid-size-control {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.grid-size-control input {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    padding: 8px 16px;
    background-color: var(--button-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: var(--button-hover);
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    resize: vertical;
}

.controls {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    justify-content: center;
}

.grid {
    display: inline-grid;
    gap: 1px;
    background-color: var(--grid-border);
    padding: 1px;
    margin: 15px 0;
}

.cell {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    font-weight: bold;
    position: relative;
    border: 1px solid #ddd;
}

.cell.header {
    background-color: #e0e0e0;
}

.cell.oil-header {
    background-color: rgba(255, 0, 0, 0.2);
}

.cell.water-header {
    background-color: rgba(0, 0, 255, 0.2);
}

.cell.filled-oil {
    background-color: var(--oil-color);
    color: white;
}

.cell.filled-water {
    background-color: var(--water-color);
    color: white;
}

.cell input {
    width: 100%;
    height: 100%;
    border: none;
    text-align: center;
    font-size: 16px;
    outline: none;
}

.cell.aquarium-border-top {
    border-top: 2px solid var(--aquarium-border);
}

.cell.aquarium-border-right {
    border-right: 2px solid var(--aquarium-border);
}

.cell.aquarium-border-bottom {
    border-bottom: 2px solid var(--aquarium-border);
}

.cell.aquarium-border-left {
    border-left: 2px solid var(--aquarium-border);
}

.footer {
    text-align: center;
    margin-top: 40px;
    color: #666;
}

.footer a {
    color: var(--button-color);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

#solution-status {
    margin-top: 15px;
    padding: 10px;
    border-radius: 4px;
}

#solution-status.success {
    background-color: #d4edda;
    color: #155724;
}

#solution-status.error {
    background-color: #f8d7da;
    color: #721c24;
}

@media (max-width: 768px) {
    .cell {
        width: 30px;
        height: 30px;
        font-size: 12px;
    }
    
    textarea {
        width: 100%;
    }
}