:root {
    --dos-blue: #0000AA;
    --dos-light-blue: #5555FF;
    --dos-cyan: #55FFFF;
    --dos-yellow: #FFFF55;
    --dos-white: #FFFFFF;
    --dos-gray: #AAAAAA;
    --dos-dark-gray: #555555;
    --dos-dialog-bg: #C0C0C0;
    --dos-black: #000000;
    --dos-green: #55FF55;
}

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

body {
    background: var(--dos-blue);
    font-family: 'VT323', 'Courier New', monospace;
    color: var(--dos-white);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Scanline overlay */
.scanlines {
    position: relative;
}
.scanlines::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.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 10;
}

/* DOS window styling */
.dos-window {
    border: 2px solid var(--dos-white);
    box-shadow: 
        inset 1px 1px 0 var(--dos-gray),
        inset -1px -1px 0 var(--dos-dark-gray),
        2px 2px 0 rgba(0,0,0,0.5);
}

.dos-titlebar {
    background: var(--dos-white);
    color: var(--dos-blue);
    padding: 2px 8px;
    font-family: 'VT323', monospace;
    font-size: 18px;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dos-titlebar-buttons {
    display: flex;
    gap: 2px;
}

.dos-titlebar-btn {
    width: 18px;
    height: 18px;
    background: var(--dos-dialog-bg);
    border: 1px outset var(--dos-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--dos-black);
    cursor: default;
    line-height: 1;
}

/* DOS button */
.dos-btn {
    font-family: 'VT323', monospace;
    font-size: 18px;
    background: var(--dos-dialog-bg);
    color: var(--dos-black);
    border: 2px outset var(--dos-white);
    padding: 4px 16px;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.dos-btn:active {
    border-style: inset;
}
.dos-btn:hover {
    background: #D0D0D0;
}

/* DOS radio/checkbox */
.dos-radio, .dos-checkbox {
    font-family: 'VT323', monospace;
    font-size: 20px;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--dos-yellow);
}

.dos-radio input, .dos-checkbox input {
    display: none;
}

.dos-radio .indicator {
    width: 16px;
    height: 16px;
    border: 2px inset var(--dos-white);
    background: var(--dos-black);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dos-radio input:checked + .indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--dos-cyan);
    border-radius: 50%;
}

.dos-checkbox .indicator {
    width: 16px;
    height: 16px;
    border: 2px inset var(--dos-white);
    background: var(--dos-black);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.dos-checkbox input:checked + .indicator::after {
    content: '✓';
    color: var(--dos-cyan);
}

/* DOS select */
.dos-select {
    font-family: 'VT323', monospace;
    font-size: 18px;
    background: var(--dos-black);
    color: var(--dos-cyan);
    border: 2px inset var(--dos-white);
    padding: 4px 8px;
    cursor: pointer;
    outline: none;
}

.dos-select option {
    background: var(--dos-black);
    color: var(--dos-cyan);
}

/* Slider */
.dos-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: var(--dos-black);
    border: 2px inset var(--dos-white);
    outline: none;
}
.dos-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 20px;
    background: var(--dos-dialog-bg);
    border: 2px outset var(--dos-white);
    cursor: pointer;
}
.dos-slider::-moz-range-thumb {
    width: 14px;
    height: 20px;
    background: var(--dos-dialog-bg);
    border: 2px outset var(--dos-white);
    cursor: pointer;
}

/* ASCII border box */
.ascii-border {
    position: relative;
    padding: 12px;
}

/* Drop zone */
.drop-zone {
    border: 3px dashed var(--dos-gray);
    background: rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    cursor: pointer;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.drop-zone.active {
    border-color: var(--dos-cyan);
    background: rgba(85, 255, 255, 0.1);
}

/* Code area */
.code-area {
    background: var(--dos-blue);
    color: var(--dos-yellow);
    font-family: 'VT323', monospace;
    font-size: 16px;
    border: none;
    outline: none;
    resize: none;
    width: 100%;
    white-space: pre;
    overflow: auto;
    padding: 8px;
    line-height: 1.3;
}

/* Preview area */
.preview-canvas {
    background: var(--dos-black);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

/* CRT effect on preview */
.crt-effect {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}
.crt-effect::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.15) 1px,
        rgba(0, 0, 0, 0.15) 3px
    );
    pointer-events: none;
    z-index: 5;
}
.crt-effect::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(
        ellipse at center,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
    z-index: 6;
}

/* Blinking cursor */
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}
.blink {
    animation: blink 1s step-end infinite;
}

/* Glow text */
.glow-text {
    text-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}
::-webkit-scrollbar-track {
    background: var(--dos-dark-gray);
    border: 1px solid var(--dos-gray);
}
::-webkit-scrollbar-thumb {
    background: var(--dos-dialog-bg);
    border: 2px outset var(--dos-white);
}
::-webkit-scrollbar-corner {
    background: var(--dos-dialog-bg);
}

/* Toast notification */
.dos-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--dos-dialog-bg);
    color: var(--dos-black);
    border: 2px outset var(--dos-white);
    padding: 12px 20px;
    font-family: 'VT323', monospace;
    font-size: 20px;
    z-index: 1000;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Error dialog */
.dos-error-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
}

.dos-error-dialog {
    background: var(--dos-dialog-bg);
    border: 2px outset var(--dos-white);
    padding: 0;
    min-width: 350px;
    max-width: 90vw;
    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
}

.dos-error-titlebar {
    background: #AA0000;
    color: var(--dos-white);
    padding: 4px 8px;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dos-error-body {
    padding: 20px;
    color: var(--dos-black);
    font-size: 20px;
    text-align: center;
}

/* Line numbers */
.line-numbers {
    color: var(--dos-dark-gray);
    user-select: none;
    text-align: right;
    padding-right: 8px;
    border-right: 1px solid var(--dos-dark-gray);
    min-width: 50px;
}

/* Mobile tweaks */
@media (max-width: 768px) {
    .dos-titlebar { font-size: 14px; }
    .code-area { font-size: 12px; }
}