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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #fff;
    color: #000;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

.input-section {
    background: #f5f5f5;
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border: 1px solid #000;
}

.input-section label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
}

.input-wrapper {
    display: flex;
    gap: 1rem;
}

#text-input {
    flex: 1;
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid #000;
    border-radius: 4px;
    background: #fff;
    color: #000;
}

#text-input:focus {
    outline: none;
    border-color: #000;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

#text-input::placeholder {
    color: #888;
}

#encode-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

#encode-btn:hover {
    background: #333;
}

#encode-btn:active {
    background: #000;
}

.error-message {
    color: #000;
    margin-top: 1rem;
    font-size: 0.9rem;
    min-height: 1.4rem;
    font-weight: bold;
}

.info-section {
    margin-bottom: 2rem;
}

.info-section h2 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
}

.info-card {
    background: #f5f5f5;
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid #000;
}

.info-card p {
    margin-bottom: 0.8rem;
}

.info-card ul {
    margin-left: 1.5rem;
    color: #333;
}

.formula {
    background: #eee;
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    text-align: center;
    margin: 1rem 0;
    border: 1px solid #000;
}

.result-section {
    animation: fadeIn 0.5s ease;
}

.result-section.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.result-card {
    background: #f5f5f5;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #000;
}

.result-card h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.encoding-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.encoding-item {
    background: #eee;
    padding: 0.5rem 0.8rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    border: 1px solid #ccc;
}

.encoding-item .char {
    font-weight: bold;
}

.encoding-item .prime {
    font-weight: bold;
}

.encoding-item .exp {
    font-weight: bold;
}

.godel-number {
    background: #eee;
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.8;
    border: 1px solid #000;
}

.digit-count {
    color: #666;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.binary-info {
    color: #666;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.binary-display {
    background: #eee;
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    word-break: break-all;
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.6;
    border: 1px solid #000;
}

.binary-display .one {
    color: #000;
    font-weight: bold;
}

.binary-display .zero {
    color: #999;
}

.grid-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.grid-controls select {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    border: 2px solid #000;
    background: #fff;
    color: #000;
    cursor: pointer;
}

.slider-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #eee;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.slider-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.slider-group label {
    font-weight: 500;
    font-size: 0.95rem;
}

.slider-group label span {
    font-weight: bold;
    background: #000;
    color: #fff;
    padding: 0.1rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
}

.slider-group input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #ccc;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: #000;
    border-radius: 50%;
    cursor: pointer;
}

.slider-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #000;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.slider-hint {
    font-size: 0.8rem;
    color: #666;
    font-style: italic;
}

.slider-group.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.slider-group.disabled .slider-hint {
    color: #999;
}

.pixel-grid-container {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #eee;
    padding: 2rem;
    border-radius: 4px;
    min-height: 200px;
    border: 1px solid #000;
}

#pixel-grid {
    image-rendering: pixelated;
    border: 2px solid #000;
}

.grid-dimensions {
    color: #666;
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
}

footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #000;
    color: #666;
    font-size: 0.9rem;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #eee;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #999;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .input-wrapper {
        flex-direction: column;
    }
    
    #encode-btn {
        width: 100%;
    }
    
    .encoding-item {
        font-size: 0.75rem;
    }
}
