/* Japanese Minimalistic 6502 Emulator Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background-color: #ffffff;
    color: #000000;
    line-height: 1.6;
    font-size: 14px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
    border-bottom: 1px solid #000000;
    padding-bottom: 2rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    letter-spacing: 0.1em;
}

header p {
    font-size: 1rem;
    font-weight: 300;
    color: #666666;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 0.5rem;
}

h2, h3 {
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: 0.05em;
}

/* Editor Section */
.editor-section {
    margin-bottom: 2rem;
}

#assembly-code {
    width: 100%;
    height: 300px;
    padding: 1rem;
    border: 1px solid #000000;
    background-color: #ffffff;
    color: #000000;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    resize: vertical;
    outline: none;
    line-height: 1.5;
}

#assembly-code:focus {
    border-color: #666666;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

#assembly-code::placeholder {
    color: #999999;
}

/* Controls */
.controls {
    display: flex;
    gap: 0.5rem;
}

.controls-section {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    padding: 1rem;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid #000000;
    background-color: #ffffff;
    color: #000000;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.05em;
    min-width: 80px;
}

.btn:hover {
    background-color: #000000;
    color: #ffffff;
}

.btn.primary {
    background-color: #000000;
    color: #ffffff;
}

.btn.primary:hover {
    background-color: #333333;
}

.btn.secondary {
    border-color: #666666;
    color: #666666;
}

.btn.secondary:hover {
    background-color: #666666;
    color: #ffffff;
}

/* Output Section */
.output-section {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Registers */
.registers {
    border: 1px solid #e0e0e0;
    padding: 1rem;
}

.register-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 1rem;
}

.register {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    border: 1px solid #f0f0f0;
    background-color: #fafafa;
}

.register label {
    font-weight: 500;
    color: #333333;
}

.register span {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    color: #000000;
}

/* Screen Output */
.screen {
    border: 1px solid #e0e0e0;
    padding: 1rem;
}

.screen-display {
    margin-top: 1rem;
    min-height: 200px;
    padding: 1rem;
    border: 1px solid #f0f0f0;
    background-color: #000000;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    line-height: 1.2;
    white-space: pre-wrap;
    overflow-y: auto;
}

/* Memory Display */
.memory {
    border: 1px solid #e0e0e0;
    padding: 1rem;
}

.memory-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(16, 1fr);
    gap: 2px;
    font-size: 11px;
    max-height: 200px;
    overflow-y: auto;
}

.memory-cell {
    padding: 2px 4px;
    text-align: center;
    border: 1px solid #f0f0f0;
    background-color: #fafafa;
    min-height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memory-cell.modified {
    background-color: #e0e0e0;
    border-color: #000000;
}

/* Console */
.logs {
    grid-column: 1 / -1;
    border: 1px solid #e0e0e0;
    padding: 1rem;
}

#console-output {
    margin-top: 1rem;
    min-height: 150px;
    max-height: 300px;
    padding: 1rem;
    border: 1px solid #f0f0f0;
    background-color: #fafafa;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .output-section {
        grid-template-columns: 1fr 1fr;
    }
    
    .memory {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .output-section {
        grid-template-columns: 1fr;
    }
    
    .controls-section {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .controls {
        align-self: stretch;
    }
    
    header h1 {
        font-size: 2rem;
    }
}

/* Animation for value changes */
.register span.updated,
.memory-cell.updated {
    animation: highlight 0.5s ease;
}

@keyframes highlight {
    0% { background-color: #000000; color: #ffffff; }
    100% { background-color: inherit; color: inherit; }
}

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

::-webkit-scrollbar-track {
    background: #f0f0f0;
}

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

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