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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-attachment: fixed;
    color: #e0e0e0;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}


/* Page Transition Effects */
body.page-loaded {
    opacity: 1;
}

body.page-exit {
    opacity: 0;
}

.editor-container {
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cursor Trail */
.cursor-trail {
    position: fixed;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    transform: translate(-50%, -50%) scale(1);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.4);
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 14px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: translateX(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.editor-container {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 60px;
}

.editor-header {
    text-align: center;
    margin-bottom: 30px;
}

.editor-header h1 {
    font-size: 42px;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.editor-subtitle {
    font-size: 16px;
    color: #b0b0b0;
    font-style: italic;
}

.editor-wrapper {
    display: flex;
    gap: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toolbar {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

.tool-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tool-section h3 {
    font-size: 14px;
    color: #4a9eff;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 12px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateX(3px);
}

.tool-btn.active {
    background: #4a9eff;
    color: #fff;
    border-color: #4a9eff;
    box-shadow: 0 4px 15px rgba(74, 158, 255, 0.3);
}

.color-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 8px 12px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    width: 100%;
    margin-top: 8px;
}

.color-input:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.2);
}

#colorPicker {
    width: 100%;
    height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
}

#brushSize {
    width: 100%;
    margin-top: 8px;
}

#brushSizeDisplay {
    color: #b0b0b0;
    font-size: 12px;
    text-align: center;
    margin-top: 5px;
}

.zoom-display {
    margin-top: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.zoom-display span {
    color: #4a9eff;
    font-weight: bold;
    font-size: 14px;
}

.canvas-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 20px;
    min-height: 500px;
    position: relative;
    overflow: auto;
    max-width: 100%;
    max-height: calc(100vh - 250px);
}

#canvas {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: crosshair;
    max-width: 100%;
    height: auto;
    transition: transform 0.2s ease;
    display: block;
}

.canvas-overlay {
    position: absolute;
    pointer-events: none;
    display: none;
}

/* Scrollbar styling */
.toolbar::-webkit-scrollbar {
    width: 8px;
}

.toolbar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.toolbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.toolbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

@media (prefers-color-scheme: light) {
    body {
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 50%, #e0e7ff 100%);
        color: #2d3748;
    }

    .back-button {
        background: rgba(0, 0, 0, 0.05);
        color: #2d3748;
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .back-button:hover {
        background: rgba(0, 0, 0, 0.1);
        color: #1a202c;
    }

    .editor-header h1 {
        color: #1a202c;
        text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
    }

    .editor-subtitle {
        color: #4a5568;
    }

    .editor-wrapper {
        background: rgba(255, 255, 255, 0.8);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .tool-section {
        background: rgba(0, 0, 0, 0.03);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }

    .tool-section h3 {
        color: #2563eb;
    }

    .tool-btn {
        background: rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.1);
        color: #2d3748;
    }

    .tool-btn:hover {
        background: rgba(0, 0, 0, 0.08);
        color: #1a202c;
    }

    .tool-btn.active {
        background: #2563eb;
        color: #fff;
        border-color: #2563eb;
        box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    }

    .color-input {
        background: rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.1);
        color: #2d3748;
    }

    .canvas-container {
        background: rgba(0, 0, 0, 0.05);
    }
    
    .zoom-display {
        background: rgba(0, 0, 0, 0.05);
        border: 1px solid rgba(0, 0, 0, 0.1);
    }
    
    .zoom-display span {
        color: #2563eb;
    }
}

@media (max-width: 1024px) {
    .editor-wrapper {
        flex-direction: column;
    }

    .toolbar {
        width: 100%;
        max-height: 300px;
        flex-direction: row;
        flex-wrap: wrap;
        overflow-x: auto;
    }

    .tool-section {
        min-width: 200px;
    }
}

@media (max-width: 600px) {
    .editor-header h1 {
        font-size: 32px;
    }

    .editor-subtitle {
        font-size: 14px;
    }

    .toolbar {
        flex-direction: column;
    }

    .tool-section {
        min-width: 100%;
    }
}

