@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&display=swap');

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

body {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 11px;
    background: #C0C0C0;
    color: #000000;
    overflow: hidden;
}

/* Classic window styling */
.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    border: 2px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
}

/* Menu Bar */
.menu-bar {
    background: #C0C0C0;
    border-bottom: 1px solid #808080;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-items {
    display: flex;
    gap: 16px;
}

.menu-item {
    padding: 2px 8px;
    cursor: pointer;
    border: 1px solid transparent;
}

.menu-item:hover {
    border: 1px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
    background: #E0E0E0;
}

.app-title {
    font-weight: bold;
    font-size: 12px;
}

.system-info {
    font-size: 10px;
    color: #404040;
}

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    min-height: 0;
}

/* Left Sidebar */
.left-sidebar {
    width: 160px;
    background: #C0C0C0;
    border-right: 1px solid #808080;
    padding: 8px;
    overflow-y: auto;
}

.tool-section {
    margin-bottom: 16px;
}

.section-title {
    font-weight: bold;
    margin-bottom: 6px;
    padding: 2px 4px;
    background: #A0A0A0;
    border: 1px solid;
    border-color: #404040 #DFDFDF #DFDFDF #404040;
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
}

.tool-button {
    width: 32px;
    height: 32px;
    background: #C0C0C0;
    border: 1px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
}

.tool-button:hover {
    background: #D0D0D0;
}

.tool-button.active {
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    background: #A0A0A0;
}

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.pattern-preview {
    width: 32px;
    height: 32px;
    border: 1px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
    cursor: pointer;
    background: white;
}

.pattern-preview:hover {
    border-color: #000000;
}

.pattern-preview canvas {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.brush-sizes {
    display: flex;
    gap: 4px;
}

.brush-size {
    width: 28px;
    height: 28px;
    background: #C0C0C0;
    border: 1px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 8px;
    line-height: 1;
}

.brush-size.active {
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    background: #A0A0A0;
}

/* Canvas Area */
.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #A0A0A0;
    padding: 16px;
}

.canvas-wrapper {
    position: relative;
    border: 2px solid;
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    background: white;
}

#mainCanvas, #gridCanvas {
    display: block;
    image-rendering: pixelated;
    cursor: crosshair;
}

#gridCanvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

.canvas-controls {
    position: absolute;
    top: -32px;
    left: 0;
    display: flex;
    gap: 4px;
}

/* Right Sidebar */
.right-sidebar {
    width: 200px;
    background: #C0C0C0;
    border-left: 1px solid #808080;
    padding: 8px;
    overflow-y: auto;
}

.ai-section {
    margin-bottom: 16px;
}

.input-group {
    margin-bottom: 12px;
}

.input-group label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    font-size: 10px;
}

#promptInput {
    width: 100%;
    height: 60px;
    padding: 4px;
    border: 1px solid;
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    background: white;
    font-family: inherit;
    font-size: 10px;
    resize: none;
}

.style-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
}

.style-btn {
    padding: 4px 6px;
    border: 1px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
    background: #C0C0C0;
    font-family: inherit;
    font-size: 9px;
    cursor: pointer;
}

.style-btn.active {
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    background: #A0A0A0;
}

#canvasSizeSelect {
    width: 100%;
    padding: 2px;
    border: 1px solid;
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    background: white;
    font-family: inherit;
    font-size: 10px;
}

.generate-button {
    width: 100%;
    padding: 8px;
    background: #008000;
    color: white;
    border: 2px solid;
    border-color: #00C000 #004000 #004000 #00C000;
    font-family: inherit;
    font-weight: bold;
    font-size: 11px;
    cursor: pointer;
}

.generate-button:hover {
    background: #00A000;
}

.generate-button:disabled {
    background: #808080;
    border-color: #A0A0A0 #606060 #606060 #A0A0A0;
    cursor: not-allowed;
}

.loading-area {
    margin-top: 8px;
    text-align: center;
}

.loading-bar {
    width: 100%;
    height: 16px;
    background: white;
    border: 1px solid;
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    margin-bottom: 4px;
    position: relative;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(45deg, #0000FF, #00FFFF);
    width: 0%;
    transition: width 0.3s;
}

.loading-text {
    font-size: 9px;
    color: #404040;
}

.suggestions {
    margin-top: 12px;
}

.section-subtitle {
    font-size: 9px;
    color: #404040;
    margin-bottom: 4px;
}

.suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}

.suggestion {
    padding: 2px 4px;
    background: #E0E0E0;
    border: 1px solid #808080;
    font-size: 8px;
    cursor: pointer;
    border-radius: 3px;
}

.suggestion:hover {
    background: #F0F0F0;
}

.export-section {
    border-top: 1px solid #808080;
    padding-top: 8px;
}

.export-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

/* Generic retro button */
.retro-button {
    padding: 4px 8px;
    border: 1px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
    background: #C0C0C0;
    font-family: inherit;
    font-size: 9px;
    cursor: pointer;
}

.retro-button:hover {
    background: #D0D0D0;
}

.retro-button:active {
    border-color: #404040 #DFDFDF #DFDFDF #404040;
    background: #A0A0A0;
}

/* Status Bar */
.status-bar {
    background: #C0C0C0;
    border-top: 1px solid #808080;
    padding: 4px 8px;
    display: flex;
    justify-content: space-between;
    font-size: 10px;
}

/* About Dialog */
.about-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.dialog-content {
    background: #C0C0C0;
    border: 2px solid;
    border-color: #DFDFDF #404040 #404040 #DFDFDF;
    padding: 16px;
    width: 300px;
    text-align: center;
}

.dialog-title {
    font-weight: bold;
    margin-bottom: 12px;
    padding: 4px;
    background: #000080;
    color: white;
    margin: -16px -16px 12px -16px;
}

.dialog-text {
    margin-bottom: 16px;
    font-size: 10px;
    line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .left-sidebar {
        width: 120px;
    }
    
    .right-sidebar {
        width: 160px;
    }
    
    .canvas-container {
        padding: 8px;
    }
}

/* Scanline effect (optional) */
.canvas-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.03) 2px,
        rgba(0,0,0,0.03) 4px
    );
    pointer-events: none;
}

/* Pixel-perfect rendering */
canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}