body {
    margin: 0;
    padding: 20px;
    font-family: Arial, sans-serif;
    background-color: #404040;
    color: white;
}

.container {
    max-width: 1240px;
    margin: 0 auto;
}

.screen {
    display: none;
    text-align: center;
}

.screen.active {
    display: block;
}

.screen h2 {
    margin-bottom: 30px;
    color: white;
}

button {
    padding: 15px 30px;
    margin: 10px;
    font-size: 16px;
    cursor: pointer;
    border: none;
    border-radius: 8px;
    background-color: #4CAF50;
    color: white;
}

button:hover {
    background-color: #45a049;
}

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

button.secondary {
    background-color: #2196F3;
}

button.secondary:hover {
    background-color: #0b7dda;
}

.rules-config {
    margin: 20px auto;
    max-width: 600px;
}

.rule-row {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 10px 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    color: white;
}

.rule-sum {
    width: 80px;
    font-weight: bold;
    text-align: center;
}

.rule-options {
    display: flex;
    gap: 20px;
    margin-left: 20px;
}

.rule-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

.state-preview {
    width: 20px;
    height: 20px;
    border: 1px solid #333;
    border-radius: 3px;
}

.initial-state-editor {
    margin: 20px auto;
    max-width: 1200px;
}

.editor-container {
    width: 1200px;
    height: 120px;
    border: 2px solid #333;
    overflow-x: auto;
    overflow-y: hidden;
    background-color: #404040;
    margin: 20px auto;
    position: relative;
}

.cell-strip {
    width: 4800px; /* 240 células × 20px = 4800px */
    height: 20px;
    display: flex;
    padding: 50px 0;
}

.editor-cell {
    width: 20px;
    height: 20px;
    border: 1px solid #ddd;
    cursor: pointer;
    flex-shrink: 0;
}

.editor-cell:hover {
    border: 2px solid #333;
}

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

.controls {
    margin-bottom: 20px;
    text-align: center;
}

.info {
    margin-bottom: 20px;
    text-align: center;
    font-size: 18px;
}

.automata-container {
    width: 1200px;
    height: 800px;
    overflow-y: auto;
    overflow-x: hidden;
    margin: 0 auto;
    position: relative;
}

.generation-row {
    width: 1200px;
    height: 5px;
    display: flex;
    flex-shrink: 0;
}

.cell {
    width: 5px;
    height: 5px;
    flex-shrink: 0;
}

.rules-display {
    font-family: monospace;
    font-size: 18px;
    font-weight: bold;
}

.color-selection {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #666;
}

.color-selection h3 {
    margin-bottom: 20px;
    color: white;
}

.color-config {
    max-width: 400px;
    margin: 0 auto;
}

.color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 15px 0;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.color-label {
    font-weight: bold;
    min-width: 80px;
}

.color-preview {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #666;
    margin: 0 15px;
}

.color-button {
    padding: 8px 16px;
    font-size: 14px;
}

.color-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.import-export-controls {
    margin-top: 15px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.import-export-btn {
    padding: 8px 16px;
    font-size: 12px;
    background-color: #9C27B0;
}

.import-export-btn:hover {
    background-color: #7B1FA2;
}

.rules-controls {
    margin-bottom: 20px;
}

.initial-state-controls {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.save-automata-btn {
    padding: 5px 10px;
    font-size: 12px;
    margin-left: 15px;
    background-color: #FF9800;
}

.save-automata-btn:hover {
    background-color: #F57C00;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
}

.modal-content {
    background-color: #505050;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    max-height: 80%;
    overflow-y: auto;
    color: white;
}

.modal-content h3 {
    margin-bottom: 20px;
    text-align: center;
}

.saved-list {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.saved-item {
    background-color: rgba(255, 255, 255, 0.1);
    margin: 10px 0;
    padding: 15px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.saved-item:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.saved-item-info {
    flex: 1;
}

.saved-item-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.saved-item-details {
    font-size: 12px;
    color: #ccc;
    font-family: monospace;
}

.saved-item-actions {
    display: flex;
    gap: 10px;
}

.delete-btn {
    background-color: #f44336;
    padding: 5px 10px;
    font-size: 12px;
}

.delete-btn:hover {
    background-color: #d32f2f;
}

.empty-list {
    text-align: center;
    color: #888;
    font-style: italic;
    padding: 40px 20px;
}

.article-access {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #666;
}

.article-btn {
    background-color: #795548;
    padding: 10px 20px;
    font-size: 14px;
}

.article-btn:hover {
    background-color: #5D4037;
}

.article-modal .modal-content {
    max-width: 900px;
    max-height: 90%;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #666;
}

.article-header h2 {
    margin: 0;
    color: white;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.article-content {
    line-height: 1.6;
    text-align: left;
    color: white;
}

.article-content h3 {
    color: white;
    margin-top: 25px;
    margin-bottom: 15px;
}

.article-content h4 {
    color: #ccc;
    margin-top: 20px;
    margin-bottom: 10px;
}

.article-content p {
    margin-bottom: 15px;
}

.article-content strong {
    color: white;
    font-weight: bold;
}

.article-content em {
    color: #ccc;
    font-style: italic;
}

.article-content a {
    color: #ccc;
    text-decoration: underline;
}

.article-content a:hover {
    color: white;
}

.article-content .note {
    background-color: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #FFC107;
    padding: 15px;
    margin: 20px 0;
    border-radius: 4px;
}

.model-selection {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid #666;
}

.model-selection h3 {
    margin-bottom: 20px;
    color: white;
}

.model-options {
    max-width: 500px;
    margin: 0 auto;
}

.model-option {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin: 15px 0;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-align: left;
}

.model-option input[type="radio"] {
    margin-right: 15px;
    transform: scale(1.2);
}

.model-option label {
    cursor: pointer;
    font-size: 16px;
    flex: 1;
}