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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0d0d1a;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

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

/* ─── UI ─── */
#ui {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 50px;
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 10;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mode-btn {
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.35);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mode-btn::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    transform: scale(1.1);
}

.mode-btn:active {
    transform: scale(0.9);
}

.mode-btn.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    box-shadow: 0 0 24px rgba(255,255,255,0.08);
    transform: scale(1.05);
}

.mode-btn.active::after {
    border-color: rgba(255,255,255,0.2);
}

.ui-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,0.08);
    margin: 0 4px;
}

#clearBtn {
    color: rgba(255,100,100,0.4);
}

#clearBtn:hover {
    color: rgba(255,100,100,0.85);
    background: rgba(255,100,100,0.1);
}

/* ─── Хинт ─── */
#hint {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.2);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
    letter-spacing: 0.5px;
    pointer-events: none;
    transition: opacity 0.8s ease;
    z-index: 5;
    white-space: nowrap;
    text-shadow: 0 0 20px rgba(255,255,255,0.05);
}

/* ─── Счётчик пятен ─── */
#blob-count {
    position: fixed;
    top: 20px;
    right: 20px;
    color: rgba(255,255,255,0.12);
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 12px;
    letter-spacing: 1px;
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.5s ease;
}

/* ─── Адаптив ─── */
@media (max-width: 480px) {
    #ui {
        bottom: 20px;
        gap: 6px;
        padding: 6px 12px;
    }
    .mode-btn {
        width: 40px;
        height: 40px;
        font-size: 17px;
    }
    .ui-divider {
        height: 22px;
    }
    #hint {
        bottom: 80px;
        font-size: 12px;
    }
    #blob-count {
        top: 12px;
        right: 12px;
        font-size: 10px;
    }
}
