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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

h1 {
    color: #333;
    margin-bottom: 30px;
    text-align: center;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin: 30px 0 20px 0;
    font-size: 1.5em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

h3 {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.controls {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: 0.9em;
}

.control-group input {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 1em;
    width: 120px;
    transition: border-color 0.3s;
}

.control-group input:focus {
    outline: none;
    border-color: #667eea;
}

.control-group input[type="checkbox"] {
    width: auto;
    height: 20px;
    cursor: pointer;
}

.color-palette {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.import-export {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.import-export-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.action-button {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: background 0.3s, transform 0.2s;
}

.action-button:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.action-button:active {
    transform: translateY(0);
}

label.action-button {
    display: inline-block;
    text-align: center;
}

#color-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-button {
    width: 50px;
    height: 50px;
    border: 3px solid #333;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-number {
    font-size: 24px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.4);
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    user-select: none;
}

.color-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.color-button.selected {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.color-button.empty {
    background: repeating-linear-gradient(
        45deg,
        #ccc,
        #ccc 10px,
        #ddd 10px,
        #ddd 20px
    );
}

.examples-section, .test-section {
    margin-bottom: 40px;
}

.example-item, .test-item {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
}

.example-item h4, .test-item h4 {
    color: #555;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.grid-pair {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

.grid-container {
    display: inline-block;
}

.grid-container h5 {
    color: #666;
    margin-bottom: 10px;
    font-size: 0.95em;
    font-weight: 600;
}

.grid {
    display: inline-grid;
    gap: 2px;
    padding: 10px;
    background: #333;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.cell {
    width: 30px;
    height: 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: transform 0.1s;
    border-radius: 2px;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
}

.cell:hover {
    transform: scale(1.1);
    z-index: 10;
    position: relative;
}

.cell.empty {
    background: repeating-linear-gradient(
        45deg,
        #ccc,
        #ccc 10px,
        #ddd 10px,
        #ddd 20px
    );
}

@media (max-width: 768px) {
    .grid-pair {
        flex-direction: column;
    }
    
    .cell {
        width: 25px;
        height: 25px;
    }
}

