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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

.container {
    background: white;
    border-radius: 0;
    box-shadow: none;
    padding: 20px;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 15px;
    font-size: 2em;
}

.main-content {
    display: flex;
    gap: 0;
    flex: 1;
    overflow: hidden;
}

.left-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.right-sidebar {
    position: relative;
    width: 200px;
    background: #f8f9fa;
    border-radius: 0;
    transition: all 0.3s ease;
    overflow: hidden;
}

.right-sidebar.hidden {
    width: 40px;
}

.right-sidebar.hidden .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

.toggle-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    border-color: #667eea;
    background: #667eea;
}

.toggle-btn:hover svg {
    color: white;
}

.toggle-btn svg {
    transition: transform 0.3s ease;
}

.right-sidebar.hidden .toggle-btn svg {
    transform: rotate(180deg);
}

.sidebar-content {
    padding: 50px 15px 15px 15px;
    transition: opacity 0.3s ease;
}

.toolbar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 15px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 0;
}

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

.tool-section h3 {
    color: #555;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.button-group.vertical {
    flex-direction: column;
}

.tool-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.tool-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.tool-btn svg {
    width: 20px;
    height: 20px;
}

.color-btn {
    width: 50px;
    height: 50px;
    border: 3px solid #fff;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    outline: 2px solid transparent;
}

.color-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.color-btn.active {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #555;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: flex-start;
}

.action-btn:hover {
    border-color: #764ba2;
    color: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.2);
}

.action-btn:active {
    transform: translateY(0);
}

#deleteBtn:hover {
    border-color: #e74c3c;
    color: #e74c3c;
}

.canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    background: #fff;
    border-radius: 0;
    overflow: hidden;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
    flex: 1;
}

#canvas {
    border: 2px solid #e0e0e0;
    cursor: crosshair;
    background: 
        linear-gradient(90deg, #f5f5f5 1px, transparent 1px),
        linear-gradient(180deg, #f5f5f5 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: -1px -1px;
    display: block;
    width: 100%;
    height: 100%;
}

#canvas.select-mode {
    cursor: default;
}

.info {
    text-align: center;
    color: #666;
    font-size: 14px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 0;
}

#infoText {
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    #canvas {
        max-width: 100%;
        height: auto;
    }

    .tool-btn,
    .action-btn {
        padding: 8px 12px;
        font-size: 12px;
    }

    .color-btn {
        width: 40px;
        height: 40px;
    }
}
