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

body {
    background: #0a0a0a;
    color: #e0e0e0;
    font-family: 'Special Elite', monospace;
    min-height: 100vh;
    overflow-x: hidden;
}

#static-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><rect fill="%23fff" width="1" height="1" x="0" y="0" opacity="0.03"/></svg>');
    background-size: 4px 4px;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
}

#app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
}

/* Header */
#header {
    text-align: center;
    padding: 15px 10px;
    background: linear-gradient(180deg, #1a0a0a 0%, #0a0a0a 100%);
    border-bottom: 2px solid #cc0000;
}

#header h1 {
    font-family: 'Creepster', cursive;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: #cc0000;
    text-shadow: 2px 2px #000, -1px -1px #00ff00;
    letter-spacing: 3px;
    animation: flicker 3s infinite;
}

.glitch {
    position: relative;
}

.subtitle {
    font-family: 'Permanent Marker', cursive;
    color: #cc0000;
    font-size: clamp(0.7rem, 2vw, 1rem);
    margin-top: 5px;
    opacity: 0.8;
    animation: pulse 2s infinite;
}

@keyframes flicker {
    0%, 90%, 100% { opacity: 1; }
    92% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.7; }
}

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

/* Main Content */
#main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Toolbar */
#toolbar {
    width: 80px;
    background: linear-gradient(90deg, #151515 0%, #0f0f0f 100%);
    border-right: 1px solid #333;
    padding: 10px 5px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.tool-section {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tool-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #aaa;
    padding: 8px 5px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 10px;
    font-family: 'Special Elite', monospace;
}

.tool-btn:hover {
    background: #2a1a1a;
    border-color: #cc0000;
    color: #cc0000;
}

.tool-btn.active {
    background: #2a0a0a;
    border-color: #cc0000;
    color: #cc0000;
    box-shadow: 0 0 10px rgba(204, 0, 0, 0.3);
}

.tool-icon {
    font-size: 18px;
}

.tool-label {
    font-size: 8px;
    text-transform: uppercase;
}

.size-label {
    font-size: 9px;
    color: #666;
    text-align: center;
}

#brush-size {
    width: 100%;
    accent-color: #cc0000;
}

.colors {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}

.color-btn {
    width: 25px;
    height: 25px;
    border: 2px solid #333;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover, .color-btn.active {
    border-color: #fff;
    transform: scale(1.1);
}

/* Canvas Container */
#canvas-container {
    flex: 1;
    position: relative;
    background: #0a0a0a;
    overflow: hidden;
}

#canvas {
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

#drop-zone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 10, 0.95);
    border: 3px dashed #333;
    cursor: pointer;
    transition: all 0.3s;
}

#drop-zone.hidden {
    display: none;
}

#drop-zone.dragover {
    border-color: #cc0000;
    background: rgba(30, 10, 10, 0.95);
}

.drop-content {
    text-align: center;
    color: #666;
}

.drop-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 10px;
}

.drop-content .small {
    font-size: 12px;
    opacity: 0.6;
}

/* Sidebar */
#sidebar {
    width: 220px;
    background: linear-gradient(270deg, #151515 0%, #0f0f0f 100%);
    border-left: 1px solid #333;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.panel {
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 12px;
}

.panel h3 {
    font-family: 'Permanent Marker', cursive;
    color: #cc0000;
    font-size: 14px;
    margin-bottom: 10px;
    text-align: center;
}

.action-btn {
    width: 100%;
    background: linear-gradient(180deg, #2a0a0a 0%, #1a0505 100%);
    border: 1px solid #cc0000;
    color: #cc0000;
    padding: 10px;
    font-family: 'Special Elite', monospace;
    font-size: 11px;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #3a0a0a;
    box-shadow: 0 0 15px rgba(204, 0, 0, 0.4);
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-group {
    margin: 10px 0;
}

.slider-group label {
    display: block;
    font-size: 10px;
    color: #888;
    margin-bottom: 5px;
}

.slider-group input[type="range"] {
    width: 100%;
    accent-color: #cc0000;
}

#theme-select {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #cc0000;
    padding: 8px;
    font-family: 'Special Elite', monospace;
    font-size: 11px;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 10px;
}

.preset-btn {
    background: #0a0a0a;
    border: 1px solid #444;
    color: #888;
    padding: 6px 4px;
    font-size: 8px;
    font-family: 'Permanent Marker', cursive;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: #cc0000;
    color: #cc0000;
}

#custom-text {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #cc0000;
    padding: 8px;
    font-family: 'Permanent Marker', cursive;
    font-size: 12px;
}

#custom-text::placeholder {
    color: #444;
}

/* Bottom Bar */
#bottom-bar {
    background: #111;
    border-top: 1px solid #333;
    padding: 10px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    align-items: center;
}

.control-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.control-btn {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #aaa;
    padding: 8px 12px;
    font-family: 'Special Elite', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.control-btn:hover {
    border-color: #888;
    color: #fff;
}

.control-btn.danger {
    border-color: #660000;
    color: #aa0000;
}

.control-btn.danger:hover {
    background: #2a0a0a;
    border-color: #cc0000;
}

.control-btn.save {
    border-color: #006600;
    color: #00aa00;
}

.control-btn.save:hover {
    background: #0a2a0a;
    border-color: #00cc00;
}

.control-btn.chaos {
    border-color: #666600;
    color: #aaaa00;
}

.control-btn.chaos:hover {
    background: #2a2a0a;
    border-color: #cccc00;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

#url-input {
    background: #0a0a0a;
    border: 1px solid #333;
    color: #cc0000;
    padding: 8px;
    font-family: 'Special Elite', monospace;
    font-size: 11px;
    width: 180px;
}

/* Footer */
footer {
    text-align: center;
    padding: 15px;
    background: #080808;
    border-top: 1px solid #222;
}

.footer-text {
    color: #444;
    font-size: 11px;
}

.footer-link {
    color: #cc0000;
    text-decoration: none;
}

.footer-link:hover {
    text-decoration: underline;
}

.disclaimer {
    font-size: 9px;
    color: #333;
    margin-top: 5px;
    font-style: italic;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #1a1a1a;
    border: 2px solid #cc0000;
    padding: 25px;
    max-width: 400px;
    width: 90%;
}

#modal-text-input {
    width: 100%;
    background: #0a0a0a;
    border: 1px solid #333;
    color: #cc0000;
    padding: 12px;
    font-family: 'Permanent Marker', cursive;
    font-size: 16px;
    margin-bottom: 15px;
}

.modal-content button {
    width: 48%;
    padding: 10px;
    font-family: 'Special Elite', monospace;
    cursor: pointer;
    margin: 0 1%;
}

#modal-confirm {
    background: #2a0a0a;
    border: 1px solid #cc0000;
    color: #cc0000;
}

#modal-cancel {
    background: #1a1a1a;
    border: 1px solid #444;
    color: #888;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    #main-content {
        flex-direction: column;
    }
    
    #toolbar {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        padding: 8px;
        border-right: none;
        border-bottom: 1px solid #333;
    }
    
    .tool-section {
        flex-direction: row;
    }
    
    .tool-btn {
        min-width: 50px;
    }
    
    #sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        border-left: none;
        border-top: 1px solid #333;
    }
    
    .panel {
        flex: 1;
        min-width: 200px;
    }
    
    #canvas-container {
        min-height: 300px;
    }
    
    #bottom-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .control-group {
        justify-content: center;
    }
    
    #url-input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    #header h1 {
        font-size: 1.2rem;
    }
    
    .preset-grid {
        grid-template-columns: 1fr;
    }
    
    .tool-label {
        display: none;
    }
    
    .tool-btn {
        min-width: 40px;
        padding: 6px;
    }
    
    .control-btn {
        padding: 6px 8px;
        font-size: 10px;
    }
}