* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', Courier, monospace;
    background-color: #352879;
    color: #6C5EB5;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.c64-container {
    width: 1200px;
    height: 800px;
    background-color: #352879;
    border: 4px solid #6C5EB5;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.c64-header {
    background-color: #6C5EB5;
    color: #352879;
    padding: 8px 16px;
    border-bottom: 2px solid #352879;
}

.c64-branding {
    font-weight: bold;
    font-size: 14px;
    letter-spacing: 1px;
}

.c64-info {
    font-size: 11px;
    margin-top: 2px;
}

.c64-menu-bar {
    background-color: #4A3A8C;
    padding: 6px 8px;
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #352879;
    flex-wrap: wrap;
}

.menu-btn {
    background-color: #6C5EB5;
    color: #352879;
    border: 1px solid #352879;
    padding: 4px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-btn:hover {
    background-color: #8B7BC5;
}

.menu-btn:active {
    background-color: #352879;
    color: #6C5EB5;
}

.run-btn {
    background-color: #5EB56C;
}

.run-btn:hover {
    background-color: #7BC58B;
}

.stop-btn {
    background-color: #B56C5E;
}

.stop-btn:hover {
    background-color: #C58B7B;
}

.c64-main {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.editor-panel,
.terminal-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 2px solid #6C5EB5;
    margin: 4px;
    background-color: #2A1F5C;
}

.panel-header {
    background-color: #4A3A8C;
    color: #6C5EB5;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: bold;
    border-bottom: 1px solid #6C5EB5;
}

.basic-editor {
    flex: 1;
    background-color: #2A1F5C;
    color: #6C5EB5;
    border: none;
    padding: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    outline: none;
    overflow-y: auto;
}

.basic-editor::placeholder {
    color: #4A3A8C;
}

.basic-editor::-webkit-scrollbar {
    width: 12px;
}

.basic-editor::-webkit-scrollbar-track {
    background: #2A1F5C;
}

.basic-editor::-webkit-scrollbar-thumb {
    background: #4A3A8C;
    border: 1px solid #6C5EB5;
}

.basic-editor::-webkit-scrollbar-thumb:hover {
    background: #6C5EB5;
}

.terminal-output {
    flex: 1;
    background: radial-gradient(circle at top left, #2A1F5C 0%, #1A0F3C 100%);
    color: #8B7BC5;
    padding: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.4;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-shadow: 0 0 5px rgba(139, 123, 197, 0.3);
    position: relative;
}

.terminal-output::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(108, 94, 181, 0.03) 2px,
        rgba(108, 94, 181, 0.03) 4px
    );
    pointer-events: none;
    z-index: 0;
}

.terminal-output > * {
    position: relative;
    z-index: 1;
}

.game-canvas-container {
    flex: 1;
    background-color: #2A1F5C;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.game-canvas {
    background-color: #1A0F3C;
    border: 2px solid #6C5EB5;
    display: block;
    max-width: 100%;
    max-height: calc(100% - 40px);
}

.game-controls-hint {
    color: #8B7BC5;
    font-size: 11px;
    margin-top: 8px;
    text-align: center;
    font-family: 'Courier New', Courier, monospace;
}

.terminal-output::-webkit-scrollbar {
    width: 12px;
}

.terminal-output::-webkit-scrollbar-track {
    background: #2A1F5C;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: #4A3A8C;
    border: 1px solid #6C5EB5;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #6C5EB5;
}

.input-container {
    background-color: #2A1F5C;
    border-top: 1px solid #6C5EB5;
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-prompt {
    color: #6C5EB5;
    font-size: 14px;
    font-weight: bold;
}

.input-field {
    flex: 1;
    background-color: #2A1F5C;
    color: #6C5EB5;
    border: 1px solid #6C5EB5;
    padding: 4px 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    outline: none;
}

.input-field:focus {
    border-color: #8B7BC5;
    background-color: #352879;
}

.c64-status-bar {
    background-color: #4A3A8C;
    color: #6C5EB5;
    padding: 4px 8px;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
    border-top: 2px solid #352879;
}

#status-line {
    font-weight: bold;
}

.error-message {
    color: #B56C5E;
}

.success-message {
    color: #5EB56C;
}

/* Cursor blinking effect */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.cursor {
    display: inline-block;
    width: 8px;
    height: 14px;
    background-color: #5EB56C;
    animation: blink 1s infinite;
    margin-left: 2px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #352879;
    border: 4px solid #6C5EB5;
    width: 800px;
    max-width: 90%;
    max-height: 80%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.modal-header {
    background-color: #6C5EB5;
    color: #352879;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #352879;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: bold;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #352879;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #2A1F5C;
}

.modal-body {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.samples-search-container {
    margin-bottom: 16px;
}

.samples-search {
    width: 100%;
    background-color: #2A1F5C;
    color: #6C5EB5;
    border: 2px solid #6C5EB5;
    padding: 10px 12px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.samples-search:focus {
    border-color: #8B7BC5;
    background-color: #352879;
}

.samples-search::placeholder {
    color: #4A3A8C;
}

.samples-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sample-category {
    font-weight: bold;
    font-size: 12px;
    color: #8B7BC5;
    margin-top: 12px;
    margin-bottom: 4px;
    padding: 4px 0;
    border-bottom: 1px solid #4A3A8C;
}

.sample-category:first-child {
    margin-top: 0;
}

.sample-item {
    background-color: #2A1F5C;
    border: 2px solid #6C5EB5;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sample-item:hover {
    background-color: #4A3A8C;
    border-color: #8B7BC5;
}

.sample-title {
    font-weight: bold;
    font-size: 14px;
    color: #6C5EB5;
    margin-bottom: 4px;
}

.sample-description {
    font-size: 11px;
    color: #8B7BC5;
    margin-bottom: 6px;
}

.sample-preview {
    font-size: 10px;
    color: #6C5EB5;
    font-family: 'Courier New', Courier, monospace;
    white-space: pre-wrap;
    max-height: 60px;
    overflow: hidden;
    background-color: #1A0F3C;
    padding: 6px;
    border: 1px solid #4A3A8C;
}

/* Dialog Modal Styles */
.dialog-content {
    width: 500px;
    max-width: 90%;
}

.dialog-message {
    color: #6C5EB5;
    font-size: 14px;
    margin-bottom: 16px;
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
}

.dialog-input-container {
    margin-bottom: 16px;
}

.dialog-input {
    width: 100%;
    background-color: #2A1F5C;
    color: #6C5EB5;
    border: 2px solid #6C5EB5;
    padding: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    outline: none;
}

.dialog-input:focus {
    border-color: #8B7BC5;
    background-color: #352879;
}

.dialog-list {
    max-height: 200px;
    overflow-y: auto;
    background-color: #2A1F5C;
    border: 2px solid #6C5EB5;
    padding: 8px;
    margin-bottom: 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: #6C5EB5;
    white-space: pre-wrap;
}

.dialog-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding: 12px 16px;
    background-color: #4A3A8C;
    border-top: 2px solid #352879;
}

.dialog-btn {
    background-color: #6C5EB5;
    color: #352879;
    border: 1px solid #352879;
    padding: 6px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dialog-btn:hover {
    background-color: #8B7BC5;
}

.dialog-btn:active {
    background-color: #352879;
    color: #6C5EB5;
}
