* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}
body { 
    font-family: 'Courier New', monospace;
    background: #1f2937;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ===== DRAWING APP STYLES ===== */

.drawing-app-container {
    width: 100%;
    height: 100%;
    background: #1f2937;
    overflow: hidden;
    position: relative;
}

/* Canvas Styles */
#mainCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #1f2937;
    cursor: crosshair;
    touch-action: none;
    
    /* Canvas performance optimizations */
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* High DPI canvas improvements */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
    #mainCanvas {
        image-rendering: auto;
    }
}

/* Canvas Sidebar */
.canvas-sidebar {
    position: absolute;
    top: 74px; /* Changed from 12px to 68px (12px + 44px button height + 8px gap) */
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 10;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.control-btn:active {
    transform: scale(0.95);
}

.control-btn:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Status Display */
.status-display {
    position: absolute;
    bottom: 12px;
    left: 12px;
    z-index: 10;
}

.status-panel {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
}

/* Tool indicators */
.tool-indicator {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.tool-brush {
    background: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.tool-eraser {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 0 20px;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.close-btn:hover {
    color: #374151;
}

.modal-body {
    padding: 0 20px;
}

.modal-footer {
    padding: 16px 20px 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 8px;
}

.setting-group input[type="range"] {
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    appearance: none;
}

.setting-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #f97316;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.setting-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #f97316;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    cursor: pointer;
}

.setting-group input[type="color"] {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    padding: 0;
}

.setting-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.setting-group input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.setting-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    color: #374151;
}

.btn-primary {
    background: #f97316;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background: #ea580c;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .canvas-sidebar {
        top: 74px; /* Adjusted for mobile (8px + 40px button height + 8px gap) */
        right: 8px;
        padding: 8px;
        border-radius: 12px;
    }

    .control-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .status-display {
        bottom: 8px;
        left: 8px;
        right: 8px;
    }

    .status-display .status-panel {
        width: 100%;
    }

    .status-display .flex {
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
        font-size: 12px;
    }

    .status-panel {
        padding: 8px 12px;
        font-size: 12px;
    }

    .modal-content {
        margin: 10px;
        max-width: none;
    }
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.space-x-2 > * + * {
    margin-left: 0.5rem;
}

.space-x-4 > * + * {
    margin-left: 1rem;
}