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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    touch-action: none;
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif;
    background: #fffbeb;
}

body {
    display: flex;
    flex-direction: column;
    position: relative;
}

header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    z-index: 20;
    pointer-events: none;
}

header * {
    pointer-events: auto;
}

.back-btn {
    background: white;
    padding: 10px 20px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: bold;
    color: #d97706;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.back-btn:hover, .back-btn:active {
    transform: scale(1.05);
    background: #fef3c7;
}

header h1 {
    font-size: 1.6rem;
    color: #d97706;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.1);
    flex: 1;
    text-align: center;
    margin-right: 10px;
}

.fullscreen-btn {
    font-size: 1.5rem;
    background: rgba(255,255,255,0.8);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: transform 0.2s;
    flex-shrink: 0;
    text-decoration: none;
    color: inherit;
}
.fullscreen-btn:active {
    transform: scale(0.9);
}

#paint-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    cursor: crosshair;
    touch-action: none;
}

#palette {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 12px 18px;
    border-radius: 50px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border: 4px solid #fde68a;
    z-index: 20;
}

.color-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

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

.color-btn.active {
    border-color: #9ca3af;
    transform: scale(1.15);
    box-shadow: 0 0 0 3px white, 0 0 0 5px #d1d5db;
}

.divider {
    width: 3px;
    height: 40px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 0 4px;
}

.tool-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 3px solid transparent;
    background: #f3f4f6;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover, .tool-btn:active {
    transform: scale(1.1);
    background: #e5e7eb;
}

@media (min-width: 768px) {
    .color-btn {
        width: 55px;
        height: 55px;
    }
    .tool-btn {
        width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }
    #palette {
        gap: 14px;
        padding: 14px 24px;
    }
}

@media (max-width: 400px) {
    .color-btn {
        width: 36px;
        height: 36px;
    }
    .tool-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }
    #palette {
        gap: 6px;
        padding: 8px 12px;
    }
    header h1 {
        font-size: 1.2rem;
    }
}