/* Glassmorphism & Modern UI */
:root {
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.5);
    --primary: #333;
    --active: #0070f3;
}

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    overflow: hidden;
    background: #f5f5f5;
    background-image: radial-gradient(#ddd 1px, transparent 1px);
    background-size: 20px 20px;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

#canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.ui-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    pointer-events: auto;
    padding: 10px;
}

/* Header */
.top-bar {
    align-self: center;
    margin-top: 5px;
    display: flex;
    gap: 10px;
}

.social-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.social-btn {
    text-decoration: none;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.5);
}

.icon-btn {
    border: none;
    background: transparent;
    font-size: 18px;
    cursor: pointer;
    padding: 0 8px;
}

/* Footer (Tools) */
.bottom-bar {
    align-self: center;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.tool-row,
.color-row,
.status-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
}

.tool-btn,
.size-btn {
    border: 1px solid #ddd;
    background: #fff;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
}

.tool-btn.active,
.size-btn.active {
    background: var(--active);
    color: white;
    border-color: var(--active);
}

.color-picker-wrapper {
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#colorPicker {
    width: 150%;
    height: 150%;
    margin: -25%;
    cursor: pointer;
    border: none;
    padding: 0;
}

.recent-colors {
    display: flex;
    gap: 6px;
}

.recent-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.recent-swatch.active {
    transform: scale(1.1);
    border-color: #333;
}

.divider,
.divider-v {
    background: rgba(0, 0, 0, 0.1);
}

.divider {
    width: 100%;
    height: 1px;
}

.divider-v {
    width: 1px;
    height: 20px;
    margin: 0 5px;
}

.status-row {
    font-size: 11px;
    color: #888;
    width: 100%;
    justify-content: space-between;
}

/* Loading */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    z-index: 999;
    display: flex;
    center;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #ccc;
    border-top-color: #333;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}