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

body {
    background: #000080;
    color: #ffffff;
    font-family: 'IBM Plex Mono', 'Courier New', monospace;
    font-size: 13px;
    min-height: 100vh;
    overflow-x: hidden;
}

#app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px;
}

/* Boot Screen */
#boot-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    padding: 20px;
    overflow: hidden;
}

#boot-text {
    color: #aaaaaa;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
}

#boot-text .highlight {
    color: #55ff55;
}

#boot-text .cyan {
    color: #55ffff;
}

/* Header */
#header {
    text-align: center;
    margin-bottom: 10px;
    color: #55ffff;
    font-size: 14px;
    line-height: 1.3;
}

.header-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
}

.header-sub {
    color: #ffff55;
}

.header-border {
    color: #55ffff;
}

.blink {
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* Main Layout */
#main-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

@media (max-width: 1000px) {
    #main-content {
        grid-template-columns: 1fr;
    }
}

/* Panels */
.panel {
    background: #000040;
    border: 1px solid #0000aa;
}

.panel-title {
    color: #55ffff;
    padding: 2px 0;
    font-size: 12px;
}

.panel-body {
    padding: 8px;
}

.panel-bottom {
    color: #55ffff;
    font-size: 12px;
}

/* Drop Zone */
#drop-zone {
    border: 2px dashed #55ffff;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 8px;
    transition: background 0.2s;
}

#drop-zone:hover, #drop-zone.drag-over {
    background: #000080;
    border-color: #ffff55;
}

#drop-zone p {
    color: #55ffff;
}

#drop-zone .small {
    font-size: 10px;
    color: #aaaaaa;
    margin-top: 4px;
}

#file-input {
    display: none;
}

/* Source Canvas */
#source-canvas {
    width: 100%;
    max-height: 200px;
    background: #000000;
    border: 1px solid #333366;
    image-rendering: pixelated;
    display: block;
    margin: 8px 0;
}

/* Webcam */
#webcam-video {
    width: 100%;
    max-height: 180px;
    background: #000;
    border: 1px solid #333366;
    margin: 8px 0;
}

/* Resolution Row */
.resolution-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.resolution-row label {
    color: #55ffff;
    font-size: 11px;
}

.resolution-row select, #palette-select {
    background: #000020;
    color: #55ff55;
    border: 1px solid #55ffff;
    padding: 3px 6px;
    font-family: inherit;
    font-size: 11px;
}

/* DOS Buttons */
.dos-btn {
    display: block;
    width: 100%;
    background: #333366;
    color: #ffffff;
    border: 1px solid #5555ff;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    margin: 4px 0;
    text-align: left;
    transition: all 0.1s;
}

.dos-btn:hover {
    background: #5555ff;
    color: #ffffff;
}

.dos-btn.green {
    border-color: #55ff55;
    color: #55ff55;
}

.dos-btn.green:hover {
    background: #005500;
}

.dos-btn.cyan {
    border-color: #55ffff;
    color: #55ffff;
}

.dos-btn.cyan:hover {
    background: #005555;
}

.dos-btn.yellow {
    border-color: #ffff55;
    color: #ffff55;
}

.dos-btn.yellow:hover {
    background: #555500;
}

/* Controls */
.control-section {
    margin-bottom: 10px;
}

.section-label {
    color: #ffff55;
    margin-bottom: 4px;
    font-size: 11px;
}

/* Bit Depth Buttons */
#bit-depth-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.bit-btn {
    background: #000020;
    color: #aaaaaa;
    border: 1px solid #333366;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    position: relative;
}

.bit-btn:hover {
    color: #ffffff;
    border-color: #5555ff;
}

.bit-btn.active {
    background: #5555ff;
    color: #ffffff;
    border-color: #ffffff;
}

.bit-btn .tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #000000;
    color: #ffff55;
    padding: 4px 8px;
    font-size: 10px;
    white-space: nowrap;
    border: 1px solid #ffff55;
    z-index: 100;
}

.bit-btn:hover .tooltip {
    display: block;
}

/* Dither Options */
#dither-options {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.dither-btn {
    background: #000020;
    color: #aaaaaa;
    border: 1px solid #333366;
    padding: 4px 6px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
}

.dither-btn:hover {
    color: #ffffff;
    border-color: #5555ff;
}

.dither-btn.active {
    background: #005555;
    color: #55ffff;
    border-color: #55ffff;
}

/* Threshold Slider */
#threshold-slider {
    width: 70%;
    margin-right: 8px;
    accent-color: #55ffff;
}

#threshold-val {
    color: #55ff55;
}

/* Output Canvas */
#output-canvas-wrapper {
    position: relative;
    background: #000000;
    border: 1px solid #333366;
    margin-bottom: 8px;
    overflow: hidden;
}

#output-canvas {
    width: 100%;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

#scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.15) 2px,
        rgba(0,0,0,0.15) 4px
    );
}

#file-size-indicator {
    color: #55ff55;
    font-size: 11px;
    margin: 6px 0;
}

#palette-display {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    margin-top: 6px;
}

.palette-swatch {
    width: 12px;
    height: 12px;
    border: 1px solid #555;
}

/* Code Panel */
#code-panel {
    margin-bottom: 10px;
}

#code-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
}

.tab-btn {
    background: #000020;
    color: #aaaaaa;
    border: 1px solid #333366;
    padding: 4px 12px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
}

.tab-btn.active {
    background: #333366;
    color: #55ffff;
    border-color: #55ffff;
}

#code-content {
    background: #000010;
    border: 1px solid #333366;
    padding: 10px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 8px;
}

#code-output {
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Syntax Colors */
.kw { color: #55ffff; }
.str { color: #ffff55; }
.num { color: #ffffff; }
.cmt { color: #55ff55; }
.op { color: #ff55ff; }

/* Footer */
footer {
    text-align: center;
    padding: 10px;
    border-top: 1px solid #333366;
}

footer a {
    color: #55ffff;
    text-decoration: none;
}

footer a:hover {
    color: #ffff55;
}

/* Actions section */
.actions {
    margin-top: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: #000020;
}
::-webkit-scrollbar-thumb {
    background: #333366;
}
::-webkit-scrollbar-thumb:hover {
    background: #5555ff;
}